Optimization Models under Uncertainty in Distributed Generation Systems: A Review

: Distributed generation systems (DGSs) are one of the key developments enabling the energy transition. DGSs provide users with increased control over their energy use and generation, but entail greater complexity in their design and operation. Traditionally, optimization models have been used to overcome this complexity, and currently, research is focusing on integrating uncertainties on them. This review attempts to analyze, classify and discuss 170 articles dealing with optimization of DGSs under uncertainty. A survey has been performed to identify the selected manuscripts and the strengths and weaknesses of previous reviews. As a result, an innovative classiﬁcation has been designed and the distinct elements of optimization models in DGSs have been highlighted: microgrid architecture, sources of uncertainty, uncertainty addressing methods, problem types and formulations, objective functions, optimization algorithms and additional features. Each part is detailed thoroughly to provide an instructive overview of the research output in the area. Subsequently, several aspects of interest are discussed in depth: the future of dealing with uncertainty, the main contributions and trends, and the relative importance of the ﬁeld. It is expected that this review will be of use to both experts and lay people to learn more about the current state of optimization models in DGSs and provide insights into how to further develop this ﬁeld.


Introduction
Currently, climate change awareness is increasing around the world. Companies and governments are diverting more resources to confront this issue. This stance is especially evident in the European Union, where the Fit for 55 package has recently been passed [1]. This new set of policies intends to accelerate the transition from the current centralized fossilfueled energy model to one where clean electricity has become the primary energy source.
Distributed generation systems (DGSs) are expected to play a significant role in this transition. DGSs are local-scale, clean and smart energy generation facilities that are connected to the customer side of the grid. DGSs empower individuals and communities to have a greater control over their energy supply and its externalities-energy sovereignty [2]. Therefore, the development of DGSs appeals to various agents and from different points of view: consumers who want to increase their energy sovereignty, policymakers who desire to accomplish certain environmental goals and investors seeking to profit from this new and promising sector.
DGSs offer a greater degree of flexibility compared with traditional centralized systems. This flexibility manifests in several ways: storing electricity for future needs, selling energy to other users via a peer-to-peer market, automating the starting time of controllable devices and providing ancillary services to the grid operator. Therefore, the management and design of DGSs are not trivial tasks. Optimization models have been widely proposed

Methodology
A pool of 170 articles, comprising references , has been considered in this review. All of them are research papers which introduce an optimization model in the field of DGSs and consider uncertainty in one or more SoU. To identify the articles of this pool, several queries have been performed on the Scopus database. The queries included a combination of keywords related to the principal topics of this review: optimization, DGSs and uncertainty.
Next, the results were filtered to include exclusively research articles from the last five years (2016 to mid-2021). The selected articles were published by Elsevier, IEEE or MDPI publishing companies, which include several of the most impactful journals in the energy sector. The following criteria have been used to select the final pool of articles: currency (the source pertains to the aforementioned period, and has not been outdated by more recent studies), authority (the authors are affiliated with a reputable university or organization), reliability (the manuscript contains facts and not personal opinions, and references are appropriate) and coverage (articles must cover in depth a problem of DGS under uncertainty). Articles dealing with technical aspects of microgrids or RE forecasting, two major topics in the DGS field, were excluded. This methodology is schematized in Figure 1.
After thoroughly reading the articles in the pool, a classification system was developed, providing an overview of the key features of optimization models in DGSs. Hence, the optimization model is divided into two major parts: the uncertainty characterization and the mathematical model. To the best of the authors' knowledge, this is the first time such a classification has been introduced in the field of DGSs. It is expected to provide a better understanding of the state of the art in the field, and aid to identify potential starting points for new research.

Microgrid Architecture
Microgrids are structures which integrate DGSs, distribution lines, loads and flexibility devices. Microgrids can be classified according to their mode of operation and power type [14]. With regard to their operation mode, microgrids can be grid-connected or islanded. A grid-connected microgrid is connected to the transmission or distribution network through a point of common coupling. Therefore, it can trade energy with the main grid, and DGSs may be able to participate in the wholesale market through an aggregator [103]. An islanded or stand-alone microgrid is not coupled with a bigger network. DGSs are the only source of energy that can satisfy the loads; therefore, the flexibility requirements are much higher (more storage capacity, load shifting or generation curtailment). Microgrids can also switch the mode of operation, for example, to ensure system stability in case of a contingency. As shown in Figure 2a, the optimization of DGSs under uncertainty has been observed in both grid-connected and islanded microgrids. Some articles even consider grid contingencies as SoUs (Section 4.1.4).
work. DGSs are the only source of energy that can satisfy the loads; therefore, the flex ity requirements are much higher (more storage capacity, load shifting or generation tailment). Microgrids can also switch the mode of operation, for example, to ensure tem stability in case of a contingency. As shown in Figure 2a, the optimization of D under uncertainty has been observed in both grid-connected and islanded microg Some articles even consider grid contingencies as SoUs (Section 4.1.4). centage of articles that consider each microgrid power type. Note: in many articles, the power is not explicitly mentioned, but assumed from the microgrid topology.
With regard to power type, microgrids can be AC, DC, or hybrid AC/DC [186] microgrids distribute the energy of DGSs through a DC bus. These can more effecti integrate DC generation sources such as PV and fuel cells, and storage elements suc batteries and ultracapacitors. AC microgrids distribute energy through an AC bus, w can easily be coupled with the main grid, most loads, turbines and engines. Inverter needed to connect DC sources to AC microgrids, and rectifiers for the opposite. Each ergy conversion process entails energy losses and an increase in system complexity. brid AC/DC microgrids, consisting of both AC and DC buses, attempt to minimize number of unnecessary conversion processes, leading to a greater integration of D loads, and flexibility devices. As shown in Figure 2b, most articles assume an AC or hy AC/DC setting, although the power type is not explicitly mentioned in many cases.

Renewable Generation
The electricity mix is progressively including RE sources which, in addition to being dispatchable, have a strong spatial and temporal variability. A system with a penetration of these sources faces substantial uncertainty about its final energy pro tion. To reduce it, these systems are usually coupled with energy storage, diesel gen tors or the electrical grid. Relying on this equipment entails an increase in mainten (battery degradation with its use), emissions (fuel burned by the auxiliary generator) costs (electricity purchased from the grid). An accurate prediction of generated en reduces dependence on these devices, lengthening the system lifespan, cutting emiss and reducing the electricity bill. This is the reason why RE generation supplies are most employed SoU in the scientific literature.
The most widespread RE sources used in DGSs are PV solar and wind. To cons the uncertainty of PV generation, it is often sufficient to analyze a single variable: the s irradiance [187]. In the case of wind power, each wind turbine is defined by a curve states the generated power as a sole function of wind speed. Therefore, wind speed i only SoU accounted to forecast wind power. With regard to power type, microgrids can be AC, DC, or hybrid AC/DC [186]. DC microgrids distribute the energy of DGSs through a DC bus. These can more effectively integrate DC generation sources such as PV and fuel cells, and storage elements such as batteries and ultracapacitors. AC microgrids distribute energy through an AC bus, which can easily be coupled with the main grid, most loads, turbines and engines. Inverters are needed to connect DC sources to AC microgrids, and rectifiers for the opposite. Each energy conversion process entails energy losses and an increase in system complexity. Hybrid AC/DC microgrids, consisting of both AC and DC buses, attempt to minimize the number of unnecessary conversion processes, leading to a greater integration of DGS, loads, and flexibility devices. As shown in Figure 2b, most articles assume an AC or hybrid AC/DC setting, although the power type is not explicitly mentioned in many cases.

