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")
# <codecell> # a small hack to start off import sys pathnameto_eplusscripting = "c:/eppy/eplusscripting/" sys.path.append(pathnameto_eplusscripting) # the above lines will let you run your script from anywhere. # future versions will not need this 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) # <markdowncell> # idf1 now holds all the data to your in you idf file. # # Now that the behind-the-scenes work is done, we can print this file. # <codecell> idf1.printidf() # <markdowncell>
# 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/>. """Name fields may end with Name rather than be Name test this conclusion: just check if the field has a reference""" from modeleditor import IDF from StringIO import StringIO iddname = "../iddfiles/Energy+V8_0_0.idd" IDF.setiddname(iddname) idf = IDF(StringIO("")) idds = idf.idd_info i = 0 bpoint = 5 for fieldidds in idds: i += 1 for fieldidd in fieldidds: if fieldidd.has_key('field') and fieldidd.has_key('reference'): if fieldidd['field'][0].find('Name') != -1: if fieldidd['field'][0] != 'Name': print fieldidd['field'][0], idf.model.dtls[i] if i > bpoint: pass
# (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/>. """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
# 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/>. """examples of pythonic operations on energyplus objects""" # try these out line by line in the python interpreter or in ipython # from idfreader import idfreader import modeleditor 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) # give easy to remember names to objects that you are working on zones = idf.idfobjects['zone'.upper()] # all the zones surfaces = idf.idfobjects['BUILDINGSURFACE:DETAILED'.upper()] # all the surfaces # # first zone - zone0 zone0 = zones[0] # name of zone0 print zone0.Name # allzone names zonenames = [zone.Name for zone in zones] print zonenames
Temp.append(element) listIsNested = keepChecking #determine if outer loop exits TheList = Temp[:] 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',
"""figure out how to switch branches in a loop.""" import sys sys.path.append('../') import copy import modeleditor 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
example:- - surface = allobjects['BUILDINGSURFACE:DETAILED'][0] # a surface - surface.azimuth # gives azimuth of surface - surface.tilt # gives tilt of surface - surface.area # gives area of surface """ # from idfreader import idfreader 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) # bunchdt, data, commdct = idfreader(fname, iddfile) # surfaces = bunchdt['BUILDINGSURFACE:DETAILED'.upper()] # all the surfaces surfaces = idf.idfobjects['BUILDINGSURFACE:DETAILED'.upper()] # all the surfaces # Let us look at the first surface surface = surfaces[0] # WALL-1PF print surface.azimuth # 180.0 print surface.tilt # 0.0 print surface.area # 18.3
# \\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()
# Copyright (c) 2012 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/>. """read an idf file and print it to screen""" # ex_readprint.py from modeleditor import IDF iddfile = "../iddfiles/Energy+V8_0_0.idd" IDF.setiddname(iddfile) fname = "../idffiles/V_7_2/smallfile.idf" idf = IDF(fname) idf.printidf()
# 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()