eppy package

Subpackages

Submodules

eppy.bunch_subclass module

Sub-class of Bunch that represents a single EnergyPlus IDF object.

This module provides the EpBunch class (a dict-like object that also supports attribute access) together with a collection of helper functions that operate on EpBunch instances.

exception eppy.bunch_subclass.BadEPFieldError[source]

Bases: AttributeError

Raised when an unknown or illegal field name is accessed on an EpBunch.

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

Bases: Munch

Dict-like container for a single EnergyPlus IDF object.

Fields, values and the corresponding IDD metadata are stored so that they can be accessed both by key and by attribute. A number of convenience methods for range checking, unit conversion, object references, etc. are also provided.

checkrange(fieldname)[source]

Check whether the current value of a field lies inside its IDD range.

Parameters:

fieldname (str) – Name of the field to validate.

Returns:

The field value itself (unchanged).

Return type:

object

Raises:

RangeError – If the value is outside the allowed range.

property fieldnames

List of field names (friendly alias for objls).

Return type:

list of str

property fieldvalues

List of field values (friendly alias for obj).

Return type:

list

get_ipvalue(fieldname, verbose=False)[source]

Return the value of the field converted to IP units.

Parameters:
  • fieldname (str) – Name of the field.

  • verbose (bool, optional) – If True, return a string that includes the IP value together with a comment in the same style as EpBunch.__repr__ / print_ip (e.g. "39.37    !- Thickness {in}"). Default is False (return only the numeric/IP value).

Returns:

The value expressed in the corresponding IP unit (or the original value when conversion is not possible). When verbose=True a formatted comment string is returned instead.

Return type:

float, int, original type, or str

get_referenced_object(fieldname)[source]

Return the object that is referenced by a field of this object.

For example, a Construction layer field points to a Material; this method returns that Material object.

Parameters:

fieldname (str) – Name of the field that holds the reference.

Returns:

The first matching referenced object, or None if none is found. (More than one match indicates a malformed IDF.)

Return type:

EpBunch or None

get_retaincase(fieldname)[source]

Return whether the field should retain case in comparisons.

Parameters:

fieldname (str) – Name of the field.

Returns:

True if the IDD entry for the field contains the key retaincase, False otherwise.

Return type:

bool

get_sivalue(fieldname, verbose=False)[source]

Return the SI value of the field (optionally with a comment).

Parameters:
  • fieldname (str) – Name of the field.

  • verbose (bool, optional) – If True, return a string that includes the SI value together with a comment in the same style as EpBunch.__repr__ (e.g. "1.0    !- Thickness {m}"). Default is False (return only the raw SI value).

Returns:

The field value, or a formatted comment string when verbose=True.

Return type:

float, int, original type, or str

getfieldidd(fieldname)[source]

Return the complete IDD metadata dictionary for a field.

Parameters:

fieldname (str) – Name of the field.

Returns:

The IDD dictionary for the field, or an empty dict if the field does not exist.

Return type:

dict

getfieldidd_item(fieldname, iddkey)[source]

Return a single item from a field’s IDD dictionary.

Parameters:
  • fieldname (str) – Name of the IDF field.

  • iddkey (str) – Key inside the field’s IDD dictionary (e.g. "units", "type", "minimum", "retaincase").

Returns:

The value stored under iddkey (normally a list), or an empty list if the field or the key does not exist.

Return type:

list

getrange(fieldname)[source]

Return the numeric range constraints defined for a field in the IDD.

Parameters:

fieldname (str) – Name of the field.

Returns:

Dictionary containing the keys maximum, minimum, maximum<, minimum> and type (or None when a constraint is not present).

Return type:

dict

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

Return a list of objects that refer to this object.

Parameters:
  • iddgroups (list of str, optional) – Restrict the search to objects belonging to these IDD groups.

  • fields (list of str, optional) – Restrict the search to these field names.

Returns:

All objects that contain a reference to the current object.

Return type:

list of EpBunch

getunits(fieldname)[source]

Return the SI unit string of a field, or None if none is defined.

Parameters:

fieldname (str) – Name of the field.

