eppy package

Submodules

eppy.bunch_subclass module

Sub class Bunch to represent an IDF object.

exception eppy.bunch_subclass.BadEPFieldError[source]

Bases: AttributeError

An Exception

class eppy.bunch_subclass.EpBunch(obj, objls, objidd, *args, **kwargs)[source]

Bases: munch.Munch

Fields, values, and descriptions of fields in an EnergyPlus IDF object stored in a bunch which is a dict extended to allow access to dict fields as attributes as well as by keys.

checkrange(fieldname)[source]

Check if the value for a field is within the allowed range.

fieldnames

Friendly name for objls.

fieldvalues

Friendly name for obj.

get_referenced_object(fieldname)[source]

Get an object referred to by a field in another object.

For example an object of type Construction has fields for each layer, each of which refers to a Material. This functions allows the object representing a Material to be fetched using the name of the layer.

Returns the first item found since if there is more than one matching item, it is a malformed IDF.

Parameters:
  • referring_object (EpBunch) – The object which contains a reference to another object,
  • fieldname (str) – The name of the field in the referring object which contains the reference to another object.
Returns:

Return type:

EpBunch

get_retaincase(fieldname)[source]

check if the field should retain case

getfieldidd(fieldname)[source]

get the idd dict for this field Will return {} if the fieldname does not exist

getfieldidd_item(fieldname, iddkey)[source]

return an item from the fieldidd, given the iddkey will return and empty list if it does not have the iddkey or if the fieldname does not exist

getrange(fieldname)[source]

Get the allowed range of values for a field.

getreferingobjs(iddgroups=None, fields=None)[source]

Get a list of objects that refer to this object

isequal(fieldname, value, places=7)[source]

return True if the field == value Will retain case if get_retaincase == True for real value will compare to decimal ‘places’

exception eppy.bunch_subclass.RangeError[source]

Bases: ValueError

An Exception

eppy.bunch_subclass.addfunctions(abunch)[source]

add functions to epbunch

eppy.bunch_subclass.almostequal(first, second, places=7, printit=True)[source]

Test if two values are equal to a given number of places. This is based on python’s unittest so may be covered by Python’s license.

eppy.bunch_subclass.checkrange(bch, fieldname)[source]

throw exception if the out of range

eppy.bunch_subclass.extendlist(lst, i, value='')[source]

extend the list so that you have i-th value

eppy.bunch_subclass.get_referenced_object(referring_object, fieldname)[source]

Get an object referred to by a field in another object.

For example an object of type Construction has fields for each layer, each of which refers to a Material. This functions allows the object representing a Material to be fetched using the name of the layer.

Returns the first item found since if there is more than one matching item, it is a malformed IDF.

Parameters:
  • referring_object (EpBunch) – The object which contains a reference to another object,
  • fieldname (str) – The name of the field in the referring object which contains the reference to another object.
Returns:

Return type:

EpBunch

eppy.bunch_subclass.get_retaincase(bch, fieldname)[source]

Check if the field should retain case

eppy.bunch_subclass.getfieldidd(bch, fieldname)[source]

get the idd dict for this field Will return {} if the fieldname does not exist

eppy.bunch_subclass.getfieldidd_item(bch, fieldname, iddkey)[source]

return an item from the fieldidd, given the iddkey will return and empty list if it does not have the iddkey or if the fieldname does not exist

eppy.bunch_subclass.getrange(bch, fieldname)[source]

get the ranges for this field

eppy.bunch_subclass.getreferingobjs(referedobj, iddgroups=None, fields=None)[source]

Get a list of objects that refer to this object

eppy.bunch_subclass.isequal(bch, fieldname, value, places=7)[source]

return True if the field is equal to value

eppy.bunch_subclass.return42(self, *args, **kwargs)[source]
eppy.bunch_subclass.somevalues(ddtt)[source]

returns some values

eppy.bunchhelpers module

some helper files

eppy.bunchhelpers.cleancommdct(commdct)[source]

make all keys in commdct lower case

eppy.bunchhelpers.cleaniddfield(acomm)[source]

make all the keys lower case

eppy.bunchhelpers.intinlist(lst)[source]

test if int in list

eppy.bunchhelpers.makefieldname(namefromidd)[source]

made a field name that can be used by bunch

eppy.bunchhelpers.matchfieldnames(field_a, field_b)[source]

Check match between two strings, ignoring case and spaces/underscores.

Parameters:
  • a (str) –
  • b (str) –
Returns:

Return type:

bool

eppy.bunchhelpers.onlylegalchar(name)[source]

return only legal chars

eppy.bunchhelpers.replaceint(fname, replacewith='%s')[source]

replace int in lst

eppy.bunchhelpers.scientificnotation(val, width=19)[source]

return val in scientific notation if it is wider than ‘width’ chars otherwise return val with no change

eppy.easyopen module

home of easyopen - to easily open an idf file

exception eppy.easyopen.MissingIDDException[source]

Bases: Exception

