Next Article in Journal
Effect of the Substrate to Inoculum Ratios on the Kinetics of Biogas Production during the Mesophilic Anaerobic Digestion of Food Waste
Next Article in Special Issue
The Importance of Introducing Zero- and Low-Carbon Solutions in Urban Bus Transport
Previous Article in Journal
State of the Art of Technologies in Adaptive Dynamic Building Envelopes (ADBEs)
Previous Article in Special Issue
Social Capital in Energy Enterprises: Poland’s Case
Order Article Reprints
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:

Microgrid Operation Optimization Using Hybrid System Modeling and Switched Model Predictive Control

Department of Automatic Control and Robotics, Faculty of Electrical Engineering, West Pomeranian University of Technology in Szczecin, Sikorskiego 37, 70-313 Szczecin, Poland
Author to whom correspondence should be addressed.
Energies 2022, 15(3), 833;
Received: 4 January 2022 / Revised: 15 January 2022 / Accepted: 19 January 2022 / Published: 24 January 2022


Optimization of economic aspects of microgrid operation in both grid-connected and islanded mode leads to contradictive definitions of optimality for both modes. There is no general agreement on how to cope with this duality. To address this issue, as well as modern energy market requirements and a better renewable energy utilization necessity in the case of large facilities, a comprehensive control solution utilizing the appropriate model is needed. In response, the authors propose a hybrid microgrid model covering fundamental features and designed to work in conjunction with two switched receding horizon control laws. A relevant controller is chosen according to the current microgrid operation mode and its cost function tailored to specific demands of the islanded or grid-connected operation. Performed research led to a new switched hybrid model predictive control approach focused on microgrid economic optimization. This approach utilizes an appropriate hybrid microgrid model also contributed by the authors. The introduced solution turned out to be effective in overall energy cost reduction in the case of large commercial facilities, regardless of grid-connection and renewable generation scenarios. Furthermore, it also provides satisfactory renewable energy and storage capabilities utilization in changing grid connection conditions.

1. Introduction

Recent policy for climate and energy leans towards reducing greenhouse gas emissions and reaching energy systems without a significant carbon footprint. Electricity generation and consumption are at the forefront of this change. Therefore, currently used distribution and transmission grids will have to inevitably meet the above-mentioned requirements and a key solution in achieving carbon-neutral smart grids seem to be wide usage of microgrid solutions [1]. To reach that neutrality, a vast amount of renewable energy sources is vital and transition to such means of energy production is already taking place. Unfortunately, as pinpointed in [2], the adoption of renewable energy sources pose various challenges arising from user demands and fluctuate profiles of renewable energy generation far different from traditional means of energy generation. The structural solution to those new challenges is splitting the electrical network into smaller units based on distributed resources. Every smaller segment, the so-called microgrid, manages the local loads, generation and is equipped with storage capabilities. Moreover, it possesses means of connecting to and disconnecting from other segments, as well as can exchange energy with them. This approach significantly improves possibilities of remedying the instability of renewable sources and allows for fuller utilization of available renewable energy. In addition, small independent networks capable of island-mode operation tend to be incomparably more reliable in terms of continuity of supply and, with appropriate control strategies, offer economical benefits not only in remote regions.
According to [3], when considering complex microgrid control solutions, hierarchical control is mainly selected. Such systems consist of three distinguishable levels. Primary control stabilizes system frequency and voltage in response to rapid load changes, thus operating on the smallest timescale. Secondary control focuses on nullifying grid parameters deviations in steady-state and synchronizing with the public grid after the transition to grid-connected operation. Lastly, tertiary control is responsible for power flow control between microgrid elements or between microgrid clusters and upstream, public grid. Additionally, it introduces further functionalities in form of large-scale planning or economic optimization. As reported in [4], microgrid management is often associated with optimal control or optimization. Such optimization may concern economic, environmental, or technical objectives and optimal operation can be achieved using various techniques. Frequently used approaches include meta-heuristic or heuristic methods, stochastic and robust methods, Model Predictive Control in various forms, linear, dynamic, and nonlinear programming, as well as artificial intelligence.
Single and multi-objective optimization methods based on heuristic algorithms such as particle swarm or firefly optimization are a widespread choice. Some of the usage cases include cost and sizing optimization with fossil fuel share reduction in energy generation [5], microgrid load dispatch optimization [6] and for optimization of energy production cost in a microgrid [7]. Meta-heuristics are also used in combination with other techniques such as mixed-integer linear programming [8] or artificial neural networks [9]. On the other hand, artificial neural networks can adapt to uncertainties and are applicable when the exact model of a system is not available [10]. Exemplary applications include optimal energy scheduling [11] and storage system management [12]. It is worth noting that, according to [10], artificial neural networks are more commonly used in primary and secondary control than on the tertiary level. An exemplary solution utilizing a fuzzy-logic decision system in a multi-objective optimization problem can be found in [13]. Due to uncertainties, such as energy demand and generation, robust and stochastic optimization and control algorithms are also applicable in microgrid management cases. Robust optimization focused on both economy and robustness is presented in [14]. An exemplary optimal stochastic energy management system can be found in [15] and a robust economic energy and reserve management system is derived in [16]. Lastly, different mathematical programming methods are widely used, including dynamic, mixed-integer, and nonlinear programming. Some of the usage cases include energy generation cost optimization [17] and demand-generation mismatch optimization [18]. Importantly, the latter two are often equated with hybrid and nonlinear Model Predictive Control. Given the focus of this paper, usage of Model Predictive Control and mixed-integer linear programming, especially in hybrid form, will be discussed in detail below.
The applicability of Model Predictive Control (MPC in short) on all microgrid control levels is one of its most significant advantages. As reported in [19,20], the popularity of MPC stems from the fact that the resulting control strategy, due to the direct use of the process model, respects all system interactions and constraints which are not that easy to capture using other control methods. Moreover, it provides constraints satisfaction, stability guarantee and is adequate in application to multi-variable processes. Going back to the microgrid world, it is clear that any microgrid consists of a substantial amount of interacting elements, sometimes in an unintuitive manner, and controllers must operate in a significantly constrained environment. Interestingly, various phenomenons occurring in microgrid exhibit hybrid behavior, therefore building microgrid hybrid models is not overly complicated, especially in the economical scope. Additionally, receding horizon control is highly compatible with hybrid systems and such a combination is widely used. In [21], a hybrid model is used for economical optimization to include as much detail as possible and conventional MPC is used in form of a single mixed-integer linear programming (MILP) problem among other methods. The scope of research is focused on grid-connected mode and islanded operation is not considered. A Single Hybrid MPC (HMPC) solution using Mixed Logical Dynamical (MLD in short) framework in conjunction with a highly efficient MILP solver is presented in [22]. The scope of modeling focuses on economic and dynamic modeling of microgrid components including varying energy costs taken into account during optimization but no demand-side management. The exact solution is dedicated to the Brazilian energy market. In turn, the authors of [23] aim to design a management system dedicated to smart house systems. A hybrid model of its electrical and thermal system is derived, HMPC for on-grid operation proposed and solved using MILP solver. Importantly, a time-varying energy price is also introduced and no demand-side management is considered. As can be seen, the usage of mixed-integer linear programming is very wide, mainly because of highly accessible and efficient solvers, as well as simulation environments equipped with toolboxes connecting solvers and hybrid modeling tools. The synergy between microgrid modeled using discrete hybrid automata described in HYSDEL language and resulting MILP solved using CPLEX solver is precisely described in [24] where authors propose a hybrid optimization model for management of microgrid featuring automatic grid connection. A similar approach is presented in [25]. The study presents a hybrid model predictive control solution to optimal economic energy management of microgrid with hydrogen-based storage. Applied control scheme employs single Lyapunov-based HMPC using microgrid model in discrete hybrid automata form converted to MLD representation. Demand-side management is not considered and emphasis is put on grid-connected operation. The solution includes optimal dispatch and load sharing controllers. Naturally, there are other usable optimization approaches, without the introduction of receding control strategies in form of MPC. The authors of [26] use particle swarm optimization with the aim of minimizing the operation cost of a microgrid and improving photoelectric consumption by means of energy demand management. The algorithm is also solving a single MILP problem. Varying energy price is used but the microgrid remains connected to the public grid.
Considering the wide range of MILP applications and available tools authors of this paper choose to develop a novel HMPC-based control solution covering separate optimization of both on-grid and off-grid operation. To clarify, when dealing with microgrid switching between on-grid and off-grid operation mode, the control system must achieve an optimal solution regardless of the current mode. However, optimal control for each of those modes should be reached using different criteria resulting in slightly different optimization problems but still using the same microgrid model. That said, derivation of compatible microgrid hybrid model was also needed. Moreover, such a model should also cover demand-side management and the presence of energy-tariff with changing energy price.
A novel control concept utilizing switched hybrid MPC applied to economically optimize microgrid operation is the main contribution of this paper. Additionally, a compatible hybrid microgrid model in MLD form featuring demand-side management, varying energy price, and operation in both grid-connected and islanded mode is also contributed.