Return type:

str or None

property ip

site.ip.Elevation → numeric IP value

Type:

Access fields in IP units

ip_str()[source]

Return the IDF-snippet string with values in IP units.

property ipv

Access fields in IP units with comment: site.ipv.Elevation → e.g. ‘123.0 !- Elevation {ft}’

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

Test whether a field is equal to a given value.

String comparisons respect the retaincase flag; numeric comparisons use a tolerance of places decimal places.

Parameters:
  • fieldname (str) – Name of the field.

  • value (object) – Value to compare against.

  • places (int, optional) – Decimal places used for real/integer comparison (default 7).

Return type:

bool

print_ip()[source]
set_ipvalue(fieldname, ipvalue)[source]

Convert an IP value to SI and store it in the field.

The field’s SI unit is obtained with getunits. The matching default IP unit is obtained with epconversions.defaultipunit. The conversion itself is performed by epconversions.convert2si.

Parameters:
  • fieldname (str) – Name of the IDF field (e.g. "Thickness").

  • ipvalue (float or int) – Numeric value expressed in the default IP unit that corresponds to the field’s SI unit.

Notes

  • If the field has no units the value is stored unchanged.

  • If the conversion cannot be performed the original ipvalue is stored unchanged (same graceful fallback used by print_ip).

property si

Access fields in SI units (same as normal attribute access).

property siv

Access fields in SI units with comment: site.siv.Elevation → e.g. ‘37.5 !- Elevation {m}’

exception eppy.bunch_subclass.RangeError[source]

Bases: ValueError

Raised when a field value lies outside the range defined in the IDD.

eppy.bunch_subclass.addfunctions(abunch)[source]

Attach specialised helper methods to an EpBunch instance.

Depending on the object type (surface, material, fan, zone, …) the appropriate calculation functions (area, r-value, fan power, etc.) are added to the instance’s __functions dictionary.

Parameters:

abunch (EpBunch) – The object that will receive the extra methods.

Returns:

The same object, now with additional functions attached.

Return type:

EpBunch

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

Test whether two numeric values are equal to a given number of places.

This implementation is based on the corresponding method in Python’s unittest module and may therefore be covered by the Python licence.

Parameters:
  • first (float or int) – First value to compare.

  • second (float or int) – Second value to compare.

  • places (int, optional) – Number of decimal places to which the values must agree (default is 7).

  • printit (bool, optional) – If True (default) print a diagnostic message when the values are not almost equal.

Returns:

True if the values agree to the requested number of places, False otherwise.

Return type:

bool

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

Validate that a field value lies inside its IDD range (see EpBunch.checkrange).

Parameters:
  • bch (EpBunch) – The EnergyPlus object that contains the field.

  • fieldname (str) – Name of the field to validate.

Returns:

The field value itself (unchanged).

Return type:

object

Raises:

RangeError – If the value is outside the allowed limits.

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

Extend a list so that index i becomes a valid index.

If i is already inside the list nothing is done; otherwise the list is padded with value up to (and including) index i.

Parameters:
  • lst (list) – The list to be extended (modified in-place).

  • i (int) – Desired index that must become valid.

  • value (object, optional) – Fill value used for the new elements (default is the empty string).

Return type:

None

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

