**1. Introduction**

The concept of smart, environmentally friendly, and sustainable cities is crucial to assessing how well nations have advanced their civilizations and development [1–3]. The goal of developed nations' research and development efforts is to create greener cities and communities that enhance the state of the environment worldwide and reduce pollution from human activity [4]. To accomplish a comprehensive energy solution, it is crucial to control the demand for and distribution of produced energy [3,4]. Furthermore, it is also necessary to implement various forms of renewable energy technology in cities and societies [5]. To enable sustainable energy for cities, a mix of several renewable energy sources, such as solar, wind, geothermal, tidal, etc., is necessary [6]. Intelligent energy management strategies can be implemented at all levels, starting at home and extending to

**Citation:** Nazir, M.S.; Chu, Z.; Abdalla, A.N.; An, H.K.; Eldin, S.M.; M. Metwally, A.S.; Bocchetta, P.; Javed, M.S. Study of an Optimized Micro-Grid's Operation with Electrical Vehicle-Based Hybridized Sustainable Algorithm. *Sustainability* **2022**, *14*, 16172. https://doi.org/ 10.3390/su142316172

Academic Editors: Herodotos Herodotou, Sheraz Aslam and Nouman Ashraf

Received: 5 November 2022 Accepted: 1 December 2022 Published: 3 December 2022

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

**Copyright:** © 2022 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/).

every nook and cranny of the city, including transportation, schools, hospitals, factories, streets, etc. [7]. The increasing penetration of renewables has driven power systems to operate closer to their stability boundaries, increasing the risk of instability [8]. With the upcoming dynamic power generation in many countries, the installed capacity of power generation can gradually and effectively use energy to promote energy conservation, which plays an important role in achieving sustainable energy development [8,9]. The authors discussed the rapid development of power grid technology in the mix with the electric vehicles (EVs) industry (V2G) [10,11]. Using large-scale EV charging piles in the area to realize vehicle network interaction allows large-scale EVs and EVs to take part in economic optimization management, while the use of an energy storage system allows users to create energy arbitrage by discharging during price peaks and charging during off-peak periods if a variable energy price is considered [9].

The control methods of the microgrid (MG) are more diversified, and the development of safety emergency response capabilities has become a current research hotspot. In terms of reducing the valley gap, the literature uses the temporal and spatial characteristics of EVs to construct an orderly charging and discharging load for EVs and a real-time electricity price response model [12]. EVs and other power generation equipment can take part in the economic dispatch of the MG. To study the different strategies between EV power stations and MG, an economic dispatch optimization model was constructed [13]. To solve the increase in the popularity of the complex EV access point network, it has been proposed large-scale EVs be connected to the network, and there is a good deal of optimization scheduling methods. EVs are effectively used to optimize charging and reduce system load peaks and valleys [14]. However, the economic dispatch model of the literature mentioned above considered three factors of an MG, while the user benefits and safety of MG operation do not cogitate the performance of MG management and the participation of EV users [8,15].

These days, smart parking lots are becoming more and more popular since they offer a workable solution to power outages [16]. Systems for managing energy can benefit from heuristic algorithms since they speed up decision-making and develop a novel heuristic algorithm for MG energy management [17]. The principle behind this algorithm is to avoid wasting the available renewable potential at each period. Model predictive control is used to reduce the output power loss caused by converter failure, panel shading, and dirt buildup on wind and PV panels [18].

Authors discussed the dimensional optimization algorithm for optimizing scheduling problems, such as the endless combination of particle swarm optimization (PSO) algorithm and differential evolution algorithm (DE), and the random particle swarm algorithm (RDPSO) [19,20]. Authors proposed that WOANN predicts the required control gain parameters of the hybrid renewable energy systems to maintain the power flow, based on the active and reactive power variation on the load side [19]. The imperialist competition algorithm (ICA) combined mutation, destruction, and selection of a variety of different operators with PSO and other methods studied [21,22]. However, these methods have some shortcomings in finding the optimal solution and the best ability to overcome them [23]. Based on the above analysis, starting from the management side of the MG operator, we comprehensively considered the three factors of MG operation safety, environmental governance, and user participation. A preliminary EV participation in the MG operation management optimization model was established to realize the operating and management costs, environmental pollution control costs, and the lowest mid-term cost [24]. The multi-agent chaotic particle swarm optimization (MACPSO) algorithm combined with the chaotic particle swarm optimization algorithm and chaotic particle swarm optimization (CPSO) algorithm was used to solve the problem [25]. The demand and response characteristics of each power generation unit, large-scale EVs, and electric load in the region were different, and the constraint conditions of each power generation unit presented nonlinear characteristics [26]. A regional MG under the constraints of nonlinear equations is one difficulty for researchers [27]. Furthermore, achieving the best states of

management cost, environmental pollution, and load fluctuation variance are another topic of discussion [26]. Authors used the penalty function method to deal with the relevant constraints; this method adds a penalty term to generate a new objective function [20]. Energy conservation has become a long-term strategic policy for global economic and social development [27]. The enhancement of energy management can improve energy efficiency and promote energy conservation and emissions reduction [28]. However, integrating renewable energy and a flexible load makes the integrated energy system a complex dynamic with high uncertainty, bringing great challenges to modern energy management [29]. With the increasing number of vehicle charging piles installed in recent years, load peak periods are brought to the station area, resulting in an insufficient capacity of the station area, in turn resulting in an overload of the distribution transformer in the station area, increased loss of lines and transformers, and other problems [30]. A good auxiliary power supply is the key to the coordinated development between vehicle charging and the power grid in a smart MG [28]. The wind and solar energy generation system can transform the natural resources of the station area into a stable power supply. Authors proposed an energy management method for a grid-connected wind-solar storage MG system with multiple types of energy storage [31]. Authors have researched optimal energy scheduling of MG considering EV charging load [32]. According to the two operation modes of the MG, namely grid-connected and isolated islands and the different access modes of EVs, the MG operation control strategy including EVs was customized [21]. To investigate if solar energy and wind energy are naturally complementary, an energy storage system and an optimized battery energy storage control strategy were combined to put forward a hybrid landscape storage system control strategy considering the charging effect of batteries [33]. The author discussed the operation energy management strategy of the isolated grid of an MG containing hybrid energy storage [33]. However, none of these explored strategies were studied with regard to their application in smart stations/MGs and EVs.