eppy.easyopen.cleanupversion(ver)[source]

massage the version number so it matches the format of install folder

eppy.easyopen.easyopen(fname, idd=None, epw=None)[source]

automatically set idd and open idf file. Uses version from idf to set correct idd It will work under the following circumstances:

  • the IDF file should have the VERSION object.
  • Needs the version of EnergyPlus installed that matches the IDF version.
  • Energyplus should be installed in the default location.
Parameters:
  • fname (str, StringIO or IOBase) – Filepath IDF file, File handle of IDF file open to read StringIO with IDF contents within
  • idd (str, StringIO or IOBase) – This is an optional argument. easyopen will find the IDD without this arg Filepath IDD file, File handle of IDD file open to read StringIO with IDD contents within
  • epw (str) – path name to the weather file. This arg is needed to run EneryPlus from eppy.
eppy.easyopen.getiddfile(versionid)[source]

find the IDD file of the E+ installation

eppy.easyopen.getoldiddfile(versionid)[source]

find the IDD file of the E+ installation E+ version 7 and earlier have the idd in /EnergyPlus-7-2-0/bin/Energy+.idd

eppy.eppy module

Main module.

eppy.fanpower module

quick and dirty functions for get fan power BHP or Watts

eppy.fanpower.bhp2pascal(bhp, cfm, fan_tot_eff)[source]

return inputs for E+ in pascal and m3/s

eppy.fanpower.bhp2watts(bhp)[source]

convert brake horsepower (bhp) to watts

eppy.fanpower.cfm2m3s(cfm)[source]

convert flow cfm to meter^3/second

eppy.fanpower.fan_bhp(fan_tot_eff, pascal, m3s)[source]

return the fan power in bhp given fan efficiency, Pressure rise (Pa) and flow (m3/s)

eppy.fanpower.fan_maxcfm(ddtt)[source]

return the fan max cfm

eppy.fanpower.fan_watts(fan_tot_eff, pascal, m3s)[source]

return the fan power in watts given fan efficiency, Pressure rise (Pa) and flow (m3/s)

eppy.fanpower.fanpower_bhp(ddtt)[source]

return fan power in bhp given the fan IDF object

eppy.fanpower.fanpower_watts(ddtt)[source]

return fan power in bhp given the fan IDF object

eppy.fanpower.inh2o2pascal(inh2o)[source]

convert pressure in inches of water to Pascals

eppy.fanpower.m3s2cfm(m3s)[source]

convert flow meter^3/second to cfm

eppy.fanpower.pascal2inh2o(pascal)[source]

convert pressure in Pascals to inches of water

eppy.fanpower.watts2bhp(watts)[source]

convert watts to brake horsepower (bhp)

eppy.fanpower.watts2pascal(watts, cfm, fan_tot_eff)[source]

convert and return inputs for E+ in pascal and m3/s

eppy.function_helpers module

helper functions for the functions called by bunchdt

eppy.function_helpers.area(ddtt)[source]

area of the surface

eppy.function_helpers.azimuth(ddtt)[source]

azimuth of the surface

eppy.function_helpers.buildingname(ddtt)[source]

return building name

eppy.function_helpers.fan_maxcfm(ddtt)[source]

return the Maximum_Flow_Rate in cfm

eppy.function_helpers.fanpower_bhp(ddtt)[source]

return fanpower in bhp

eppy.function_helpers.fanpower_watts(ddtt)[source]

return fanpower in watts

eppy.function_helpers.getcoords(ddtt)[source]

return the coordinates of the surface

eppy.function_helpers.grouper(num, iterable, fillvalue=None)[source]

Collect data into fixed-length chunks or blocks

eppy.function_helpers.heatcapacity(ddtt)[source]
eppy.function_helpers.height(ddtt)[source]

height of the surface

eppy.function_helpers.rvalue(ddtt)[source]
eppy.function_helpers.rvalue_ip(ddtt)[source]
eppy.function_helpers.subsurfaces(ddtt)[source]

return al list of surfaces that belong to the zone

eppy.function_helpers.tilt(ddtt)[source]

tilt of the surface

eppy.function_helpers.true_azimuth(ddtt)[source]

true azimuth of the surface

eppy.function_helpers.ufactor(ddtt)[source]
eppy.function_helpers.ufactor_ip(ddtt)[source]
eppy.function_helpers.width(ddtt)[source]

width of the surface

eppy.function_helpers.zonesurfaces(ddtt)[source]

return al list of surfaces that belong to the zone

eppy.hvacbuilder module

make plant loop snippets

class eppy.hvacbuilder.SomeFields[source]

Bases: object

Some fields

