Oemof.solph Non optimal control / Definition of custom EMS


I was wondering if there is a possibility in oemof.solph to define a custom EMS controller that controls the battery (e.g. by setting its power level) during the simulation. The background of the question is that I would like to investigate simple (rule based) control algorithms (for example for peak shaving or self consumption optimization for batteries).

As I understand it, as oemof applies optimization, only an “optimal” control strategy can be found. However, I wanted to double check if there is options to apply rule based (“non optimnal”) control strategies as well.

Thanks and kind regards


Hi Tobi,

This topic is brought up from time to time, however, there is no straightforward solution. If it’s possible to imprint the strategy into costs, you can mimic a traditional control strategy. This approach is e.g. shown in [1]. It’s easy to implement if all of your control parameters are known beforehand, e.g. if you control based on ambient temperature. For battery storage you could force the optimizer to charge early by giving costs to store the energy that rise with time.

So, solph will always find the optimal control strategy. But you can often set the costs in a way that your control strategy is optimal.

1: Energies | Free Full-Text | Deduction of Optimal Control Strategies for a Sector-Coupled District Energy System

1 Like

Hi @tobirohrer This work is historical, but the deeco framework mimicked control system behavior to set flow (often stylized “flo”) and return temperatures in heat networks prior to stepwise (recursive dynamic) optimization. See:

And in particular:

  • figure 8.1 flowchart (p121) (numbered 136 on PDF)
  • section §8.6 on “thermal sub-networks” (p146–150) (numbered starting 161 on PDF)

It can sometimes be useful to see how others have framed up similar problems. That said, this method may well not port to entire horizon optimization? HTH, R