Optimal Management of an Energy Storage Unit in a PV-Based Microgrid Integrating Uncertainty and Risk

This paper addresses an optimized management of a storage energy battery which is part of a microgrid with a connection to the main grid and is supplied by a photovoltaic (PV) power plant. The main contribution of this paper is to consider uncertainty in electricity price while managing the battery storage. The forecasted value for demand and PV unit are predicted by a seasonal autoregressive integrated moving average model (SARIMA)—capable of accurately characterizing both seasonality effects and tail fatness. The optimal operation of the battery is determined by resolving a linear optimization program in which the objective function comprises the conditional value at risk (CVaR). Using CVaR ensures that the demand is fully supplied while minimizing the risk and operational cost. The cost function is the difference between power sold and bought subject to the charging and discharging rates for the battery and defining upper and lower bounds for the level of battery charge. The simulation results confirm that the risk consideration has a significant effect on the optimized management of a storage energy battery in a photovoltaic grid-connected microgrid.


Introduction
A major portion of the electricity currently produced in the world is still generated by centralized systems, based on nuclear power or fossil fuel plants. Changes in the operational and regulatory nature of traditional power plants and the emergence of low voltage power generation systems, as well as grid connection, have paved the way for alternative opportunities for the generation of energy close to the load by the consumers themselves, that is, the distributed generation (DG) of the generated electric energy, demand response (DR), and energy storage system (ESS) [1][2][3]. However, this path leads to the rise of new challenges for the power system management [4].
The potential of DG can be better understood if used in certain subsystems called microgrids. A microgrid uses DG to supply electricity to the connected customers in a local area grid. Some literature has provided solutions for the emerging microgrid and its planning. In ref. [5,6], a new control method which combined thermal comfort optimization in one hand and demand response management in the other hand is presented. In ref. [7] optimization programming based on multiagent control for two centralized and decentralized demand responses is suggested. In ref. [8] a comprehensive review of the latest topologies for the isolated PV microinverters is studied. In ref. [9] On the other hand, in some publications, the energy management is considered by an online model predictive control (MPC) method [28,29]. Although the MPC can enhance the robustness by its feedback mechanism, their performance is limited due to the complexity of modeling and its associated errors. In ref. [30] a scheme is proposed to increase the resiliency of a microgrid which is equipped with PV and battery storage. This is accomplished by considering the uncertainty in the electricity price and the generated power. In ref. [31] a unit commitment model based on a two-stage stochastic method is proposed which considers demand response and energy storage. In ref. [32] stochastic optimization is formulated in two stages, where the decisions made regarding the battery charging and discharging and the ultracapacitor in the first stage do not change in the second stage. In ref. [33] a virtual power plant, including a conventional power plant, renewable power generations, and an energy storage system, is presented in order to find the maximum profit while committing to its bilateral contracts. Nevertheless, most of the literature on optimal energy management in power systems, including the mentioned references, minimize the cost or maximize the profit regardless of the uncertainty consideration in the price, the demand, and renewable energy sources. This is not sufficient for an efficient and optimal energy management and it is needed to incorporate uncertainty and risk measure in the problem formulation. In ref. [34] the uncertainties of day-ahead programming are studied under different scenarios.
In ref. [35] an online optimal energy storage control method is suggested which considers the uncertainty in the net demand and the renewable power generation prediction. In this case the problem is formulated based on a mixed integer linear program optimization. The authors in ref. [36] studied the risk management topic in electricity and fuel markets. Multidimensional modeling is suggested in ref. [37] with the aim of assessing the performance of a smart grid under risk consideration and managing the load and demand for the purpose of optimization in operation. The model of incorporation of the energy storage device with the distributed renewable energy besides the smart grid structure will support the power performance optimization when it comes to load and demand control. In the last few years, the value at risk (VaR), known as a risk-based optimization, has been proposed in the literature [38]. On the other hand, VaR is known for being a noncoherent risk measure which shows a few limitations, for instance, the absence of coherency and convexity. A fact that deems it quite unattractive for such types of optimization problems [39].
The risk measure known as the conditional value at risk (CVaR) is, on the other hand, a much more coherent one which was recently applied to a certain power grid associated problem, in this case, an optimized energy control model [40]. In ref. [41] an optimum trading of wind power in day-ahead (DA) electricity markets is proposed under uncertainty while taking into consideration the wind power generation and prices. Kernel density estimation is used to create a probabilistic wind power prediction, while the Gaussian distribution is considered for uncertainties in DA and real-time (RT) prices. An optimized risk-constrained offering strategy, which takes into account the CVaR, is proposed in ref. [42] for the electricity market in the case of a hybrid electricity power grid which includes certain elements such as demand response and a wind farm. It is concluded that cooperative operation of demand response users and wind power producers can decrease the possible risks and raise the anticipated revenue. A model which combines large-scale penetration of wind and solar electricity generation with~50% of annual demand with a baseload coal and nuclear generation is proposed in ref. [43] where CVaR is used in the objective function with the aim of optimizing the residual load and then tailoring it in order to fit the baseload generation. In ref. [44] an optimization model of an electric vehicle aggregator is proposed in order to obtain the real-time flexible bidding and day-ahead inflexible bidding under several market uncertainties.
In ref. [34] an optimization model of the day ahead planning and management is presented which takes into account the risk measurement. In this study, a stochastic optimization model is applied under two scenarios including a risk averse and a risk neutral decision. It is demonstrated that the day-ahead scheduling can be changed considerably with risk-based decision-making in microgrids. Moreover, it is shown that determining factors for the savings and risks of the microgrid are the Appl. Sci. 2019, 9, 169 4 of 16 capacity configuration and the variability measures. A CVaR risk aversion model is proposed in ref. [45] with the aim of dynamically schedule a virtual power plant connected with a combined PV, wind, and ESS system and which also takes into consideration the DR and uncertainty. The results showed that the model successfully described the virtual power plant (VPP) risk and provided the decision support means for the decision maker. In ref. [46] a energy trading model is proposed, which happens to be decentralized, in a day-ahead electricity market with renewable energy generation and load aggregators' active participation in DR programs. In this study, in order to reduce uncertainty, CVaR is applied with the aim to limit the possibility of an elevated renewable generation shortage with a well definite level of confidence. Finally, a stochastic two-stage unit commitment for Crete and Lanzarote-Fuerteventura islands with high renewable penetration is proposed in ref. [47] by using CVaR for an effective management of the uncertainty.
This paper presents an online optimal management for a finite time horizon of a grid connected microgrid comprising an intermittent renewable energy source, an energy storage device, and a power demand. The key contribution of this work is the risk consideration of the electricity price which is incorporated into the optimization problem. The goal is to minimize the cost of the electricity while supplying the demand as well as ensuring the operation constraints of the energy storage device. The energy storage device is enforced to have a limitation for its storage level (by not exceeding the upper and lower limits of the ESS level) and a maximum rate for its charging and discharging operations. Finally, the CVaR is used to reach a compromise between operational cost and risk consideration on the price of electricity.

