Keywords

1 Introduction

Regarding the monetary and operational difficulties that the electrical utilities are recently confronting, the electric industry has set off for seeking innovations toward settling such issues in the future, a future seen as smart grid era. There will be fundamental differences in the conventional power system and the smart grid. As such, when the demand rises, the favored arrangement would not be necessarily generating more electricity to fulfill the consumption requirements. In other words, generation of electricity will not directly be dependent on consumption; rather it will be a function of losses minimization, end-user demand management and collaboration with customers in order to optimize the load. All of the approaches mentioned earlier ensure striking the balance between generation and consumption without the generation having inevitably been increased. The smart grid will have the capacity to improve the utilization of its own components, lessen power losses, diminish superfluous loads, guarantee maintainability and cost-effectiveness of the electricity produced, meet the demand, and help to preserve the environment.

In the last century, the only information that was needed to see if the generation was sufficient or not in the conventional power system was the voltage and frequency of power system, which varied in relation to the demand. Therefore, such a load-following system confronted unabated growth on the demands and was no longer able to keep up with it regarding the reliability considerations. Utility companies were not able to expand their generation capacities due to the increasing cost of electricity production, the unstoppable growth of demand and stagnant revenues. In addition to the mentioned monetary issues, the negative effects of the emission of greenhouse gases on the environment have urged the electric utility to transform from the paradigm of “load-following” to “generation-following”, and that is the reason why smart grids and then microgrids were developed [1].

Smart grid energy systems have been developing constantly in order to be able to integrate renewable energy resources, energy storage systems, diesel generators, loads, control systems etc., which are called microgrids or hybrid power systems. Connecting several distributed generation and storage sources to several other loads microgrids are a small version of traditional distribution systems mostly via low-voltage distribution networks. Moreover, with the invention of microgrids, remote communities have become capable of been supplied by electricity which was uneconomical before. Furthermore, the microgrid concept has been considered one of the best solutions for incorporating more renewable energy resources into the existing power system, as they can be operated in a grid-connected and isolated mode, which can bright plenty of reliability both for customers and for the power system [2].

As the number of distributed generation units and the penetration level of renewable energy resources increase, the new distribution network cannot be neglected for being a passive appendage to the power transmission system, but an integrated unit. Moreover, multi-management approaches should be undertaken for operation and planning of such complex systems, which are thought as a cluster of renewable and non-renewable energy resources and loads of different profiles. All this complexity has plenty of benefits in its favor, such as reduction of power losses, increased efficiency by using combined heat and power generators, increased local reliability, the correction of voltage sag etc.

In this chapter, following an introduction to the fundamentals and definition of microgrids, the focus is taken on microgrid planning and energy management that explores modeling random variables for wind and solar energy. Then, solar and wind energy modeling using several different probability distributions are explained. Afterward, the optimization models for microgrid planning has been proposed elaborately using stochastic programming and deterministic mathematical models.

2 Fundamentals of Microgrids

The present power system is practically built to conduct electricity from power plants, which are mostly far away from load centers, to consumers centralized at industrial and domestic sites. In addition, having been using an assortment of compound innovations to guarantee the uppermost productivity in power plants, the process of combustion loses almost 70% of the fuel as lost heat. Moreover, because in the conventional power system generation follows consumption, there are 20% extra capacity in power plants to meet the consumers’ electricity only at peak demand time. Another drawback regarding the present power system will be a vulnerability of complete blackouts throughout the network in case of mass interruptions somewhere within the network. All the mentioned downsides have forced scientists to come up with an idea to address the problems to have a stable, more efficient, and cost-effective electric system [1].

The cutting-edge smart grid is to address the significant weaknesses of the current network and to give the service companies full perceivability over operating all the components and services that they provide. Smart grids are also expected to be more resilient in case of any kind of failure and engage all the stakeholders in a cheap and reliable empowerment industry and meticulous energy transactions. Figure 2.1 is a depiction comparing smart grids with the conventional power system highlighting the key differences in hierarchies, technologies and operational strategies [1].

Fig. 2.1
figure 1

Comparison of a conventional and a smart grid [1]

2.1 Definition of Microgrids

Microgrids are interrelated structures of loads and local power plants that can function independently of the network called islanded mode, or be connected to it, considered as a grid-tied mode. Microgrids basically embody virtually all the fundamental components of the conventional network, such as power plants and consumers in a more compact structure. The power plants are closely located in the neighborhood of loads so that no transmission system resembling the existing one is required any longer. Moreover, the local power plants may be able to meet the local demand, otherwise, the deficiency of electricity will be compensated by a larger grid connecting microgrids altogether. In other words, microgrids are just a scaled-down version of the existing network, which is also recognized as smart microgrids if a sophisticated command and control system is incorporated into them [1].

There are also some other diverse terms attached to the general definition of microgrids, each being posed by different communities, all of which seek their own advantages. Some believe microgrids should integrate renewable energy sources for environmental concerns, whereas the others think energy surety and reliability are essential factors to be taken into consideration which demand microgrids to be connected to a firmer grid. Following apprehensions about the latter, energy storage systems are to be added into microgrids in order to mitigate the impacts of uncertain nature of renewable energy resources. In addition, there are imposing concerns about the cyber protection of smart microgrids as there are interconnected components included into microgrids to have them fully manageable, which likewise stresses incorporating defensive structures into them in case of intrusions. Last but not least, energy efficiency and cost effectiveness of microgrids come as high priorities, without which there will not be any justification for devising such state-of-the-art technologies [1].

It is worth bearing in mind that an interconnected set of loads and generations do not need to inevitably be smart in order to be called a microgrid. In other words, the mere fact that the grid is a scaled-down version of the conventional grid which is a generation-following system rather than a load-following one suffice for being called a microgrid. Nevertheless, a smart microgrid is designed as a structure in which loads are fed by local generation connected to or disconnected from a larger grid, same as a microgrid, that a level of intelligence has been incorporated into it in order to make it efficiently manageable and optimizable. It should be noted that the intelligence can be applied to all of the components of microgrids, such as power generation, load, and accessibility management etc., or a few of them, which the total level of smartness of microgrids are defined based on [1].

2.2 Architecture of Microgrids

As discussed earlier, there are several basic building blocks which are indispensable gears of smart microgrids, such as different types of power generation sources, including renewables, a wide variety of loads having different consumption profiles, and interconnected levels of networked intelligence including all the components needed for the command and control system to be devised (Fig. 2.2). This abridged graph underlines the way that the fundamental parts of a smart microgrid are incorporated through two autonomous yet interrelated connections. The first one relates to the conventional straight energy flow interrelation, transferring electricity from local power plants to the consumers. The second one refers to a mutually connected system collecting different sets of sensory, alarm etc. data and making energy management feasible through the channels of communication to the components and parameters of microgrids. In addition, the energy management system of microgrids can be central or distributed according to the size of microgrids to completely fulfill the control requirements of microgrids in relation to the complexity of them [1].

