Stochastic MPC for energy hubs using data driven demand forecasting

Francesco Micheli, Varsha Behrunani, Jonas Mehr, Philipp Heer, John Lygeros

Introduction

Energy hubs serve as integrated systems that coordinate multiple energy carriers—such as electricity, natural gas, and thermal energy—to optimize local generation, conversion, and storage. These systems are essential for modernizing the power grid, yet they face a significant hurdle: the inherent unpredictability of demand. Building energy consumption is influenced by chaotic variables including weather patterns, occupancy, and human behavior.

Traditional deterministic controllers often struggle with this uncertainty; a controller that is too optimistic may violate physical constraints or deplete storage, while one that is too conservative incurs excessive operational costs. This paper proposes a robust framework that combines probabilistic forecasting with stochastic optimization to manage these trade-offs effectively.

Methodology

Data-Driven Forecasting

The authors utilize Gaussian Process (GP) regression to model electricity and thermal demands. Unlike standard neural networks that provide a single point estimate, GPs yield a full probability distribution, offering a measure of uncertainty for every prediction. To project demand over a 24-hour horizon, the system employs a recursive sampling algorithm: the model predicts the next hour's demand, samples a value from that distribution, and uses it as an input for the subsequent hour. This process captures the non-Gaussian nature of multi-step trajectories, which is critical for realistic scenario generation.

Scenario-Based Stochastic MPC

The control strategy is built on a Scenario-Based Stochastic Model Predictive Control (MPC). In this approach, the controller samples $M$ possible demand trajectories from the GP model. It then solves a deterministic optimization problem designed to satisfy system constraints—such as storage limits and conversion capacities—across all $M$ scenarios simultaneously.

The energy hub modeled in this study includes:

  • Photovoltaics (PV)
  • Combined Heat and Power (CHP) unit
  • Heat Pump (HP)
  • Gas Boiler (GB)
  • Electrical and Thermal Storage Systems

To maintain mathematical feasibility in the face of extreme demand scenarios, the authors incorporate "slack variables." These allow the optimization to find a solution even when constraints are technically violated, by applying a heavy penalty to the cost function rather than strictly forbidding the state.

Experimental Setup

The framework was tested using real-world data from the ETZ building at ETH Zürich, Switzerland.

  • Training: Three years of historical data were used to optimize GP hyperparameters.
  • Evaluation: The controller was simulated over a three-month period (December 2018 to February 2019).
  • Features: The models integrated time encoding (sine/cosine), workday/holiday flags, ambient temperature, solar irradiation, and lagged demand values.

Key Insights and Results

Forecast Accuracy

The GP-based predictor demonstrated high reliability, maintaining residuals within ±5% for electricity and ±10% for heat for the first and third quartiles across the entire 24-hour horizon.

Reliability vs. Cost

The study highlights a crucial trade-off between operational safety and cost.

  • Baseline: A theoretical controller with "perfect information" (knowing future demand exactly) achieved a cost of 59.01 CHF/h.
  • Stochastic Performance: By increasing the number of scenarios ($M$) from 1 to 100, the authors reduced thermal constraint violations from approximately 30% of the time to nearly 0%.
  • Economic Efficiency: Most importantly, this significant gain in reliability came with only a marginal increase in operational costs, suggesting that stochastic MPC can provide safety without sacrificing economic viability.

Conclusion and Future Work

This research demonstrates that combining Gaussian Process forecasting with scenario-based MPC provides a robust solution for energy hub management. The "receding horizon" nature of MPC—where the plan is recalculated every hour—provides intrinsic robustness, allowing the system to achieve high reliability with a manageable number of scenarios.

Future work will address the integration of PV generation uncertainty into the stochastic framework and explore the scaling of this approach to distributed energy hubs, where multiple buildings coordinate to balance loads across a wider network.

Summary updated

Abstract

Energy hubs convert and distribute energy resources by combining different energy inputs through multiple conversion and storage components. The optimal operation of the energy hub exploits its flexibility to increase the energy efficiency and reduce the operational costs. However, uncertainties in the demand present challenges to energy hub optimization. In this paper, we propose a stochastic MPC controller to minimize energy costs using chance constraints for the uncertain electricity and thermal demands. Historical data is used to build a demand prediction model based on Gaussian processes to generate a forecast of the future electricity and heat demands. The stochastic optimization problem is solved via the Scenario Approach by sampling multi-step demand trajectories from the derived prediction model. The performance of the proposed predictor and of the stochastic controller is verified on a simulated energy hub model and demand data from a real building.
BibTeX
@inproceedings{micheli2023stochastic,
  author = {Francesco Micheli and Varsha Behrunani and Jonas Mehr and Philipp Heer and John Lygeros},
  title = {{Stochastic MPC for energy hubs using data driven demand forecasting}},
  booktitle = {IFAC-PapersOnLine},
  year = {2023},
  doi = {10.1016/j.ifacol.2023.10.803},
}
Figure