The Measurement of the Risk
In this study we assume that f (x,y) represents a loss related with an array of decision variables x, which in turn is selected from a specific subset X of R n and selected from the random variable y in R m . In this case, the x vector could be understood as an array of existing selections, whereas the uncertainty set is specified by y vector. Thus, the objective is to achieve the optimal solution for the decision vector x by minimizing the cost function of the model which, in vector y, is bound to the uncertainty. As seen in the introduction, VaR is one of the most frequently utilized risk measurements, meaning that it specifically fit for cases in which loss distribution functions with a fat tail behavior are employed [48]. By employing a probabilistic approach where the probability density function of y is represented by P associated with f (x, y) and given a confidence level β, the β-VaR is known as the minimum cost α for all cases in which the loss probability above β never exceeds 1 − β: VaR is a popular risk measure mostly known and generally employed in the financial sector. However, in cases of practical optimization problems, this risk measure is noncoherent and is undermined by undesirable mathematical properties such as the absence of convexity and subadditivity, thus making it quite unappealing for optimization purposes. For this reason, the conditional value at risk (CVaR) is employed in ref. [48] as an improved alternative to VaR, which is also known as mean shortfall or average value at risk. This makes it mostly suitable for practical optimization problems which require a real-time solution. Thus, given the confidence level β, CVaR is given by the following equation.
The above equation specifies the conditional estimated value of the cost, limited to its value surpassing the β-percentile. When compared to typical robust optimization models, minimizing CVaR guarantees a higher flexibility in choosing the objective and could also enhance the performance by utilizing the distributional information on the uncertain parameter y. As a matter of fact, if the CVaR of the cost is minimized it is also minimized the risk of the system being vulnerable to great losses instead of minimizing the worst-case cost scenario. Furthermore, in cases of functions of linear cost, the minimization of CVaR can be expressed as a modest linear optimization problem, making it more suitable for practical applications [49].
By utilizing a sample originating from the distribution of the uncertain parameter y, CVaR is expressed by the following equation.
where, the positive components of z are given by z + , β-VaR is given by α, the number of Monte Carlo routes is represented by M in which the estimated value of β-CVaR in the cost function is assessed, and finally y i specifies the ith uncertain variable's created path. In order to reach a resolution for this problem, it is usually recommended to substitute 0 + with an array of constraints. Thus, the expression of the CVaR minimization is given by the following equation.