a_fields = ['Branch List Name', 'Connector List Name', 'Supply Side Inlet Node Name', 'Demand Side Outlet Node Name', 'Demand Side Inlet Node Names', 'Supply Side Outlet Node Names']
c_fields = ['Condenser Side Inlet Node Name', 'Condenser Side Outlet Node Name', 'Condenser Side Branch List Name', 'Condenser Side Connector List Name', 'Demand Side Inlet Node Name', 'Demand Side Outlet Node Name', 'Condenser Demand Side Branch List Name', 'Condenser Demand Side Connector List Name']
p_fields = ['Plant Side Inlet Node Name', 'Plant Side Outlet Node Name', 'Plant Side Branch List Name', 'Plant Side Connector List Name', 'Demand Side Inlet Node Name', 'Demand Side Outlet Node Name', 'Demand Side Branch List Name', 'Demand Side Connector List Name']
exception eppy.hvacbuilder.WhichLoopError[source]

Bases: Exception

eppy.hvacbuilder.componentsintobranch(idf, branch, listofcomponents, fluid=None)[source]

insert a list of components into a branch fluid is only needed if there are air and water nodes in same object fluid is Air or Water or ‘’. if the fluid is Steam, use Water

eppy.hvacbuilder.connectcomponents(idf, components, fluid=None)[source]

rename nodes so that the components get connected fluid is only needed if there are air and water nodes fluid is Air or Water or ‘’. if the fluid is Steam, use Water

eppy.hvacbuilder.doingtesting(testing, testn, result=None)[source]

doing testing

eppy.hvacbuilder.flattencopy(lst)[source]

flatten and return a copy of the list indefficient on large lists

eppy.hvacbuilder.getbranchcomponents(idf, branch, utest=False)[source]

get the components of the branch

eppy.hvacbuilder.getfieldnamesendswith(idfobject, endswith)[source]

get the filednames for the idfobject based on endswith

eppy.hvacbuilder.getmakeidfobject(idf, key, name)[source]

get idfobject or make it if it does not exist

eppy.hvacbuilder.getnodefieldname(idfobject, endswith, fluid=None, startswith=None)[source]

return the field name of the node fluid is only needed if there are air and water nodes fluid is Air or Water or ‘’. if the fluid is Steam, use Water

eppy.hvacbuilder.initinletoutlet(idf, idfobject, thisnode, force=False)[source]

initialze values for all the inlet outlet nodes for the object. if force == False, it willl init only if field = ‘’

eppy.hvacbuilder.main()[source]

the main routine

eppy.hvacbuilder.makeairloop(idf, loopname, sloop, dloop, testing=None)[source]

make an airloop

eppy.hvacbuilder.makecondenserloop(idf, loopname, sloop, dloop, testing=None)[source]

make condenser loop with pipe components

eppy.hvacbuilder.makeductbranch(idf, bname)[source]

make a branch with a duct use standard inlet outlet names

eppy.hvacbuilder.makeductcomponent(idf, dname)[source]

make a duct component generate inlet outlet names

eppy.hvacbuilder.makepipebranch(idf, bname)[source]

make a branch with a pipe use standard inlet outlet names

eppy.hvacbuilder.makepipecomponent(idf, pname)[source]

make a pipe component generate inlet outlet names

eppy.hvacbuilder.makeplantloop(idf, loopname, sloop, dloop, testing=None)[source]

make plant loop with pip components

eppy.hvacbuilder.renamenodes(idf, fieldtype)[source]

rename all the changed nodes

eppy.hvacbuilder.replacebranch(idf, loop, branch, listofcomponents, fluid=None, debugsave=False, testing=None)[source]

It will replace the components in the branch with components in listofcomponents

eppy.hvacbuilder.replacebranch1(idf, loop, branchname, listofcomponents_tuples, fluid=None, debugsave=False)[source]

do I even use this ? …. yup! I do

eppy.hvacbuilder.returnnone()[source]

return None

eppy.idd_helpers module

helper functions for idd

eppy.idd_helpers.folder2ver(folder)[source]

get the version number from the E+ install folder

eppy.idd_helpers.latestidd()[source]

extract the latest idd installed

eppy.iddcurrent module

current idd

eppy.iddgaps module

idd comments have gaps in them. With ote fields as indicated This code fills those gaps see: SCHEDULE:DAY:LIST as an example

eppy.iddgaps.cleancommdct(commdct)[source]

make all keys in commdct lower case

eppy.iddgaps.cleaniddfield(acomm)[source]

make all the keys lower case

eppy.iddgaps.getfields(comm)[source]

get all the fields that have the key ‘field’

eppy.iddgaps.missingkeys_nonstandard(block, commdct, dtls, objectlist, afield='afiled %s')[source]

This is an object list where thre is no first field name to give a hint of what the first field name should be

eppy.iddgaps.missingkeys_standard(commdct, dtls, skiplist=None)[source]

put missing keys in commdct for standard objects return a list of keys where it is unable to do so commdct is not returned, but is updated

eppy.iddgaps.repeatingfieldsnames(fields)[source]

get the names of the repeating fields

eppy.iddv7 module

eppy.iddv800 module

eppy.idf_helpers module

useful functions that should in the class IDF. write them here first as a development step. If they are really useful and don’t muddy waters include them in IDF and remove them here

