Model Predictive Control for Distributed Microgrid
Battery Energy Storage Systems

1

arXiv:1702.04699v1 [] 15 Feb 2017

Thomas Morstyn, Member, IEEE, Branislav Hredzak, Senior Member, IEEE,
Ricardo P. Aguilera, Member, IEEE, and Vassilios G. Agelidis, Fellow, IEEE

Abstract—This paper proposes a new convex model predictive
control strategy for dynamic optimal power flow between battery
energy storage systems distributed in an AC microgrid. The
proposed control strategy uses a new problem formulation, based
on a linear d–q reference frame voltage-current model and
linearised power flow approximations. This allows the optimal
power flows to be solved as a convex optimisation problem, for
which fast and robust solvers exist. The proposed method does
not assume real and reactive power flows are decoupled, allowing
line losses, voltage constraints and converter current constraints
to be addressed. In addition, non-linear variations in the charge
and discharge efficiencies of lithium ion batteries are analysed
and included in the control strategy. Real-time digital simulations
were carried out for an islanded microgrid based on the IEEE 13
bus prototypical feeder, with distributed battery energy storage
systems and intermittent photovoltaic generation. It is shown
that the proposed control strategy approaches the performance
of a strategy based on non-convex optimisation, while reducing
the required computation time by a factor of 1000, making it
suitable for a real-time model predictive control implementation.
Index Terms—Battery Energy Storage, Energy Management,
Microgrid, Model Predictive Control, Optimal Power Flow,
Quadratic Programming.

I. I NTRODUCTION

P

OWER networks are undergoing a shift from the traditional model of centralised power generation towards a
smart decentralised generation model. This trend encompasses
the introduction of distributed renewable generation sources,
controllable energy storage (ES) devices and advanced control
using modern communication technologies [1].
Microgrids have been proposed as an organising principle
for this future smart decentralised grid [2]. A microgrid is a
collocated set of generation sources, loads and storage devices,
which can operate as part of the main grid, or autonomously
if islanded.
Power network control involves dispatching sources based
on a wide range of competing objectives and constraints.
Power network objectives include power loss minimisation and
maximising the utilisation of renewable sources. Constraints
are introduced by power quality limits and device operating
limits. The solution of this constrained optimisation problem
for static networks has been widely studied as the optimal
power flow problem [3].
T. Morstyn is with the Department of Engineering Science at the
University of Oxford, Oxford OX1 2JD, United Kingdom (email:
thomas.morstyn@eng.ox.ac.uk)
B. Hredzak is with the School of Electrical Engineering and Telecommunications at the University of New South Wales (UNSW Australia), Sydney,
NSW 2052, Australia (email: b.hredzak@unsw.edu.au).
R. P. Aguilera is with The School of Electrical, Mechanical and Mechatronic
Systems, University of Technology Sydney (UTS), NSW 2007, Australia.
(email: raguilera@ieee.org).
V. G. Agelidis is with the Department of Electrical Engineering at the
Technical University of Denmark (DTU), 2800 Kgs. Lyngby, Denmark (email:
vasagel@elektro.dtu.dk).

The introduction of ES systems significantly increases the
computational complexity of the optimal power flow problem,
since it must be solved across a time horizon as the dynamic
optimal power flow problem [4]. The optimal use of ES
systems depends not only on the network topology, constraints
and objective, but also the state of charge (SoC) of the ES
systems. SoC limits are of particular importance for battery
ES systems, since they suffer significant lifetime deterioration
when overcharged or undercharged [5]. Also, batteries with
very low SoC are unable to provide power to the network, due
to their reduced output voltage [6]. The SoC of the battery ES
systems will also affect the optimisation objective function,
since battery efficiency depends on the SoC [7].
Recently, there has been significant research interest in using
model predictive control (MPC) for microgrids with ES [8].
The network objective function and constraints are formulated
into a finite-time optimal control problem. At each sampling
period a set of system states are updated, the optimal control
problem is solved online and the controller time horizon
recedes by another step. MPC has been widely applied in the
process industries, robotics and vehicle navigation [9], [10].
With advances in communications and computer processing,
it has become a practical solution for microgrid control.
Existing MPC strategies for microgrids with distributed ES
can be broadly divided into four groups:
(i) Strategies which only consider a single ES system, or
multiple ES systems in aggregate [11]–[13]. This restricts
power flows between different ES systems from being
considered.
(ii) Strategies assuming an ideal real power transfer model
between the microgrid ES systems [14], [15]. Losses and
line power flow limits are not considered.
(iii) Strategies based on the DC power flow approximation
[16]. In this case, lines connecting the ES systems are
treated as purely reactive, so that with a small angle
approximation power flows depend linearly on the bus
voltage angles. This provides a convex optimisation for
which fast and robust solvers are readily available. However, line losses and bus voltage limits are not considered.
This is particularly unsuitable for microgrids, which may
have relatively low line X/R ratios [17].
(iv) Strategies based on non-convex optimisation. MPC based
on non-linear programming (NLP) in unbalanced microgrids is presented in [18]. However, since the problem
is non-convex, scalability is limited, and existing solvers
are only guaranteed to find locally optimal solutions. An
alternate approach is to use recursive dynamic programming for the ES system optimal power flow problem
[4]. This method obtains a globally optimal solution, but
its numerical complexity grows in power law with the
number of ES systems.

2

