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
AbstractTransducerhas aone-to-manyrelationship withAbstractDataMeasure, e.g., a sensor can have multiple data measures.AbstractTransducerhas amany-to-onerelationship withAbstractFloorSpace, e.g., an open space can have multiple sensors.AbstractTransduerhas amany-to-onerelationship withAbstractSubsystem, e.g., an appliance can have multiple sensors.
Attributes
name:str, the unique name of the transducerregistry_id:str, the registry ID of the transducerinput_voltage_range:ContinuousMeasure, the input voltage range (maximum, minimum, and unit) of the transducerinput_current_range:ContinuousMeasure, the input current range (maximum, minimum, and unit) of the transduceroutput_current_range:ContinuousMeasure, the output current range (maximum, minimum, and unit) of the transduceroutput_voltage_range:ContinuousMeasure, the output voltage range (maximum, minimum, and unit) of the transducermeta_data:Dict[str, Any], metadata associated with the transducerdata:list, a list of data recorded by the transducer
Behaviours (Methods)
add_data(data: Union[List[TriggerHistory], List[SensorData]]): adds data to the transducerremove_data(data: Union[TriggerHistory, SensorData]): removes data from the transduceradd_meta_data(key, value): adds metadata to the transducerremove_meta_data(key): removes metadata from the transducerget_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 sensormeasure_range:AbstractRangeMeasure, the range of acceptable measurement for the sensordata_frequency:float, the interval at which data is recorded by the sensorunit:MeasurementUnit, the measurement unit of the data being measuredcurrent_value:float (optional), the current value for the sensormeasure_type:MeasureType, the type of data measured by the sensorsensor_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 actuatortrigger_output:Union[AbstractHVACComponent, Appliance], the device or equipment which is actuatedcontroller:Controller (optional), the controller that triggers this actuatoractuation_interval:float (optional), the interval at which actuation happens
Behaviours (Methods)
Same as in AbstractTransducer (inherits the methods).