eppy.idf_helpers.copyidfintoidf(toidf, fromidf)[source]

copy fromidf completely into toidf

eppy.idf_helpers.getanymentions(idf, anidfobject)[source]

Find out if idjobject is mentioned an any object anywhere

eppy.idf_helpers.getidfkeyswithnodes()[source]

return a list of keys of idfobjects that hve ‘None Name’ fields

eppy.idf_helpers.getidfobjectlist(idf)[source]

return a list of all idfobjects in idf

eppy.idf_helpers.getobject_use_prevfield(idf, idfobject, fieldname)[source]

field=object_name, prev_field=object_type. Return the object

eppy.idf_helpers.getobjectswithnode(idf, nodekeys, nodename)[source]

return all objects that mention this node name

eppy.idf_helpers.idfobjectkeys(idf)[source]

returns the object keys in the order they were in the IDD file it is an ordered list of idf.idfobjects.keys() keys of a dict are unordered, so idf.idfobjects.keys() will not work for this purpose

eppy.idf_helpers.name2idfobject(idf, groupnamess=None, objkeys=None, **kwargs)[source]

return the object, if the Name or some other field is known. send field in **kwargs as Name=’a name’, Roughness=’smooth’ Returns the first find (field search is unordered) objkeys -> if objkeys=[‘ZONE’, ‘Material’], search only those groupnames -> not yet coded

eppy.idf_msequence module

Subclass from collections.MutableSequence to get finer control over a list like object.

This is to work with issue 40 in github:

idf1.idfobjects[‘BUILDING’] is a list and is not connected to idf1.model.dt[‘BUILDING’]

List has to be subclassed to solve this problem.

# Alex Martelli describes how to use collections.MutableSequence in # <http://stackoverflow.com/questions/3487434/overriding-append-method-after-inheriting-from-a-python-list>

class eppy.idf_msequence.Idf_MSequence(list1, list2, theidf)[source]

Bases: collections.abc.MutableSequence

Used to keep IDF.idfobjects in sync with IDF.model.dt.

insert(i, v)[source]

Insert an idfobject (bunch) to list1 and its object to list2.

eppy.idfreader module

use epbunch

class eppy.idfreader.ConvInIDD[source]

Bases: object

hold the conversion function to integer, real and no_type

conv_dict()[source]

dictionary of conversion

integer(x, y)[source]
no_type(x, avar)[source]
real(x, y)[source]
exception eppy.idfreader.NoIDDFieldsError[source]

Bases: Exception

eppy.idfreader.addfunctions(dtls, bunchdt)[source]

add functions to the objects

eppy.idfreader.addfunctions2new(abunch, key)[source]

add functions to a new bunch/munch object

eppy.idfreader.convertafield(field_comm, field_val, field_iddname)[source]

convert field based on field info in IDD

eppy.idfreader.convertallfields(data, commdct, block=None)[source]

docstring for convertallfields

eppy.idfreader.convertfields(key_comm, obj, inblock=None)[source]

convert based on float, integer, and A1, N1

eppy.idfreader.convertfields_old(key_comm, obj, inblock=None)[source]

convert the float and interger fields

eppy.idfreader.endof_extensible(extensible, thisblock)[source]

get the vars from where extension happens

eppy.idfreader.extension_of_extensible(objidd, objblock, n)[source]

generate the list of new vars needed to extend by n

eppy.idfreader.getextensible(objidd)[source]

return the extensible from the idd

eppy.idfreader.iddversiontuple(afile)[source]

given the idd file or filehandle, return the version handle

eppy.idfreader.idfreader(fname, iddfile, conv=True)[source]

read idf file and return bunches

eppy.idfreader.idfreader1(fname, iddfile, theidf, conv=True, commdct=None, block=None)[source]

read idf file and return bunches

eppy.idfreader.makeabunch(commdct, obj, obj_i, debugidd=True, block=None)[source]

make a bunch from the object

eppy.idfreader.makebunches(data, commdct)[source]

make bunches with data

eppy.idfreader.makebunches_alter(data, commdct, theidf, block=None)[source]

make bunches with data

eppy.json_functions module

functions to use json to modify an idf file

eppy.json_functions.key2elements(key)[source]

split key to elements

eppy.json_functions.updateidf(idf, dct)[source]

update idf using dct

eppy.loops module

get the loop data to draw the diagram Other notes: - tested for idd version 6.0 - when E+ is updated, run versionchangecheck.py for the following objects uses the following objects [‘plantloop’, ]

eppy.loops.branch_inlet_outlet(data, commdct, branchname)[source]

return the inlet and outlet of a branch

eppy.loops.branchlist2branches(data, commdct, branchlist)[source]

get branches from the branchlist

eppy.loops.extractfields(data, commdct, objkey, fieldlists)[source]

get all the objects of objkey. fieldlists will have a fieldlist for each of those objects. return the contents of those fields

eppy.loops.getadistus(data, commdct)[source]

