Component Configuration Models
Configuration Model
- pydantic model encodapy.components.basic_component_config.ControllerComponentModel[source]
Model for the configuration of the controller components.
- Variables:
active (
bool) – Whether the component is active or notid (
str) – The id of the componenttype (
str) – The type of the component (e.g. thermal storage, heat pump, etc. / needs to be defined for individual components)inputs (
IOModell) – The inputs of the component as a dictionary with IOAllocationModel for the individual inputsoutputs (
IOModell) – The outputs of the component as a dictionary with IOAllocationModel for the individual outputsconfig (
ConfigDataPoints) – The configuration of the component as a dictionary with IOAllocationModel for the individual static data or DataPointModel with direct values
Show JSON schema
{ "title": "ControllerComponentModel", "description": "Model for the configuration of the controller components.\n\nAttributes:\n active (bool): Whether the component is active or not\n id (str): The id of the component\n type (str): The type of the component (e.g. thermal storage, heat pump, etc. / needs to be defined for individual components)\n inputs (IOModell): The inputs of the component as a dictionary with IOAllocationModel for the individual inputs\n outputs (IOModell): The outputs of the component as a dictionary with IOAllocationModel for the individual outputs\n config (ConfigDataPoints): The configuration of the component as a dictionary with IOAllocationModel for the individual static data or DataPointModel with direct values", "type": "object", "properties": { "active": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": true, "title": "Active" }, "id": { "title": "Id", "type": "string" }, "type": { "title": "Type", "type": "string" }, "inputs": { "$ref": "#/$defs/IOModell" }, "outputs": { "$ref": "#/$defs/IOModell" }, "config": { "anyOf": [ { "$ref": "#/$defs/ConfigDataPoints" }, { "type": "null" } ], "default": null } }, "$defs": { "ConfigDataPoints": { "additionalProperties": { "anyOf": [ { "$ref": "#/$defs/IOAllocationModel" }, { "$ref": "#/$defs/DataPointGeneral" } ] }, "description": "Model for the configuration of config data points.\n\nSee also :class:`~encodapy.components.basic_component_config.IOAllocationModel` and\n:class:`~encodapy.utils.datapoints.DataPointGeneral`.", "title": "ConfigDataPoints", "type": "object" }, "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.", "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" } }, "required": [ "value" ], "title": "DataPointGeneral", "type": "object" }, "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" }, "IOAllocationModel": { "description": "Model for the input or output allocation.\n\nAttributes:\n entity (str): ID of the entity to which the input or output is allocated\n attribute (str): ID of the attribute to which the input or output is allocated", "properties": { "entity": { "description": "ID of the entity to which the input or output is allocated", "title": "Entity", "type": "string" }, "attribute": { "description": "ID of the attribute to which the input or output is allocated", "title": "Attribute", "type": "string" } }, "required": [ "entity", "attribute" ], "title": "IOAllocationModel", "type": "object" }, "IOModell": { "additionalProperties": { "$ref": "#/$defs/IOAllocationModel" }, "description": "Model for the input, staticdata and output of a component.\n\nIt contains a dictionary with the key as the ID of the input, output or static data\nand the value as the allocation model\n\nSee also :class:`~encodapy.components.basic_component_config.IOAllocationModel`.\n\nThere is no validation for this.\nIt is used to create the the ComponentIOModel for each component.", "title": "IOModell", "type": "object" } }, "required": [ "id", "type", "inputs", "outputs" ] }
-
field config:
Optional[ConfigDataPoints] = None
Specific Sub-Models
- pydantic model encodapy.components.basic_component_config.ComponentData[source]
Bases:
BaseModelBasemodel for the configuration of the datapoints of a component
Base for
InputData,OutputDataandConfigData.Provides a validator to check the units of the input values and convert them if necessary.
Make sure to check the datatype in validators, because the
ComponentDatamodel is also used for the datatransfer configuration to components. This model looks different, so validators should check datatypes before trying to validate data to avoid unexpected errors. Example for datatype checks in validators:@model_validator(mode="after") def check_model(self) -> "InputPreparationInputData": "Model validator to check the model after initialization." if not isinstance(self.field, DataPointGeneral): return self # check the model with your code return self @field_validator("field", mode="before") @classmethod def check_field(cls, value: DataPointGeneral) -> DataPointGeneral: "Check only a field before initialization." if not isinstance(value, DataPointTimeSeries): return value # check the field with your code return value
Show JSON schema
{ "title": "ComponentData", "description": "Basemodel for the configuration of the datapoints of a component\n\nBase for :class:`~encodapy.components.basic_component_config.InputData`,\n:class:`~encodapy.components.basic_component_config.OutputData` and\n:class:`~encodapy.components.basic_component_config.ConfigData`.\n\nProvides a validator to check the units of the input values and convert\nthem if necessary.\n\nMake sure to check the datatype in validators, because the\n:class:`ComponentData` model is also used for the datatransfer\nconfiguration to components.\nThis model looks different, so validators should check datatypes before\ntrying to validate data to avoid unexpected errors.\nExample for datatype checks in validators::\n\n @model_validator(mode=\"after\")\n def check_model(self) -> \"InputPreparationInputData\":\n \"Model validator to check the model after initialization.\"\n\n if not isinstance(self.field, DataPointGeneral):\n return self\n\n # check the model with your code\n return self\n\n @field_validator(\"field\", mode=\"before\")\n @classmethod\n def check_field(cls, value: DataPointGeneral) -> DataPointGeneral:\n \"Check only a field before initialization.\"\n\n if not isinstance(value, DataPointTimeSeries):\n return value\n\n # check the field with your code\n return value", "type": "object", "properties": {} }
- pydantic model encodapy.components.basic_component_config.ComponentIOModel[source]
Bases:
BaseModelModel for the input and output of the thermal storage service.
- Variables:
input (
InputModel) – Input configuration for the thermal storage serviceoutput (
OutputModel) – Output configuration for the thermal storage service
Show JSON schema
{ "title": "ComponentIOModel", "description": "Model for the input and output of the thermal storage service.\n\nAttributes:\n input (:class:`~encodapy.utils.datapoints.InputModel`): Input configuration for the thermal storage service\n output (:class:`~encodapy.utils.datapoints.OutputModel`): Output configuration for the thermal storage service", "type": "object", "properties": { "input": { "allOf": [ { "$ref": "#/$defs/InputData" } ], "description": "Input configuration for the thermal storage service" }, "output": { "allOf": [ { "$ref": "#/$defs/OutputData" } ], "description": "Output configuration for the thermal storage service" } }, "$defs": { "InputData": { "description": "Base model for the component input configuration.\n\nSubclass this and declare fields for each input datapoint. InputData\ninherits the unit-checking validator from :class:`~encodapy.components.basic_component_config.ComponentData`,\nwhich will validate and convert units when possible.\n\nFields should be instances of :class:`~encodapy.utils.datapoints.DataPointGeneral`\n(or subclasses thereof) so the validator can handle unit and value conversion.\n\nNeeds to be implemented for the specific component.", "properties": {}, "title": "InputData", "type": "object" }, "OutputData": { "description": "Base model for the component output configuration.\n\nSubclass this and declare fields for each output datapoint. OutputData\ninherits the unit-checking validator from :class:`~encodapy.components.basic_component_config.ComponentData`,\nwhich will validate and convert units when possible.\n\nFields should be instances of :class:`~encodapy.utils.datapoints.DataPointGeneral`\n(or subclasses thereof) so the validator can handle unit and value conversion.\n\nNeeds to be implemented for the specific component.", "properties": {}, "title": "OutputData", "type": "object" } }, "required": [ "input", "output" ] }
-
field output:
OutputData[Required] Output configuration for the thermal storage service
- pydantic model encodapy.components.basic_component_config.ConfigData[source]
Bases:
ComponentDataBase model for the component static configuration data.
Subclass this and declare fields for each static configuration datapoint. ConfigData inherits the unit-checking validator from
ComponentData, which will validate and convert units when possible.Fields should be instances of
DataPointGeneral(or subclasses thereof) so the validator can handle unit and value conversion.Needs to be implemented by the user if static configuration is required.
Show JSON schema
{ "title": "ConfigData", "description": "Base model for the component static configuration data.\n\nSubclass this and declare fields for each static configuration datapoint. ConfigData\ninherits the unit-checking validator from :class:`~encodapy.components.basic_component_config.ComponentData`,\nwhich will validate and convert units when possible.\n\nFields should be instances of :class:`~encodapy.utils.datapoints.DataPointGeneral`\n(or subclasses thereof) so the validator can handle unit and value conversion.\n\nNeeds to be implemented by the user if static configuration is required.", "type": "object", "properties": {} }
- pydantic model encodapy.components.basic_component_config.ConfigDataPoints[source]
Bases:
RootModel[Dict[str, Union[IOAllocationModel, DataPointGeneral]]]Model for the configuration of config data points.
See also
IOAllocationModelandDataPointGeneral.Show JSON schema
{ "title": "ConfigDataPoints", "description": "Model for the configuration of config data points.\n\nSee also :class:`~encodapy.components.basic_component_config.IOAllocationModel` and\n:class:`~encodapy.utils.datapoints.DataPointGeneral`.", "type": "object", "$defs": { "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.", "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" } }, "required": [ "value" ], "title": "DataPointGeneral", "type": "object" }, "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" }, "IOAllocationModel": { "description": "Model for the input or output allocation.\n\nAttributes:\n entity (str): ID of the entity to which the input or output is allocated\n attribute (str): ID of the attribute to which the input or output is allocated", "properties": { "entity": { "description": "ID of the entity to which the input or output is allocated", "title": "Entity", "type": "string" }, "attribute": { "description": "ID of the attribute to which the input or output is allocated", "title": "Attribute", "type": "string" } }, "required": [ "entity", "attribute" ], "title": "IOAllocationModel", "type": "object" } }, "additionalProperties": { "anyOf": [ { "$ref": "#/$defs/IOAllocationModel" }, { "$ref": "#/$defs/DataPointGeneral" } ] } }
- pydantic model encodapy.components.basic_component_config.IOAllocationModel[source]
Bases:
BaseModelModel for the input or output allocation.
- Variables:
Show JSON schema
{ "title": "IOAllocationModel", "description": "Model for the input or output allocation.\n\nAttributes:\n entity (str): ID of the entity to which the input or output is allocated\n attribute (str): ID of the attribute to which the input or output is allocated", "type": "object", "properties": { "entity": { "description": "ID of the entity to which the input or output is allocated", "title": "Entity", "type": "string" }, "attribute": { "description": "ID of the attribute to which the input or output is allocated", "title": "Attribute", "type": "string" } }, "required": [ "entity", "attribute" ] }
- pydantic model encodapy.components.basic_component_config.IOModell[source]
Bases:
RootModel[Dict[str, IOAllocationModel]]Model for the input, staticdata and output of a component.
It contains a dictionary with the key as the ID of the input, output or static data and the value as the allocation model
See also
IOAllocationModel.There is no validation for this. It is used to create the the ComponentIOModel for each component.
Show JSON schema
{ "title": "IOModell", "description": "Model for the input, staticdata and output of a component.\n\nIt contains a dictionary with the key as the ID of the input, output or static data\nand the value as the allocation model\n\nSee also :class:`~encodapy.components.basic_component_config.IOAllocationModel`.\n\nThere is no validation for this.\nIt is used to create the the ComponentIOModel for each component.", "type": "object", "$defs": { "IOAllocationModel": { "description": "Model for the input or output allocation.\n\nAttributes:\n entity (str): ID of the entity to which the input or output is allocated\n attribute (str): ID of the attribute to which the input or output is allocated", "properties": { "entity": { "description": "ID of the entity to which the input or output is allocated", "title": "Entity", "type": "string" }, "attribute": { "description": "ID of the attribute to which the input or output is allocated", "title": "Attribute", "type": "string" } }, "required": [ "entity", "attribute" ], "title": "IOAllocationModel", "type": "object" } }, "additionalProperties": { "$ref": "#/$defs/IOAllocationModel" } }
- pydantic model encodapy.components.basic_component_config.InputData[source]
Bases:
ComponentDataBase model for the component input configuration.
Subclass this and declare fields for each input datapoint. InputData inherits the unit-checking validator from
ComponentData, which will validate and convert units when possible.Fields should be instances of
DataPointGeneral(or subclasses thereof) so the validator can handle unit and value conversion.Needs to be implemented for the specific component.
Show JSON schema
{ "title": "InputData", "description": "Base model for the component input configuration.\n\nSubclass this and declare fields for each input datapoint. InputData\ninherits the unit-checking validator from :class:`~encodapy.components.basic_component_config.ComponentData`,\nwhich will validate and convert units when possible.\n\nFields should be instances of :class:`~encodapy.utils.datapoints.DataPointGeneral`\n(or subclasses thereof) so the validator can handle unit and value conversion.\n\nNeeds to be implemented for the specific component.", "type": "object", "properties": {} }
- pydantic model encodapy.components.basic_component_config.OutputData[source]
Bases:
ComponentDataBase model for the component output configuration.
Subclass this and declare fields for each output datapoint. OutputData inherits the unit-checking validator from
ComponentData, which will validate and convert units when possible.Fields should be instances of
DataPointGeneral(or subclasses thereof) so the validator can handle unit and value conversion.Needs to be implemented for the specific component.
Show JSON schema
{ "title": "OutputData", "description": "Base model for the component output configuration.\n\nSubclass this and declare fields for each output datapoint. OutputData\ninherits the unit-checking validator from :class:`~encodapy.components.basic_component_config.ComponentData`,\nwhich will validate and convert units when possible.\n\nFields should be instances of :class:`~encodapy.utils.datapoints.DataPointGeneral`\n(or subclasses thereof) so the validator can handle unit and value conversion.\n\nNeeds to be implemented for the specific component.", "type": "object", "properties": {} }