← Lesson diary · Process Identification and Control
Process Identification and Control · Lessons 11–13
A house with photovoltaic panels, a battery and a handful of appliances, on a time-of-use tariff. You decide which appliances have to run today and inside which hours they are allowed to run; the controller decides when to start each of them and what to do with the battery, so that the electricity bill of the day is as small as possible. This is the economic MPC problem of the lesson, written exactly as on the blackboard and solved in your browser.
| Load | Not before | Done by |
|---|
| from … to |
| Strategy | Bill of the day | Battery at midnight | Service | Net cost | Bought | Sold | Self-consumed | Peak |
|---|
One optimization over the 24 hours of the day, with perfect forecasts of generation and of the non-plannable load. In closed loop it is re-solved at every step on the updated state and forecast; with nothing unexpected happening, the plan you see here is what the controller would follow.
min Σt T/3600 · (cint Pint − coutt Poutt) + cwear Σt T/3600 · (Pcht + Pdist) − cterm xN
Pint − Poutt = Pnplt + Pplt + Pesst − Ppvt
Pplt = Σℓ Σj Pℓ(t−j+1) sj,ℓ Σj=SℓFℓ−Nℓ sj,ℓ = 1 sj,ℓ ∈ {0,1}
xt+1 = xt + ηch T/3600 Pcht − (1/ηdis) T/3600 Pdist
When a flexibility service is asked for, one more term joins the objective over the hours of the event: λ Σ T/3600 · (Pint − Pcap)+ for the cap, or λ Σ T/3600 · |Ppoct − Preft| for the curve, each written with the two non-negative variables of the exact linearization of the absolute value. The fee paid for the service is a constant and does not change the optimal plan — it changes whether accepting the service was a good idea, which is your decision, not the controller's.
Each appliance has a fixed power profile and a duration; the binary sj,ℓ says that load ℓ starts at hour j, and the equality says it starts exactly once, inside the window you choose. That makes this a mixed-integer linear program, which the page solves with a simplex and a branch and bound written for the occasion. Both were checked against the Cbc solver on a few hundred random instances of this same model, optimum against optimum.
Simplifications with respect to the lecture: no electric vehicle, no thermal part, and the indicator variables that forbid buying and selling (or charging and discharging) at the same time are left out, because with a selling price below the buying one and a round-trip efficiency below one the optimal solution never does either. The page checks it on every solution.