2. Economically Oriented Microgrid Hybrid Model

To date, various methods have been applied to model different aspects of microgrid operation. The general use of hybrid modeling is a well-established approach to capturing phenomenons occurring in a microgrid, understood as a dynamical system. Those phenomenons tend to be nonlinear or highly complicated and, what follows, problematic to directly model. This also entails high computational cost which is vital for model predictive control-oriented applications. Segmenting complex relationships into relatively simple pieces and switching them depending on certain conditions proves very useful, especially in the case of microgrids. Multiple distinguishable microgrid components are naturally operating in a hybrid manner, for example, energy storage is either discharged or charged, depending on energy demand and supply balance. The authors decided on employing a hybrid microgrid model in the mixed logical dynamical form given reduced computational burden and high compatibility with phenomenons occurring in a microgrid, as well as with model predictive control. This section introduces a hybrid model built to work in conjunction with the proposed switched MPC control approach.

2.1. Energy Storage Description

The derived energy storage model is based on the simple principle of energy balance sourced from [21] and expanded. Variable E s t ( k + 1 ) represents energy aggregated in energy storage at time k + 1 , which depends on current storage level E s t ( k ) , constant self-discharge E s d , energy discharged from storage 1 η d E and amount of energy charging the storage η c E + . Charging and discharging efficiency is taken into account and labelled as η c and η d , respectively. Equation (1) describes the aforementioned relationship:
E s t ( k + 1 ) = E s t ( k ) + η c E + ( k ) 1 η d E ( k ) E s d
Energy charging the storage unit is described as previous energy balance in microgrid E b ( k 1 ) multiplied by boolean δ b which indicates positive or negative E b ( k 1 ) as follows:
E + ( k ) = E b ( k 1 ) for δ b ( k ) ( z ex ( k ) ) 0 otherwise
where z e x ( k ) denotes auxiliary variable defined as a product of the real variable E b ( k 1 ) and the logical condition δ b . It is equivalent to the expression z e x ( k ) = δ b ( k ) E b ( k 1 ) . A similar notation will be used throughout the whole model description. Charging delay is added to take into account that storage charging or discharging is not instant. Furthermore, energy discharged is expressed as previous energy balance E b ( k 1 ) minus already explained E + ( k ) :
E ( k ) = E b ( k 1 ) E + ( k )
Substitution of E + ( k ) and E ( k ) to Equation (1) reveals that δ b is used to nullify or include certain expressions depending on energy balance. This means that, given negative E b ( k ) , auxiliary binary variable δ b ( k ) becomes zero and storage is discharged with efficiency η d . On the other hand, in the case of non-negative energy balance, hence δ b ( k ) equal one, storage is charged with the efficiency η c . Finally, self-discharge constant E s d consists of energy spent to cool storage units labeled as E a c and energy lost due to natural self-discharge E n d :
E s d = E a c + E n d
Appropriate E a c and E n d values are adopted based on informations from [27].

2.2. Transactions with a Public Energy Network

Other essential components of a microgrid model are energy transactions with a public energy network. Considering an economically oriented approach, those can be understood as costs and gains associated with buying and selling energy, respectively. At this point, it should be emphasized that authors assume energy purchase prices change over time according to the energy tariff given in [28], which is currently available in Poland. Figure 1 shows the resulting energy price chart.
As can be seen from Figure 1, three pricing periods can be distinguished: standard price f f l a t , morning peak price f m p and evening peak price f e p . Introduction of a simple timer t t i m is necessary for the model to correctly switch between aforementioned prices. Time aggregated in t t i m is increased at every time step k by sampling time T s and reset, by subtracting 24, if boolean δ t i m ( k ) indicates that t t i m ( k ) is equal or greater than 24. This relationship is specified by:
t t i m ( k + 1 ) = t t i m ( k ) + T s z t i m ( k )
t t i m ( k ) 24 δ t i m ( k ) = 1
z t i m ( k ) = 24 δ t i m ( k )
That simple timer made switching between energy prices according to the current time possible. However, actual energy price switching is based on inequalities and binary auxiliary variables δ t 1 ( k ) , δ t 2 ( k ) , δ t 3 ( k ) and δ t 4 ( k ) becoming true when certain time has been exceeded. Variables t m p s and t m p e indicate starting and ending time of morning peak, respectively. Similarly, t e p s and t e p e correspond with the evening peak as follows:
t t i m ( k ) t m p s δ t 1 ( k ) = 1
t t i m ( k ) t e p e δ t 2 ( k ) = 1
t t i m ( k ) t e p s δ t 3 ( k ) = 1
t t i m ( k ) t m p e δ t 4 ( k ) = 1
In addition, the amount of energy exchanged with the public grid is denoted by E e x and related auxiliary variable δ e x , describing its sign, defined in the following way:
E e x ( k ) 0 δ e x ( k ) = 1
Then, using timing taken from Equation (9) through Equation (11) and pricing according to Figure 1, variability of base energy cost c c ( k ) can be expressed as:
c c ( k ) = E e x ( k ) f m p for δ t 1 ( k ) δ t 4 ( k ) δ ex ( k ) δ cp ( z mp ( k ) ) E e x ( k ) f e p for δ t 2 ( k ) δ t 3 ( k ) δ ex ( k ) δ cp ( z ep ( k ) ) E e x ( k ) f f l a t for ( δ t 1 ( k ) δ t 4 ( k ) ) ( δ t 2 ( k ) δ t 3 ( k ) ) δ ex ( k ) δ cp ( z flat ( k ) ) 0 otherwise
At last, the total energy purchase cost is defined as an aggregate of various fees, multiplied by the amount of energy exchanged with the public grid E e x ( k ) . Besides, according to [28], total energy cost c b ( k ) consists of switched base energy cost c c ( k ) , co-generation fee f c g , renewable energy fee f r e s , quality fee f q and switched power cost c p ( k ) further associated with the power fee f p , hence:
c b ( k ) = E e x ( k ) ( f c g + f r e s + f q ) + c c ( k ) + c p ( k )
with c p ( k ) defined as:
c p ( k ) = E e x ( k ) f p for δ t 1 ( k ) δ t 2 ( k ) δ ex ( k ) δ cp ( z p ( k ) ) 0 otherwise
Note that binary variable δ c p is associated with the grid connection status. Consequently, when in on-grid mode, δ c p equals one and in off-grid mode, its value changes to zero.
On the contrary, profit from selling excessive energy c s ( k ) is described by significantly simpler Equation (16). Given negative E e x ( k ) indicated by δ e x ( k ) equal to zero and active connection with public grid due to δ c p ( k ) = 1 , energy is sold at price f s e l l . If at least one of those conditions is not met, the microgrid is not connected to public grid or is buying the energy, therefore c s ( k ) is set to zero.
c s ( k ) = E e x ( k ) f s e l l for δ ex ( k ) δ cp ( k ) ( z s ( k ) ) 0 otherwise
As a result, profit c s ( k ) equals the amount of sold energy multiplied by the constant energy selling price. Appropriate energy selling price is taken from [29] and converted to euros.