Renewable Generation
The electricity mix is progressively including RE sources which, in addition to not being dispatchable, have a strong spatial and temporal variability. A system with a high penetration of these sources faces substantial uncertainty about its final energy production. To reduce it, these systems are usually coupled with energy storage, diesel generators or the electrical grid. Relying on this equipment entails an increase in maintenance (battery degradation with its use), emissions (fuel burned by the auxiliary generator) and costs (electricity purchased from the grid). An accurate prediction of generated energy reduces dependence on these devices, lengthening the system lifespan, cutting emissions and reducing the electricity bill. This is the reason why RE generation supplies are the most employed SoU in the scientific literature.
The most widespread RE sources used in DGSs are PV solar and wind. To consider the uncertainty of PV generation, it is often sufficient to analyze a single variable: the solar irradiance [187]. In the case of wind power, each wind turbine is defined by a curve that states the generated power as a sole function of wind speed. Therefore, wind speed is the only SoU accounted to forecast wind power.

Load
The aggregated demand of a region or a country shows some regularities. However, the smaller the group of consumers, the more volatile their demands. In a small community, the overall load can exhibit drastic changes between different time intervals [188]. Thus, load is also considered an SoU by several papers.
A number of factors exist that can significantly alter load. Each consumer has different appliances, work schedule, habits and financial capacity. In addition, buildings have different uses and numbers of people inhabiting them. These factors can be difficult to Energies 2022, 15, 1932 6 of 40 know in advance or frequently changed. Therefore, for simplicity, the SoU considered in most papers is the load itself and not its underlying factors.

Electricity Price
Electricity tariffs can be either flat or time-of-use (ToU). Typically, only residential consumers opt for flat tariffs. Corporate consumers can purchase electricity for a fixed price too, in the form of a power purchase agreement [189], but ToU tariffs are still widely used.
A ToU tariff consist of different parts, mainly: cost of energy, charges and taxes. Charges and taxes are usually static and known in advance, whereas the cost of energy depends on factors such as the country's actual demand, nuclear and renewable availability, and the price of commodities. ToU tariffs in their various pricings (static, real-time, variablepeak and critical-peak [190]) incorporate this uncertainty into the bill. Thus, the electricity price under ToU tariffs is regularly considered a SoU.

Islanding Events
In many developed countries, the access to the grid is taken for granted and the connection is stable enough to provide a high security of supply. However, in developing countries or rural settings, the likelihood of an outage is not negligible.
Islanding events can be characterized by their starting time and their duration [47]. One or both of these magnitudes can be modelled. If the duration of the outage is assumed to be uncertain, the problem is usually modelled in two levels: the upper level refers to the normal operation of the microgrid, whereas the lower level is devoted to the operation in islanded mode, until the contingency resolves [175].

EV Availability and State of Charge
It is expected that EV penetration-both pure and plugged-in hybrid-will continue to increase. EV chargers are also being deployed in private households and industries [191].
In essence, an EV can function as intermittent storage, an additional flexibility device that DGS users can utilize. However, to avoid compromising their comfort, it is imperative not to limit the time that the vehicle can be used nor the travel distance. Hence, both the availability and state of charge of EV [133] are SoUs worth considering in energy management optimization.

Economic Parameters
When computing the profitability of DGSs, it is necessary to determine the cashflows in each year. Economic and regulatory parameters are crucial for their proper calculation. However, most authors do not introduce them in the computation because they are unknown or difficult to determine.
The following economic parameters can be uncertain in a long-term feasibility analysis: incentives, tax benefits, ancillary services rewards, emission coefficients, feed-in tariffs, operation and maintenance costs, re-investment costs, inflation rates and surplus charges [75]. This list is not comprehensive, but it shows the importance of accounting for economic uncertainty when designing a DGS. Despite this, economic and regulatory parameters are the least considered SoUs, as Figure 3 shows.

Sensitivity Analysis and What-If Analysis
Sensitivity analysis is the most straightforward method to capture uncertainties. In a sensitivity analysis, one input parameter of the model is changed at a time, and its effect on the output is evaluated. This evaluation enables determination of the significance of the parameter variability on the output. This technique has been used to check the effect of economic assumptions in a DGS model [75], and for overcoming uncertainty in meteorological data and load [40]. Closely related, a what-if or scenario analysis varies several input parameters at a time, which results in different scenarios or cases. This technique has been employed to capture the effects of uncertainty on the optimal dispatch, as well as to evaluate the demand response potential [82]. However, the scenarios chosen in sensitivity and what-if analysis are arbitrary in most cases, leading to an incomplete picture of the SoU behavior.
Energies 2022, 15, x FOR PEER REVIEW 7 of 42 economic uncertainty when designing a DGS. Despite this, economic and regulatory parameters are the least considered SoUs, as Figure 3 shows.

Sensitivity Analysis and What-If Analysis
Sensitivity analysis is the most straightforward method to capture uncertainties. In a sensitivity analysis, one input parameter of the model is changed at a time, and its effect on the output is evaluated. This evaluation enables determination of the significance of the parameter variability on the output. This technique has been used to check the effect of economic assumptions in a DGS model [75], and for overcoming uncertainty in meteorological data and load [40].

Probability Distribution Functions (PDF)
The most common way to address uncertainty in DGS is by the use of PDFs. Beta PDF has been used extensively to characterize solar radiation [149]. Beta distribution is characterized by the following equation: where α and β are the shape parameters of the distribution, and x is the uncertain parameter scaled to the interval [0,1]. For solar radiation, typical parameter values are α = 4 and β = 2 [192]. Weibull accurately characterizes different scenarios of wind speed [57]. For a given wind speed v, the Weibull PDF is given as: where k is the shape parameter and c is the scale parameter, closely related to the mean wind speed. When k = 2, the distribution is also called the Rayleigh distribution. The generated wind power is derived from the resulting speed and the wind turbine's power curve. Solar radiation [20] and other SoUs such as the demand profile [182], islanding duration [47] and EV availability [111] can be modeled with a normal distribution. Table 1 provides a classification of the different theoretical PDFs employed for the most common SoUs. Sometimes, it can be preferable not to fit the SoU to any known distribution, but rather to an empirical distribution which matches the most with the available data [9]. This method has been applied to an hourly aggregate load profile and data from a PV station [133], and to electricity price as well [46]. Under this method, SoUs are assumed to behave as the parameters of the chosen PDF indicate. This behavior is guaranteed in the long run, which means that estimates of monthly or annual outputs of the SoU match the values observed in reality. However, values in consecutive time intervals are not necessarily related.

Time Series
A time series model forecasts the future possible values of an SoU using its historical values. A desirable property of any time series is stationarity [193], which means that the PDF of the values does not depend on the time at which the series is observed. If an SoU is not stationary, it is imperative to apply a transformation before applying a time series model. For example, solar radiation is not stationary: its pattern shows regular day and night cycles. A common approach is to model the clear-sky index, which is the result of dividing the solar radiation by the theoretical radiation that would reach the Earth under clear-sky conditions [194].
The most typical time series model is the autoregressive integrated moving average (ARIMA) [22], which can be extended with conditional heteroskedasticity (GARCH) [9] and seasonal components (SARIMA) [153]. In contrast to the theoretical PDF approach, time series models guarantee a coherence of the values in consecutive time intervals, but fail to capture the long-term trends.

Risk Measures
Risk is defined by the deviation of the expected outcome. In the energy sector, SoUs are difficult to predict; therefore, risk measures help identify the probability that DGS operation results are worse than expected. This risk is often incorporated in the objective function to minimize it.
The most common risk measure in energy management models is the conditional value-at-risk (CVar) [58,124]. CVar assesses the tail risk, meaning the most disadvantageous outcomes of a random variable. Formally, it is the expectation that the value of the variable exceeds the value-at-risk, which is the maximum potential loss that can occur with a degree of confidence.

Uncertainty Budget
Uncertainty budgets or sets include the values for the uncertain parameters in a robust optimization problem [195]. The simplest uncertainty set is the interval-based set, where the uncertain parameters are constrained between two predefined values [196]. The interval set can be generalized to the multi-interval set [129], which can overcome the conservativeness of traditional robust models.
A more general version is the polyhedral uncertainty set, in which the feasible region, meaning the values that the SoUs can have without violating any constraint, is a polytope. Polyhedral uncertainty sets have been used for addressing wind and solar power uncertainties [177].
Other uncertainty sets (such as ellipsoidal or conic) can be formulated depending on the goals and characteristics of the problem, and they determine the complexity of their robust counterparts (e.g., linear, quadratic or nonlinear).
Robust models optimize the objective function under the worst possible realization of the chosen uncertainty set. That is why this UAM is commonly called the worst-case scenario [8].

