# <headingcell level=4> # Add a new material to the model # <markdowncell> # TODO # # So far we have been working only with materials that were already in the list. # What if we want to make new material? # Obviously we would use the function 'newidfobject'. # <codecell> idf1.newidfobject("MATERIAL") # <codecell> len(materials) # <markdowncell> # We have 11 items in the materials list. # Let us take a look at the last material in the list, where this fancy new material was added # <codecell> print materials[-1] # <markdowncell>
"""dev work on using IDF class""" import modeleditor from modeleditor import IDF iddfile = "../iddfiles/Energy+V7_2_0.idd" IDF.setiddname(iddfile) fname1 = "../idffiles/V_7_2/smallfile.idf" idf1 = IDF(fname1) # print idf1 fname2 = "../idffiles/V_7_2/constructions.idf" idf2 = IDF(fname2) # # test addidfobject # constr = idf2.idfobjects["construction".upper()][0] # print constr # idf1.addidfobject(constr) # print idf1 # # test newidfobject idf1.newidfobject("ZONE") idf1.printidf() idf1.newidfobject("ZONE", "gumby") idf1.printidf() # for objname in dtls: # for obj in idf.idfobjects[objname]: # print obj
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") loop = idf.getobject('PLANTLOOP', 'p_loop') branch = idf.getobject('BRANCH', 'sb0') # listofcomponents = [pipe1, chiller, pipe2] listofcomponents = [chiller, pipe1, pipe2] newbr = hvacbuilder.replacebranch(idf, loop, branch, listofcomponents, 'Water', False) print newbr.obj # print branch
return TheList loopname = "a_loop" sloop = ['sb0', ['sb1', 'sb2', 'sb3'], 'sb4'] # dloop = ['db0', ['zone1', 'zone2', 'zone3'], 'db4'] dloop = ['zone1', 'zone2', 'zone3'] # makeairloop(idf1, loopname, sloop, dloop) # idf1.saveas("hh1.idf") from StringIO import StringIO import iddv7 IDF.setiddname(StringIO(iddv7.iddtxt)) idf = IDF(StringIO('')) newairloop = idf.newidfobject("AirLoopHVAC".upper(), loopname) fields = SomeFields.a_fields # for use in bunch flnames = [field.replace(' ', '_') for field in fields] # TODO : check if these change too. # simplify naming a_fields = ['Branch List Name', 'Connector List Name', 'Supply Side Inlet Node Name', 'Demand Side Outlet Node Name', 'Demand Side Inlet Node Names',
# 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()