2.3. Critical and Non-Critical Energy Demand

The aforementioned microgrid energy balance takes into account two main load sources. Both critical E c ( k ) and non-critical E n ( k ) loads are given as sum of various lesser loads:
E c ( k ) = i = 1 n E c i ( k )
E n ( k ) = i = 1 n E n i ( k )
Due to the fact that non-critical loads are also controllable, it is necessary to introduce a demand reduction coefficient β ( k ) . This also poses a problem because β ( k ) is considered as an input and disturbance E n ( k ) is treated as a state variable. By definition, every equation forming part of a mixed logical dynamical model must be affine and hence multiplication and division of inputs, outputs, and state variables are not permitted. In other words, it has become necessary to approximate the product of controllable loads summary demand E n ( k ) and demand reduction coefficient β ( k ) . The main idea is to restrict the range of values of β ( k ) to predefined, fixed values of β a p x by checking in what range β lies at time k, store the results of performed checks in binary variables δ b 1 ( k ) δ b 6 ( k ) defined as follows:
β ( k ) β a p x 1 δ b 1 ( k ) = 1
β ( k ) β a p x 2 δ b 2 ( k ) = 1
β ( k ) β a p x 3 δ b 3 ( k ) = 1
β ( k ) β a p x 4 δ b 4 ( k ) = 1
β ( k ) β a p x 5 δ b 5 ( k ) = 1
β ( k ) β a p x 6 δ b 6 ( k ) = 1
and round original β ( k ) down to predefined values of β a p x 1 β a p x 6 in accordance with the following rules:
E n a p x ( k ) = E n ( k ) β a p x 1 for δ b 1 ( k ) δ b 2 ( k ) ( z apx 1 ( k ) ) E n ( k ) β a p x 2 for δ b 2 ( k ) δ b 3 ( k ) ( z apx 2 ( k ) ) E n ( k ) β a p x 3 for δ b 3 ( k ) δ b 4 ( k ) ( z apx 3 ( k ) ) E n ( k ) β a p x 4 for δ b 4 ( k ) δ b 5 ( k ) ( z apx 4 ( k ) ) E n ( k ) β a p x 5 for δ b 5 ( k ) δ b 6 ( k ) ( z apx 5 ( k ) ) E n ( k ) β a p x 6 for δ b 6 ( k ) ( z apx 6 ( k ) )
The resulting expressions are affine and further applicable to the energy balance equation. Figure 2 illustrates the methodology set out above through a simple example.

2.4. Power Generator and Energy Balance in Microgrid

It was decided that there would be a deadband on power generator power to mitigate inconsiderable power values resulting in unnecessary generator activation. Therefore, generator power P g ( k ) is checked if lower than the deadband P d b and the result is stored in δ d b ( k ) . In case of the power demanded from the generator at time k being less than or equal to P d b , boolean δ d b ( k ) is set to zero as set out below:
P g ( k ) P d b δ d b ( k ) = 1
Moreover, the usage of a power generator bears some costs which cannot be omitted. Overall generator operation cost c m g is composed of fuel cost approximated by means of expression z f a 1 ( k ) z f a 2 ( k ) and constant maintenance cost c m n t . The generator state is described using boolean δ g ( k ) , with zero indicating that it is not providing any power. As a result, c m g ( k ) is described as:
c m g ( k ) = z f a 1 ( k ) z f a 2 ( k ) + z m n t ( k ) z m n t ( k ) = c m n t δ g ( k )
It is worth noting that when generator power output lies under specified threshold P t r , checked through the following inequality:
P g ( k ) P t r δ t r ( k ) = 1
fuel cost is independent to P g and set using f c o n s t . Otherwise, linear approximation using coefficients f a , f b and fuel price f f d gets chosen. However, the partial fuel cost z f a 2 ( k ) is solely used to nullify the influence of f c o n s t on the fuel cost when above the threshold value. The aforementioned functionality is introduced using Equations (29) and (30).
z f a 1 ( k ) = f c o n s t f f d T s for δ tr ( k ) ( f a P g ( k ) + f b ) f f d T s otherwise
z f a 2 ( k ) = f c o n s t f f d T s for δ tr ( k ) δ g ( k ) 0 otherwise
Generator startup and shutdown is also to be penalized using already mentioned boolean generator status δ g ( k ) , with c s S D and c s S U being two cost coefficients, respectively, for shutdown and startup. Therefore, the resulting cost c s t ( k ) is defined as:
c s t ( k ) = c s S D ( δ g ( k ) δ g ( k 1 ) ) + c s S U ( δ g ( k ) δ g ( k 1 ) )
Finally, energy balance in microgrid E b at the time k is circumscribed as the sum of various demands and supplies resulting in Equation (32). The variable E R E S expresses energy provided by renewable sources, E e x 2 describes transactions with the public grid and excessive energy utilization in off-grid mode, z g represents energy provided by power generator including the deadband and delay to account for power generator reaction time, E c stands for summary critical energy demand and E n a p x expresses the energy demand of controllable loads with respect to demand-side management, hence:
E b ( k ) = E R E S ( k ) + E e x 2 ( k ) + z g ( k 1 ) E c ( k ) E n a p x ( k )
Note that z g , related to the generator, is delayed one step to account for its response time. In the interests of clarity and simplicity powers provided by generator P g and renewable sources P R E S are redefined to corresponding energies as follows:
E R E S ( k ) = P R E S ( k ) T s
z g ( k ) = P g ( k ) δ d b ( k ) T s
Furthermore, E e x 2 is in fact just redefined E e x with the difference that E e x 2 allows for excessive energy utilization in the off-grid mode which is irrelevant in terms of cost-oriented Equation (14). As shown in Equation (35), E e x 2 is not zeroed either in the on-grid mode to allow energy selling or when E e x is negative, to allow excessive energy utilization in the off-grid mode. This can be then summed up using the following expression:
E e x 2 ( k ) = E e x ( k ) for δ ex ( k ) δ cp ( k ) ( z ex 2 ( k ) ) 0 otherwise

2.5. State-Space Model in MLD Form