This paper proposes a new convex MPC strategy for dynamic optimal flow between battery ES systems distributed in
an AC microgrid. The novel features of the control strategy
are:
1) A new formulation of the dynamic optimal power flow
problem is proposed, based on a linear d–q reference
frame voltage-current model and linearised power flow
approximations. This allows the ES system optimal power
flows to be solved as a convex quadratically constrained
quadratic program (QCQP), for which fast and robust
solvers exist, making it suitable for a real-time receding
horizon MPC implementation. The proposed method does
not assume real and reactive power flows are decoupled,
allowing line losses, voltage constraints and converter
current constraints to be addressed in the optimisation.
2) Non-linear variations in the charge and discharge efficiencies of lithium ion batteries are analysed with respect
to SoC and output power. It is shown that this nonlinear dependence is well approximated by second order
polynomial functions, which are incorporated into the
control strategy by updating the charge and discharge
efficiencies at each sampling interval.
To demonstrate the performance of the proposed control
strategy, simulations were carried out for an islanded microgrid
based on the IEEE 13 bus prototypical feeder, with distributed
battery ES systems and intermittent PV generation. The simulations were completed with an RTDS Technologies real-time
digital simulator, with non-linear battery models and switching
converter models.
The rest of this paper is organised as follows. Section
II presents the principle of operation of the proposed MPC
strategy. In Section III, models are developed for the microgrid
network and battery ES systems. Section IV presents the MPC
optimisation problem formulation. Results, demonstrating the
control strategy’s performance are presented in Section V.
Section VI concludes the paper.
II. P RINCIPLE OF O PERATION
This study considers a microgrid with distributed renewable
generation sources and battery ES devices. The renewable generation sources and ES devices are connected to the microgrid
by controllable voltage source converters (VSC).
A standard method for VSC control is to have an inner
loop current controller, and outer loop voltage controller which
regulates the VSC output voltage to a desired reference [19].
The VSC local control operates on a fast time-scale, and thus
replacing it with a central MPC would be infeasible, requiring
very high bandwidth communications.
Following a change in the VSC output voltage references,
the time taken for a microgrid to reach steady state is on
the order of 1 second. Assuming that the local controllers are
well designed and give desirable transient performance, the
MPC strategy can operate on a slower time-scale, with a static
network model.
In this study a 1 minute sampling period is chosen, allowing
the power flows to be adjusted in response to changes in PV
generation, taking into account the SoC of the batteries. The

VSC
vodq1
State of Charge
of the Batteries

Renewable
Generation
Predictions

MPC

vodq2

Local
Control

Local
Control

Microgrid

Fig. 1. High level block diagram of the proposed MPC strategy.

Vdci

iLdqi

Battery

Lfi
VSC

rfi

Lci
Cfi

vbdqi

iodqi

vodqi

iloaddqi
Lloadi

rci

rloadi

Llinek
ilinedqk
rlinek
vbdqj

Fig. 2. Two bus microgrid segment, with a battery energy storage system,
LCL output filter, RL line and RL load.

manipulated variables of the MPC are the output voltages of
the converters, transformed to a fixed frequency synchronous
d–q reference frame. These are supplied as references to the
local VSC voltage controllers. A high level block diagram of
the proposed control strategy is shown in Fig. 1.
This study considers an islanded microgrid operating autonomously from the main grid. Since the microgrid load must
be supplied by the local generation sources and ES systems, a
natural objective is power network loss minimisation, while
making use of the maximum power available from renewable generation. Network power quality requirements impose
constraints on the VSC output voltages, and device operating
limits require constraints on the VSC output currents and SoC
of the batteries.

III. M ICROGRID M ODELLING
A. Microgrid Network
The network model considers the passive components, including coupling filters, lines and loads, between the buses
which are actively regulated by the VSCs.
Fig. 2 shows a two bus segment of the microgrid. The
full microgrid has loads Sloads = {1, . . . , Nload }, lines
Sline = {1, . . . , Nline } and VSCs Svsc = {1, . . . , Nvsc }.
The microgrid lines are modelled as RL circuits. In the
synchronous d–q reference frame, the state equations for the
VSC output currents, load currents and line currents can be
combined into a state space model, with the vector of regulated

3

VSC output voltages as the input [19].




i
iodq
d  odq 
iloaddq = Anet iloaddq  + Bnet vodq ,
dt
ilinedq
ilinedq
T
T
iodq = iodq1 · · · iTodqNvsc ,

T
iloaddq = iTloaddq1 · · · iTloaddqNload ,

T
ilinedq = iTlinedq1 · · · iTlinedqNline ,
 T
T
T
· · · vodqN
vodq = vodq1
.
vsc

(1)

iLdqi = GiLi vodq

(4)
T

iodq1 and vodqi are the d–q component vectors of the output
current and output voltage of the ith VSC. The d–q current
components of the load at bus i are given by iloaddqi , and the
d–q current components of line j are given by ilinedqj .
The MPC strategy operates on a much slower time-scale
than the network dynamics. The following static model describing the steady state network behaviour is used to calculate
the network currents from the VSC output voltages.
iodq = Gio vodq , iloaddq = Giload vodq

Vdci is the VSC DC link voltage, ami = 0.5 for sinusoidal
pulse width modulation (PWM), iLdqi is the inductor current
d–q component vector and udqi is the PWM control signal
d–q component vector.
The local VSC controllers regulate the output voltage much
faster than the MPC sampling period. Therefore, the following
static VSC model can be used.

(2)

ũdqi = Gũi vodq , ũdqi = ami Vdci [udi uqi ]




