eppy package¶
Subpackages¶
- eppy.EPlusInterfaceFunctions package
- Submodules
- eppy.EPlusInterfaceFunctions.eplusdata module
- eppy.EPlusInterfaceFunctions.iddgroups module
- eppy.EPlusInterfaceFunctions.iddindex module
- eppy.EPlusInterfaceFunctions.mylib1 module
- eppy.EPlusInterfaceFunctions.mylib2 module
- eppy.EPlusInterfaceFunctions.parse_idd module
- eppy.EPlusInterfaceFunctions.readidf module
- eppy.EPlusInterfaceFunctions.structures module
- Module contents
- eppy.constructions package
- eppy.experimental package
- eppy.geometry package
- eppy.results package
- eppy.runner package
- eppy.samplescripts package
- eppy.useful_scripts package
- Submodules
- eppy.useful_scripts.change_edges module
- eppy.useful_scripts.doc_images module
- eppy.useful_scripts.eppy_version module
- eppy.useful_scripts.eppyreadtest_file module
- eppy.useful_scripts.eppyreadtest_folder module
- eppy.useful_scripts.idfdiff module
- eppy.useful_scripts.idfdiff_missing module
- eppy.useful_scripts.loopdiagram module
- eppy.useful_scripts.relatedobjects module
- eppy.useful_scripts.renamecolon module
- Module contents
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:
AttributeErrorRaised when an unknown or illegal field name is accessed on an EpBunch.
- class eppy.bunch_subclass.EpBunch(obj, objls, objidd, *args, **kwargs)[source]¶
Bases:
MunchDict-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=Truea 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
Noneif 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:
Trueif the IDD entry for the field contains the keyretaincase,Falseotherwise.- 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>andtype(orNonewhen 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
Noneif 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
- 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
retaincaseflag; numeric comparisons use a tolerance ofplacesdecimal 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
- 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 withepconversions.defaultipunit. The conversion itself is performed byepconversions.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
ipvalueis stored unchanged (same graceful fallback used byprint_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:
ValueErrorRaised 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
__functionsdictionary.
- 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
unittestmodule 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:
Trueif the values agree to the requested number of places,Falseotherwise.- 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
ibecomes a valid index.If
iis already inside the list nothing is done; otherwise the list is padded withvalueup to (and including) indexi.- 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
Noneif 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:
Trueif the IDD entry for the field contains the keyretaincase,Falseotherwise.- 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>andtype(orNonewhen 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
Noneif 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.bunchhelpers module¶
some helper files
eppy.easyopen module¶
home of easyopen - to easily open an idf file
- 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.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.fanpower module¶
quick and dirty functions for get fan power BHP or Watts
- 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.function_helpers module¶
helper functions for the functions called by bunchdt
eppy.hvacbuilder module¶
make plant loop snippets
- class eppy.hvacbuilder.SomeFields[source]¶
Bases:
objectSome 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']¶
- 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.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.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.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.idd_helpers module¶
helper functions for idd
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.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.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.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.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
**kwargsas 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>
eppy.idfreader module¶
use epbunch
- class eppy.idfreader.ConvInIDD[source]¶
Bases:
objecthold the conversion function to integer, real and no_type
- eppy.idfreader.convertafield(field_comm, field_val, field_iddname)[source]¶
convert field based on field info in IDD
- 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.idfreader1(fname, iddfile, theidf, conv=True, commdct=None, block=None)[source]¶
read idf file and return bunches
eppy.json_functions module¶
functions to use json to modify an idf file
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.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.getfieldindex(data, commdct, objkey, fname)[source]¶
given objkey and fieldname, return its index
eppy.modeleditor module¶
functions to edit the E+ model
- class eppy.modeleditor.IDF(idfname=None, epw=None)[source]¶
Bases:
objectThe 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¶
- 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
- 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¶
- 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_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 callsEPBunch.print_ip()on each one.print_ipconverts 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:
- 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.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.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.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.pytest_helpers module¶
helpers for pytest
eppy.simpleread module¶
read the idf file by just parsing the text
eppy.simplesurface module¶
from BUILDINGSURFACE:DETAILED and FENESTRATIONSURFACE:DETAILED make a wall floor, celiling etc or a window
- 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.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.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.
eppy.walk_hvac module¶
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.