**1. Introduction**

The greater diffusion of renewable energies mitigates the environmental deterioration caused by greenhouse gases due to conventional electricity generation (Gen) [1]. Power microgrids (MGs)are complex because they face uncertainties such as demand forecasts, electric vehicles (EVs), battery swapping stations (BSSs), market price (MP) variability, and renewable energy forecasts [2–7]. Gen is strongly influenced by the variability of electricity market (EM) prices, which seek to minimize operating costs using energy sources such as the solar power [8]. Furthermore, pivotal agents and monopolies should be reduced because they produce market power. Traditionally, the Herfindahl Hirschman index and the Residual Supply Index have been used to monitor EMs [9].

The prediction of photovoltaic (PV) energy has been extensively studied with Monte Carlo simulations [8]. However, the lack of reliable information on solar Gen makes energy delivery less efficient. Weather conditions such as unpredictable winds prevent forecasts from being accurate. In such a scenario, uncertainty is inherent and cannot be eliminated in planning [8]. Additionally, energy is available in Ems, where agents can buy and sell power [10]. Intraday markets (IMs) present an additional complexity that should be responsible for mismatches in scheduling on the day of operation. These imbalances are produced by changes in the forecasts of the load or PV Gen [11].

The regularization of the electric generators that are involved in energy dispatch must be studied in more detail. The user is given reliability, and study on the reserves that allow absorbing market volatilities is imperative. The literature suggests planning with multiple agents to reduce greenhouse gas costs, separately evaluating operating expenses and revenues obtained in markets, and assessing the demand curve [10,12,13].

**Citation:** Garcia-Guarin, J.; Alvarez, D.; Rivera, S. Uncertainty Costs Optimization of Residential Solar Generators Considering Intraday Markets. *Electronics* **2021**, *10*, 2826. https://doi.org/10.3390/ electronics10222826

Academic Editors: Nebojša Raiˇcevi´c, Vasilija Šarac and Marinko Barukˇci´c

Received: 13 October 2021 Accepted: 15 November 2021 Published: 17 November 2021

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

Another approach takes price information from a real EM to conduct energy dispatch planning [14]. However, the adequate number of IM auctions and their relationship with (PV) Gen remains undefined [11].

The main objective of this research is to evaluate the various residential solar Gen curves of an electrical MG, which is the basis for energy dispatch [15]. Gen overestimation and underestimation deviations must be adjusted using a statistical function [8]. The variations are quantified and compared with Monte Carlo simulations [16]. Once the uncertainty costs (UCs) are estimated, UCs due to deviations in the energy dispatch of the MG are evaluated [8]. The solution strategy uses the variable neighbourhood searchdifferential evolutionary particle swarm optimization (VNS-DEEPSO) algorithm in two stages: the first one optimizes the economic benefits of the MG, and the second one optimizes the IMs [17]. This algorithm was selected due to its high performance in smart MG optimization problems [18].

The evaluations of the revenues from solar Gen were conducted by taking 500 representative scenarios out of 5000 [14]. The costs were collated with the results obtained from the Monte Carlo simulations, yielding an error between 7 X 10−5% and 0.0168% for one day of operation. The prices of uncertainty are evaluated by varying the IM auctions. It is ascertained that with greater number of auctions, the imbalances in the scheduling of solar Gen decrease.

This article presents the following structure: In Section 2, works related to the present investigation are compared. Section 3 presents the mathematical formulation of the UCs and the formulation of the objective cost function of the MG. Section 4 offers the case study, Section 5 shows the results, and Section 6 outlines the main conclusions of this investigation.

#### **2. State of the Art**

In the literature, studies on smart MGs that optimize resources are reviewed [19]. Most of the works propose the improvement of the services of the steady demand and the generators [6,19,20] so that users can participate in demand response (DR) programs [21]. They can also collaborate with flexible load managemen<sup>t</sup> by improving their consumption habits [15,22,23]. Energy storage systems (ESSs) promise to provide further flexibility to stakeholders, who can buy off-peak energy hours and sell it during peak hours [4,10,17,23]. EMs benefit from previous integration that also facilitates the penetration of renewable resources such as solar energy [8,15]. In the case of IMs, the auction numbers play an essential role in the planning of energy dispatch [11].