This paper proposes large-scale EVs involved with MG operation and its management optimization method. This method first makes full use of the EV natural flexible load property, and the response of the large-scale EV scheduling model is constructed. Then, considering the system's operation, user participation, and environmental governance, an optimization model is established. The system operation management cost of the MG, environmental pollution control cost, and load fluctuation variance are integrated to achieve an optimal system. Finally, by comparing the optimization results of multiple scenarios, it is verified that the model can realize effective load management in the region and reduce the management cost of MGs and environmental pollution treatment costs to support a healthy society.

The rest of the study is organized as follows, Section 2 presents the related work, Section 3 describes the proposed model, Section 4 explains the results and discussion and the conclusion is presented in Section 5.

### **2. Related Work**

#### *2.1. Model of Large-Scale EVs*

Assume that some users of EVs in the area respond to the dispatching information of the regional grid to charge from and discharge to the MG. In contrast, some users do not respond to dispatching information and randomly access charging [21]. The dispatching structure diagram is shown in Figure 1.

According to the operating characteristics of the EVs in the area, the regional responsedispatching EV cluster is divided into a charging cluster and a discharging cluster [34]. The charging and discharging responsiveness of EV users at time *t* expressed as:

$$\varphi\_d(t) = \frac{N\_d(t)}{N \times 100\%} \tag{1}$$

$$
\varphi\_{\mathfrak{C}}(t) = \frac{N\_{\mathfrak{C}}(t)}{N \times 100\%} \tag{2}
$$

$$
\varphi(t) = \varphi\_d(t) + \varphi\_c(t) \tag{3}
$$

where *N* is the total number of EVs in the area; *N<sup>d</sup>* (*t*) is the number of EVs that respond to discharge information; *Nc*(*t*) is the number of EVs that respond to charging; *ϕ<sup>d</sup>* (*t*) is the discharge responsiveness of EV users; *ϕc*(*t*) is the user's charging responsiveness; *ϕ*(*t*) is the user's responsiveness. When a user responds to charging, *ϕ<sup>d</sup>* (*t*) = 0, and when the user responds to discharge, *ϕc*(*t*) = 0. *Sustainability* **2022**, *14*, x FOR PEER REVIEW 4 of 20 respond to dispatching information and randomly access charging [21]. The dispatching structure diagram is shown in Figure 1.

**Figure 1.** Layout of large-scale EV response to MG dispatch. **Figure 1.** Layout of large-scale EV response to MG dispatch.

#### According to the operating characteristics of the EVs in the area, the regional re-*2.2. EV Disorderly Charging Model*

sponse-dispatching EV cluster is divided into a charging cluster and a discharging cluster [34]. The charging and discharging responsiveness of EV users at time *t* expressed as: ( ) ( ) 100% *d d N t t N* ϕ <sup>=</sup> <sup>×</sup> (1) ( ) ( ) 100% *c c N t t N* ϕ <sup>=</sup> <sup>×</sup> (2) It is assumed that the charging power of an EV is equal to the power of the connected charging piles and limited by the power of the charging piles installed in the area [35]. The charging power of different types of charging piles is inconsistent. According to the maximum state of charge of the *i*-th EV *SOCi*,*max*, the state of charge *SOC<sup>i</sup>* at the beginning of charging, the power of the connected charging pile *Pi*,*ch*, the power battery capacity *C*, and the charging efficiency *ηCEV*, the charging duration of EVs obtained in the formula is as follows [36]:

$$t\_{c,i} = \frac{(\text{SOC}\_{i,\text{max}} - \text{SOC}\_i)\mathbf{C}}{\eta\_{\text{CEV}} P\_{\text{ch},i}} \tag{4}$$

where is the total number of EVs in the area; ௗ() is the number of EVs that respond The calculation expression is:

$$P\_{\rmuno}(t) = (1 - \rho(t)) \sum\_{i=1}^{N} P\_{\rm ch,i}(t).a\_{\rm lcp,t}.a\_{\rm stlate,t} \tag{5}$$

, ,, <sup>1</sup>

= − (5)

 αα

the user responds to discharge, () = 0. *2.2. EV Disorderly Charging Model*  It is assumed that the charging power of an EV is equal to the power of the connected charging piles and limited by the power of the charging piles installed in the area [35]. The charging power of different types of charging piles is inconsistent. According to the where *Puno*(*t*) represents the total disordered charging load in the area at time *t, t* 1, 2, 3, . . . , 24; N is the number of EVs; *Pch*,*<sup>i</sup>* (*t*) is the connection at the charging time *t*, *αstate*,*<sup>i</sup>* represents the state of the charging pile, *αstate*,*<sup>i</sup>* = 1 represents the charging state, and *αtcp*,*<sup>i</sup>* represents the parking time; *tp*,*<sup>i</sup>* is greater than the required charging duration. *tc*,*<sup>i</sup>* is used to calculate the charging power that is *αtcp*,*<sup>i</sup>* 1 and the total disordered charging load in the *t* period area.

#### maximum state of charge of the *i*-th EV ,௫, the state of charge at the beginning of charging, the power of the connected charging pile ,, the power battery capac-*2.3. Model of Charging, Discharging, and User Response*