0
−ωCf i
1 0
T
GiLi =
ei ⊗
+ Gioi
ωCf i
0
0 1





rf i −ωLf i
1 0
T
Gũi =
GiLi + ei ⊗
ωLf i
rf i
0 1
ei is a vector of length Nvsc , with a 1 at position i and zeros for
all other entries. ũdqi is the VSC input voltage d–q component
vector. The real power supplied from the DC side of the VSC
is given by
Pvsci = ũdi iLdi + ũqi iLqi .

(5)

C. Battery Energy Storage System
Let the subset of microgrid VSCs associated with battery
ES systems be given by Sbatt ⊆ Svsc . The SoC dynamics
T
T
Gio
· · · GiloadN ] ,
load
for battery ES system i ∈ Sbatt can be modelled using the
Giline = [GTiline1 · · · GTilineN ]T .
following discrete time state equations [16], [18],
line
(
(k)
The d–q reference frame voltage-current model is based on
, Pvsci (k) ≤ 0,
SoCi (k) − ηchi (k)Ts PEvsci
maxi
SoC
(k
+
1)
=
i
Pvsci (k)
1
a balanced three phase system. In general, this assumption is
SoCi (k) − ηdisi (k) Ts Emaxi , Pvsci (k) > 0.
justified by power network standards which place stringent
(6)
restrictions on the level of voltage unbalance. However, if
voltage unbalance is a concern it can be addressed with a Ts is the sampling period, Emaxi is the maximum battery
lower level compensation scheme based on virtual impedance energy in Ws, ηchi is the charging efficiency and ηdisi is the
discharging efficiency.
[20].
When this model is used for MPC the charge and discharge
The microgrid impedances are required to develop the
efficiencies
are commonly assumed to be constant [16], [18].
voltage-current model. If the microgrid impedances are not
However,
the
battery efficiency is actually a non-linear funcavailable, they can be obtained using online identification
tion
of
the
SoC
and the battery output power.
methods [21].
At a particular steady state output current, an electrochemical battery cell (e.g. lithium ion, lead acid) can be modelled
B. Voltage Source Converters
as an open circuit voltage Voci and terminal resistance Rti ,
The MPC strategy controls power flows in the microgrid each with a non-linear dependence on the SoC [6].
by providing voltage references to the VSCs of the renewable
Voci = a0i e−a1i SoCi + a2i + a3i SoCi − a4i SoCi2 + a5i SoCi3 ,
generation sources and ES systems. The VSCs use standard
Rti = Rsi + Rtsi + Rtli
decoupled d–q inner loop current controllers, and outer loop
voltage controllers to regulate their output voltage to the
Rsi = b0i e−b1i SoCi + b2i + b3i SoCi − b4i SoCi2 + b5i SoCi3 ,
desired reference.
Rtsi = c0i e−c1i SoC + c2i , Rtli = d0i e−d1i SoCi + d2i .
(7)
Let ω be the microgrid frequency. In the synchronous d–q
Assuming there is a balancing circuit between the battery
reference frame, the state equations for inductor current and
cells, the total battery output current idci = icelli Nparai
output voltages of VSC i ∈ Svsc are given by [22],
and the battery output voltage Vdci = vcelli Nseriesi , where
rf i
1
ami Vdci
d
iLdi = −
iLdi + ωiLqi −
vodi +
udi , (3) Nseriesi is the number of series connected cells in each string
dt
Lf i
Lf i
Lf i
and Nparai is the number of parallel connected cell strings.
d
rf i
1
ami Vdci
For a particular SoC and output power, the battery cell
iLqi = −
iLqi − ωiLdi −
voqi +
uqi ,
dt
Lf i
Lf i
Lf i
current can be obtained by solving the following quadratic
equation,
d
1
vodi =
(iLdi − iodi ) + ωvoqi ,
dt
Cf i
1
Pvsci
Voci (SoCi )
+
= 0.
i2celli − icelli
d
1
Rti (SoCi )
Nseriesi Nparai Rti (SoCi )
voqi =
(iLqi − ioqi ) − ωvodi .
(8)
dt
Cf i
ilinedq = Giline vodq ,
[GTio

GTiload
= [GTio1

GTiline ]T = (−Anet )−1 Bnet ,
· · · GTioNvsc ]T , Giload = [GTiload1

4

Let τ = {k0 , . . . , k0 + Np − 1} be the MPC time horizon.
The MPC state variables are the battery ES systems’ SoC levels SoCi (k), k ∈ τ i ∈ Sbatt . The MPC manipulated variables
are the VSC d–q reference frame output voltage references,
VSC charging powers and VSC discharging powers, over the
time horizon.
Û = [U (k0 )T U (k0 + 1)T · · · U (k0 + Np − 1)T ]T ,
T

Fig. 3. Relationship between VSC output power and battery SoC with ηch ,
and a fitted second order polynomial approximation.

(11)

PTch (k)

U (k) = [vodq (k)
PTdis (k)]T ,
Pch (k) = [Pch1 (k) · · · PchNvsc (k)]T ,
Pdis (k) = [Pdis1 (k) · · · PdisNvsc (k)]T .
The charge and discharge power variables are introduced
to allow different charge and discharge efficiencies while
maintaining a convex QP formulation.
A. Objective Function

Fig. 4. Relationship between VSC output power and battery SoC with
and a fitted second order polynomial approximation.

1
,
ηdis

Then, the battery charging and discharging efficiencies are
given by,
icelli Voci (SoCi )
, icelli ≤ 0
icelli (Voci (SoCi ) − icelli Rti (SoCi ))
(9)
icelli (Voci (SoCi ) − icelli Rti (SoCi ))
, icelli > 0.
=
icelli Voci (SoCi )

ηchi =

ηdisi

The microgrid considered in this study includes 100kWh,
900V lithium ion batteries. The batteries are made up of 130
parallel strings, each with 215 series connected 4.2V, 860mAh
cells. The cell model parameters in (7) are provided by [23].
Fig. 3 and 4 show the effect of the SoC and output power on
the charge and discharge efficiency. As shown, second order
polynomials provide good approximations for the efficiency
over the ranges of interest for the output power (-100kW to
100kW) and SoC (20% to 100%).
ch
ch
2
ch
ηchi = pch
0i + pSoC1i SoCi + pSoC2i SoCi + pP 1i Pvsci
2
ch
+pch
P 2i Pvsci + pP SoCi SoCi Pvsci ,
(10)

1
dis
dis
2
dis
= pdis
0i + pSoC1i SoCi + pSoC2i SoCi + pP 1i Pvsci
ηdisi
2
dis
+pdis
P 2i Pvsci + pP SoCi SoCi Pvsci .
IV. M ODEL P REDICTIVE C ONTROL F ORMULATION
In this section the microgrid optimisation problem is formulated as a convex QCQP, which can be implemented with
a receding horizon for MPC.

The objective chosen for the islanded microgrid is to minimise real power losses over the time horizon. Real power
losses are incurred due to network line resistances, resistances
in the VSC LCL filters and losses from charging/discharging
the batteries. The objective function to be minimised is given
by,
X
Jobj =
JLCL (k) + Jline (k) + Jbatt (k),
(12)
k∈τ

X

JLCL (k) =

T
vodq
(k) rf i GTiLi (k)GiLi (k)

i∈Svsc


+ rci GTioi (k)Gioi (k) vodq (k),
(13)
X
T
Jline (k) =
rlinej vodq
(k)GTilinej Gilinej vodq (k), (14)
j∈Sline

X

Jbatt (k) =

i∈Sbatt


(1 − ηchi )Pchi (k) +

1
ηdisi


− 1 Pdisi (k).
(15)

The losses associated with the relative positions of the
microgrid loads, renewable generation sources and battery ES
systems are included in the objective function through the
Gioi (k), GiLi (k) and Gilinej matrices. Gioi (k) and GiLi (k)
vary over the time horizon k ∈ τ based on the microgrid load
predictions.
Directly including the SoC and output power dependence
of ηchi and ηdisi in the objective function would make the
optimisation problem non-convex. Instead, the efficiencies are
updated each time interval prior to the optimisation, and
treated as constant over the time horizon. The efficiencies are
calculated based on the current SoC estimates and the output
powers from the previous time interval, using the second order
polynomial approximations (10).
B. Constraints
The microgrid power quality requirements and device operating limits are formulated as affine equality and convex
inequality constraints to provide a convex QCQP formulation.

5

Pdisi (k)−Pchi (k) = ũdi (k)iLdi (k) + ũqi (k)iLqi (k),

(16)

1.1

v d / V LL (Vpu)

1) VSC Output Power: To ensure the MPC solution is
feasible, the VSC charge and discharge power manipulated
variables must match the power flows expected from the output
voltage manipulated variables.

Pdisi (k)−Pchi (k) = [Ũdi (k) Ũqi (k)]GiLi (k)vodq (k)

(18)

+ [ILdi (k) ILqi (k)]Gũi (k)vodq (k)
− Ũdi (k)ILdi (k) − Ũqi (k)ILqi (k), i ∈ Svsc k ∈ τ.
For the ith battery ES system, let the allowed range of real
output powers be given by [−P̄chi , P̄disi ]. This motivates the
following constraints,
Pchi (k) ≤ P̄chi , Pdisi (k) ≤ P̄disi , i ∈ Sbatt k ∈ τ.

(19)

The remaining VSCs (i ∈ Svsc , i ∈
/ Sbatt ) are associated
with renewable generation sources or constant power loads.
Let Sgen ⊆ Svsc be the set of renewable generation sources
and Scpl ⊆ Svsc be the set of constant power loads.
The constant power load predictions over the time horizon
are given by Pcpli (k), i ∈ Scpl k ∈ τ . The constant power
loads are constrained to operate at this level.
Pdisi (k) = 0, Pchi (k) = Pcpli (k), i ∈ Scpl k ∈ τ.

(20)

The available renewable generation predictions over the
time horizon are given by Pmppi (k), i ∈ Sgen k ∈ τ . The
renewable generation sources are constrained to operate at this
level.
Pdisi (k) = Pmppi (k), Pchi (k) = 0, i ∈ Sgen k ∈ τ.

(21)

In practice, the linearisation (18) may result in a mismatch
between the available renewable generation Pmppi (k) and
the power required to achieve the output voltage reference
vodqi (k). This is corrected by including an integral control
loop with the local VSC voltage controller, which adjusts the
vodi (k0 ) reference until Pvsci (k0 ) = Pmppi (k0 ).
2) Battery SoC: A standard selection for the battery ES
system SoC constraints is SoC = 20%, SoC = 100%.
SoC ≤ SoCi (k + 1) ≤ SoC, i ∈ Sbatt k ∈ τ