This research focuses on the comparison of the storage systems (SSs) with batteries, IMs, and solar energy UCs (SEUCs), as shown in Table 1. SSs with batteries include different models of ESSs and residential EVs (REVs). The models in the table are listed below. Model 1 consists of an aggregator that performs transactions between ESSs and MPs, while Model 6 appraises the interaction between providers and users [4]. Model 2 evaluates the revenues from buying and selling in the market [6]. Model 3 suggests evaluating consumption patterns and their interaction with electricity prices [24]. Model 4 shows the incentives of IMs for intermittent generators, which can participate through meritocracy [25–31]. Model 5 estimates deviations in the energy dispatch due to EV uncertainty [8]. Model 7 encourages the participation of programs with DR; in addition, Model 8 includes IMs [19,20].


**Table 1.** Review of electrical MGs.

Model 9 uses ESSs and predicts demand and Gen [26]. Model 10 enables load reduction [22]. Model 11 encourages competitiveness in EMs between DR and Gen [22]. Model 12 combines renewable sources (RSs), such as a PV panel and ESSs, to reduce CO2 emissions [27]. Model 13 schedules the commissioning of thermal power plants, which reduces gas emissions and operating costs. Additional vehicles, wind and photovoltaic generators, and ESSs are connected to the grid. In addition, Model 14 schedules the load when faced with uncertainty regarding the future price. Model 15 reduces both costs and environmental emissions by using hybrid systems with batteries and wind and solar generators. Model 16 formulates distributed energy resources, with the energy reserve capacity and coordination of the operation with renewable resources and cogeneration. Model 17, which is the model proposed in this research, turns out to be the most complete. It has an aggregator managing the MG's resources, including RS, REV, MP, IM, DR, ESS, REV, BSS, and Gen [5,7,14,28]. In addition, the MG has restrictions that prevent the appearance of monopolies, pivotal agents, and a minimum supply of demand. [9,13]. Furthermore, the mathematical formulation of the uncertainty caused by deviations in solar energy dispatch is stated [8,15]. The costs of the MG are optimized using the VNS-DEEPSO algorithm, which presents the best performance in a similar MG [17,18].

## **3. Mathematical Formulation**

The mathematical models are presented in two sections. The first section establishes the UCs for solar Gen. The second section formulates the objective function for the MG.

#### *3.1. Uncertainty Costs of Photovoltaic Generation*

The irradiance distribution ( *G*) is represented using a probability function ( *fG*) *,* where the parameter (λ) is the mean, and the parameter (*β*) is the standard deviation [33]. The distribution for intraday solar radiation curves can be adjusted as follows.

$$f\_{\mathcal{G}}(\mathcal{G}) = \frac{1}{\mathcal{G}\beta\sqrt{2\pi}} \cdot e^{-\frac{(\ln(\mathcal{G}) - \lambda)^2}{2\beta^2}} ; 0 < \mathcal{G} < \infty \tag{1}$$

In solar panels, the power that is generated depends on the reference irradiance *RC*. The irradiance can be represented by quadratic or linear behavior, as depicted below [33].

$$f\_{\rm G}W\_{PV}(G) = \begin{cases} \; W\_{PV\_r} \cdot \frac{G^2}{G\_r R\_C}, 0 < G < R\_C\\ \; W\_{PV\_r} \cdot \frac{G}{G\_r}, G > R\_C \end{cases} \tag{2}$$

The overestimation *CPV*,*o*,*<sup>i</sup>* or underestimation *CPV*,*u*,*<sup>i</sup>* represents the deviations in the binding dispatch and IMs. The variable *WPV*,*<sup>i</sup>* represents PV generators *i* and the available power, while the power programmed by the aggregator is represented by *WPV*,*s*,*i*.

$$\text{LICF} = \mathbb{C}\_{PV, \mu, i}(\mathcal{W}\_{PV, s, i} - \mathcal{W}\_{PV, i}) + \mathbb{C}\_{PV, \rho, i}(\mathcal{W}\_{PV, i} - \mathcal{W}\_{PV, s, i}) \tag{3}$$

#### *3.2. Objective Function of Microgrid*

