Scenario MPC example
Reference paper: A. Cordoba-Pacheco, F. Ruiz, “Optimal Energy Management in multi-microgrids. A
Scenario-Based MPC Approach,” in 2024 European Control Conference, 2024.
Control problem is defined in the following, where the numbers of the equations refer to the paper.
min
ீ
್ೠ
ೖ
,ீ
ೞ
ೖ
,
್ೠ
ೕ,ೖ
,
ಶೄ
ವೞ
ೖ
,
ಶೄ
ೖ
,
ುೇ
ೖ
,
ೈಶ
ೖ
,ఋ
퐽
ఋ
+퐽
ೖ
ெோ
ୀଵ
(
23
)
s.t.
푆푂퐶
ாௌ
ೖ
௧ାଵ
=푆푂퐶
ாௌ
ೖ
௧
+
푃
ாௌ
ೖ
௧
⋅휂
ாௌ
ೖ
⋅Δ푡
푄
௫
ೖ
−
푃
ாௌ
ವೞ
ೖ
௧
⋅Δ푡
휂
ாௌ
ವೞ
ೖ
⋅푄
௫
ೖ
(
2
)
⎣
⎢
⎢
⎢
⎢
⎢
⎡
푃
ೖ,ೞ
௧ାଵ
푃
ೖ,ೞ
௧
푃
ೖ,ೞ
௧ିଵ
푃
ೖ,ೞ
௧ିଶ
푃
ೖ,ೞ
௧ିଷ
⎦
⎥
⎥
⎥
⎥
⎥
⎤
=
⎣
⎢
⎢
⎢
⎡
0.42 0.11 0.15 0.05 0.04
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
⎦
⎥
⎥
⎥
⎤
⎣
⎢
⎢
⎢
⎢
⎢
⎡
푃
ೖ,ೞ
௧
푃
ೖ,ೞ
௧ିଵ
푃
ೖ,ೞ
௧ିଶ
푃
ೖ,ೞ
௧ିଷ
푃
ೖ,ೞ
௧ିସ
⎦
⎥
⎥
⎥
⎥
⎥
⎤
+
⎣
⎢
⎢
⎢
⎡
1
0
0
0
0
⎦
⎥
⎥
⎥
⎤
휖
,௦
௧
(
24
)
0≤푃퐺
௨௬
ೖ
௧
≤푃퐺
௨௬௫
⋅퐵
௦
ೖ
௧
(
7
)
0≤ 푃퐺
௦
ೖ
௧
≤푃퐺
௦௫
⋅൫1−퐵
௦
ೖ
௧
൯
(
8
)
0≤푃
௨௬
ೖ,ೕ
௧
≤푃퐺
௨௬௫
⋅퐵
௦
ೖ
௧
(
9
)
0≤푃
௨௬
ೕ,ೖ
௧
≤푃
௦௫
⋅൫1−퐵
௦
ೖ
௧
൯
(
10
)
0≤푃
ாௌ
ೖ
௧
≤푃
ாௌ
ೌೣ
⋅퐵
ாௌ
ೖ
௧
(
11
)
0≤푃
ாௌ
ವೞ
ೖ
௧
≤푃
ாௌ
ವೞೌೣ
⋅൫1−퐵
ாௌ
ೖ
௧
൯
(
12
)
푆푂퐶
ாௌ
ೖ
≤푆푂퐶
ாௌ
ೖ
௧
≤푆푂퐶
ாௌ
ೌೣ
ೖ
(
3
)
0≤푃
ௐா
ೖ
௧
≤ 푃
ௐா
ೖ
௧
(
5
)
0≤푃
ೖ
௧
≤ 푃
ೖ,ೞ
௧
(
19
)
−훿
௧
≤푃퐺
௨௬
ೖ
௧
+푃
ாௌ
ವೞ
ೖ
௧
+푃
ೖ
௧
+푃
ௐா
ೖ
௧
+푃
௨௬
ೖ,ೕ
−
ெோ
ୀଵ
푃퐺
௦
ೖ
௧
−푃
ாௌ
ೖ
௧
−푃
ത
ೖ
−푃
௨௬
ೕ,ೖ
ெோ
ୀଵ
≤훿
௧
(
20
)
훿
௧
≥0
(
21
)
with 푘=1,...,푀푅, 푗=1,...,푀푅, 푡=푡
,푡
+1,...,푇
௭
−1, 푠푐푛=1,...,푁
௦
The cost function is computed as
퐽
ఋ
+퐽
ೖ
ெோ
ୀଵ
where
퐽
ఋ
=
‖
훿
௧
‖
ଶ
ଶ
⋅Δ푡
퐽
ೖ
= ቂ൫푃퐺
௨௬
ೖ
௧
−푃퐺
തതതത
௨௬
ೖ
௧
൯
ଶ
⋅퐶
̅
௨௬
௧
−൫푃퐺
௦
ೖ
௧
−푃퐺
തതതത
௦
ೖ
௧
൯
ଶ
⋅퐶
̅
௦
௧
ቃ⋅Δ푡
௧ା்
ିଵ
௧ୀ௧
Known information:
푀푅=3
푇
௭
=20
푁
௦
=89
System inputs 풖
풕
at time instant 풕, with 풕=ퟏ,ퟐ,...,ퟐퟎ:
푃퐺
௨௬
ೖ
௧
, with 푘=1,2,3
푃퐺
௦
ೖ
௧
, with 푘=1,2,3
푃
௦
ೖ,ೕ
௧
, with 푘=1,2,3, and 푗=1,2,3
푃
௨
ೕ,ೖ
௧
, with 푘=1,2,3, and 푗=1,2,3
푃
ாௌ
ವೞ
ೖ
௧
, with 푘=1,2,3
푃
ாௌ
ೖ
௧
, with 푘=1,2,3
푃
ೖ
௧
, with 푘=1,2,3
푃
ௐா
ೖ
௧
, with 푘=1,2,3
훿
௧
System states 풙
풕
at time instant 풕, with 풕=ퟏ,ퟐ,...,ퟐퟎ:
푆푂퐶
ாௌ
ೖ
௧
, with 푘=1,2,3
푃
ೖ,ೞ
௧
, with 푘=1,2,3 and 푁
௦
=1,2,...,89
푃
ೖ,ೞ
௧ିଵ
, with 푘=1,2,3 and 푁
௦
=1,2,...,89
푃
ೖ,ೞ
௧ିଶ
, with 푘=1,2,3 and 푁
௦
=1,2,...,89
푃
ೖ,ೞ
௧ିଷ
, with 푘=1,2,3 and 푁
௦
=1,2,...,89
푃
ೖ,ೞ
௧ିସ
, with 푘=1,2,3 and 푁
௦
=1,2,...,89
Known parameters at time instant 풕, with 풕=ퟏ,ퟐ,...,ퟐퟎ:
푃퐺
௨௬௫
푃퐺
௦௫
퐵
௦
ೖ
௧
, with 푘=1,2,3
푃
ாௌ
ೌೣ
퐵
ாௌ
ೖ
௧
, with 푘=1,2,3
퐵
௦
ೖ
௧
, with 푘=1,2,3
휂
ாௌ
ವೞ
ೖ
, with 푘=1,2,3
휂
ாௌ
ೖ
, with 푘=1,2,3
푄
௫
ೖ
, with 푘=1,2,3
Δ푡
푆푂퐶
ாௌ
ೖ
, with 푘=1,2,3
푆푂퐶
ாௌ
ೌೣ
ೖ
, with 푘=1,2,3
푃퐺
തതതത
௨௬
ೖ
௧
, with 푘=1,2,3
퐶
̅
௨௬
௧
푃퐺
തതതത
௦
ೖ
௧
, with 푘=1,2,3
퐶
̅
௦
௧
System disturbances 풅
풕
at time instant 풕, with 풕=ퟏ,ퟐ,...,ퟐퟎ:
휖
,௦
௧
, with 푘=1,2,3 and 푁
௦
=1,2,...,89
System dynamics is described in Eqs. (2) and (24) and can be recast as
푥
௧ାଵ
=퐴푥
௧
+퐵푢
௧
+퐸
௫
푝
௧
+퐹
௫
푑
௧
+퐺
௫