from .generic import GenericMapping
[docs]
class GenericEnergySystemMapping(GenericMapping):
"""
Generic mapping between controllers in different containers.
Allows to map a variable to a responder controller in another container responder_net.
"""
[docs]
def __init__(self, container, initiator_id, initiator_column, responder_net, responder_id, responder_column,
order=0, application_operation="add", no_chain=True, conversion_function=None, index=None):
"""
Initializes the GenericWiseMapping.
:param container: The prosumer object
:param initiator_id: The initiating controller
:param initiator_column: The column in the initiating controller
:param responder_id: The responding controller
:param responder_column: The column in the responding controller
:param order: The order of mapping application
:param application_operation: The operation to apply ("add" or "subtract" - default: "add")
:param no_chain: Boolean (default: True)
:param conversion_function: function to apply to the mapping results (default if None: identity function)
:param index: The index of the mapping
"""
super().__init__(container, initiator_id, initiator_column, responder_id, responder_column,
order, application_operation, no_chain, conversion_function, index)
self.responder_net = responder_net
def __str__(self):
return "GenericEnergySystemMapping"
@property
def name(self):
return "GenericEnergySystemMapping"
def _validate(self):
"""
Validates the generic mapping.
"""
super()._validate()
[docs]
def map(self, initiator_controller, responder_controller_id):
"""
Applies the element-wise mapping between the initiator and responder controllers.
:param initiator_controller: The initiating controller
:param responder_controller_id: The responding controller id in the mapping's responder_net
"""
responder_controller = self.responder_net.controller.loc[responder_controller_id].object
super().map(initiator_controller, responder_controller)