(22)

Using (6), the SoC at each interval of the time horizon can
be expressed in terms of the estimates of the current SoC
(SoCi (k0 ), i ∈ Sbatt ) and the manipulated variables.
SoCi (k + 1) = SoCi (k) + ηchi Ts

Pchi (k)
1
Pdisi (k)
−
Ts
.
Emaxi
ηdisi
Emaxi
(23)

Since a linear system model is necessary to maintain a convex
QP formulation, ηchi and ηdisi are updated each time interval

V L L max
vd min

0.9
0.8
0.7
-0.6

0 ≤ Pchi (k), 0 ≤ Pdisi (k), i ∈ Svsc k ∈ τ. (17)
The quadratic equality constraint (16) makes the microgrid
optimisation problem non-convex. To obtain a convex formulation, the quadratic equality constraints are replaced by approximate affine equality constraints obtained through linearisation,
based on nominal operating points of ILdqi (k), Ũdqi (k), for
the VSC inductor currents and input voltages.

V L L min

1

-0.4

-0.2

0

0.2

0.4

0.6

v q / V LL (Vpu)

Fig. 5. VSC RMS output voltage constraints and conservative affine lower
bound.

prior to the optimisation, and treated as constant over the time
horizon.
The SoC model and objective function require that for each
k ∈ τ and i ∈ Sbatt either Pchi (k) = 0 or Pdisi (k) = 0.
This is ensured by the constraint that the charging and discharging powers are greater than or equal to zero (17) and
the observation that Jbatt (k) applies a cost to Pchi (k) > 0
and Pdisi (k) > 0 since the batteries have limited efficiency
[18]. If the optimisation problem has a feasible solution with
Pdis (k) > 0 and Pchi (k) > 0, there will be a lower cost
solution with one at a lower value, and the other at zero.
3) VSC Output Voltage: Standard RMS voltage limits for an
AC microgrid are VLL ± 10%, where VLL is the nominal line
to line voltage. Therefore, the VSC d–q voltage components
should be limited so that,
2
2
vodi
(k) + voqi
(k) ≤ (1.1VLL )2