Point Estimate Method
PEM refers to the 2m or 2m + 1 PEM as defined by Hong [197]. The PEM makes use of the statistical information contained in the first central moments of a variable. These are calculated on 2 points for each variable, named concentrations. Each concentration can be defined as a pair of values: location and weight. The location is the value of the variable, and the weight is used for evaluating its relative importance in respect to other points. A deterministic problem has to be solved twice for each random variable, at the two locations of the random variable and the mean of the remaining (m − 1) variables. The 2m PEM has been used to model uncertainties in load, market prices and renewable output [143].
The 2m + 1 variant needs one more evaluation on the means of all the m input random variables. This variant is used in [45] to estimate uncertainties in renewable output, load and market prices.
The PEM is considered computationally inexpensive, although its main drawback is that a distribution of the random variables must be assumed [198].

Machine Learning (ML)
The advance of artificial intelligence has led to a great development in the field of ML. ML algorithms can deal with uncertainties in DGS. Among them, artificial neural networks (ANNs) stand out because of their ability to handle nonlinear or changing relationships between variables. No previous information about the system is required; only an input of data.
A basic ANN consists of a series of layers, namely, the input layer, the hidden layers and the output layer. Each layer comprises a number of nodes which are connected to the nodes of the previous and next layers. Each node receives the outputs of the previous nodes, called activations (except in the input layer, where it receives the input data), performs some operations and sends its output to the following layer. For energy forecasting, architectures with several layers are normally used [80,171]. Transformations of the input data, such as the wavelet transform [138], can also be used to improve the forecasting performance.
Another ML algorithm that has gained relevance in DGS is the support vector machine (SVM). SVM is a supervised learning method employed to classify data by defining a hyperplane between two categories of observations. The closest datapoints to the hyperplane are called the support vectors, and the SVM objective is to maximize the distance from the hyperplane to those points.
When the problem is nonlinear and a plane cannot be used to separate the two categories, SVM can use kernels, which are functions that project the data into a higher dimensional space, where the categories are linearly separable. SVMs with Gaussian kernels have been presented in the literature [164].

Fuzzy Logic
Fuzzy logic is involved in optimizing a problem with imprecisely defined model parameters. Some methods make use of random variables; however, fuzzy logic is based on fuzzy set theory.
Fuzzy sets contain elements that do not completely pertain to them, but rather have a degree of membership. In classical sets, membership is a binary term (1 means that the element belongs to the set, and 0 the opposite). However, in fuzzy sets, the membership is a function of a real variable defined between 0 and 1.
In [185], fuzzy logic is applied to a controller to smooth power peaks and variability. The controller comprises a set of fuzzy rules and variables characterized by triangular membership functions. As an analogy, the results of the function in fuzzy logic controllers are not black or white, but different shades of grey [199].
In addition, fuzzy set theory can be generalized to form possibility theory, which is an alternative to probability theory at handling uncertainties [200]. Probability theory uses only one metric (probability) to capture the uncertainty of an event, whereas possibility theory uses two, possibility and necessity.

Markov Chains
A Markov chain is a stochastic process in which the probability of a state at any step of the process only depends on the previous states [193]. The order of the Markov chain is the number of previous states in consideration, and the probability of switching from one state to another is time-independent.
To apply a Markov chain, the amplitude range has to be broken into several discrete states. Then, a transition matrix that includes the probability of switching from one state to another is created. The matrix parameters are determined by the input data of the SoU [193]. Inter-day variation in wind speed has been formulated as a Markov decision process [145]. Additionally, a combination of Markov chain and Monte Carlo has been used on time series of wind speed and solar radiation [63].
One of the principal advantages of Markov chains is that they give both a point forecast and an estimate of the PDF associated with it. Furthermore, it only requires an input of data [193] and makes no assumptions about its distribution.
In summary, the number and percentage of articles that consider each UAM are visualized in Figure 4.

Day-Ahead Energy Management
The most frequent problem in the field of optimization of DGS under uncertainty is day-ahead energy management, also called scheduling. In this setting, the goal is to establish the setpoints of the decision variables, normally the generated power of each source. Other decision variables that may appear in this problem are the flows of energy between each source and consumption, the energy storage level and the voltage levels on each bus.
Setpoints are established at the time of the program execution, normally one day in advance, for the 24 h of the following day, although other time horizons can be considered. The time resolution varies in each problem, but for day-ahead scheduling, it is typically set to 1 h. This type of program is equivalent, according to classical control theory, to level 3 control systems (see Figure 5), typically applied to production planning problems. Other decision variables that may appear in this problem are the flows of energy between each source and consumption, the energy storage level and the voltage levels on each bus. Setpoints are established at the time of the program execution, normally one day in advance, for the 24 h of the following day, although other time horizons can be considered. The time resolution varies in each problem, but for day-ahead scheduling, it is typically set to 1 h. This type of program is equivalent, according to classical control theory, to level 3 control systems (see Figure 5), typically applied to production planning problems.

Online Management
Online management refers to level 1 and 2 control systems (see Figure 5), which fix the setpoints of generated power, voltage and frequency continuously, or in a very short time span. It must not be confused with real-time control, which ensures that those setpoints are attained and are resilient to disturbances [202]. These articles fit into level 0 or level 1 control systems, out of the scope of this review.
The goal of online energy management is to create more accurate setpoints than dayahead energy management. To create these setpoints, data must be acquired and updated in minutes or seconds. Data can include forecasts of SoUs, setpoints of previous offline optimizations and the current status of the system. The setpoints are then established according to an objective function that must be minimized. After the optimization, the obtained setpoints are applied by the real-time controller. Table 2 shows the analyzed articles that perform online management and the time span of the updating process. It is worth noting that some articles employ the concepts 'online' or 'real-time' just to announce that simulations can run without supervision, even though the time step is not small enough to create accurate setpoints.

Online Management
Online management refers to level 1 and 2 control systems (see Figure 5), which fix the setpoints of generated power, voltage and frequency continuously, or in a very short time span. It must not be confused with real-time control, which ensures that those setpoints are attained and are resilient to disturbances [202]. These articles fit into level 0 or level 1 control systems, out of the scope of this review.
The goal of online energy management is to create more accurate setpoints than dayahead energy management. To create these setpoints, data must be acquired and updated in minutes or seconds. Data can include forecasts of SoUs, setpoints of previous offline optimizations and the current status of the system. The setpoints are then established according to an objective function that must be minimized. After the optimization, the obtained setpoints are applied by the real-time controller. Table 2 shows the analyzed articles that perform online management and the time span of the updating process. It is worth noting that some articles employ the concepts 'online' or 'real-time' just to announce that simulations can run without supervision, even though the time step is not small enough to create accurate setpoints. In a sizing or design problem, the maximum capacities or power rates of the components of the DGS are obtained. This problem often integrates energy management constraints, performing both tasks at the same time. Sizing problems fit into level 4 control (see Figure 5), and have a very direct practical implementation in the real world.
These problems do not explicitly consider a time horizon, although a facility lifetime is assumed for net present value (NPV) calculations. Perfect forecasts are not needed because the goal of designing under uncertainty is to test the system under different conditions. However, this does not mean that uncertainty can be neglected: a deterministic approach normally leads to oversizing or undersizing the facility, by considering a scenario which does not simulate the real operating conditions [46,140].

Trading
The trading problem focuses on the interaction between the users of the DGS and the market. Usually, the trading considers several agents, and it is assumed that their goal is to maximize their benefits. These agents can be users of the DGS, or the market and network operators. Offline energy management problems try to find the optimal solution under the consumers point of view, whereas trading problems consider diverse points of view, with interests that may be conflicting. Accomplishing a solution that can benefit all the parties is difficult, but it is typically achieved by using an objective function that bears similarities to social welfare in electricity markets [21].