All equations introduced in previous subsections are converted to single HYSDEL script in accordance with [30] and compiled, resulting in a hybrid microgrid model in general mixed logical dynamical form with x ( k ) being system state vector, y ( k ) expressing output vector and u ( k ) corresponding to input vector:
x ( k + 1 ) = A x ( k ) + B 1 u ( k ) + B 2 δ ( k ) + B 3 z ( k ) + B 5
y ( k ) = C x ( k ) + D 1 u ( k ) + D 2 δ ( k ) + D 3 z ( k ) + D 5
E 2 δ ( k ) + E 3 z ( k ) E 4 x ( k ) + E 1 u ( k ) + E 5
with vectors of auxiliary variables δ ( k ) and z ( k ) defined as follows:
δ = [ δ e x δ b δ t i m δ t r δ d b δ t 1 δ t 2 δ t 3 δ t 4 δ b 1 δ b 2 δ b 3 δ b 4 δ b 5 δ b 6 ]
z = [ z e x z m p z e p z f l a t z s z p z e x 2 z a p x 1 z a p x 2 z a p x 3 z a p x 4 z a p x 5 z a p x 6 z t i m z f a 1 z f a 2 z m n t z g ]
and output, input, as well as state vectors given in the form of:
y ( k ) = c s t ( k ) c m g ( k ) c s ( k ) c b ( k ) S O C ( k ) β i n v ( k )
u ( k ) = E e x ( k ) P g ( k ) β ( k )
x ( k ) = E s t ( k ) P R E S ( k ) E n ( k ) E c ( k ) t t i m ( k ) E b ( k ) E b ( k 1 ) P g ( k ) P g ( k 1 ) δ g ( k ) δ g ( k 1 ) δ c p ( k )
Furthermore, two newly introduced output variables S O C ( k ) and β i n v ( k ) account for energy storage percentage state of charge and percentage controllable load demand reduction, respectively, and are defined as:
S O C ( k ) = 100 E s t ( k ) E m a x
β i n v ( k ) = 100 ( 1 β ( k ) )
with E m a x indicating storage capacity.
Importantly, the MLD state-space matrices are omitted due to large sizes but nonetheless, the method used in receiving them is well known and precisely described in [30,31].

3. Microgrid Control System Oriented towards Economic Optimization

To optimize the microgrid economical performance, adequate control strategy is needed. According to various studies including [1,2], model predictive control is one of the few methods capable of handling complex requirements in terms of control quality in a microgrid environment and at the same time is characterized by a high compatibility with complicated hybrid systems used to model microgrids. By using a novel, switched hybrid model predictive control approach authors are able to incorporate network connection tolerance in controller design.

3.1. Control System Concept with Switched Hybrid MPC

To accommodate different control objectives and slightly different perceiving of optimality in the on-grid and off-grid modes it is decided that the best approach to achieve optimal performance in terms of costs, but also relatively consistent storage energy level, is to use dual MPC switched according to connection status to the public power grid. This is done by having suboptimal control law u * ( k ) switch between u o f f * ( k ) and u o n * ( k ) under dictation of the connection status δ c p ( k ) . This can be then expressed as:
u ( k ) = u o f f * ( k ) for δ cp ( k ) u o n * ( k ) for δ cp ( k )
In addition, various delays are introduced into the control system structure to take into account the time needed for performing state and output measurements and also the amount of time required to calculate control signals. For this reason, at time k, both control laws are evaluated using measurements from timestep k 1 . Thanks to that approach, an online optimization solution is applicable due to the fact, that the optimization could take up to T s . Figure 3 illustrates the implemented control system structure.

3.2. Optimization Problem Formulation

The major element of the model predictive control algorithm is the cost function that is being minimized. As already mentioned, the authors opted for switched MPC, therefore two cost functions are introduced. Based on those functions, two optimization problems are formulated, the first being used when a microgrid is connected to the public grid and the second exclusively for the off-grid operation. The generalized cost function value depends on the weighted sum of input, output, and state vector elements using vector norms. The weight matrices are denoted as R for input vector u and Q for outputs y. Moreover, J also features reference values for output variables indicated by y r . Apart from cost function, the optimization problem involves various constraints, concerning energy storage unit, power generator and demand reduction. Storage energy level, rate of charge, rate of discharge, as well as generator power, are limited in values and rates of change marked with Δ . The energy exchanged with the public grid is constrained only in terms of values. As a result, optimization problem based on the aforementioned cost function J and solved in constrained solution space is defined as follows:
min u k , , u k + N J = k = 1 N R u k 1 + Q ( y k y r ) 1 subject to E s t m i n E s t k E s t m a x Δ E s t m i n E s t k E s t k 1 Δ E s t m a x 0 P g k P g m a x Δ P g m a x P g k P g k 1 Δ P g m a x β m i n β k β m a x Δ β m a x β k β k 1 Δ β m a x E e x m a x E e x k E e x m a x x 0 = x ( k ) u 0 = u ( k ) y 0 = y ( k )
with weight matrices and output reference values switched according to operation mode and defined as:
R = R o f f ( k ) for δ cp ( k ) R o n ( k ) for δ cp ( k )
Q = Q o f f ( k ) for δ cp ( k ) Q o n ( k ) for δ cp ( k )
y r = y r o f f ( k ) for δ cp ( k ) y r o n ( k ) for δ cp ( k )
It is also important to emphasize that Equation (36) through Equation (38) hold for each k and that x k denotes the prediction step instead of the time step. Initial prediction values x 0 , u 0 and y 0 equal state, input, and output values measured at time k for which optimization is performed.
According to Equation (46), one problem is solved at every time step k resulting in a series of N suboptimal control vectors u k , , u k + N from which only the first one is used and becomes u ( k + 1 ) . Optimization problems described above are synonymous with model predictive control. Therefore, three model predictive control laws are implemented in MATLAB using Multi-Parametric Toolbox 3.0 according to the guidelines from [32]. Two of them are included in the switched MPC and one is used for comparison purposes during testing in form of the non-switched MPC. To speed up control calculation, an efficient MILP solver from Gurobi Optimizer [33] is used.

4. Parameters and Testing Scenario

It is important to outline model and controllers parameters used during testing and to emphasize the chosen approach in terms of energy generation and demand scenarios. The aim was to use as much real-world data as possible, in order to prove the adequacy of the developed hybrid model and control solution.

4.1. Parameters and Constraints

