Base Transition Rules Class DocumentationΒΆ

class eptransition.rules.base_rule.ObjectTypeAndName(object_type, object_name)[source]

This is a simple class for defining an object type/name combination

Parameters:
  • object_type (str) – The object type
  • object_name (str) – The name of the object (usually field[0]
class eptransition.rules.base_rule.OutputVariableTransitionRule[source]

This class is a must-override base class for defining transition rules for output variable objects These objects are treated somewhat specially by the tool because a small change can affect so many objects, and it would be unwise to expect each version to include so much repeated code.

The structure of the output objects here is based on 8.5/8.6. In the future, if the objects didn’t change much, it would make most sense to just keep using this class and making small tweaks as needed. If more major changes occur, it would be best to create a new base class to move forward.

The fields for each object are described next

  • OV: Output:Variable

    1. Key Value
    2. Variable Name * * * *
    3. Reporting Frequency
    4. Schedule Name
  • OM: Output:Meter, OMM: Output:Meter:MeterFileOnly

    1. Name * * * *
    2. Reporting Frequency
  • OMC: Output:Meter:Cumulative, OMCM: Output:Meter:Cumulative:MeterFileOnly

    1. Name * * * *
    2. Reporting Frequency
  • OTT: Output:Table:TimeBins

    1. Key Value
    2. Variable Name * * * *
    3. Interval Start
    4. Interval Size
    5. Interval Count
    6. Schedule Name
    7. Variable Type
  • FMUI: ExternalInterface:FunctionalMockupUnitImport:From:Variable

    1. EnergyPlus Key Value
    2. EnergyPlus Variable Name * * * *
    3. FMU File Name
    4. FMU Instance Name
    5. FMU Variable Name
  • FMUE: ExternalInterface:FunctionalMockupUnitExport:From:Variable

    1. EnergyPlus Key Value
    2. EnergyPlus Variable Name * * * *
    3. FMU Variable Name
  • EMS: EnergyManagementSystem:Sensor

    1. Name
    2. Output:Variable or Output:Meter Key Name
    3. Output:Variable or Output:Meter Name * * * *
  • OTM: Output:Table:Monthly

    1. Name
    2. Digits after Decimal
    3. Variable or Meter X Name * * * *
    4. Variable or Meter X Aggregation Type

    ... repeating with variable names for each 2, 4, 6, 8, ...

  • OTA: Output:Table:Annual

    1. Name
    2. Filter
    3. Schedule Name
    4. Variable or Meter X Name * * * *
    5. Variable or Meter X Aggregation Type

    ... repeating with variable names for each 3, 5, 7, 9, ...

  • MC: Meter:Custom

    1. Name
    2. Fuel Type
    3. Key Name X
    4. Output Variable or Meter Name X * * * *

    ... repeating with variable names for each 3, 5, 7, 9, ...

  • MCD: Meter:CustomDecrement

    1. Name
    2. Fuel Type
    3. Source Meter Name ????
    4. Key Name X
    5. Output Variable or Meter Name X

    ... repeating with variable names for each 4, 6, 8, 10, ...

EMS = 'ENERGYMANAGEMENTSYSTEM:SENSOR'
FMUE = 'EXTERNALINTERFACE:FUNCTIONALMOCKUPUNITEXPORT:FROM:VARIABLE'
FMUI = 'EXTERNALINTERFACE:FUNCTIONALMOCKUPUNITIMPORT:FROM:VARIABLE'
MC = 'METER:CUSTOM'
MCD = 'METER:CUSTOMDECREMENT'
OM = 'OUTPUT:METER'
OMC = 'OUTPUT:METER:CUMULATIVE'
OMCM = 'OUTPUT:METER:CUMULATIVE:METERFILEONLY'
OMM = 'OUTPUT:METER:METERFILEONLY'
OTA = 'OUTPUT:TABLE:ANNUAL'
OTM = 'OUTPUT:TABLE:MONTHLY'
OTT = 'OUTPUT:TABLE:TIMEBINS'
OV = 'OUTPUT:VARIABLE'
complex_output_operation(full_object, dependent_objects)[source]

This method should be overridden in derived classes and should perform the complex operations to transition the argument object passed in. The function should return a list because some complex operations may split the initial object into multiple objects. The object passed in will have any simple name swaps already performed.

Parameters:
  • full_object – The original object to be replaced.
  • dependent_objects – A dictionary of dependent objects
Returns:

A list of new IDFObject instances, typically just one though

Raises:

UnimplementedMethodException – Raised if this method is called on the base class itself

get_complex_operation_types()[source]

This method should be overridden in the derived classes and return a list of object names that require more complex transition operations than a simple variable name swap

Returns:A list of strings, each representing an object name that requires complex transition operations
Raises:UnimplementedMethodException – Raised if this method is called on the base class itself
get_dependent_object_names()[source]

This method can be overridden in derived classes if any of the output variable name changes depend on other objects in the idf. Simply return a list of object names

Returns:A list of object names that output variable name changes are dependent upon
get_output_objects()[source]

This method should be overridden in derived classes and return a list of all output-related object types in this version of EnergyPlus. A base version is available in the base class that can be used as a starter and if an object name changes, the derived class can change that name as needed in the return array.

Returns:A list of strings, each representing an output object type name
Raises:UnimplementedMethodException – Raised if this method is called on the base class itself
get_simple_swaps()[source]

This method should be overridden in derived classes and return a dictionary where each key is the name of an output variable, and the value of each key is the new variable name. This map is used when doing the simple variable name swaps.

Returns:A dictionary of <old_variable_name, new_variable_name>
Raises:UnimplementedMethodException – Raised if this method is called on the base class itself
get_standard_indexes_from_object(object_name)[source]

This method should be overridden in derived classes and return a list of the zero-based field indexes that include a variable name in the given object type. A base version is available in the base class that can be used as a starter and if the structure of any object types changes, the derived class can change that one as needed in the return list

Parameters:object_name – The name of the object being inspected
Returns:A list of zero-based indexes, each representing a field containing an output variable name
Raises:UnimplementedMethodException – Raised if this method is called on the base class itself
original_full_variable_type_list()[source]
original_standard_indexes_from_object(object_name)[source]

This method returns the list of indexes where variable names are found. These are zero based indexes. This method returns a base version that can be used by a derived class directly, modified, or used as a template for future derived classes.

Parameters:object_name – The upper case name of the object currently being transitioned.
Returns:A list of zero-based indexes
simple_name_swap(variable_name)[source]

This method is a simple method that queries the must-override get_simple_swaps method in the derived class and either returns a new variable name to swap in place of the original name, or returns None as a signal that this original variable name does not need replacement

Parameters:variable_name – The original variable name to potentially be replaced
Returns:A new variable name, if a swap is to be performed, or None if not
transition(core_object, dependent_objects)[source]

This method can be implemented by derived classes if necessary, but should capture the entire transition functionality just using the other required <must-override> methods in this class. This function first scans all the variable names in the current locations, and renames as needed. Then this function checks if this object type needs a complex transition, and if so, calls the appropriate derived method. This method then returns a full IDFObject instance.

Parameters:
  • core_object – The original object to be replaced
  • dependent_objects – A dictionary of dependent objects
Returns:

A list of new IDFObject instances, typically just one though

class eptransition.rules.base_rule.TransitionReturn(objects_to_write, objects_to_delete=None)[source]

This is a simple class for capturing the response from a transition call

Parameters:
  • objects_to_write ([IDFObject]) – The list of IDFObject instances to be written as a result of this transition
  • objects_to_delete ([ObjectTypeAndName]) – The list of idf object type/name combinations to be deleted as a result of this transition
class eptransition.rules.base_rule.TransitionRule[source]

This class is a must-override base class for defining transition rules for idf objects

get_name_of_object_to_transition()[source]

This method should be overridden in derived classes and return a single name of an object that this rule handles the transition for.

Returns:A string name of an object to transition
Raises:UnimplementedMethodException – Raised if this method is called on the base class itself
get_names_of_dependent_objects()[source]

This method should be overridden in derived classes and return a list of object names that the derived transition implementation is dependent upon.

Returns:A list of string object names
Raises:UnimplementedMethodException – Raised if this method is called on the base class itself
transition(core_object, dependent_objects)[source]

This method is the core transition operation for this object.

Parameters:
  • core_object – The original idf object to be transitioned
  • dependent_objects – A dictionary of {object_name: [idf_object, ...]} containing the idf object data in the original idf that have object names defined in this derived classes get_names_of_dependent_objects method. Each key in this argument is a string object name, and each value is a list of all the idf objects in the file of that type.
Returns:

A list of new IDFObject instances, typically just one though

Raises:

UnimplementedMethodException – Raised if this method is called on the base class itself