ity , and the charging efficiency ா, the charging duration of EVs obtained in the formula is as follows [36]: ,max , , ( ) *i i c i CEV ch i SOC SOC C t* η *P* <sup>−</sup> <sup>=</sup> (4) The calculation expression is: EV users respond to dispatched charging and discharging, while users responding to the dispatching information of the regional MG and connect to the regional MG for controllable charging and discharging in an orderly manner. Suppose that when the user of the *i*-th EV responds to the scheduling information, they also provide feedback on important parameters such as the state of charge of the power battery *SOC<sup>i</sup>* , the parking time *tp*,*<sup>i</sup>* , the next trip, and the unit power consumption of the EV to the area of the MG to calculate the energy consumption for the rest of the user's journey *SOCrest*,*<sup>i</sup>* according

> ( ) (1 ( )) ( ). . *N uno ch i tcp t state t i*

1,2,3, . . . ,24; N is the number of EVs; ,() is the connection at the charging time *t*,

=

*Pt t Pt* ϕ

to the feedback parameter information, the state of charge of comprehensive user anxiety *SOCanx*,*<sup>i</sup>* , and to protect the battery reserve with capacity margin of not less than 20% to calculate the charging and discharging time of the EV.

The charging duration is consistent with Equation (6), and the discharge duration is expressed as [37]:

$$t\_{d,i} = \frac{(\text{SOC}\_i - \text{SOC}\_{i,\text{rest}} - \text{SOC}\_{\text{ann},i} - \text{20\%})\text{C}}{\eta\_{d\to V}P\_{\text{dis},i}}\tag{6}$$

where *ηdEV* is the discharge efficiency of EV; *Pdis*,*<sup>i</sup>* represents the discharge power of the connected charging pile.

The total charge and discharge power *PresEV*(*t*) of EVs in the area at time *t* can be obtained by:

$$P\_{\text{disLoad}}(t) = \varphi\_{\text{dis}}(t) \sum\_{i=1}^{N} P\_{\text{dis},i}(t). \mathfrak{a}\_{tdp,t}. \mathfrak{a}\_{\text{state},t} \tag{7}$$

$$P\_{cLoad}(t) = \varphi\_c(t) \sum\_{i=1}^{N} P\_{ch,i}(t). \alpha\_{tcp,t}. \alpha\_{state,t} \tag{8}$$

$$P\_{\rm resEV}(t) = P\_{\rm disLoad}(t) + P\_{\rm cLoad}(t) \tag{9}$$

where *αtdp*,*<sup>i</sup>* means that the parking time *tp*,*<sup>i</sup>* is greater than the continuous discharge time *td*,*i* to calculate the discharge power, that is, *αtdp* = 1, according to the discharge of the connected charging pile power.

#### **3. Proposed Model**

#### *3.1. Objective Function*

The operating and management costs of the regional MG and pollutant control costs can be collectively referred to as the total operating and management costs of the regional MG, defined as:

$$\min \text{F } \lambda\_1 (F1 + F2) + \lambda\_2 \text{F3} \tag{10}$$

where *λ*<sup>1</sup> and *λ*<sup>2</sup> are weighting factors, where *λ*<sup>1</sup> + *λ*<sup>2</sup> = 1.

The integrated operation and management cost of an MG with large-scale EVs mainly includes the economic operation cost of the MG and the incentive cost for EVs that respond to dispatching to take part in the dispatch as follows:

$$F\_1 = \sum\_{i=1}^{T} \left\{ \left[ \mathbb{C}\_n(P\_{\rm DG}(n, t)) + \mathbb{C}\_{w, n}(P\_{\rm DG}(n, t)) \right] \right\} + \mathbb{C}\_{grid}(t)P\_{grid}(t) + \mathbb{C}\_{exit}(t) + \mathbb{C}\_{dc}(t) \tag{11}$$

where *T* is a dispatch cycle; *NDG* is the type of power generation unit installed in the area; *C*(*PDG*(*n*, *t*)) is the power generation cost of the *n*th type of power generation unit; *CW*,*n*(*PDG*(*n*, *t*)) is the maintenance cost of the nth type of power generation unit; *PDG*(*n*, *t*) is the power generation of the *n* type of power generation unit; *cgrid*(*t*) and *Pgrid*(*t*) are the agreement points of the MG and the power grid company at time *t*, respectively; *Cexcit*(*t*) is the cost of incentivizing EVs to participate in dispatch; *Cdc*(*t*) is the difference between the operation purchase of electricity from users (discharge) and the sale of electricity to EVs (charging), an additional fee is required.

The power generation cost of a distributed generation unit is defined as:

$$\mathcal{C}\_{\rm n}(P\_{\rm DG}(\mathfrak{n},t)) = \mathfrak{a}\_{\rm n}[P\_{\rm DG}(\mathfrak{n},t)]^2 + \beta\_{\rm n}P\_{\rm DG}(\mathfrak{n},t) + \gamma\_{\rm n} \tag{12}$$

where *αn*, *βn*, and *γ<sup>n</sup>* are cost constants, which are related to the type of distributed generation (DG) unit.

The maintenance cost of the power-generating unit is approximately proportional to the power generated by the power-generating unit.