Generation of Scenarios by Utilizing a Seasonal ARIMA Model
The probabilistic configuration of the stochastic process Y can be characterized through the identification of the combined distribution of its arbitrary variables. This demonstrates both the connections which occur between all of the variables (also known as statistical dependencies) and the probabilistic way of every random variable on its marginal distributions. In real circumstances, the identification of the combined distribution is usually a challenging and exhaustive effort. However, this can be accomplished if the following postulations are made [50].
(1) The considered combined distribution has to be a multivariate Gaussian distribution and has to be assessed by identifying the average vector and the random variables' variance-covariance matrix constituting the stochastic method. (2) The analyzed stochastic method is deemed stationary, signifying that the variance-covariance matrix and the mean vector do not depend on time t.
As a result, all autoregressive moving average (ARMA) models rely on the above-mentioned two assumptions. On the other hand, such principles are not followed in certain stochastic processes, thus, with the purpose of reaching the wanted proprieties, a few alterations are necessary to be made to the process. Furthermore, occasionally, several time series events, such as monthly, indicate a seasonality trend which signifies a relation among observations registered in the course of a comparable period of time in consecutive time series. The seasonal tie is not the only one, another connection is the relation among observations noticed in the course of a successive period. Such an observation can be noticed, for instance, for the load demand in certain smaller periods during the course of the month which indicates a closely matching profile each week and each day, thus creating an example of both weekly and daily seasonality. For the case in this study, the quotidian seasonality shows that a seasonal pattern of a 24 order is considered for an hourly load demand series, thus, signifying that the demand of day d − 1 at hour h is similar to the load of day d at hour h. This similarity is easily verified in cases of a weekly seasonality, in which the seasonality order is consequently 24 × 7 = 168. For such types of conditions, a seasonal autoregressive integrated moving average method (SARIMA) becomes much better suited in detriment of ARMA. This is due to the fact that SARIMA, by being an improvement of the ARMA model, takes into account the potential seasonal unit roots and, specially, the seasonality [51]. Given a stochastic problem featuring a seasonality of order S, the overall equation of the SARIMA method with the subsequent parameters (p,d,q) × (P,D,Q) s is represented by the following expression.
With a seasonal component of P the autoregressive parameters are ϕ 1 , ϕ 2 , . . . , ϕ P , with a Q moving average parameters ϑ 1 , ϑ 2 , . . . , ϑ Q and a with a differentiation order D. For the case of this study, the load demand and the PV generation, by displaying time-varying features, are described by the SARIMA method.

