← Lesson diary · Process Identification and Control

Service Area Lab

Process Identification and Control · Lesson 6

Service Area Lab

The charging area of the case study, run for a full day. Vehicles arrive and recharge, the photovoltaic plant produces what it produces, and a storage system is the only thing the controller can act on. The question is how much power ends up crossing the point of connection — which is what the capacity part of the bill is paid on. Everything is computed in your browser while the day runs.

The service area

00:00
POC with MPC
0.0 kW
without storage: 0.0
Storage
30.0 kWh
u = 0.00 kW
Charging demand
0.0 kW
ppev, known forecast
Renewables
0.0 kW
pres, known forecast
Power at the point of connectionkW
with MPC without storage plan over the window limits pmin, pmax
Energy in the storage xkkWh
Storage power ukkW
Disturbances: demand and renewableskW
ppev charging demand pres renewables

The day so far

0 min
Operation Peak |p| at the POC Time beyond the limits Energy taken from the grid Energy sent back
Without storage — — — —
With MPC — — — —

The peak is the number that sizes the connection and the capacity part of the bill, so it is the one to watch.

The problem solved at every step k

The same formulation written in class, and the same one in the Julia code: sign convention of the consumer, so power consumed is positive and u > 0 charges the storage.

min Σi=1..N [ α·pi² + β·(xi − xref)² ] + βf·(xN+1 − xref)²
s.t. pi = ui + ppevi − presi (balance at the POC)
   xi+1 = xi + (T/3600)·ui (storage)
   x1 = xk (measurement)
   umin ≤ ui ≤ umax, xmin ≤ xi ≤ xmax, pmin ≤ pi ≤ pmax

Sampling time T = 60 s, one step per minute, 24 hours. Only u1 is applied, then the whole problem is rebuilt one minute later. Because p is an affine function of u, the limits on the power at the point of connection are simple bounds on the control, and what is left is the same quadratic program as in the tank lab.

What to notice

  • The peak, not the energy. The storage does not create energy: over the day the area takes from the grid roughly what it consumes either way. What changes is the peak, and that is what the connection is sized on and what the capacity tariff charges.
  • Charging before the rush. In the ordinary day the controller fills the storage during the hours of sun and empties it in the evening, when the vehicles arrive and the photovoltaic is gone. It can do that only because the forecasts are inside its window.
  • The window has to span the event. With N = 20 steps the controller sees twenty minutes ahead, which is not enough to prepare for an evening that lasts two hours. Push N up and watch the preparation start earlier and the peak drop.
  • Without the forecast there is no anticipation. Untick the forecast box: the controller then assumes the present demand will persist, and reacts instead of preparing.
  • Storage size and power. A larger capacity is useless if the power limit is small, and the other way round: try moving the two sliders in opposite directions.
  • The energy reference is a soft wish, and you can price it. β decides how hard the storage is pulled back towards xref, ready for the next event, and it is paid for in power at the point of connection. With the settings the page opens with the storage ends the day within half a kilowatt-hour of its reference and the peak is still halved. Lower β to 0.02 and the storage ends the day five kilowatt-hours away, because the optimal trade-off accepts a deviation that decays with a time constant of about seven hours. Raise it to 2 and the controller keeps the storage tidy but stops shaving: the peak climbs back towards the one of the area without storage.
  • The terminal cost decides whether the storage comes home. Untick "terminal cost from the Riccati equation" and the storage drifts: it ends the day far from its reference and comes back only very slowly. The reason is the one of Lesson 4. With a window of twenty minutes, a controller whose terminal cost is just the stage weight β sees almost no value in the state it leaves behind, so it is myopic. The right terminal cost is the value function of the unconstrained problem, the xTWx with W from the Riccati equation — here about four hundred times β — and with it the twenty-minute controller behaves like the infinite-horizon one.