Economic MPC and the Value of a Forecast

A commercial office building with rooftop chillers and air handlers

Open the Commercial Building HVAC and Demand Response app

Advanced Control Exercise 23 of 30 in Nonlinear and Economic MPC · All exercises · Time: 15 minutes

A building's concrete stores cooling for hours, and the electricity tariff and the demand charge change through the day. The objective is the bill with everyone comfortable, not a temperature setpoint. This exercise runs the same summer day four ways and shows that a forecast is worth money only if it is long enough, and that a short one can be worse than none.

Learning Outcomes

  • Replace a tracking objective with an economic one that includes a demand charge and a comfort band with slack.
  • Explain why the horizon must span the storage's time constant, and why a short forecast can cost more than none.
  • Compare a floating band, a priced precooling rule and an economic MPC by bill, peak demand and comfort.

Book Chapter

Model Predictive Control and Economic Optimization (Volume 9), Chapter 9, A Building HVAC Simulator With a Comfort Band Instead of a Setpoint. Read the chapter, open the PDF, or watch the lecture slides.

Theory in Brief

A two-node model holds the zone air `T_a`, which changes in minutes, and the building mass `T_m`, which changes in hours:

$$\begin{gathered} C_a \frac{dT_a}{dt} = \frac{T_m - T_a}{R_{am}} + \frac{T_o - T_a}{R_{ao}} + Q_{int} - Q_{cool}, \\ C_m \frac{dT_m}{dt} = \frac{T_a - T_m}{R_{am}} \end{gathered}$$

The economic MPC minimizes the energy bill and the demand charge on the day's highest 15-minute power, with comfort as a band priced by a slack:

$$\begin{gathered} \min \sum_k c_k P_k \Delta t + c_D \hat P + \rho \sum_k \epsilon_k \\ \mathrm{s.t.}\quad P_k \le \hat P, \\ T_{lo} - \epsilon_k \le T_{a,k} \le T_{hi} + \epsilon_k, \epsilon_k \ge 0 \end{gathered}$$

The epigraph variable `\hat P` turns the maximum into a linear constraint. Precooling the mass at night, when cooling is cheap and the chiller efficient, moves load out of the afternoon peak. That works only if the plan sees the afternoon while there is still time to cool the mass: the horizon must span the storage's time constant. A short horizon sees the peak too late and starts precooling when it can only add a new peak.

Model: Physics-based two-node thermal model per zone, with a chiller curve and the tariff.
Decision: Zone setpoints every 15 minutes, planned 24 hours ahead to minimize the bill within the comfort band.
Learning: The load and weather forecasts are inputs; a learned forecast would enter the plan the same way.

Exercise

Read 2 min · Predict 1 min · Run 7 min · Explain 3 min · Check your AI 2 min.

Predict. Floating at the top of the comfort band saves energy. Will it lower the demand charge? Will precooling with 90 minutes of forecast save more or less than with eight hours? Will a 24-hour MPC beat the priced rule?

Run the Commercial Building HVAC and Demand Response app. Use the fastest speed, 240 min/s, and press Run again to pause at the times in each step.

  1. Open 7 · The band, with no forecast — the building floats. Press Run in Auto and run the whole day (1440 min). Read Today, Peak demand and Comfort.
  2. Open 8 · The band, with eight hours of forecast, the priced precooling rule with eight hours of forecast, and run the day. Read the same tiles.
  3. Open 9 · Ninety minutes of forecast, which is worse than none (ninety minutes of forecast) and run the day.
  4. Open 15 · The same day, planned: a 24 h MPC against the priced rule (the 24-hour MPC) and run the day.

Explain.

  1. Why does ninety minutes of forecast cost more than none at all?
  2. Where does the MPC's saving over the priced rule (case 8) come from, energy or demand charge? Why?

Generative AI Learning

"A building controller precools the mass before an afternoon peak, using a weather and load forecast. How long should the forecast horizon be, and can a short forecast make the bill worse than no forecast? Explain."

Check the answer against your run: A good answer ties the horizon to the time needed to cool the mass and says a short forecast precools too late and sets a new peak. Your step 3 tile is the test. The assistant is your tutor and reviewer; you answer for every claim you turn in.

What to Turn In

A four-row table (float, precool 8 h, precool 90 min, MPC) with Today, Peak demand and Comfort, your written prediction, and three sentences that answer the two questions.

Floating at the top of the band costs $585 with a 202 kW peak and 100.0 % comfort. Precooling with eight hours of forecast costs $561 with a 188 kW peak. With ninety minutes it costs $602 with a 222 kW peak: more than the building that never precooled. The 24-hour MPC costs $558 with a 183 kW peak and 100.0 % comfort; the precooling runs also held every zone in band.

Ninety minutes of forecast sees the afternoon peak only when it is nearly here. The mass cannot be cooled that fast, so the attempt runs the chiller hard an hour before the peak and sets a new, higher demand peak. Precooling is storage, and storage needs a horizon longer than its charge time. The MPC's small saving over the priced rule is almost all demand charge: it prices the day's single peak quarter hour and shapes the afternoon load flat under it, and it can treat the four zones differently, where the rule has one setpoint for all four. The case text notes that retuning the rule can match it on this day; the plan's advantage shows on days the rule was not tuned for.

Measured with the app build of December 3, 2026 by a scripted replay of the steps above. Numbers that no tile shows come from the replay's record; your readings from the trends will be close. A later app release may move the last digit.

Benchmarks III solves energy problems in GEKKO. Pose a one-zone, two-node building over 24 hours with a time-of-use tariff, a demand charge via an epigraph variable, and a comfort band with slack. Solve it with horizons of 2, 6 and 24 hours (receding, re-solved each hour) and compare the bills.

Related

References

  1. Hedengren, J. D. (ed.), Model Predictive Control and Economic Optimization, Volume 9 of Interactive Control Engineering, Chapter 9, "A Building HVAC Simulator With a Comfort Band Instead of a Setpoint", pp. 202–233, Advanced Process Solutions, 2026. PDF (CC BY 4.0).
  2. Oldewurtel, F., Parisio, A., Jones, C. N., Gyalistras, D., Gwerder, M., Stauch, V., Lehmann, B., Morari, M., Use of model predictive control and weather forecasts for energy efficient building climate control, Energy and Buildings 45, 15–27, 2012.

Course Information

TCLab

Project

Applications

Advanced Control Exercises

Exams

Modeling

Machine Learning

Estimation

Control

Reinforcement Learning

Related Courses

Admin