s2_mpc is a seasonal stochastic model predictive control (MPC) framework for optimizing the operation of energy systems with short-term to seasonal storage under forecast uncertainty.
Using long-term scenarios and matching stochastic forecasts generated by ents_casting, simulates realistic energy system operation over multiple weather years while accounting for forecast uncertainty and seasonal storage management.
flowchart TD
A[Historical measured data] --> B[ents_casting]
B --> C["Long-term scenarios<br/>and stochastic forecasts"]
C --> F[s2_mpc]
D["Energy system configuration<br/><code>input_dict.txt</code>"] --> F
E["Configuration<br/><code>config.yaml</code>"] --> F
F --> G["Storage level trajectories<br/>and KPIs"]
Clone the repository:
git clone https://github.com/RWTH-LTT/s2_mpc.gitCreate a virtual environment:
python3 -m venv ./venv_s2_mpcActivate the virtual environment:
. venv_s2_mpc/Scripts/activateIf you already use a virtual environment for ents_casting, you can reuse that environment.
Install s2_mpc together with all required dependencies:
pip install -e ./s2_mpcconfig.yaml contains all settings required for the optimization, including:
- the path to the
ents_castingdata directory, - the energy system to optimize,
- the MPC look-ahead horizon,
- the number of stochastic forecast scenarios,
- Gurobi solver settings, and
- the method used to mitigate the end-of-horizon effect (including the forecast-updated annual cost-to-go).
The default configuration is sufficient for a first test run.
Two exemplary energy systems are currently provided:
input_dict_honda.txtinput_dict_flensburg.txt
s2_mpc requires long-term scenarios and stochastic forecasts generated by ents_casting. Ensure that these datasets are available in the directory specified in config.yaml.
Run the complete workflow:
python -m s2_mpcCommand-line arguments described in __main__.py can be used to overwrite the corresponding settings in config.yaml.
Many stages of the workflow can also be executed individually and parallelized using MPI.
Intermediate results are written to:
data_results/01-COMPUTED-INPUT
Final optimization results are written to:
data_results/02-RESULTS
s2_mpc has been at the Institute of Technical Thermodynamics (RWTH Aachen University) by:
- Benedict Brosius
- Judith Zoeller
- Mats Zoellmann
- Stefan Helders
- Jan Wilberg
If s2_mpc supports your research, please cite:
Brosius, B., Zoeller, J., Zoellmann, M., Helders, S., Nilges, B., Schricker, H., & von der Assen, N. (2026). Model predictive control of smart energy systems with seasonal storage: Mitigating the end-of-horizon effect via stochastic dynamic programming. Energy Conversion and Management: X. https://doi.org/10.1016/j.ecmx.2026.102138