(24)

2
vodi
(k)

(25)

+

2
voqi
(k)

2

≥ (0.9VLL ) , i ∈ Svsc k ∈ τ.

The upper bound (24) is a convex quadratic constraint and can
be directly included in the convex MPC formulation. However,
the lower bound (25) is non-convex. Assuming the voltage
should be able to vary in the d–q reference frame around a
nominal operating point of vodqi = (VLL , 0), the non-convex
quadratic lower bound can be approximated by the following
conservative affine inequality constraint on the d axis voltage.
vodi (k) ≥ 0.9VLL , i ∈ Svsc k ∈ τ.

(26)

Fig. 5 shows the RMS voltage limits in the d–q reference
frame and the conservative d axis lower bound.
4) VSC Output Current: The maximum rated current of
the VSC switches will impose a constraint on the VSC RMS
current. Note that this implicitly introduces a limit on the
maximum reactive output power of the VSC, based on the
output voltage and real output power [24]. Let the maximum
VSC RMS phase current be given by I¯phi . The VSC d–q
inductor current components should be limited so that,
√
i2Ldi (k) + i2Lqi (k) ≤ ( 3I¯phi (k))2 , i ∈ Svsc k ∈ τ. (27)
C. Non-Convex and Convex Optimisation Formulations
The MPC loss minimisation objective is a quadratic function
of the manipulated variables. The microgrid MPC strategy can
be formulated as a non-convex QCQP given by,
minimise Jobj
Û

subject to (16), (17), (19), (20), (21),
(22), (23), (24), (25), (27).

(28)

6

TABLE I
R EAL -T IME S IMULATION PARAMETERS
650

ω
Np
SoC
P̄dis
Cf
pch
0
pch
P1
pdis
0
pdis
P1

(Islanded)

646

645

632

633

634

611

684

671

692

675
415V/4.16kV

652

680
Load
Battery System

50Hz
30min
20%
100kW
680µF
1.00
-4.77·10−7
1.00
5.00·10−7

VLL
Ts
SoC
Lf
Lc
pch
SoC1
pch
P2
pdis
SoC1
pdis
P2

415V
1min
100%
3.8mH
300µH
4.00·10−3
3.06·10−13
-4.60·10−3
4.23·10−13

fvsc
I¯ph
P̄ch
rf
rc
pch
SoC2
pch
P SoC
pdis
SoC2
pdis
P SoC

120

PV Real Power (kW)

PV System

Fig. 6. Case study microgrid.

10kHz
150A
100kW
0.15Ω
0.05Ω
-3.11·10−3
9.66·10−8
4.13·10−3
-1.36·10−7

Bus 632
Prediction

100
80
60
40
20

minimise Jobj

(29)

Û

subject to (17), (18), (19), (20), (21),
(22), (23), (24), (26), (27).

0
0

2

4

6

8

10

Time (h)

Fig. 7. PV generation real output power and predictions.

Nominal Load (kW)

Since the objective function is convex, the MPC optimisation can be formulated as a convex QCQP by replacing the
VSC output power quadratic equality constraints (16) with
affine approximations (18), and by replacing the quadratic
lower bound on the VSC RMS output voltages (25) with the
conservative affine lower bound (26).

Total Load
Prediction

70
60
50
40
30
0

2

4

6

8

10

Time (h)

Having formulated the dynamic optimal power flow problem as a convex QCQP, it can be solved with interior point
methods which can solve problems with hundreds of variables
and constraints in several seconds on standard computing
hardware [25].
D. Model Predictive Control Implementation
The convex QCQP is implemented using receding horizon
MPC to control the microgrid battery ES systems in real-time.
At each time interval, k0 :
1) Updated battery SoC estimates, SoCi (k0 ), i ∈ Sbatt , renewable generation predictions, Pmppi (k), i ∈ Sgen k ∈
τ , load predictions, Pcpli (k), i ∈ Scpl k ∈ τ , and network
matricies Gioi (k), GiLi (k), i ∈ Svsc k ∈ τ are obtained.
2) The convex dynamic optimal power flow problem (29) is
solved.
3) The optimal d–q voltages for the current time interval
∗
vodqi
(k0 ), i ∈ Svsc , are supplied as references for the
local VSC voltage controllers. In addition, the renewable
sources operated for maximum power point tracking are
provided with, Pmppi (k0 ), i ∈ Sgen .
4) The MPC time horizon recedes by a step, k0 ← k0 + 1,
for the next time interval.
V. R ESULTS
To demonstrate the performance of the proposed MPC strategy, simulations were carried out using an RTDS Technologies
real-time digital simulator. The proposed MPC strategy was
used to control four battery ES systems and a PV generation

Fig. 8. Nominal total microgrid load profile (for bus voltages of 415V) and
predictions.

source, distributed in an islanded microgrid based on the IEEE
13 bus prototypical test feeder. The batteries were simulated
using the non-linear model from [23], and switching converter
models were used for the VSCs.
A. Real-Time Digital Simulation
The case study microgrid is shown in Fig. 6. The simulation
parameters are provided in Table I. The network is operated at
50Hz. Each battery ES system has a 100kWh, 900V lithium
ion battery, as described in Section III-C. PV generation
with 100kW nominal capacity at standard test conditions is
introduced at bus 632. The maximum PV power point was
calculated using the method from [26] for irradiance and
temperature data with 1 minute resolution, taken from the
NREL Baseline Measurement Station in Colorado, for the 15th
of August 2015 between 6am and 4pm.
The MPC is formulated with a 1 minute sampling period
based on the PV generation variability. A 30 minute time
horizon is used based on the expected availability of PV
generation predictions from ground-based sky imaging sensors
[27]. At each sampling interval, the MPC strategy has access to
the current SoC of the batteries, PV generation and microgrid
load, as well as inaccurate PV generation and load predictions
over the time horizon.
Fig. 7 shows the varying PV generation output power and

Battery Real Power (kW)

7

30

Bus 646
Bus 634
Bus 675
Bus 680

20
10
0
-10
-20
-30
0

2

4

6

8

10

Time (h)

Battery State of Charge (%)

Fig. 9. Battery ES system real output powers.

Bus 646
Bus 634
Bus 675
Bus 680

100
80
60
40
20
0

2

4

6

8

10

Time (h)

VSC Reactive Power (kVAr)

Fig. 10. Battery ES system SoC levels.
100

Bus 646
Bus 634
Bus 675
Bus 680
Bus 632

50

0

-50
0

2

4

6

8

10

Time (h)

VSC RMS Phase Current (A)

Fig. 11. VSC reactive output powers.
200

Bus 646
Bus 634
Bus 675
Bus 680
Bus 632

150
100
50
0
0

2

4

6

8

10

Time (h)

VSC RMS Output Voltage (Vpu)

Fig. 12. VSC RMS inductor phase currents.
1.2

Bus 646
Bus 634
Bus 675
Bus 680
Bus 632

1.1

profile was generated based on the residential microgrid load
profile from [29]. A random walk (with uniformly distributed
steps between ±0.75% each minute) was added to model
minute to minute variations.
The MPC QCQP was solved in MATLAB with the IBM
CPLEX solver, implemented using the YALMIP toolbox [30].
The average solution time was 0.71 seconds on an Intel
Core i7-4770 CPU. TCP/IP communication over an Ethernet
network was used between the computer running the MPC
and the real-time digital simulator simulating the network and
local VSC controllers.
Fig. 10 shows that the battery ES systems begin with SoC
between 25% and 100%. As shown in Fig. 9, the battery
ES systems share the difference between the intermittent PV
generation and the load. The minimum SoC reached by any
of the batteries is 19.98% and the maximum SoC reached is
100.05%, slightly violating the 20% to 100% limits. These
small violations are caused by the approximate nature of the
battery SoC model.
The VSCs inject/absorb reactive power to control the microgrid bus voltages, as shown in Fig. 11. Fig. 12 shows the
VSC phase currents. The maximum phase current is 165A.
Averaging over each 1 minute sampling period to remove the
ripple current and transients (which are not considered by
the MPC strategy) the maximum average phase current for
any interval is 154.8A, slightly violating the 150A limit. The
constraint violation is caused by the PV generation prediction
errors. Fig. 13 shows that the microgrid bus voltages are kept
within the required limits of VLL ±10%. The proposed MPC
strategy keeps the VSC output voltages near the lower voltage
limit. Since the microgrid load is mainly resistive, this reduces
the load currents and losses. This demonstrates the importance
of an MPC strategy that includes the effect of line impedances
and source output voltages on losses.
The average power loss is 12.638kW over the case study.
To ensure the proposed MPC strategy is not overly sensitive
to the placement of the VSCs, the case study was repeated
with the PV generation source at bus 611, bus 652 and bus
645 (instead of bus 632), giving average losses of 12.634kW,
12.642kW and 12.654kW respectively.

1

B. Comparison with the Non-Convex QCQP

0.9

0.8
0

2

4

6

8

10

Time (h)

Fig. 13. VSC per unit RMS output voltages.

the predictions used by the MPC strategy. The PV generation
predictions are modelled by a moving average with a 5 minute
window. This gives a root mean squared error of 12.7%, which
is in line with the error expected from intra-hour PV generation
predictions [28].
The microgrid has a variable resistive load at each bus.
Fig. 8 shows the total nominal load profile (for bus voltages
of 415V) and the load predictions, which are modelled by
a moving average with a 5 minute window. The total load
is evenly divided between the 12 microgrid buses. The load

The accuracy of the sub-optimal solution found by the proposed MPC strategy based on the convex QCQP formulation
(29) with inaccurate PV generation and load predictions, was
compared to the non-convex QCQP formulation (28) without
PV generation and load prediction errors. Solving the nonconvex QCQP takes too long for real-time implementation.
Instead it was solved offline for each thirty minute interval
of the case study, based on accurate PV generation and load
predictions. MATLAB’s FMINCON solver was used to find a
local optimum, taking the solution of the convex QCQP as a
starting point.
The convex QCQP gave an average power loss of 12.638kW
over the case study, while the non-convex QCQP gave an
average power loss of 11.596kW (8.25% lower). However,
the average solution time for the non-convex QCQP was 23

8

minutes, compared to 0.71 seconds for the convex QCQP (a
reduction by a factor of 1000), demonstrating its unsuitability
for a real-time implementation.
C. Comparison with a Constant Efficiency SoC Model
To quantify the benefits of the proposed variable efficiency
battery SoC model, the proposed MPC strategy formulation
was modified so that the battery charging and discharging
efficiencies were kept constant. A charging efficiency of
99.81% and discharging efficiency of 99.80% were used based
on a nominal charging and discharging power of ±5kW and a
SoC of 70%. The case study was repeated using the constant
efficiency MPC strategy, giving average losses of 13.194kW,
a 4.40% higher cost than the variable efficiency formulation
(12.638kW).
The proposed method for incorporating the variable battery
efficiency is approximate and, in certain cases, it may be
possible to find fixed efficiency values which give superior
performance. The main advantage of the proposed method is
that it provides a means of generating reasonable approximate
values based on the microgrid operating state.
VI. C ONCLUSION
A new convex MPC strategy for dynamic optimal power
flow between distributed AC microgrid battery ES systems
has been presented. The convex optimisation formulation can
be solved quickly using robust solvers, and accounts for line
losses and voltage drops in the microgrid. The proposed
control strategy approaches the performance of a strategy
based on non-convex optimisation, while reducing the required
computation time by a factor of 1000, making it suitable for
a real-time MPC implementation.
R EFERENCES
[1] M. H. Nehrir, C. Wang, K. Strunz, H. Aki, R. Ramakumar, J. Bing,
Z. Miao, and Z. Salameh, “A Review of Hybrid Renewable/Alternative
Energy Systems for Electric Power Generation: Configurations, Control,
and Applications,” IEEE Trans. Sustain. Energy, vol. 2, no. 4, pp. 392–
403, Oct. 2011.
[2] R. Lasseter, “MicroGrids,” in 2002 IEEE Power Engineering Society
Winter Meeting., vol. 1, 2002, pp. 305–308.
[3] J. Momoh, R. Adapa, and M. El-Hawary, “A review of selected optimal
power flow literature to 1993. I. Nonlinear and quadratic programming
approaches,” IEEE Trans. Power Syst., vol. 14, no. 1, pp. 96–104, 1999.
[4] Y. Levron, J. M. Guerrero, and Y. Beck, “Optimal Power Flow in
Microgrids With Energy Storage,” IEEE Trans. Power Syst., vol. 28,
no. 3, pp. 3226–3234, Aug. 2013.
[5] V. Agarwal, K. Uthaichana, R. A. DeCarlo, and L. H. Tsoukalas,
“Development and Validation of a Battery Model Useful for Discharging
and Charging Power Control and Lifetime Estimation,” IEEE Trans.
Energy Convers., vol. 25, no. 3, pp. 821–835, Sep. 2010.
[6] M. Chen and G. Rincon-Mora, “Accurate Electrical Battery Model
Capable of Predicting Runtime and IV Performance,” IEEE Trans.
Energy Convers., vol. 21, no. 2, pp. 504–511, Jun. 2006.
[7] Y. Parvini and A. Vahidi, “Maximizing charging efficiency of lithiumion and lead-acid batteries using optimal control theory,” 2015 American
Control Conference (ACC), pp. 317–322, Jul. 2015.
[8] D. E. Olivares, A. Mehrizi-Sani, A. H. Etemadi, C. A. Canizares,
R. Iravani, M. Kazerani, A. H. Hajimiragha, O. Gomis-Bellmunt,
M. Saeedifard, R. Palma-Behnke, G. A. Jimenez-Estevez, and N. D.
Hatziargyriou, “Trends in Microgrid Control,” IEEE Trans. Smart Grid,
vol. 5, no. 4, pp. 1905–1919, Jul. 2014.

