opyplus.Epm

class opyplus.Epm(json_data=None, check_required=True, check_length=True, idd_or_version=None)

Energyplus model.

An Epm is an Energy Plus Model. It can come from and idf, a epjson (not coded yet), or a json. It can be transformed in an idf, an epjson (not coded yet) or a json.

Parameters
json_data: json serializable object, default None

if provided, Epm will be filled with given objects

check_length: boolean, default True

If True, will raise an exception if a field has a bigger length than authorized. If False, will not check.

check_required: boolean, default True

If True, will raise an exception if a required field is missing. If False, not not perform any checks.

idd_or_version: (expert) if you want to use a specific idd, you can require a specific version (x.x.x), or

directly provide an IDD object.

Notes

Eplus version behaviour:

  • if idd_or_version is provided, required idd will be used (may trigger a warning if it is not coherent with json_data version, if any)

  • else if json_data is provided: will use proper idd (according to version field) or trigger a warning if idd is not available and will choose the closest

  • else will use default eplus version used in conf, which is initially set to latest available idd version

Methods

dump_external_files(self, target_dir_path)

Dump external files.

from_idf(buffer_or_path[, check_required, …])

See load.

from_json(buffer_or_path[, check_required, …])

Create Epm from a json file.

get_comment(self)

Get comment.

get_external_files(self)

Get a list of external files available.

get_info(self)

Get info.

load(buffer_or_path[, check_required, …])

Load Epm from a file.

save(self[, buffer_or_path, dump_external_files])

Save Epm to a file.

set_comment(self, comment)

Set comment.

set_defaults(self)

All fields of Epm with a default value and that are null will be set to their default value.

to_idf(self[, buffer_or_path, …])

See save.

to_json(self[, buffer_or_path, indent])

Save to json.

to_json_data(self)

Dump the Epm to a json-serializable dict.

dump_external_files(self, target_dir_path)

Dump external files.

Parameters
target_dir_path: str
classmethod from_idf(buffer_or_path, check_required=True, check_length=True, idd_or_version=None)

See load.

classmethod from_json(buffer_or_path, check_required=True, check_length=True, idd_or_version=None)

Create Epm from a json file.

Parameters
buffer_or_path: io.StringIO or str

json buffer or path

check_required: bool

If True (default), will raise an exception if a required field is missing. If False, not not perform any checks.

check_length: bool

If True (default), will raise an exception if a field has a bigger length than authorized. If False, will not check.

Returns
Epm
Other Parameters
idd_or_version: Idd or tuple

if you want to use a specific idd, you can require a specific version (x.x.x), or directly provide an IDD object.

get_comment(self)

Get comment.

Returns
str
get_external_files(self)

Get a list of external files available.

Returns
list of opyplus.epm.external_file.ExternalFile
get_info(self)

Get info.

Returns
str
classmethod load(buffer_or_path, check_required=True, check_length=True, idd_or_version=None)

Load Epm from a file.

Parameters
buffer_or_path: str or typing.StringIO

idf buffer or path

check_required: bool

If True (default), will raise an exception if a required field is missing. If False, do not perform any checks.

check_length: bool

If True (default), will raise an exception if a field has a bigger length than authorized. If False, will not check.

Returns
Epm
Other Parameters
idd_or_version: tuple or Idd

If you want to use a specific idd, you can require a specific version (x.x.x), or directly provide an IDD object.

save(self, buffer_or_path=None, dump_external_files=True)

Save Epm to a file.

Parameters
buffer_or_path: typing.StringIO or str or None

output to write into. If None, will return a json string.

dump_external_files: boolean, default True

if True, external files will be dumped in external files directory

Returns
str or None

None, or an idf string (if buffer_or_path is None).

set_comment(self, comment)

Set comment.

Parameters
comment: str
set_defaults(self)

All fields of Epm with a default value and that are null will be set to their default value.

to_idf(self, buffer_or_path=None, dump_external_files=True)

See save.

to_json(self, buffer_or_path=None, indent=2)

Save to json.

Parameters
buffer_or_path: io.StringIO or str or None

output to write into. If None (default), will return a json string.

indent: int

Defines the indentation of the json, default 2

Returns
str or None

None, or a json string (if buffer_or_path is None).

to_json_data(self)

Dump the Epm to a json-serializable dict.

Returns
dict

A dictionary of serialized data.