Optimal Energy Management Based on the Minimization of the Conditional VaR
In this paper a microgrid in grid-connected operating mode is considered, including a renewable energy source, i.e., PV, an energy storage device, i.e., a battery, and a power demand as depicted in Figure 1. The output power supplied by the PV systems is given by Equation (6), as follows [52] where, the output power of the module at irradiance G I NG is represented by P PV , P STG represents the maximum power of the module at standard test conditions (STC), the incident irradiance is given by G I NG , P STG stands for the irradiance at STC 1000 × w m 2 , the temperature coefficient of power is given by k, and T r and T C represent the reference temperature and the cell, respectively. average parameters and a with a differentiation order D. For the case of this study, the load demand and the PV generation, by displaying time-varying features, are described by the SARIMA method.

Optimal Energy Management Based on the Minimization of the Conditional VaR
In this paper a microgrid in grid-connected operating mode is considered, including a renewable energy source, i.e., PV, an energy storage device, i.e., a battery, and a power demand as depicted in Figure 1. The output power supplied by the PV systems is given by Equation (6), as follows [52] where, the output power of the module at irradiance is represented by , represents the maximum power of the module at standard test conditions (STC), the incident irradiance is given by , stands for the irradiance at STC , the temperature coefficient of power is given by k, and Tr and TC represent the reference temperature and the cell, respectively. The considered rolling horizon time could be transformed to be discrete into N intervals of a duration of while the demand of the power is supplied by any of the following, the ESS, the PV, or by the grid at every time step. According to Figure 1, for , eight decision variables are available and are shown in the following expression.
Where, specifies the quantity of power moved commencing in unit i and ending in unit j in the given the time step t. In the equation, the superscripts D, G, PV, and S each represent the demand, grid, PV, and ESS, respectively. In this case is the quantity of the ESS at the t th time step. Assuming that st is given, is then equal to , The considered rolling horizon time could be transformed to be discrete into N intervals of a duration of ∆t while the demand of the power is supplied by any of the following, the ESS, the PV, or by the grid at every time step. According to Figure 1, for t = 1, 2, . . . , T N , eight decision variables are available and are shown in the following expression.
where, P ij t specifies the quantity of power moved commencing in unit i and ending in unit j in the given the time step t. In the equation, the superscripts D, G, PV, and S each represent the demand, grid, PV, and ESS, respectively. In this case s t is the quantity of the ESS at the tth time step. Assuming that s t is given, s t+1 is then equal to where, S Battery is the maximum capacity of the battery and η C is the charging efficiency. Regarding the mentioned assumption, the cost, which is imposed to the microgrid system owner while exchanging power with the grid in each time step, is represented by the following expression (9).
where, C GD t , C GS t , C SG t and C PVG t are the electricity prices and η D is the discharging efficiency. In order to keep the model simple, equal values are given for the prices i.e., C GD t = C GS t = C SG t = C PVG t = C t which is acceptable in the majority of the electricity markets. Thus, Equation (10) expresses the cost function as follows.
As a consequence, the cost incurred by the owner of the system is identical to the profit achieved from the power supplied to the load demand by the ESS and the renewable energy resource and subtracting the cost of the grid supplied power. Thus, at every time step for an optimum operation a straightforward policy would be the minimization of the cost at tth stage through the resolution of the subsequent linear optimization equation: In this paper such a strategy will be further labeled as the simple policy. Even though the aforementioned policy is quite direct, it does not take into account the effect of choices on the ESS level future condition. So it cannot be a practical stimulating model. The risk neutral policy is another option to the abovementioned strategy since it takes into account the global cost over the predicting time horizon. This policy can be assessed by resolving the subsequent linear programming equation: As a result of the volatility and unpredictable features of the electricity prices, the neutral policy cannot be, at the same time, a proper method for the ideal energy management since it overlooks the fat tail characteristic of the electricity price. Therefore, it is necessary to take into account the uncertainty and the risk and at the same time looking for an optimized method to manage the battery performance. In addition, a different option exists for a neutral and simple policy and this option is called the risk averse policy. This policy is created integrating the cost function expressed by Equation (9) inside the VaR minimization shown by Equation (4). By considering the aforementioned risk averse policy, besides ESS constraints and limitations, the subsequent linear programming equation will be represented by the following equation.
Subject to (P GD t C GD t  22) in which w represents the weighting factor for concerning the risk, P PV t represents the total generated power from PV, and D t is the power demand at each time step t. The constraint (17) specifies that the PV's overall produced power is directed to the demand of the load. The constraint represented by Equation (18) represents the power demand which is entirely provided by the grid, ESS, or PV. S max and S min represent the maximum and minimum admissible charge level of the ESS and the constraints (19) and (20) and indicate that the amount of storage of the ESS in the succeeding time step continues larger than S min and smaller than S max , respectively. Moreover, 0 ≤ ∆S C ≤ 1 and 0 ≤ ∆S D ≤ 1 give the highest volume for charging. Finally, the discharging rate and constraints (21) and (22) inhibit the ESS to discharge or charge more rapidly when compared to the conventional rates for the duration of each time step.

