def main(): from StringIO import StringIO import iddv7 IDF.setiddname(StringIO(iddv7.iddtxt)) idf1 = IDF(StringIO('')) loopname = "p_loop" sloop = ['sb0', ['sb1', 'sb2', 'sb3'], 'sb4'] dloop = ['db0', ['db1', 'db2', 'db3'], 'db4'] # makeplantloop(idf1, loopname, sloop, dloop) loopname = "c_loop" sloop = ['sb0', ['sb1', 'sb2', 'sb3'], 'sb4'] dloop = ['db0', ['db1', 'db2', 'db3'], 'db4'] # makecondenserloop(idf1, loopname, sloop, dloop) loopname = "a_loop" sloop = ['sb0', ['sb1', 'sb2', 'sb3'], 'sb4'] dloop = ['zone1', 'zone2', 'zone3'] makeairloop(idf1, loopname, sloop, dloop) idf1.saveas("hh1.idf")
# <markdowncell> # This is easy: # <codecell> idf1.save() # <markdowncell> # If you'd like to do a "Save as..." use this: # <codecell> idf1.saveas("something.idf") # <headingcell level=2> # Working with E+ objects # <markdowncell> # Let us open a small idf file that has only "CONSTRUCTION" and "MATERIAL" objects in it. # You can go into "../idffiles/V_7_2/constructions.idf" and take a look at the file. # We are not printing it here because it is too big. # # So let us open it using the idfreader - # <codecell>
#name and volume of small zones namevolume = [(zn.Name, zn.Volume) for zn in smallzones] print namevolume # number of small zones print len(smallzones) print smallzones[0].Name print smallzones[1].Name #We could rename the small zones by saying # smallzones[0].Name = "FIRST-SMALL-ZONE" # smallzones[1].Name = "SECOND-SMALL-ZONE" # now we have a problem # surfaces still refer to the old zone names # to safely change the name of an idfobject so that all the references are # updated, we do the following: modeleditor.rename(idf, smallzones[0], "FIRST-SMALL-ZONE") modeleditor.rename(idf, smallzones[1], "SECOND-SMALL-ZONE") # now the zone names are: zonenames = [zone.Name for zone in zones] print zonenames # # save to disk and look at the file idf.saveas('bfile.idf') # open the idf file and search for the string "SMALL" # You will find all the places where the name was changed
fld1 = "Supply_Air_Path_Inlet_Node_Name" fld2 = "Demand_Side_Inlet_Node_Names" z_supplypth[fld1] = newairloop[fld2] z_supplypth.Component_1_Object_Type = "AirLoopHVAC:ZoneSplitter" z_supplypth.Component_1_Name = z_splitter.Name # make AirLoopHVAC:ZoneMixer key = "AirLoopHVAC:ZoneMixer".upper() z_mixer = idf.newidfobject(key) z_mixer.Name = "%s Demand Side Mixer" % (loopname, ) z_mixer.Outlet_Node_Name = newairloop.Demand_Side_Outlet_Node_Name for i, zone in enumerate(dloop): z_equipconn = modeleditor.getobjects(idf.idfobjects, idf.model, idf.idd_info, "ZoneHVAC:EquipmentConnections".upper(), #places=7, **dict(Zone_Name=zone))[0] fld = "Inlet_%s_Node_Name" % (i + 1, ) z_mixer[fld] = z_equipconn.Zone_Return_Air_Node_Name # make AirLoopHVAC:ReturnPath key = "AirLoopHVAC:ReturnPath".upper() z_returnpth = idf.newidfobject(key) z_returnpth.Name = "%sReturnPath" % (loopname, ) z_returnpth.Return_Air_Path_Outlet_Node_Name = newairloop.Demand_Side_Outlet_Node_Name z_returnpth.Component_1_Object_Type = "AirLoopHVAC:ZoneMixer" z_returnpth.Component_1_Name = z_mixer.Name idf.saveas('b.idf')
import bunch_subclass from modeleditor import IDF import hvacbuilder from StringIO import StringIO import iddv7 IDF.setiddname(StringIO(iddv7.iddtxt)) idf = IDF(StringIO('')) loopname = "p_loop" sloop = ['sb0', ['sb1', 'sb2', 'sb3'], 'sb4'] dloop = ['db0', ['db1', 'db2', 'db3'], 'db4'] hvacbuilder.makeplantloop(idf, loopname, sloop, dloop) idf.saveas("hhh1.idf") # replacebranch(loop, branch, listofcomponents) # loop = loop of name p_loop # branch = branch of name sb1 # make pipe components np1, np2 # pipe1 = hvacbuilder.makepipecomponent(idf, 'np1') # pipe2 = hvacbuilder.makepipecomponent(idf, 'np2') # idf.saveas("hhh2.idf") pipe1 = idf.newidfobject("PIPE:ADIABATIC", 'np1') chiller = idf.newidfobject("Chiller:Electric".upper(), 'Central_Chiller') pipe2 = idf.newidfobject("PIPE:ADIABATIC", 'np2') # pipe3 = idf.newidfobject("PIPE:ADIABATIC", 'np4') # pipe4 = idf.newidfobject("PIPE:ADIABATIC", 'np4') # idf.saveas("hhh2.idf")
# \\default 5.0 # # """ # # idftxt = """Version,6.0; # """ # iddhandle = StringIO(iddtxt) # # iddhandle = open(iddfile, 'r') # fhandle = StringIO(idftxt) # # bunchdt, data, commdct = idfreader(fhandle, iddhandle) # s = str(data) # open("fsfs.idf", 'w').write(s) # # iddhandle.close() # fhandle.close() # # ----------- # open using IDF iddhandle = open(iddfile, 'r') fhandle = open(fname, 'r') IDF.setiddname(iddhandle) idf1 = IDF(fhandle) idf1.saveas("isis.idf") # idf1.printidf() # s = idf1.asstring() # print s iddhandle.close() fhandle.close()
# Eppy is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with eppy. If not, see <http://www.gnu.org/licenses/>. """read a idf file and write it disk""" # ex_readwrite.py from modeleditor import IDF iddfile = "../iddfiles/Energy+V7_0_0_036.idd" fname = "../idffiles/V_7_0/5ZoneSupRetPlenRAB.idf" IDF.setiddname(iddfile) idf = IDF(fname) outfilename = "afile.idf" idf.saveas(outfilename) # from idfreader import idfreader # # iddfile = "../iddfiles/Energy+V7_0_0_036.idd" # fname = "../idffiles/V_7_0/5ZoneSupRetPlenRAB.idf" # # bunchdt, data, commdct = idfreader(fname, iddfile) # # outfilename = "afile.idf" # txt = str(data) # open(outfilename, 'w').write(txt)
# Copyright (c) 2013 Santosh Philip # This file is part of eppy. # Eppy is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # Eppy is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with eppy. If not, see <http://www.gnu.org/licenses/>. from modeleditor import IDF from StringIO import StringIO import iddv7 IDF.setiddname(StringIO(iddv7.iddtxt)) idf1 = IDF(StringIO('')) ploop = idf1.newidfobject('PLANTLOOP', 'p_loop') cloop = idf1.newidfobject('CONDENSERLOOP', 'c_loop') idf1.outputtype = 'nocomment' idf1.outputtype = 'compressed' idf1.saveas('gumby.idf') # print idf1.idfstr()