Various parameters are introduced in expressions composing the hybrid model as well as in the process of optimization problem formulation. They are then collected in Table 1 and their values were chosen according to distinct sources. Values of β a p x 1 through β a p x 6 are selected assuming 50% maximal controllable load reduction and, by setting adequate β constraints β m a x and β m i n , a range of values between 100 and 50 percent with 10 percent maximal rate of change Δ β m a x is achieved. It is assumed that the maintenance cost c m n t equals EUR 1 per hour, the shutdown cost c s S D is the same as the price of one unit of fuel and startup cost c s S D is half the shutdown cost. The natural discharge E n d , the energy needed for storage cooling E a c , the efficiencies η c and η d as well as the maximal amount of energy charged Δ E s t m a x and discharged Δ E s t m i n over T s are sourced from [27] as well as the storage capacity E s t m a x . The minimal allowed level of energy in storage E s t m i n is selected keeping in mind that deep discharge is unacceptable. Parameters f a , f b and f c o n s t , related to fuel cost are calculated based on [34]. Generator maximum power P g m a x comes from the same source. Although T s may prove sufficient for the chosen generator to ramp up to full power, a much smaller additional ramp up constraint Δ P g m a x is selected to allow for smoother operation. The energy pricing, including various fees, is borrowed from [28] and converted to euros. The generator deadband P d b , fuel threshold P t r , required connection power E e x m a x , identical to the maximal amount of energy exchanged with public grid, sampling time T s and prediction horizon N were fine-tuned during preliminary testing.
On the other hand, matrices of weighting coefficients mentioned in Equation (47), as well as weighting matrices R s and Q s associated with single hybrid MPC used during simulation as a reference, have the following values:
R o n = 25 0 0 0 50 0 0 0 0.1 Q o n = 250 0 0 0 0 0 0 250 0 0 0 0 0 0 1000 0 0 0 0 0 0 2000 0 0 0 0 0 0 15 0 0 0 0 0 0 5 R o f f = 50 0 0 0 25 0 0 0 0.1 Q o f f = 250 0 0 0 0 0 0 250 0 0 0 0 0 0 100 0 0 0 0 0 0 1 0 0 0 0 0 0 15 0 0 0 0 0 0 1 R s = 25 0 0 0 50 0 0 0 0.1 Q s = 250 0 0 0 0 0 0 250 0 0 0 0 0 0 1000 0 0 0 0 0 0 2000 0 0 0 0 0 0 15 0 0 0 0 0 0 3
Note that matrices dedicated to different operation modes have slightly different values. Such diversity allows for different control policies depending on connection status. For example, R o n features a lower energy exchange penalty and much higher generator usage punishment compared to R o f f . Moreover, in the case of R o f f , those priorities are reversed, which is much needed in off-grid mode. On the other hand, values of Q s and R s should be viewed as a necessary compromise to accommodate for the lack of a switching mechanism. Given the fact, that on-grid mode poses more cost reduction opportunities, penalties expressed through both Q o n and Q s encourage the management system to sell more energy if possible and buy less of it from the public grid. At the same time, Q o f f and Q s allow for a greater extent of load shedding compared to Q o n . Similarly, three reference values vectors are specified:
y r o n = 0 0 10 0 90 0 y r o f f = 0 0 0 0 40 0 y r s = 0 0 10 0 65 0
All outputs except for c s and S O C are to be minimized in the on-grid scenario, hence their reference values are set to zeros, which nullifies the reference value. On the other hand, c s denotes income from energy selling, therefore it is to be maximized by means of setting very high desired income and therefore turning a resulting problem into income maximization. When it comes to S O C , the reference value is introduced to encourage storage unit charging with renewable energy but, at the same time, to leave a sufficient margin. There is no energy sales opportunity in off-grid mode therefore, reference vector y r o f f , aside from storage state of charge reference, differs only in c s reference value being changed to zero. Significantly lower target stored energy level allows to not overuse diesel generator. Values of y r s are similar to y r o n with one exception being the lower state of charge reference required to achieve acceptable storage utilization in both on-grid and off-grid mode.

4.2. Simulated Microgrid Configuration

The authors choose to analyse the performance of the proposed solution when applied to a large commercial facility with its own photovoltaic installation, power generator and energy storage. This is why the aggregated, total critical energy demand profile consists of various load profiles sourced from small and medium businesses as well as residential buildings, to imitate shops, workshops, public buildings, and lodging facilities connected to the considered microgrid. Figure 4 features the structure of the analysed microgrid.
What is more, basic controllable loads are also present in form of air conditioning, water heating, and decorative elements. The microgrid is connected to the public grid via the point of common coupling and energy can be exchanged in both directions. Fundamental information flow concerning the energy management system is also shown in Figure 4. Aside from energy supply and demand, information on the connection status, as well as, the storage state is delivered to the management algorithm, while the amount of energy exchanged with the public grid, generator power set-point, and degree of energy supply reduction is returned. The main optimization goal is to minimize operation cost, but it simultaneously takes into account some technical aspects such as generator and storage usage or continuity of energy supply. Still, the system is also intended to improve the use of renewable energy. Another point is that, in off-grid mode, microgrid is unable to exchange energy with the public grid but is able to utilize excessive energy. Nevertheless, such a surplus of energy is to be avoided. On the other hand, in on-grid mode, the microgrid can freely exchange energy with the public grid. It is also worth adding that switching from on-grid to off-grid mode can be also equated with a power outage in the public grid.

4.3. Energy Generation and Demand Scenarios

It is decided that the developed system will be tested using two solar power generation patterns, the first being a sunny day with nearly peak power and the second being a cloudy day with very changeable power output. By choosing such scenarios, the solution could be checked for economical benefits, storage level consistency, and solar energy utilisation in radically different renewable energy supply conditions. Both one-day scenarios are prepared using averaged data acquired from a solar plant located in Stargard in Poland. On the other hand, critical and non-critical demand profiles, already mentioned in the previous subsection, are prepared using end-user data sourced from [35]. Scenarios chosen for later use in the simulation are shown in Figure 5.
What is more, the total energy demand of controllable loads is fairly constant. However, critical demand is notably higher between the hours of 9:00 and 22:00.

4.4. Performed Tests and Their Methodology

Having all the necessary data, the authors opted for three-stage testing. Firstly, a basic comparison of switched HMPC performance during the sunny and the cloudy day is made. Naturally, to activate the control law switch, microgrid grid-connection mode changes during the simulation period. Such a simple method is chosen to assess how different generation scenarios affect performance in combined on-grid and off-grid operations.
Secondly, it was considered appropriate to compare the performance of the proposed approach against a standard, single, non-switched HMPC solution. Such conduct allows for a confrontation of switched MPC approach with non-switched one without additional factors and under the same conditions. As a result, the main part of the testing process is focused on evaluating the advantages and disadvantages of switched control applied to the specific case. It is mainly through the lens of economical performance but other factors, including technical aspects, are also analysed. Consequently, two types of tests have been performed at this stage:
  • comparison of both control strategies over 48-h long simulation period consisting of the sunny day followed by the cloudy day and with two connection mode switches
  • comparison of total operation cost for both approaches using aforementioned renewable energy supply scenario but with varying initial storage state of charge S O C ( 0 ) and time of connection mode switch from on-grid to off-grid t o f f .
The first routine allows for closer inspection of how individual variables change over time and how high are output values associated with economical performance. The second one is solely dedicated to total operation cost exploration in respect to a varying initial state of charge and mode-switch time. Notably, this routine consists of combined data collected from 49 individual, 48-h long, test runs. Therefore, each time, two parallel simulations were performed. Figure 6 illustrates how the tests concerning switched and non-switched HMPC were performed in MATLAB.
Following initial conditions were used during all three stages of testing:
x ( 0 ) = S O C ( 0 ) E s t m a x 0 0 0 0 0 0 0 0 0 0 1
u ( 0 ) = 0 0 100
The value of S O C ( 0 ) is constant for the first, as well as for the second test and equals 52%. For the purposes of the third routine, two sets are defined in the following way:
X = 30 40 50 60 70 80 90
S = 0 8 16 24 32 40 48
as well as their Cartesian product:
XS = X × S
The set X contains percentage S O C ( 0 ) values, and the set S contains connection mode switch times t o f f . The set XS contains all ordered pairs from sets X and S .
As a result, for each of the 49 pairs test runs are performed using every combination of initial states of charge S O C ( 0 ) and mode change times t o f f contained in the table XS . It is also worth adding that in this case, only one operation mode switch happens during the simulation and the microgrid always starts in on-grid mode.