Simulation Results
With the purpose of studying the accuracy of the suggested method the simulation outcomes are further shown. Thus, for this purpose, the case study presented in Chapter 4 and shown in Figure 1 is utilized to analyze and study the proposed strategy. The electricity prices were taken from [53] while the vital information concerning the PV's insolation of is given by National Renewable Energy Laboratory (NREL) and can be found in [54]. Additionally, the theoretical load demand is related to a standard microgrid. Table 1 gives all the necessary characteristics of the ESS. With the intention of having a realistic estimation of the PV generation and demand, the seasonality effect is considered in their modeling. It is assumed that 3 MW is the rated power of the PV. The PV generation and demand are shown over the time horizon of 168 h in Figures 2 and 3, respectively.     4-6 exemplify the ESS level for the distinct types of management strategies under three confidence levels: β = 0.9, 0.95, and 0.99. As can be seen from the abovementioned figures, the simple policy forces the ESS to be discharged to the lowest possible amount as quick as possible and, yet, maintain it in this setting for the remaining duration of the time horizon. Besides, through the use of the risk neutral policy, it will discharge and charge the ESS as soon as the estimated price will be dropping and raising, respectively, while the oscillations of the price of the electricity are not taken into account. Such type of exchanging among maximum and minimum charge levels depends on and . However, the risk averse policy does not show the same type of pattern for all the time horizon and it inserts risk in the optimum planning. Such a policy relies on the confidence level β in a way that the greater the amount for β will result in a heavily distinct behavior while the neutral risk policy produces an optimal management for the battery with a smaller amount of risk and lower exposure to the deviation in electricity price. Moreover, in Figure 7, the battery storage levels for the three different confidence levels β = 0.9, β = 0.95, and β = 0.99 are depicted together in order to show their different response. As the confidence level increases, the battery storage level is changed in order to decrease the amount of risk for supplying the load demand.
Utilizing the risk averse policy could result in a slightly greater operational cost for the system owner, but reduces the risk amount significantly, which the system then has to deal with in the future time. In addition, Figures 8-14 show the power transferred between PV, grid, demand and battery energy storage, specified as decision variables in Equation 6, under the risk neutral and the risk averse policy while using a confidence level β = 0.95. As it can be observed in Figures 8, 10, and 14, which show the power transferred from the grid to demand, PV to grid, and PV to battery storage, respectively; there is not much of a difference between the risk averse and the risk neutral policy, to specify these variables. However Figure 9 demonstrates that power transferred from the Figures 4-6 exemplify the ESS level for the distinct types of management strategies under three confidence levels: β = 0.9, 0.95, and 0.99. As can be seen from the abovementioned figures, the simple policy forces the ESS to be discharged to the lowest possible amount as quick as possible and, yet, maintain it in this setting for the remaining duration of the time horizon. Besides, through the use of the risk neutral policy, it will discharge and charge the ESS as soon as the estimated price will be dropping and raising, respectively, while the oscillations of the price of the electricity are not taken into account. Such type of exchanging among maximum and minimum charge levels depends on ∆S D and ∆S C . However, the risk averse policy does not show the same type of pattern for all the time horizon and it inserts risk in the optimum planning. Such a policy relies on the confidence level β in a way that the greater the amount for β will result in a heavily distinct behavior while the neutral risk policy produces an optimal management for the battery with a smaller amount of risk and lower exposure to the deviation in electricity price. Moreover, in Figure 7, the battery storage levels for the three different confidence levels β = 0.9, β = 0.95, and β = 0.99 are depicted together in order to show their different response. As the confidence level increases, the battery storage level is changed in order to decrease the amount of risk for supplying the load demand. grid to the battery has changed significantly. This shows that risk consideration on the price have a large effect on the performance of the battery storage. In Figure 11 the amount of power transferred from the PV to the battery storage is shown. In contrast to the neutral risk policy, there is no power delivered from the PV to the battery storage if a risk averse method is employed.           BUtilizing the risk averse policy could result in a slightly greater operational cost for the system owner, but reduces the risk amount significantly, which the system then has to deal with in the future time. In addition, Figures 8-14 show the power transferred between PV, grid, demand and battery energy storage, specified as decision variables in Equation 6, under the risk neutral and the risk averse policy while using a confidence level β = 0.95. As it can be observed in Figures 8, 10 and 14, which show the power transferred from the grid to demand, PV to grid, and PV to battery storage, respectively; there is not much of a difference between the risk averse and the risk neutral policy, to specify these variables. However Figure 9 demonstrates that power transferred from the grid to the battery has changed significantly. This shows that risk consideration on the price have a large effect on the performance of the battery storage. In Figure 11 the amount of power transferred from the PV to the battery storage is shown. In contrast to the neutral risk policy, there is no power delivered from the PV to the battery storage if a risk averse method is employed.                    Moreover, Figures 12 and 13 show the injected power from the battery storage to the engagement demand and confirm that power in the grid has increased considerably by using the risk averse policy in detriment to the neutral risk strategy, which shows that ESS is used more actively to optimize the cost function while reducing the risk measurement. This increases the system operational cost to some extent.
However, it strengthens the system against the uncertainty in the electricity price. The confidence level β can control such types of amounts in a way that higher value for β imposes a higher operational cost on the system owner. Thus, in this way, the risk averse policy can protect the system against uncertainty in the electricity price more than the simple and neutral strategies could ever protect.

