Virtual Energy Storage in RES-Powered Smart Grids with Nonlinear Model Predictive Control

The integration of a variety of heterogeneous energy sources and different energy storage systems has led to complex infrastructures and made apparent the urgent need for efficient energy control and management. This work presents a non-linear model predictive controller (NMPC) that aims to coordinate the operation of interconnected multi-node microgrids with energy storage capabilities. This control strategy creates a superstructure of a smart-grid consisting of distributed interconnected microgrids, and has the ability to distribute energy among a pool of energy storage means in an optimal way, formulating a virtual central energy storage platform. The goal of this work is the optimal exploitation of energy produced and stored in multi-node microgrids, and the reduction of auxiliary energy sources. A small-scale multi-node microgrid was used as a basis for the mathematical modelling and real data were used for the model validation. A number of operation scenarios under different weather conditions and load requests, demonstrates the ability of the NMPC to supervise the multi-node microgrid resulting to optimal energy management and reduction of the auxiliary power devices operation.


Introduction
Climate change, global warming and ozone depletion are important issues for reducing carbon dioxide emissions. In combination with the increased energy demand and the reduced fossil fuel stocks, the global interest has shifted to alternative energy sources. Distributed renewable production, over the years evolved into an organized structure by integrating local energy storage systems and loads [1]. These structures known as microgrids have undertaken the fulfillment of energy demand, mostly based on renewable energy [2]. Microgrids contain electricity sources and loads and they consist of various sources of distributed generation, and most importantly renewable energy sources (RES) [3]. The integration of numerous power devices in microgrids along with the stochastic nature of renewable generation and the uncertainty concerning the load demand resulted in the need of appropriate management and control [4][5][6].
A review in microgrid technologies can be found in [7] where the authors provide a multi-disciplinary portrait of today's microgrid drivers, real-world applications, challenges, and future prospects. Authors in [8] give an overview of the main control topics in microgrids, covering different control levels, emphasizing on energy management systems with model predictive control (MPC). Many approaches have been reported in the literature for optimal control and management [9][10][11][12][13][14]. MPC is a control policy extensively used by the power system community. Advantage of this method is its capability to handle the future behavior of the system, the renewable energy generation and demand forecasts, the systems constraints, as well as the feedback mechanism it provides, making the controlled system more robust against uncertainty [15,16]. MPC methods used in power networks have been illustrated for voltage control [17], thermal loads [18], for managing the heating, ventilation and air conditioning units (HVAC) [19] and as a framework for controlling microgrids or multiple units with flexible power consumption [20,21]. As microgrids greatly depend on its renewables and load demand forecasts, which include certain amount of uncertainty [22], model predictive control (MPC) is an effective control policy to optimize their operation. The effectiveness of MPC as a control policy in microgrids is examined by numerous studies. In this respect, authors in [23] investigate the available MPC policies that can be applied for linear parameter varying (LPV) systems. Authors in [24] propose a supervisory MPC system for a wind/solar energy generation. The system computes the optimal power references for the generators and two local controllers drive the two subsystems to these references. In [25] a flexible and modular control scheme is presented that allows virtual power plant (VPP) operation, based on distributed MPC, while in [26] a distributed power scheduling approach is proposed for balancing the demand and supply. A distributed peer-to-peer multi-agent framework [27] and a two level MPC scheme [28] are proposed for managing the power sharing and ensuring stable operation in microgrids with inverter-interfaced distributed energy resources.
At isolated microgrids, the challenge is to provide an uninterrupted and stable power supply based only on local generation and storage. In [29] a centralized energy management system based on MPC is proposed. The goal is to reduce the negative impacts introduced by uncertainties of renewable energy generations. Additionally, [30] proposes a stochastic-predictive energy management system while in [31] a two-stage MPC based energy management comprising of two optimization layers is presented. The first supports power dispatch and the second, the prediction error correction while the power output of a diesel generator is used as control variable in order to minimize the microgrid operational cost. In [32] an MPC-based combined unit commitment and optimal power flow model is proposed for integrated energy management in isolated microgrids whereas authors in [33] propose an MPC-based centralized energy management strategy (EMS) for an isolated microgrid including a distribution network model and its unbalance conditions. Extended research and evolution of microgrids resulted in structures integrating multiple distributed microgrids into larger multi-node microgrids by linking each other through power, information and control signals channels [34]. A challenge was raised because the energy management in these microgrids is needed not only to optimize operation of each microgrid, but also to achieve global optimization by coordinating power flow among microgrids. Studies on this field propose an MPC-based EMS [35,36] for multiple microgrids to optimally manage and coordinate energy supply and demand aiming at minimization of overall costs whereas in [37] a centralized MPC method for power flow management is proposed for cooperating microgrids, targeting to balance the supply and demand by maximizing renewable energy generation.
To this end, this work presents a framework for coordinating multi-microgrids based on Non Linear Model Predictive control. A two layer approach is used. The first layer consists of a low level internal hierarchical EMS providing a device level coordination and power flow at each node. The second layer implements a NMPC framework for managing the power flow between the interconnected battery energy storage systems (BESS) of the nodes. In this way a supervisory EMS is applied that does not affect directly the device level operation, but has an indirect affect to the systems through the BESS and the exchanged energy. The simplicity of the framework is derived from the ability of the NMPC to coordinate the energy storage systems, based on their energy state as well as on weather and load predictions and maintain independent device level operation letting it exclusively be handled by the internal EMS. The main aim of the work is to provide a reliable and highly efficient control scheme that can provide a solid basis for the study of multi-node microgrids and their response under different scenarios of weather and load situations. An increased flexibility can be achieved in the microgrid by aggregating the distributed BESS into one virtually larger central storage system. Additionally, the Energies 2021, 14, 1082 3 of 22 framework is highly parameterizable and it can be adapted not only to various types of energy devices and microgrid topologies but also to user and/or microgrid needs through the objective function's weight coefficients.
The work is organized as follows: In Section 2, a description is given of the multi-node microgrid adopted for this research. The formulation of the mathematical models of the nodes based on the low level hierarchical EMS and the devices models, is also described in this section. In Section 3 the methodology is analyzed and the formulation of the NMPC is given. Section 4 presents the simulation results of three microgrid case studies. Finally in Section 5 a discussion is made and overall conclusions are given.