Return the object referenced by a field of referring_object (see EpBunch.get_referenced_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:

The first matching referenced object, or None if none is found.

Return type:

EpBunch or None

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

Return whether the field should retain case (see EpBunch.get_retaincase).

Parameters:
  • bch (EpBunch) – The EnergyPlus object that contains the field.

  • fieldname (str) – Name of the field.

Returns:

True if the IDD entry for the field contains the key retaincase, False otherwise.

Return type:

bool

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

Return the IDD metadata dictionary for a field (see EpBunch.getfieldidd).

Parameters:
  • bch (EpBunch) – The EnergyPlus object that contains the field.

  • fieldname (str) – Name of the field.

Returns:

The IDD dictionary for the field, or an empty dict if the field does not exist.

Return type:

dict

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

Return a single item from a field’s IDD dictionary (see EpBunch.getfieldidd_item).

Parameters:
  • bch (EpBunch) – The EnergyPlus object that contains the field.

  • fieldname (str) – Name of the IDF field.

  • iddkey (str) – Key inside the field’s IDD dictionary (e.g. "units", "type", "minimum", "retaincase").

Returns:

The value stored under iddkey (normally a list), or an empty list if the field or the key does not exist.

Return type:

list

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

Return the numeric range constraints for a field (see EpBunch.getrange).

Parameters:
  • bch (EpBunch) – The EnergyPlus object that contains the field.

  • fieldname (str) – Name of the field.

Returns:

Dictionary containing the keys maximum, minimum, maximum<, minimum> and type (or None when a constraint is not present).

Return type:

dict

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

Return objects that refer to referedobj (see EpBunch.getreferingobjs).

Parameters:
  • referedobj (EpBunch) – The object that is being referred to.

  • iddgroups (list of str, optional) – Restrict the search to objects belonging to these IDD groups.

  • fields (list of str, optional) – Restrict the search to these field names.

Returns:

All objects that contain a reference to referedobj.

Return type:

list of EpBunch

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

Return the SI unit string of a field, or None if the field has no units.

Parameters:
  • bch (EpBunch) – The EnergyPlus object that contains the field.

  • fieldname (str) – Name of the field.

Return type:

str or None

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

Test whether a field equals a value (see EpBunch.isequal).

Parameters:
  • bch (EpBunch) – The EnergyPlus object that contains the field.

  • fieldname (str) – Name of the field.

  • value (object) – Value to compare against.

  • places (int, optional) – Decimal places used for real/integer comparison (default 7).

Return type:

bool

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

Proof-of-concept stub that always returns 42 (to be removed).

eppy.bunch_subclass.somevalues(ddtt)[source]

Return a tuple of a few commonly-used fields from an EpBunch.

Parameters:

ddtt (EpBunch) – The object from which the values are taken.

Returns:

(Name, Construction_Name, obj).

Return type:

tuple

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)

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.ext_field_functions module

functions to deal with extensible fields Moving the functions here is a work in progress

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

get the vars from where extension happens

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

generate the list of new vars needed to extend by n

eppy.ext_field_functions.extfieldint(fieldname, sep=None)[source]

return the integer in the extensible field It there is more than one integer, it will return the last one

eppy.ext_field_functions.getextensible(objidd)[source]

return the extensible from the idd

eppy.ext_field_functions.increaseIDDfields(block, commdct, key_i, key_txt, n)[source]

increase fields in IDD - ie in block and commdct

eppy.ext_field_functions.islegalextensiblefield(objidd, fieldname)[source]

return true if afieldname is an extensible field in objidd

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.a_missingkey_standard(commdct, key_i, key_txt, nofirstfields)[source]

sometimes IDD has fields with no field description. This happens in extensible. This functions picks up the previous field description and adds them to the fields that have no field descriptions. This update is done in place to commdct commdct is not returned. missing field descriptions are actually mising keys of a dict hence the function is called a missingkey

This is very old function. Not sure how it works now.

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, int_replace=None)[source]

get the names of the repeating fields

eppy.iddv7 module

eppy.iddv800 module

eppy.iddv940 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: 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.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

exception eppy.modeleditor.IDDResetError[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

idfnamestr

Path to the IDF file.

idfobjectslist

List of EpBunch objects in the IDF.

modelEplusdata object

Data dictionary and list of objects for the entire model.

outputtypestr

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
copyidf()[source]

Return a copy of IDF

Return type:

modeleditor.IDF object

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.

  • name (str) – The name of the object to fetch.

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’], …}

Return type:

dict

classmethod getiddname()[source]

Get the name of the current IDD used by eppy.

Return type:

str

getobject(key, name)[source]

Fetch an IDF object given key and name.

Parameters:
  • key (str) – The type of IDF object.

  • name (str) – The name of the object to fetch.

Return type:

EpBunch object.

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

String representation of the IDF.

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, 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.

  • 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.

Return type:

EpBunch object