Conclusions
An optimal management method between PV and battery energy storage in a microgrid was proposed in this paper based on the minimization of the conditional value at risk condition. With the aim of having a more realistic simulation, some constraints related to the battery storage were included in the optimization problem. These constraints were added to prevent the battery charge level to rise above or below certain levels. Furthermore, several constraints specify the rates for the charging and discharging conditions. Real data was used for the simulation and it was then verified that there was a considerable difference between the optimal management under risk consideration and the optimal risk neutral approach. This difference became more significant when the confidence Moreover, Figures 12 and 13 show the injected power from the battery storage to the engagement demand and confirm that power in the grid has increased considerably by using the risk averse policy in detriment to the neutral risk strategy, which shows that ESS is used more actively to optimize the cost function while reducing the risk measurement. This increases the system operational cost to some extent.
However, it strengthens the system against the uncertainty in the electricity price. The confidence level β can control such types of amounts in a way that higher value for β imposes a higher operational cost on the system owner. Thus, in this way, the risk averse policy can protect the system against uncertainty in the electricity price more than the simple and neutral strategies could ever protect.

Conclusions
An optimal management method between PV and battery energy storage in a microgrid was proposed in this paper based on the minimization of the conditional value at risk condition. With the aim of having a more realistic simulation, some constraints related to the battery storage were included in the optimization problem. These constraints were added to prevent the battery charge level to rise above or below certain levels. Furthermore, several constraints specify the rates for the charging and discharging conditions. Real data was used for the simulation and it was then verified that there was a considerable difference between the optimal management under risk consideration and the optimal risk neutral approach. This difference became more significant when the confidence level β of CVaR increased. The simulation results showed that the proposed approach in this paper enhanced the utilization of renewable energy, e.g., PV and wind along with battery storage. By utilizing the proposed method in this paper, in which it was applied a risk averse policy while managing the battery energy storage, the system cost slightly increased when compared to the risk neutral policy. However, it made the system stronger against uncertainty, which is associated to the day-ahead electricity price. For a future work the rolling horizon approach will be taken into account by considering a robust method for uncertainty and trying to find a way to show quantitatively the improvement of the system against uncertainty.

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