1 Introduction

The continuous increase in electricity consumption in the world can lead to an increase in the installation of fossil-fuel-based power plants, which will lead to environmental pollution. On the other hand, fossil-fuel resources around the world are running low and raising concerns about electricity supply to consumers (Kuriqi et al. 2019; Ali et al. 2019). Therefore, it is necessary to decrease the development of fossil-fuel-based power plants and propose new solutions to produce clean electricity (Kuriqi et al. 2019; Bejarano et al. 2019). One of the best solutions is to move from passive distribution networks to active networks, including renewable-based distributed energy resources (DERs) near the loads. Also, the use of active distribution networks in the form of microgrids (MGs) can provide numerous economic, technical and environmental advantages for the distribution system (AL-Dhaifallah 2021; Gong et al. 2020). An MG is a smart system that includes several small-scale distributed generations (DGs), storage systems and controllable loads, electric vehicles (EVs) and power electronic devices (Mohamed et al. 2020).

Optimal management of DERs in supplying loads within the MG and its connection to the main grid can rise the effectiveness of the power system and reduce environmental problems caused by electricity generation. In fact, maximizing the use of DERs within MGs and near the local loads can effectively reduce generation in fossil-fuel-based bulk power plants and also reduce power grid losses. The use of storage systems and EVs along with DERs in these networks can greatly increase the flexibility and provide the possibility of peak shaving in critical peak situations (Izadbakhsh et al. 2015; Rezvani et al. 2015). Objectives such as reducing costs and environmental problems as well as increasing efficiency and reliability are all achievable with optimal management of MGs and their proper interaction to the main grid in compliance with the constraints (Quynh et al. 2021). Reducing the price of electricity is another important benefit of optimal operation of MGs, which is beneficial for consumers. For operators, they can increase stability, reduce pressure on large power plants, as well as minimize losses in the power system (Javadi et al. 2021; Li et al. 2022). Therefore, it is essential to propose improved methods for the scheduling of MGs in the presence of new technologies such as EVs.

Recent advances in the EV industry around the world have increased their presence in today's modern power systems as PEVs due to their technical advantages (Li et al. 2022; Roslan et al. 2021; Fan et al. 2021). Predictions in the US show that the penetration of PEVs will reach 20% by 2030 (Lee and Lovellette 2011). PEVs and plug-in hybrid PHEVs can join the MGs for charging known as the G2V equipment and also supply loads in peak times through the V2G technology. Such technologies are effective to manage the intermittent behavior of DERs in MGs by charging and discharging ability and also to provide a flexible capability for MGs to responds to variable loads (Tan et al. 2013). They also have the chance to participate in the resurrected power market through PEV aggregators (Druitt and Früh 2012). Contributing to the power electricity market provides many economic benefits for PEV owners (Honarmand et al. 2014). However, the profit of the owners is extremely reliant on the charging/discharging performance of the PEV. Although the presence of PHEVs can provide many benefits for distribution networks, the existence of a large number of them without proper management and coordination with other DERs can provide some problems (Noori and Tatari 2016). To optimize the aggregator profit with the presence of PHEVs, an improved charging strategy considering price constraints is proposed in Sortomme and El-Sharkawi (2011). In (Honarmand et al. 2014), optimal operation of MG considering the intermittent behavior of RESs, spinning reserve issues and PEVs is investigated. The PEVs are implemented in the MG based on a smart parking lot. The charging/discharging of PHEVs is performed based on the market electricity price. According to the profit, the PEVs are charged/discharged, contributing to the reserve market or not. In (Shafie-khah et al. 2012), the agreement between the owners of PEV and the aggregator is investigated to analyze the effects of market regulation features. The real-time characteristic of PEVs as a storage system is extracted in Tehrani et al. (2013). For maximizing the profit of PEVs in the electricity market, the PEVs are operated as ESSs. Moreover, the capability of EVs for contributing in the ancillary services is also assessed. The role of generating companies in a restructured power system based on game theory is analyzed for both the energy and reserve mark in. A stochastic optimal operation for an MG consisting of DERs, storage devices and PHEVs is suggested in Kamankesh et al. (2016). The Monte Carlo simulations (MCS) are used to model the uncertainty of under-study MG. several algorithms are also used for the optimization of MGs. One of the best algorithms with advantages like not being trapped into local optima and fast convergence is the modified shuffled frog leaping algorithm (MSFLA), which is used widely for optimal operation of MGs (Eusuff et al. 2006; Elbeltagi et al. 2007). This algorithm can provide optimal solutions for MGs including several renewable energies and PHEVs.