Multi-Node Microgrid
The methodology in this work is developed based on a real multi-node microgrid. The existing infrastructure is used in order to be able to apply, tune and validate the controller based on real data acquired from the field. This multi-node autonomous microgrid is powered from RES and consists of three smaller microgrids, the nodes. Each node integrates photovoltaics (PV) and wind turbines (WT) as energy sources, local loads and BESS. Additionally, diesel generators (DG) are included as backup energy sources. One of the nodes incorporates hydrogen generation and consumption infrastructure that is used in cases of renewable energy excess, where electricity is converted to hydrogen and stored in tanks. In case of energy shortage the stored hydrogen is converted to electricity to meet the load demand. The infrastructure consists of a low temperature proton exchange membrane (PEM) water electrolysis device (Electrolyzer) and a PEM fuel cell (FC). Moreover, each node incorporates all necessary devices and power electronics, such as converters and inverters, meters and chargers. A low-pressure intermediate tank and a final high-pressure tank for hydrogen storage as well as a compressor are also included. The operation of the microgrid is monitored by a supervisory control and data acquisition (SCADA) system [38]. An additional DC bus bar, that interconnects electrically the nodes, enables the exchange of energy through bidirectional DC/DC converters. Table 1 describes the power characteristics of the devices and Figure 1 shows the topology of the microgrid.

Methodology
The process of implementing the NMPC in the microgrid under study, due to the complexity of the structure and the plethora of subsystems, requires careful planning both in the construction of the models as well as in the definition of the constraints governing the system. The steps are: 1. Mathematical models of all the devices that make up the nodes of the microgrid were used.

Methodology
The process of implementing the NMPC in the microgrid under study, due to the complexity of the structure and the plethora of subsystems, requires careful planning both in the construction of the models as well as in the definition of the constraints governing the system. The steps are:

1.
Mathematical models of all the devices that make up the nodes of the microgrid were used.

2.
Finding the parameters determined from the technical characteristics of all devices.

3.
Validating of the mathematical models. Experimental data and characteristic curves of the devices were used for the validation of the models.

4.
Creating an energy management algorithm for each node. An EMS is implemented internally at each node. 5.
Using the mathematical models of the devices and the energy management algorithm, the mathematical model of each node was developed. 6.
Developing and implementing the NMPC for the nodes taking into account the operating constraints. The NMPC is the basis for the creation of a virtual central storage platform and the resulting optimal energy management among the nodes of the microgrid.

Mathematical Models
The mathematical models of the devices of each node of the micro grid are from [39]. The process models that describe the topology of the nodes of the multi node microgrid and used for prediction and optimization by the NMPC, have been developed on the basis of a hierarchical EMS. The mathematical models include batteries (lead acid accumulators), photovoltaic panels, wind turbines and in case of H 2 production a PEM electrolyzer, a PEM fuel cell, hydrogen low and high pressure storage tanks and a hydrogen compressor [39,40]. All mathematical models were experimentally verified with data acquired from the onsite SCADA archiving system [41] and from tests conducted in CPERI/CERTH laboratories (fuel cell). Indicative results from the validation process can be found in Appendix A.

Energy Management Strategy
The operation sequence of the power devices defines the EMS applied in each of the nodes of the microgrid. This sequence depends on the existing subsystems, the desired results and the technical characteristics of the devices [42][43][44]. In this work a hierarchical energy management is applied for the internal operation of the nodes (adopted by the SCADA system), targeting mainly on the load fulfillment [41].
The same strategy is applied to all three nodes, to keep the internal operation as simple as possible, in order to demonstrate the ability of the NMPC to provide in a higher level the optimal energy management in the multi-node microgrid. In the applied strategy ( Figure 2), priority is given in the fulfillment of the load demand. The necessary power is provided firstly from the RES and subsequently from the BESS in case of RES shortage. The final power source to cover the load comes from the DG. If there is a power excess, the batteries are charged in priority until the maximum defined limit, and the remaining power is converted and stored as hydrogen.

