A fair comparison of two stochastic optimization algorithms Benchmarking MPC vs SDDP April 10, 2017 1/33
Why using stochastic optimization? We aim to tackle uncertainties in Energy Management System. Problem: we do not know in advance the uncertainties, common in the management of energetical systems: • Electrical demands • Hot water demands • Outdoor temperature • Wind’s speed • Solar irradiation • etc. 2/33
Introducing the problem Here, we focus on the management of a domestic microgrid Sensitivity analysis w.r.t two uncertainties: • Electrical demands • Solar irradiation 3/33
Introducing the problem Here, we focus on the management of a domestic microgrid Sensitivity analysis w.r.t two uncertainties: • Electrical demands • Solar irradiation 3/33
Introducing the problem Here, we focus on the management of a domestic microgrid Sensitivity analysis w.r.t two uncertainties: • Electrical demands • Solar irradiation We compare two classes of algorithm: The Mainstream: Model Predictive Control (MPC) (use forecasts to predict the future uncertainties) The Challenger: Stochastic Dual Dynamic Programming (SDDP) (model uncertainties with discrete probability laws) 3/33
Outline A brief recall of the single house problem Physical modelling Optimization problem Resolution Methods Handling solar irradiation Academic modeling Realistic modeling 4/33
Framing the optimization problem We aim to • Minimize electrical’s bill • Maintain a comfortable temperature inside the house To achieve these goals, we can • store electricity in battery; • store heat in hot water tank. We control the stocks every 15mn over one day. We formulate a multistage stochastic programming problem 5/33
Microgrid’s description NETWORK SOLAR F n PANEL F pv BATTERY ELECTRICAL DEMAND F b D el F t F h THERMAL TANK DOMESTIC DEMAND HOT WATER D th 6/33
Outline A brief recall of the single house problem Physical modelling Optimization problem Resolution Methods Handling solar irradiation Academic modeling Realistic modeling 7/33
We introduce states, controls and noises � � B t , H t , θ i t , θ w • Stock variables X t = t • B t , battery level (kWh) • H t , hot water storage (kWh) • θ i t , inner temperature ( ◦ C ) NETWORK SOLAR F n F pv PANEL • θ w t , wall’s temperature ( ◦ C ) � � BATTERY ELECTRICAL DEMAND F b D el F + B , t , F − • Control variables U t = B , t , F A , t , F H , t F h F t • F + THERMAL TANK DOMESTIC B , t , energy stored in the battery DEMAND HOT WATER D th • F − B , t , energy taken from the battery • F A , t , energy used to heat the hot water tank • F H , t , thermal heating R v � � R f D E t , D DHW , Φ s • Uncertainties W t = Ti Tw Te t t R i R s R m R e • D E C i C w t , electrical demand (kW) • D DHW , domestic hot water demand (kW) t • Φ s t , external radiations (kW) 8/33
Discrete time state equations So we have the four state equations (all linear): � � B , t − 1 ρ c F + F − B t +1 = α B B t + ∆ T B , t ρ d � � F A , t − D DHW H t +1 = α H H t + ∆ T t � � θ i t − θ w + θ e t − θ w t + ∆ T R i R e θ w t +1 = θ w t t P int Φ s + γ F H , t + + t t R i + R s R m + R e R i + R s R e + R m c m � � θ w t − θ i + θ e t − θ i + θ e t − θ i t + ∆ T R s θ i t +1 = θ i t t t P int + (1 − γ ) F H , t + t R i + R s R i + R s c i R v R f which will be denoted: X t +1 = f t ( X t , U t , W t +1 ) 9/33
Outline A brief recall of the single house problem Physical modelling Optimization problem Resolution Methods Handling solar irradiation Academic modeling Realistic modeling 10/33
Prices and temperature setpoints vary along time • T f = 24h, ∆ T = 15mn 0.16 0.15 Electricity price (euros) 0.14 0.13 • Electricity peak and off-peak 0.12 0.11 hours 0.10 0.09 0.08 • π E t = 1.5 euros/kWh 21 Temperature setpoint [°C] 20 (10x higher than usual) 19 18 • Temperature set-point 17 ¯ 16 θ i t = 16 ◦ C or 20 ◦ C 15 0 4 8 12 16 20 24 Hours 11/33
The costs we have to pay • Cost to import electricity from the network − b E + π E t max { 0 , − F NE , t +1 } t max { 0 , F NE , t +1 } � �� � � �� � selling buying where we define the recourse variable (electricity balance): = D E + F + F NE , t +1 B , t − F − + F H , t + F A , t − F pv , t t +1 B , t � �� � ���� ���� ���� ���� � �� � Network Demand Heating Tank Solar panel Battery t − ¯ θ i θ i • Virtual Cost of thermal discomfort: κ th ( ) t � �� � deviation from setpoint 10 8 κ th 6 Piecewise linear cost 4 Penalize temperature if 2 below given setpoint 0 10 5 0 5 10 12/33
Instantaneous and final costs for a single house • The instantaneous convex costs are L t ( X t , U t , W t +1 ) = − b E + π E t max { 0 , − F NE , t +1 } t max { 0 , F NE , t +1 } � �� � � �� � buying selling t − ¯ + κ th ( θ i θ i t ) � �� � discomfort • We add a final linear cost K ( X T ) = − π H H T − π B B T to avoid empty stocks at the final horizon T 13/33
That gives the following stochastic optimization problem T − 1 � min J ( X , U ) = E L t ( X t , U t , W t +1 ) + K ( X T ) X , U � �� � � �� � t =0 instantaneous cost final cost X t +1 = f t ( X t , U t , W t +1 ) s . t Dynamic X ♭ ≤ X t ≤ X ♯ U ♭ ≤ U t ≤ U ♯ X 0 = X ini σ ( U t ) ⊂ σ ( W 1 , . . . , W t ) Non-anticipativity 14/33
That gives the following stochastic optimization problem T − 1 � min J ( X , U ) = E L t ( X t , U t , W t +1 ) + K ( X T ) X , U � �� � � �� � t =0 instantaneous cost final cost X t +1 = f t ( X t , U t , W t +1 ) s . t Dynamic X ♭ ≤ X t ≤ X ♯ U ♭ ≤ U t ≤ U ♯ X 0 = X ini σ ( U t ) ⊂ σ ( W 1 , . . . , W t ) Non-anticipativity Because of the non-anticipativity constraint, we can not solve the optimization problem with standard methods (such as stochastic gradient) 14/33
Outline A brief recall of the single house problem Physical modelling Optimization problem Resolution Methods Handling solar irradiation Academic modeling Realistic modeling 15/33
MPC vs SDDP: uncertainties modelling The two algorithms use optimization scenarios to model the uncertainties: MPC SDDP 6 5 4 Load [kW] 3 2 1 0 0 4 8 12 16 20 24 Time (h) 16/33
MPC vs SDDP: online resolution At the beginning of time period [ τ, τ + 1], do MPC SDDP • Consider a rolling horizon [ τ, τ + H [ • We consider the approximated value �� � T functions V t • Consider a deterministic scenario of 0 demands (forecast) � � � V t ≤ V t ���� W τ +1 , . . . , W τ + H Piecewise affine functions • Solve the deterministic optimization • Solve the stochastic optimization problem problem : τ + H � min Lt ( Xt , Ut , W t +1) + K ( X τ + H ) � X , U t = τ min E W τ +1 L τ ( X τ , u τ , W τ +1) u τ s . t . X · = ( X τ , . . . , X τ + H ) � �� + � V τ +1 f τ ( X τ , u τ , W τ +1) U · = ( U τ , . . . , U τ + H − 1) Xt +1 = f ( Xt , Ut , W t +1) ⇒ this problem resumes to solve a LP at each timestep X ♭ ≤ Xt ≤ X ♯ U ♭ ≤ Ut ≤ U ♯ Get optimal solution U # • Get optimal solution ( U # τ , . . . , U # • τ + H ) τ Send U # over horizon H = 24 h • τ to assessor • Send only first control U # τ to assessor, and iterate at time τ + 1 17/33
100 80 60 y 40 20 0 10 5 0 5 10 x A brief recall on Dynamic Programming Dynamic Programming µ t is the probability law of W t and is being used to estimate expectation and compute offline value functions with the backward equation: V T ( x ) = K ( x ) � � � � V t ( x t ) = min E µ t L t ( x t , U t , W t +1 ) + V t +1 f ( x t , U t , W t +1 ) � �� � U t � �� � current cost future costs 18/33
A brief recall on Dynamic Programming Dynamic Programming µ t is the probability law of W t and is being used to estimate expectation and compute offline value functions with the backward equation: V T ( x ) = K ( x ) � � � � V t ( x t ) = min E µ t L t ( x t , U t , W t +1 ) + V t +1 f ( x t , U t , W t +1 ) � �� � U t � �� � current cost future costs Stochastic Dual Dynamic Programming • Convex value functions V t are approximated as a supremum of a finite set of affine functions 100 • Affine functions (=cuts) are computed during 80 forward/backward passes, till convergence 60 y 40 • SDDP makes an extensive use of LP solver 20 � � � λ k t x + β k 0 V t ( x ) = max ≤ V t ( x ) t 10 5 0 5 10 1 ≤ k ≤ K x 18/33
Outline A brief recall of the single house problem Physical modelling Optimization problem Resolution Methods Handling solar irradiation Academic modeling Realistic modeling 19/33
How to forecast solar irradiation? We suppose that we have available at midnight a forecast ˆ Φ, with error bounds ( ε 0 , . . . , ε T ). The realization of Φ t is equal to Φ t = ˆ Φ t × (1 + ε t ) . 20/33
Recommend
More recommend