docstring for fname

eppy.loops.getfieldindex(data, commdct, objkey, fname)[source]

given objkey and fieldname, return its index

eppy.loops.makeadistu_inlets(data, commdct)[source]

make the dict adistu_inlets

eppy.loops.mixerfields(data, commdct)[source]

get mixer fields to diagram it

eppy.loops.objectcount(data, key)[source]

return the count of objects of key

eppy.loops.plantloopfieldlists(data)[source]

return the plantloopfield list

eppy.loops.plantloopfields(data, commdct)[source]

get plantloop fields to diagram it

eppy.loops.repeatingfields(theidd, commdct, objkey, flds)[source]

return a list of repeating fields fld is in format ‘Component %s Name’ so flds = [fld % (i, ) for i in range(n)] does not work for ‘fields as indicated’

eppy.loops.splitterfields(data, commdct)[source]

get splitter fields to diagram it

eppy.loops.splittermixerfieldlists(data, commdct, objkey)[source]

docstring for splittermixerfieldlists

eppy.modeleditor module

functions to edit the E+ model

exception eppy.modeleditor.IDDAlreadySetError[source]

Bases: Exception

Exception Object

exception eppy.modeleditor.IDDNotSetError[source]

Bases: Exception

Exception Object

class eppy.modeleditor.IDF(idfname=None, epw=None)[source]

Bases: object

The IDF class holds all the information about an EnergyPlus IDF.

iddname

Name of the IDD currently being used by eppy. As a class attribute, this is set for all IDFs which are currently being processed and cannot be changed for an individual IDF.

Type:str
iddinfo

Comments and metadata about fields in the IDD.

Type:list
block

Field names in the IDD.

Type:list
idfname : str
Path to the IDF file.
idfobjects : list
List of EpBunch objects in the IDF.
model : Eplusdata object
Data dictionary and list of objects for the entire model.
outputtype : str
How to format the output of IDF.print or IDF.save, IDF.saveas or IDF.savecopy. The options are: ‘standard’, ‘nocomment’, ‘nocomment1’, ‘nocomment2’, and ‘compressed’.
block = None
copyidfobject(idfobject)[source]

Add an IDF object to the IDF.

Parameters:idfobject (EpBunch object) – The IDF object to remove. This usually comes from another idf file, or it can be used to copy within this idf file.
getextensibleindex(key, name)[source]

Get the index of the first extensible item.

Only for internal use. # TODO : hide this

Parameters:
  • key (str) – The type of IDF object. This must be in ALL_CAPS.
  • name (str) – The name of the object to fetch.
Returns:

Return type:

int

getiddgroupdict()[source]

Return a idd group dictionary sample: {‘Plant-Condenser Loops’: [‘PlantLoop’, ‘CondenserLoop’], ‘Compliance Objects’: [‘Compliance:Building’], ‘Controllers’: [‘Controller:WaterCoil’, ‘Controller:OutdoorAir’, ‘Controller:MechanicalVentilation’, ‘AirLoopHVAC:ControllerList’], …}

Returns:
Return type:dict
classmethod getiddname()[source]

Get the name of the current IDD used by eppy.

Returns:
Return type:str
getobject(key, name)[source]

Fetch an IDF object given key and name.

Parameters:
  • key (str) – The type of IDF object. This must be in ALL_CAPS.
  • name (str) – The name of the object to fetch.
Returns:

Return type:

EpBunch object.

idd_info = None
iddname = None
idfstr()[source]

String representation of the IDF.

Returns:
Return type:str
initnew(fname)[source]

Use the current IDD and create a new empty IDF. If the IDD has not yet been initialised then this is done first.

Parameters:fname (str, optional) – Path to an IDF. This does not need to be set at this point.
initread(idfname)[source]

Use the current IDD and read an IDF from file. If the IDD has not yet been initialised then this is done first.

Parameters:idf_name (str) – Path to an IDF file.
initreadtxt(idftxt)[source]

Use the current IDD and read an IDF from text data. If the IDD has not yet been initialised then this is done first.

Parameters:idftxt (str) – Text representing an IDF file.
new(fname=None)[source]

Create a blank new idf file. Filename is optional.

Parameters:fname (str, optional) – Path to an IDF. This does not need to be set at this point.
newidfobject(key, aname='', defaultvalues=True, **kwargs)[source]

Add a new idfobject to the model. If you don’t specify a value for a field, the default value will be set.

For example

newidfobject("CONSTRUCTION")
newidfobject("CONSTRUCTION",
    Name='Interior Ceiling_class',
    Outside_Layer='LW Concrete',
    Layer_2='soundmat')
Parameters:
  • key (str) – The type of IDF object. This must be in ALL_CAPS.
  • aname (str, deprecated) – This parameter is not used. It is left there for backward compatibility.
  • defaultvalues (boolean) – default is True. If True default values WILL be set. If False, default values WILL NOT be set
  • **kwargs – Keyword arguments in the format field=value used to set the value of fields in the IDF object when it is created.
