Transducer - ptidejteam/tools4cities-metamenth GitHub Wiki

Transducer is a collective term for sensor and actuators that can be found in a building environment. MetamEnTh has three (3) major classes to model transducers: AbstractTransducer, Sensor and Actuator.

Classes and Their Relationships

All classes (entities) have auto-generated IDs (UID) to uniquely identify objects created from them.

AbstractTransducer

This class defines common attributes and behaviours common to both sensors and actuators

Parent Class

None

Relationships

  • AbstractTransducer has a one-to-many relationship with AbstractDataMeasure, e.g., a sensor can have multiple data measures.
  • AbstractTransducer has a many-to-one relationship with AbstractFloorSpace, e.g., an open space can have multiple sensors.
  • AbstractTransduer has a many-to-one relationship with AbstractSubsystem, e.g., an appliance can have multiple sensors.

Attributes

  • name: str, the unique name of the transducer
  • registry_id: str, the registry ID of the transducer
  • input_voltage_range: ContinuousMeasure, the input voltage range (maximum, minimum, and unit) of the transducer
  • input_current_range: ContinuousMeasure, the input current range (maximum, minimum, and unit) of the transducer
  • output_current_range: ContinuousMeasure, the output current range (maximum, minimum, and unit) of the transducer
  • output_voltage_range: ContinuousMeasure, the output voltage range (maximum, minimum, and unit) of the transducer
  • meta_data: Dict[str, Any], metadata associated with the transducer
  • data: list, a list of data recorded by the transducer

Behaviours (Methods)

  • add_data(data: Union[List[TriggerHistory], List[SensorData]]): adds data to the transducer
  • remove_data(data: Union[TriggerHistory, SensorData]): removes data from the transducer
  • add_meta_data(key, value): adds metadata to the transducer
  • remove_meta_data(key): removes metadata from the transducer
  • get_data(self, search_terms: Dict = None) -> Union[List[SensorData], List[TriggerHistory]]: searches for transducer data based on data attributes and their values, e.g., {'timestamp': '2024-03-27 00:15:00'}
  • get_data_by_date(self, from_timestamp: str, to_timestamp: str = None) -> Union[List[SensorData], List[TriggerHistory]]: fetches transducer data between (inclusive) from_timestamp to to_timestamp. If to_timestamp is not provided, it searches the data from from_timestamp to the last data point available.

Sensor

This class defines various sensors in buildings. The Sensor class inherits all the attributes and behaviours of AbstractTransducer.

Parent Class

AbstractTransducer

Relationships

Defined above in AbstractTransducer.

Attributes

  • measure: SensorMeasure, the phenomenon (e.g., temperature) measured by the sensor
  • measure_range: AbstractRangeMeasure, the range of acceptable measurement for the sensor
  • data_frequency: float, the interval at which data is recorded by the sensor
  • unit: MeasurementUnit, the measurement unit of the data being measured
  • current_value: float (optional), the current value for the sensor
  • measure_type: MeasureType, the type of data measured by the sensor
  • sensor_log_type: SensorLogType, indicates if data is recorded by polling or change of value

Behaviours (Methods)

Same as in AbstractTransducer (inherits the methods).

Actuator

This class defines various actuators in buildings. The Actuator class inherits all the attributes and behaviours of AbstractTransducer.

Parent Class

AbstractTransducer

Relationships

Defined above in AbstractTransducer.

Attributes

  • set_point: AbstractMeasure (optional), the setpoint value of the actuator
  • trigger_output: Union[AbstractHVACComponent, Appliance], the device or equipment which is actuated
  • controller: Controller (optional), the controller that triggers this actuator
  • actuation_interval: float (optional), the interval at which actuation happens

Behaviours (Methods)

Same as in AbstractTransducer (inherits the methods).