Formulation of the Non-Linear Model Predictive Control Framework
According to the mathematical formulation of the NMPC [45][46][47][48] the state variable vector ( ) is the stored energy in the batteries, the controlled variable vector ( ) is the state of the battery charge SOC% and the manipulated variable vector ( ) is the power that needs to be transferred from and to each node.
At each time instant t, each node = 1,2, … , has an energy state ( ). This is calculated from the mathematical model and the EMS applied in each node and depends on the respective weather forecast and load demand. The controlled variable ̂( ) is a function of the state variable ( ) and the manipulated variable ( ). Positive values of ( ) depict power inflow into node i from other nodes while negative values depict power outflow to other nodes. ( ) defines the control signals to be applied on the DC/DC converter of node i in order to achieve the energy exchange with the other nodes of the microgrid.
For weighting independently the inflow and outflow exchanged power, manipulated variables are divided into charging ( , ) and discharging variables ( , ).
where m depicts the number of the interconnected microgrids (nodes).
( ) depicts the set point of the SOC of node i at time instant t. The optimal control problem can be described as a trajectory following problem, applying the minimum amount of energy. The functional J in Equation (2) is defined by the sum of squares of the distances of the controlled variables ̂ from the reference trajectory multiplied with a matrix of appropriate weight coefficients Q and the sum of squares of the manipulated variables for each node in the prediction horizon multiplied also with a matrix of appropriate coefficients P.  We define with P the available power in the node resulting by the difference between the renewable power P RES minus the load demand P Load , i.e., P = P RES − P Load . When P > 0, the battery state of charge (SOC) is checked. If SOC is not exceeding SOC max , the excess power charges the batteries (P acc = P). Otherwise, if the node integrates an electrolyzer, the available power P is compared with the device's operational limits P elec_min , P elec_max and if being between them, P is exploited to produce hydrogen (P elec = P). In case of P > P elec_max , only the maximum feasible amount of power is handled by the electrolyzer (P elec = P elec_max ). In all other cases, the power remains unexploited.
When P < 0, if SOC > SOC min , the batteries discharge to cover the load (P = P acc ). Otherwise, if the node integrates a fuel cell, and the power demand is less than its operational limit P fc_max , P is covered from the fuel cell power (P fc = P). In any other case, the diesel generator is activated and produces constant power P dg . Part of this power covers the load and the rest charges the battery. The generator remains active, until battery SOC reaches a predefined level SOC dg .
Additional operational limits of the devices have been taken into account, such as battery charging and discharging current limits, I c max , I d max . which depend on the instant SOC [39], as well as hydrogen tank pressures Pr H2 , and limits Pr H2_min , Pr H2_max necessary for hydrogen utilization.

Formulation of the Non-Linear Model Predictive Control Framework
According to the mathematical formulation of the NMPC [45][46][47][48] the state variable vector x(t). is the stored energy in the batteries, the controlled variable vector y(t) is the state of the battery charge SOC% and the manipulated variable vector u(t). is the power that needs to be transferred from and to each node.
At each time instant t, each node i = 1, 2, . . . , m. has an energy state x i (t). This is calculated from the mathematical model and the EMS applied in each node and depends on the respective weather forecast and load demand. The controlled variableŷ i (t) is a function of the state variable x i (t) and the manipulated variable u i (t). Positive values of u i (t). depict power inflow into node i from other nodes while negative values depict power outflow to other nodes. u i (t) defines the control signals to be applied on the DC/DC converter of node i in order to achieve the energy exchange with the other nodes of the microgrid.
For weighting independently the inflow and outflow exchanged power, manipulated variables u i . are divided into charging (u c,i ) and discharging variables (u d,i ).
where m depicts the number of the interconnected microgrids (nodes). y sp i (t). depicts the set point of the SOC of node i at time instant t.
The optimal control problem can be described as a trajectory following problem, applying the minimum amount of energy. The functional J in Equation (2) is defined by the sum of squares of the distances of the controlled variablesŷ. from the reference trajectory y sp . multiplied with a matrix of appropriate weight coefficients Q and the sum of squares of the manipulated variables u. for each node in the prediction horizon multiplied also with a matrix of appropriate coefficients P.
At each time step k, a prediction of the energy states y pred i . is made for the current step and the next N p − 1 steps, with functions f a,i being a set of algebraic equations that define the process model. The process model was developed in MATLAB environment and consists of three functions. Each function is developed taking into account the mathematical models of the devices (Figure 1), the power characteristics (Table 1) and the hierarchical EMS applied for each node ( Figure 2). The prediction error e(k) between the current predicted state and the current real state is calculated by: This error is added to the predicted states of the entire prediction horizon T p , resulting theŷ i . states for the cost function J. The optimal control values for the control horizon T c are then recalculated by minimizing the cost function J within the prediction horizon T p min u J(k).
with respect to u and taking into account a set of constrains. Only the first control value of the optimal control sequence is applied to the DC/DC converters and the procedure is then repeated for the next time step. The duration of each step is 5 min. Matrices Q and P, are diagonal positive definite matrices of order N p and are weight matrices for the quadratic terms in the cost function. Matrix Q defines the rate at which each node reaches the target while matrix P defines the significance of each node's participation in providing or receiving energy. Both matrices weight the quadratic terms of the cost function for the entire prediction horizon.

