1. Introduction
The development of microgrid (MG) technology has provided the opportunity and the infrastructure for improving the efficiency of energy consumption [
1,
2]. Microgrid systems are typically made up of load and distributed energy resources, such as photovoltaics (PV) systems, wind turbines, biogas power plants, fuel cells and energy storage systems (ESS) [
3]. A microgrid can operate in a grid-connected or an islanded mode. The hybrid microgrid system, which comprises different distributed energy resources, has become promising as it provides an integral part of the development of smart grid systems [
4,
5]. However, there are still many challenges in implementing and operating the microgrid, one of which arises due to the intermittent nature of the renewable energy sources (RESs) because of the stochastic nature of the underlying metrological conditions [
6]. A potential solution to this challenge is the integration of a fast-response energy storage system. Energy storage is an important component with great prospects in future power systems, as it plays an important role in alleviating the problem of sudden energy crisis and power shortage in remote areas [
7]. Moreover, the introduction of the hybrid system enhances self-consumption and offers an opportunity to reduce energy costs. The EMS ensures the availability of energy resources during longer time intervals, ensuring that the load demand is met by the total power produced by the distributed energy resources [
8].
Extensive research has been reported previously on the management of microgrids, much of which has focused on mathematical formulations and is usually tested under offline scenarios. However, due to the stochastic nature of the RESs, offline optimization may fail to achieve the optimal result as the uncertainties of the RESs are not considered in real-time. In [
9], a linear mathematical model is suggested to balance the generation and load of a microgrid by minimizing the total operating cost of the system over 24 h. To demonstrate the performance of their approach, a tiered power management system composed of an advisory and a real-time layer was introduced. The advisory layer provided long-term directives to the real-time layer by solving the RH problem offline using the predicted PV and load data. However, this approach was not implemented in real-time using real data; instead, long-term directives from the advisory layer were passed to the real-time layer. In [
10], the economic dispatch problem for total operation and cost minimization in a DC-MG has been formulated and solved with a heuristic method. However, this approach does not enhance the design of the EMS architecture so that it can be easily implemented on a physical system. An intelligent energy management system is defined in [
11] as an architecture that sequentially connected functional modules such as power forecasting, energy storage management and an optimization module for a day-ahead optimal operation of the microgrid. However, this system may produce a bottleneck in the flow of data for real-time operations. These reported works do not deal with the uncertainty of the RESs generation nor the consumption in real-time. To overcome these challenges, an online strategy such as the one proposed in [
12,
13] can be implemented, where energy management systems are designed and implemented by considering the current status of the microgrid, but without consideration of future power generation or load demand. In [
14], an optimal energy/power control method is presented for the operation of energy storage in grid-connected MGs considering forecast electricity usage and renewable energy generation. However, prediction errors due to long-term predictions were not considered. In [
15], a rolling horizon-based energy management strategy is defined for a specific case study. The strategy consists of two stages: a deterministic management model is first formulated, followed by a rolling horizon control strategy. The actions on the microgrid devices respond to an optimization criterion related to the estimation of the future system behavior, which is continually predicted by updatable forecasts to reduce uncertainty in both production capacity and energy demand. However, the proposed optimization model did not consider the control of the ESS in real-time utilizing the predicted PV generation and load demand within the 24-hour time horizon. To address this issue, the current work pays attention to operating the EMS in real-time utilizing the LSTM network, because of its long-term memory for the prediction of variables in systems such as PV generation and load demand.
In this paper, the RH control strategy is utilized to perform the optimization every hour and the LSTM predicts the PV generation and load data for 24 h. The optimal dispatch problem is solved using the MILP algorithm and the dispatchable battery commands for the first hour are applied in real-time. The real data are then used to update the LSTM input and the process is repeated for future time windows. With this approach, the EMS can mitigate the undesirable challenges associated with the PV generation’s stochasticity and real-time power imbalances.
To evaluate the proposed approach, the daily operating cost is compared against a reference benchmark. The proposed hybrid MILP-LSTM optimization framework is executed in two different scenarios:
Simulations have been carried out for different operating conditions covering 12 months.
The microgrid optimal performance is dependent on the ESS charging/discharge times based on the time of use (ToU) tariff of the grid. It is evaluated in terms of the daily operating cost of energy [
9]. The optimal schedule of the grid-connected microgrid is performed through the optimization of the microgrid. The MILP optimization approach is chosen because it presents a flexible and robust method for solving complex problems by making fast energy management decisions via integer decision variables and identifying the best connection between the plants and utilities. It systematically finds the best trade-off in the operation of the microgrid to achieve maximum resource efficiency and minimum operating cost while respecting the system operational constraints [
16]. We have utilized the LSTM-MILP-RH control strategy for the optimization of the grid-connected microgrid while introducing new constraints for controlling the ESS charge/discharge cycle, using the most up-to-date predictions and the latest information about the system, to adapt to new events and operating conditions. The LSTM-MILP-RH (online) approach was compared against the LSTM-MILP (offline) approach, demonstrating that the online optimization approach outperforms the offline approach, and the results are presented in
Section 4.
Table 1 compares the contribution of this paper in terms of other similar methodologies in the contemporary literature.
The rest of the paper is organized as follows:
Section 2 presents the proposed optimal operation of the battery in a grid-tied microgrid, the MILP formulation and LSTM prediction theory. The RH control strategy implementation is explained in
Section 3. In
Section 4, the simulation results are presented, and the conclusion is drawn in
Section 5.
2. Optimal Operation of Battery Using MILP
A schematic of the grid-tied microgrid under study is shown in
Figure 1. The main components of the hybrid system are the PV, ESS and local load. The power flow within the microgrid is illustrated in
Figure 2. The grid connection is represented in the first node and the imported power from the grid,
, at time
is used for the charging of the ESS in the third node and directly supplies the load demand in the fourth node. The second node is the PV supply source, which can also be used to charge the ESS and supply the load demand. The energy demand at all times is met by a combination of power from the PV, denoted as
power from the ESS,
, and power from the grid, as described in (1):
The PV generation should supply the energy demand. When it is insufficient, additional power is imported from the ESS and/or the grid depending on the battery state of charge (SoC) and the grid tariff.
2.1. The MILP Formulation
The MILP is formulated to solve the economic dispatch problem to find the minimum operational cost while satisfying the load demand and respecting imposed constraints. The MILP economic dispatch problem solution results in the optimal power flow through each connection for each time step in the optimization horizon [
17,
18]. To formulate the microgrid scheduling problem, the cost function associated with the MILP and the constraints are defined in (2) as:
where
is the objective function,
is the number of generators in the power system,
is the cost of the generated power by
and
represents the set of constraints for
. The selected optimal solution is implemented on the system equations and the system response, such as the ESS state of charge, charge/discharge power is measured [
9]. The decision variables for the economic dispatch problem are presented in
Table 2.
The state of charge of the ESS and the charge/discharge powers from the ESS,
, are calculated in terms of the decision variables and considered as the system state. For each time step, the total energy of the microgrid system is defined as
. It is important that the optimization process does not schedule ESS charge and discharge simultaneously. Therefore, an inequality constraint is formulated as an integer in (3) as:
The power imported from the grid is formulated as:
The grid and PV powers at any time
can be used to charge the ESS and feed the load. The flow in the network considers the storage capabilities of the ESS and the possible curtailment of the PV. This is represented by the node balance constraints given in (6)–(9) as:
Whenever the PV system produces power greater than the load demand, the excess power is utilized in charging the ESS depending on the SoC. The inequalities in (10) show that the power from the grid and the PV can only be positive parameters, represented as:
The SoC of the ESS must be kept within a safety limit that is defined based on the minimum and maximum SoC of the battery, given in (11) as:
To enforce (11), further constraints are developed in (12) and (13) relating the SoC to the capacity of the ESS and the power flows to and from the battery as:
where,
and
are the charge/discharge efficiencies of the ESS, respectively. Considering (12) and (13), the SoC difference equation can be written as:
where
is the coefficient that converts the ESS charge/discharge power to the charging unit, in percentage.
The important factor here is the SoC, which is modeled based on (11) and (12). In the present study, we consider that the ESS consists of a lead-acid battery, and hence it should be charged fully after a full discharge cycle. This is to prevent the fast rate collapse of the battery voltage during discharge events. The ESS is charged and discharged subjected to maximum charging/discharging rates,
and
. The BESS discharge rate will also not exceed the demand due to constraint (1). To limit the charging/discharging cycle of the ESS to a predetermined constant,
, additional binary integer variables and constraints are introduced based on the ESS technology. First, we define
to be a binary integer variable that represents the charging state of the ESS. The value of
is 0 when
(i.e., the ESS is charging) and
is 1 when
(i.e., the ESS is discharging). We then define an additional binary integer variable at each time step, which is 0 if
and
are the same and 1 if they are different, thereby representing a change in the state of the ESS. The constraints for the implementation of the limits on the charging/discharging cycle of ESS can be summarized as (15)–(19), given by:
The cost of energy for each time step,
, can be calculated within the constraints using (20), as:
where,
, and it is the power utilized from the grid based on the optimal schedule of the microgrid using the RH control strategy, as explained in
Section 3. Since the main objective of this paper is to minimize operational cost, safe operation of the ESS and promote self-consumption, the objective function is formulated as an economic dispatch problem in (21), as:
subject to (1), (3)–(19), as constraints.
2.2. Background of LSTM Prediction Networks
This paper uses LSTM-based deep learning for predicting the load demand and the PV generation for the future, considering one year of historical data from the Ushant Island in France. LSTM networks are a type of Recurrent Neural Networks (RNNs) with modules typically referred to as cells rather than neurons, and they contain series of gates. Each LSTM cell has a form of longer-term memory in the form of a cell state that is updated throughout time [
19]. The LSTM model is trained with the root-mean-squared error (RMSE) loss function, Adam optimizer and a maximum of 300 epochs with a single gradient threshold. RMSE indicates the deviation between the predicted value and the measured value, and it is a measure of the forecasting error [
20]. The PV generation and load demand are predicted for the last day in each month of the year. Before training or testing a neural network, the training and testing data must go through a series of pre-processing steps. Normalization was applied here as the pre-processing method, which reduces the effect of different scaling of the collected data, including interpolating any missing data points and organizing the data (historical PV generation and load demand) in a chronological form [
21]. The normalized data are then used as an input to the LSTM network. The initial predicted PV output power and load demand for the last day of January, May, August and November are shown in
Figure 3 and
Figure 4 respectively, with the RMSE indicating the accuracy of the predictions. To forecast the values of future time steps of the sequence, the training sequence with values shifted by one time step is specified as the response. This means that at each time step of the input sequence, the LSTM network learns to predict the value of the next time step. To predict the next time step, the previous prediction is used as an input to the function [
22].
3. Receding Horizon Control
The RH strategy is a concept adopted from model predictive control (MPC), which operates by using online model-based optimization to determine the current control action [
23]. It is a general-purpose control scheme that involves repeatedly solving a constrained optimization problem, using predictions of future generation and demand over a moving time horizon to choose the control action. The RH control handles constraints, such as limits on control variables, directly and naturally, and generates precisely calculated control actions, respecting the constraints. The basic RH policy is very simple. At time
t, we consider an interval extending
T steps into the future:
t,
t + 1, …,
t +
T, as shown in
Figure 5. We then carry out several steps. For power system scheduling problems with high dependency on the forecasted values of renewable energy productions and demand, this method has been found to effectively correct errors in the prediction of renewable energy generation and load in future iterations [
24]. At each hour, the economic dispatch of the battery is obtained using 24 h data of predicted future renewable energy production and demand using the LSTM network, as explained in
Section 2.2. The optimization outputs are 24 h of dispatch commands, as summarized using the matrix in (22) as:
Here, only the dispatch commands for the next hour are shown (the first column of the matrix is implemented in real-time, and the rest are discarded).
The generation and demand input data to the LSTM are updated to include that of the generation and demand at the current hour . The LSTM is then used to predict data for the next 24 h, and the process is repeated in real-time for each time step. If the time step, , is one hour, the algorithm is repeated times, which represents the number of time steps, , for h of the day. The RH final solution is the optimal schedule of the renewable energy source and the grid power for supplying the load and charging the battery.
The RH control strategy allows for the improvement of the forecasting errors for each iteration of the economic dispatch problem, since the feasibility of economic dispatch and optimality depends on the accuracy of prediction of the renewable generation in power systems [
9].
4. Simulations and Results
To solve the optimization problem, a case study was developed considering data from the Ushant Island project in France under the Intelligent Community Energy (ICE) program to test the proposed approach for the real-time operation of the microgrid energy sources [
25]. The proposed energy management system simulation was performed in MATLAB with a 32 GB 64-bit operating system computer, dual core i7, 2.70–2.90 GHz. The average computational time of the simulation was about 8.89 ± 2.12 s using this computer, over 12 months.
Figure 1 illustrates the Ushant Island model, which has the following parameters: 3 MW PV system, grid connection and 2400 kWh battery ESS capacity. The daily ToU electricity tariff rate is shown in
Table 3. The characteristics of the ESS, such as the capacity, the SoC limits or bounds and the initial SoC, are shown in
Table 4.
To evaluate the proposed real-time energy management of the microgrid, the simulation was carried out considering two scenarios. For the first scenario, as seen in the EMS flow model in
Figure 6, the optimization is performed in real-time considering the RH technique using the real-time and predicted data simultaneously, with the real-time data used to update the input of the LSTM. The optimal daily operating cost for the 24 h horizon is recorded, while in the second scenario, as seen in
Figure 7 it considers a day-ahead offline optimization using predicted data only, the ESS command is applied online with real data and the optimal daily operating cost is recorded.
The available historical data were utilized on a monthly basis by predicting the PV generation and load demand of the last day of every month. The BESS operation starts from its minimum SoC of 50%, with a maximum charging/discharging power of 300 kW.
The results of the simulations for the microgrid dispatch are shown in
Figure 8 when the battery charge/discharge cycle was limited to two for January, May, August and November, representing the four seasons of the year, with background colors representing the ToU tariff regions. Since the battery charge/discharge cycle is limited to two using (15)–(19), the battery starts charging at the beginning of the day when the ToU tariff is at its lowest rate (the green region), discharges when the ToU tariff is at its highest rate (the red region) and starts charging again when PV power becomes available or during the mid-peak ToU tariff (pink region), and finally discharges during the second peak of the ToU tariff. This charge/discharge pattern of the battery is consistent throughout the year and makes it easy to calculate the life of the battery ESS based on the standard lifecycle vs. the depth of discharge (DOD) curve of batteries.
A day-ahead schedule based on an offline optimization was performed with the predicted PV power and load demand for the second scenario using the MILP optimization approach. The MILP module, as shown on the EMS flow model in
Figure 7, calculates the set-points for the dispatchable resources 24 h ahead based on predicted resources. The grid and the ESS are the dispatchable energy resources, which means the power output can be controlled while the PV system and the load demand are varying resources or non-dispatchable resources. The ESS command obtained from the offline day-ahead optimization was implemented in real-time on real data, as shown in
Figure 7. The daily operating cost for the 24 h horizon was calculated. To evaluate the effectiveness of the proposed approach, the simulations were performed for the last day of every month, the monthly historical data were trained using the LSTM network and the last day of the month was predicted. Both scenarios were tested every month, and the daily optimal operating cost was compared against a benchmark in which the forecasted data are the same as the real data. This is a non-practical situation, but it will help us to evaluate the effectiveness of the two scenarios.
Figure 9 shows the daily optimal operating cost of the microgrid for the last day of every month of the year, for the benchmark, the real-time with RHC and the offline optimization using predicted data. The simulation results show that the operating cost of the proposed real-time strategy outperformed the offline optimization strategy by 3.3%. The details of the total percentage difference between the two scenarios and how close they were to the benchmark are shown in
Table 5.
5. Conclusions
This paper presented an EMS to minimize the daily operating cost and control the charge/discharge cycle of ESS in a grid-tied microgrid, while guaranteeing the security of supply and respecting imposed constraints. The optimality of this approach was evaluated based on the daily operating cost of energy. Furthermore, the result from simulation studies carried out on the two scenarios considering different sets of data throughout the year shows that the online optimization adopting the LSTM-MILP-RH (online) control strategy was more effective in terms of reducing the daily operating cost when compared to the LSTM-MILP (offline) optimization approach, with the benchmark daily operating cost set as a reference. The approach is general enough to be used with different ToU tariff models and could be applied to commercial, residential and standalone microgrids.
Finally, since ESS degradation depends largely on the charging/discharging cycles, this approach guarantees a longer life for the ESS as the utilization of the ESS charging/discharging cycle limiting constraint is implemented in both scenarios. In this case, the charging/discharging cycle has been limited to two cycles.
Further research needs to be carried out in sensitivity analysis, distributed demand side management, considering different ToU tariffs (i.e., UK economy 7, UK economy 10 and UK standard tariff), to observe the effect of the ToU tariff on the battery charge/discharge cycle limits and how a change in the battery charge/discharge cycle limit will affect the daily operating cost of the microgrid.