[9] P. D. Christofides, R. Scattolini, D. Muñoz de la Peña, and J. Liu,
“Distributed model predictive control: A tutorial review and future
research directions,” Computers & Chemical Engineering, vol. 51, pp.
21–41, Apr. 2013.
[10] J. H. Lee, “Model predictive control: Review of the three decades
of development,” International Journal of Control, Automation and
Systems, vol. 9, no. 3, pp. 415–424, Jun. 2011.
[11] A. Parisio, E. Rikos, and L. Glielmo, “A Model Predictive Control
Approach to Microgrid Operation Optimization,” IEEE Trans. Control
Syst. Technol., vol. 22, no. 5, pp. 1813–1827, Sep. 2014.
[12] E. Perez, H. Beltran, N. Aparicio, and P. Rodriguez, “Predictive Power
Control for PV Plants With Energy Storage,” IEEE Trans. Sustain.
Energy, vol. 4, no. 2, pp. 482–490, Apr. 2013.
[13] E. Mayhorn, K. Kalsi, M. Elizondo, N. Samaan, and K. Butler-Purry,
“Optimal control of distributed energy resources using model predictive
control,” in 2012 IEEE Power and Energy Society General Meeting, Jul.
2012, pp. 1–8.
[14] H. Dagdougui, L. Dessaint, and A. Ouammi, “Optimal power exchanges
in an interconnected power microgrids based on model predictive
control,” 2014 IEEE PES General Meeting — Conference & Exposition,
pp. 1–5, Jul. 2014.
[15] F. Garcia-Torres and C. Bordons, “Optimal Economical Schedule of
Hydrogen-Based Microgrids With Hybrid Storage Using Model Predictive Control,” IEEE Trans. Ind. Electron., vol. 62, no. 8, pp. 5195–5207,
Aug. 2015.
[16] P. P. Zeng, Z. Wu, X.-P. Zhang, C. Liang, and Y. Zhang, “Model
predictive control for energy storage systems in a network with high
penetration of renewable energy and limited export capacity,” 2014
Power Systems Computation Conference, pp. 1–7, Aug. 2014.
[17] S. Tabatabaee, H. R. Karshenas, A. Bakhshai, and P. Jain, “Investigation
of droop characteristics and X/R ratio on small-signal stability of
autonomous Microgrid,” 2011 2nd Power Electronics, Drive Systems
and Technologies Conference, pp. 223–228, Feb. 2011.
[18] D. E. Olivares, C. A. Canizares, and M. Kazerani, “A Centralized Energy
Management System for Isolated Microgrids,” IEEE Trans. Smart Grid,
vol. 5, no. 4, pp. 1864–1875, Jul. 2014.
[19] N. Pogaku, M. Prodanovic, and T. C. Green, “Modeling, Analysis and
Testing of Autonomous Operation of an Inverter-Based Microgrid,”
IEEE Trans. Power Electron., vol. 22, no. 2, pp. 613–625, Mar. 2007.
[20] M. Savaghebi, A. Jalilian, J. C. Vasquez, and J. M. Guerrero, “Secondary
Control Scheme for Voltage Unbalance Compensation in an Islanded
Droop-Controlled Microgrid,” IEEE Trans. Smart Grid, vol. 3, no. 2,
pp. 797–807, jun 2012.
[21] M. Ciobotaru, R. Teodorescu, P. Rodriguez, A. Timbus, and F. Blaabjerg,
“Online grid impedance estimation for single-phase grid-connected
systems using PQ variations,” PESC Record - IEEE Annual Power
Electronics Specialists Conference, pp. 2306–2312, Jun. 2007.
[22] X. Wu, S. K. Panda, and J. Xu, “Effect of Pulse-Width Modulation
Schemes on the Performance of Three-Phase Voltage Source Converter,”
IECON 2007 - 33rd Annual Conference of the IEEE Industrial Electronics Society, pp. 2026–2031, 2007.
[23] T. Kim and W. Qiao, “A Hybrid Battery Model Capable of Capturing
Dynamic Circuit Characteristics and Nonlinear Capacity Effects,” IEEE
Trans. Energy Convers., vol. 26, no. 4, pp. 1172–1180, Dec. 2011.
[24] S. G. Johansson, G. Asplund, E. Jansson, and R. Rudervall, “Power
system stability benefits with VSC DC-transmission systems.” in CIGRE
Conference, Paris, France, 2004, pp. 1–8.
[25] S. Boyd and L. Vandenberghe, Convex Optimization.
Cambridge
University Press, 2004.
[26] M. Villalva, J. Gazoli, and E. Filho, “Comprehensive Approach to
Modeling and Simulation of Photovoltaic Arrays,” IEEE Trans. Power
Electron., vol. 24, no. 5, pp. 1198–1208, May 2009.
[27] M. Diagne, M. David, P. Lauret, J. Boland, and N. Schmutz, “Review
of solar irradiance forecasting methods and a proposition for small-scale
insular grids,” Renewable and Sustainable Energy Reviews, vol. 27, pp.
65–76, Nov. 2013.
[28] Y. Chu, H. T. C. Pedro, L. Nonnenmacher, R. H. Inman, Z. Liao,
and C. F. M. Coimbra, “A smart image-based cloud detection system
for intrahour solar irradiance forecasts,” Journal of Atmospheric and
Oceanic Technology, vol. 31, no. 9, pp. 1995–2007, 2014.
[29] S. Papathanassiou, N. Hatziargyriou, and K. Strunz, “A Benchmark Low
Voltage Microgrid Network,” in Proceedings of the CIGRE Symposium:
Power Systems with Dispersed Generation, Jan. 2005, pp. 1–8.
[30] J. Lfberg, “Yalmip : A toolbox for modeling and optimization in
MATLAB,” in Proceedings of the CACSD Conference, Taipei, Taiwan,
2004.