popidfobject(key, index)[source]

Pop an IDF object from the IDF.

Parameters:
  • key (str) – The type of IDF object.

  • index (int) – The index of the object to pop.

Return type:

EpBunch object.

printidf()[source]

Print the IDF.

printidf_ip()[source]

Print the entire IDF in IP units.

Iterates over all objects in the IDF (in the same order used by idfstr / printidf) and calls EPBunch.print_ip() on each one. print_ip converts numeric field values from SI to IP units (where a conversion is defined) and shows the corresponding IP unit in the comment.

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

removeallidfobjects(idfobject)[source]

Remove all IDF object of a certain type from the IDF.

Parameters:

idfobject (EpBunch object) – The IDF object to remove.

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.

  • name (str) – The name of the object to fetch.

Return type:

EpBunch object

removeidfobject(idfobject)[source]

Remove an IDF object from the IDF.

Parameters:

idfobject (EpBunch object) – The IDF object to remove.

classmethod resetidd()[source]

resets the IDD for testing. Users should not use this

It will raise the exception IDDResetError

Return type:

None

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.

idfstr

Full or relative path to the IDF file to be run, or an IDF object.

weatherstr

Full or relative path to the weather file.

output_directorystr, optional

Full or relative path to an output directory (default: ‘run_outputs)

annualbool, optional

If True then force annual simulation (default: False)

design_daybool, optional

Force design-day-only simulation (default: False)

iddstr, optional

Input data dictionary (default: Energy+.idd in EnergyPlus directory)

epmacrostr, optional

Run EPMacro prior to simulation (default: False).

expandobjectsbool, optional

Run ExpandObjects prior to simulation (default: False)

readvarsbool, optional

Run ReadVarsESO after simulation (default: False)

output_prefixstr, optional

Prefix for output file names (default: eplus)

output_suffixstr, 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)

versionbool, optional

Display version information (default: False)

verbose: str
Set verbosity of runtime messages (default: v)

v: verbose q: quiet s: silent

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.

runfile(**kwargs)[source]

Run an IDF file on the disk with a given EnergyPlus weather file. This is a wrapper for the EnergyPlus command line interface.

This is different from run() which can run a file that is only in memory

Parameters:

kwargs – See eppy.runner.functions.run()

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.copyidf(idf_source)[source]

returns an in memory copy of idf

It copies only the idfobjects. epw, idfname are not copied

Parameters:

idf_source (IDF) – modelmaker.IDF object.

Return type:

modelmaker.IDF object

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 .

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.

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.units_proxy module

Unit-aware attribute access for EpBunch objects.

This module provides UnitsProxy, a thin proxy that lets callers read (and write) EnergyPlus object fields in either SI or IP units without having to call conversion helpers explicitly.

Typical usage

After the proxy is attached to an EpBunch via the ip, ipv, si and siv properties:

site = idf.idfobjects[“Site:Location”][0]

site.ip.Elevation # numeric value in IP units site.ipv.Elevation # same value plus an IDF-style comment site.si.Elevation # numeric value in SI units (identical to

# ordinary attribute access)

site.siv.Elevation # SI value plus an IDF-style comment

Assignment works the same way: writing through .ip / .ipv converts the supplied IP number back to SI before storing it; writing through .si / .siv stores the value unchanged.

The proxy also supports dictionary-style access (obj.ip["Elevation"]) and tab-completion of field names.

class eppy.units_proxy.UnitsProxy(epbunch, mode='ip')[source]

Bases: object

Proxy that lets you do: obj.ip.FieldName → numeric IP value obj.ipv.FieldName → verbose IP string (value + !- comment) obj.si.FieldName → numeric SI value obj.siv.FieldName → verbose SI string (value + !- comment)

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 if Energyplus of that version is installed.

  • newidf(version=None) or newidf() will workif the IDD has already been set

  • newidf(version=some_version) will work
    • if some_version matches the IDD already set

    • OR if no IDD has been set

Parameters:

version (string) – version of the new file you want to create. Will work only if this version of Energyplus has been installed OR if it matches the IDD already set.

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.