io
input_data_inventory
- class libdots.io.input_data_inventory.InputDataInventory(calculation_messages: dict[str, list[type[IODataInterface]]], service_name: str)[source]
Bases:
objectThe input data inventory. This tracks the incoming mqtt messages and whether all required messages have been received for a specific calculation function.
- Parameters:
calculation_messages – A dictionary of function names and message types it should receive.
service_name – The name of the calculation service.
An example for calculation_messages looks like this
{ "post_battery": [NewStep, ChargeConsumption, Supply], "pre_battery": [NewStep, Load, PvOutput, Import, Export], }
This defines that there are 2 calculation functions for the calculstion service and what message type each of them requires as input.
- create_new_class(input_class: type[IODataInterface], serialized_values: bytes) IODataInterface[source]
- property expected_esdl_ids_dict: dict[str, list[str]]
- get_input_data(calc_name: str) dict[str, NewStep | list[IODataInterface]][source]
io_data
- class libdots.io.io_data.IODataInterface[source]
Bases:
ABCAbstract class defining incoming our outgoing messages. The actual data is comming from the messages in the
messagesmodule, and those are compiled from protobuf in message_definitions.
- class libdots.io.io_data.ModelParameters[source]
Bases:
IODataInterface- get_values_as_serialized_protobuf() bytes[source]
Get a protobuf encoded message with all variables.
- parameters_dict: ModelParametersDescription
- class libdots.io.io_data.NewStep[source]
Bases:
IODataInterfaceMessages that are sent over MQTT for each new timestep.
- get_values_as_serialized_protobuf() bytes[source]
Get a protobuf encoded message with all variables.
- parameters_dict: TimeStepDescription
mqtt_client
- class libdots.io.mqtt_client.MqttClient(host: str, port: int, qos: int, username: str, password: str, service_name: str, input_data_inventory: InputDataInventory, service_calc: ServiceCalc[Any], sim_logger: Logger)[source]
Bases:
objectThe MQTT Client handling receiving and sending MQTT messages.
- property mqtt_client: Client
mqtt_log_handler
- class libdots.io.mqtt_log_handler.MqttLogHandler(client: MqttClient)[source]
Bases:
Handler