Tutorial for pyenergyplus

ex_readprint.py

read an idf file and print it to screen


In [3]:
"""read an idf file and print it to screen"""
# ex_readprint.py

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)
print data # will print the idf file to the terminal

ex_readwrite.py

read a idf file and write it disk


In [ ]:
"""read a idf file and write it disk"""
# ex_readwrite.py

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)

The two lines below show what the print out looks like


In [5]:
txt = str(data)
print txt[:500]


Version,
     7.0;

SimulationControl,
     Yes,
     Yes,
     No,
     No,
     Yes;

Building,
     Building,
     30.,
     City,
     0.04,
     0.4,
     FullExterior,
     25,
     6;

SurfaceConvectionAlgorithm:Inside,
     Simple;

SurfaceConvectionAlgorithm:Outside,
     SimpleCombined;

HeatBalanceAlgorithm,
     ConductionTransferFunction;

Timestep,
     4;

ConvergenceLimits,
     1,
     20,
     4,
     10;

Site:Location,
     CHICAGO_IL_USA TMY2-94846,
     41.78,
     -87.75,

ex_pythonic.py

examples of pythonic operations on energyplus objects


In [6]:
from idfreader import idfreader

iddfile = "../iddfiles/Energy+V7_0_0_036.idd"
fname = "../idffiles/V_7_0/5ZoneSupRetPlenRAB.idf"

In [7]:
bunchdt, data, commdct = idfreader(fname, iddfile)

give easy to remember names to objects that you are working on


In [8]:
# give easy to remember names to objects that you are working on
zones = bunchdt['zone'.upper()] # all the zones
surfaces = bunchdt['BUILDINGSURFACE:DETAILED'.upper()] # all the surfaces

first zone - zone0


In [9]:
# first zone - zone0
zone0 = zones[0]

name of zone0


In [10]:
# name of zone0
print zone0.Name


PLENUM-1

all zone names


In [12]:
# allzone names
zonenames = [zone.Name for zone in zones]
print zonenames


['PLENUM-1', 'SPACE1-1', 'SPACE2-1', 'SPACE3-1', 'SPACE4-1', 'SPACE5-1', 'Sup-PLENUM-1']

zone volumes


In [13]:
zonevolumes = [zone.Volume for zone in zones]
print zonevolumes
# note that zone volumes are strings, not floats
# future version will automatically have them as floats


['283.2', '239.247360229', '103.311355591', '239.247360229', '103.311355591', '447.682556152', '208.6']

In [ ]: