honeybee_doe2.util module

Various utilities used throughout the package.

honeybee_doe2.util.clean_inp_file_contents(inp_file)[source]

Get the contents of an INP file without any commented lines.

These comment lines might interfere with regex parsing if they are present.

Parameters:

inp_file – A path to an IDF file containing objects to be parsed.

Returns:

A single string for the clean IDF file contents.

honeybee_doe2.util.generate_inp_string(u_name, command, keywords, values)[source]

Get an INP string representation of a DOE-2 object.

This method is written in a generic way so that it can describe practically any element of the INP Building Description Language (BDL).

Parameters:
  • u_name – Text for the unique, user-specified name of the object being created. This must be 32 characters or less and not contain special or non-ASCII characters. The clean_doe2_string method may be used to convert strings to a format that is acceptable here. For example, a U-Name of a space might be “Floor2W ClosedOffice5”.

  • command – Text indicating the type of instruction that the DOE-2 object executes. Commands are typically in capital letters and examples include POLYGON, FLOOR, SPACE, EXTERIOR-WALL, WINDOW, CONSTRUCTION, etc.

  • keywords – A list of text with the same length as the values that denote the attributes of the DOE-2 object.

  • values – A list of values with the same length as the keywords that describe the values of the attributes for the object.

Returns:

inp_str – A DOE-2 INP string representing a single object.

honeybee_doe2.util.generate_inp_string_list_format(u_name, command, keywords, values)[source]

Get an INP string of a DOE-2 object with nicer formatting for list values.

This method will process any values that are a list or tuple and format them such that they are indented and more readable. This method is written in a generic way so that it can describe practically any element of the INP Building Description Language (BDL).

Parameters:
  • u_name – Text for the unique, user-specified name of the object being created. This must be 32 characters or less and not contain special or non-ASCII characters. The clean_doe2_string method may be used to convert strings to a format that is acceptable here. For example, a U-Name of a space might be “Floor2W ClosedOffice5”.

  • command – Text indicating the type of instruction that the DOE-2 object executes. Commands are typically in capital letters and examples include POLYGON, FLOOR, SPACE, EXTERIOR-WALL, WINDOW, CONSTRUCTION, etc.

  • keywords – A list of text with the same length as the values that denote the attributes of the DOE-2 object.

  • values – A list of values with the same length as the keywords that describe the values of the attributes for the object. The items in this list can be list themselves, in which case they will be translated with nice indented formatting.

Returns:

inp_str – A DOE-2 INP string representing a single object.

honeybee_doe2.util.header_comment_major(header_text)[source]

Create a header given header_text, which can help organize the INP file contents.

honeybee_doe2.util.header_comment_minor(header_text)[source]

Create a header given header_text, which can help organize the INP file contents.

honeybee_doe2.util.parse_inp_string(inp_string)[source]

Parse an INP string of a single DOE-2 object into a list of values.

Note that this method is only equipped to parse DOE-2 test strings that originate from eQuest or from this package. It has not yet been generalized to parse all formats of text formats that can appear in a DOE-2 file.

Parameters:

inp_string – An INP string for a single DOE-2 object.

Returns:

A tuple with four elements.

  • u_name: Text for the unique name of the object.

  • command: Text for the type of instruction that the DOE-2 object executes.

  • keywords: A list of text with the same length as the values that denote the attributes of the DOE-2 object.

  • values: A list of values with the same length as the keywords that describe the values of the attributes for the object.

honeybee_doe2.util.switch_statement_id(value)[source]

Convert a string into a 4-character ID that can be used for switch statements.

This is needed to deal with the major limitations that DOE-2 places on switch statement IDs, where every ID must be 4 characters