5. Results

Having hybrid microgrid model, control laws, and all the parameters, as well as data, prepared, simulations are carried over. In order to properly analyse the results, measures of performance are introduced. Summary startup and shutdown, maintenance, and energy costs, as well as income from selling energy, are used to better understand simulation results. Moreover, average S O C and β are also analysed. All those values are presented in appropriate tables. Furthermore, corresponding figures containing storage state of charge, energy balance, and all system inputs are also provided. The comments concerning the first two testing routines are made based on information derived from relevant figure-table pairs. The last routine is discussed on the basis of the appropriate figure, as well as some additional numerical data.

5.1. Comparison of Microgrid Performance in Different Renewable Energy Generation Scenarios

The numerical results obtained from sunny and cloudy renewable energy generation scenarios analysis are summarised in Table 2, while Figure 7 compares storage state of charge, energy balance, and system inputs over the simulation horizon. It is apparent from the aforementioned table that the cloudy day turned out to be significantly more costly. For instance, C s t , C m g , and C b have, respectively, about 2.5, 2.5, and 2.2 times higher values for the case of the cloudy day in comparison to the case of the sunny day. Consequently, this leads to a 146% higher total operation cost. As Figure 7 shows, such a huge difference stems from the necessity of compensating for lacking energy supply in off-grid mode, mainly after 18:00, by means of the power generator. In contrast, higher SOC in the evening of the sunny day translates into a longer period without the need for energy generated from diesel fuel.
From the chart, it can be also seen that SOC in on-grid mode is kept relatively low in wait for renewable energy supply but when a significant amount of energy becomes available operation mode is changed. In both scenarios, storage is charged visibly over the level specified by the reference value, but in the case of the cloudy day, this process is much less significant. That explains why the average S O C ¯ during the cloudy day is 18% lower. Given the limited time in on-grid mode, there is no energy being sold regardless of the scenario, hence C s equals zero. Additionally, in Figure 7 there is a clear trend of reducing controllable load energy supply only when diesel generator is needed. It can be also seen from the aforementioned figure, that more fluctuations of energy balance ( E b ) occur in off-grid mode. Furthermore, around 14:00 during the sunny day, a significant amount of excess energy appears.
It is important to emphasize that the purpose of this test is to initially verify if chosen modeling and control approach is appropriate and combined lead to satisfactory results in one of the simpler scenarios. Summarizing, performed test exhibited that chosen switched control approach is capable of handling basic energy generation and grid-connection scenarios. It proves able to use the capacity of the storage to its advantage and to not overuse power generator although some excess energy occurred, which is not ideal.

5.2. Comparison of Microgrid Performance Using Switched and Non-Switched HMPC Control

Turning now to the second test, the developed switched HMPC approach is compared with standard, single hybrid MPC. The analysis is based on a 48-h long simulation including both the sunny and cloudy days, as well as two grid-connection mode transitions. The numerical data produced as a result are gathered in Table 3 and matching charts are presented in Figure 8. Firstly, as Table 3 shows, C m g and C b are higher for the case of single hybrid MPC by about 12% and 34%, respectively. This denotes that, although P g charts for both cases seem similar, single HMPC tend to use the generator to a slightly greater extent. What is more, switched HMPC tend to buy significantly less energy in the on-grid mode based on data contained in Figure 8. Besides, there is no excess energy at all in off-grid mode, regardless of the control approach and both control laws make the grid sell a substantial amount of energy.
Interestingly enough, as presented in Table 3, a single HMPC manages to achieve 67% greater income from energy sales compared to the competitive solution but its summary operation cost is higher by about 12%. This leads to the conclusion that overall energy exchange with the public grid is more efficient in the case of switched HMPC, especially considering identical C s t values and similar P g values over the whole simulation period. Another point is that switched solution also provides 8% higher average state of charge (calculated as percent relative difference). Figure 8 illustrates that both solutions exhibit similar trends in respect of SOC, although, considering E b and S O C ¯ , switched approach seem to provide a slightly more consistent storage energy level than the single MPC solution. This can prove important when considering the storage life cycle. Nevertheless, the single MPC provides 5% higher average β value even though it features a greater extent of load shedding penalization. Still, the share of the controllable load in overall energy demand is relatively small and it does not translate into significant gains in economical terms. Admittedly, the performed test shows that switched HMPC approach has a slight advantage over single HMPC control not just in terms of economical benefits.

5.3. Comparison of Switched and Non-Switched HMPC Control Performance in Various Connection Scenarios and with Varying Initial Storage State of Charge

The previous test shows the advantage of switched hybrid MPC on the example of a single scenario but it falls short in proving its superiority in a wider variety of circumstances. Therefore, to somehow address obvious concerns about the adequacy of the proposed solution third testing routine is introduced. Through preliminary testing, the initial state of charge S O C ( 0 ) and the time of the transition between on-grid and off-grid operation t o f f are selected as key factors with possibly the biggest impact on simulation results. Finally, as mentioned in the previous section, 49 simulations covering various combinations of S O C ( 0 ) and t o f f are conducted, and gathered data is used to create surfaces shown in Figure 9.
Although the third testing procedure is the most complicated one, conclusions based on the relation of both surfaces are rather simple. As it turns out, the quantity of time in different operation modes has the biggest impact on total microgrid operation cost, while the impact of the initial state of charge is rather marginal. The single most striking observation to emerge from overall cost comparison is the fact, that the cost-surfaces do not intersect and the surface related to switched hybrid MPC is located below the surface tied to the single HMPC, which in turn, proves that in all 49 cases, overall operation cost is lower when utilizing the novel solution proposed by the authors. The greater the share of off-grid operation, the more significant the gains become, which may seem obvious considering two oriented on specific mode cost functions as opposed to only one. Averaged total operation cost reduction amounts to 6.26% when using switched MPC with a maximal cost reduction of 11.23% and a minimal reduction of 3.12%, which proves the adequacy of the proposed method based on simulation data available to the authors.

6. Conclusions

Research presented in this paper led to the development of a microgrid economical optimization strategy based on switched hybrid model predictive control as well as a compatible microgrid hybrid model on the basis of which the receding horizon control algorithm operates. The performance of the proposed control scheme was analyzed through three-stage simulation testing using real solar generation data and real energy demand profiles. The study was intended to compare and contrast the level of performance gains offered by switched model predictive control compared to non-switched one. The introduced solution proved to be effective in changing grid connection conditions and renewable energy generation regardless of the grid-connection scenario. Its usage led to a 6% averaged total operation cost reduction in comparison with the single HMPC strategy. Another important point is that the greater the share of off-grid operation, the more significant the gains become. Besides, this profit is made mainly due to better renewable energy utilisation management. An obvious drawback is the lack of means of energy demand and production forecasting, which means optimization is performed assuming constant demand and production over the prediction horizon. This is not ideal but, given the fact that the system presented in this paper manages to work well without forecasting certain data, this approach can be deemed useful for simple systems. Nonetheless, implementing such functionalities could noticeably improve performance.
Despite needing minor amendments, the proposed solution can be used in microgrid management systems intended to cope with common energy supply interruptions or highly autonomous microgrids in remote regions. Due to generalized microgrid model formulation and commonly available and exchangeable tools, the proposed model and control scheme does not depend on specific equipment or software and should be applicable to any standard microgrid. Given the conceptual character of this study, the authors intend to supplement more functionalities through further research and address shortcomings found during testing. Future work suggests the implementation of advanced energy demand and supply forecasting capabilities, as well as more sophisticated demand-side management functionalities.