Expansion Planning
Similar to the design problem, the expansion planning goal is to define the maximum capacity of the new elements of the network. However, expansion planning problems are classically used in big and already established networks, where big power plants must be built to satisfy the new demand.
Even though this is not a problem that deals exclusively with DGS, it has been included because modern formulations of expansion planning consider RE sources and uncertainties [93], making it not differ excessively from design problems.
In summary, the number and percentage of articles that deal with each problem type are shown in Figure 6.

Economic
The most widespread objective functions in DGSs are economic (see Figure 7a). Most authors share the practical vision that optimizing the finances of DGSs is crucial for their proper development. Each paper considers different terms in their cost functions, but almost all coincide in the need of maximizing benefits-in sizing problems, where the initial investment is stated-or minimizing operating costs-in management problems. classically used in big and already established networks, where big power plants must be built to satisfy the new demand.
Even though this is not a problem that deals exclusively with DGS, it has been included because modern formulations of expansion planning consider RE sources and uncertainties [93], making it not differ excessively from design problems.
In summary, the number and percentage of articles that deal with each problem type are shown in Figure 6. Share of each problem type in the total number of problems analyzed in the pool of articles. Note: each article may deal with more than one problem type. Self-elaboration.

Economic
The most widespread objective functions in DGSs are economic (see Figure 7a). Most authors share the practical vision that optimizing the finances of DGSs is crucial for their proper development. Each paper considers different terms in their cost functions, but almost all coincide in the need of maximizing benefits-in sizing problems, where the initial investment is stated-or minimizing operating costs-in management problems. Operating costs can often be minimized along with other variables, such as power losses and overall implementation expenses [54]. Other economic functions can be observed, using indicators such as NPV [93], earning before interests, tax, depreciation and amortization (EBITDA) [19], or social welfare [134] in the case of problems with multiple agents.

Environmental
DGSs are more sustainable than traditional centralized systems, but they also coexist with other energy sources such as traditional grid or diesel generators. Therefore, an environmental objective function seeks to maximize the output of clean energy sources even though when other sources could be cheaper or more convenient.
Environmental functions are often employed as a secondary objective in multi-objective formulations, subordinated to the economic goals. However, some authors consider that environmental and economic goals are intrinsically related. Conventionally, the environmental metric considered is the emissions of carbon dioxide [44], although other metrics can be considered such as the equivalent environmental cost [184], the self-consumption rate [131], fuel costs [35] or non-clean energy use [159].

Economic
The most widespread objective functions in DGSs are economic (see Figure 7a). Most authors share the practical vision that optimizing the finances of DGSs is crucial for their proper development. Each paper considers different terms in their cost functions, but almost all coincide in the need of maximizing benefits-in sizing problems, where the initial investment is stated-or minimizing operating costs-in management problems. Operating costs can often be minimized along with other variables, such as power losses and overall implementation expenses [54]. Other economic functions can be observed, using indicators such as NPV [93], earning before interests, tax, depreciation and amortization (EBITDA) [19], or social welfare [134] in the case of problems with multiple agents.

Environmental
DGSs are more sustainable than traditional centralized systems, but they also coexist with other energy sources such as traditional grid or diesel generators. Therefore, an environmental objective function seeks to maximize the output of clean energy sources even though when other sources could be cheaper or more convenient.
Environmental functions are often employed as a secondary objective in multi-objective formulations, subordinated to the economic goals. However, some authors consider that environmental and economic goals are intrinsically related. Conventionally, the environmental metric considered is the emissions of carbon dioxide [44], although other metrics can be considered such as the equivalent environmental cost [184], the self-consumption rate [131], fuel costs [35] or non-clean energy use [159].

Reliability
In certain cases, it is more critical to ensure the reliability of the DGS rather than optimize their economic or environmental efficiency. Reliability is a general term that includes many different concepts (see Figure 7b): the inconvenience cost of load shifting [37], the peak to average demand ratio [18], the risk of mismatch [137], meaning when energy buyers are not able to find sellers and vice versa, the total voltage deviations in

Reliability
In certain cases, it is more critical to ensure the reliability of the DGS rather than optimize their economic or environmental efficiency. Reliability is a general term that includes many different concepts (see Figure 7b): the inconvenience cost of load shifting [37], the peak to average demand ratio [18], the risk of mismatch [137], meaning when energy buyers are not able to find sellers and vice versa, the total voltage deviations in islanded mode [165], or the energy losses [74].

Multi-Objective Approaches
Different criteria to design or to manage DGSs are valid and provide valuable findings. When these criteria, which can be conflicting, need to be considered at the same time, it is imperative to use multi-objective formulations.
Multi-objective approaches can be developed as single objective functions which integrate two or more goals. Penalties have handled RE curtailment and load shedding in the same economic objective function [146]. The weighted sum method has been used to minimize cost, emissions, and expected energy not supplied, reducing the problem to a single objective [127].
An alternative approach is to create a Pareto front. A Pareto front contains the range of optimal solutions, balancing the contributions of the different objectives. The augmented Epsilon constraint has been used to obtain a Pareto front that balances operational costs and air pollution [151]. Other methods that can be used to obtain a Pareto front are multi-objective metaheuristic algorithms [16] and fuzzy decision-making [47]. These approaches are classified in Figure 8.
tegrate two or more goals. Penalties have handled RE curtailment and load shedding in the same economic objective function [146]. The weighted sum method has been used to minimize cost, emissions, and expected energy not supplied, reducing the problem to a single objective [127].
An alternative approach is to create a Pareto front. A Pareto front contains the range of optimal solutions, balancing the contributions of the different objectives. The augmented Epsilon constraint has been used to obtain a Pareto front that balances operational costs and air pollution [151]. Other methods that can be used to obtain a Pareto front are multi-objective metaheuristic algorithms [16] and fuzzy decision-making [47]. These approaches are classified in Figure 8.

Classical
A classical optimization problem minimizes an objective function subject to a series of constraints. This is the favorite approach for deterministic settings, but many authors also prefer this structure for stochastic problems because of its simplicity. The model proposed by Ghasemi [55] is a typical example of a classical optimization framework. This formulation returns the optimal solution for a set of given parameters but is very inflexible at incorporating uncertainties.

Scenario-Based
Uncertainties can be effectively integrated by using different scenarios in the formulation of the problem. Each scenario covers a realization of the parameters of the model, and is characterized by a certain probability of occurrence or weight.
A scenario-based formulation does not imply a scenario analysis as a UAM. In a scenario-based formulation, different scenarios and their weights are generated with methods such as Monte Carlo simulation [64] or Latin hypercube sampling [39]. The objective function is then optimized considering the expected value of the solution for all the scenarios [26]. In a scenario analysis, on the other hand, input parameters are manually modified, and the objective function only considers one particular scenario at a time.

Classical
A classical optimization problem minimizes an objective function subject to a series of constraints. This is the favorite approach for deterministic settings, but many authors also prefer this structure for stochastic problems because of its simplicity. The model proposed by Ghasemi [55] is a typical example of a classical optimization framework. This formulation returns the optimal solution for a set of given parameters but is very inflexible at incorporating uncertainties.

Scenario-Based
Uncertainties can be effectively integrated by using different scenarios in the formulation of the problem. Each scenario covers a realization of the parameters of the model, and is characterized by a certain probability of occurrence or weight.
A scenario-based formulation does not imply a scenario analysis as a UAM. In a scenario-based formulation, different scenarios and their weights are generated with methods such as Monte Carlo simulation [64] or Latin hypercube sampling [39]. The objective function is then optimized considering the expected value of the solution for all the scenarios [26]. In a scenario analysis, on the other hand, input parameters are manually modified, and the objective function only considers one particular scenario at a time.

Two-Stage Stochastic Programming (2SSP)
Two-stage stochastic programming (2SSP) is a more general case of the scenario-based analysis, in which the decision variables of the program can be divided in two stages: the first-stage, or 'here-and-now' decisions; and the second-stage, or 'wait-and-see' decisions. The two stages are divided by the moment of realization of the SoU. This means that an optimal decision has to be made on the first stage without knowing what could happen to the random variables in the second stage.
In practice, the equivalent deterministic form is employed. In this formulation, every uncertain parameter is characterized as a finite number of scenarios, which occur with a certain probability. Two well-known indices can be used to assess the quality of the