Returns:

Return type:

EpBunch object

popidfobject(key, index)[source]

Pop an IDF object from the IDF.

Parameters:
  • key (str) – The type of IDF object. This must be in ALL_CAPS.
  • index (int) – The index of the object to pop.
Returns:

Return type:

EpBunch object.

printidf()[source]

Print the IDF.

read()[source]

Read the IDF file and the IDD file. If the IDD file had already been read, it will not be read again.

Read populates the following data structures:

  • idfobjects : list
  • model : list
  • idd_info : list
  • idd_index : dict
removeextensibles(key, name)[source]

Remove extensible items in the object of key and name.

Only for internal use. # TODO : hide this

Parameters:
  • key (str) – The type of IDF object. This must be in ALL_CAPS.
  • name (str) – The name of the object to fetch.
Returns:

Return type:

EpBunch object

removeidfobject(idfobject)[source]

Remove an IDF object from the IDF.

Parameters:idfobject (EpBunch object) – The IDF object to remove.
run(**kwargs)[source]

This method wraps the following method:

rruunn(idf=None, weather=None, output_directory=’’, annual=False, design_day=False, idd=None, epmacro=False, expandobjects=False, readvars=False, output_prefix=None, output_suffix=None, version=False, verbose=’v’, ep_version=None)

Wrapper around the EnergyPlus command line interface.

idf : str
Full or relative path to the IDF file to be run, or an IDF object.
weather : str
Full or relative path to the weather file.
output_directory : str, optional
Full or relative path to an output directory (default: ‘run_outputs)
annual : bool, optional
If True then force annual simulation (default: False)
design_day : bool, optional
Force design-day-only simulation (default: False)
idd : str, optional
Input data dictionary (default: Energy+.idd in EnergyPlus directory)
epmacro : str, optional
Run EPMacro prior to simulation (default: False).
expandobjects : bool, optional
Run ExpandObjects prior to simulation (default: False)
readvars : bool, optional
Run ReadVarsESO after simulation (default: False)
output_prefix : str, optional
Prefix for output file names (default: eplus)
output_suffix : str, optional
Suffix style for output file names (default: L)
L: Legacy (e.g., eplustbl.csv) C: Capital (e.g., eplusTable.csv) D: Dash (e.g., eplus-table.csv)
version : bool, optional
Display version information (default: False)
verbose: str
Set verbosity of runtime messages (default: v)
v: verbose q: quiet
ep_version: str
EnergyPlus version, used to find install directory. Required if run() is called with an IDF file path rather than an IDF object.

str : status

CalledProcessError

AttributeError
If no ep_version parameter is passed when calling with an IDF file path rather than an IDF object.
save(filename=None, lineendings='default', encoding='latin-1')[source]

Save the IDF as a text file with the optional filename passed, or with the current idfname of the IDF.

Parameters:
  • filename (str, optional) – Filepath to save the file. If None then use the IDF.idfname parameter. Also accepts a file handle.
  • lineendings (str, optional) – Line endings to use in the saved file. Options are ‘default’, ‘windows’ and ‘unix’ the default is ‘default’ which uses the line endings for the current system.
  • encoding (str, optional) – Encoding to use for the saved file. The default is ‘latin-1’ which is compatible with the EnergyPlus IDFEditor.
saveas(filename, lineendings='default', encoding='latin-1')[source]

Save the IDF as a text file with the filename passed.

Parameters:
  • filename (str) – Filepath to to set the idfname attribute to and save the file as.
  • lineendings (str, optional) – Line endings to use in the saved file. Options are ‘default’, ‘windows’ and ‘unix’ the default is ‘default’ which uses the line endings for the current system.
  • encoding (str, optional) – Encoding to use for the saved file. The default is ‘latin-1’ which is compatible with the EnergyPlus IDFEditor.
savecopy(filename, lineendings='default', encoding='latin-1')[source]

Save a copy of the file with the filename passed.

Parameters:
  • filename (str) – Filepath to save the file.
  • lineendings (str, optional) – Line endings to use in the saved file. Options are ‘default’, ‘windows’ and ‘unix’ the default is ‘default’ which uses the line endings for the current system.
  • encoding (str, optional) – Encoding to use for the saved file. The default is ‘latin-1’ which is compatible with the EnergyPlus IDFEditor.
classmethod setidd(iddinfo, iddindex, block, idd_version)[source]

Set the IDD to be used by eppy.

Parameters:
  • iddinfo (list) – Comments and metadata about fields in the IDD.
  • block (list) – Field names in the IDD.
classmethod setiddname(iddname, testing=False)[source]

Set the path to the EnergyPlus IDD for the version of EnergyPlus which is to be used by eppy.

Parameters:
  • iddname (str) – Path to the IDD file.
  • testing (bool) – Flag to use if running tests since we may want to ignore the IDDAlreadySetError.
Raises:

IDDAlreadySetError

