Model Predictive Control for smart energy systems [1cm...

21
Model Predictive Control for smart energy systems MPC for a portfolio of heat pumps - new results Hjørdis Amanda Schlüter, Jozsef Gaspar, John Bagterp Jørgensen CITIES MPC Workshop, Technical University of Denmark, Kgs. Lyngby, May 18, 2018

Transcript of Model Predictive Control for smart energy systems [1cm...

Page 1: Model Predictive Control for smart energy systems [1cm ...smart-cities-centre.org/wp-content/uploads/Slides-John.pdf · Price(Eur)-standardapproach 0.68 1.41 Price(Eur)-MPC 0.35 0.95

Model Predictive Control for smart energy systems

MPC for a portfolio of heat pumps - new results

Hjørdis Amanda Schlüter, Jozsef Gaspar, John Bagterp Jørgensen

CITIES MPC Workshop,

Technical University of Denmark,Kgs. Lyngby, May 18, 2018

Page 2: Model Predictive Control for smart energy systems [1cm ...smart-cities-centre.org/wp-content/uploads/Slides-John.pdf · Price(Eur)-standardapproach 0.68 1.41 Price(Eur)-MPC 0.35 0.95

Introduction

Heat pumps• Efficient for heating (and cooling) buildings

• Use electricity efficiently

• Ideal for an energy system with significant stochastic energy sources such aswind and solar energy

Model Predictive Control (MPC)• MPC has been suggested to control heat pumps.

• One can use direct control or control using prices. We investigate price basedcontrol.

• Use the thermal inertia (mass) of buildings to store heat when the electricityprices are low

2 DTU Compute 18.5.2018

Page 3: Model Predictive Control for smart energy systems [1cm ...smart-cities-centre.org/wp-content/uploads/Slides-John.pdf · Price(Eur)-standardapproach 0.68 1.41 Price(Eur)-MPC 0.35 0.95

The building and the heat pump

3 DTU Compute 18.5.2018

Page 4: Model Predictive Control for smart energy systems [1cm ...smart-cities-centre.org/wp-content/uploads/Slides-John.pdf · Price(Eur)-standardapproach 0.68 1.41 Price(Eur)-MPC 0.35 0.95

Building model

Energy balances

Cp,rTr = Qfr −Qra + (1− p)φs

Cp,f Tf = Qwf −Qfr + pφs

Cp,wTw = Qc −Qwf

Conductive heat transfer rates

Qra = (UA)ra(Tr − Ta)Qfr = (UA)fr(Tf − Tr)Qwf = (UA)wf (Tw − Tf )

4 DTU Compute 18.5.2018

Page 5: Model Predictive Control for smart energy systems [1cm ...smart-cities-centre.org/wp-content/uploads/Slides-John.pdf · Price(Eur)-standardapproach 0.68 1.41 Price(Eur)-MPC 0.35 0.95

The heat pump - vapor compression cycle (VCC)

COP = h3(T3, P4)− h4(Tw + ∆T, P4)h3(T3, P4)− h2(Tgr −∆T, P2)Qc = ηe · COP ·Wc

5 DTU Compute 18.5.2018

Page 6: Model Predictive Control for smart energy systems [1cm ...smart-cities-centre.org/wp-content/uploads/Slides-John.pdf · Price(Eur)-standardapproach 0.68 1.41 Price(Eur)-MPC 0.35 0.95

Nonlinear economic MPC

minu

φ =∫ tf

t0

(C(x(t), u(t), d(t)) + V (y(t)))dt,

s.t. x(t0) = xk, k ≥ 0˙x(t) = Ax(t) +Bu(t) + Ed(t), t ∈ [t0, tf ]y(t) = Cx(t), t ∈ [t0, tf ]umin(t) ≤ u(t) ≤ umax(t), t ∈ [t0, tf ]∆umin(t) ≤ ∆u(t) ≤ ∆umax(t), t ∈ [t0, tf ]ymin(t)− v(t) ≤ y(t), t ∈ [t0, tf ]ymax(t) + v(t) ≥ y(t), t ∈ [t0, tf ]v(t) ≥ 0, t ∈ [t0, tf ]

Energy cost:C(x(t), u(t), d(t)) = pel(t) ·Wc

Comfort penalty:

V (y) = ρ(Tr − Tmin)min + ρ(Tr − Tmax)max

6 DTU Compute 18.5.2018

Page 7: Model Predictive Control for smart energy systems [1cm ...smart-cities-centre.org/wp-content/uploads/Slides-John.pdf · Price(Eur)-standardapproach 0.68 1.41 Price(Eur)-MPC 0.35 0.95

Nonlinear economic MPC - resultsGaspar et al (2017):

16

18

20

22

24T

r (oC

)

NMPC LMPC LMPC w. COP = 4.5

0

1

2

3

Qc (

kW

)

2

4

6

CO

P

0

0.25

0.5

0.75

1

Wc (

kW

)

00:00 06:00 12:00 18:00 00:00 06:00 12:00 18:00 00:00 06:00 12:00 18:00 00:00 06:00 12:00 18:00 00:00 06:00 12:00 18:00 00:0020

40

60

pel (

Eu

r/M

Wh

)a

b

c

d

e

Control algorithm Wc Ctotal Wc,avg Cavg TVU TVT Crel(kW h) (Euro) (kW h/month) Euro/month (W ) (K) (%)

Reference MPC 9.49 1.602 56.9 9.62 289.0 - -Linear MPC, COP = 4.5 8.15 0.945 48.9 5.67 389.2 0.92 41.0Linear MPC 7.84 0.976 47.0 5.86 455.9 0.95 39.0Nonlinear MPC 7.60 0.943 45.6 5.66 452.5 0.69 41.2

7 DTU Compute 18.5.2018

Page 8: Model Predictive Control for smart energy systems [1cm ...smart-cities-centre.org/wp-content/uploads/Slides-John.pdf · Price(Eur)-standardapproach 0.68 1.41 Price(Eur)-MPC 0.35 0.95

Heat pump model

Nonlinear model:

COP = h3(T3, P4)− h4(Tw + ∆T, P4)h3(T3, P4)− h2(Tgr −∆T, P2)

Qc = ηe · COP ·Wc

Linear model with constant coefficient of performance, COP, and electricalefficiency, ηe:

Qc = ηWc

whereη = ηe · COP

8 DTU Compute 18.5.2018

Page 9: Model Predictive Control for smart energy systems [1cm ...smart-cities-centre.org/wp-content/uploads/Slides-John.pdf · Price(Eur)-standardapproach 0.68 1.41 Price(Eur)-MPC 0.35 0.95

Model

Energy balances

Cp,rTr = Qfr −Qra + (1− p)φs

Cp,f Tf = Qwf −Qfr + pφs

Cp,wTw = Qc −Qwf

Conductive heat transfer rates

Qra = (UA)ra(Tr − Ta)Qfr = (UA)fr(Tf − Tr)Qwf = (UA)wf (Tw − Tf )

Heat pump

Qc = ηWc

9 DTU Compute 18.5.2018

Page 10: Model Predictive Control for smart energy systems [1cm ...smart-cities-centre.org/wp-content/uploads/Slides-John.pdf · Price(Eur)-standardapproach 0.68 1.41 Price(Eur)-MPC 0.35 0.95

Linear discrete time state space model

Linear model

xk+1 = Axk +Buk + Edk

yk = Cxk

States (x), manipulated variable (u), disturbances (d), and output (y):

x =

Tr

Tf

Tw

u = Wc d =[Ta

φs

]y = Tr

10 DTU Compute 18.5.2018

Page 11: Model Predictive Control for smart energy systems [1cm ...smart-cities-centre.org/wp-content/uploads/Slides-John.pdf · Price(Eur)-standardapproach 0.68 1.41 Price(Eur)-MPC 0.35 0.95

Linear program - linear economic MPC

min φ

s.t. xk+1 = Axk +Buk + Edk, k = 0, 1, . . . , N − 1,yk = Cxk, k = 1, . . . , N,umin ≤ uk ≤ umax, k = 0, 1, . . . , N − 1,∆umin ≤ ∆uk ≤ ∆umin, k = 0, 1, . . . , N − 1,

Soft constraints (k = 1, 2, . . . , N)ymin,k − s1,k − s2,k ≤ yk, yk ≤ ymax,k + t1,k + t2,k,

0 ≤ s1,k ≤ s1,max, 0 ≤ t1,k ≤ t1,max,

0 ≤ s2,k ≤ ∞, 0 ≤ t2,k ≤ ∞.Objective function

φ =

Energy cost︷ ︸︸ ︷N−1∑k=0

c′kuk +

Temperature violations︷ ︸︸ ︷N∑

k=1ρ′s1s1,k + ρ′s2s2,k + ρ′t1t1,k + ρ′t2t2,k

11 DTU Compute 18.5.2018

Page 12: Model Predictive Control for smart energy systems [1cm ...smart-cities-centre.org/wp-content/uploads/Slides-John.pdf · Price(Eur)-standardapproach 0.68 1.41 Price(Eur)-MPC 0.35 0.95

Heat pump performance using Model Predictive Control

Heat pump using a standard approach vs. using a MPC over a 5 day period

18

20

22

24

0

0.2

0.4

0.6

0.8

1

40

60

80

100

0:00 12:00 0:00 12:00 0:00 12:00 0:00 12:00 0:00 12:00 0:00

0

0.5

1

1.5

40

60

80

100

18

20

22

24

0

0.2

0.4

0.6

0.8

1

40

60

80

100

0:00 12:00 0:00 12:00 0:00 12:00 0:00 12:00 0:00 12:00 0:00

0

0.5

1

1.5

40

60

80

100

12 DTU Compute 18.5.2018

Page 13: Model Predictive Control for smart energy systems [1cm ...smart-cities-centre.org/wp-content/uploads/Slides-John.pdf · Price(Eur)-standardapproach 0.68 1.41 Price(Eur)-MPC 0.35 0.95

Heat pump performance using Model Predictive Control

Performance improval by using a MPCAs illustrated by the figures on the previous slide, the MPC is able to:

• Incorporate an upper limit on the input power of a portfolio of heat pumps

• Regulate the heat flow such that the indoor temperature is kept between anupper and a lower limit

• React on the given electricity prices by only turning the pump on when theelectricity price is low

House 1 House 2Price (Eur) - standard approach 0.68 1.41Price (Eur) - MPC 0.35 0.95Savings by using MPC 48.9% 32.8%

Table: Price saving over the 5 day period of the previous example using a MPC

13 DTU Compute 18.5.2018

Page 14: Model Predictive Control for smart energy systems [1cm ...smart-cities-centre.org/wp-content/uploads/Slides-John.pdf · Price(Eur)-standardapproach 0.68 1.41 Price(Eur)-MPC 0.35 0.95

Heat pump for a good and a poorly insulated houseHow the seasons affect performance of the heat pump of a good and apoorly insulated houseIn the following "House 1" refers to a good insulated house and "House 2" refersto a poorly insulated house.

18

20

22

24

0

0.2

0.4

0.6

0.8

1

40

60

80

100

0:00 12:00 0:00 12:00 0:00 12:00 0:00 12:00 0:00 12:00 0:00

0

10

20

30

0

50

100

150

200

250

18

20

22

24

0

0.2

0.4

0.6

0.8

1

40

60

80

100

0:00 12:00 0:00 12:00 0:00 12:00 0:00 12:00 0:00 12:00 0:00

0

10

20

30

0

50

100

150

200

250

14 DTU Compute 18.5.2018

Page 15: Model Predictive Control for smart energy systems [1cm ...smart-cities-centre.org/wp-content/uploads/Slides-John.pdf · Price(Eur)-standardapproach 0.68 1.41 Price(Eur)-MPC 0.35 0.95

Relation between the magnitude of the electricity prices and the penaltyfor violating constraints

Importance of choosing the right penalty parameterThe lower soft constraint s1 for the indoor temperature y and the lower constraint ymin isdefined as

y ≥ ymin − s1, with 0 ≤ s1 ≤ ∞.

For the temperature to be as close as possible to the desired ymin there is a penalty ρ1associated with this soft constraint. However, for heat pumps there is a relation betweenthis penalty parameter and the magnitude of the electricity prices.

With a prediction horizon of 2 days this relation is visible:

18

20

22

24

0

0.2

0.4

0.6

0.8

1

4

6

8

1010

7

18

20

22

24

0

0.2

0.4

0.6

0.8

1

4

6

8

1010

7

18

20

22

24

0

0.2

0.4

0.6

0.8

1

4

6

8

1010

7

15 DTU Compute 18.5.2018

Page 16: Model Predictive Control for smart energy systems [1cm ...smart-cities-centre.org/wp-content/uploads/Slides-John.pdf · Price(Eur)-standardapproach 0.68 1.41 Price(Eur)-MPC 0.35 0.95

How the prediction horizon contributes to an offset between thetemperature and the lower constraint

Prediction horizonsInvestigations of different prediction horizons in open loop simulation:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14

18

19

20

21

22

23

24

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14

0

0.2

0.4

0.6

0.8

1

30

40

50

60

70

80

16 DTU Compute 18.5.2018

Page 17: Model Predictive Control for smart energy systems [1cm ...smart-cities-centre.org/wp-content/uploads/Slides-John.pdf · Price(Eur)-standardapproach 0.68 1.41 Price(Eur)-MPC 0.35 0.95

How the prediction horizon contributes to an offset between temperatureand constraintStep responsesTo understand why the predictions vary a lot for different horizon lengths, one can investigate thestep responses. These give an indicate of what amount of compressor input power of the heatpump leads to the following increase in the indoor temperature.

As illustrated, the heating process requires an interval of more than 14 days to arrive at a steadystate.

17 DTU Compute 18.5.2018

Page 18: Model Predictive Control for smart energy systems [1cm ...smart-cities-centre.org/wp-content/uploads/Slides-John.pdf · Price(Eur)-standardapproach 0.68 1.41 Price(Eur)-MPC 0.35 0.95

Reducing the offset between temperature and constraint

Increasing the prediction horizon lengthUsing a prediction horizon of 2 days compared to 14 days, the offset between temperature andconstraint is reduced:

18

20

22

24

0

0.2

0.4

0.6

0.8

1

4

6

8

1010

7

18

20

22

24

0

0.2

0.4

0.6

0.8

1

4

6

8

1010

7

18

20

22

24

0

0.2

0.4

0.6

0.8

1

4

6

8

1010

7

18 DTU Compute 18.5.2018

Page 19: Model Predictive Control for smart energy systems [1cm ...smart-cities-centre.org/wp-content/uploads/Slides-John.pdf · Price(Eur)-standardapproach 0.68 1.41 Price(Eur)-MPC 0.35 0.95

Choice of the right penalty parameter

Introducing another soft constraintTo avoid the search for a suited penalty parameter ρ1 one could consider to introduceanother soft constraint s2 associated with a penalty parameter of large magnitudeρ2 = 1012:

y ≥ ymin − s1 − s2, with 0 ≤ s1 ≤ 0.75, 0 ≤ s2 ≤ ∞,

where the value 0.75 is called the borderline between these two soft constraints. Here theborderline parameter can be used to enforce the temperature up or down.

18

20

22

24

0

0.5

1

4

6

8

1010

7

19 DTU Compute 18.5.2018

Page 20: Model Predictive Control for smart energy systems [1cm ...smart-cities-centre.org/wp-content/uploads/Slides-John.pdf · Price(Eur)-standardapproach 0.68 1.41 Price(Eur)-MPC 0.35 0.95

Conclusions

Observations• Long control and prediction horizons necessary (N)

• Selection of the prices for soft constraints is non trivial

Recommendations• Use tailored algorithms for MPC that scales well with the prediction horizon

• Use linear MPC with constant COP (surpricingly it seems that the benefits ofNMPC are marginal)

• Use several penalty levels for the soft constraints (or a quadratic penalty function- it will however give a QP and not an LP)

Key future focus:• Efficient algorithms to tackle challenging realistic problems that cannot be solvedby off-the-shelf optimization software

20 DTU Compute 18.5.2018

Page 21: Model Predictive Control for smart energy systems [1cm ...smart-cities-centre.org/wp-content/uploads/Slides-John.pdf · Price(Eur)-standardapproach 0.68 1.41 Price(Eur)-MPC 0.35 0.95

Acknowledgements and Contact

This project is partially supported by• CITIES

• SCA

Contact:John Bagterp Jø[email protected]

21 DTU Compute 18.5.2018