The smart MG is represented in Figure 1, which has a bidirectional flow of information. The following tasks are undertaken: buying and selling energy in IMs, charging and discharging ESSs, charging and discharging batteries from a BSS, and charging and discharging EVs. Other elements that comprise the MG are the distributed generators (DGs) and load with DR [5,7,14,28]. In addition, the smart MG considers restrictions such as the Herfindahl–Hirschman concentration index and the index of the three most prominent bidders to avoid monopolies and pivotal agents [9]. There is also the demand welfare, which ensures a minimum consumption of the demand [13].

**Figure 1.** Structure of the electrical microgrid.

The MG model operates in a black box. Information is taken from a real MG, in which the input variables are calculated, and the MG model calculates the benefits obtained as presented below [14]. The profits of the network are represented by P, periods are represented by t, scenarios are represented by s, the probability of the occurrence of each scenario is characterized by Pr, Ns is the maximum number of scenarios, and T is the maximum number of periods.

$$\cdot MG\_{Total}^{Intraday + 1} = \sum\_{s=1}^{N\_s} \left( \sum\_{t=1}^{T=Ti} P\_{(t,s)} + \sum\_{t=Ti+1}^{T=2Ti} P\_{(t,s)} + \sum\_{t=Ti+1}^{T=24} P\_{(t,s)} \right) \cdot \text{Pr}(\text{s}) \tag{4}$$
 
$$\{Ti, 2Ti, \dots, 24\} \epsilon \mathbb{Z}$$

The deviations in the dispatch of solar energy will appear in each of the intraday periods. The UCs are calculated for each period, where *NPV* represents the maximum number of PV Gen units.

