A Convex Approximation For The Tertiary Control of
A Convex Approximation For The Tertiary Control of
A R T I C L E I N F O A B S T R A C T
Keywords: This article presents an optimization model for tertiary control in three-phase unbalanced microgrids. This model
Tertiary control considers 24h operation and includes renewable energy sources, energy storage devices, and grid code limita
Optimal power flow tions. Power flow equations are simplified using a recently developed approximation based on Wirtinger’s cal
Convex optimization
culus. The proposed model is evaluated both theoretically and practically. From the theoretical point of view, the
Wirtinger calculus
Linear power flow
model is suitable for tertiary control since it is convex; hence, global optimum, uniqueness of the solution, and
convergence of the interior point method are guaranteed. From the practical point of view, the model is simple
enough to be implemented in a small single-board computer with low time calculation. The latter is evaluated by
implementing the model in a Raspberry-Pi board with the CIGRE low voltage benchmark; the model is also
evaluated in the IEEE 123-nodes test system for power distribution networks.
1. Introduction TC is the highest level in the hierarchy for microgrids operation [4].
It defines the optimal operation point for the active and reactive power
1.1. Motivation in each distributed resource and how much energy the microgrid is
willing to trade with the primary grid to satisfy the power balance be
Modern power distribution systems include distributed resources tween the load and power generation [5].
like wind and solar generation as well as storage devices. These com The problem is closely related to the optimal power flow and the
ponents can be grouped, forming a microgrid with potential improve management of energy storage devices. The optimal power flow is a
ments in efficiency and reliability. However, to achieve these classic problem that has regained importance due to the challenges
improvements, a microgrid must be complemented with an optimization associated with introducing renewable energy and new advances in
algorithm called tertiary control, which will be referred to as TC in the convex optimization [6]. A modern approach to this problem is based on
rest of the paper [1]. conic approximations such as semidefinite programming and
An optimization model for TC requires to include constraints related second-order cone optimization (see [7] and the references therein for a
to renewable energies and energy storage devices and an accurate rep complete review of this subject). These relaxations transform the
resentation of the power flow equations. Besides, the model must be non-convex problem into a convex thereof with theoretical and practical
tailored for real implementation. Therefore, it is convenient to formulate advantages related to global optimal, uniqueness of the solution, and
a model that guarantees global optimum, uniqueness of the solution, and fast convergence rate [8]. Despite obvious theoretical advances, these
convergence of the algorithms. Convex optimization emerges as a suit algorithms are far from becoming a proper tertiary control in practical
able alternative in this context. Nevertheless, the power flow equations applications [9]. Computational time may be high, especially in semi
introduce non-convex constraints that require linearization, considering definite approximations, and its implementation may require solvers
a trade-off between precision and convexity [2]. On the other hand, the that allow conic programming [10]. In addition, the algorithms should
model must be simple enough to be implemented in a practical situation, be tailored to be implemented in low-cost single-board computers and
with a well-defined time frame for the entire process, and considering not in a desktop computer.
time calculations and latency of the communications [3].
https://doi.org/10.1016/j.epsr.2021.107423
Received 26 May 2020; Received in revised form 25 February 2021; Accepted 2 June 2021
Available online 20 June 2021
0378-7796/© 2021 Elsevier B.V. All rights reserved.
D.-A. Ramirez et al. Electric Power Systems Research 199 (2021) 107423
1.3. Contribution The paper is organized as follows: Section 2 shows the architecture of
the proposed TC. A general representation of three-phase microgrids and
This paper presents a model based on a linearization recently pro their main components, such as wind turbines, solar panels, and energy
posed in [20]. The contribution of the article can be summarized as storage devices, is presented in Section 3. Next, a general formulation of
follows: the power flow equations for grid-connected operation is presented in
Section 4. The proposed Wirtinger linearization is described in Section 5,
• An optimization model for 24h operation, considering unbalanced resulting in a convex model. The CIGRE microgrid benchmark results are
operation, realistic models of the loads and, renewable and storage presented in Section 6, followed by its software implementation. Finally,
devices. conclusions and recent references are presented.
• A convex approximation of the batteries losses and the exponential
models of loads (previous linearizations considered constant 2. Tertiary control in microgrids
impedance, current, and power, known as ZIP models and did not
consider the non-linear model of the batteries). Microgrids are usually operated using a hierarchical control that
• A static reserve model that allows the transition from grid-connected emulates the automatic generation control of conventional power sys
to island operation. tems. This hierarchy consists of three controls known as primary, sec
• An implementation in a small single-board computer (a Raspberry ondary, and tertiary control. Primary control aims to synchronize and
Pi) that demonstrates the proposed algorithm can be implemented in stabilize the microgrid, while secondary control aims to achieve nominal
practice at a low cost. frequency; finally, tertiary control aims to optimize the operation.
Therefore, TC operates in a stationary or quasi-stationary state.
Table 1 shows a comparison with recent references, considering the A typical architecture for TC is shown in Figure 1. Renewable re
main aspects for TC in microgrids. • indicates an aspect that was fully sources and energy storage devices are integrated through power elec
considered in the reference, indicates an aspect that was partially tronics converters to control active and reactive power. However, this
considered, and indicates an aspect that was not considered in said control is limited by the converters’ capacity and the primary resource
reference.
2
D.-A. Ramirez et al. Electric Power Systems Research 199 (2021) 107423
Fig. 1. Integration of wind, solar and energy storage devices through power electronic converters, including TC.
availability (i.e., solar irradiance and wind speed). Besides, the state of
charge of the batteries (SOC) must be managed to minimize power loss
and/or reduce costs. Therefore, an optimization problem requires to be
executed by a central controller in real-time.
Real-time may means different things, according to the application.
For a primary control, real-time is an action executed in the order of
seconds or even milliseconds, whereas for the tertiary control, real-time
is in the order of minutes. The tertiary control is, therefore, a quasi-
dynamic model that works in an entire day.
Different types of communications technologies can be used in this
architecture, for example, WiFi or ZigBee [21]. In any case, delays or
latency must be considered; these delays include those associated with
the optimization model and those associated with the communications.
The maximum latency experienced by the ZigBee technology for a dis
tance of 50 m with 50-byte packets was 18 ms, according to [22]. Fig. 2. Hypergraph representation for line sections in microgrids
Therefore, the primary source of delay is the execution time of the
optimization model. Therefore, fast algorithms with convergence guar
anteed are required.
The central controller can be any device, such as a personal computer Circuit variables in each hyperbranch l ∈ E are represented by a 3 ×
or an industrial computer; however, it is advisable an embedded system 3 admittance matrix as given in (1).
dedicated explicitly for TC. This system must be small and reliable to be Il = Yl Vl (1)
placed in the point of common coupling, that is, the point where the
microgrid is electrically connected to the electric distribution system. These matrices can be grouped together in a block diagonal matrix YE
The optimization model requires to be accurate but straightforward that relates the vector of three-phase voltages with the vector of three-
enough to be implemented in this device. This is the main objective of phase currents, as given in (2).
the model presented in the next section.
IE = YE VE (2)
3. Modelling
where VE and IE are vectors where the first elements correspond to the
phase A, next the phase B and finally the phase C. An incidence matriz
3.1. Three-phase grid
A ∈ RH ×E is created for the hypergraph, where akl = 1 if the hyper
A three-phase microgrid is represented as a connected hypergraph G branch l ∈ E is in the direction k→m and akl = − 1 if it is in the direction
= {H , E }, where H represents the set of hypernodes and E ⊆N ×N m→k. The other entries of the matrix are zero. This matrix requires to be
represents the hyperbranches. Each hypernode and hyperbranch has increased in order to consider three phases in each hypernode. There
three components that represent phases {A, B, C} as depicted in Fig 2. fore, the following expressions are obtained:
Along this section and for the rest of the paper, matrices and vectors IH = (I3 ⊗ A)IE (3)
are represented in capital letter whereas entries of these matrices/vec
tors are represented in lower case letters. Unless otherwise specified, all VE = (I3 ⊗ A)⊤ VH (4)
variables are defined in the complex domain; x represents the complex
conjugate of x, and X⊤ is the conjugate transpose of X. Subscripts IH = (I3 ⊗ A)YE ((I3 ⊗ A))⊤ VH = YH VH (5)
represent node and/or time whereas superscripts represent labels of the
variables, if they are text, and, exponentiation if they are numeric. where I3 is the identity matrix of size 3 × 3, YH is the three-phase
3
D.-A. Ramirez et al. Electric Power Systems Research 199 (2021) 107423
admittance matrix, ⊗ is the Kronecker product and (⋅)⊤ represents the vkt αk
transpose conjugate. sload
kt = sZIP
kt ‖ ‖ (15)
vnom
The hypernode set is divided in two new sets H = {S , N } where S
represents the slack hypernode and N are the rest of hypernodes. A time series for sload
k is required in order to obtain the 24h operation.
Therefore, the model of the grid is given by the following matrix
equations: 3.3. Photovoltaic units
IS = YSS VS + YSN VN (6) The model that represents the power supplied by the photovoltaic
units (PVs) during a period is presented in (16)
IN = YNS VS + YNN VN (7)
psolar
kt ≤ ρk ψ t (16)
where
( ) where psolar
kt power that the photovoltaic generator can inject in the
YSS YSN
YH = (8) period t, ρk is the productivity coefficient associated to the solar panel,
YNS YNN
and ψ t corresponds to the irradiance measured in (W/m2 ), perpendic
Notice that S is size three since there are three slack nodes in the sys ular to the panel for the period t. The model requires a time series of ψ
tem, corresponding to each phase. The voltage VS is given by (9): for 24 h. Power electronic converters are allow to reduce their produc
⎛ ⎞ tion if required by the optimization model there in the inequality.
1
VS = v nom ⎝ − 2π /3j ⎠
e (9)
3.4. Wind turbine model
e2π/3j
Generally, a model for the generated wind power may be obtained
where vnom is the nominal voltage in per unit, measured in the point of
using a wind turbine profile obtained experimentally. In this case, the
point of common coupling. On the other hand, voltages VN are variables
proposed model represents an approximation of the active power sup
in the optimization model and thus, the current in each node of the grid
plied by the wind turbine; thus the wind power may be calculated based
is in function of these voltages
∑ ∑ on the wind speed and the wind turbine power coefficient as follows:
ik = ysk vs + ykm vm , ∀k ∈ N (10) ( )
⎧ nom wt 3 ⎫
s∈S m∈N
⎪
⎪ kp nom
, if 0 ≤ wt ≤ wnom
k ⎪
⎪
⎪
⎪ w k
⎪
⎪
⎪
⎪ ⎪
⎪
multiplying by vk an expression for the nodal powers is obtained as ⎪
⎪
⎪
⎪
⎪
⎪
⎨ ⎬
follows: wind
pkt ≤ (17)
nom nom max
∑ ∑ ⎪ p k , if w k ≤ w t ≤ w k ⎪
⎪ ⎪
skt = vkt ymk vmt + vkt ykm vmt , ∀k ∈ N (11) ⎪
⎪
⎪
⎪
⎪
⎪
⎪
⎪
⎪
⎪ ⎪
⎪
m∈S m∈N ⎪
⎩ ⎪
⎭
max
where vk represents the complex conjugate of vk and sk = pk +jqk is the 0, if wk ≤ wt
total apparent power in node k. A subscripts t was added to all variables
to indicate the time since the model is formulated for one day operation. where pwind
kt corresponds to the maximum power that the wind turbine
Each node may have different power injections such as wind and can deliver in the period of time t, the wind speed is a time variable
solar generation, energy storage and, loads. Therefore, the following described by wt , and pnom is the rated power that each of the wind tur
balance of power in each node is obtained: bines can inject to the system. wnom represents the rated wind speed at
which the turbines generate its rated power, and the maximum wind
skt = swind
kt + ssolar
kt + sbattery
kt − sload
kt (12) speed that the turbines tolerates is represented by wmax . The model re
quires a time series of the wind velocity during a period of time.
Total losses of the grid are calculated as given in (13).
ploss
(
= real VS⊤ t YSS VS t + 2VS⊤ t YSN VN t + VN⊤ t YNN VN t
)
(13) 3.5. Battery energy storage
t
Further, the power supplied by the main grid to the microgrid is The following equation proposes a simplified dynamic model of the
defined as follows battery energy storage k at each time t.
( )
pgrid
t = real((YSS VS t + YSN VN t )⊤ VS t ) (14) ekt = ekt− 1 + pchar disch
kt − pkt Δt (18)
This variable defines the interchange of power with the main grid,
where pchar is the charging power, pdisch is the power at discharge, and ekt
and hence, it is essential for the optimization model. kt kt
is the energy stored by the batteries, considering a positive value if it
injects power to the microgrid and a negative value for the charging
mode. Δt is the time discretization (usually 1h). A quadratic model of the
3.2. Three-phase exponential load model
losses in the battery and the converter is proposed, considering effi
ciencies of charge and discharge as follows:
Three-phase loads are represented by a general model that considers
constant power, constant current, and constant impedance [23]. This ( char )2
nchar
kt = achar
k pkt + bchar char
k pkt + ck
char
(19)
model can be described in terms of a constant α ∈ {0, 1, 2} as given in
(15) where 0 corresponds to constant power, 1 to constant current and 2 ( disch )2
ndisch = adisch pkt + bdisch pdisch + cdisch (20)
to constant impedance. Fractional values of αk are also allowed in the kt k k kt k
model.
4
D.-A. Ramirez et al. Electric Power Systems Research 199 (2021) 107423
this model is taken from data-sheets of batteries (see for example [24]). 4. Optimization problem
It is important to remark that acharge and adischarge are always positive.
Then, the active power delivered by the battery energy storage is given The proposed power flow requires a time series for wind speed, solar
by the following equations: irradiance, and power demand. The optimization model search for
( ) optimal use of energy storage devices as given below, where all variables
pchar disch
kt − pkt = real sbattery (21) depend on the time, and therefore, the subindex t is omitted in most of
the equations.
The model seeks to minimize the costs ct of the energy supplied by
3.6. Power and voltage limits
the primary grid. The model of each component and the grid itself are
also considered. For the sake of completeness, the entire model is pre
Photovoltaic units, wind turbines, and battery energy storage devices
sented in Table 2 including the type of equation (notice that quadratic
are integrated into the microgrid through power electronic converters,
equality constraints are also non-convex).
as depicted in Fig 1. These converters can generate or consume reactive
The model presented in Table 2 is called, in this paper, as non-convex
power on the assumption that the current and apparent power is below
tertiary control model (hereafter called NC-TC Model). This model
its maximum.
contains some complex variables (e.g sk , vk and vm ) which simplifies its
Therefore, the apparent power is limited by the following constrain:
representation. However, it is important to remark that this is only a
‖ sdevice
k ‖≤ sdevice
max , ∀device ∈ {wind, solar, battery} (22) representation since an optimization model requires to be defined in an
ordered set (for example, the set Rn ). Therefore, each equality constraint
Notice that this constraint is convex. with complex variables must be separated into real and imaginary parts.
On the other hand, voltage limits are considered by the following This complex representation allows a simple formulation of the linear
constraint: izations using Wirtinger’s calculus. The resulting linearizations can be
written directly in complex form, in packages such as cvxpy as explained
‖ vk − vnom ‖≤ δvnom (23)
in the next section.
where δ is the maximum voltage deviation according to the grid code.
4.1. Convex identification
3.7. Static reserve NC-TC model is non-linear and non-convex, and therefore, a convex
approximation is required. However, some parts of the model are
A static reserve is proposed in the model. This new concept is strongly already convex, for instance, affine equations. Power loss, grid power,
related to the energy stored by the batteries. It is applied because it and loss in the battery energy storage devices are all quadratic equality
needs to keep the system secure and in equilibrium when the system constraints. These equations define, in principle, non-convex sets.
changes from grid-connected to island operation. The static reserve However, they can be transformed into convex sets by replacing equality
guarantees a time of safe operation in which the demand of the micro for inequality constraints and noticing that these quadratic forms are all
grid can be supplied by the available generation and energy stored by convex. This approximation is suitable since the objective function in
the batteries. Taking this criterion into account, a deficit dt of power cludes minimizing pgrid and hence, the inequality gap tends to be
provided by generators is defined as a function of the demand and the minimized.
power injected by the slack node to the microgrid as given in (24), The only remaining non-convex constraints are (11) and (15). These
∑ constraints will be linearized by using Wirtinger calculus as presented in
dt = sload
k − pgrid
t (24) the next subsection.
k∈N
Therefore, the energy stored by the batteries is limited by the 5. Convex model
following constraints:
∑ 5.1. Wirtinger’s linearization
ekt ≥ real(dt ) (25)
In general, an equality constraint is non-convex unless it is an affine
battery
k∈N
5
D.-A. Ramirez et al. Electric Power Systems Research 199 (2021) 107423
̂
∂f ̂
∂f
f ≈ f (z0 ) + Δz + Δz (28) SN t = K⋅V N t + L⋅VN t + U (38)
∂z ∂z
Precision of this approximation was evaluated in [20], where results
For example, a function f = vk vm can be linearized around a point vk0 ,
demonstrated errors less than 1 × 10− 3 in voltages. It is important to
vm0 as follows:
remark that the linearization is defined in the complex domain, there
( )
fore, vk0 must consider the phase (i.e., e0j for phase A, e− 2π/3j for phase B
f vk , vm = vk vm (29)
and e2π/3j for phase C).
≈ vk0 vm0 + vm0 Δvk + vk0 Δvm (30) 5.3. Wirtinger’s linearization for exponential loads
( )
= vk0 vm0 + vm0 vk − vk0 + Equation (15) can be also linearized using Wirtinger’s calculus. The
(31)
non-linear term in this expression is given by (39).
vk0 (vm − vm0 )
( )α2
= vm0 vk + vk0 vm − vk0 vm0 (32) ‖ vk ‖α = vk vk (39)
Notice that Wirtinger’s derivatives fulfill the basic properties for dif Linearizing around vk0 the following expression is obtained
ferentiation known from real-valued analysis concerning the linearity,
( )α2 ( )α2 ̂
product rule and composition of functions. ∂ ‖ vk ‖α ̂
∂ ‖ vk ‖α
vk vk ≈ vk0 vk0 + Δvk + Δvk
∂vk ∂vk
(40)
( )α2− 1 ( )
5.2. Wirtinger’s Linearization of the power flow equations ( )α α
= vk0 v*k0 2 + vk0 vk0 vk0 Δvk + vk0 Δvk
2
The linearization presented in (32) can be used for linearizing (11),
as follows: Considering that the voltages of the system are near of the nominal
value, a good point of linearization is vk0 = vnom ejϕ as the complex
∑ ∑ ( )
skt = vkt ymk vmt + ykm vm0 vk + vk0 vm − vk0 vm0 (33) nominal voltage, where ϕ is 0, − 2π/3 or 2π/3 according to the phase.
m∈S m∈N Therefore, the nonlinearity of the ZIP load model is represented linearly
by the following expression:
After simple algebraic manipulations the following matrix repre
sentation is obtained: ( )α2
vk vk ≈ (vnom )α +
SN t =(diag(Y
( )S ⋅VS t )⋅V N t + diag(YN ⋅V
(N 0 )⋅V N t +
) ( ( )) (41)
(34) α nom α− 2 nom − jϕ ( )
diag V N 0 ⋅YN )⋅VN t − diag(VN 0 )⋅ YN ⋅V N 0 (v ) v e vk − vnom ejϕ + vnom ejϕ vk − vnom e− jϕ
2
Equation (34) defines an affine space which constitutes an approxima Then, simplifying (41), the following equation is obtained:
tion of the power flow. The following matrices are defined in order to ( )α2
simplify the nomenclature:
vk vk = (vnom )α +
K = diag(YS VS ) + diag(YN ⋅VN 0 ) (35) ( ) (42)
α
( ) (vnom )α− 2
vnom e− jϕ vk + vnom ejϕ vk − 2(vnom )2
2
L = diag V N 0 ⋅YN (36)
Therefore, (15) is replaced by the following affine equation:
( ) ( )
U = − diag(VN 0 )⋅ YN ⋅V N 0 (37) SNloadt = SNZIPt ∘ M + HVN t + TV N t (43)
Therefore, Constraint (11) is transformed into the following affine where ∘ represents the Hadamard product and M, H, T are constant
equation: vectors given by
6
D.-A. Ramirez et al. Electric Power Systems Research 199 (2021) 107423
6. Results
7
D.-A. Ramirez et al. Electric Power Systems Research 199 (2021) 107423
The exponential model described in subsection 3.2 was used for the
loads, with values of α given in Table 4. The system was analyzed for
operation in 24h with intervals of 1h; a variable energy cost ct was
considered as shown in Figure 4.
Two main cases were analyzed, namely:
Case 1 (surplus sale): in this case, the slack node can inject and
receive power from the microgrid; the
optimization model decides the purchase
or sale of energy, according to market
prices and the generation and demand
conditions of the microgrid.
Case 2 (without surplus sale): in this case, the slack node is limited to Fig. 6. Optimal solar generation () and available solar generation () for the
only supply power, i.e., the microgrid Case 1. The algorithm always takes the maximum solar generation.
cannot inject power to the main grid.
This type of limitation is due to some
grid codes that are restrictive in terms of
surplus sales.
The behavior of the TC for this case is shown in Fig 5, where pgrid is
the power taken or sold to the main grid, and pER represents the power
provided by the photovoltaic units, wind turbines, and batteries. As a
result, the microgrid takes power from the main grid in periods where
the renewable generation and batteries can not satisfy the load or when
the energy has a low price. Eventually, the microgrid sold power to the
system when the generator can supply the load, and there is an excess of
generation.
The photovoltaic generation uses all its available resources, injecting Fig. 7. Optimal wind generation () and available wind generation () for Case 1.
the maximum amount of power that the irradiance profile allows in all The algorithm always take the maximum available power.
the periods. The behavior of the photovoltaics units is represented in Fig
6.
Wind turbines have the same behavior as photovoltaic sources, as
shown in Fig 7. These use the available wind speed profile, giving a
result where the turbine can provide the maximum power in each period
according to the wind speed forecast.
Finally, and considering an initial batteries SOC of 50%, these have a
response to the load, as shown in Fig 8.
Notice that all batteries have similar behavior; they charge
completely in periods of low prices, low demand and/or high genera
tion, to discharge in periods with high demand when the prices are
higher.
The power provided by the slack node is limited in all the periods of
Fig. 8. Energy stored in each battery for Case 1, considering the SOC of the
the tertiary control. This constraint is represented as follows: batteries between 30% and 100% of the batteries energy.
pgrid
t ≥0 (48)
Fig. 5. Tertiary control the slack node (), load demand () and power PER () for Fig. 9. Energy exchange with the main grid (), total generation () and total
the Case 1. demand () for Case 2.
8
D.-A. Ramirez et al. Electric Power Systems Research 199 (2021) 107423
Table 5
Performance comparison between different solvers.
Case Solver Execution Iterations Operative cost Status
time (s) ($)
the balance in periods that the load power overtakes the generation, as
shown in Fig 12; in these periods, the tertiary control requires to mini
mize the purchase of energy to the main grid and reduce costs in the
peak of demand.
9
D.-A. Ramirez et al. Electric Power Systems Research 199 (2021) 107423
7. Conclusions
10
D.-A. Ramirez et al. Electric Power Systems Research 199 (2021) 107423
11