Author Contributions

Conceptualization, G.M. and P.O.; Formal analysis, G.M.; Investigation, G.M.; Methodology, G.M. and P.O.; Resources, P.O.; Software, G.M.; Supervision, P.O.; Validation, P.O.; Visualization, G.M.; Writing—original draft, G.M.; Writing—review and editing, P.O. All authors have read and agreed to the published version of the manuscript.


This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest.


  1. Garcia-Torres, F.; Zafra-Cabeza, A.; Silva, C.; Grieu, S.; Darure, T.; Estanqueiro, A. Model Predictive Control for Microgrid Functionalities: Review and Future Challenges. Energies 2021, 14, 1296. [Google Scholar] [CrossRef]
  2. Bordons, C.; Garcia-Torres, F.; Ridao, M.A. Model Predictive Control of Microgrids; Springer Nature: Cham, Switzerland, 2020. [Google Scholar] [CrossRef]
  3. Hu, J.; Shan, Y.; Guerrero, J.; Ioinovici, A.; Chan, K.; Rodriguez, J. Model predictive control of microgrids—An overview. Renew. Sustain. Energy Rev. 2020, 136, 110422. [Google Scholar] [CrossRef]
  4. Topa Gavilema, A.O.; Alvarez, J.D.; Torres Moreno, J.L.; Garcia, M.P. Towards Optimal Management in Microgrids: An Overview. Energies 2021, 14, 5202. [Google Scholar] [CrossRef]
  5. Ahmad, S.; Ullah, I.; Jamil, F.; Kim, D. Toward the Optimal Operation of Hybrid Renewable Energy Resources in Microgrids. Energies 2020, 13, 5482. [Google Scholar] [CrossRef]
  6. Zhang, X.; Wang, Z.; Lu, Z. Multi-objective load dispatch for microgrid with electric vehicles using modified gravitational search and particle swarm optimization algorithm. Appl. Energy 2022, 306, 118018. [Google Scholar] [CrossRef]
  7. Yang, Y.; Qiu, J.; Qin, Z. Multidimensional Firefly Algorithm for Solving Day-Ahead Scheduling Optimization in Microgrid. J. Electr. Eng. Technol. 2021, 16, 1755–1768. [Google Scholar] [CrossRef]
  8. Kim, R.K.; Glick, M.B.; Olson, K.R.; Kim, Y.S. MILP-PSO Combined Optimization Algorithm for an Islanded Microgrid Scheduling with Detailed Battery ESS Efficiency Model and Policy Considerations. Energies 2020, 13, 1898. [Google Scholar] [CrossRef][Green Version]
  9. Wang, L.; Xue, A. Equivalent Modeling of Microgrids Based on Optimized Broad Learning System. Energies 2021, 14, 7911. [Google Scholar] [CrossRef]
  10. Lopez-Garcia, T.B.; Coronado-Mendoza, A.; Domínguez-Navarro, J.A. Artificial neural networks in microgrids: A review. Eng. Appl. Artif. Intell. 2020, 95, 103894. [Google Scholar] [CrossRef]
  11. Abdolrasol, M.G.M.; Mohamed, R.; Hannan, M.A.; Al-Shetwi, A.Q.; Mansor, M.; Blaabjerg, F. Artificial Neural Network Based Particle Swarm Optimization for Microgrid Optimal Energy Scheduling. IEEE Trans. Power Electron. 2021, 36, 12151–12157. [Google Scholar] [CrossRef]
  12. Otani, T.; Tanabe, R.; Koyanagi, Y.; Iwamoto, S. Cooperative load frequency control of generator and battery using a recurrent neural network. In Proceedings of the TENCON 2017—2017 IEEE Region 10 Conference, Penang, Malaysia, 5–8 November 2017; pp. 918–923. [Google Scholar] [CrossRef]
  13. Hamedi, K.; Sadeghi, S.; Esfandi, S.; Azimian, M.; Golmohamadi, H. Eco-Emission Analysis of Multi-Carrier Microgrid Integrated with Compressed Air and Power-to-Gas Energy Storage Technologies. Sustainability 2021, 13, 4681. [Google Scholar] [CrossRef]
  14. Yang, J.; Su, C. Robust optimization of microgrid based on renewable distributed power generation and load demand uncertainty. Energy 2021, 223, 120043. [Google Scholar] [CrossRef]
  15. Silva, J.A.A.; Lopez, J.C.; Arias, N.B.; Rider, M.J.; da Silva, L.C.P. An optimal stochastic energy management system for resilient microgrids. Appl. Energy 2021, 300, 117435. [Google Scholar] [CrossRef]
  16. Rezaei, N.; Khazali, A.; Mazidi, M.; Ahmadi, A. Economic energy and reserve management of renewable-based microgrids in the presence of electric vehicle aggregators: A robust optimization approach. Energy 2020, 201, 117629. [Google Scholar] [CrossRef]
  17. Mosa, M.A.; Ali, A.A. Energy management system of low voltage dc microgrid using mixed-integer nonlinear programing and a global optimization technique. Electr. Power Syst. Res. 2021, 192, 106971. [Google Scholar] [CrossRef]
  18. Alhumaid, Y.; Khan, K.; Alismail, F.; Khalid, M. Multi-Input Nonlinear Programming Based Deterministic Optimization Framework for Evaluating Microgrids with Optimal Renewable-Storage Energy Mix. Sustainability 2021, 13, 5878. [Google Scholar] [CrossRef]
  19. Borrelli, F.; Bemporad, A.; Morari, M. Predictive Control for Linear and Hybrid Systems; Cambridge University Press: Cambridge, UK, 2017. [Google Scholar] [CrossRef][Green Version]
  20. Tatjewski, P. Advanced Control of Industrial Processes: Structures and Algorithms; Advances in Industrial Control; Springer: London, UK, 2007. [Google Scholar] [CrossRef]
  21. Parisio, A.; Rikos, E.; Glielmo, L. A Model Predictive Control Approach to Microgrid Operation Optimization. IEEE Trans. Control Syst. Technol. 2014, 22, 1813–1827. [Google Scholar] [CrossRef]
  22. Conte, E.; Mendes, P.R.C.; Normey-Rico, J.E. Economic Management Based on Hybrid MPC for Microgrids: A Brazilian Energy Market Solution. Energies 2020, 13, 3508. [Google Scholar] [CrossRef]
  23. Khakimova, A.; Shamshimova, A.; Sharipova, D.; Kusatayeva, A.; Ten, V.; Bemporad, A.; Familiant, Y.; Shintemirov, A.; Rubagotti, M. Hybrid model predictive control for optimal energy management of a smart house. In Proceedings of the 2015 IEEE 15th International Conference on Environment and Electrical Engineering (EEEIC), Rome, Italy, 10–13 June 2015; pp. 513–518. [Google Scholar] [CrossRef]
  24. Paula e Silva, D.; Salles, J.; Fardin, J.; Pereira, M. Management of an island and grid-connected microgrid using hybrid economic model predictive control with weather data. Appl. Energy 2020, 278, 115581. [Google Scholar] [CrossRef]
  25. Olama, A.; Mendes, P.R.; Camacho, E.F. Lyapunov-based hybrid model predictive control for energy management of microgrids. IET Gener. Transm. Distrib. 2018, 12, 5770–5780. [Google Scholar] [CrossRef]
  26. Dou, C.; Zhou, X.; Zhang, T.; Xu, S. Economic Optimization Dispatching Strategy of Microgrid for Promoting Photoelectric Consumption Considering Cogeneration and Demand Response. J. Mod. Power Syst. Clean Energy 2020, 8, 557–563. [Google Scholar] [CrossRef]
  27. Saft Batteries. Intensium® Mini Flexible Lithium-Ion Energy Storage System Datasheet. Available online: (accessed on 10 July 2021).
  28. ENEA S. A. ENEA Energy Tariff 2021. Available online: (accessed on 10 July 2021).
  29. Polish Energy Regulatory Office. Average Sales Price on Polish Competitive Energy Market (Annual and Quarterly). Available online:,Srednia-cena-sprzedazy-energii-elektrycznej-na-rynku-konkurencyjnym-roczna-i-kwa.html (accessed on 10 July 2021).
  30. Torrisi, F.; Bemporad, A. HYSDEL-a tool for generating computational hybrid models for analysis and synthesis problems. IEEE Trans. Control Syst. Technol. 2004, 12, 235–249. [Google Scholar] [CrossRef]
  31. Bemporad, A.; Morari, M. Control of systems integrating logic, dynamics, and constraints. Automatica 1999, 35, 407–427. [Google Scholar] [CrossRef]
  32. Herceg, M.; Kvasnica, M.; Jones, C.N.; Morari, M. Multi-Parametric Toolbox 3.0. In Proceedings of the IEEE 2013 European Control Conference (ECC), Zurich, Switzerland, 17–19 July 2013; pp. 502–510. [Google Scholar] [CrossRef][Green Version]
  33. Gurobi Optimization LLC. Gurobi—The Fastest Solver. Available online: (accessed on 16 December 2021).
  34. Proton Polska. Proton ZPP 100 Energy Generator Datasheet. Available online: (accessed on 16 December 2021).
  35. Customer-Led Network Revolution. Customer-Led Network Revolution Dataset. Available online: (accessed on 16 December 2021).