Constraints
The cost function J is subject to several physical and conceptual constrains. The solution of the optimal control problem takes into account all constrains which are applied at each time-step k for every step j = 0, . . . , N p − 1. in the prediction horizon. The power Additionally, charging and discharging simultaneously a node, is not a feasible state. Thus, In order for the exchanged energy balance to be maintained and since power flowing in and out of the node has opposite signs, the sum of the power exchanged at each time step should be zero.
Equation (10) determines the predefined limits of the batteries SOC (controlled variablê Finally, Equation (11) determines the limits of the battery operating current I acc .

Simulation Results
In order to demonstrate the benefits of the NMPC, three scenarios (case studies) were examined. The first scenario, demonstrates a 24-h operation of the microgrid with weather conditions similar to a typical spring day. The second scenario demonstrates the effectiveness of the controller under different set points and weight coefficients in the cost function and under unpredicted weather and load conditions for a 24-h operation. Finally, a long-term operation (7 days) of the microgrid is simulated in the third scenario for the controller's long-term efficiency validation. To compare and highlight the capability of the controller to exploit the maximum amount of energy and balance the microgrid, in each scenario, two simulations of the microgrid operation are performed: one with the NMPC disabled (isolated node operation) and one with the controller enabled (interconnected node operation).
In all scenarios, each node starts at different levels of battery SOC. The initial SOC for the three nodes is 63%, 69% and 76.5% respectively. It is assumed that third node has initial stored hydrogen at 6 bars. For weather conditions prediction, the last 30 days average for 24 h of solar irradiation and wind speed are used. Furthermore, three typical residential load profiles are used.

Microgrid Operation without the NMPC
In the first scenario, data of solar irradiation and wind speed were used by the models. Figure 3a shows the daily power production from the PV in each node, while Figure 3b shows the respective power from wind turbines. The load profiles of each node are shown in Figure 3c. In the first scenario, data of solar irradiation and wind speed were used by the models. Figure 3a shows the daily power production from the PV in each node, while Figure 3b shows the respective power from wind turbines. The load profiles of each node are shown in Figure 3c.     The charging and discharging operation is observed in positive and negative availability respectively. In the first and the second node, the diesel generators are activated when minimum SOC is reached while in the third node the water electrolysis device is activated at maximum SOC in order to exploit excess energy.
A detailed operation of the power devices inside each node can be seen in Figures 5-7. Figure 5a shows that the load in node 1 (dashed line) is covered initially by the battery. Afterwards the RES are gradually beginning to contribute during the day. At approximately 9:00 h, when the battery reaches the minimum SOC (55%), the diesel generator starts to operate offering 2 KW constant power to load demand and for the battery charging. During this period, battery is also charged from the RES. The generator stops as soon as the battery reaches 65% SOC (generator operating limit) at 14:00 h. From this point, the RES and the battery take over to fulfill the load. The total power flow along with any shortage or excess of energy in the node during the 24 h operation is given in Figure 5b with   The charging and discharging operation is observed in positive and negative availability respectively. In the first and the second node, the diesel generators are activated when minimum SOC is reached while in the third node the water electrolysis device is activated at maximum SOC in order to exploit excess energy.
A detailed operation of the power devices inside each node can be seen in Figures 5-7. Figure 5a shows that the load in node 1 (dashed line) is covered initially by the battery. Afterwards the RES are gradually beginning to contribute during the day. At approximately 9:00 h, when the battery reaches the minimum SOC (55%), the diesel generator starts to operate offering 2 KW constant power to load demand and for the battery charging. During this period, battery is also charged from the RES. The generator stops as soon as the battery reaches 65% SOC (generator operating limit) at 14:00 h. From this point, the RES and the battery take over to fulfill the load. The total power flow along with any shortage or excess of energy in the node during the 24 h operation is given in Figure 5b with a Sankey diagram. Data of all Sankey diagrams in table form can be found in Appendix B.
charging. During this period, battery is also charged from the RES. The generator stops as soon as the battery reaches 65% SOC (generator operating limit) at 14:00 h. From this point, the RES and the battery take over to fulfill the load. The total power flow along with any shortage or excess of energy in the node during the 24 h operation is given in Figure 5b with a Sankey diagram. Data of all Sankey diagrams in table form can be found in Appendix B. In a similar way, node 2 uses the diesel generator, since its battery also reaches the lower SOC limit. Figure 6a shows operation of all devices in node 2 while the total energy flow is depicted in Figure 6b. In a similar way, node 2 uses the diesel generator, since its battery also reaches the lower SOC limit. Figure 6a shows operation of all devices in node 2 while the total energy flow is depicted in Figure 6b. In contrast to the first two nodes, the greater RES production capacity of node 3 ( Figure 7), constantly covers the loads and brings the battery's SOC in its maximum permissible limit, 80%. This results in the operation of the water electrolysis device at 12:30 h for the excess energy exploitation. As shown in Figure 7a, the electrolyzer operates at its maximum power (4 KW) for the first 2.5 h of operation, while in the remaining period (until 17:30) operates at the levels of renewable surplus.  In contrast to the first two nodes, the greater RES production capacity of node 3 ( Figure 7), constantly covers the loads and brings the battery's SOC in its maximum permissible limit, 80%. This results in the operation of the water electrolysis device at 12:30 h for the excess energy exploitation. As shown in Figure 7a, the electrolyzer operates at its maximum power (4 KW) for the first 2.5 h of operation, while in the remaining period (until 17:30) operates at the levels of renewable surplus.
A more detailed analysis of the microgrid's operation reveals (Figure 8a) an additional energy shortage in node 2 at time periods where the diesel generator was activated, indicating unmet loads. At the third node, on the other hand, power excess occurs, even though the electrolyzer was in operation. The renewable hydrogen production, the pressures of the intermediate and the final hydrogen storage tanks (produced H 2 ) are depicted in Figure 8b.
In contrast to the first two nodes, the greater RES production capacity of node 3 (Figure 7), constantly covers the loads and brings the battery's SOC in its maximum permissible limit, 80%. This results in the operation of the water electrolysis device at 12:30 h for the excess energy exploitation. As shown in Figure 7a, the electrolyzer operates at its maximum power (4 KW) for the first 2.5 h of operation, while in the remaining period (until 17:30) operates at the levels of renewable surplus.

Microgrid Operation with NMPC
By electrically interconnecting the three nodes through the common DC bus and applying the NMPC to the microgrid brings a significant difference in the overall operating state. When the controller actions for energy exchange are applied, the BESS of the three nodes create a distributed central storage unit. The operating conditions of the three nodes are suggested to be the same.
The goal of the NMPC is set to drive the batteries to a charging state of 80%. This goal however, can only be achieved when the globally required power at any time is available to the microgrid as a whole. Due to stochastic production from renewables, reaching the desired goal can be considered relative to the energy availability. The NMPC however, provides at all times the optimal solution fulfilling the constraints given the power availability of the renewable sources. Figure 9a shows the battery SOC evolution which is balanced between limits after a short period of time and energy surplus and shortage is managed without the operation of auxiliary power devices. The appropriate control actions for energy transfer delivered by the optimal solution of the NMPC optimization problem are shown in Figure 9b. At any given time the control satisfies the constraints of batteries charging/discharging currents, exchanged power energy balance and limits of exchanged power.

Microgrid Operation with NMPC
By electrically interconnecting the three nodes through the common DC bus and applying the NMPC to the microgrid brings a significant difference in the overall operating state. When the controller actions for energy exchange are applied, the BESS of the three nodes create a distributed central storage unit. The operating conditions of the three nodes are suggested to be the same.
The goal of the NMPC is set to drive the batteries to a charging state of 80%. This goal however, can only be achieved when the globally required power at any time is available to the microgrid as a whole. Due to stochastic production from renewables, reaching the desired goal can be considered relative to the energy availability. The NMPC however, provides at all times the optimal solution fulfilling the constraints given the power availability of the renewable sources. Figure 9a shows the battery SOC evolution which is balanced between limits after a short period of time and energy surplus and shortage is managed without the operation of auxiliary power devices. The appropriate control actions for energy transfer delivered by the optimal solution of the NMPC optimization problem are shown in Figure 9b. At any given time the control satisfies the constraints of batteries charging/discharging currents, exchanged power energy balance and limits of exchanged power. the power availability of the renewable sources. Figure 9a shows the battery SOC evolution which is balanced between limits after a short period of time and energy surplus and shortage is managed without the operation of auxiliary power devices. The appropriate control actions for energy transfer delivered by the optimal solution of the NMPC optimization problem are shown in Figure 9b. At any given time the control satisfies the constraints of batteries charging/discharging currents, exchanged power energy balance and limits of exchanged power.  The total energy flow throughout the microgrid is shown in Figure 10, as a result of the energy exchange actions determined by the NMPC. It is obvious that the control actions reflect the energy dynamics of each node, since the quantities of energy exchanged in total, correspond to the pre-existing energy state of each node. The total energy flow throughout the microgrid is shown in Figure 10, as a result of the energy exchange actions determined by the NMPC. It is obvious that the control actions reflect the energy dynamics of each node, since the quantities of energy exchanged in total, correspond to the pre-existing energy state of each node.

Operation without the NMPC
In this case study a variety of different assumptions is applied compared to the previous one. As shown in Figure 11a,b the operation of nodes 2 and 3 is simulated with load demands at the 2/3rd of the first case, which indicates an unforeseen change in power requirements and for node 3 less sun irradiation is assumed, that indicates an unforeseen change in weather conditions (disturbance). The wind turbine generation remains the same as previous scenario. Simulating the operation of the microgrid under these conditions, Figure 11c shows the evolution of the battery SOC during the 24 h operation and Figures 12-14 show the detailed operation of the internal power systems of each node and the respective power flow.

Operation without the NMPC
In this case study a variety of different assumptions is applied compared to the previous one. As shown in Figure 11a,b the operation of nodes 2 and 3 is simulated with load demands at the 2/3rd of the first case, which indicates an unforeseen change in power requirements and for node 3 less sun irradiation is assumed, that indicates an unforeseen change in weather conditions (disturbance). The wind turbine generation remains the same as previous scenario. Simulating the operation of the microgrid under these conditions, Figure 11c shows the evolution of the battery SOC during the 24 h operation and Figures 12-14 show the detailed operation of the internal power systems of each node and the respective power flow. load demands at the 2/3rd of the first case, which indicates an unforeseen change in power requirements and for node 3 less sun irradiation is assumed, that indicates an unforeseen change in weather conditions (disturbance). The wind turbine generation remains the same as previous scenario. Simulating the operation of the microgrid under these conditions, Figure 11c shows the evolution of the battery SOC during the 24 h operation and Figures 12-14 show the detailed operation of the internal power systems of each node and the respective power flow. During the time periods having no sunshine the batteries cover the greatest amount of requested energy, with a small contribution of the wind generators at nodes 2 and 3. Although the power production from PVs in node 3 was almost ¼ th of the previous scenario, battery SOC remains in high levels. No energy surplus at node 3 is observed thus no hydrogen production is noticed. However, the node is capable of covering the loads. The same condition applies also for node 2. On the other hand, node 1 reaches instantly the lower SOC, and thus the diesel generator starts to offer the requested amount of energy as seen in Figure 12a.   thus no hydrogen production is noticed. However, the node is capable of covering the loads. The same condition applies also for node 2. On the other hand, node 1 reaches instantly the lower SOC, and thus the diesel generator starts to offer the requested amount of energy as seen in Figure 12a.

Microgrid Operation with the NMPC
In the second scenario the controller efficiency in case of different reference trajectories for each node is investigated, including also a step change during the day. Moreover achieving the desired SOC in the first node is weighted as more important than for the other two ones (different weights in the cost function). To this end, the controller was adjusted to the desired reference trajectories giving more emphasis on the charging status of the first node in the objective function.
The resulting operation of the microgrid with the NMPC enabled is shown in Figure  15. The controller derives appropriate control actions in order to keep track of the targets (dashed lines) succeeding, as expected, better results for node 1. The deviations of battery SOC from the desired trajectories at nodes 2 and 3 are equally divided, as a result of the optimal control actions, depending at the same time on the available renewable power constrain.
At node 3, due to the reduced renewable power and the given weight for achieving the SOC reference, the battery SOC reaches the lower level limit, which results in the activation of the fuel cell at 8: 30 h. Figure 16a-c show the device operation at each node, During the time periods having no sunshine the batteries cover the greatest amount of requested energy, with a small contribution of the wind generators at nodes 2 and 3. Although the power production from PVs in node 3 was almost 1 /4 th of the previous scenario, battery SOC remains in high levels. No energy surplus at node 3 is observed thus no hydrogen production is noticed. However, the node is capable of covering the loads. The same condition applies also for node 2. On the other hand, node 1 reaches instantly the lower SOC, and thus the diesel generator starts to offer the requested amount of energy as seen in Figure 12a.

Microgrid Operation with the NMPC
In the second scenario the controller efficiency in case of different reference trajectories for each node is investigated, including also a step change during the day. Moreover achieving the desired SOC in the first node is weighted as more important than for the other two ones (different weights in the cost function). To this end, the controller was adjusted to the desired reference trajectories giving more emphasis on the charging status of the first node in the objective function.
The resulting operation of the microgrid with the NMPC enabled is shown in Figure 15. The controller derives appropriate control actions in order to keep track of the targets (dashed lines) succeeding, as expected, better results for node 1.
The deviations of battery SOC from the desired trajectories at nodes 2 and 3 are equally divided, as a result of the optimal control actions, depending at the same time on the available renewable power constrain.
At node 3, due to the reduced renewable power and the given weight for achieving the SOC reference, the battery SOC reaches the lower level limit, which results in the activation of the fuel cell at 8:30 h. Figure 16a-c show the device operation at each node, with the battery power following the controller's actions. The operation of the fuel cell is shown in Figure 16c (node 3) during the period of time that the battery reaches the lower SOC limit. A significant outcome is that node 3 offers power to other nodes during the fuel cell operation. Therefore, a single fuel cell device installed in one of the nodes can cover energy shortage in the whole microgrid as a result of the NMPC actions. Figure 16d shows the respective hydrogen consumption from the fuel cell. over achieving the desired SOC in the first node is weighted as more important than for the other two ones (different weights in the cost function). To this end, the controller was adjusted to the desired reference trajectories giving more emphasis on the charging status of the first node in the objective function.
The resulting operation of the microgrid with the NMPC enabled is shown in Figure  15. The controller derives appropriate control actions in order to keep track of the targets (dashed lines) succeeding, as expected, better results for node 1. The deviations of battery SOC from the desired trajectories at nodes 2 and 3 are equally divided, as a result of the optimal control actions, depending at the same time on the available renewable power constrain.
At node 3, due to the reduced renewable power and the given weight for achieving the SOC reference, the battery SOC reaches the lower level limit, which results in the activation of the fuel cell at 8: 30 h. Figure 16a-c show the device operation at each node, with the battery power following the controller's actions. The operation of the fuel cell is shown in Figure 16c (node 3) during the period of time that the battery reaches the lower SOC limit. A significant outcome is that node 3 offers power to other nodes during the fuel cell operation. Therefore, a single fuel cell device installed in one of the nodes can cover energy shortage in the whole microgrid as a result of the NMPC actions. Figure 16d shows the respective hydrogen consumption from the fuel cell. In Figure 17, the total power flow throughout the microgrid is depicted, after implementing the NMPC. Node 1 absorbs the largest amount of energy. There is generally a greater energy exchange in this scenario, as a result of the controller trying to meet the targets under different reference goals and load demands. In Figure 17, the total power flow throughout the microgrid is depicted, after implementing the NMPC. Node 1 absorbs the largest amount of energy. There is generally a greater energy exchange in this scenario, as a result of the controller trying to meet the targets under different reference goals and load demands.

Microgrid Operation without the NMPC
In order to validate the long-term efficiency of the controller, a seven-day operation of the microgrid was examined. In this case in order to investigate the controller's efficiency under more extreme conditions, the diesel generator's dynamics is decreased to 1 kW while the batteries low SOC limit is set to 60% resulting to narrower operation zone of 60-80%. Additionally, the renewable power generation is reduced to 75% of the nominal power. The required loads were set to 1 kWp, 1.5 kWp and 3 kWp for each node respectively. Thus the microgrid faces greater challenges in order to maintain its optimal operability. Figure 18a depicts the available power each node should handle for seven days. In the case where NMPC is not activated, ( Figure 19) the extended usage of the diesel generator in node 1 is necessary, with an additional energy shortage. These unmet loads exist although at node 3 there is a surplus of unexploited energy and the electrolyzer is in operation (Figure 18b).

Microgrid Operation without the NMPC
In order to validate the long-term efficiency of the controller, a seven-day operation of the microgrid was examined. In this case in order to investigate the controller's efficiency under more extreme conditions, the diesel generator's dynamics is decreased to 1 kW while the batteries low SOC limit is set to 60% resulting to narrower operation zone of 60-80%. Additionally, the renewable power generation is reduced to 75% of the nominal power. The required loads were set to 1 kWp, 1.5 kWp and 3 kWp for each node respectively. Thus the microgrid faces greater challenges in order to maintain its optimal operability. Figure 18a depicts the available power each node should handle for seven days.

Microgrid Operation without the NMPC
In order to validate the long-term efficiency of the controller, a seven-day operation of the microgrid was examined. In this case in order to investigate the controller's efficiency under more extreme conditions, the diesel generator's dynamics is decreased to 1 kW while the batteries low SOC limit is set to 60% resulting to narrower operation zone of 60-80%. Additionally, the renewable power generation is reduced to 75% of the nominal power. The required loads were set to 1 kWp, 1.5 kWp and 3 kWp for each node respectively. Thus the microgrid faces greater challenges in order to maintain its optimal operability. Figure 18a depicts the available power each node should handle for seven days. In the case where NMPC is not activated, ( Figure 19) the extended usage of the diesel generator in node 1 is necessary, with an additional energy shortage. These unmet loads exist although at node 3 there is a surplus of unexploited energy and the electrolyzer is in operation (Figure 18b). In the case where NMPC is not activated, ( Figure 19) the extended usage of the diesel generator in node 1 is necessary, with an additional energy shortage. These unmet loads exist although at node 3 there is a surplus of unexploited energy and the electrolyzer is in operation (Figure 18b).

Microgrid Operation with the NMPC
The batteries SOC evolution is shown in Figure 20a. The cases of with or without the activation of the NMPC is shown. The controller successfully manages to balance the dynamic of the microgrid, by providing cooperation. In case that all BESS reach the lower SOC, then the controller disallows the energy exchange. The respective control action is depicted in Figure 20b.  Figure 21 shows the total energy flow through the three nodes. One can notice the contribution of the diesel generator in nodes 1 and 2 and the contribution of the fuel cell in node 3. This is a minimum contribution of the auxiliary power devices and took place in the periods where all three nodes reached the lower SOC.

Microgrid Operation with the NMPC
The batteries SOC evolution is shown in Figure 20a. The cases of with or without the activation of the NMPC is shown. The controller successfully manages to balance the dynamic of the microgrid, by providing cooperation. In case that all BESS reach the lower SOC, then the controller disallows the energy exchange. The respective control action is depicted in Figure 20b.

Microgrid Operation with the NMPC
The batteries SOC evolution is shown in Figure 20a. The cases of with or without the activation of the NMPC is shown. The controller successfully manages to balance the dynamic of the microgrid, by providing cooperation. In case that all BESS reach the lower SOC, then the controller disallows the energy exchange. The respective control action is depicted in Figure 20b.  Figure 21 shows the total energy flow through the three nodes. One can notice the contribution of the diesel generator in nodes 1 and 2 and the contribution of the fuel cell in node 3. This is a minimum contribution of the auxiliary power devices and took place in the periods where all three nodes reached the lower SOC.  Figure 21 shows the total energy flow through the three nodes. One can notice the contribution of the diesel generator in nodes 1 and 2 and the contribution of the fuel cell in node 3. This is a minimum contribution of the auxiliary power devices and took place in the periods where all three nodes reached the lower SOC.

Discussion
The interconnected operation of the microgrid nodes revealed a new perspective in the coordinated operation of the overall network. The NMPC demonstrates its ability to synchronize the operation of distributed microgrids and provide increased flexibility in the energy distribution by formulating a virtual central storage. The energy sharing provided by the controller's actions, offers not only energy balance in the microgrid but also a significant change in the utilization of the auxiliary devices. The main goal of achieving optimal energy exploitation at each case is fulfilled. The NMPC framework can be highly parameterized and it can be adapted to various types of energy devices and microgrid topologies. Moreover, the controller itself can be adapted to user and/or microgrid needs through the objective function's weight coefficients.
An overall analysis of the results proves the capabilities of the NMPC. The coordination of the BESS provides an indirect management of the local systems operation. The first scenario shows the minimization of the diesel generator and the electrolyzer operation with a respective reduction of the energy shortage and surplus periods (Figure 22a). At the more demanding second scenario (Figure 22b), even though the fuel cell initiated its operation, the provided power was relatively lower than the respective power that would be required by the usage of the diesel generator in the isolated mode operation. At the third scenario of the weakly operation ( Figure 23), a significant reduction is observed in the NMPC case to the diesel generator operation by 76.65% and to the energy shortage by 95.85%. The energy surplus is also reduced, which depicts that the energy is optimally exploited throughout the entire microgrid.

Discussion
The interconnected operation of the microgrid nodes revealed a new perspective in the coordinated operation of the overall network. The NMPC demonstrates its ability to synchronize the operation of distributed microgrids and provide increased flexibility in the energy distribution by formulating a virtual central storage. The energy sharing provided by the controller's actions, offers not only energy balance in the microgrid but also a significant change in the utilization of the auxiliary devices. The main goal of achieving optimal energy exploitation at each case is fulfilled. The NMPC framework can be highly parameterized and it can be adapted to various types of energy devices and microgrid topologies. Moreover, the controller itself can be adapted to user and/or microgrid needs through the objective function's weight coefficients.
An overall analysis of the results proves the capabilities of the NMPC. The coordination of the BESS provides an indirect management of the local systems operation. The first scenario shows the minimization of the diesel generator and the electrolyzer operation with a respective reduction of the energy shortage and surplus periods (Figure 22a). At the more demanding second scenario (Figure 22b), even though the fuel cell initiated its operation, the provided power was relatively lower than the respective power that would be required by the usage of the diesel generator in the isolated mode operation.

Discussion
The interconnected operation of the microgrid nodes revealed a new perspective in the coordinated operation of the overall network. The NMPC demonstrates its ability to synchronize the operation of distributed microgrids and provide increased flexibility in the energy distribution by formulating a virtual central storage. The energy sharing provided by the controller's actions, offers not only energy balance in the microgrid but also a significant change in the utilization of the auxiliary devices. The main goal of achieving optimal energy exploitation at each case is fulfilled. The NMPC framework can be highly parameterized and it can be adapted to various types of energy devices and microgrid topologies. Moreover, the controller itself can be adapted to user and/or microgrid needs through the objective function's weight coefficients.
An overall analysis of the results proves the capabilities of the NMPC. The coordination of the BESS provides an indirect management of the local systems operation. The first scenario shows the minimization of the diesel generator and the electrolyzer operation with a respective reduction of the energy shortage and surplus periods (Figure 22a). At the more demanding second scenario (Figure 22b), even though the fuel cell initiated its operation, the provided power was relatively lower than the respective power that would be required by the usage of the diesel generator in the isolated mode operation. At the third scenario of the weakly operation ( Figure 23), a significant reduction is observed in the NMPC case to the diesel generator operation by 76.65% and to the energy shortage by 95.85%. The energy surplus is also reduced, which depicts that the energy is optimally exploited throughout the entire microgrid. At the third scenario of the weakly operation ( Figure 23), a significant reduction is observed in the NMPC case to the diesel generator operation by 76.65% and to the energy shortage by 95.85%. The energy surplus is also reduced, which depicts that the energy is optimally exploited throughout the entire microgrid. Overall we can say that the presented NMPC meets the requirements for a coordinated and balanced operation, taking into account unpredictable weather fluctuations, user defined expectations and constrains set by the microgrid and systems operation.

Conclusions
In the present work the development of a NMPC scheme for the supervisory management of energy in an autonomous RES-powered microgrid was presented. The controller takes in account all the features of a multi-node microgrid including renewables, H2, storage and load demands. An investigation in the behavior of the controller under nominal operational conditions and under disturbances in weather, load demands, changes of SOC profiles and long term operation, prove the effectiveness and robustness of the controller. The integration of the transferred energy among the nodes in the cost function reduces the transferred amounts of energy, protecting the BESS from multiple charging/discharging cycles. By independently weighting the manipulated variables, additional flexibility is given for the power that each node should provide or receive. In this way necessary restrictions can be applied, depending on user and/or microgrid needs.
Three case studies were demonstrated where the behavior of the nodes was studied both in connected and isolated mode. The comparison demonstrated that the controller always fulfills the operating objectives, regardless of the RES fluctuation. Overall the NMPC coordinates the energy exchange between the storage systems and therefore performs an aggregation of the distributed energy storage formulating a virtual larger system that acts as central storage for the multi-node microgrid. This virtual central storage is able to manage local energy shortage or excess at all times reducing or even eliminating the operation of the auxiliary power systems (diesel generator).
The main benefit derived by the NMPC application is the optimal usage of the renewable energy, through the minimization of the losses. On the other hand, reducing the operation of auxiliary sources offers not only economic benefits (fuel, maintenance), but also environmental, due to reduced carbon dioxide emissions. Adjusting the operation of sensitive hydrogen devices (water electrolysis device and fuel cell) to the optimal is another economic benefit, since the cost of purchasing and maintaining these devices and the required infrastructure is high. In short, the use of the NMPC framework, to control and achieve energy balance between the nodes, maximizes the autonomy of the microgrid in terms of profitability, economy and environmental friendliness.    Overall we can say that the presented NMPC meets the requirements for a coordinated and balanced operation, taking into account unpredictable weather fluctuations, user defined expectations and constrains set by the microgrid and systems operation.

Conclusions
In the present work the development of a NMPC scheme for the supervisory management of energy in an autonomous RES-powered microgrid was presented. The controller takes in account all the features of a multi-node microgrid including renewables, H2, storage and load demands. An investigation in the behavior of the controller under nominal operational conditions and under disturbances in weather, load demands, changes of SOC profiles and long term operation, prove the effectiveness and robustness of the controller. The integration of the transferred energy among the nodes in the cost function reduces the transferred amounts of energy, protecting the BESS from multiple charging/discharging cycles. By independently weighting the manipulated variables, additional flexibility is given for the power that each node should provide or receive. In this way necessary restrictions can be applied, depending on user and/or microgrid needs.
Three case studies were demonstrated where the behavior of the nodes was studied both in connected and isolated mode. The comparison demonstrated that the controller always fulfills the operating objectives, regardless of the RES fluctuation. Overall the NMPC coordinates the energy exchange between the storage systems and therefore performs an aggregation of the distributed energy storage formulating a virtual larger system that acts as central storage for the multi-node microgrid. This virtual central storage is able to manage local energy shortage or excess at all times reducing or even eliminating the operation of the auxiliary power systems (diesel generator).
The main benefit derived by the NMPC application is the optimal usage of the renewable energy, through the minimization of the losses. On the other hand, reducing the operation of auxiliary sources offers not only economic benefits (fuel, maintenance), but also environmental, due to reduced carbon dioxide emissions. Adjusting the operation of sensitive hydrogen devices (water electrolysis device and fuel cell) to the optimal is another economic benefit, since the cost of purchasing and maintaining these devices and the required infrastructure is high. In short, the use of the NMPC framework, to control and achieve energy balance between the nodes, maximizes the autonomy of the microgrid in terms of profitability, economy and environmental friendliness.

Conflicts of Interest:
The authors declare no conflict of interest.

Appendix A. Indicative Results of Models Verification
Energies 2021, 14, 1082 20 of 23 Acknowledgments: The authors would like to thank the anonymous reviewers for their insightful comments and valuable suggestions on this paper.   Acknowledgments: The authors would like to thank the anonymous reviewers for their insightful comments and valuable suggestions on this paper.