Multi-Stage Stochastic Programming (MSSP)
Two-stage stochastic programming (2SSP) assumes that every uncertain parameter is realized just after the first-stage decisions are taken. However, the uncertainties might rather be realized sequentially over time, depending on the previous decisions. Then, it is more appropriate to use MSSP.
MSSP considers an unspecified number of stages, each of which includes the realizations of the uncertainties at the previous stage as input values [121]. As in 2SSP, the deterministic equivalent is commonly used. However, it is imperative to include non-anticipativity constraints to fix the decisions on each stage, ignoring the uncertain realizations in future stages.
A classification of the articles that deal with uncertainty in DGS with a stochastic formulation is presented in Table 3. Table 3. Classification of stochastic programming mathematical formulations.

Robust Programming
Robust optimization seeks to incorporate a certain degree of robustness against uncertainty in the input data. A robust solution can be defined as one that stays optimal, feasible or at least acceptable under any realization of the uncertainties. This is overly restrictive; therefore, it is common to define an uncertainty set or budget, in which all the realizations are contained [203].
Other ways to account for robustness can be included in the model, in addition to uncertainty budgets. For example, adjustable robust optimization combines features of MSSP in the sense that uncertainty is revealed progressively through periods [104]. Additionally, regret optimization tries to minimize the maximum relative regret, which is the difference between the cost of the decisions taken and the best possible decision in hindsight [107].

Chance Constraints
In optimization models, constraints are usually "hard", in the sense that they must be satisfied by any feasible solution of the model with absolute certainty. Conversely, a constraint which has to be met just with a certain probability is called a chance constraint.
To solve a model with chance constraints, they must be decoupled into deterministic constraints, by the use of cumulative distribution functions [204]. Chance constraints have been widely applied in power systems to ensure that demand is met with a certain confidence level [144]. Table 4 details the articles that deal with uncertainty in DGS with a robust or chance constraints formulation. Table 4. Classification of robust and chance constraints programming mathematical formulations.

Robust Formulation References
Robust programming [

Rolling Horizon (RH)
Most of the model formulations that account for uncertainty do so with the aid of forecasts. Long-term forecasts are extremely difficult to obtain with accuracy. Therefore, there exists the view that energy management must be implemented within the shortest possible span, to not depend on forecasts excessively. RH allows this, by repeatedly solving an optimization model over a reduced period, called prediction horizon. The prediction horizon moves forward in time during each solution step. In [98], the prediction horizon moves on a daily basis, and results are given with an hourly resolution.
RH obtains non-anticipative solutions, meaning that only the available information contained in the prediction horizon is used. It models a more real situation, unlike by assuming a long-term forecast is certain. In addition, the forecasts are updated at each solution step, improving the accuracy of the model. RH has been proven to reduce the computational time of large-scale problems [205], although the large number of simulations can be daunting if the problem is nonlinear in nature [206].

Model Predictive Control (MPC)
The equivalent of RH in real-time management is MPC. Both are considered dynamic formulations because they need to solve an optimization problem in each time step over a finite horizon. In MPC, the current state, the input and output measurements are used to calculate a future control sequence that optimizes a given performance metric. This control sequence is used as an input in the next step, and simulations are repeated for the whole planning horizon. MPC can be used along with RH for short-term operational analyses [66]. Table 5 shows the articles that deal with uncertainty in DGS with a dynamic formulation.

Game Theory
Optimization models traditionally assume that the objective function only involves one agent, which is the one who usually runs the model. However, situations exist in which several agents are able to influence the outcomes of the model. Moreover, these agents may have conflicting interests [207]. For example, market clearing models need to account for the needs of both electricity consumers and electric utilities. Additionally, in situations of high RE penetration, the distribution system operator may need to preserve grid stability, introducing another conflicting interest.
Game theory models are developed especially for these situations when each player acts only on their knowledge base and towards their own interests. Formulations include multi-agent systems [103,112], Cournot games [72], Stackelberg games [33,51,71], Shapley value [93] and Kelly criterion [32].
In summary, Figure 9 shows the number and share of articles that use each problem formulation.
In summary, Figure 9 shows the number and share of articles that use each problem formulation.

Linear/Mixed Integer Solver
Linear programming (LP) is used to solve an optimization problem by maximizing or minimizing a linear function subject to linear constraints. It is highly desirable to formulate optimization problems as LP. Linear functions are convex and linear constraints define a convex feasible region; thus, it is guaranteed that the optimal solution is indeed a global optimum.
LP can be extended to accommodate integer and binary variables. Then, the program is called mixed-integer linear programming (MILP). MILP maintains the desirable properties of LP: low computational burden and assurance of a global optimum.
Conventional solvers integrate a state-of-the-art version of the Simplex algorithm, as well as various interior point methods to efficiently solve LP and MILP. Among them, CPLEX is the most common commercial solver that tackles both LP and MILP problems efficiently (see Table 6).

Linear/Mixed Integer Solver
Linear programming (LP) is used to solve an optimization problem by maximizing or minimizing a linear function subject to linear constraints. It is highly desirable to formulate optimization problems as LP. Linear functions are convex and linear constraints define a convex feasible region; thus, it is guaranteed that the optimal solution is indeed a global optimum.
LP can be extended to accommodate integer and binary variables. Then, the program is called mixed-integer linear programming (MILP). MILP maintains the desirable properties of LP: low computational burden and assurance of a global optimum.
Conventional solvers integrate a state-of-the-art version of the Simplex algorithm, as well as various interior point methods to efficiently solve LP and MILP. Among them, CPLEX is the most common commercial solver that tackles both LP and MILP problems efficiently (see Table 6).

Convex Solver
The generalization of LP is convex programming (CP). CP involves optimizing a convex objective function over a set of convex constraints. As well as in LP, it is ensured that the optimal solution identified is global. However, the computational complexity is increased. Quadratic, second-order cone and semidefinite programming fit into the category of CP.
The most established algorithms to solve convex programs are interior-point methods. In contrast to Simplex, which searches the optimal solution in the vertices of the feasible region, interior-point methods use a barrier function to find the optimal solution inside the feasible region [208]. Common commercial convex solvers include Gurobi and CVX, although nonlinear solvers can deal with these types of problems as well, and even CPLEX is prepared to include quadratic objectives (see Table 7).

Nonlinear Solver
Nonlinearities in the objective functions or constraints may be essential to formulate a mathematical program. When this happens, two possible approaches can be taken: relaxing the nonlinearities to convert the program into a CP, or solving the nonlinear program (NLP) as it is originally formulated.
When this second approach is preferred, several algorithms can be employed. Commercial solvers incorporate advanced algorithms such as generalized reduced gradient (CONOPT), augmented Lagrangian (MINOS, DICOPT), sequential quadratic programming (SNOPT, fmincon) and branch and bound (BARON, SBB) [209] (see Table 8). However, the computational burden of NLP is high, and there is the risk of the algorithm falling into a local optimum, leading to a sub-optimal solution.

Metaheuristic Algorithms
Metaheuristic algorithms are extensively used in NLP because they achieve a quality solution with low computational requirements, in contrast to conventional solvers where these tend to be expensive. A heuristic is defined by a strategy that finds a solution by trial and error. Metaheuristics are superior algorithms that implement and modify various heuristics to achieve a better-quality solution.
A number of metaheuristic procedures have been applied to DGS with success. Some of the most prominent are swarm-based algorithms such as particle swarm optimization (PSO), ant colony optimization or firefly algorithm (see Table 9). Swarm-based algorithms are based on the concept of swarm intelligence [210], systems of non-intelligent entities exhibiting collective intelligent behavior.
PSO, the most commonly employed metaheuristic algorithm in DGS, is inspired by natural phenomena such as bird flocking and fish schooling [122]. The algorithm starts by generating random candidate solutions, called particles. Each particle has two properties, position and speed, which are dynamically changing on each iteration of the algorithm, covering the search space of the problem. The changes depend on the particle's current properties, its experience and other particles' experience [155]. When the predefined number of iterations is met or the particles converge, the algorithm terminates. Table 9. Swarm-based metaheuristic algorithms employed in the DGS literature.

Reference
Swarm-Based Algorithm [85] Ant lion algorithm [34] Competitive swarm optimization [38,123] Crow search algorithm [64] Cultural PSO co-evolutionary [18] Dragonfly algorithm [24,132] Firefly algorithm-modified [164] Flower pollination algorithm [28] Grasshopper optimization algorithm [141] Group search optimization [45] Imperialist competitive algorithm [16,49,62,105,[111][112][113]122,150,155,175] PSO [25,68,94,139] PSO-modified Other extensively used algorithms include genetic and evolutionary algorithms (see Table 10). Genetic algorithms are inspired by natural selection, as described in Darwin's theory [211]. Random initial solutions, called individuals, are generated by the algorithm. Each individual has a series of properties, called chromosomes, and a fitness value that must be optimized. In each iteration, a new population of individuals is created using three operators: selection, crossover and mutation. Two parent individuals are selected according to their fitness values. Then, these individuals' chromosomes are combined with a crossover probability, and some random changes are made to the chromosomes of the new individuals with a mutation probability. This process is repeated until the termination criteria are met.
One of the most popular variants of the genetic algorithm for multi-objective applications in DGSs is the non-dominated sorting genetic algorithm II (NSGA-II). In this variant, parents are selected according to their degree of non-domination (a better relative performance for all objectives), and their crowding distance (proximity to other solutions). Differential evolution is another popular algorithm closely related to the genetic algorithm. However, it is not biologically inspired, and mutation does not mix chromosomes (binary values), but vectors with real numbers according to a certain scheme [212]. Table 10. Genetic or evolutionary metaheuristic algorithms employed in the DGS literature.

Reference
Genetic/Evolutionary Algorithm [48] Analog ensemble [106] Bat algorithm-modified [23] Bird-mating optimization [23,139,169,184] Differential evolution algorithm [180] Evolutionary predator and prey [54,89] Exchange market algorithm [29,63,97,102] Genetic algorithm [100] Harmony search algorithm [31] Krill herd algorithm-modified [47,138] NSGA-II [76,122] Rule-based/custom algorithm [87] Symbiotic organism search algorithm [143] Whale optimization algorithm In summary, Figure 10 shows the number of articles that use each type of optimization algorithm and their shares. To define electricity lines, parameters such as resistance, reactance and capacity must be stated. Obtaining real-life setups is not always possible; therefore, some researchers use pre-defined test feeders provided by IEEE or CIGRE (see Table 11). [47,138] NSGA-II [76,122] Rule-based/custom algorithm [87] Symbiotic organism search algorithm [143] Whale optimization algorithm In summary, Figure 10 shows the number of articles that use each type of optimization algorithm and their shares. To define electricity lines, parameters such as resistance, reactance and capacity must be stated. Obtaining real-life setups is not always possible; therefore, some researchers use pre-defined test feeders provided by IEEE or CIGRE (see Table 11).

Battery Aging Model
All physical components of DGSs suffer wear. Wear is normally a linear process that depends on the components' use or the time since they were acquired. However, battery lifetimes are principally affected by four magnitudes [213]: temperature, state of charge (SoC), depth of discharge (DoD) and velocity of discharge (C-rate). The higher the temperature, DoD and C-rate, and the more extreme the SoC, the more severe the battery degradation will be. Optimal energy management can decisively influence the battery lifetime by considering these parameters.
Habitually, the battery lifetime is measured as the number of cycles that it can perform when the aforementioned parameters take certain values. Therefore, the battery aging model is essentially a cycle counting model. An aging cost can be introduced instead of the cycle counter to simplify the model (see Table 12). Table 12. Battery degradation models employed in the articles.

Demand-Side Management
With the rise of smart plugs, intelligent controllers and Internet of Things (IoT), the concept of demand response or demand-side management gained a lot of traction. Demand response models can displace controllable loads to a time where they would be more beneficial to run from an economic, environmental or comfort perspective.
Demand response is, as storage, a flexibility measure that can adapt consumption to generation and tackle uncertainty caused by load and other SoUs. It has displayed very promising results in all studies it has been applied, whether it is an incentive-based demand response [69], time-based [122] or price-based [178].

Correlation
In most studies, SoUs are modelled independently, without considering their influence on other SoUs. However, some SoUs do indeed influence each other. For example, there is a negative correlation between solar irradiance and wind speed: there tends to be more wind during the night and cloudy days. Alternatively, the demand could tend to be higher when there is no sun because heating devices are required. Therefore, several methods to account for correlation have been introduced in the articles (see Table 13).

Linearization
As mentioned in Section 5.4.3, when facing a problem with a nonlinear nature, two approaches can be taken: solving the NLP as it is, or relaxing the problem.
A relaxation, or linearization, is the process of transforming the nonlinear equations of the model into equations that can be supported by a convex or MILP solver. A relaxation can be proposed because an assumption in the physical model makes simplifying the constraint without losing accuracy possible; or because some mathematical properties allow representing the same nonlinear constraint with simpler terms.
The most straightforward examples are piecewise linear functions (see Table 14), which only require linear and binary variables to represent a complex nonlinear function [86]. Table 13. Methods employed in the articles to integrate correlation between variables.

References
Linearization Technique [17,22,38,58,73,78,118,134,136,158,161,167,181] Auxiliary variables [37,51,53,61,67,82,99,129,130,176] Big m method [43,51,60,170] Convex relaxation [52,163] Diagonal quadratic approximation [21,53,177] Dual theory [129,158] Geometric approximation [21,34,35,[37][38][39]78,86,99,101,110,124,146,158,160] Piecewise linear functions 5.5.6. Decentralization The execution of an algorithm normally takes place in a single computer or controller. This approach suffers issues of security, because if this single node fails, the optimal energy management cannot be implemented anymore. On top of that, if this node is in charge of controlling the facility production, the facility may cease operating. Moreover, there are problems in which several agents are involved, and those agents will not commonly agree to use the same node for performing the calculations, especially when there are conflicting interests between the parties.
To tackle these problems, several papers have proposed decentralized or distributed formulations. In a decentralized formulation, an algorithm breaks a full optimization problem into several sub-problems or sub-routines, each of which is solved by a different controller. A number of algorithms are well-suited for solving problems in a distributed fashion, such as the alternating direction method of multipliers (ADMM) [107] and analytical target cascading (ATC) [52] (see Table 15). Decentralized algorithms are expected to flourish in the near future because of the surge of blockchain. Blockchain allows, among other applications, the integration of community energy markets that share distributed energy resources in a more efficient manner [214].
Energies 2022, 15, 1932 26 of 40 In summary, Figure 11 shows the number of articles that consider each additional feature. 6. Discussion

About the Future of Dealing with Uncertainty
Most contemporary optimization models in the field of DGSs acknowledge uncertainty. However, the scientific community has not reached an agreement on the best ways in which uncertainty has to be addressed (see Figure 4), nor which SoUs are most important to analyze (see Figure 3). RE generation (Section 4.1.1) remains the most considered SoU by an ample margin (see Figure 3). The combination of solar and wind has proven to be reliable when coupled together with a flexibility device, such as the main grid or energy storage [141]. It is foreseen that these devices will experience major improvements in the coming years. In the case of batteries, active developments are taking place with the aim of improving their energy density and lifespan [215]. In addition, the electrical grid will be able to accommodate more renewable power with the aid of dispatchable generators, interregional transmission, stationary energy storage and demand response [12]. Therefore, the production of RE will be more controllable in the future, reducing the needs of forecasting.
Reducing forecasting needs does not mean that uncertainty analysis will become irrelevant; quite the opposite. Dealing with uncertainty will become even more relevant, but analysis will be realized more in the short-term, rather than ubiquitous long-term problem formulation (Sections 5.3.1-5.3.4). This change will suppose an evolution of the UAMs that will be employed in the literature. Currently, the conventional approach to deal with uncertainties is in an open-loop manner. This term, borrowed from control theory, illustrates how uncertainties are addressed by generating scenarios from PDFs or by considering uncertainty intervals, but without retrofitting that enables updating of the scenarios and intervals based on the current state of the system. In contrast, the closedloop approach employs short-term accurate forecasts and uses all available data, including the current state, to continually update and improve the uncertainty analysis. Dynamic approaches such as RH and MPC (Sections 5.3.7 and 5.3.8) are inherently closedloop approaches, but this does not mean a typical stochastic or robust approach cannot be modified to include retrofitting.
Therefore, it is expected that traditional UAMs, such as sensitivity analysis or theoretical PDFs (Sections 4.2.1 and 4.2.2), will become less relevant, in favor of more dataintensive methods such as ML, fuzzy theory and Markov chains (Sections 4.2.7-4.2.9). ML algorithms, such as neural networks and SVM, are able to handle complex nonlinear relationships without any previous assumption on the system [216]. The increase in computational power to execute algorithms more efficiently and manage larger datasets will also

About the Future of Dealing with Uncertainty
Most contemporary optimization models in the field of DGSs acknowledge uncertainty. However, the scientific community has not reached an agreement on the best ways in which uncertainty has to be addressed (see Figure 4), nor which SoUs are most important to analyze (see Figure 3). RE generation (Section 4.1.1) remains the most considered SoU by an ample margin (see Figure 3). The combination of solar and wind has proven to be reliable when coupled together with a flexibility device, such as the main grid or energy storage [141]. It is foreseen that these devices will experience major improvements in the coming years. In the case of batteries, active developments are taking place with the aim of improving their energy density and lifespan [215]. In addition, the electrical grid will be able to accommodate more renewable power with the aid of dispatchable generators, interregional transmission, stationary energy storage and demand response [12]. Therefore, the production of RE will be more controllable in the future, reducing the needs of forecasting.
Reducing forecasting needs does not mean that uncertainty analysis will become irrelevant; quite the opposite. Dealing with uncertainty will become even more relevant, but analysis will be realized more in the short-term, rather than ubiquitous long-term problem formulation (Sections 5.3.1-5.3.4). This change will suppose an evolution of the UAMs that will be employed in the literature. Currently, the conventional approach to deal with uncertainties is in an open-loop manner. This term, borrowed from control theory, illustrates how uncertainties are addressed by generating scenarios from PDFs or by considering uncertainty intervals, but without retrofitting that enables updating of the scenarios and intervals based on the current state of the system. In contrast, the closed-loop approach employs short-term accurate forecasts and uses all available data, including the current state, to continually update and improve the uncertainty analysis. Dynamic approaches such as RH and MPC (Sections 5.3.7 and 5.3.8) are inherently closedloop approaches, but this does not mean a typical stochastic or robust approach cannot be modified to include retrofitting.
Therefore, it is expected that traditional UAMs, such as sensitivity analysis or theoretical PDFs (Sections 4.2.1 and 4.2.2), will become less relevant, in favor of more data-intensive methods such as ML, fuzzy theory and Markov chains (Sections 4.2.7-4.2.9). ML algorithms, such as neural networks and SVM, are able to handle complex nonlinear relationships without any previous assumption on the system [216]. The increase in computational power to execute algorithms more efficiently and manage larger datasets will also help these algorithms to thrive in the DGS sector, not only in the scientific literature, but also in real-life applications.
Additionally, the SoUs under consideration will also grow. As mentioned before, RE generation is currently the most employed SoU, but now it is common to find articles that consider more than one of them. Especially load (Section 4.1.2), which even with demand response programs will be highly uncertain [188]. Dynamic tariffs are still prevalent [217], and it is in fact an incentive for the use of energy storage (e.g., using arbitrage [169]); therefore, it is expected that they will keep being applied in the following years. However, the SoU that is expected to grow the most is EVs. It is expected that there will be 137 million EVs by 2030, up from an estimated 11 million units in 2020 [218], and even those which do not have chargers may be able to plug the vehicle in around community areas or in public parking spaces. Therefore, uncertainty related to this intermittent storage-hours of availability and storage capacity-will have to be considered to effectively manage future microgrids. As a final remark, it is expected that policies on RE will become more complex in most countries. Therefore, the economic benefits of DGS will be subject to regulatory uncertainty [219], and this will have to be considered in future models if the results are to be accurate.

About the Articles' Main Contributions and Trends
When researchers build an optimization model for DGS, they have to face a dilemma. Some relationships between variables are nonlinear in nature; however, as mentioned in Section 5.4.3, models encounter some difficulties at handling nonlinearities. Therefore, model builders may either omit these relationships, simplify them with a relaxation (Section 5.5.5) or make use of a complex algorithm that is able to handle nonlinear problems (Sections 5.4.3 and 5.4.4). All these approaches are more or less equally used in the literature (see Figure 10), but the latter is particularly relevant, especially because of the surge in metaheuristic algorithms. Indeed, one of the main contributions that such articles present is the development of an innovative metaheuristic algorithm to solve a nonlinear optimization problem. This algorithm is usually benchmarked against conventional solvers and other metaheuristic algorithms to prove its validity. This is the reason why 26 different metaheuristic algorithms have been observed in the pool of 170 articles (see Tables 9 and 10). The use and benchmarking of a new algorithm has proved sufficient to guarantee a meaningful contribution in the field. However, the scientific community has still not reached an agreement on which algorithm is superior. Judging by the numbers, the PSO algorithm is the most employed metaheuristic algorithm in the literature, even in the most recent articles. However, from time to time, an algorithm appears, claiming to beat PSO in terms of accuracy and computational resources; the discussion is all but over. Consequently, it is expected that more metaheuristic algorithms will appear in the DGS literature in the following years.
In addition to ML and data science, one recent and major disruptive technology with applications in DGSs is blockchain [214]. Blockchain is expected to impact the DGS field in aspects such as energy billing, wholesale energy trading, demand response and peerto-peer markets [220]. Energy management will also change. Currently, most models adopt a centralized approach in which a single controller gathers all the data, performs the computation and establishes the value of the different decision variables. Distributed and decentralized approaches (Section 5.5.6) have been found residually in the literature: only 11 of the 170 analyzed articles used a decentralized formulation. However, with the surge of this technology, it is expected that decentralized models will gain prevalence in the coming years. Blockchain has not yet been observed in optimization models that consider uncertainty, but the same algorithms that are applied to these models (e.g., ADMM) have also been observed in models that consider blockchain [221].
The trading problem (Section 5.1.4), which is one of the less observed (see Figure 6), is expected to gain importance in the coming years, and models that integrate energy management and trading mechanisms are sure to provide an important contribution in state-of-the-art DGSs.
Overall, models tend to incorporate more features as time advances: more SoUs are analyzed, more complex UAMs are developed, there is further sophistication in the formulation or the solving method, and more additions such as demand response. Instead of modelling the load curve as an uncertain parameter, models that consider demand response (Section 5.5.3) include a set of tasks or consumptions that can be activated at a specified time [20,148]. It is expected that the IoT will make demand response more agile and flexible [222]; thus, models that aim for applications in real settings will have to consider it.
The validation of the model is typically performed in a virtual setup, consisting of a predefined grid model. The most used testbed is the IEEE 33-bus system [223], which consists of a radial distribution network. This setup is usually modified to include RE sources and variable loads. Experimental validations in real setups are not common; therefore, this might be a valuable contribution in future articles.
Regarding correlation between variables (Section 5.5.4), very few models acknowledge it (14 of 170), although it is expected that novel data-intensive methods to deal with uncertainty will manage correlations effectively in the future. Finally, the implementation of a battery aging model (Section 5.5.2) is still a complex task, because most models incur in nonlinearities at counting the cycles. However, it is considered a matter of great importance because batteries are some of the most expensive components in DGSs [224], and not optimizing their lifespan will surely cause economic losses to the customers. Currently, the most accurate algorithm to count the number of cycles is the Rainflow counting algorithm, although it is nonlinear. On the other hand, some models employ an approximate degradation cost, but do not consider all the mechanics of the aging process. Thus, integrating the battery model into energy management optimization is a promising line of research that will surely be developed in the near future.

About the Relative Impact of the Field (Meta-Analysis)
It is also interesting to discuss how the field of optimization of DGSs under uncertainty is being accepted by researchers all around the globe. Iran and China are the indisputable leaders in scientific research in this field (see Figure 12). Both countries have almost the same percentage of publications from the article pool that has been gathered for this review. It is especially remarkable in the case of Iran, which has a much smaller population than China, but manages to top the scientific production ranking in this field. The United States is the third country by volume of articles, far behind the first two, but still with a notable scientific production. The European Union, on the other hand, is lacking behind other developed countries and regions in terms of research output in the field, despite claiming to be leading the energy transition. Developed countries such as Australia, South Korea and Canada follow the European Union in the number of publications, despite having much smaller populations. Other countries that have also dived into this field are India, Malaysia, Singapore, the United Kingdom and Vietnam. Figure 12 presents the number of articles that have been written by researchers from each country or region. accounting two or more countries as a separate category (an article may pertain to more than one category in this case). Self-elaboration.
Articles written by these authors are usually published in an impactful journal on the energy field. The top three journals that have been observed in the article pool are: Applied Energy, Energy and IEEE Transactions on Smart Grid, with 43, 35 and 25 articles from the pool, respectively (see Figure 13). All three of them are ranked in high positions by the indicators employed to catalog journals. For instance, they have 2020 JCR impact factor values of 9.746, 7.147 and 8.960, respectively, and belong to the first quartile in their area. (a) Accounting articles that have been written by researchers in two or more countries as a separate category. (b) Without accounting two or more countries as a separate category (an article may pertain to more than one category in this case). Self-elaboration.
Articles written by these authors are usually published in an impactful journal on the energy field. The top three journals that have been observed in the article pool are: Applied Energy, Energy and IEEE Transactions on Smart Grid, with 43, 35 and 25 articles from the pool, respectively (see Figure 13). All three of them are ranked in high positions by the indicators employed to catalog journals. For instance, they have 2020 JCR impact factor values of 9.746, 7.147 and 8.960, respectively, and belong to the first quartile in their area. In addition, other journals that have especially been attracting publications of this type recently are the International Journal of Electrical Power & Energy Systems, Energies, IEEE Transactions on Industrial Informatics and Renewable Energy, with impact factors of 4.63, 3.004, 10.215 and 8.001, respectively. The most impactful journal that has been observed to publish articles in this field is Renewable and Sustainable Energy Reviews, with an impact factor of 14.982. These figures show that the optimization of DGSs under uncertainty is considered of interest by researchers around the world, and that future research is likely to be accepted in a quality journal. In Figure 13, a classification of the articles by publishing journal is observed: Energies 2022, 15, x FOR PEER REVIEW 3 In addition, other journals that have especially been attracting publications of this recently are the International Journal of Electrical Power & Energy Systems, Energies, Transactions on Industrial Informatics and Renewable Energy, with impact factors of 3.004, 10.215 and 8.001, respectively. The most impactful journal that has been obse to publish articles in this field is Renewable and Sustainable Energy Reviews, with an im factor of 14.982. These figures show that the optimization of DGSs under uncertain considered of interest by researchers around the world, and that future research is l to be accepted in a quality journal. In Figure 13, a classification of the articles by publis journal is observed: Figure 13. Number of articles in the pool by publishing journal. Self-elaboration.
The last metric to be analyzed is citations. Most of the articles in the pool have extensively cited, with a median citation count of 32.5 per article, and a mean cit count of 43.2 per article. If these numbers are put into perspective by considering the that the article has been published, the pool achieves a median of 1.0 citations per m and a mean of 1.16 citations per month. Assuming the pool of articles is representati can be considered that the field is on good standing. The most cited article in the p [101], with a total count of 277 citations in January 2022. In Figure 14, the descriptiv tistics of the article citations are presented. The last metric to be analyzed is citations. Most of the articles in the pool have been extensively cited, with a median citation count of 32.5 per article, and a mean citation count of 43.2 per article. If these numbers are put into perspective by considering the time that the article has been published, the pool achieves a median of 1.0 citations per month and a mean of 1.16 citations per month. Assuming the pool of articles is representative, it can be considered that the field is on good standing. The most cited article in the pool is [101], with a total count of 277 citations in January 2022. In Figure 14, the descriptive statistics of the article citations are presented. .001, respectively. The most impactful journal that has been observed to publish articles in this field is Renewable and Sustainable Energy Reviews, with an impact factor of 14.982. These figures show that the optimization of DGSs under uncertainty is considered of interest by researchers around the world, and that future research is likely to be accepted in a quality journal. In Figure 13, a classification of the articles by publishing journal is observed: Figure 13. Number of articles in the pool by publishing journal. Self-elaboration.
The last metric to be analyzed is citations. Most of the articles in the pool have been extensively cited, with a median citation count of 32.5 per article, and a mean citation count of 43.2 per article. If these numbers are put into perspective by considering the time that the article has been published, the pool achieves a median of 1.0 citations per month and a mean of 1.16 citations per month. Assuming the pool of articles is representative, it can be considered that the field is on good standing. The most cited article in the pool is [101], with a total count of 277 citations in January 2022. In Figure 14, the descriptive statistics of the article citations are presented.

Conclusions
In this review, the dominant features of the articles that tackle the optimization of DGSs under uncertainty have been identified. A new classification in terms of the mathematical model and uncertainty characterization has been proposed. It has been observed that several SoUs are employed in the articles, most prominently RE generation and load, but soon, EV availability and economic incentives will be equally relevant. Regarding UAMs, it has been observed how the most popular methods rely on PDFs, although dataintensive methods such as neural networks and SVM are beginning to gain prominence. The problem formulation can also be of several forms, stochastic, robust, chance constraints or dynamic (MPC or RH). It is expected that closed-loop approaches, which consider the current state of the system in their decision process, will take the lead in the following years. In addition, regarding the optimization algorithm, both linear and nonlinear approaches are widely accepted, but nonlinear approaches are now usually tackled with the use of a metaheuristic algorithm. The development of a new algorithm is often sufficient to guarantee a substantial contribution in the field.
Models are growing in complexity, by the use of several additional features: grid testbed validation, a battery aging model, considering demand response or controllable loads, correlation between uncertain parameters and decentralization. These features and more that are to come will make optimization models applicable to real-life settings. It is expected that research projects on DGS will continue to increase, thus collaborating in an important part of the energy transition and making people advance into a fully green and decarbonized society.

Conclusions
In this review, the dominant features of the articles that tackle the optimization of DGSs under uncertainty have been identified. A new classification in terms of the mathematical model and uncertainty characterization has been proposed. It has been observed that several SoUs are employed in the articles, most prominently RE generation and load, but soon, EV availability and economic incentives will be equally relevant. Regarding UAMs, it has been observed how the most popular methods rely on PDFs, although data-intensive methods such as neural networks and SVM are beginning to gain prominence. The problem formulation can also be of several forms, stochastic, robust, chance constraints or dynamic (MPC or RH). It is expected that closed-loop approaches, which consider the current state of the system in their decision process, will take the lead in the following years. In addition, regarding the optimization algorithm, both linear and nonlinear approaches are widely accepted, but nonlinear approaches are now usually tackled with the use of a metaheuristic algorithm. The development of a new algorithm is often sufficient to guarantee a substantial contribution in the field.
Models are growing in complexity, by the use of several additional features: grid testbed validation, a battery aging model, considering demand response or controllable loads, correlation between uncertain parameters and decentralization. These features and more that are to come will make optimization models applicable to real-life settings. It is expected that research projects on DGS will continue to increase, thus collaborating in an important part of the energy transition and making people advance into a fully green and decarbonized society.