Fig. 2.2
figure 2

Basic building blocks of microgrids [1]

3 Microgrid Planning and Energy Management

Energy management and planning are of critical importance when it comes to integrating microgrids, equipped with renewable energy resources, into the network. There are several functions that are to be considered when dealing with the planning of microgrids, such as load forecasting, the uncertainty of renewable sources, reduction of CO2 emissions etc. In addition, electricity should be consumed almost as soon as it is generated and system operators and planners should devise such complex processes in order to make generation meet consumption promptly. As the uncontrollability of renewable energy resources is an important issue to be tackled, one way is to incorporate them with controllable generators and power storage solutions and come up with Hybrid Power Systems (HPS). The main conclusion to be drawn is that it is a very challenging task to develop a right strategy to combine renewable resources with the conventional network and storage systems in order to meet the demand while struggling with the uncertain nature of power sources. Hence, all the parameters that have a part in the planning of microgrids should be modeled in details mathematically to avail of picking the best approaches where microgrid planning and energy management jut out [2].

3.1 Modeling Random Variables for Wind Energy

The penetration of wind power, which is a means of electricity production utilizing the kinetic energy of wind, has been growing dramatically since the beginning of the 21st century. The total capacity of wind power installed globally increased considerably from 18 GW at the end of 2000 to 238 GW at the end of 2011, having 41 GW installed in 2011 alone. Regarding the amount of penetration of renewable sources of energy, it is highly essential to investigate power generation in the presence of such sources. As for Wind Turbines, achieving an accurate assessment of the electrical system is not simply conceivable only by analyzing deterministically. However, the power injected into the network can be calculated using the wind turbines’ power curve and the probabilistic distribution of wind speed [3].

3.1.1 Characteristics of Wind Turbines

The output power of wind turbines is generally established by two parameters as mean hourly wind speed and the output characteristics of wind turbines. To have a careful assessment of the output power of wind turbines, specific evaluations should be made on the hourly-logged data of wind speed as converting them to the pertinent values at the height of hubs. It is feasible to calculate the data at the height of hubs through Eq. (2.1) as:

$$v = v_{hr} \left( {\frac{h}{{h_{r} }}} \right)^{\gamma }$$
(2.1)

where hr is the wind speed at a reference height, h is the wind speed at a pre-defined hub height, vhr is wind speed at reference height in m/s, v is wind speed in m/s, and γ represents the power law exponent [4].

The model that is used to calculate the wind turbine output power (PWT) has been given by Eqs. (2.2) and (2.3) as follows:

$$P_{WT} = \left\{ {\begin{array}{*{20}l} {a.v^{3} - b.P_{R} } \hfill & {v_{ci} \text{ < }v\text{ < }v_{r} } \hfill \\ {P_{R} } \hfill & {v_{r} \text{ < }v\text{ < }v_{co} } \hfill \\ 0 \hfill & {\text{otherwise}} \hfill \\ \end{array} } \right.$$
(2.2)

subject to:

$$\left\{ {\begin{array}{*{20}l} {a = \frac{{P_{R} }}{{v_{r}^{3} - v_{ci}^{3} }}} \hfill \\ {b = \frac{{v_{ci}^{3} }}{{v_{r}^{3} - v_{ci}^{3} }}} \hfill \\ \end{array} } \right.$$
(2.3)

where PR is rated the power of wind turbine in kW, vco is cutoff speed, vci is the cut-in speed of wind turbine in m/s and vr signifies the rated velocity of the wind turbine in m/s [4].

Figure 2.3 is related to one of the common wind turbines that is used in a few microgrid-related projects called Whisper 3 kW (Southwest Wind Power), which its output power curve is established based on Eqs. (2.1), (2.2) and (2.3). In addition, the output power curve for most of the wind turbines follow almost the same path as Whisper 3 kW (Southwest Wind Power) does. However, the selection process of wind turbines also is dependent on the data of average annual wind speed and economic considerations both for specific locations.

Fig. 2.3
figure 3

Power curve for Whisper 3 kW wind turbine

3.1.2 Probability Distributions for Wind Speed Modeling

The mathematical expressions given by Eqs. (2.4) and (2.5) are the Weibull Probability Distribution formulas that model hourly wind speed as a random variable, which makes the prediction of wind speed at a given location feasible for the planners to make an estimation of the wind power available to inject into the grid [5].

$$f(v) = \frac{r}{c}\left( {\frac{v}{c}} \right)^{r - 1} \exp \left[ { - \left( {\frac{v}{c}} \right)^{r} } \right]$$
(2.4)

subject to:

$$\left\{ {\begin{array}{*{20}l} {r = \left( {\frac{\sigma }{{v_{mean} }}} \right)^{ - 1.086} } \hfill \\ {c = \frac{{v_{mean} }}{{\Gamma \left( {1 + \frac{1}{r}} \right)}}\quad {\text{where}},\;\Gamma \left( n \right) = (n - 1)!} \hfill \\ \end{array} } \right.$$
(2.5)

where f(v) is the wind speed, vmean is the mean speed and σ is the standard deviation of the wind speed for a specific location, then the Cumulative Distribution Function (CDF) can be characterized mathematically by Eq. (2.6) [5].

$$F(v) = 1 - \exp \left[ {\left( { - \frac{v}{c}} \right)^{r} } \right]$$
(2.6)

3.2 Modeling Random Variables for Solar Energy

Another environmentally friendly means of energy production is photovoltaic systems that are operated without the smallest amount of emissions. What make them an ideal solution for both urban and rural utilizations are little maintenance requirements and long lifespan when used as independent systems. Moreover, transmission and distribution costs can be effectively reduced when generator systems are located in close proximate to consumers, in which context PV systems can be taken efficiently into the consideration. However, extensive adoption of PV systems confronts a major barrier as the high cost of their deployment.

It is practicable to predict solar radiation at a particular location based on the logged data for a certain period that are usually measured per unit area on a horizontal surface in Wh/m2. In other words, the solar radiation that a surface receives is depended on the angle of the surface with respect to the sun, of which astronomical parameters and the surface orientation decide. More on this, there are two main steps to radiation conversion as decomposition and transposition. The former refers to the decomposition of the radiation into two separate components as beam and diffuse. The latter denotes transposition of the beam and diffuse onto the inclined panel. Thus, the overall radiation consists of the two components and the radiation reflected by the ground. The main process in the estimation of diffuse radiation, which is the most important step, is the clearness index expressing extraterrestrial solar radiation caused by the atmosphere. Just as the other renewable sources of energy and the varying solar insolation from day to day comparing the same hours, there is a desperate need to develop a comprehensive method to deal with the uncertainty of solar energy.

3.2.1 Characteristics of Photovoltaic Panels

Several investigative models presenting the current-voltage relations that are developed based on the electrical characteristics of PV panels can be used for calculating the hourly output power. Belfkira presented one comprehensive model in 2009 that is taken into consideration for this chapter. It is applicable, using a maximum power point tracker (MPPT), to determine PV panel current (Impp) and voltage (Vmpp) at the maximum power point based on the mentioned model. In addition, the models comprise the properties of panel temperature and radiation level on the output power as shown by Eqs. (2.7)–(2.14) [6].

$$I_{mpp} = I_{SC} \left[ {1 - C_{1} \left[ {\exp \left( {\frac{{V_{\max } }}{{C_{2} V_{OC} }}} \right) - 1} \right]} \right] + \Delta I$$
(2.7)
$$V_{mpp} = V_{\max } + \mu_{V,OC} \cdot \Delta T$$
(2.8)

where ISC is short circuit current of solar panel in Amps, , is temperature constant for open circuit voltage in V/degC, VOC and Vmax are open circuit voltage of PV panel and maximum voltage of PV panel at the reference operating condition in Volts, respectively.

The output power of PV panel at the extreme power point, Pmpp, is expressed as:

$$P_{mpp} = V_{mpp} \cdot I_{mpp}$$
(2.9)

subject to:

$$C_{1} = \left( {1 - \frac{{I_{\max } }}{{I_{SC} }}} \right)\exp \left( { - \frac{{V_{\max } }}{{C_{2} V_{OC} }}} \right)$$
(2.10)
$$C_{2} = \left( {\frac{{V_{\max } }}{{V_{OC} }} - 1} \right)\left[ {\ln \left( {1 - \frac{{I_{\max } }}{{I_{SC} }}} \right)} \right]^{ - 1}$$
(2.11)
$$\Delta I = I_{SC} \left( {\frac{{G_{T} }}{{G_{ref} }} - 1} \right) + \mu_{I,SC} \cdot \Delta T$$
(2.12)
$$\Delta T = T_{c} - T_{c,ref}$$
(2.13)

where Imax is the maximum amount for current of the PV panel at the reference working condition, µI,SC is temperature coefficient at reference operating conditions for short circuit current. Gref and GT are irradiance at reference operating conditions equal to 1000 W/m2 hourly and irradiance on tilted surface in W/m2, respectively, and Tc and Tref are PV panel operating temperature and reference temperature in degree Celsius, respectively. Tc can be presented as follows:

$$T_{c} = T_{a} + \frac{NOCT - 20}{800}\cdot G_{T}$$
(2.14)

where NOCT denotes the Normal Cell Operating Temperature. In addition, NOCT refers to the cell temperature when the PV panel is being operated under 800 W/m2 of solar irradiance and the ambient temperature of 20 °C and also it is usually between 42 and 46 °C [6].

As discussed before, there are two determining factors to the output power produced by solar panels as the irradiation and the angle between the panel and the sun, while solar irradiation data is what most of the sources make available. More on that, when the sunlight and solar panel are perpendicular to each other, the output power is at its maximum level, whereas the power delivered by sunlight to a fixed module is less than the maximum amount due to the changing nature of the sun angle. In addition, when the tilt angle is equal to the latitude of the location, the panel will provide the maximum output power over a course of a year. Nevertheless, lower tilt angles are optimized for summer times as greater fraction of sunlight will be transferred into electricity, while steeper tilt angles being the best choice for winter times as for large winter loads.

3.3 Non-linear Dependence Structures for Modeling Random Variables

Wind and solar power having been the most accessible sources of renewable energy, the uncertainty connected cause them not to be able to meet the demand completely. In other words, there is a high variability in output power when it comes to wind power because of the ever-changing nature of wind, while solar power following a more known pattern showing large changes in output power compared to the slight changes in solar radiation. In general, there is a correlation between the spatial dependencies, non-Gaussian and non-linear nature of wind speeds, where Kumaraswamy distribution model is one of the best models to be utilized. Moreover, three main advantages justify using Kumaraswamy distribution as its comparable characteristics with beta distribution, simple analytical formulations for convenient calculations as well as its simple integration with copulas. Most of the existing literature refer to wind farms as a feasible means of smoothing wind power that also have a great effect on stability and reliability enhancement of renewable energy generation [7].

More on copulas, it is one of the most appropriate methodologies of modeling non-linear, non-normal and complex dependency structures, which is widely used in the field of finance. In addition, one of the most significant advantages of copulas is their power in demonstrating the dependency structure autonomously of the marginal distributions of the contributing variables, which comes to a great importance for planners when finding the output of wind power at different locations independently of their behavior. An estimation can be made for the correlation between the locations through separation distance and averaging period, which makes it feasible to produce a precise model of dependency structure via basic information about the location of wind turbines. Therefore, it is highly important to select an appropriate copula function in order to have the least unacceptable errors. Generation of scenarios is one of the most important usages of wind power modeling using copulas, which are inseparable parts of scholastic programming as a common decision-making tools in power system analysis. Moreover, it has already been proven that wind speeds are non-normally distributed and non-linearly dependent. Hence, while the multivariate data not being distributed normally, the quantiles of margins’ sums cannot be calculated from sums of variances and covariance [8].

4 Microgrid Planning—Solar and Wind Energy Modeling

As solar and wind energy are site-dependent, zero emissions and non-depletable, they have always been considered to be the most important sources of renewable energy, although their unpredictable nature being of utmost concern. In general, the time distribution of the demand does not necessarily fit with the variations of wind and solar energy, which makes the designs costly and not reliable if they are devised independently. This section introduces mathematical solutions for modeling wind and solar-based renewable sources of energy, which will be investigated to understand their characteristics in order to design microgrids that are more reliable. In order to comprehend the correlation between renewable energy sources and their spatial properties, novel approaches using copulas have been examined through leading us to avoid over-designed as well as under-designed systems [9].

4.1 Probability Distributions for Modeling PV, Solar and Wind Energy

The amount of solar radiation reaching the ground depends on the climate conditions as well as spatial properties such as latitude and altitude, but it has been proven by many studies that the irradiation difference between on the ground and outside the atmosphere depends mainly on the cloudiness. In addition, solar irradiation can precisely be modeled by Hollands and Huggets distribution, while Weibull probability distribution models wind speed as a random variable quite well and Kumaraswamy distribution presents a general tool for modeling all the parameters at once that will be taken for consideration.

4.1.1 Kumaraswamy Distribution

There are two main reasons for using the Kumaraswamy distribution for modeling renewable resources of energy as its ability to model non-linear transformation of energy resources in order to be integrated with copulas and a much simpler form than the Beta distribution that is also computationally faster. The Kumaraswamy distribution is given by Eqs. (2.15) and (2.16), which is an alternative two-parameter distribution on (0, 1). Having some more advantages in terms of traceability, it possesses the same properties as the beta distribution [10].

$$\left\{ {\begin{array}{*{20}l} {f(x) = abx^{a - 1} (1 - x^{a} )^{b - 1} } \hfill \\ \begin{aligned} a,b > 0 \hfill \\ x \in [0,1] \hfill \\ \end{aligned} \hfill \\ \end{array} } \right.$$
(2.15)
$$F(x) = [1 - (1 - x^{a} )^{b} ]$$
(2.16)

where f(x) is the probability density functions and F(x) is the cumulative density functions.

Furthermore, Kumaraswamy distribution can be used not only for resource modeling in general but also for demand modeling effectively. It is also important to note that the copulas that are used to model the dependency structure of the wind power are of more interest to the system planners rather than the ones modeling only wind speed. Regarding modeling wind power, standard benchmark wind turbines, such as 3 kW Turbine based on HOMER, are taken into consideration in order to come up with the best parametric fit for wind power at each location. One best way to fit wind power to the distribution is to take advantage of the double bounded Kumaraswamy distribution due to its general nature and simplicity, and then the marginal for all the locations will be obtained and dependence structure can be established through Vine Copulas. Moreover, non-Gaussian nature of wind power and high dimensionality of wind data at different locations makes it virtually impossible to be captured completely using correlation means as well as adequate copula functions, where solutions such as Pair Copula Constructions (PCC) approaches come up [11, 12].

4.1.2 The Theory of Copulas

A copula, in probability theory and statistics, is a multivariate probability distribution for which the marginal probability distribution of each variable is uniform, which is used to describe the dependence between random variables. In other words, combining univariate distributions is possible through copula functions in order to obtain a joint distribution with particular dependence structure. Most simplified demonstrations of copulas derive from the way copulas are used on distributions, of which knowing the way a cumulative density function (CDF) contributing in generating a random sample is a necessity. In general, sampling from a uniform distribution would be the first step through drawing a value from a particular distribution, which is called the CDF of a variable, and then a sample can be obtained from a PDF as shown in Fig. 2.4. Moreover, several different distributions are extended this method such as Sklar’s theorem, which states that for a given joint multivariate distribution function and the marginal distributions related; a copula function can be found that relates them [13].

Fig. 2.4
figure 4

Drawing a random sample from a CDF

4.1.3 Sklar’s Theorem

Sklar’s theorem has been considered the foundation of most of the applications of copulas theory in statistics, which clarifies the role of copulas in the joint connection between multivariate distribution functions and their univariate margins. This theorem first appeared in [13], which the name “copula” was chosen to emphasize the manner in which a copula “couples” a joint distribution function to its univariate margins. Thus, the brief explanation of Sklar’s theorem is as the following [14]:

  • Let H be a joint distribution function with margins F and G. Then there exists a copula C such that for all x, y in \(\overline{{\mathbf{R}}}\),

    $$H(x,y) = C(F(x),G(y))$$
    (2.17)
  • If F and G are continuous, then C is unique; otherwise, C is uniquely determined on RanF×RanG. Conversely, if C is a copula and F and G are distribution functions, then the function H defined by Eq. (2.17) is a joint distribution function with margins F and G.

  • C is a copula if C:[0,1]2  [0,1] and,

  1. 1.

    C(0, um) = C(vm,0) = 0

  2. 2.

    C(1, um) = C(um, 1) = um

  3. 3.

    C(um2, vm2) − C(um1, vm2) − C(um2, vm1) + C(um1, vm1) ≥ 0 for all vm1 < vm2, um1 < um2

  4. 4.

    If C is differentiable once in its first argument and once in its second then, C is equivalent to \(\int_{{v_{m1} }}^{{v_{m2} }} {\int_{{u_{m1} }}^{{u_{m2} }} {\frac{{\partial^{2} C}}{{\partial u_{m} \partial v_{m} }}du_{m} dv_{m} \ge 0} }\) for all vm1 < vm2, um1 < um2

The above-mentioned definition shows that copulas can be counted as independent distribution functions which are defined on [0, 1]2 with uniform marginal. In addition, probabilities of one-dimensional events can be produced by each of the marginal distributions taken by copula functions and projected to a joint probability and having the relationship enforced on them. Overall, it is very efficient to use copulas in order to create multivariate distributions as they help segregate selection of dependence and marginal from one another, Sklar’s theorem being one of the easiest ways for the formation of copulas. More on this, if F(x) and G(y) are the marginal distributions and the copula can be given by Eq. (2.18) [14].

$$C(u_{m} ,v_{m} ) = H_{{u_{m} v_{m} }} (F^{ - 1} (u_{m} ),G^{ - 1} (v_{m} ))$$
(2.18)

4.1.4 The Right Copula Selection

Making the right choice when it comes to modeling data through distribution means is of utmost importance, considering wide verity of distributions and copulas available. The selection of copulas is mostly based on two factors as familiarity and tractability whereby Gumbel copula being the best for extreme distributions, Gaussian the rightest for linear correlations, which is obtained from normal distribution, and t-copula for the dependence in tails etc. Moreover, in order to generate a copula incorporating marginal distributions of two variables, distributions such as lognormal and Kumaraswamy with (μ, σ) and (a, b) as their parameters, respectively, a copula from Frank family can be taken advantage of which is given by Eq. (2.19) [14, 15].

$$C(u_{m} ,v_{m} ) = - \frac{1}{\delta }\ln \left( {1 + \frac{{\left( {e^{{ - \delta u_{m} }} + 1} \right)\left( {e^{{ - \delta v_{m} }} - 1} \right)}}{{\left( {e^{ - \delta } - 1} \right)}}} \right)$$
(2.19)

where δ is a coefficient determining the degree of dependence between marginal.

A lot of work having been carried out on acquiring marginal distributions and different methods having been proven efficient for different cases such as empirical distribution or parametric best fit, empirical distribution is where to start often, but in order to obtain a smooth curve, it is efficient to apply kernel smoothing or cubic splines. Likewise, Eq. (2.20) presents t-copula as for modeling tails, which compared with Gaussian copula enables for joint fat tails and an increased probability of joint extreme events [16, 17].

$$C_{\rho ,\vartheta } (u_{m} ,v_{m} ) = \int\limits_{ - \infty }^{{t_{\vartheta }^{ - 1} (u_{m} )}} {\int\limits_{ - \infty }^{{t_{\vartheta }^{ - 1} (v_{m} )}} {\frac{1}{{2\pi \left( {1 - \rho^{2} } \right)^{{\frac{1}{2}}} }}} } \left\{ {1 + \frac{{x^{2} - 2\rho xy + y^{2} }}{{\vartheta \left( {1 - \rho^{2} } \right)}}} \right\}^{{\frac{ - (\vartheta + 2)}{2}}} dsdt$$
(2.20)

where, \(t_{\vartheta }^{ - 1}\) is the inverse of the standard univariate t-copula with ϑ degrees of freedom, ρ and ϑ are the factors of the copula, and expectation 0 and variance \(\frac{\vartheta }{\vartheta - 2}\). An additional parameter was introduced by t-copula compared to Gaussian copula as ϑ, which an increase in it decreases the tendency to exhibit extreme co-movements [18].

There is another copula called Gumbel copula, which is an asymmetric one (given by Eq. (2.21)) and shows superior dependency in the positive tail than in the negative [17].

$$C_{\delta } (u_{m} ,v_{m} ) = \exp \left( { - \left[ {\left( { - \log u_{m} } \right)^{\delta } + \left( { - \log v_{m} } \right)^{\delta } } \right]^{1/\delta } } \right)$$
(2.21)

where δ is a coefficient controlling the degree of dependence.

It is understood that no any particular distribution presented in this chapter or in all the other addressed references fit the output power generated by wind turbines and solar panels quite well. On the other hand, Kumaraswamy distribution has proven a better efficiency on modeling the dependence regarding wind and solar power, and it is also one of the best probabilistic approaches to model uncertainty in the resources. Furthermore, to better model the association between uncertain parameters, the idea of modeling dependence seems to be of great importance where copulas come to use to model wind power in relation to the spatial domain.

5 Optimization Models for Microgrid Planning

The penetration of renewable energy sources is typically high in an isolated microgrid system with a small amount of carbon footprint, in which removing interruptions is of great importance. Although the capital investment on such power systems is high and the uncertain nature of such sources of energy is a serious challenge to be met, they are significantly appreciated from the environmental aspects. Besides, there are several basic and sophisticated optimization models in order to include and consider all of the possible energy generation and cost scenarios in the microgrid planning problem such as deterministic optimization model, scholastic programming etc., which are discussed in this section.

5.1 Deterministic Optimization Models

Designing a cost-effective and reliable capacity for Hybrid Power Systems (HPS) has been studied from different aspects of view, for which heuristic approaches are applied to choose the best system configurations and cost minimization policies for the most economical operational purposes. However, the operational planning and HPS was conventionally formulated as a single objective function, denoting to the minimization of total cost considering certain reliability factors. In addition, there are other objectives recently incorporated into the general one as reliability maximization, losses, and emissions minimization etc. Just as many other optimization problems, there are several contradictory objectives combined into one which requires multi-objective optimization methods to be used [19].

The optimization procedure is a repetitive process starting from selecting system configurations randomly, and then conducting the related simulations by static rules and choosing operational policies to minimize costs. The iterative process obtains the fitness of system configurations and ranks them, and then a new set of variables are produced and applied to the system using evolutionary algorithms, which carries on until the best solution is found according to the stopping criteria for the algorithm. Additionally, there are plenty of simulation tools such as HOMER and HYBRIDS available to apply to the designed systems and make various comparisons on them in order to come up with the best operational strategies when facing contrasting scenarios. The correlation between the operational planning of HPS and the capacity design is well understood by the simulation approach, although the optimal systems configurations might not found during the process because of the limitations posed by unnecessary constraints and possible suboptimal points found by the heuristic algorithm. Therefore, it is important to hire an optimization method that tackles all the hurdles and comes up with the best solution for the HPS designing. Equations (2.22)–(2.38) represent the mathematical functions for an approach that simultaneously finds an optimal operating plan and system configurations for the HPS problem incorporated as a Multi-objective Linear Programming optimization problem [19].

5.1.1 Objective Function

The combined objective function to be minimized is given by Eq. (2.22).

$${\text{Objective}}{:}\,w_{c} \cdot TDC + (1 - w_{c} ) \cdot TDE$$
(2.22)
$$\begin{aligned} TDC & = \sum\limits_{{i = \left\{ {dg,pv,wt} \right\}}} {\left[ {N_{i} \left( {\frac{{IC_{i} }}{{T_{i} }} + OM_{i} } \right)} \right]} + \frac{{IC_{b} }}{{T_{b} }} \cdot \frac{{\sum\nolimits_{t = 1}^{24} {\sum\nolimits_{m = 1}^{12} {Ch_{b} (t,m)} } }}{{12 \cdot C_{\max } }} \\ & \quad + FC_{dg} \cdot \frac{{\sum\nolimits_{t = 1}^{24} {\sum\nolimits_{m = 1}^{12} {O_{dg} (t,m)} } }}{12} \end{aligned}$$
(2.23)
$$\begin{aligned} TDE & = \sum\limits_{{i = \left\{ {dg,pv,wt} \right\}}} {\left[ {\frac{{N_{i} \cdot EE_{i} }}{{T_{i} }}} \right]} + \frac{{EE_{b} }}{{T_{b} }} \cdot \frac{{\sum\nolimits_{t = 1}^{24} {\sum\nolimits_{m = 1}^{12} {Ch_{b} (t,m)} } }}{{12 \cdot C_{\max } }} \\ &\quad + DE_{dg} \cdot \frac{{\sum\nolimits_{t = 1}^{24} {\sum\nolimits_{m = 1}^{12} {O_{dg} (t,m)} } }}{12} \end{aligned}$$
(2.24)

where wc is a factor denoting the weight of the cost minimization objective function, Ni and ICi represent the number of power storage units and generation and initial cost per storage unit and power generation of type i in US$. Ti and OMi are expected life and maintenance and daily operations costs for a storage or generation unit of type i in days and US$/day, respectively. Chb(t, m) is all batteries’ charging power in kW, Odg(t, m) and Cmax are and the output power from DG sources in kW and the maximum available charge of a battery in kWh [19].

5.1.2 Constraints

The ideal answer must meet a set of constraints presented in the following:

  1. A.

    Supply-demand balance: Power demand equals the sum of unmet load and power supply at any time interval:

    $$\left( {\begin{array}{*{20}c} \begin{aligned} & D(t,m) + Ch_{b} (t,m) \le O_{dg} (t,m) + N_{pv} \cdot O_{pv} (t,m) + N_{wt} \cdot O_{wt} (t,m) \\ & \quad + DCh_{b} (t,m) + D_{us} (t,m) \\ \end{aligned} \\ {\forall t,m} \\ \end{array} } \right)$$
    (2.25)

    where, D(t, m) is the amount of peak demand in kW and Dus(t, m) is the unmet load in kW. Chb(t, m) (kW) and DChb(t, m) (kWh) are the charging power and the power shared by the storage system (batteries), respectively. Odg(t, m), Opv(t, m) and Owt(t, m) are the output power from generation sources in kW, and Ni is the quantity of power storage/generation units [19].

  2. B.

    The output limit of diesel generator: diesel generators’ output power must not be larger than their rated capacity:

    $$\left( {\begin{array}{*{20}c} {O_{dg} (t,m) + SR(t,m) \le N_{dg} \cdot RC_{dg} } \\ {\forall t,m} \\ \end{array} } \right)$$
    (2.26)

    where, SR(t, m) is the available spinning reserve in kW and RCdg is the rated capacity of diesel generator [19].

  3. C.

    The State of Charge (SoC) of batteries: A restraint presenting the linkage between energy storage in the battery and the process of discharging and charging.

    $$\left( {\begin{array}{*{20}c} {C(t + 1,m) = C(t,m)(1 - \gamma_{sd} ) + Ch_{b} (t,m) - \frac{{Dch_{b} (t - 1,m)}}{{\gamma_{d} }}} \\ {\forall t,m} \\ \end{array} } \right)$$
    (2.27)

    where, C(t, m) is the stored energy in the batteries in kWh, γsd and γd are the efficiencies of hourly self-discharging and discharging for batteries in %/hour and %, respectively, while m is the month of the year and t is the hour of the day [19].

  4. D.

    Capacity limits of batteries: There is an upper limit for batteries regarding their SoC:

    $$\left( {\begin{array}{*{20}c} {\left( {1 - DOD_{\max } } \right) \cdot C_{\max } \cdot N_{b} \le C(t,m) \le C_{\max } \cdot N_{b} } \\ {\forall t,m} \\ \end{array} } \right)$$
    (2.28)

    where DOD is the maximum value of depth of discharge in a cycle considering the fact that discharging and charging electricity to or from the battery must be less than or equal to its rated capacity [19].

    $$\left( {\begin{array}{*{20}c} {Ch_{b} (t,m) \le N_{b} \cdot RC_{b} } \\ {\forall t,m} \\ \end{array} } \right)$$
    (2.29)
    $$\left( {\begin{array}{*{20}c} {DCh_{b} (t,m) \le N_{b} \cdot RC_{b} } \\ {\forall t,m} \\ \end{array} } \right)$$
    (2.30)
  5. E.

    The requirements of spinning reserve (SR): Diesel generators must be capable of responding promptly to any changes and possible failures in the power generation units.

    $$\left( {\begin{array}{*{20}c} {SR(t,m) \ge SR_{\min } D(t,m)} \\ {\forall t,m} \\ \end{array} } \right)$$
    (2.31)

    where, SR(t, m) representing spinning reserve available in kW and the requirements of spinning reserve is considered as a fraction of total demand. Moreover, it has been assumed that no limits have been imposed on the ramp up/down of generators and their output power can be changed immediately [19].

  6. F.

    Cycle repeatability: The SoC of batteries, in the beginning, should equal to the one at the end of the cycle, which guarantees the optimal cycle is repeatable [19].

    $$\left( {\begin{array}{*{20}c} {C(24,m)(1 - \gamma_{sd} ) + Ch_{b} (1,m) - \frac{{Dch_{b} (1,m)}}{{\gamma_{d} }} = C(1,m)} \\ {\forall m} \\ \end{array} } \right)$$
    (2.32)
  7. G.

    The maximum permissible level of unmet power (EUE): To maintain the acceptable service being delivered, the amount of energy not being supplied, as EUE, must not exceed a predefined extent.

    $$\sum\limits_{t = 1}^{24} {\sum\limits_{m = 1}^{12} {D_{us} (t,m)} \le EUE_{\max } }$$
    (2.33)

    In addition, reliability assessment is done through considering the ability of storage units and generators to meet the demand completely whereby an accurate planning of resources will ensure perfect reliability (EUE = 0) [19].

  8. H.

    Budget and/or resource limitations: In order to assure that the solution is practical from the monetary point of view, the following constraints are applied to the objective function, which denotes the budget by means of RES numbers [19].

    $$N_{pv,\min } \le N_{pv} \le N_{pv,\max }$$
    (2.34)
    $$N_{wt,\min } \le N_{wt} \le N_{wt,\max }$$
    (2.35)
    $$N_{b,\hbox{min} } \le N_{b} \le N_{b,\max }$$
    (2.36)
  9. I.

    Prevention of simultaneous discharging and charging: To prevent the process of charging and discharging from happening at the same time the following constraint is applied to the objective function [19].

    $$\left( {\begin{array}{*{20}c} {Ch_{b} (t,m) \times DCh_{b} (t,m) = 0} \\ {\forall t,m} \\ \end{array} } \right)$$
    (2.37)
  10. J.

    Energy to Power Ratio (E/P): Batteries’ capacity is determined via E/P ratio for any given power rating, which represents an association between energy size and power for a particular storage system. The former notes to the maximum sum of energy that the storage system can store for a certain duration, while the latter represents the rate at which charging and discharging processes can be continually run.

    $$\left( {\begin{array}{*{20}c} {\underline{EPR} \cdot N_{b} \cdot RC_{b} \le C(t,m) \le \overline{EPR} \cdot N_{b} \cdot RC_{b} } \\ {\forall t,m} \\ {{\text{where}}{:}\;EPR\,{\text{or}}\frac{E}{P} = \frac{{{\text{Energy Capacity }}({\text{kWh}})}}{{{\text{Power Rating }}({\text{kWh}})}}} \\ \end{array} } \right)$$
    (2.38)

5.2 Two-Stage Stochastic Programming Grounded Model

One of the lately developed approaches for operating and planning of the distributed energy systems is the two-stage stochastic programming model, which has been demonstrated to be efficient and flexible when it comes to dealing with uncertainty in microgrids. In addition, Monte Carlo Simulation (MCS) is the most common way for generating stochastic variable scenarios for two-stage stochastic programming, and the risk cost can be enormously reduced by all the possible realizations having been considered. There are several problems that the two-stage stochastic programming has been applied on, such as a stochastic model for optimal energy management with the goal of cost and emission minimization, two-stage SP strategy for energy and reserve scheduling with demand response, two-stage SP method for the optimal design of distributed energy system etc. Equations (2.39)–(2.54) represent the mathematical formulation for the problem of microgrid planning and operation using the two-stage stochastic programming method [19, 20].

5.2.1 Objective Function

The combined objective function to be minimized is given by Eq. (2.39).

$$\begin{aligned} & \overline{N}_{pv} \left( {IC_{pv} + OM_{pv} (N_{pv} )} \right) + \overline{N}_{wt} \left( {IC_{wt} + OM_{wt} (N_{wt} )} \right) \\ & \quad + N_{dg} \left( {IC_{dg} + OM_{dg} (O_{dg} )} \right) + \overline{N}_{b} \left( {IC_{b} + OM_{b} } \right) \\ & \quad + \frac{1}{{n_{s} }}\left( {\sum\limits_{t} {\sum\limits_{s} {\left( {C_{us} D_{ust}^{s} } \right) + FC_{dg} \sum\limits_{s} {\sum\limits_{t} {\left( {O_{{dg_{t} }}^{s} } \right)} } } } + \sum\limits_{s} {\sum\limits_{t} {O_{{dg_{t} }}^{s} \cdot C_{tax} \cdot C_{int} } } } \right) \\ \end{aligned}$$
(2.39)

where, Ndg, Nwt, and Npv are the total numbers of non-renewable generators, wind turbines and PV panels, respectively. ICpv, ICdg, ICwt and ICb are the levelized annual installation cost of PV panels, diesel generation, wind turbines and batteries in $, correspondingly. OMdg, OMpv, OMwt, and OMb are expressed as levelized annual management and operation cost for generation sources and FCdg is the fuel cost in $/kWh. D and Dus are the demand in kW and the unserved demand in kW, respectively. Cus, Ctax and Cint are unserved power’s cost in $/kW, the tax of carbon in ($/kg) and intensity of CO2 in kg/kW, correspondingly. Odg, Opv and Owt are the output power from generation sources in kW and ns refers to the total number of scenarios where s ϵ ns and t ϵ 1…8760 and t is in hours, respectively. There are two sets of variables for any two-stage stochastic programming as recourse and here-and-now variables, the former denoting the decisions to be made in case of uncertainty happening in the operational phase and latter referring to the decisions to be made in the planning phase. More on that, planning phase includes the installation of batteries, diesel generators, solar panels and wind turbines, while operational phase embodying the real-time output power of batteries (DChb) and diesel generators (Odg) and also the unsupplied load (Dus) [19].

5.2.2 Constraints

The ideal answer must meet a set of constraints presented in the following:

  1. A.

    Supply-demand balance: Power demand equals to the sum of unmet load and power supply from renewable energy sources at any time interval, while the storage might not have the capacity for the power produced which should be dumped or a specific amount of energy might remain unsupplied [19].

    $$\left( {\begin{array}{*{20}c} {D(t,s) = O_{dg} (t,s) + N_{pv} \cdot O_{pv} (t,s) + N_{wt} \cdot O_{wt} (t,s)} \\ { + DCh_{b} (t,s) + D_{us} (t,s) - Ch_{b} (t,s)} \\ {\forall t \in 1 \ldots t,s \in 1 \ldots n_{s} } \\ \end{array} } \right)$$
    (2.40)
  2. B.

    The output limit of diesel generator: the output power of diesel generators must not be larger than their rated capacity. In order to insure that the desired amount of power is available for all of the scenarios, the spinning reserve has been considered a function of variable s.

    $$\left( {\begin{array}{*{20}c} {O_{dg} (t,s) + SR(t,s) \le N_{dg} \cdot RC_{dg} } \\ {\forall t \in 1 \ldots t,s \in 1 \ldots n_{s} } \\ \end{array} } \right)$$
    (2.41)
  3. C.

    The State of Charge (SoC) of batteries: A constraint presenting the linkage between energy storage in the battery and the process of charging and discharging [19].

    $$\left( {\begin{array}{*{20}c} {C(t,s) = C(t - 1,s)\cdot (1 - \gamma_{sd} ) + Ch_{b} (t,s) - \frac{{DCh_{b} (t,s)}}{{\gamma_{d} }}} \\ {\forall t \in 1 \ldots t,s \in 1 \ldots n_{s} } \\ \end{array} } \right)$$
    (2.42)

    where C is the stored energy in the batteries in kWh, γsd and γd are the efficiencies of hourly self-discharging and discharging for batteries in %/hour and %, respectively. Chb (kW) and DChb (kWh) are the charging power and the power shared by the storage system (batteries), respectively [19].

  4. D.

    Capacity limits of batteries: There is an upper limit for batteries regarding their SoC:

    $$\left( {\begin{array}{*{20}c} {(1 - DOD_{\max } )\cdot C_{\max } \cdot N_{b} \le C(t,s) \le C_{\max } \cdot N_{b} } \\ {\forall s \in 1 \ldots n_{s} } \\ \end{array} } \right)$$
    (2.43)

    where DODmax is the maximum amount of depth of discharge in a cycle considering the fact that charging and discharging electric power to or from the battery must be less than or equal to its rated capacity [19].

    $$\left( {\begin{array}{*{20}c} {Ch_{b} (t,s) \le N_{b} \cdot RC_{b} } \\ {\forall t,s} \\ \end{array} } \right)$$
    (2.44)
    $$\left( {\begin{array}{*{20}c} {DCh_{b} (t,s) \le N_{b} \cdot RC_{b} } \\ {\forall t,s} \\ \end{array} } \right)$$
    (2.45)

    where The rated capacity of batteries is given by RCb in kW.

  5. E.

    The maximum permissible level of unmet power (EUE): To maintain the acceptable service being delivered, the amount of energy not being supplied, as EUE, must not exceed a predefined extent [19].

    $$\left( {\begin{array}{*{20}c} {\frac{{\sum\nolimits_{t = 1}^{9760} {D_{{us_{t} }}^{s} } }}{{\sum\nolimits_{t = 1}^{9760} {D_{t}^{s} } }} \le EUE_{\max } } \\ {\forall s \in 1 \ldots n_{s} } \\ \end{array} } \right)$$
    (2.46)
  6. F.

    Budget and/or resource limitations: In order to assure that the solution is practical from the monetary point of view, the following constraints are applied to the objective function, which denotes the budget by means of RES numbers.

    $$N_{pv,\hbox{min} } \le N_{pv} \le N_{pv,\max }$$
    (2.47)
    $$N_{wt,\hbox{min} } \le N_{wt} \le N_{wt,\max }$$
    (2.48)
    $$N_{b,\hbox{min} } \le N_{b} \le N_{b,\max }$$
    (2.49)
  7. G.

    The initial state of batteries in each scenario: The initial state of batteries in each scenario is as the following:

    $$\left( {\begin{array}{*{20}c} {C_{t}^{s} = \frac{{C_{\max } \times N_{b} }}{2}} \\ {\forall S \in 1 \ldots n_{s} ,t = 1} \\ \end{array} } \right)$$
    (2.50)

    Renewable energy penetration is one of the most important components, which needs to be taken into consideration when modeling two-stage stochastic programming for the sake of microgrids planning. In addition, as the initial investment needed for installation of diesel generation is much lower than renewable sources of energy, it is quite cost-effective to provide all the energy from them, which is not the case. Therefore, the contribution percentage for renewable resources of energy should be determined and optimized considering a particular reliability measures as the following.

  8. H.

    Minimum penetration levels of Renewable Energy Sources: In order to make the planner and optimizer to ensure a particular percentage of renewable resources energy penetration, the following constraint should be applied to the objective function [19].

    $$\left( {\begin{array}{*{20}c} {\sum\limits_{t = 1}^{t} {N_{wt} } O_{wt} (t,s) + \sum\limits_{t = 1}^{t} {N_{pv} } O_{pv} (t,s) \ge RP\sum\limits_{t = 1}^{t} {\left( {D(t,s) - D_{us} (t,s)} \right)} } \\ {\forall s \in 1 \ldots n_{s} } \\ \end{array} } \right)$$
    (2.51)

    where RP is the factor specifying the penetration level.

  9. I.

    The requirements of spinning reserve (SR): Diesel generators must be capable of responding promptly to any changes and possible failures in the power generation units.

    $$\left( {\begin{array}{*{20}c} {SR(t,s) \ge SR_{\hbox{min} } D(t,s)} \\ {\forall t \in 1 \ldots 8760,s \in 1 \ldots n_{s} } \\ \end{array} } \right)$$
    (2.52)
  10. J.

    Prevention of simultaneous discharging and charging: To prevent the process of charging and discharging from happening at the same time the following constraint is applied to the objective function.

    $$\left( {\begin{array}{*{20}c} {Ch_{b} (t,s) \times DCh_{b} (t,s) = 0} \\ {\forall t,s} \\ \end{array} } \right)$$
    (2.53)
  11. K.

    Energy to Power Ratio (E/P): Batteries’ energy capacity is determined via E/P ratio for any given power rating, which represents an association between energy size and power for a particular storage system. The former notes to the maximum sum of energy that the storage system can store for a certain duration, while the latter represents the rate at which charging and discharging processes can be continually run.

    $$\left( {\begin{array}{*{20}c} {\underline{EPR} \cdot N_{b} \cdot RC_{b} \le C(t,s) \le \overline{EPR} \cdot N_{b} \cdot RC_{b} } \\ {\forall t,m} \\ {{\text{where}}{:}\,EPR\,{\text{or}}\frac{E}{P} = \frac{{{\text{Energy Capacity }}({\text{kWh}})}}{{{\text{Power Rating }}({\text{kWh}})}}} \\ \end{array} } \right)$$
    (2.54)

5.3 Two-Stage Stochastic Programming Model—Risk Averse

One of the most important problems to be dealt with in modeling and planning microgrids that involve uncertainty is the risk investigations and exposure to economic and environmental risk cannot be avoided when it comes to planning power transmission and distribution systems for microgrids. Moreover, ideas of portfolio optimization by Markowitz [21] can be used in order to extend the two-stage stochastic programming model to consider risk investigations [19]. As there is a variance in the second-stage variables, the evaluation of the variance should be applied to them as well. The new objective function incorporating risk investigations is expressed as Eqs. (2.55) and (2.56).

$${\text{minimize}}\,A + \theta_{r} \sqrt {Var(B)}$$
(2.55)
$$Var(B) = E\left[ {B^{2} } \right] - \left( {E[B]} \right)^{2}$$
(2.56)

where B is the second-stage objective function, (E[B])2 is the square of the objective function and E[B2] is as the following:

$$E[B^{2} ]_{s} = \sum\limits_{s = 1}^{n} {B_{s}^{2} \times \Pr (s)}$$
(2.57)

where B is the objective function and Pr(s) is the possibility function expressing the incidence of state s.

The new objective function to be minimized is a non-linear objective function incorporating risk investigations as Eq. (2.58).

$${\text{minimize}}\,E[A + B] + \theta_{r} \sqrt {Var(B)}$$
(2.58)

where,

$$\begin{aligned} A & = \overline{N}_{pv} (IC_{pv} + OM_{pv} (N_{pv} )) + \overline{N}_{wt} (IC_{wt} + OM_{wt} (N_{wt} )) \\ & \quad + N_{dg} (IC_{dg} + OM_{dg} (O_{dg} )) + \overline{N}_{b} (IC_{b} + OM_{b} ) \\ \end{aligned}$$
(2.59)
$$B = \frac{1}{{n_{s} }}\left( {\sum\limits_{t} {\sum\limits_{s} {(C_{us} D_{{us_{t} }}^{s} ) + FC_{dg} \left( {\sum\limits_{s} {\sum\limits_{t} {O_{{dg_{t} }}^{s} } } } \right) + } } \sum\limits_{s} {\sum\limits_{t} {O_{{dg_{t} }}^{s} } } C_{tax} C_{int} } \right)$$
(2.60)

It should be noted that all the constraints for two-stage stochastic programming stay the same for the new risk-averse objective function, while the objective function incorporates the variance for the uncertainties explicitly.

6 Conclusion

Smart grids are the solution for the traditional power system confronting operational and monetary difficulties, which has fundamental differences comparing to the conventional one. As such, when the demand rises, the favored arrangement would not be necessarily generating more electricity to fulfill the consumption requirements. In other words, generation of electricity will not directly be dependent on consumption; rather it will be a function of losses minimization, end-user demand management and collaboration with customers in order to roll back the load. Furthermore, microgrids are a compact version of traditional power system connection multiple distributed sources to multiple loads, which draws the interest of power system planners as they can be of great importance when it comes to electrifying remote areas. In this chapter, following an introduction to the fundamentals and definition of microgrids, the focus was taken on microgrid planning and energy management that explored modeling random variables for wind and solar energy. Then, solar and wind energy modeling using several different probability distributions were explained. Finally, the optimization models for microgrid planning has been proposed elaborately using stochastic programming and deterministic mathematical models.