This study suggests a stochastic optimal operation for an MG containing DERs and PHEVs. The MCS is applied to model the uncertain behavior of PHEVs which are three various charging patterns comprising uncontrolled, controlled and smart charging. The problem formulation for this optimization has a nonlinear feature and needs an improved optimization algorithm. To cope with this challenge, GOA algorithm as an effective tool to deal with optimal operation of the MG is taken into account. Several case studies are considered and the superiority of this algorithm is confirmed by comparing it with conventional methods.

This paper is arranged as: The charging patterns of PHEVs are presented in Sect. 2. Section 3 presents the mathematical formulation. The optimization algorithm is given in Sect. 4. Simulations are provided in Sect. 5. Section 6 contains the conclusions.

2 Charging behavior of PHEVS

Many factors affect the charging and discharging pattern of electric vehicles. The most important factors include the number of PHEVs that are in charge mode, the type and rate of the charging services, the capacity of the battery and SOC as well charting time and duration. Uncertainties in electric vehicles are also one of the important factors that in the conditions of connection of a large number of EVs will greatly affect the behavior of the network. Uncertainties in PHEVs are also one of the important factors that in the conditions of connection of a large number of EVs can greatly affect the behavior of the MGs. In this regard, three scenarios are considered for investigating the charging pattern of PHEVs including: (i) uncoordinated charging plan, (ii) coordinated charging plan, (iii) smart charging. PHEVs have the ability to inject power into the grid at any time of the day. Nevertheless, from the network's point of view, connecting at any time of the day is not suitable. In this scenario, PHEVs leave the house in the morning and return home in the evening to charge through the grid around 18:00. The MCS is used for modeling the uncertain behavior of PHEVs. The probability distribution function (PDF) is taken into account for charging starting time as (1) (Kamankesh et al. 2016; Rostami et al. 2015; Qian et al. 2010):

$$ f(t_{{{\text{start}}}} ) = \frac{1}{b - \alpha }\,\,\,\,\,\,\,\alpha \le t_{{{\text{start}}}} \le b\,\,\,\,\alpha = 18,\,\,b = 19\,\,\,\,\,\,\,\, $$
(1)

Due to the high price of electricity in peak conditions, owners of EVs try to charge at off-peak conditions where the electricity tariff is low in the coordinated charging plan. This causes EV owners to charge their PHEVs after 9:00 p.m. to reduce their electricity costs. To model the coordinated charging plan the following PDF is considered (Rostami et al. 2015; Qian et al. 2010):

$$ f\left( {t_{{{\text{start}}}} } \right) = \frac{1}{b - \alpha }\,\,\,\,\,\,\,\alpha \le t_{{{\text{start}}}} \le b\,\,\,\,\alpha = 21,\,\,b = 24\,\,\,\,\,\,\, $$
(2)

The smart charging pattern allows the owners of EVs to get the most advantageous conditions so that their charging time is in the situations of the lowest price of electricity, as well as the least amount of demand and even in case of overproduction in the generation. In fact, in this plan, most benefits are provided to both owners of EVs and the utilities. For showing the complexity of used smart charging plans and identifying the charging start time, a normal PDF is applied as (Rostami et al. 2015; Qian et al. 2010):

$$ f(t_{{{\text{start}}}} {)} = \frac{1}{{\sigma \sqrt {2\pi } }}e^{{\left( { - \frac{ - 1}{2}\left( {\frac{{t_{{{\text{start}}}} - \mu }}{\sigma }} \right)^{2} } \right)}} \,\,\,\,\,\,\mu = 1\,\,,\,\,\,\,\sigma = 3 $$
(3)

After connecting the PHEV to the charger at home, the battery started to charge. The SOC of the PHEV can be identified by having the traveled mile by the EV during the day. The ratio of existing energy to maximum storable energy in the battery is the SOC. The daily driven mile of an EV is stated to track a log-normal PDF as (Kamankesh et al. 2016; Rostami et al. 2015; Li and Zhang 2012):

$$ f(m) = \frac{1}{{m\sigma_{m} \sqrt {2\pi } }}e\frac{{ - \left( {\ln \left( m \right) - \mu_{m} } \right)^{2} }}{{2\sigma m^{2} }}\,\,\,\,\,\,\,\,m \succ 0 $$
(4)

In plug-in mode, the SOC is determined through the driven mile of the EV and its all-electric range (AER) as:

$$ SoC = \left\{ {\begin{array}{*{20}l} 0 \hfill & {m \succ AER} \hfill \\ {\frac{AER - m}{{AER}} \times 100\% } \hfill & {M \le AER} \hfill \\ \end{array} } \right. $$
(5)

According to AER, there exist several PHEVs such as PHEV-20, PHEV-30, PHEV-40 and PHEV-60 (Kamankesh et al. 2016; Rostami et al. 2015; Li and Zhang 2012). The numerical subscript shows the vehicle AER in miles. Here PHEV-20 is taken into account for the study. The below formula is used to calculate the charging duration of the PHEV as:

$$ t_{D} = \frac{{C_{{{\text{bat}}}} \times (1 - {\text{SOC}}) \times {\text{MaxDOD}}}}{\eta \times P} $$
(6)

As seen, at home charging points, Level 1 and 2 chargers are used. Moreover, Level 3 is suitable for commercial and public transportation. It is not used for this study. Nevertheless, the recommended model can be developed to consider such chargers as well. Figure 1 shows four various characteristics of PHEV to make an alteration between PHEV factors and battery capabilities. As the market share can be considered as a discrete distribution the type of a PHEV is accidentally chosen based on the given market shares.

Fig. 1
figure 1

Features of various classes of PHEV

3 Problem formulation

As mentioned before, MGs consist of several DERs, storage devices and controllable loads at the distribution system voltage level providing numerous advantage for the power systems. They can function in grid-tied and island mode. However, the operation of MGs when new technologies such as EVs are integrated into them is very challenging. In the following subsections, the problem formulation for optimal operation of MG for this study is presented.

3.1 Objective function

In this part, the objective function of this paper based on minimizing the cost of MG is introduced. According to (7), it contains four parts. The first part is the cost of fuel owing to generating power by DGs. The next part is related to the start-up and shut-down costs. The third and final parts are the costs of the storage device and the power imported from the main grid (Izadbakhsh et al. 2015; Rezvani et al. 2015; Moghaddam et al. 2011):

$$ \begin{aligned} {\text{Min}}\;f\left( x \right) = & \sum\limits_{t = 1}^{T} {{\text{Cost}}^{t} } \\ = & \sum\limits_{t = 1}^{T} {\left\{ {\sum\limits_{i = 1}^{{N_{g} }} {\left[ {u_{i} \left( t \right)p_{Gi} \left( t \right)B_{Gi} \left( t \right) + S_{Gi} \left| {u_{i} \left( t \right) - u_{i} \left( {t - 1} \right)} \right|} \right] + \sum\limits_{j = 1}^{{N_{s} }} {\left[ {u_{j} \left( t \right)P_{sj} B_{sj} \left( t \right) + S_{sj} \left| {u_{j} \left( t \right) - u_{j} \left( {t - 1} \right)} \right| + P_{{{\text{Grid}}}} \left( t \right)B_{Grid} \left( t \right)} \right]} } } \right\}} \\ \end{aligned} $$
(7)

Considering X as the vector of state variables, the real power of DGs and their commitment status can be given as (Rezvani et al. 2015; Moghaddam et al. 2011).

$$ \begin{gathered} X = \left[ {P_{g},\;U_{g} } \right]_{1 \times 2nT} \hfill \\ P_{g} = \left[ {P_{G},\;P_{S} } \right] \hfill \\ n = N_{g} + N_{s} + 1 \hfill \\ \end{gathered} $$
(8)

The active power of the DGs and their commitment status vectors can be rewritten as:

$$ \begin{aligned} & P_{G} = \left[ {P_{G,1},\;P_{G,2},...,P_{{G,N_{g} }} } \right] \hfill \\& P_{G,i} = \left[ {P_{G,i} \left( 1 \right),\;P_{G,i} \left( 2 \right),...,P_{G,i} \left( T \right)} \right]\quad i = 1,2,...,N_{g} + 1 \hfill \\& P_{s} = \left[ {P_{s,1},P_{s,2},...P_{{s,N_{s} }} } \right] \hfill \\& P_{S,i} = \left[ {P_{S,j} \left( 1 \right),\;P_{S,j} \left( 2 \right),...,P_{S,j} \left( T \right)} \right]\quad j = 1,2,...,N_{s} \hfill \\ \end{aligned} $$
(9)

3.2 Limitations

3.2.1 Balancing generation with load demand

The equality of production and consumption in the MG at any time is one of the most necessary constraints for the proper operation of the MGs (Moghaddam et al. 2011). The power equilibrium constraint in the studied MG without considering the losses is given in the following equation

$$ \sum\limits_{i = 1}^{{N_{g} }} {P_{G,i} \left( t \right) + \sum\limits_{i = 1}^{{N_{s} }} {P_{s,j} \left( t \right)} + \sum\limits_{i = 1}^{{N_{g} }} {P_{{{\text{Grid}}}} \left( t \right)} } = \sum\limits_{k = 1}^{{N_{L} }} {P_{L,k} \left( t \right)} + \sum\limits_{l = 1}^{{N_{{{\text{PHEV}}}} }} {P_{{{\text{PHEV}},l}} \left( t \right)} $$
(10)

3.2.2 DG generation limitation

The constraint on power generation of DGs and the exchange power with the utility are given as (Moghaddam et al. 2011):

$$ \begin{aligned} & P_{Gi,\min } \left( t \right) \le P_{Gi} \left( t \right) \le P_{Gi,\max } \hfill \\& P_{{{\text{grid,}}\min }} \left( t \right) \le P_{{{\text{Grid}}}} \left( t \right) \le P_{{{\text{grid,m}}ax}} \left( t \right) \hfill \\ \end{aligned} $$
(11)

3.2.3 Constraint of battery and charger operation

The limitations of the storage system contain the available energy, the restrictions on the stored energy and the charging/discharging rates as given in below (Moghaddam et al. 2011):

$$ \begin{gathered} W_{{{\text{ess}}}} \left( t \right) = W_{{{\text{ess}}}} \left( {t - 1} \right) + \eta_{{{\text{charge}}}} P_{{s,{\text{charge}}}} \Delta t - \frac{1}{{\eta_{{{\text{discharge}}}} }}P_{{s,{\text{discharge}}}} \Delta t \hfill \\ \left\{ {\begin{array}{*{20}l} {W_{{\text{ess,min}}} \le W_{ess} \left( t \right) \le W_{{\text{ess,max}}} } \hfill \\ {P_{{s,{\text{charge}}}} \left( t \right) \le P_{{\text{charge,max}}} } \hfill \\ {P_{{s,{\text{discharge}}}} \left( t \right) \le P_{{\text{discharge,max}}} } \hfill \\ \end{array} } \right. \hfill \\ \end{gathered} $$
(12)

The available energy in the battery is given at each time slot Δt.

4 Grasshopper optimization algorithm

Mirjalili et al. has introduced in 2018 the GOA as a new efficient swarm intelligence-based method (Saremi et al. 2017). It is noted that the grasshoppers produce a sound when they are in the farm and its major items of the swarm in the larval level are the steady progress and small paces. However, the abrupt wide-area progress is the vital behavior of the swarm when they get adult. It is noted that the presented GOA would control and manage the voltage and current of the solar PV system delivered to the tied converter. The position of the members of the population of grasshoppers indicated by Xi which is stated in (13) specifies a feasible solution (Luo et al. 2018).

$$ X_{i} = S_{i} + G_{i} + A_{i} $$
(13)

It is noted that the social contact and the gravity force sensed by the grasshopper i are denoted by Si and Gi, respectively. Besides, the wind advection is shown by Ai. By using these three items, the grasshoppers’ movements would be thoroughly simulated. However, the major item is the social contact among grasshoppers determined as follows:

$$ S_{i} = \sum\limits_{\begin{subarray}{l} j = 1 \\ j \ne i \end{subarray} }^{N} {s\left( {d_{ij} } \right)} \hat{d}_{ij} $$
(14)

In this regard, the distance between the two grasshoppers i and j is denoted by dij which is determined as follows:

$$ d_{ij} = \left| {x_{j} - x_{i} } \right| $$
(15)

Furthermore, the social force is shown by S obtained as below:

$$ s\left( r \right) = fe^{{\frac{ - r}{l}}} - e^{ - r} $$
(16)

The attraction intensity is also indicated by f while its length scale is shown by l. Accordingly, the unit vector between two grasshoppers is denoted by \(\hat{d}_{ij}\) which is derived as follows:

$$ \hat{d}_{ij} = \frac{{x_{j} - x_{i} }}{{d_{ij} }} $$
(17)

Function s indicates the effects of the social contact of grasshoppers. In case the distance is equal to the repulsion force, there would be no attraction and repulsion, and the area is named comfort area (Luo et al. 2018). Although this function is associated with many advantages if grasshoppers are located far from each other, not a powerful force would be induced between them. Hence, this distance must be either mapped or normalized. In this respect, the component G indicating the gravity constant would be determined as follows:

$$ G_{i} = - g\hat{e}_{g} $$
(18)

Besides, the unity vector to the earth center is shown by \(\hat{e}_{g}\). Component A would be obtained as below using the constant drift u and \(\hat{e}_{w}\) which is a unity vector toward the wind direction:

$$ A_{i} = u\hat{e}_{w} $$
(19)

Accordingly, relationship (13) would be rewritten as follows:

$$ X_{i} = \sum\limits_{\begin{subarray}{l} j = 1 \\ j \ne i \end{subarray} }^{N} {s\left( {\left| {x_{j} - x_{i} } \right|} \right)} \frac{{x_{j} - x_{i} }}{{d_{ij} }} - g\hat{e}_{g} + u\hat{e}_{w} $$
(20)

It is noteworthy that the population size of the grasshoppers is indicated by N. An efficient stochastic method with effective exploitation and exploration should be used to achieve a highly precise approximation of the global optimal solution of the problem. Particular parameters must be utilized for the proposed model to indicate the exploitation and exploration at each stage of the optimization process. Thus, the mathematical model would be as (21):

$$ X_{i}^{d} = c\left( {\sum\limits_{\begin{subarray}{l} j = 1 \\ j \ne i \end{subarray} }^{N} {c\frac{{ub_{d} - lb_{d} }}{2}s\left( {\left| {x_{j}^{d} - x_{i}^{d} } \right|} \right)} \frac{{x_{j} - x_{i} }}{{d_{ij} }}} \right) + \hat{T}_{d} $$
(21)

It is noted that the maximum and minimum values of the dimension d are depicted by ubd and lbd, respectively, while the value of the dimension d in the most updated value of the objective function is stated by \(\hat{T}_{d}\). Moreover, a reducing coefficient c is applied for narrowing the comfort, repulsion, and attraction areas. Besides, it is worth mentioning that S is nearly similar to the S component represented in (13). It is noted that the wind direction is constantly toward \(\hat{T}_{d}\). The inner c would help reduce the repulsion and attraction forces existing among grasshoppers proportionally to the number of iterations. On the contrary, the outer c mitigates the search coverage surrounding the \(\hat{T}_{d}\) as the iterations rise. c would be updated using the relationship (22) to alleviate the explorations and raise exploitation proportionally to the number of iterations.

$$ c = c^{\max } - l\frac{{c^{\max } - c^{\min } }}{L} $$
(22)

where l indicates the present iteration and L shows the total number of iterations. The values selected for the maximum and minimum bounds of c, which are denoted by cmax and cmin, are 1 and 0.00001, respectively. Algorithm 1 shows the pseudo-code of the proposed method.

It is worth noting that the subsequent location of any grasshopper would be specified by using the present location, the global best value, and also the location of the remaining search agents, implying that every search agent should be included to obtain the subsequent location of any grasshopper. In addition, the second part mitigates the movements of the agent near the target, indicating that the exploitation and exploration of the whole swarm near the target are taken into consideration. Particularly, it is supposed that c1 mitigates the movements of grasshoppers near the target, showing that c1 is indeed supposed for making the exploitation and exploration of the whole swarm balanced near the target. Meanwhile, c2 narrows the attraction, comfort, and repulsion areas existing between the grasshoppers. This issue indicates that the area would be linearly mitigated to direct grasshoppers toward finding the optimum in the search area.

5 Results of simulation

The considered MG for this study for optimal operation consists of several sources such as FC, a WT, an MT, a PV and a NiMH-Battery as the storage system. The structure of the under study MG in connection of the man grid is given in Fig. 2. The optimal operation of the MG is performed for 24 h with the aim of determining the output power of sources with minimum cost.

Fig. 2
figure 2

MG under study

Table 1 provides the technical limitations of DERs and the bid coefficients in cents of Euro (€ct) per kilowatt-hour (kWh). The forecasted output power of WT’s and PV’s, load data and market energy prices are depicted in Figs. 3 and 4. In this paper, DGs generate only active power at the unity power factor. In other words, reactive power management is not considered in this study. The type of loads are electrical and heat loads are not taken into account in this paper. The MG is in the connection with the upscale grid and can import/export power into the upscale grid during various hours of the day. Two different scenarios according to the battery initial charging and DGs' condition are taken into account to verify the effectiveness of the GOA algorithm in optimal operation of the PHEVs in this MG.

Table 1 Costs and limitations of DGs (Rezvani et al. 2015; Moghaddam et al. 2011)
Fig. 3
figure 3

PV and WT power

Fig. 4
figure 4

Market price and load demand

5.1 First scenario

Simulations are done for a day-ahead horizon. Nevertheless, it is possible to extend this scheduling for 168 h or even for longer periods without any change in the problem formulation. As shown in Fig. 5a–c, under the low price of electricity, the battery begins to absorb the power, and also DGs with high cost reduce their output power. Also, storage systems inject power into the grid during peak load conditions when the energy tariff is high. It is also cost-effective for the MG to sell power to the main grid when the price of electricity is high. In other words, in conditions with a high tariff, all DGs inside the MG operate at their maximum power. According to the above description, the MT output power is reduced when the energy price is low while the output power of the MT is maximized when the electricity price is high over intervals 9–17. Also, due to the fact that the FC has a low operating cost, the MG management plans to FC generate at its maximum capacity so that it can supply the load. As depicted in Fig. 5b, the battery is charging at the first hours of the day over intervals 8–14. The best solution (BS), worst solution (WS), mean value (Mean) and standard deviation (Std) are considered as Table 2 for comparing the recommended methods with the conventional schemes. The results of comparisons show that the proposed algorithm has many advantages such as a high convergence rate in comparison with other techniques. Figure 5c shows the time required to solve each algorithm for considered case studies. According to the figure, the time for the proposed algorithm is 5.87 s, while for GA, PSO equal to 12.14 s and 10.22 s, correspondingly.

Fig. 5
figure 5

a and b.The hourly production of DGs, ignoring the PHEVS _Scenario 1, (c). Mean simulation time of Scenario 1

Table 2 Comparison of costs

5.2 Second scenario

Here, all DGs can turn off or started up throughout the study and also the battery is not charged primarily. PV and WT can generate power at their maximum rate. Maximum generation in WT and PV systems is an encouraging policy for investors because such DERs have to produce after the first time capital investment. According to Fig. 6, the MT is charging the battery during this time as an expensive DG. By selling the storage device energies at peak times to the utility grid, the cost of the MG is significantly reduced. The main grid and the output power of FC are at their maximum at the first hours of the day to charge the battery to be used in peak hours.

Fig. 6
figure 6

a and b. The hourly production of DGs, disregarding the PHEVS_ Scenario 2. (c). Mean simulation time of the Scenario 2

Even though the MT generates power in the first hours of the day, it is not considered as a cost-effective DG. Consequently, for reducing the MG cost, the operator shut down it in some hours. The outcomes of the comparison between the recommended the GOA algorithm and traditional approaches such as GA, PSO, FSAPSO are displayed in Table 3. The simulation results specify that the proposed the GOA algorithm can provide a lower cost for the MG than other conventional methods. Figure 6c displays the time required to address each algorithm for considered case studies. According to the figure, the time for the suggested algorithm is 5.79 s, which is much lower than GA, PSO.

Table 3 Cost function Comparison

5.3 PHEVs considered for fist scenario and second scenario

The aim of this part is to evaluate the charging demands of PHEVs. The penetration rate of PHEVs out of 70 EVs in the MG is considered equal to 30%. The uncertainties include the charging demand of PHEVs, load demand, the price of electricity and the output of PV and WT. Uncontrolled charging, controlled charging and smart charging of PHEVs are considered for the PHEVs. Figures 7, 8, 9, 10, 11, 12 illustrate the simulation results.

Fig. 7
figure 7

a and b Optimal operation for the uncontrolled charging pattern_ Scenario 1

Fig. 8
figure 8

a and 9b. Optimal operation for he controlled charging pattern_ Scenario 1

Fig. 9
figure 9

a and b. Optimal operation for the smart charging pattern_ Scenario 1

Fig. 10
figure 10

a and b. Optimal operation for the uncontrolled charging pattern_ Scenario 2

Fig. 11
figure 11

a and b. Optimal operation for the controlled charging pattern_ Scenario 2

Fig. 12
figure 12

a and b. Optimal operation for the smart charging pattern_ Scenario 2

To maximize power production, some changes are required in the utility. In fact, the MG cannot supply the PHEV charging demand without modification in the utility characteristics. In uncontrolled charging mode, the imported power of the main grid is increased and batteries are charged at light-load hours as shown in Fig. 8. The MT also generates at minimum possible power because of high cost of power generation.

According to Fig. 9, the MT is shut down and the main grid is responsible for supplying power in the controlled charging of PHEVs mode. The minimum cost for the MG is obtained in the controlled and smart charging schemes.

Comparing among various pattern show that the uncontrolled mode has the highest cost for the MG and in this mode the MG supply with the utility grid is between 15 and 17. In contrast, the lowest cost is related to the smart charging scheme as the main grid is transferred power into the MG during the off-peak period of 1–4.

As seen, the results of the GOA algorithm and traditional approaches such as GA, PSO and FSAPSO in case of total operating costs are presented in Tables 4 and 5. The simulation outcomes specify that the recommended the GOA algorithm can provide a lower cost for the MG than other conventional methods. Figure 13a and b shows the Mean simulation time for the smart charging plan Scenario 1 and Scenario 2, respectively. The time for solving the problem in the first Scenario and second scenario are 6.65 and 7.17 with the presented model.

Table 4 Best solutions for various cases Scenario 1
Table 5 Best solutions of different algorithms Scenario 2
Fig. 13
figure 13

a Mean simulation time of the smart charging plan Scenario 1. b Mean simulation time of the smart charging plan Scenario 2

Simulations with and without considering the PHEVs in the first and second test systems are performed and shown in Fig. 14. As seen, the power imported from the main grid is increased and the energy is stored in the battery at light-load hours in the uncontrolled charging mode. In addition, because of the high cost of the MT, it is OFF in this mode.

Fig. 14
figure 14

Results with and without considering the PHEVs

6 Conclusion

Low environmental pollution and cost as well as high efficiency are achieved by optimal operation of MGs. In this paper, optimal operation for an MG including several DERs and PHEV considering uncertainties is suggested. Three various charging patterns consist of the uncontrolled, controlled and smart charging schemes are taken into account for the PHEVs. An improved the GOA algorithm is used for optimization objective with fast response. The MCS is used for modeling the uncertainties in the problem formulation. The proposed model is simulated in different case studies and compared with the conventional GA and PSO. The outcomes show that the proposed method has good performance when considering PHEVs in the MG than the dispatch model without PHEVs. The recommended model affords novel insight for the use of PHEVs in MG, with aim of providing more flexibility for the MG with low cost.