exception eppy.modeleditor.NoObjectError[source]

Bases: Exception

Exception Object

exception eppy.modeleditor.NotSameObjectError[source]

Bases: Exception

Exception Object

eppy.modeleditor.addobject(bunchdt, data, commdct, key, theidf, aname=None, **kwargs)[source]

add an object to the eplus model

eppy.modeleditor.addobject1(bunchdt, data, commdct, key, **kwargs)[source]

add an object to the eplus model

eppy.modeleditor.addthisbunch(bunchdt, data, commdct, thisbunch, theidf)[source]

add a bunch to model. abunch usually comes from another idf file or it can be used to copy within the idf file

eppy.modeleditor.almostequal(first, second, places=7, printit=True)[source]

Test if two values are equal to a given number of places. This is based on python’s unittest so may be covered by Python’s license.

eppy.modeleditor.equalfield(bunchdt, data, commdct, idfobj1, idfobj2, fieldname, places=7)[source]

returns true if the two fields are equal will test for retaincase places is used if the field is float/real

eppy.modeleditor.extendlist(lst, i, value='')[source]

extend the list so that you have i-th value

eppy.modeleditor.getallobjlists(idf, refname)[source]

get all object-list fields for refname return a list: [(‘OBJKEY’, refname, fieldindexlist), …] where fieldindexlist = index of the field where the object-list = refname

eppy.modeleditor.getextensibleindex(bunchdt, data, commdct, key, objname)[source]

get the index of the first extensible item

eppy.modeleditor.getfieldcomm(bunchdt, data, commdct, idfobject, fieldname)[source]

get the idd comment for the field

eppy.modeleditor.getnamedargs(*args, **kwargs)[source]

allows you to pass a dict and named args so you can pass ({‘a’:5, ‘b’:3}, c=8) and get dict(a=5, b=3, c=8)

eppy.modeleditor.getobject(bunchdt, key, name)[source]

get the object if you have the key and the name returns a list of objects, in case you have more than one You should not have more than one

eppy.modeleditor.getobjects(bunchdt, data, commdct, key, places=7, **kwargs)[source]

get all the objects of key that matches the fields in **kwargs

eppy.modeleditor.getrefnames(idf, objname)[source]

get the reference names for this object

eppy.modeleditor.iddofobject(data, commdct, key)[source]

from commdct, return the idd of the object key

eppy.modeleditor.is_retaincase(bunchdt, data, commdct, idfobject, fieldname)[source]

test if case has to be retained for that field

eppy.modeleditor.isfieldvalue(bunchdt, data, commdct, idfobj, fieldname, value, places=7)[source]

test if idfobj.field == value

eppy.modeleditor.namebunch(abunch, aname)[source]

give the bunch object a name, if it has a Name field

eppy.modeleditor.newrawobject(data, commdct, key, block=None, defaultvalues=True)[source]

Make a new object for the given key.

Parameters:
  • data (Eplusdata object) – Data dictionary and list of objects for the entire model.
  • commdct (list of dicts) – Comments from the IDD file describing each item type in data.
  • key (str) – Object type of the object to add (in ALL_CAPS).
Returns:

A list of field values for the new object.

Return type:

list

eppy.modeleditor.obj2bunch(data, commdct, obj)[source]

make a new bunch object using the data object

eppy.modeleditor.poptrailing(lst)[source]

Remove trailing blank items from lst.

eppy.modeleditor.refname2key(idf, refname)[source]

return all keys that have the reference name

eppy.modeleditor.removeextensibles(bunchdt, data, commdct, key, objname)[source]

remove the extensible items in the object

eppy.modeleditor.rename(idf, objkey, objname, newname)[source]

rename all the refrences to this objname

eppy.modeleditor.zone_floor2roofheight(idf, zonename, debug=False)[source]

zone floor to roof height

eppy.modeleditor.zone_height_min2max(idf, zonename, debug=False)[source]

zone height = max-min

eppy.modeleditor.zonearea(idf, zonename, debug=False)[source]

zone area

eppy.modeleditor.zonearea_floor(idf, zonename, debug=False)[source]

zone area - floor

eppy.modeleditor.zonearea_roofceiling(idf, zonename, debug=False)[source]

zone area - roof, ceiling

eppy.modeleditor.zoneheight(idf, zonename, debug=False)[source]

zone height

eppy.modeleditor.zonevolume(idf, zonename)[source]

zone volume

eppy.pytest_helpers module

helpers for pytest

eppy.pytest_helpers.almostequal(first, second, places=7, printit=True)[source]

docstring for almostequal # taken from python’s unit test # may be covered by Python’s license

eppy.pytest_helpers.do_integration_tests()[source]

Check whether the ‘EPPY_INTEGRATION’ environment variable has been set to do integration tests.

Returns:
Return type:bool

eppy.simpleread module

read the idf file by just parsing the text

eppy.simpleread.idf2txt(txt)[source]

convert the idf text to a simple text