$$\mathcal{C}\_{w,n}(P\_{DG}(n,t)) = \lambda\_n^m(P\_{DG}(n,t) \tag{13}$$

where *λ m n* represents the maintenance coefficient of *n* types of distributed power generation units. Different types of distributed power generation units have different maintenance coefficients. For different types of maintenance coefficients, please refer to the literature.

To use the capacity of the EV's power battery, the regional MG adopts certain incentives for car owners to attract EV owners to actively respond to the dispatching information of the regional MG, charge/discharge the regional MG, and take incentive measures.

The cost calculation expression is:

$$\mathbf{C}\_{\text{exci}}(t) = \boldsymbol{\varrho}(t) \sum\_{i=1} (\mathbf{SOC}\_{i,\text{max}} - \mathbf{SOC}\_{i,\text{min}}) \mathbf{C} \boldsymbol{\rho}\_{\text{exci}}(t) \wedge\_i(t) \tag{14}$$

where *ρexcit*(*t*) represents the unit incentive cost at time *t*, and its value is calculated by referring to the distributed generation kilowatt-hour subsidy standard [38]; Λ*i*(*t*) is the connection state of the charging pile at time *t*, Λ*i*(*t*) = 1 means the charging pile is connected, Λ*i*(*t*) = 0 means the charging pile is not connected.

The additional cost added by the difference in the electricity price during the charging and discharging period of the user can be calculated by:

$$\mathcal{C}\_{d\varepsilon}(t) = \sum\_{i=1}^{T} \sum\_{i=1}^{N} \left\{ \varphi\_{dis}(t) P\_{dis,i}(t) p(t) \,\triangle\_{d,t} - (1 - \varphi\_{dis}(t)) P\_{ch,i}(t) c(t) \Delta\_{\varepsilon,i} \right\} \tag{15}$$

where *T* is a dispatch period; *N* is the total number of EVs in the area; *p*(*t*) is the on-grid price of the user for discharging into the regional MG at time *t*; *c*(*t*) is the charging price of the user at time t; ∆*tc*,*<sup>i</sup>* and ∆*td*,*<sup>i</sup>* , respectively, represent the continuous charging and discharging time of EV users to the regional MG. The pollutant penalty costs for MG operation are as follows:

$$F\_2 = \sum\_{t=1}^{T} \left| \sum\_{n=1}^{N\_{DG}} \sum\_{m=1}^{M} \mathcal{C}\_m \alpha\_{m,n} P\_{DG}(n, t) + \sum\_{m=1}^{M} \mathcal{C}\_m \alpha\_{grid,m} P\_{grid}(t) \right| \tag{16}$$

where *M* is the type of pollutant, and the power generation process mainly considers NOx, SO2, and carbon emissions; *C<sup>m</sup>* represents the cost per kilogram of treating these m types of pollutants; *αn*,*<sup>m</sup>* represents the first type of power generation unit produced. The emission coefficient of *m*-type gas pollutants; *PDG*(*n*, *t*) is the power generation of the nth type of power generation unit; *αgrid*,*<sup>m</sup>* represents the emission coefficient of *m*-type gas pollutants generated when the public large-scale power grid transmits electric energy; *Pgrid*(*t*) represents the power flowing in both directions between the regional MG and the large public grid.

The power supplied by the grid to the MG is positive, and the power supplied by the regional MG to the large power grid is negative due to the load fluctuation and due to improving the security and stability of the MG's economic operation.

$$F\_3 = \frac{1}{T} \sum\_{t=1}^{T} \left( P\_{load}(t) + P\_{uno}(t) + P\_{resEV}(t) - \sum\_{n=1}^{N\_{DG}} P\_{DG}(n, t) - P\_{av}(t) \right)^2 \tag{17}$$

where *Pload*(*t*) represents the basic electricity load in the MG in the period *t*; *Puno*(*t*) represents the disorderly charging load of EVs in the period *t*; *PresEV*(*t*) represents the EVs response charge and discharge in the period *t* load.

#### *3.2. Constraints*

To achieve a balanced state of power on the supply and demand side in regional MGs, the power balance constraint can be expressed as:

$$P\_{load}(t) + \left(P\_{uno}(t) + P\_{resEV}(t)\right) = \sum\_{n=1}^{N\_{DG}} P\_n(t) - P\_{bss}(t) + P\_{grid}(t) \tag{18}$$

where *Pn*(*t*) is the power supply of the *n*th type of power generation unit in the area; *Pbss*(*t*) is the energy storage system's total charge and discharge power; greater than 0 means discharging, and less than 0 means charging.

EV charging and discharging state constraints:

$$\text{SOC}\_{i}(t+1) = \text{SOC}(t)\_{i} + \left(\frac{\eta\_{c,i} P\_{c,i}(t)}{\text{C}} \alpha\_{\text{state},i} \cdot \triangle\_{c,t} + \frac{P\_{di,i}(t)}{\eta\_{d,i} \text{C}} \alpha\_{\text{state},i} \triangle\_{d,t}\right) \tag{19}$$

where *SOCi*(*t* + 1) and *SOCi*(*t*) are, respectively, the state of charge of the *i*th EV power battery during (*t* + 1) and *t* periods; *ηc*,*<sup>i</sup>* , *ηd*,*<sup>i</sup>* represents the charge and discharge efficiency of EV; ∆*c*,*<sup>t</sup>* and ∆*d*,*<sup>t</sup>* represent the duration of charge and discharge.

To meet the user's next trip needs, the user can set the desired power battery power.

$$\text{SOC}\_{i}(t\_{\text{leave}}) \ge \text{SOC}\_{\text{desired},i} \tag{20}$$

where *SOCdesired*,*<sup>i</sup>* represents the state of charge of the power battery expected by the user when leaving the charging pile; *SOCi*(*tleave*) represents the actual state of charge of the power battery when the EV leaves the charging pile.

#### *3.3. Hybridized Algorithm*

#### 3.3.1. The GSA Algorithm

The GSA acts on agents as objects whose actions are recorded by the masses [39]. Objects are to display a solution or a portion of a solution. The gravitational pull attracts items to themselves, causing a worldwide movement toward objects with larger masses [40]. Because the heavier masses have higher fitness criteria, achieving a worthy ideal answer is more difficult.

The position is defined with *N* as:

$$X\_{\mathbf{i}} = (\mathbf{x}\_{\mathbf{i}}^1 \dots \mathbf{x}\_{\mathbf{i}}^d \dots \mathbf{x}\_{\mathbf{i}}^n) \text{ for } \mathbf{i} = \mathbf{1}, \mathbf{2}, \dots, \mathbf{N} \tag{21}$$

First, the agents of the solution have given a solution based on Newton's gravitational theory [41]. The gravitational force is calculated as follows:

$$F\_{ij}^d(t) = G(t)\frac{M\_i(t)\ge M\_j(t)}{R\_{i\bar{j}}(t) + \varepsilon} \left(\mathfrak{x}\_{\bar{j}}^d(t) - \mathfrak{x}\_i^d(t)\right) \tag{22}$$

The Euclidian distance can be written as:

$$R\_{i\dot{j}}(t) = \left\| X\_i(t), X\_{\dot{j}}(t) \right\|\_2 \tag{23}$$

The total force acting can be presented as:

$$F\_i^d(t) = \sum\_{j \in k\text{best}, j \neq i}^{N} rand\_j F\_{ij}^d(t) \tag{24}$$

Moreover, *a d i* (*t*) can be presented as:

$$a\_i^d(t) = \frac{F\_i^d(t)}{M\_{il}(t)}\tag{25}$$

Furthermore, a technique based on this concept can be described to obtain an agent's subsequent speed and location. An agent's subsequent speed can be represented as a function of its current velocity plus its current acceleration. As a result, the improved location and speed provides:

$$v\_i^d(t+1) = rand\_i \times v\_i^d(t) + a\_i^d(t) \tag{26}$$

$$\mathfrak{x}\_{i}^{d}(t+1) = \mathfrak{x}\_{i}^{d}(t) + \mathfrak{v}\_{i}^{d}(t+1) \tag{27}$$

To appropriately regulate the search procedure, the gravitational constant (G) is set arbitrarily at the start and gradually decreases over time as follows:

$$G(t) = G(G\_0, t) \tag{28}$$

$$G(t) = G\_0 e^{-\alpha \frac{t}{\hbar}} \tag{29}$$

The masses of the agents can be determined via fitness evaluation. The greater an agent's act mass, the more significant that agent is to obtaining the answer. According to Newton's laws of gravity and motion, a hefty mass has greater pull-on power and moves slower. The masses can be described as follows:

$$M\_{\rm di} = M\_{\rm pi} = M\_{\rm ii} = M\_{\rm i} \quad i = 1, 2, \dots, N$$

$$m\_{\rm i}(t) = \frac{fit\_i(t) - worst(t)}{best(t) - worst(t)}\tag{30}$$

$$M\_{\bar{l}}(t) = \frac{m\_{\bar{l}}(t)}{\sum\_{j=1}^{N} m\_{\bar{j}}(t)}\tag{31}$$

#### 3.3.2. The RFR Algorithm

The fitness function for the GSA algorithm must be established to assess the benefits and drawbacks of the RFR model for each node [42]. The following new particle will result from the crossing:

$$X\_{inew}^{k} = rX\_i^k + (1 - r)X\_j^k \tag{32}$$

$$V\_{incw}^{k} = \frac{V\_i^k + V\_j^k}{|V\_i^k| + \left|V\_j^k\right|} \left|V\_j^k\right|\tag{33}$$

where the random number *r* value is between 0 to 1; the velocities of particles are *V*<sup>i</sup> and *V*j , *X*<sup>i</sup> and *X*<sup>j</sup> ; *X*<sup>i</sup> and *V*<sup>i</sup> are the new positions and velocities of the different particles, while *X*<sup>i</sup> replaces them.

The method of dynamically adjusting the inertia factor is used for great particles.

In the initial phase, *w* is nominated to develop global searchability. The slighter *w* stood in the later phase to attain a more sophisticated search. The efficient formulation of the inertia factor is presented in Equation (33).

$$w(t) = (w\_1 - w\_2) \times (T - t) / T + w\_2 \tag{34}$$

The following was chosen for the mean square of the residual:

$$R\_{RF}^2 = 1 - \frac{MSE\_{ooB}}{\sigma\_y^2} \tag{35}$$

where the predicted cost of variance is σ 2 <sup>y</sup>; residual error *R 2 RF* is the mean square. Each input feature's significance can be determined by random forest as:

$$f\_{\mathbf{i}} = \frac{\sum\_{j \in featurei} \mathfrak{m}\_{j}}{\sum\_{k} \mathfrak{m}\_{k}} \tag{36}$$

$$
\dot{m}\_k = \dot{w}\_k M\_k - \dot{w}\_{k1} M\_{k1} - \dot{w}\_{k2} M\_{k2} \tag{37}
$$

where node *k* importance is *n*k; the feature division is the node with the feature *I* as *n*<sup>j</sup> ; the number of samples in node *k* is *w<sup>k</sup>* , *w1*, and *w2*, the ratio and its sub-nodes to all the samples, respectively; the node *k* mean square errors are *M<sup>k</sup>* , *M1*, and *M<sup>2</sup>* and its sub-nodes.

Figure 2 shows the multi-objective model is weighted into a comprehensive singleobjective model. There may be errors in weighting to overcome subjective experience. This paper uses the entropy method for weighting, forming a weighted single-objective optimization model, and implementing specific steps.


**Figure 2.** MG operation-based hybridized GSA-RFR algorithm. **Figure 2.** MG operation-based hybridized GSA-RFR algorithm.

#### **4. Result and Discussion 4. Result and Discussion**

#### *4.1. Model Parameter 4.1. Model Parameter*

weight

ଵ 0.5, initial social learning factor

Figure 3 shows a selection of the typical wind and solar power forecast curves in the MG of a park. The charging piles are installed in the park and can be divided into three levels. Table 1 lists the allowable charging power of each level of charging piles. The three-Figure 3 shows a selection of the typical wind and solar power forecast curves in the MG of a park. The charging piles are installed in the park and can be divided into three levels. Table 1 lists the allowable charging power of each level of charging piles. The

0.9, the lower limit of inertia

3, the search radius

2.5, termination self-learning factor

20.5, termination social learning factor ଶ = 2.5,

level charging pile proportions are 50%, 30%, and 20%. Due to the limitations of the actual

stalled in the park, unit power generation costs and maintenance costs, environmental governance cost coefficients, and time-of-use electricity prices of the park [43]. Assuming that all EVs in the park are of the same type, the charging and discharging power and the charging and discharging efficiency are the same. The EV's parameters are shown in Table 5. The GSA-RFR algorithm parameters; population size is 300, the maximum iteration time

= 350, the upper limit of inertia weight ௫

0.5, the number of iterations of optimal chaos ℎ = 10.

0.4, the initial self-learning factor

environment size ௦௭ 20, optimal chaotic environment size ℎ௦௭

three-level charging pile proportions are 50%, 30%, and 20%. Due to the limitations of the actual park's MG installed capacity and transmission power lines, it is assumed that there are 100 EVs in the park. Tables 2–4 show the parameters of the power generation units installed in the park, unit power generation costs and maintenance costs, environmental governance cost coefficients, and time-of-use electricity prices of the park [43]. Assuming that all EVs in the park are of the same type, the charging and discharging power and the charging and discharging efficiency are the same. The EV's parameters are shown in Table 5. The GSA-RFR algorithm parameters; population size is 300, the maximum iteration time *MaxTime* = 350, the upper limit of inertia weight *wmax* = 0.9, the lower limit of inertia weight *wmin* = 0.4, the initial self-learning factor *c<sup>i</sup>* = 2.5, termination self-learning factor *c*<sup>1</sup> *<sup>f</sup>* = 0.5, initial social learning factor *c<sup>i</sup>* = 20.5, termination social learning factor *c*<sup>2</sup> *<sup>f</sup>* = 2.5, environment size *lsize* = 20, optimal chaotic environment size *hsize* = 3, the search radius *r* = 0.5, the number of iterations of optimal chaos *hcir* = 10. *Sustainability* **2022**, *14*, x FOR PEER REVIEW 11 of 20

**Figure 3.** Typical wind and PV power generation forecast curve in the area. **Figure 3.** Typical wind and PV power generation forecast curve in the area.


**Table 1.** Charging power rating of piles. **Table 1.** Charging power rating of piles.

**Contaminant** 

**Period (Time)** 

**Table 2.** Parameters of each power generation unit, generation cost, and maintenance cost. **Table 2.** Parameters of each power generation unit, generation cost, and maintenance cost.

**Type Control Costs (USD/kg) Pollutant Emission Factor (kWh)** 

CO2 0.21 889 724 0 0 SO2 14.842 1.8 0.0036 0 0 NOx 62.94 41.6 0.2 0 0

> **10:00–15:00 19:00–22:00**

Electricity price (USD/kWh) 1.56 0.7 0.43 Purchase price (USD/kWh) 0.75 0.43 0.14

Value 52.5 20/90 50 0.95

**(kWh) SOC Limit (%)** 


**Grid MT WT PV** 

**1:00–6:00 23:00–24:00** 

**(%)** 

**Charge and Discharge Efficiency** 

**Peak Normal Valley** 

**7:00–9:00 16:00–18:00** 

**Charge and Discharge Power Limit (kW)** 

**Table 4.** Local time-of-use electricity price list.

**Table 5.** Electric vehicle parameters.

**Category Battery Capacity** 

**Table 3.** Environmental costs and pollutant emission coefficient.


**Table 3.** Environmental costs and pollutant emission coefficient.

**Table 4.** Local time-of-use electricity price list.


**Table 5.** Electric vehicle parameters. selected: (1) user autonomous charging model; (2) orderly charging and discharging


per in reducing load volatility, three different EV charging and discharging models are

#### *4.2. Effectiveness of the Large-Scale EV Response Scheduling Model* of-use electricity price is shown. The performance of orderly charge and discharge according to the peak-valley time-of-use electricity price information is reduced by 11.6%. Mean-

To verify the effectiveness of a large-scale EV response scheduling model in this paper in reducing load volatility, three different EV charging and discharging models are selected: (1) user autonomous charging model; (2) orderly charging and discharging model based on peak-valley time-of-use electricity prices; (3) response scheduling model, using three different charging and discharging models, the total electricity load, including EVs, and the charging and discharging loads were calculated, and the user response degree was set to 100%. The operating results are shown in Figure 4. while, this causes EV users to charge and discharge the MG to generate new electricity (peaks), which makes a new impact on the MG. The response scheduling model guides EVs to charge from and discharge to the MG based on peak-valley time-of-use electricity prices and regional load information. Compared with the user-autonomous charging model and the orderly charge–discharge model of peak-valley time-of-use electricity prices, the variance of load fluctuations is reduced by 25.3% and 15.5%. The response scheduling model improves the smoothness of the regional load.

**Figure 4.** The operation results of MG with different loads.

*4.3. Weight Coefficients and Impact of Different Optimization Results* 

fluctuation variance of the MG in a dispatch period are shown in Table 6.

**Table 6.** Comparison of optimization results of different weight coefficients.

**efficient MG Operation Costs (USD) Environmental Pollution** 

1 94,099.872 10,735.098 12.56 2 42,739.869 8585.706 86.68 3 36,717.197 8081.684 118.62 4 31,347.512 7632.539 126.76

cients. Among them, the weight coefficient λ1 in each group has a value of 0, 0.3, 0.5, 0.8, and 1; the weight coefficient λ2 is 1, 0.7, 0.5, 0.2, 0, respectively. According to the optimization results, the statistics of the integrated operation and management costs and load

**Costs (USD)** 

**Load Fluctuation** 

**Variance** 

**Figure 4.** The operation results of MG with different loads.

**Weight Co-**

In Figure 4, the orderly charge and discharge model based on the peak-valley time-ofuse electricity price is shown. The performance of orderly charge and discharge according to the peak-valley time-of-use electricity price information is reduced by 11.6%. Meanwhile, this causes EV users to charge and discharge the MG to generate new electricity (peaks), which makes a new impact on the MG. The response scheduling model guides EVs to charge from and discharge to the MG based on peak-valley time-of-use electricity prices and regional load information. Compared with the user-autonomous charging model and the orderly charge–discharge model of peak-valley time-of-use electricity prices, the variance of load fluctuations is reduced by 25.3% and 15.5%. The response scheduling model improves the smoothness of the regional load.

#### *4.3. Weight Coefficients and Impact of Different Optimization Results*

To analyze the influence of different weight coefficients on the optimization results, the table compares the optimization results under five groups of different weight coefficients. Among them, the weight coefficient λ<sup>1</sup> in each group has a value of 0, 0.3, 0.5, 0.8, and 1; the weight coefficient λ<sup>2</sup> is 1, 0.7, 0.5, 0.2, 0, respectively. According to the optimization results, the statistics of the integrated operation and management costs and load fluctuation variance of the MG in a dispatch period are shown in Table 6.


**Table 6.** Comparison of optimization results of different weight coefficients.

The MG operation and management, environmental pollution control, load fluctuation variance, and other indicators of cost reach the best operating state to select the appropriate weighting coefficients. Table 6 shows that setting different weight coefficients has an impact on the optimization results. When the weight coefficient *λ*<sup>1</sup> increases, the MG operating costs and environmental pollution cost gradually decrease, and the load fluctuation variance increases with the decrease in the weight coefficient λ2. Table 6 shows the maximum value of MG operation management cost, environmental pollution control cost, and load fluctuation variance as USD 94,099.872 and USD 10,735.098. The minimum values are USD 31,190.257, USD 6976.039, and USD 12.56, respectively. The entropy weight method is used to calculate the weight coefficients of each objective function, and the weight coefficients *λ*<sup>1</sup> and *λ*<sup>2</sup> are 0.589 and 0.421, respectively. Applying the obtained weight coefficients to weigh different objective functions and solving the proposed model, the MG operation management, environmental pollution costs and load fluctuation are USD 31,984.413, USD 76,695.169, and USD 120.236, respectively.

#### *4.4. Controllable Power Generation Unit Output with Different Responsiveness*

The output of controllable generating units with different responsiveness were studied, and the user responsiveness in the selected area is 0%, 50%, 80%, and 100%, respectively. Figure 5 shows the operation results, and the responses of different users in a dispatch period were counted. The operation management, load fluctuation and the costs of the MG with a high degree are shown in Table 6.

5 31,190.257 6976.039 285.38

USD 31,984.413, USD 76,695.169, and USD 120.236, respectively.

the MG with a high degree are shown in Table 6.

*4.4. Controllable Power Generation Unit Output with Different Responsiveness* 

The MG operation and management, environmental pollution control, load fluctuation variance, and other indicators of cost reach the best operating state to select the appropriate weighting coefficients. Table 6 shows that setting different weight coefficients has an impact on the optimization results. When the weight coefficient *λ*1 increases, the MG operating costs and environmental pollution cost gradually decrease, and the load fluctuation variance increases with the decrease in the weight coefficient λ2. Table 6 shows the maximum value of MG operation management cost, environmental pollution control cost, and load fluctuation variance as USD 94,099.872 and USD 10,735.098. The minimum values are USD 31,190.257, USD 6976.039, and USD 12.56, respectively. The entropy weight method is used to calculate the weight coefficients of each objective function, and the weight coefficients *λ*1 and *λ*2 are 0.589 and 0.421, respectively. Applying the obtained weight coefficients to weigh different objective functions and solving the proposed model, the MG operation management, environmental pollution costs and load fluctuation are

The output of controllable generating units with different responsiveness were studied, and the user responsiveness in the selected area is 0%, 50%, 80%, and 100%, respectively. Figure 5 shows the operation results, and the responses of different users in a dispatch period were counted. The operation management, load fluctuation and the costs of

Time (hour)

(**b**)

(**c**)

**Figure 5.** *Cont*.


(**e**)

**Figure 5.** The planned output of controllable power generation units with different user responsiveness; (**a**) 0% of the planned output of controllable generating units, (**b**) 30% of the planned output of controllable power generation units, (**c**) 50% of the planned output of controllable power generation units, (**d**) 80% of the planned output of controllable power generation units, (**e**) 100% controllable power generation unit planned output. Figure 6 shows the power supply change curve of the large-scale public power grid. **Figure 5.** The planned output of controllable power generation units with different user responsiveness; (**a**) 0% of the planned output of controllable generating units, (**b**) 30% of the planned output of controllable power generation units, (**c**) 50% of the planned output of controllable power generation units, (**d**) 80% of the planned output of controllable power generation units, (**e**) 100% controllable power generation unit planned output.

During the period 8:00–20:00 large-scale EVs are connected to the MG in disorder, and the power demand of the MG during the peak period of electricity load is sharp. Increasing the amount of power supplied by the large public grid to the MG is likely to cause the large public grid to be overloaded. Figure 6 and Table 7 show the statistical data that when the user responsiveness is between 30% and 80%, as the user responsiveness increases, the operation and management costs of the MG and the environmental pollution control costs are reduced correspondingly, and the variance of load fluctuations is first. Considering the tendency to increase after decreasing when the user response rate is 100%, large-scale EVs are connected to the regional MG for charging and discharging. Due to the limitation Figure 6 shows the power supply change curve of the large-scale public power grid. During the period 8:00–20:00 large-scale EVs are connected to the MG in disorder, and the power demand of the MG during the peak period of electricity load is sharp. Increasing the amount of power supplied by the large public grid to the MG is likely to cause the large public grid to be overloaded. Figure 6 and Table 7 show the statistical data that when the user responsiveness is between 30% and 80%, as the user responsiveness increases, the operation and management costs of the MG and the environmental pollution control costs are reduced correspondingly, and the variance of load fluctuations is first. Considering the tendency to increase after decreasing when the user response rate is 100%, large-scale EVs are connected to the regional MG for charging and discharging. Due to the limitation of the installed capacity of the regional MG-distributed energy, the demand for electricity in the region increases, leading to the microgrid's related costs. Correspondingly, at the

same time, the variance of load fluctuations increases compared with the variances of load fluctuations with a responsiveness of 50% and 80%. 80% 28,655.759 7836.853 130.19 100% 35,750.162 7972.188 196.15

**(USD)** 

**Environmental Pollution Treatment Costs** 

**Load Fluctuation** 

of the installed capacity of the regional MG-distributed energy, the demand for electricity in the region increases, leading to the microgrid's related costs. Correspondingly, at the same time, the variance of load fluctuations increases compared with the variances of load

**Figure 6.** Convergence curves of different optimization algorithms. **Figure 6.** Convergence curves of different optimization algorithms.

*Sustainability* **2022**, *14*, x FOR PEER REVIEW 16 of 20

**Table 7.** Comparison of MG indicators for different user responsiveness.

0% 45,454.215 9467.724 253.71 30% 37,967.285 8760.162 144.13 50% 31,690.206 7881.186 114.24

fluctuations with a responsiveness of 50% and 80%.

**MG Operating Costs** 

**(USD)** 

**Responsive-**

**ness** 


*4.5. Comparison of Different Optimization Algorithms*  **Table 7.** Comparison of MG indicators for different user responsiveness.

#### hough the solution time of the MINLP method is not much different from that of the PSO algorithm, its optimization accuracy is better than that of the PSO algorithm. In the CPSO *4.5. Comparison of Different Optimization Algorithms*

algorithm, the chaotic search strategy is added to improve the global search ability of the algorithm to a certain extent, thereby avoiding falling into local extreme points. Still, its convergence accuracy needs to be improved. The CPSO algorithm requires more iterations and time to achieve convergence in the solution process, but it improves the optimi-A comparison is made to verify the effectiveness of the GSA-RFR algorithm in solving high-dimensional, non-continuous problems with the multi-constrained optimization problems (MINLP) method, GSA algorithm, CPSO algorithm, and multi-agent PSO algorithm to solve the economic optimization model put forth in this study and contrast the GSA-RFR algorithm's solution outcomes with the optimization outcomes of various algorithms. The maximum number of iterations is 350, and the population size is 300. Figure 6 depicts the convergence curves of various algorithms.

The PSO method has the fastest convergence speed, as shown in Figure 6, but it is prone to premature phenomena and cannot converge upon the global extreme point. Although the solution time of the MINLP method is not much different from that of the PSO algorithm, its optimization accuracy is better than that of the PSO algorithm. In the CPSO algorithm, the chaotic search strategy is added to improve the global search ability of the algorithm to a certain extent, thereby avoiding falling into local extreme points. Still, its convergence accuracy needs to be improved. The CPSO algorithm requires more iterations and time to achieve convergence in the solution process, but it improves the optimization results. Compared with several optimization methods, the GSA-RFR algorithm integrates a multi-agent system and a chaotic search mechanism to increase its time consumption, but its optimization effect is the best.

Table 8 shows that when the economic optimization model is established, the optimization result's operating cost, environmental pollution control cost, and load fluctuation variance are minimized. The GSA-RFR algorithm demonstrates good performance in solving high-dimensional, non-continuous, and multi-constrained optimization problems.


**Table 8.** Comparison of optimization results of different optimization algorithms.

#### **5. Conclusions**

The goal of developed nations' research and development efforts is to create greener cities and communities that enhance the state of the environment worldwide and reduce environmental pollution. EVs will play a critical role in energy systems over the coming years, due to their environmental friendliness and capacity to reduce/absorb superfluous power from renewable energy sources. Meanwhile, a large-scale EV charging pile of regional power grids increases the randomness and uncertainty of the load in the concerned area. The proposed study constructed a large-scale EV response dispatch model that significantly improves the load smoothness of the MG after large-scale EVs are connected, and reduces the impact of the entire MG. The weight coefficients *λ*<sup>1</sup> and *λ*<sup>2</sup> were determined as 0.589 and 0.421, respectively, the controllable power generation output scheme unit was best observed, and the operational management, environmental pollution control, and variance of load fluctuations costs were interestingly observed as lowest at USD 31,983.813, USD 76,695.169, and USD 120.236, respectively. The proposed hybridized optimization method directs EV users to charge from and discharge to the regional MG with the presence of renewable energy resources (wind and PV), which improves the economics of the MG and realizes the operation management and environmental pollution regularized to establish a friendly society.

In the future, studies on different scenarios, including the maximum renewable model, the uncoordinated charging model, the load levelling model, and the charging-discharging model, can be used to further enhance EV demand. Additionally, the effects of various electric vehicle (EV) charging/discharging strategies on the costs associated with operation and the removal of pollutants in remote micro-grid (MG) modes are also relevant areas for future study.

**Author Contributions:** Methodology, writing—original draft preparation, M.S.N.; formal analysis, writing, review and editing, Z.C.; A.N.A., investigation, writing, review and editing, H.K.A., S.M.E., P.B., M.S.J., and A.S.M.M. All authors have read and agreed to the published version of the manuscript.

**Funding:** This work was funded by the Researchers Supporting Project No.(RSP-2021/363), King Saud University, Riyadh, Saudi Arabia.

**Institutional Review Board Statement:** Not applicable.

**Informed Consent Statement:** Not applicable.

**Data Availability Statement:** Data will be made available on request.

**Acknowledgments:** The authors would like to acknowledge the technical and related facilities from affiliated institutes/universities. This work was funded by the Researchers Supporting Project No.(RSP-2021/363), King Saud University, Riyadh, Saudi Arabia.

**Conflicts of Interest:** The authors declare no conflict of interest.

### **Nomenclature**


### **References**