Figure 1. Energy price chart according to chosen energy tariff.
Figure 1. Energy price chart according to chosen energy tariff.
Energies 15 00833 g001
Figure 2. Visualization of β approximation.
Figure 2. Visualization of β approximation.
Energies 15 00833 g002
Figure 3. Schematic diagram of the chosen control system structure with switching between two hybrid model predictive control laws.
Figure 3. Schematic diagram of the chosen control system structure with switching between two hybrid model predictive control laws.
Energies 15 00833 g003
Figure 4. Considered microgrid configuration for a large commercial facility.
Figure 4. Considered microgrid configuration for a large commercial facility.
Energies 15 00833 g004
Figure 5. Critical and non-critical energy demand and solar energy data used during simulation.
Figure 5. Critical and non-critical energy demand and solar energy data used during simulation.
Energies 15 00833 g005
Figure 6. Diagram showing the methodology used to compare switched and non-switched HMPC performance.
Figure 6. Diagram showing the methodology used to compare switched and non-switched HMPC performance.
Energies 15 00833 g006
Figure 7. Storage state of charge, energy balance and all system inputs over a 24-h simulation period of the sunny and cloudy day.
Figure 7. Storage state of charge, energy balance and all system inputs over a 24-h simulation period of the sunny and cloudy day.
Energies 15 00833 g007
Figure 8. Storage state of charge, energy balance, and all system inputs obtained using switched and single hybrid MPC solutions in the two-day scenario.
Figure 8. Storage state of charge, energy balance, and all system inputs obtained using switched and single hybrid MPC solutions in the two-day scenario.
Energies 15 00833 g008
Figure 9. The total cost of microgrid operation depends on the initial storage state of charge and the time at which operation mode is changed from on-grid to off-grid.
Figure 9. The total cost of microgrid operation depends on the initial storage state of charge and the time at which operation mode is changed from on-grid to off-grid.
Energies 15 00833 g009
Table 1. Microgrid model parameters and constraints.
Table 1. Microgrid model parameters and constraints.
β a p x 1 0.5000- f b 0.5000-
β a p x 2 0.6000- f c o n s t 6.100-
β a p x 3 0.7000- f e p 0.1292EUR/kWh
β a p x 4 0.8000- f m p 0.1062EUR/kWh
β a p x 5 0.9000- f f l a t 0.0787EUR/kWh
β a p x 6 1.0000- f s e l l 0.0569EUR/kWh
β m a x 100% f c g 0.0003EUR/kWh
β m i n 50% f p 0.0169EUR/kWh
Δ β m a x 10% f q 0.0023EUR/kWh
c m n t 0.25EUR f r e s 0.0005EUR/kWh
c s S D 0.4478EUR f f d 0.8956EUR/litre
c s S U 0.8956EURN15-
E e x m a x 50kWh P d b 0.5000kW
E n d 0.0082kWh P g m a x 100kW
E a c 2.000kWh Δ P g m a x 25kW
E s t m i n 100kWh P t r 32.50kW
E s t m a x 480kWh T s 0.25h
Δ E s t m i n −220kWh η c 0.9700-
Δ E s t m a x 61kWh η d 0.9700-
f a 0.1662-
Table 2. Aggregated output values associated with microgrid operation cost and averaged state of charge and energy demand reduction coefficient values for sunny and cloudy day.
Table 2. Aggregated output values associated with microgrid operation cost and averaged state of charge and energy demand reduction coefficient values for sunny and cloudy day.
VariableSunny DayCloudy DayUnit
C s t = c s t 0.892.24EUR
C m g = c m g 32.4382.41EUR
C s = c s 00EUR
C b = c b 8.7719.04EUR
C t o t a l = ( c s t + c m g c s + c b ) 42.09103.69EUR
S O C ¯ 47.6038.84%
β ¯ 95.7390.94%
Table 3. Aggregated output values associated with microgrid operation cost and averaged state of charge and energy demand reduction coefficient values obtained using switched and single hybrid MPC solutions in the two-day scenario.
Table 3. Aggregated output values associated with microgrid operation cost and averaged state of charge and energy demand reduction coefficient values obtained using switched and single hybrid MPC solutions in the two-day scenario.
VariableSwitched HMPCSingle HMPCUnit
C s t = c s t 4.934.93EUR
C m g = c m g 99.81112.06EUR
C s = c s 10.8318.16EUR
C b = c b 30.2840.55EUR
C t o t a l = ( c s t + c m g c s + c b ) 124.19139.38EUR
S O C ¯ 48.6245.09%
β ¯ 92.5096.82%
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Maślak, G.; Orłowski, P. Microgrid Operation Optimization Using Hybrid System Modeling and Switched Model Predictive Control. Energies 2022, 15, 833.

AMA Style

Maślak G, Orłowski P. Microgrid Operation Optimization Using Hybrid System Modeling and Switched Model Predictive Control. Energies. 2022; 15(3):833.

Chicago/Turabian Style

Maślak, Grzegorz, and Przemysław Orłowski. 2022. "Microgrid Operation Optimization Using Hybrid System Modeling and Switched Model Predictive Control" Energies 15, no. 3: 833.

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop