sunpeek.components.helpers.SensorMap#

class sunpeek.components.helpers.SensorMap(slot_name, sensor, sensor_type=None, component=None)#

Bases: Base

Class which defines the many-to-many mapping table and performs required logic to map Sensor objects to sensor channels on components. The sensor_type argument to the __init__ method determines the SensorType that will be attached to the sensor. If a sensor type has already been attached, attempting to create another mapping with a different type, a ConfigurationError will be raised. When a SensorMap is created, the sensor_type is not attached immediately. Instead, the sensor_type_name attribute of the sensor is set. When the SensorMap object is attached to a database session, a lookup is performed against the sensor_types table, and an appropriate SensorType object loaded and attached to the sensor.

Variables:
  • sensor (py:class:sunpeek.components.sensor.Sensor) – The sensor object to be mapped

  • slot_name (str) – The name of the sensor channel being mapped to, e.g. te_amb

  • array (physical.Array) – Array object, if the mapping is to an array

  • plant (physical.Plant) – Plant object, if the mapping is to a plant

  • heat_exchanger (helpers.pyHeatExchanger) – HeatExchanger object, if the mapping is to a hx

Methods

__init__(slot_name, sensor[, sensor_type, ...])

A simple constructor that allows initialization from kwargs.

unmap([include_sensor])