ENE 2XX: Renewable Energy Systems and Control - Microgrids.pdf · Table:Notation and Parameter...
Transcript of ENE 2XX: Renewable Energy Systems and Control - Microgrids.pdf · Table:Notation and Parameter...
ENE 2XX: Renewable Energy Systems and Control
LEC 05 : Case Study: Microgrid Planning & Control
Professor Scott MouraUniversity of California, Berkeley
Summer 2017
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 1
Outline
1 Microgrid Planning
2 Microgrid Control
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 2
Microgrids - A definition
U.S. DOE Microgrid Exchange Group:
group of interconnected loads & distributed energy resources (DERs)
clear electrical boundary w.r.t. grid
can connect and disconnect from grid
Basic components of a microgrid:
Generation: solar, wind, fuel cell, diesel generator, etc.
Loads: lighting, heating, A/C, etc.
Storage: batteries, supercaps, flywheels, thermal, hydraulic
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 3
Microgrid Configuration
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 4
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 5
Oakland EcoBlock
28 buildings, 110+ inhabitants, mixed ethnicity & economic levels
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 6
Problem Statement
Objective: Optimize size of solar PV and energy storage
Given:
Historical electricity loads
Forecast of potential PV generation
Electricity tariff (i.e. cost) structure
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 7
Problem Formulation
minimize cb · b + cs · s +N∑
k=0
cG(k) · G(k) CAPEX + OPEX (1)
subject to: s · S(k) + Bd(k) − Bc(k) + G(k) = L(k) Power balance (2)
E(k + 1) = E(k) +
[ηcBc(k) − 1
ηdBd(k)
]∆t battery dynamics (3)
0 ≤ E(k) ≤ b · Emax battery energy limits (4)
0 ≤ Bc(k) ≤ b · Bmax, 0 ≤ Bd(k) ≤ b · Bmax battery power limits (5)
− Gmax ≤ G(k) ≤ Gmax grid power limits (6)
smin ≤ s ≤ smax, bmin ≤ b ≤ bmax solar, batt scale limits (7)
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 8
Table: Notation and Parameter Values
Variable Value Units Descriptions,b optimize [-] Scale factors for solar size, battery sizeS(k) data provided [kW] Power generated from solarBd(k),Bc(k) optimize [kW] Batt charge / discharge powerG(k) optimize [kW] Power imported from gridL(k) data provided [kW] Power load of buildingE(k) optimize [kWh] Energy level of batterycb find [USD/kWh] Marginal levelized cost of scaling battcs find [USD/kW] Marginal levelized cost of scaling solarcG(k) data provided [USD/kW] Time-of-use cost of grid-imported power∆t 1 [hr] Time stepηc, ηd 0.9 [-] Battery charge, discharge efficiencyEmax 400 [kWh] Nominal battery energy capacityBmax 100 [kW] Nominal battery power capacityGmax 400 [kW] Maximum grid power (import & export)smin, smax [0,1] [-] Solar scale limitsbmin,bmax [0,5] [-] Battery scale limits
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 9
Program Reduction
Eliminate G(k) using G(k) = L(k) − s · S(k) − Bd(k) + Bc(k)
minimize cb · b + cs · s +N∑
k=0
cG(k) · [L(k) − s · S(k) − Bd(k) + Bc(k)] (8)
subject to: E(k + 1) = E(k) +
[ηcBc(k) − 1
ηdBd(k)
]∆t (9)
0 ≤ E(k) ≤ b · Emax (10)
0 ≤ Bc(k) ≤ b · Bmax, 0 ≤ Bd(k) ≤ b · Bmax (11)
− Gmax ≤ L(k) − s · S(k) − Bd(k) + Bc(k) ≤ Gmax (12)
smin ≤ s ≤ smax, bmin ≤ b ≤ bmax (13)
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 10
Uncertain Load and Solar
Optimization variables are b, s,E(k),Bd(k),Bc(k). We still have a LP. In (8)and (12), the red vars denote random quantities: load L(k), solar power S(k).
Assume L(k),S(k) are independent Gaussian random variables:
L(k) ∼ N(L(k), σ2
L (k))
(14)
S(k) ∼ N(S(k), σ2
S(k))
(15)
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 11
Chance Constraints - I
Focus on (12) which includes random variables L(k),S(k). Relax into chanceconstraint:
Pr (L(k)− s · S(k) ≤ Bd(k)− Bc(k) + Gmax) ≥ α (16)
To express as second order cone constraint, let u = L(k)− s · S(k) with meanu = L(k)− s · S(k) and variance σ2
u = σ2L (k) + s2σ2
S(k). Then we can re-writeas
Pr
(u− u
σu≤ Bd(k)− Bc(k) + Gmax − u
σu
)≥ α (17)
Note (u− u)/σu is a zero mean, unit variance Gaussian random variable.The probability in (17) is given by normal CDF function
Φ
(Bd(k)− Bc(k) + Gmax − u
σu
)≥ α, where Φ(z) =
−1√2π
∫ z
−∞e−t
2/2dt
(18)
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 12
Chance Constraints - I
Focus on (12) which includes random variables L(k),S(k). Relax into chanceconstraint:
Pr (L(k)− s · S(k) ≤ Bd(k)− Bc(k) + Gmax) ≥ α (16)
To express as second order cone constraint, let u = L(k)− s · S(k) with meanu = L(k)− s · S(k) and variance σ2
u = σ2L (k) + s2σ2
S(k). Then we can re-writeas
Pr
(u− u
σu≤ Bd(k)− Bc(k) + Gmax − u
σu
)≥ α (17)
Note (u− u)/σu is a zero mean, unit variance Gaussian random variable.The probability in (17) is given by normal CDF function
Φ
(Bd(k)− Bc(k) + Gmax − u
σu
)≥ α, where Φ(z) =
−1√2π
∫ z
−∞e−t
2/2dt
(18)
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 12
Chance Constraints - I
Focus on (12) which includes random variables L(k),S(k). Relax into chanceconstraint:
Pr (L(k)− s · S(k) ≤ Bd(k)− Bc(k) + Gmax) ≥ α (16)
To express as second order cone constraint, let u = L(k)− s · S(k) with meanu = L(k)− s · S(k) and variance σ2
u = σ2L (k) + s2σ2
S(k). Then we can re-writeas
Pr
(u− u
σu≤ Bd(k)− Bc(k) + Gmax − u
σu
)≥ α (17)
Note (u− u)/σu is a zero mean, unit variance Gaussian random variable.The probability in (17) is given by normal CDF function
Φ
(Bd(k)− Bc(k) + Gmax − u
σu
)≥ α, where Φ(z) =
−1√2π
∫ z
−∞e−t
2/2dt
(18)
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 12
Chance Constraints - II
Consequently, (17) can be expressed as
u + Φ−1(α) · σu ≤ Bd(k)− Bc(k) + Gmax (19)
Replacing mean u = L(k)− s · S(k) and variance σ2u = σ2
L (k) + s2σ2S(k) we get
L(k)− s · S(k) + Φ−1(α) ·√σ2L (k) + s2σ2
S(k) ≤ Bd(k)− Bc(k) + Gmax (20)
Rearranging this expression and assuming Φ−1(α) > 0 (i.e. α > 0.5), weget a second order cone constraint with respect to optimization variabless,Bd(k),Bc(k):√
σ2S(k) · s2 + σ2
L (k) ≤ 1
Φ−1(α)
[s · S(k) + Bd(k)− Bc(k)− L(k) + Gmax
](21)
An identical process applied to lower bound in (12) yields√σ2S(k) · s2 + σ2
L (k) ≤ 1
Φ−1(α)
[−s · S(k)− Bd(k) + Bc(k) + L(k) + Gmax
](22)
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 13
Chance Constraints - II
Consequently, (17) can be expressed as
u + Φ−1(α) · σu ≤ Bd(k)− Bc(k) + Gmax (19)
Replacing mean u = L(k)− s · S(k) and variance σ2u = σ2
L (k) + s2σ2S(k) we get
L(k)− s · S(k) + Φ−1(α) ·√σ2L (k) + s2σ2
S(k) ≤ Bd(k)− Bc(k) + Gmax (20)
Rearranging this expression and assuming Φ−1(α) > 0 (i.e. α > 0.5), weget a second order cone constraint with respect to optimization variabless,Bd(k),Bc(k):√
σ2S(k) · s2 + σ2
L (k) ≤ 1
Φ−1(α)
[s · S(k) + Bd(k)− Bc(k)− L(k) + Gmax
](21)
An identical process applied to lower bound in (12) yields√σ2S(k) · s2 + σ2
L (k) ≤ 1
Φ−1(α)
[−s · S(k)− Bd(k) + Bc(k) + L(k) + Gmax
](22)
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 13
Chance Constraints - II
Consequently, (17) can be expressed as
u + Φ−1(α) · σu ≤ Bd(k)− Bc(k) + Gmax (19)
Replacing mean u = L(k)− s · S(k) and variance σ2u = σ2
L (k) + s2σ2S(k) we get
L(k)− s · S(k) + Φ−1(α) ·√σ2L (k) + s2σ2
S(k) ≤ Bd(k)− Bc(k) + Gmax (20)
Rearranging this expression and assuming Φ−1(α) > 0 (i.e. α > 0.5), weget a second order cone constraint with respect to optimization variabless,Bd(k),Bc(k):√
σ2S(k) · s2 + σ2
L (k) ≤ 1
Φ−1(α)
[s · S(k) + Bd(k)− Bc(k)− L(k) + Gmax
](21)
An identical process applied to lower bound in (12) yields√σ2S(k) · s2 + σ2
L (k) ≤ 1
Φ−1(α)
[−s · S(k)− Bd(k) + Bc(k) + L(k) + Gmax
](22)
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 13
Chance Constraints - II
Consequently, (17) can be expressed as
u + Φ−1(α) · σu ≤ Bd(k)− Bc(k) + Gmax (19)
Replacing mean u = L(k)− s · S(k) and variance σ2u = σ2
L (k) + s2σ2S(k) we get
L(k)− s · S(k) + Φ−1(α) ·√σ2L (k) + s2σ2
S(k) ≤ Bd(k)− Bc(k) + Gmax (20)
Rearranging this expression and assuming Φ−1(α) > 0 (i.e. α > 0.5), weget a second order cone constraint with respect to optimization variabless,Bd(k),Bc(k):√
σ2S(k) · s2 + σ2
L (k) ≤ 1
Φ−1(α)
[s · S(k) + Bd(k)− Bc(k)− L(k) + Gmax
](21)
An identical process applied to lower bound in (12) yields√σ2S(k) · s2 + σ2
L (k) ≤ 1
Φ−1(α)
[−s · S(k)− Bd(k) + Bc(k) + L(k) + Gmax
](22)
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 13
SOCP Formulation
To summarize, we converted a stochastic LP into SOCP:
minimize cb · b + cs · s +N∑
k=0
cG(k) · [L(k) − s · S(k) − Bd(k) + Bc(k)] (23)
subject to: E(k + 1) = E(k) +
[ηcBc(k) − 1
ηdBd(k)
]∆t (24)
0 ≤ E(k) ≤ b · Emax (25)
0 ≤ Bc(k) ≤ b · Bmax, 0 ≤ Bd(k) ≤ b · Bmax (26)√σ2S(k) · s2 + σ2
L (k) ≤ 1
Φ−1(α)
[s · S(k) + Bd(k) − Bc(k) − L(k) + Gmax
](27)√
σ2S(k) · s2 + σ2
L (k) ≤ 1
Φ−1(α)
[−s · S(k) − Bd(k) + Bc(k) + L(k) + Gmax
](28)
smin ≤ s ≤ smax, bmin ≤ b ≤ bmax (29)
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 14
SOCP Formulation w/ Expected Operating Cost
Random vars still exist in the objective fcn. Take the expectation.
minimize cb · b + cs · s +N∑
k=0
cG(k) ·[L(k) − s · S(k) − Bd(k) + Bc(k)
](30)
subject to: E(k + 1) = E(k) +
[ηcBc(k) − 1
ηdBd(k)
]∆t (31)
0 ≤ E(k) ≤ b · Emax (32)
0 ≤ Bc(k) ≤ b · Bmax, 0 ≤ Bd(k) ≤ b · Bmax (33)√σ2S(k) · s2 + σ2
L (k) ≤ 1
Φ−1(α)
[s · S(k) + Bd(k) − Bc(k) − L(k) + Gmax
](34)√
σ2S(k) · s2 + σ2
L (k) ≤ 1
Φ−1(α)
[−s · S(k) − Bd(k) + Bc(k) + L(k) + Gmax
](35)
smin ≤ s ≤ smax, bmin ≤ b ≤ bmax (36)
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 15
Possible Extensions
Demand charges, i.e. costs associated with the maximum grid powercD ·maxk G(k)
Transformer sizing, i.e. add transformer cost to the objective functionand scale the grid power limits
EV charging, i.e. a load C(k) which is flexible subject to deliveringsufficient energy by a certain deadline
Islanded operation, i.e. optimize PV and storage size while ensuring atleast 72 hours of islanded operation (G(k) = 0)
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 16
Outline
1 Microgrid Planning
2 Microgrid Control
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 17
Motivation for Model Predictive Control (MPC)
What we learned so far: Optimization
Uses mathematical model.
Optimizes performance over finite-time horizon.
SDP models stochastic process as Markov chain.
Generates optimal control policy.
Some Questions/Gaps:
Model uncertainty?
Time horizon for my application is VERY long.
I want to forecast inputs with ML, instead of probability distributions
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 18
What is MPC?
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 19
What is MPC?
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 19
What is MPC?
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 19
Applications of MPC
Like Playing Chess!
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 20
Applications of MPC
Building Energy Management
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 20
Applications of MPC
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 20
Receding Horizon Philosophy
- At time t: Solve optimal control problem over a finite future horizon of Nsteps:
minimizeut,··· ,ut+N−1
N−1∑k=0
ct+k(xt+k,ut+k) + ct+N(xt+N),
subject to xt+(k+1) = f(xt+k,ut+k), k = 0, · · · ,N− 1
xt = x(t), [Measurement of States]
umin ≤ ut+k ≤ umax
xmin ≤ xt+k ≤ xmax
[HINT:] Can use DP, NLP, CP, SOCP, QP, LP...
- Only apply the first optimal move: u∗(t) = u∗k
- At time t + 1: Get new measurements, repeat the optimization...
Advantage of repeated online optimization: FEEDBACK!
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 21
Receding Horizon Philosophy
Advantage of repeated online optimization: FEEDBACK!
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 21
Learn more about MPC
Take ME 231A - Experiential Advanced Control Design
Read: Model Predictive Control, E. F. Camacho and C. Bordons, Springer,2007
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 22
SMART HOME ENERGYMANAGEMENT
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 23
The Building Solar+Storage Problem
Needs: Optimally manage energy flow between loads, solar, and storage.
Reality: Current controls are mostly heuristic - no models, no data.
Some Motivating Facts
Policy 50% renewables in CA by 2030, 100% in Hawaii by 2045
Climate 2011 Tsunami in Japan→ energy security and reliability
Costs Li-ion battery pack costs decreasing toward 125 USD/kWh
Data Over 50M (43%) of US homes have smart meters
Hybrid Vehicles
Photovoltaics/Grid↔ Engine
Home Demand↔ Driver Power Demand
Battery Storage↔ Battery Storage
PunchlineApply & Extend ∼10 years of HEV Energy Management
Control Research to Building Solar+Storage
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 24
The Building Solar+Storage Problem
Needs: Optimally manage energy flow between loads, solar, and storage.
Reality: Current controls are mostly heuristic - no models, no data.
Some Motivating Facts
Policy 50% renewables in CA by 2030, 100% in Hawaii by 2045
Climate 2011 Tsunami in Japan→ energy security and reliability
Costs Li-ion battery pack costs decreasing toward 125 USD/kWh
Data Over 50M (43%) of US homes have smart meters
Hybrid Vehicles
Photovoltaics/Grid↔ Engine
Home Demand↔ Driver Power Demand
Battery Storage↔ Battery Storage
PunchlineApply & Extend ∼10 years of HEV Energy Management
Control Research to Building Solar+Storage
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 24
The Building Solar+Storage Problem
Needs: Optimally manage energy flow between loads, solar, and storage.
Reality: Current controls are mostly heuristic - no models, no data.
Some Motivating Facts
Policy 50% renewables in CA by 2030, 100% in Hawaii by 2045
Climate 2011 Tsunami in Japan→ energy security and reliability
Costs Li-ion battery pack costs decreasing toward 125 USD/kWh
Data Over 50M (43%) of US homes have smart meters
Hybrid Vehicles
Photovoltaics/Grid↔ Engine
Home Demand↔ Driver Power Demand
Battery Storage↔ Battery Storage
PunchlineApply & Extend ∼10 years of HEV Energy Management
Control Research to Building Solar+Storage
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 24
The Building Solar+Storage Problem
Needs: Optimally manage energy flow between loads, solar, and storage.
Reality: Current controls are mostly heuristic - no models, no data.
Some Motivating Facts
Policy 50% renewables in CA by 2030, 100% in Hawaii by 2045
Climate 2011 Tsunami in Japan→ energy security and reliability
Costs Li-ion battery pack costs decreasing toward 125 USD/kWh
Data Over 50M (43%) of US homes have smart meters
Hybrid Vehicles
Photovoltaics/Grid↔ Engine
Home Demand↔ Driver Power Demand
Battery Storage↔ Battery Storage
PunchlineApply & Extend ∼10 years of HEV Energy Management
Control Research to Building Solar+Storage
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 24
Residential Buildings with Solar & Storage
Cloud
with information,
algorithms ...Photovoltaic
Arrays
Utility
Grid
Controller &
Converters
Battery
Load
Demand
BatteryPower
Electronic
PV
ArraysDC/DC
DC Bus AC Bus
AC Loads
DC Loads
Utility
Grid
DC/AC
(b)
(a)
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 25
Predictive Controller with Load/Weather Forecasting
Smart Home nGrid
Predic0ve Controller
PV Model
Load Forecaster
S T Pdem Hour of day Day of
Week
SOC
Pdem PPV
PbaB
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 26
Single-Family Home Energy Patterns in LA
Apr May Jun Jul Aug Sep Oct Nov Dec Jan Feb Mar
0.5
1
1.5
2
2.5
3
3.5
4
Month
Ele
ctric
ityiL
oadi
HkW
Y
HourlyiLoadDailyiLoadMonthlyiLoadYeariAverage
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 27
Single-Family Home Energy Patterns in LA
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 27
Single-Family Home Energy Patterns in LA
12 14 16 18 20 22 240.7
0.8
0.9
1
1.1
1.2
1.3
1.4
1.5
1.6
WeeklyLAverageLTemperatureL(°C)
Wee
klyL
Ave
rage
LLoa
dL(k
W)
Noise
LoadLvs.LTempFitLResult
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 27
Artificial Neural Network (ANN)
w
w
w
······
···
····
··
X
H(X,C,σ)
Y=P dem
Ta
Dw
Td
Lh
Future load
demand.
Input Layer Hidden Layer Output Layer
Y = fANN(X), X = [Ta,Dw, Td, Lh] , Y = [Lk+1, · · · , Lk+m]
Y = fANN(X) =N∑i=1
ai · Hi (‖X − Ci‖)
Hi (‖X − Ci‖) = exp
[− 1
2σi2‖X − Ci‖2
]Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 28
Short-term Forecast of Home Load
10
20
30
° C
0 3 6 9 12 15 18 210
1
2
3
HourAofADayAonA2013 09 15 Tuesday
Load
AbkW
)
10
20
30
0 3 6 9 12 15 18 210
1
2
3
Hour of Day on 2013 12 06 Friday
AirATemperautreAonA09 15
RealALoadForecastAL
AirATemperautreAonA12 06
ba)-1
ba)-2
bb)-1
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 29
Short-term Forecast of Home Load
0 0y2 0y4 0y6 0y8 1 1y20
0y2
0y4
0y6
0y8
1
RMSE
Em
piric
altC
DF
24 21 18 15 12 9 6 3 00y4
0y43
0y46
0y49
0y52
InputtHistoricaltLoadtLength
Ave
rage
tRM
SE
RMSEtcdftoftLAtDataRMSEtcdftoftBerkeleytData
haA
hbA
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 29
Battery and Photovoltaic Cell Models
battery
d
dtSOC(t) = − Ibatt(t)
Q,
Pbatt(t) = VocIbatt(t)− I2batt(t)Rin,
(a)
(b)
(c)
OCV-R
OCV-R-RC
Impedance
X. Hu, S. Li, and H. Peng, “A comparative study of equivalent circuit modelsfor Li-ion batteries,” Journal of Power Sources, vol. 198, pp. 359-367, 2012.
photovoltaics
Vd = Vcell + IpvRs,
I = Isc − Is
[e
(qVd
AkTpv(t) ) − 1
]− Vd
Rp,
Is = Is,r
(Tpv(t)
Tr
)3
eqEbgAk
(1Tr− 1
Tpv(t)
),
Isc = [Isc,r + KI(Tpv(t)− Tr)]Spv(t)
1000,
Ppv(t) = ncellVcell(t)I(t)
Isc Vd
+
-
Rp
Rs
Vcell
+
-
I
S
G. Vachtsevanos and K. Kalaitzakis, “A hybrid photovoltaic simulator for utility inter-active studies,” IEEE Transactions on Energy Conversion, no. 2, pp. 227-231, 1987.
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 30
Internet-based Data Feeds
Smart Home nGrid
Predic0ve Controller
PV Model
Load Forecaster
S T Pdem Hour of day Day of
Week
SOC
Pdem PPV
PbaB
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 31
Internet-based Data Feeds
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 31
Internet-based Data Feeds
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 31
Cloud-Enabled Control
Smart Home nGrid
Predic0ve Controller
PV Model
Load Forecaster
S T Pdem Hour of day Day of
Week
SOC
Pdem PPV
PbaB
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 32
Nonlinear MPC Formulation
minimize Jk =
∫ (k+Hp)∆t
k∆t[λ1celecPrice(t)G(t) + λ2cCO2(t)G(t)] dt,
subject tod
dtSOC(t)=− Ibatt(t)
Q, [Battery]
0=Voc(SOC)Ibatt(t)− I2batt(t)Rin − B(t),
0 = hPV(P(t),S(t), T(t)), [Photovoltaic]
0 = G(t) + ηddηdaP(t) + ηdaB(t)− L(t), [Pwr Balance]
SOCmin ≤ SOC(t) ≤ SOCmax, Iminbatt ≤ Ibatt(t) ≤ Imax
batt ,
Bmin ≤ B(t) ≤ Bmax, Gmin ≤ G(t) ≤ Gmax,
d̂ ((k + n)∆t)=fforecast(d(k∆t), · · · ,d((k − Hh)∆t)), n = 1, · · · ,Hp
‘state’ = SOC(t), ‘control’ = G(t),B(t), ‘exo. input’ = [L(t),S(t), T(t)]T
∆t = 1 hr, Hp = 6 hrs, Hh = 6 hrsSolved via Dynamic Programming
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 33
Nonlinear MPC Formulation
minimize Jk =
∫ (k+Hp)∆t
k∆t[λ1celecPrice(t)G(t) + λ2cCO2(t)G(t)] dt,
subject tod
dtSOC(t)=− Ibatt(t)
Q, [Battery]
0=Voc(SOC)Ibatt(t)− I2batt(t)Rin − B(t),
0 = hPV(P(t),S(t), T(t)), [Photovoltaic]
0 = G(t) + ηddηdaP(t) + ηdaB(t)− L(t), [Pwr Balance]
SOCmin ≤ SOC(t) ≤ SOCmax, Iminbatt ≤ Ibatt(t) ≤ Imax
batt ,
Bmin ≤ B(t) ≤ Bmax, Gmin ≤ G(t) ≤ Gmax,
d̂ ((k + n)∆t)=fforecast(d(k∆t), · · · ,d((k − Hh)∆t)), n = 1, · · · ,Hp
‘state’ = SOC(t), ‘control’ = G(t),B(t), ‘exo. input’ = [L(t),S(t), T(t)]T
∆t = 1 hr, Hp = 6 hrs, Hh = 6 hrsSolved via Dynamic Programming
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 33
Nonlinear MPC Formulation
minimize Jk =
∫ (k+Hp)∆t
k∆t[λ1celecPrice(t)G(t) + λ2cCO2(t)G(t)] dt,
subject tod
dtSOC(t)=− Ibatt(t)
Q, [Battery]
0=Voc(SOC)Ibatt(t)− I2batt(t)Rin − B(t),
0 = hPV(P(t),S(t), T(t)), [Photovoltaic]
0 = G(t) + ηddηdaP(t) + ηdaB(t)− L(t), [Pwr Balance]
SOCmin ≤ SOC(t) ≤ SOCmax, Iminbatt ≤ Ibatt(t) ≤ Imax
batt ,
Bmin ≤ B(t) ≤ Bmax, Gmin ≤ G(t) ≤ Gmax,
d̂ ((k + n)∆t)=fforecast(d(k∆t), · · · ,d((k − Hh)∆t)), n = 1, · · · ,Hp
‘state’ = SOC(t), ‘control’ = G(t),B(t), ‘exo. input’ = [L(t),S(t), T(t)]T
∆t = 1 hr, Hp = 6 hrs, Hh = 6 hrsSolved via Dynamic Programming
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 33
Nonlinear MPC Formulation
minimize Jk =
∫ (k+Hp)∆t
k∆t[λ1celecPrice(t)G(t) + λ2cCO2(t)G(t)] dt,
subject tod
dtSOC(t)=− Ibatt(t)
Q, [Battery]
0=Voc(SOC)Ibatt(t)− I2batt(t)Rin − B(t),
0 = hPV(P(t),S(t), T(t)), [Photovoltaic]
0 = G(t) + ηddηdaP(t) + ηdaB(t)− L(t), [Pwr Balance]
SOCmin ≤ SOC(t) ≤ SOCmax, Iminbatt ≤ Ibatt(t) ≤ Imax
batt ,
Bmin ≤ B(t) ≤ Bmax, Gmin ≤ G(t) ≤ Gmax,
d̂ ((k + n)∆t)=fforecast(d(k∆t), · · · ,d((k − Hh)∆t)), n = 1, · · · ,Hp
‘state’ = SOC(t), ‘control’ = G(t),B(t), ‘exo. input’ = [L(t),S(t), T(t)]T
∆t = 1 hr, Hp = 6 hrs, Hh = 6 hrsSolved via Dynamic Programming
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 33
Nonlinear MPC Formulation
minimize Jk =
∫ (k+Hp)∆t
k∆t[λ1celecPrice(t)G(t) + λ2cCO2(t)G(t)] dt,
subject tod
dtSOC(t)=− Ibatt(t)
Q, [Battery]
0=Voc(SOC)Ibatt(t)− I2batt(t)Rin − B(t),
0 = hPV(P(t),S(t), T(t)), [Photovoltaic]
0 = G(t) + ηddηdaP(t) + ηdaB(t)− L(t), [Pwr Balance]
SOCmin ≤ SOC(t) ≤ SOCmax, Iminbatt ≤ Ibatt(t) ≤ Imax
batt ,
Bmin ≤ B(t) ≤ Bmax, Gmin ≤ G(t) ≤ Gmax,
d̂ ((k + n)∆t)=fforecast(d(k∆t), · · · ,d((k − Hh)∆t)), n = 1, · · · ,Hp
‘state’ = SOC(t), ‘control’ = G(t),B(t), ‘exo. input’ = [L(t),S(t), T(t)]T
∆t = 1 hr, Hp = 6 hrs, Hh = 6 hrsSolved via Dynamic Programming
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 33
Model Predictive Control w/ Cloud-enabled Forecasts
0f40f60f8
1
SO
C
2
0
2
4
Pow
er7y
kWG
Monf Tuef Wedf Thuf Frif Satf Sunf15161718
Cen
ts&k
Wh
Load7DemandPV7PowerBattery7PowerGrid7Power
Electric7Rate7from7PGVE
Optimize for Grid Electricity Cost
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 34
Model Predictive Control w/ Cloud-enabled Forecasts
0I40I60I8
1
SO
C
2
0
2
4
Pow
ergG
kWb
MonI TueI WedI ThuI FriI SatI SunI0I4
0I450I5
0I55
kg/k
Wh
LoadgDemandPVgPowerBatterygPowerGridgPower
CarbongEmissiongfromgCAISO
Optimize for Marginal CO2 Produced from Power Plants
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 34
Control Horizon Length?Short-Term Greedy vs. Long-Term Planning
1 5 9 13 17 21 2555
60
65
70
75
80
85
90
95
100
105
Control Horizon Length (Hour)
Nor
mal
ized
Cos
t (%
)
MPC with PB
Without PBLower bound
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 35
Load Forecasting - how accurate is accurate enough?
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
62
64
66
68
70
72
LoadiDemandiForecastiRMSE (kW)
Nor
mal
ized
iCos
tip)
UDPiOptimalUniformiDistributionRBF−NNiResult
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 36
Battery Health Aware
minimize Jk =
∫ (k+Hp)∆t
k∆t[λ · cElecPrice(u, t) + (1− λ) · Qloss(u)]2 dt
J.Wang, et al., Journal of PowerSources (2010), doi:10.1016/j.jpowsour.2010.11.134
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 37
Battery Health Aware
70 75 80 85 90 95 100 105 1100
0.2
0.4
0.6
0.8
1
1.2
Monthly Electric Cost (USD)
Mon
thly
Bat
tery
Cap
acity
Los
s (%
) λ=1, Electric Cost Emphasis
Battery Health
Emphasis, λ=0
λ=0.89
λ=0.45
Utopia
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 37
Battery Health Aware
0.3 0.45 0.6 0.75 0.9−0.5
−0.4
−0.3
−0.2
−0.1
0
0.1
0.2
0.3
0.4
0.5
Battery SOC
Cel
l C−
rate
(a)
Off−peak On−peak0
50
100
150
200
250
300
350
400
450
Period
Cum
ulat
ive
Grid
Pow
er (
kW)
(b)λ=1λ=0.83λ=0
λ=1λ=0.83λ=0
C. Sun, F. Sun, S. J. Moura, “Nonlinear predictive energy management of residential buildings withphotovoltaics & batteries” Journal of Power Sources. Sept 2016, DOI: 10.1016/j.jpowsour.2016.06.076
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 37
Excited about this research?Reading Materials
C. Sun, F. Sun, S. J. Moura, “Nonlinear predictive energy management ofresidential buildings with photovoltaics & batteries” Journal of Power Sources.Sept 2016, DOI: 10.1016/j.jpowsour.2016.06.076
X. Wu, X. Hu, S. J. Moura, X. Yin, V. Picket, “Stochastic Control of Smart HomeEnergy Management with PEV Energy Storage and Photovoltaic Array,” Journalof Power Sources, Nov 2016. DOI: 10.1016/j.jpowsour.2016.09.157
X. Wu, S. J. Moura, X. Hu, X. Yin, “Stochastic Optimal Energy Management ofSmart Home with PEV Energy Storage,” to appear in IEEE Transactions on SmartGrid. DOI: 10.1109/TSG.2016.2606442
E. Burger, S. J. Moura, “Gated Ensemble Learning Method for Demand-SideElectricity Load Forecasting,” Energy and Buildings, Dec 2015. DOI:10.1016/j.enbuild.2015.10.019.
E. Burger, S. J. Moura, “Building Electricity Load Forecasting via StackingEnsemble Learning Method with Moving Horizon Optimization,” eScholarship,Dec 2015. http://escholarship.org/uc/item/6jc7377f.
Prof. Moura | Tsinghua-Berkeley Shenzhen Institute ENE 2XX | LEC 05 - Microgrids Slide 38