Skip to content

Handle multiple contracts with different delivery timesteps

Request Summary

At the moment, multiple contracts with the same product need to be executed at the same timesteps, see ContractManager line 62ff. Allow multiple different contracts with the same product to be handled.

Use case

If an Agent A provides a product to other Agents, e.g., an electricity price forecast, all the connected client agents need to contract this forecast at the same time and with the same time interval.

If client Agents require different time offsets or intervals:

  • currently: clients cannot use the same product on Agent A, but Agent A must provide "different" products to circumvent the test
  • proposed: clients can use the same product on Agent A

Considerations

Coordinate actions with input messages

In MessageManager, Messages are split by the Product their associated Contract refers to: Message -> Contract -> Product -> "Mailbox". Thus, if an Action is triggered by anything other than a triggering input message, there is an increased risk, that multiple execution time event series from different Contracts using the same Action can lead to "NO_MESSAGE_ERRORS".

Examples

Agent A offers Product "Forecast", but requires some "Input" message first from Agent B. Each forecast is valid for a certain amount of time, e.g., 1 hour, after which it needs updating.

If the provision of forecasts is mixed with digesting the required input, multiple clients (X & Y) contracting Agent A to provide its forecast are forcefully synchonised in time, and thus can be linked more easily with the required input from Agent B:

Removing the synchronisation between clients X and Y will lead to an error for the client served second when the same setup is used, since the second client request will lack the formally required input from Agent B:

Circumventing this requires splitting the Action into two Actions:

  • Digest Input from B
  • Prepare Forecast using ForecastRequest from X or Y; ensure availability of input data internally

Coordination of input from multiple agents

Problems can occur if an action requires inputs from multiple other agents, and is also triggered by this input. For example: Agent A receives a message from Agents B,C,D each. Then, Agent A is to calculate the sum of the messages. If the input message triggers the sum calculation, but Agents B,C, and D do not send their messages at the same time, the action will be called upon multiple times instead once - and the sum calculation will calculate multiple partial sums instead of one sum total.

To circumvent this, the action could be split into one "digestion" action and one calculation action. Alternatively, #147 would allow to explicitly keep synchronisation for some actions that require it.

Proposed Implementation

to be discussed

Edited by Christoph Schimeczek
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information