$$\begin{aligned} \sum\_{s=1}^{N\_t} \left( \sum\_{t=1}^{T-T\overline{t}} \left( \sum\_{j=1}^{N\_{PV}} \mathbf{C}\_{PV, \mu, j\overline{\mu}} (W\_{PV, s, j} - W\_{PV, i}) \right) + \dots \\ \dots & \sum\_{t=\overline{T}+1}^{T-2\overline{T}} \left( \sum\_{j=1}^{N\_{PV}} \mathbf{C}\_{PV, \mu, j\overline{\mu}} (W\_{PV, s, i} - W\_{PV, j}) \right) + \dots \\ \dots & \dots + \sum\_{t=\overline{T}+1}^{T-2\underline{\mu}} \left( \sum\_{j=1}^{N\_{PV}} \mathbf{C}\_{PV, \mu, j\overline{\mu}} (W\_{PV, s, j} - W\_{PV, i}) \right) + \dots \\ \mathbf{L} \mathbf{C}\_{Total}^{Intradary + 1} = \underbrace{\mathbf{1}}\_{t \mapsto 1} + \sum\_{t=1}^{T-\overline{T}} \left( \sum\_{j=1}^{N\_{PV}} \mathbf{C}\_{PV, \mu, j\overline{\mu}} (W\_{PV, j} - W\_{PV, s, j}) \right) + \dots \\ & \dots + \sum\_{t=\overline{T}+1}^{T-2\overline{T}} \left( \sum\_{j=1}^{N\_{PV}} \mathbf{C}\_{PV, \mu, j\overline{\mu}} (W\_{PV, i} - W\_{PV, s, i}) \right) + \dots \\ \dots & \dots + \sum\_{t=\overline{T}+1}^{T-2\overline{T}} \left( \sum\_{j=1}^{N\_{PV}} \mathbf{C}\_{PV, \mu, j\overline{\mu}} (W\_{PV, i} - W\_{PV, s, i}) \right) \end{aligned} (5)$$

The objective function is defined as minimizing the costs of uncertainty for the dispatch of solar energy minus the benefits obtained in the MG, which is optimized by using the VNS-DEEPSO algorithm.

$$\text{minimize } Z\_{Total}^{Intraday + 1} = \text{LC}\_{Total}^{Intraday + 1} - M\text{G}\_{Total}^{Intraday + 1} \tag{6}$$

#### **4. Case Study Presentation**

The case study is presented in two sections. The first section shows the statistical data used to evaluate the costs of uncertainty, and in the second one, the MG is given.

#### *4.1. Residential Solar Generators*

The power that is generated daily is taken from [14], where the energy for residential solar panels is considered. Figure 2 shows the power supply for 500 representative scenarios.

**Figure 2.** Residential PV generators in 24 h, data from [14].

The UC function must be validated using Monte Carlo simulations with which random irradiance values are obtained by assuming the proportionality between the irradiance and the generated power. Solar radiation parameters are considered according to solar radiation distribution frequency functions, as shown in Table 2 [34]. The penalties for overestimation and underestimation are considered [8].


**Table 2.** Solar generation parameter, data from [34].

The solar radiation values in Figure 2 are the basis for calculating the mean and standard deviation of each hour. The obtained values are summarized in Tables 3 and 4.

**Table 3.** Mean and standard deviation between 8 and 14 h.


**Table 4.** Mean and standard deviation between 15 and 21 h.


#### *4.2. Objective Function of Microgrid*

MG is located in Portugal and comprises 17 solar Gen units, 5 dispatchable units, 34 REVs, 2 ESSs, an external electricity service provider, and 90 users who actively participate in DR programs [35,36]. The distribution transformer is 160 kVA and connects to a medium and low voltage line of 30 kV/400 V–230 V [37]. The five dispatchable units comprise four DGs and an external solar generator. The transformer is connected to 25 buses [37]. Additionally, MG can transfer energy with intraday markets [11]. It also has penalties for costs of uncertainty in the Gen of solar energy, market power restrictions, and constraints on the minimum supply of energy for demand [9,13,15]. MG is optimized using the VNS-DEEPSO algorithm, which improves MG in the first stage and MIs in the second stage, as shown in Figure 3 [17,18].

**Figure 3.** Solar generators in the electrical microgrid [14].

#### **5. Results and Discussion**

The results are presented in two sections. In the first section, the UCs for residential solar energy Gen are validated, while in the second one, the UCs are estimated by varying the IMs of the MG.

#### *5.1. Uncertainty Costs with Residential Solar Generators*

The validation uses Monte Carlo simulations to determine the histograms of irradiance and solar power generated with the underestimated and overestimated costs of solar radiation, as shown in Figure 4.

**Figure 4.** Histograms of (**a**) irradiance and (**b**) solar power generated. (# means 104).

Penalties due to UCs are determined, and UCs are calculated while solar Gen varies (Figure 5).

**Figure 5.** Monte Carlo simulations for (**a**) UC function histogram and (**b**) evaluation of UCs by varying solar power. (# means 104).

Finally, the UCs are evaluated for each hour using Monte Carlo simulations and the UC function. In the Monte Carlo simulations, the value is obtained with the average of the estimated values *MCPV* [38]. The costs for underestimation and overestimation are used [33] as shown below.

$$AC\_{PV} = E[C\_{PV, \mu, i}(\mathcal{W}\_{PV, s, i}, \mathcal{W}\_{PV, i})] + E[C\_{PV, \mu, i}(\mathcal{W}\_{PV, \rho, i}, \mathcal{W}\_{PV, i})] \tag{7}$$

The estimated error when evaluating the Monte Carlo functions and the UC function is summarized in Tables 5 and 6. The error is in the range between 7 × 10−5% and 0.0168%. This research differs from previous works in which the uncertainty costs of renewable energies per day had been evaluated; in this research, a set of intraday evaluations per hour is carried out. For comparative purposes, the highest error reported in each research is taken, in which the error of 0.0168% is more exact than the errors obtained for 0.0615% from [39], 0.0343% from [16], and 0.072% from [33]. This means that this investigation contains the error closest to zero.

**Table 5.** The estimated error between 8 and 14 h.


**Table 6.** The estimated error between 15 and 21 h.


#### *5.2. Uncertainty Costs Varing Intraday Markets in the Microgrid*

The uncertainty from the solar energy dispatch is due to the underestimation and overestimation of the power. The MG model considers the UCs for solar Gen with 2, 3, 4, and 6 IMs. The auctions are taken in symmetrical times; for example, in the case of three intraday markets, the auctions are conducted every 8 h, as shown in [11]. The uncertainty costs due to overrating and underestimating the solar energy dispatch are reduced with a more significant number of intraday markets, as shown in Figure 6.

**Figure 6.** UCs of PV generators varying IMs.
