我已经成功生成了第一组运行,它只更改了基础文件中的一个值。但是,当我尝试为初始列表(idfs)中的每个运行生成进一步的运行时,它只会生成两组文件,而不是循环遍历每个先前生成的文件。
import eppy
import sys
import os
import numpy as np
pathnameto_eppy = 'c:/eppy'
pathnameto_eppy = '../'
sys.path.append(pathnameto_eppy)
from eppy import modeleditor
from eppy.modeleditor import IDF
iddfile = "C:\EnergyPlusV9-5-0\PreProcess\IDFVersionUpdater\V9-5-0-Energy+.idd"
fname1 = r"C:\Users\Breto\Documents\007 Python Programs\001 Parametrics\OPA OPT South_Shades 90_degrees.idf"
print(iddfile)
IDF.setiddname(iddfile)
EPW=r"C:\\Users\\Breto\\Documents\\007 Python Programs\\001 Parametrics\\CAN_ON_Toronto.716240_CWEC.epw"
idf_init=IDF(idfname=fname1,epw=EPW)
shade1=idf_init.idfobjects['WindowMaterial:SimpleGlazingSystem'][0]
print(shade1)
para_1_valRange=list(np.arange(0.1,1,0.1))
para_1_numruns=int(len(para_1_valRange))
print(para_1_numruns)
print(para_1_valRange)
os.chdir(r"C:\\Users\\Breto\Documents\\007 Python Programs\\001 Parametrics\\")
dir=os.getcwd()
print(dir)
idfs=[]
for i in range(0,para_1_numruns,1):
idf_l=idf_init
glazing=idf_l.idfobjects['WindowMaterial:SimpleGlazingSystem'][0]
glazing.Solar_Heat_Gain_Coefficient = para_1_valRange[i]
idfs.append(idf_l)
idf_l.saveas('OPA {} SHGC.idf'.format(para_1_valRange[i]))
para_2_valRange=np.arange(50,95,5)
print(para_2_valRange)
idfs_2=[]
for idf in idfs:
for i in range(0,len(para_2_valRange),1):
shade2=idf.idfobjects['Shading:Overhang'][0]
shade3=idf.idfobjects['Shading:Overhang'][1]
shade2.Tilt_Angle_from_WindowDoor=para_2_valRange[i]
shade3.Tilt_Angle_from_WindowDoor=para_2_valRange[i]
x=idf.idfobjects['WindowMaterial:SimpleGlazingSystem'][0]
y=x.Solar_Heat_Gain_Coefficient
idfs_2.append(idf)
idf.saveas('OPA {} SHGC_ShadeAngle.idf'.format((y,para_2_valRange[i])))