Utility Models
Types
- class encodapy.config.types.AttributeTypes(*values)[source]
Bases:
EnumEnum class for the attribute types
- TIMESERIES = 'timeseries'
- VALUE = 'value'
- class encodapy.config.types.DataQueryTypes(*values)[source]
Bases:
EnumEnum class for the data query types, used for the functions to get data
- Variables:
- CALCULATION = 'calculation'
- CALIBRATION = 'calibration'
- class encodapy.config.types.FileExtensionTypes(*values)[source]
Bases:
EnumEnum class for file Extensions, used for the file interface and defines the possible file formats
- CSV = '.csv'
- JSON = '.json'
- class encodapy.config.types.Interfaces(*values)[source]
Bases:
EnumEnum class for the interfaces
- Variables:
- FILE = 'file'
- FIWARE = 'fiware'
- MQTT = 'mqtt'
- class encodapy.config.types.MQTTFormatTypes(*values)[source]
Bases:
EnumEnum class for MQTT format types Possible values: - PLAIN (plain): Plain format - FIWARE_ATTR (fiware-attr): FIWARE attribute format - FIWARE_CMDEXE (fiware-cmdexe): FIWARE command execution format - TEMPLATE (template): Template-based format
- FIWARE_ATTR = 'fiware-attr'
- FIWARE_CMDEXE = 'fiware-cmdexe'
- PLAIN = 'plain'
- TEMPLATE = 'template'
- class encodapy.config.types.TimerangeTypes(*values)[source]
Bases:
EnumEnum class for the timedelta types, used for the functions to get timeseries data
- Variables:
- ABSOLUTE = 'absolute'
- RELATIVE = 'relative'
- pydantic model encodapy.config.mqtt_messages_template.MQTTTemplateConfigDoc[source]
Model for MQTT template configuration.
Mock class for documentation purposes.
Note
In the actual implementation, topic and payload are jinja2.Template objects, time_format is a str as time format for the timestamp in the payload. This mock uses dict to avoid import issues during documentation generation.
For more information, see
MQTTTemplateConfig.
Datapoints
- pydantic model encodapy.utils.datapoints.DataPointGeneral[source]
Bases:
BaseModelModel for datapoints of the controller component.
- Variables:
value (
Any) – The value of the datapoint, which can be of various types (string, float, int, boolean, dictionary, list, DataFrame, or None).unit (
Optional[DataUnits]) – Optional unit of the datapoint, if applicable.time (
Optional[datetime]) – Optional timestamp of the datapoint, if applicable.
Show JSON schema
{ "title": "DataPointGeneral", "description": "Model for datapoints of the controller component.\n\nAttributes:\n value (Any): The value of the datapoint, which can be of various types (string, float, int, boolean, dictionary, list, DataFrame, or None).\n unit (Optional[DataUnits]): Optional unit of the datapoint, if applicable.\n time (Optional[datetime]): Optional timestamp of the datapoint, if applicable.", "type": "object", "properties": { "value": { "title": "Value" }, "unit": { "anyOf": [ { "$ref": "#/$defs/DataUnits" }, { "type": "null" } ], "default": null }, "time": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Time" } }, "$defs": { "DataUnits": { "description": "Possible units for the data\nUnits which are defined by Unit Code (https://unece.org/trade/cefact/UNLOCODE-Download\nor https://github.com/RWTH-EBC/FiLiP/blob/master/filip/data/unece-units/units_of_measure.csv)\nor here: https://unece.org/fileadmin/DAM/cefact/recommendations/rec20/rec20_rev3_Annex3e.pdf\nTODO:\n - Is there a better way to handle the units?\n - Add more units?", "enum": [ "SEC", "HUR", "MIN", "CEL", "KEL", "LTR", "MTQ", "MQH", "MQS", "E32", "L2", "WTT", "WHR", "KWH", "CMT", "MTR", "MTK", "MTS", "P1", "OHM", "VLT" ], "title": "DataUnits", "type": "string" } }, "required": [ "value" ] }
- pydantic model encodapy.utils.datapoints.DataPointNumber[source]
Bases:
DataPointGeneralModel for datapoints of the controller component.
- Variables:
value (
float | int) – The value of the datapoint, which is a number (float, int).unit (
Optional[DataUnits]) – Optional unit of the datapoint, if applicable.time (
Optional[datetime]) – Optional timestamp of the datapoint, if applicable.
Show JSON schema
{ "title": "DataPointNumber", "description": "Model for datapoints of the controller component.\n\nAttributes:\n value (float | int): The value of the datapoint, which is a number (float, int).\n unit (Optional[DataUnits]): Optional unit of the datapoint, if applicable.\n time (Optional[datetime]): Optional timestamp of the datapoint, if applicable.", "type": "object", "properties": { "value": { "anyOf": [ { "type": "number" }, { "type": "integer" } ], "title": "Value" }, "unit": { "anyOf": [ { "$ref": "#/$defs/DataUnits" }, { "type": "null" } ], "default": null }, "time": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Time" } }, "$defs": { "DataUnits": { "description": "Possible units for the data\nUnits which are defined by Unit Code (https://unece.org/trade/cefact/UNLOCODE-Download\nor https://github.com/RWTH-EBC/FiLiP/blob/master/filip/data/unece-units/units_of_measure.csv)\nor here: https://unece.org/fileadmin/DAM/cefact/recommendations/rec20/rec20_rev3_Annex3e.pdf\nTODO:\n - Is there a better way to handle the units?\n - Add more units?", "enum": [ "SEC", "HUR", "MIN", "CEL", "KEL", "LTR", "MTQ", "MQH", "MQS", "E32", "L2", "WTT", "WHR", "KWH", "CMT", "MTR", "MTK", "MTS", "P1", "OHM", "VLT" ], "title": "DataUnits", "type": "string" } }, "required": [ "value" ] }
- pydantic model encodapy.utils.datapoints.DataPointString[source]
Bases:
DataPointGeneralModel for datapoints of the controller component.
- Variables:
value (
str) – The value of the datapoint, which is a string.unit (
Optional[DataUnits]) – Optional unit of the datapoint, if applicable.time (
Optional[datetime]) – Optional timestamp of the datapoint, if applicable.
Show JSON schema
{ "title": "DataPointString", "description": "Model for datapoints of the controller component.\n\nAttributes:\n value (str): The value of the datapoint, which is a string.\n unit (Optional[DataUnits]): Optional unit of the datapoint, if applicable.\n time (Optional[datetime]): Optional timestamp of the datapoint, if applicable.", "type": "object", "properties": { "value": { "title": "Value", "type": "string" }, "unit": { "anyOf": [ { "$ref": "#/$defs/DataUnits" }, { "type": "null" } ], "default": null }, "time": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Time" } }, "$defs": { "DataUnits": { "description": "Possible units for the data\nUnits which are defined by Unit Code (https://unece.org/trade/cefact/UNLOCODE-Download\nor https://github.com/RWTH-EBC/FiLiP/blob/master/filip/data/unece-units/units_of_measure.csv)\nor here: https://unece.org/fileadmin/DAM/cefact/recommendations/rec20/rec20_rev3_Annex3e.pdf\nTODO:\n - Is there a better way to handle the units?\n - Add more units?", "enum": [ "SEC", "HUR", "MIN", "CEL", "KEL", "LTR", "MTQ", "MQH", "MQS", "E32", "L2", "WTT", "WHR", "KWH", "CMT", "MTR", "MTK", "MTS", "P1", "OHM", "VLT" ], "title": "DataUnits", "type": "string" } }, "required": [ "value" ] }
- pydantic model encodapy.utils.datapoints.DataPointDict[source]
Bases:
DataPointGeneralModel for datapoints of the controller component.
- Variables:
value (
dict) – The value of the datapoint, which is a dictionary.unit (
Optional[DataUnits]) – Optional unit of the datapoint, if applicable.time (
Optional[datetime]) – Optional timestamp of the datapoint, if applicable.
Show JSON schema
{ "title": "DataPointDict", "description": "Model for datapoints of the controller component.\n\nAttributes:\n value (dict): The value of the datapoint, which is a dictionary.\n unit (Optional[DataUnits]): Optional unit of the datapoint, if applicable.\n time (Optional[datetime]): Optional timestamp of the datapoint, if applicable.", "type": "object", "properties": { "value": { "title": "Value", "type": "object" }, "unit": { "anyOf": [ { "$ref": "#/$defs/DataUnits" }, { "type": "null" } ], "default": null }, "time": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Time" } }, "$defs": { "DataUnits": { "description": "Possible units for the data\nUnits which are defined by Unit Code (https://unece.org/trade/cefact/UNLOCODE-Download\nor https://github.com/RWTH-EBC/FiLiP/blob/master/filip/data/unece-units/units_of_measure.csv)\nor here: https://unece.org/fileadmin/DAM/cefact/recommendations/rec20/rec20_rev3_Annex3e.pdf\nTODO:\n - Is there a better way to handle the units?\n - Add more units?", "enum": [ "SEC", "HUR", "MIN", "CEL", "KEL", "LTR", "MTQ", "MQH", "MQS", "E32", "L2", "WTT", "WHR", "KWH", "CMT", "MTR", "MTK", "MTS", "P1", "OHM", "VLT" ], "title": "DataUnits", "type": "string" } }, "required": [ "value" ] }
- pydantic model encodapy.utils.datapoints.DataPointBool[source]
Bases:
DataPointGeneralModel for datapoints of the controller component.
- Variables:
value (
bool) – The value of the datapoint, which is a boolean.unit (
Optional[DataUnits]) – Optional unit of the datapoint, if applicable.time (
Optional[datetime]) – Optional timestamp of the datapoint, if applicable.
Show JSON schema
{ "title": "DataPointBool", "description": "Model for datapoints of the controller component.\n\nAttributes:\n value (bool): The value of the datapoint, which is a boolean.\n unit (Optional[DataUnits]): Optional unit of the datapoint, if applicable.\n time (Optional[datetime]): Optional timestamp of the datapoint, if applicable.", "type": "object", "properties": { "value": { "title": "Value", "type": "boolean" }, "unit": { "anyOf": [ { "$ref": "#/$defs/DataUnits" }, { "type": "null" } ], "default": null }, "time": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Time" } }, "$defs": { "DataUnits": { "description": "Possible units for the data\nUnits which are defined by Unit Code (https://unece.org/trade/cefact/UNLOCODE-Download\nor https://github.com/RWTH-EBC/FiLiP/blob/master/filip/data/unece-units/units_of_measure.csv)\nor here: https://unece.org/fileadmin/DAM/cefact/recommendations/rec20/rec20_rev3_Annex3e.pdf\nTODO:\n - Is there a better way to handle the units?\n - Add more units?", "enum": [ "SEC", "HUR", "MIN", "CEL", "KEL", "LTR", "MTQ", "MQH", "MQS", "E32", "L2", "WTT", "WHR", "KWH", "CMT", "MTR", "MTK", "MTS", "P1", "OHM", "VLT" ], "title": "DataUnits", "type": "string" } }, "required": [ "value" ] }
- pydantic model encodapy.utils.datapoints.DataPointMedium[source]
Bases:
DataPointGeneralModel for datapoints of the controller component which define the medium.
- Variables:
value (
Medium) – The value of the datapoint, which is a Medium representing the medium.unit (
Optional[DataUnits]) – Optional unit of the datapoint, if applicable.time (
Optional[datetime]) – Optional timestamp of the datapoint, if applicable.
Show JSON schema
{ "title": "DataPointMedium", "description": "Model for datapoints of the controller component which define the medium.\n\nAttributes:\n value (Medium): The value of the datapoint, which is a Medium representing the medium.\n unit (Optional[DataUnits]): Optional unit of the datapoint, if applicable.\n time (Optional[datetime]): Optional timestamp of the datapoint, if applicable.", "type": "object", "properties": { "value": { "$ref": "#/$defs/Medium" }, "unit": { "anyOf": [ { "$ref": "#/$defs/DataUnits" }, { "type": "null" } ], "default": null }, "time": { "anyOf": [ { "format": "date-time", "type": "string" }, { "type": "null" } ], "default": null, "title": "Time" } }, "$defs": { "DataUnits": { "description": "Possible units for the data\nUnits which are defined by Unit Code (https://unece.org/trade/cefact/UNLOCODE-Download\nor https://github.com/RWTH-EBC/FiLiP/blob/master/filip/data/unece-units/units_of_measure.csv)\nor here: https://unece.org/fileadmin/DAM/cefact/recommendations/rec20/rec20_rev3_Annex3e.pdf\nTODO:\n - Is there a better way to handle the units?\n - Add more units?", "enum": [ "SEC", "HUR", "MIN", "CEL", "KEL", "LTR", "MTQ", "MQH", "MQS", "E32", "L2", "WTT", "WHR", "KWH", "CMT", "MTR", "MTK", "MTS", "P1", "OHM", "VLT" ], "title": "DataUnits", "type": "string" }, "Medium": { "const": "water", "description": "Enum class for the mediums\n\nTODO: Add more mediums", "title": "Medium" } }, "required": [ "value" ] }
Units
- class encodapy.utils.units.DataUnits(*values)[source]
Bases:
EnumPossible units for the data Units which are defined by Unit Code (https://unece.org/trade/cefact/UNLOCODE-Download or https://github.com/RWTH-EBC/FiLiP/blob/master/filip/data/unece-units/units_of_measure.csv) or here: https://unece.org/fileadmin/DAM/cefact/recommendations/rec20/rec20_rev3_Annex3e.pdf .. todo:
- Is there a better way to handle the units? - Add more units?
- CMT = 'CMT'
- DEGREECELSIUS = 'CEL'
- E32 = 'E32'
- HOUR = 'HUR'
- KELVIN = 'KEL'
- KWH = 'KWH'
- L2 = 'L2'
- LITER = 'LTR'
- MINUTE = 'MIN'
- MQH = 'MQH'
- MQS = 'MQS'
- MTK = 'MTK'
- MTQ = 'MTQ'
- MTR = 'MTR'
- MTS = 'MTS'
- OHM = 'OHM'
- PERCENT = 'P1'
- SECOND = 'SEC'
- VLT = 'VLT'
- WHR = 'WHR'
- WTT = 'WTT'
- class encodapy.utils.units.TimeUnits(*values)[source]
Bases:
EnumPossible time units for the time series data
TODO: Is it better to use standard time units? Like in the unit code?
- DAY = 'day'
- HOUR = 'hour'
- MINUTE = 'minute'
- MONTH = 'month'
- SECOND = 'second'
- class encodapy.utils.units.TimeUnitsSeconds(*values)[source]
Bases:
EnumSeconds for the time units
- DAY = 86400.0
- HOUR = 3600.0
- MINUTE = 60.0
- MONTH = 2592000.0
- SECOND = 1.0
- encodapy.utils.units.get_time_unit_seconds(time_unit: TimeUnits | str | DataUnits) float | None[source]
Funktion to get the seconds for a time unit
Mediums
- class encodapy.utils.mediums.Medium(*values)[source]
Bases:
EnumEnum class for the mediums
TODO: Add more mediums
- WATER = 'water'
- pydantic model encodapy.utils.mediums.MediumParameters[source]
Bases:
BaseModelBase class for the medium parameters
Show JSON schema
{ "title": "MediumParameters", "description": "Base class for the medium parameters\n\nAttributes:\n cp (float): Specific heat capacity [kJ/kgK]\n rho (float): Density [kg/m\u00b3]", "type": "object", "properties": { "cp": { "title": "Cp", "type": "number" }, "rho": { "title": "Rho", "type": "number" } }, "required": [ "cp", "rho" ] }
- encodapy.utils.mediums.get_medium_parameter(medium: Medium, temperature: float | None = None) MediumParameters[source]
- Function to get the medium parameter
const values, if no temperature is set
- calculation of cp and rho (constant pressure) as approximation of Glück
“Zustandswerte Luft Wasser Dampf” ISBN 3-345-00487-9
- Parameters:
medium (
Mediums) – The mediumtemperature – float = None
- Returns:
The parameters of the medium
- Return type:
- Parameters: