ESSIM supports integrating external models for two main purposes:
- Asset Logic: Replacing the default internal logic of an ESDL
EnergyAssetwith an external model. - KPI Calculation: Using external microservices to calculate Key Performance Indicators (KPIs) based on simulation results (.
External models for assets are managed via a Model Service Orchestration (MSO) controller. This allows ESSIM to trigger the deployment of external models (typically in Docker containers) and synchronize with them during the simulation steps.
The interaction follows this flow:
- Deployment: ESSIM sends a
DeployModelsmessage to the MSO controller via MQTT. - Lifecycle: The MSO controller starts the external models and ESSIM waits for a
ModelsReadysignal. - Simulation Loop: For each time step, ESSIM communicates with the external model via MQTT to exchange bid curves and energy allocations.
- Termination: When the simulation finishes, ESSIM sends a
SimulationDonemessage to the MSO controller to tear down the models.
To enable MSO, include the mso and nodeConfig sections in your simulation configuration:
{
"mso": {
"msoID": "my-mso-controller",
"mqttHost": "mqtt-broker.example.com",
"mqttPort": 1883
},
"nodeConfig": [
{
"esdlNodeId": "building_123",
"mqttHost": "mqtt-broker.example.com",
"mqttPort": 1883,
"mqttTopic": "essim/external_model/building_123",
"config": {
"parameter_1": 42
}
}
]
}mso: Configures the connection to the MSO controller.nodeConfig: Specifies which ESDL assets should use external logic. TheesdlNodeIdmust match the ID of anEnergyAssetin the ESDL model.
Lifecycle messages use Protobuf and are exchanged on the following topics:
- Publish (ESSIM → MSO):
/lifecycle/essim/mso/{simulationId}/DeployModels: Requests deployment of models./lifecycle/essim/mso/{simulationId}/SimulationDone: Signal that simulation is finished.
- Subscribe (MSO → ESSIM):
/lifecycle/mso/essim/{simulationId}/ModelsReady: Signal that all models are started and ready.
During the simulation, ESSIM communicates with the RemoteLogicNode via the configured mqttTopic:
-
Initial Configuration (JSON): Topic:
{mqttTopic}/node/{nodeId}/configPayload: Includes ESDL snippet and customconfigfromnodeConfig. -
Bid Curve Request (JSON): Topic:
{mqttTopic}/node/{nodeId}/createBidPayload:{"timeStamp": 12345678, "timeStepInSeconds": 3600, "minPrice": 0, "maxPrice": 1, ...} -
Bid Curve Response (Binary): ESSIM subscribes to:
.../simulation/{nodeId}/{carrierId}/bidPayload format:timestep(8-byte long)- Sequence of
(price, energy)pairs (8-byte double each).
-
Energy Allocation (JSON): Topic:
{mqttTopic}/node/{nodeId}/allocatePayload:{"timeStamp": 12345678, "price": 0.5, "carrierId": "electricity"}