eppy.simpleread.idfreadtest(iddhandle, idfhandle1, idfhandle2, verbose=False, save=False)[source]

compare the results of eppy reader and simple reader

eppy.simpleread.nocomment(astr, com='!')[source]

just like the comment in python. removes any text after the phrase ‘com’

eppy.simplesurface module

from BUILDINGSURFACE:DETAILED and FENESTRATIONSURFACE:DETAILED make a wall floor, celiling etc or a window

exception eppy.simplesurface.NotImplementedError[source]

Bases: Exception

Exception Object

eppy.simplesurface.bsdorigin(bsdobject, setto000=False)[source]

return the origin of the surface

eppy.simplesurface.ceilingadiabatic(idf, bsdobject, deletebsd=True, setto000=False)[source]

return a ceiling:adiabatic if bsdobject (buildingsurface:detailed) is an adiabatic ceiling

eppy.simplesurface.ceilinginterzone(idf, bsdobject, deletebsd=True, setto000=False)[source]

return an ceiling:interzone object if the bsd (buildingsurface:detailed) is an interzone ceiling

eppy.simplesurface.door(idf, fsdobject, deletebsd=True, setto000=False)[source]

return an door object if the fsd (fenestrationsurface:detailed) is a door

eppy.simplesurface.flooradiabatic(idf, bsdobject, deletebsd=True, setto000=False)[source]

return a floor:adiabatic if bsdobject (buildingsurface:detailed) is an adibatic floor

eppy.simplesurface.floorgroundcontact(idf, bsdobject, deletebsd=True, setto000=False)[source]

return a wall:adiabatic if bsdobject (buildingsurface:detailed) is an adibatic wall

eppy.simplesurface.floorinterzone(idf, bsdobject, deletebsd=True, setto000=False)[source]

return an floor:interzone object if the bsd (buildingsurface:detailed) is an interaone floor

eppy.simplesurface.fsdorigin(fsdobject, setto000=False)[source]

return the origin of the surface

eppy.simplesurface.glazeddoor(idf, fsdobject, deletebsd=True, setto000=False)[source]

return an glazeddoor object if the fsd (fenestrationsurface:detailed) is a glassdoor

eppy.simplesurface.roof(idf, bsdobject, deletebsd=True, setto000=False)[source]

return an roof object if the bsd (buildingsurface:detailed) is a roof

eppy.simplesurface.simplefenestration(idf, fsd, deletebsd=True, setto000=False)[source]

convert a bsd (fenestrationsurface:detailed) into a simple fenestrations

eppy.simplesurface.simplesurface(idf, bsd, deletebsd=True, setto000=False)[source]

convert a bsd (buildingsurface:detailed) into a simple surface

eppy.simplesurface.walladiabatic(idf, bsdobject, deletebsd=True, setto000=False)[source]

return a wall:adiabatic if bsdobject (buildingsurface:detailed) is an adibatic wall

eppy.simplesurface.wallexterior(idf, bsdobject, deletebsd=True, setto000=False)[source]

return an wall:exterior object if the (buildingsurface:detailed) is an exterior wall

eppy.simplesurface.wallinterzone(idf, bsdobject, deletebsd=True, setto000=False)[source]

return an wall:interzone object if the bsd (buildingsurface:detailed) is an interaone wall

eppy.simplesurface.wallunderground(idf, bsdobject, deletebsd=True, setto000=False)[source]

return a wall:underground if bsdobject (buildingsurface:detailed) is an underground wall

eppy.simplesurface.window(idf, fsdobject, deletebsd=True, setto000=False)[source]

return an window object if the fsd (fenestrationsurface:detailed) is a window

eppy.snippet module

just a snippet that is used in tests

eppy.walk_hvac module

eppy.walk_hvac.main()[source]
eppy.walk_hvac.nextnode(edges, component)[source]

get the next component in the loop

eppy.walk_hvac.prevnode(edges, component)[source]

get the pervious component in the loop

Module contents

Top-level package for eppy.

eppy.newidf(version=None)[source]

open a new idf file

easy way to open a new idf file for particular version. Works only id Energyplus of that version is installed.

Parameters:version (string) – version of the new file you want to create. Will work only if this version of Energyplus has been installed.
Returns:file of type eppy.modelmake.IDF
Return type:idf
eppy.openidf(fname, idd=None, epw=None)[source]

automatically set idd and open idf file. Uses version from idf to set correct idd It will work under the following circumstances:

  • the IDF file should have the VERSION object.
  • Needs the version of EnergyPlus installed that matches the IDF version.
  • Energyplus should be installed in the default location.
Parameters:
  • fname (str, StringIO or IOBase) – Filepath IDF file, File handle of IDF file open to read StringIO with IDF contents within
  • idd (str, StringIO or IOBase) – This is an optional argument. easyopen will find the IDD without this arg Filepath IDD file, File handle of IDD file open to read StringIO with IDD contents within
  • epw (str) – path name to the weather file. This arg is needed to run EneryPlus from eppy.