A Bidirectional Power Charging Control Strategy for Plug-in Hybrid Electric Vehicles

: Plug-in Hybrid Electric Vehicles (PHEVs) have the potential of providing frequency regulation due to the adjustment of power charging. Based on the stochastic nature of the daily mileage and the arrival and departure time of Electric Vehicles (EVs), a precise bidirectional charging control strategy of plug-in hybrid electric vehicles by considering the State of Charge (SoC) of the batteries and simultaneous voltage and frequency regulation is presented in this paper. The proposed strategy can control the batteries charge which are connected to the grid, and simultaneously regulate the voltage and frequency of the power grid during the charging time based on the available power when di ﬀ erent events occur over a 24-h period. The simulation results prove the validity of the proposed control strategy in coordinating plug-in hybrid electric vehicles aggregations and its signiﬁcant contribution to the peak reduction, as well as power quality improvement. The case study in this paper consists of detailed models of Distributed Energy Resources (DERs), diesel generator and wind farm, a generic aggregation of EVs with various charging proﬁles, and di ﬀ erent loads. The test system is simulated and analyzed in MATLAB / SIMULINK software. to the grid regulation when an event occurs in a DG-based power grid consisting of di ﬀ erent microgrids, diesel generator and wind farm, PHEVs with several charging proﬁles, and di ﬀ erent loads. The simulation results show the robustness of the proposed control strategy.


Motivation
The rapid increase in energy demand, destruction of the earth's resources, and discharge of carbon dioxide are the leading causes of environmental pollution and climate change in the world. Further, transportation is more attentive, considering the fact that it causes more than 15% of carbon dioxide discharge, which is critical for all the people [1,2]. As a result of that, the transition from the Internal Combustion Engine (ICE) to hybrid and full-electric vehicles has been an immense focus for the reduction of greenhouse gases [2]. Due to pollution and energy crisis, many studies in the field of Electric-Drive Vehicles (EDVs), including Battery Electric Vehicles (BEVs), Hybrid Electric Vehicles (HEVs), and Plug-in Hybrid Electric Vehicles (PHEVs) have appeared worldwide [2][3][4]. However, developments in the field of electric vehicles are restricted by the technology of the batteries and Energy Storage Systems (ESSs), there are many positive signs of progress in this field [5][6][7]. A good number of alternative energy sources, which are renewable, are already being harnessed and utilized to meet the energy demand in the world [8,9]. This paper mainly focuses on PHEVs to study the impact of EVs and their interconnection to the power system.
The arbitrary connection of PHEVs to the power grid leads to the complicated operation, planning, and control of the power system. There are different charging mechanisms for PHEVs to be charged. IEC Std. 61851 is one of the common standards, which is established for PHEVs charging [8]. Regardless of the charging mechanism, the availability of charging stations is an essential factor that should be considered for power system control, operation, and long-term planning. The common and low-cost procedure for charging PHEVs is slow charging, which drains less power from the grid. However, the main drawback of this mechanism is that it takes more time to fully charge the batteries of PHEVs. On the other hand, the fast charging mechanism, based on the new developments in power electronics devices and restructuring both of both ESSs and chargers, can expedite the charging process and charge a depleted battery from 10 to 80 percent in half an hour [10]. However, this mechanism drains more current at a high voltage level from the network and has a negative effect on the other loads connected to the same bus, e.g., the voltage drop at the end of the power line.
In modern power systems, microgrids are defined as interconnected local energy centers with control and management capabilities and clear boundaries. They enable bidirectional and autonomous power exchange to prevent power outage by providing high-quality operation and more reliable energy supply to the load centers. Aging electric power grid infrastructures, continuous increase in the load demand, integration of renewable energy resources and electric vehicles, transmission power losses, and improving the efficiency of the power system, are several challenges in modern power systems. Therefore, to overcome the mentioned challenges, macro and micro-grids are utilized to both enhance the power quality and increase the reliability of the grid side and the load side. There are several studies in the field of microgrids, considering their different manifestations, such as Smart Grids (SGs) and Virtual Power Plants (VPPs), etc. [11]. One of the main concerns in modern power system analysis is the dependency on the power from microgrids by using the grid power along with their developments. As a result, microgrids can interconnect to the power grid and improve the power quality and reliability. From another perspective, microgrids can connect to/disconnect from power grids to enable themselves and operate in both grid-connected and islanding modes.
Based on the expansion of the interconnected power grids through the long transmission lines, increasing the load demand, and the need for a supervisory control system for the power generation units, electric utilities are moving toward the decentralized and deregulated power systems, focusing on independent microgrids. Non-traditional power generation sources (e.g., wind farms, solar power plants, diesel generators, etc.) in microgrids are allowed to trade electricity with the local consumers. In addition, microgrids in a centralized structure no longer rely on a single power source. On-site generations can be utilized as emergency backups in the event of blackout or load shedding to mitigate disturbances and increase power system reliability. Figure 1 illustrates the concept of modern microgrids. As shown, there are several ways to utilize Distributed Generations (DGs), such as wind, solar, ESSs, etc. in the power system to support the grid and supply the load demand. be charged. IEC Std. 61851 is one of the common standards, which is established for PHEVs charging [8]. Regardless of the charging mechanism, the availability of charging stations is an essential factor that should be considered for power system control, operation, and long-term planning. The common and low-cost procedure for charging PHEVs is slow charging, which drains less power from the grid. However, the main drawback of this mechanism is that it takes more time to fully charge the batteries of PHEVs. On the other hand, the fast charging mechanism, based on the new developments in power electronics devices and restructuring both of both ESSs and chargers, can expedite the charging process and charge a depleted battery from 10 to 80 percent in half an hour [10]. However, this mechanism drains more current at a high voltage level from the network and has a negative effect on the other loads connected to the same bus, e.g., the voltage drop at the end of the power line.
In modern power systems, microgrids are defined as interconnected local energy centers with control and management capabilities and clear boundaries. They enable bidirectional and autonomous power exchange to prevent power outage by providing high-quality operation and more reliable energy supply to the load centers. Aging electric power grid infrastructures, continuous increase in the load demand, integration of renewable energy resources and electric vehicles, transmission power losses, and improving the efficiency of the power system, are several challenges in modern power systems. Therefore, to overcome the mentioned challenges, macro and micro-grids are utilized to both enhance the power quality and increase the reliability of the grid side and the load side. There are several studies in the field of microgrids, considering their different manifestations, such as Smart Grids (SGs) and Virtual Power Plants (VPPs), etc. [11]. One of the main concerns in modern power system analysis is the dependency on the power from microgrids by using the grid power along with their developments. As a result, microgrids can interconnect to the power grid and improve the power quality and reliability. From another perspective, microgrids can connect to/disconnect from power grids to enable themselves and operate in both grid-connected and islanding modes.
Based on the expansion of the interconnected power grids through the long transmission lines, increasing the load demand, and the need for a supervisory control system for the power generation units, electric utilities are moving toward the decentralized and deregulated power systems, focusing on independent microgrids. Non-traditional power generation sources (e.g., wind farms, solar power plants, diesel generators, etc.) in microgrids are allowed to trade electricity with the local consumers. In addition, microgrids in a centralized structure no longer rely on a single power source. On-site generations can be utilized as emergency backups in the event of blackout or load shedding to mitigate disturbances and increase power system reliability. Figure 1 illustrates the concept of modern microgrids. As shown, there are several ways to utilize Distributed Generations (DGs), such as wind, solar, ESSs, etc. in the power system to support the grid and supply the load demand.

Literature Survey and Contributions
Technically, modern microgrids are a small part of low voltage distribution networks that are located far from the substation and interconnected through a Point of Common Coupling (PCC) [12]. Based on the nature of microgrids operation (e.g., ownership, location, reliability requirements, and trading purposes), significant developments are carried out by researchers, industrial and commercial factories, and military bases. According to the Power and Utilities Navigant Research, the capacity of the global microgrid has been projected to grow from 1.4 GW in 2015 to 7.6 GW in 2024 under a base scenario [12]. Modern microgrids not only offer great promises owing to their significant benefits but also result in tremendous technical challenges. There is an urgent need to investigate the state-of-art control and energy management systems in microgrids.
One of the main challenges in microgrids technology is to manage and balance the generation and consumption of energy [13]. The power imbalance is a typical scenario in microgrids, which comes from the nature and availability of renewable energy resources to discontinuously generate power and available loads connected to microgrids. The control system should manage these imbalances to prevent electrical damage and maintain AC/DC grids stable [14][15][16][17]. As a result, recent studies have focused on proper power management and control strategies to manage the generation and consumption of energy. These control strategies are mainly targeted at: (i) controlling the interconnected DGs and ESSs, (ii) DC bus voltage regulation, (iii) minimizing the cost of imported/exported energy from/to the main grid by optimizing the power dispatch between converters and DC bus voltage, (iv) management, and optimization of ESSs operation, and (v) current sharing management between parallel converters in DC grids [17][18][19][20].
In order to optimize the power dispatch, proper communication infrastructure between the microgrids and the grid operator are required [21,22]. However, real-time simulation and monitoring can be implemented by the communication infrastructure, the outage of the communication links/signals can cause many complicated problems. The droop control method is a well-known strategy to maintain the power balance in DC microgrids [17,[22][23][24][25][26], which does not require communication infrastructure [17]. The power management of microgrids can be classified into centralized, decentralized, and distributed control categories [25][26][27][28][29]. The energy dispatched in the centralized control systems can be monitored and managed by an intelligent centralized (master) controller, which receives and analyzes the data, manages the power among the converter stations under operation, and forecasts the power and voltage references to all the power devices of the microgrids. [30,31]. These systems usually offer precise power-sharing among converters in microgrids [28,29]. In case of loss or outage of the master controller, local autonomous controllers (decentralized structure) are needed to fulfill the master controller failure [32][33][34][35]. In a distributed control system, each microgrid is allowed to only communicate with its nearby neighbors. Therefore, there is still a need for communication infrastructure. Further, there are many loops in a distributed control system, which make its design more complicated [36].
However, installing new components and/or upgrading the existing components are two methods to overcome the negative impacts of PHEVs in power grids, high investment costs prevent the mentioned solutions to be implemented. If the high penetration level of PHEVs is connected to the system, up to a 15% increase in the cost of upgrading the existing grid to guarantee the adequacy of the power system can be expected [37]. Therefore, more investigations are required to find a suitable and cost-effective solution. Utilizing proper ESSs and appropriate charging/discharging mechanism to control the power flow in PHEVs are preferable to installing new components and/or upgrading the existing infrastructures in power grids. High penetration chargers can be designed and implemented to allow bidirectional power flow between ESSs and power grids.
PHEVs can assist in improving the load-leveling profile and reducing power losses [38]. Further, utilizing efficient Voltage-Source Converters (VSCs) in power system allows transferring reactive power, as well as active power into the power grid. The DC-link capacitor and a proper switching mechanism can improve the quality of the transferred power into the grid [39]. Therefore, several studies have investigated different control strategies to implement the concept of a bidirectional charger and solve the charging issues of PHEVs [40][41][42][43].
A practical power electronics grid interface that can provide the Vehicle-to-Grid (V2G) bidirectional power flow with a high power quality is necessary to perform the grid-connected vehicle battery application. This interface should respond to the charge/discharge commands that are received from the monitoring system to enhance the reliability of the power grid. Moreover, essential requirements, such as reactive power injection and tracking the reference charge/discharge power, should be met [44,45]. A comprehensive review of the bidirectional converters is presented in [46], and discusses their advantages and disadvantages. In [47], the energy efficiency in PHEV charges along with the evaluation and comparison of the AC/DC topologies, such as the conventional Power Factor Correction (PFC) boost converter, including a diode-bridge rectifier followed by a boost converter, an interleaved PFC boost inverter, a bridgeless PFC boost converter, a phase-shifted semi bridges PFC boost converter [48], and a bridgeless interleaved boost converter [49] is presented. In addition, some non-inverted topologies are presented in [50][51][52][53][54][55][56][57][58][59][60], some of which require two or more switches to be operated in Pulse Width Modulation (PWM) mode, which causes higher total switching losses [50][51][52][54][55][56][57][58][59][60][61]. However, bidirectional power flow cannot be achieved in the topologies of [50,54,57,[61][62][63][64].
Different DC charging station architectures for PHEVs are proposed in [65][66][67]. For instance, the control of the individual EV charging processes introduced in [65] is decentralized, while a separate central supervisory system controls the power transfer from the power grid to the DC link. With sufficient energy stored in the battery of PHEVs, the bidirectional charging/discharging power control of PHEVs can be applied to reduce the frequency fluctuation [68][69][70][71][72][73][74]. A power charging control system to control the frequency in the interconnected power system with wind farms is considered in [68]. The controller in [68] is capable of stabilizing the system frequency during the charging period. Further, the bidirectional power control of PHEV applied for frequency control in the interconnected power systems with wind farms is proposed in [69]. The proportional-based PHEV power controller in [69] provides satisfactorily control, but its performance may not tolerate such uncertainties, and it may fail to handle the system frequency fluctuation. Further, the system parameters may not remain constant and continuously change when operating conditions vary [75]. The system parameter variations, such as the inertia constant and damping ratio, are conventionally considered to check the performance and robustness in the Load Frequency Control (LFC) approach [76]. Hence, the robustness of the controller against system uncertainties is a vital factor that must be considered. This paper presents a precise bidirectional charging control strategy of PHEVs in power grids to simultaneously regulate the voltage and frequency, as well as reducing the peak load, and improving the power quality by considering the SoC and available active power in power grids. Different events that may occur during a 24-h scenario in the studied DG-based system consisting of different microgrids, diesel generator and wind farm, PHEVs with several charging profiles, and different loads are considered. The simulation and analysis are performed in MATLAB/SIMULINK software. Figure 2 shows a basic model of a power system consisting of two generators and a transmission line which is connected to two generation buses. In this figure, each bus has its voltage magnitude and phase angle, where V 1 ∠θ 1 and V 2 ∠θ 2 are the corresponding voltage magnitude and phase angle of buses 1 and 2, respectively. The impedance of the transmission line is Z∠γ, where:

Principles of Bidirectional Power Flow
and Therefore, by considering voltage magnitude and phase angle differences between buses, the active power, P, and reactive power, Q, can be transferred, bidirectionally. In order to study the bidirectional power flow, it should be assumed that both buses are capable of supplying and absorbing active and reactive power.
Assuming ≫ , Equations (3) and (4) can be re-written as:   199 Table 1 shows the charging station specifications.  Based on the direction of power flow, the active and reactive power equations can be written as:

200
Assuming X R, Equations (3) and (4) can be re-written as: Small changes in the voltage magnitude have a direct impact on the reactive power flow, while deviations in phase angle can change the active power flow in power grids. If θ 1 > θ 2 , the active power can be transferred from bus 1 to bus 2 and vice versa. Further, if V 1 > V 2 , the reactive power can be transferred from bus 1 to bus 2 and vice versa. Therefore, the voltage magnitude and phase angle play the important roles in power transfer in power grids.

Bidirectional Charging Station
PHEV chargers should be installed off-board and onboard in a vehicle. Onboard chargers are built with a small size, low power rating, and can be used based on a slow charging mechanism. Off-board PHEV chargers are located at specific places and provide either a slow or fast charging mechanism. As a result, charging networks play an important role to support PHEVs. In addition, there are two common architectures (series and parallel) in the PHEV drivetrain. Moreover, a combination of these two (series-parallel architecture) is also used in some vehicles [1,[5][6][7][8]77]. This paper has considered a generic aggregation of PHEVs with different charging profiles. The number of vehicles in charge, the rated power and rated capacity, and the power converter efficiency are the important factors in this model. This model is also capable of enabling vehicles to the grid, instantly. Table 1 shows the charging station specifications. The fundamental configuration of the charging station consists of a centralized AC/DC converter and different DC/DC converters as the charging lots. The AC/DC converter rectifies the three-phase AC input signal into a DC output signal. DC/DC converters have been used to regulate and shift the output signal to the desired level. A bidirectional charging station is capable of controlling the power flow in both directions between charging stations and power grids. Figure 3 illustrates the single-line diagram of the case study in this paper [78]. Further, the proposed scheme of the grid-connected PHEV system is illustrated in this figure. The proposed model has a central AC/DC VSC station and different controllable DC/DC converters based on a certain number of PHEVs. All DC/DC converters are in a parallel architecture and are connected to a common DC bus, which has been regulated by the central AC/DC VSC station. Two different conditions have been assumed for the charging stations: (1) cars in regulation, which contribute to the grid regulation; and (2) cars in charge, which are regularly in the charging process. Therefore, there are two modes of operation for each PHEV: (1) regulation mode; and (2) charging mode.
In order to minimize the output harmonics during the operation and switching processes of converters, an RL filter has been considered between the charging station and power grid. The charging system in this paper allows transferring the active and reactive power bidirectionally with the help of a control system. The control strategy mainly focuses on the AC/DC and DC/DC converters. By proper controlling the central AC/DC VSC station, injecting reactive power into the power grid to regulate the voltage, improving the power factor, and maintaining a constant DC-bus voltage, can be achieved. Moreover, an appropriate control mechanism for the DC/DC converters can ensure controlling the charging and discharging processes of PHEVs. This paper has considered both charging and discharging operations, where the DC/DC converters are controlled by charge/discharge PHEV batteries.

214
In order to minimize the output harmonics during the operation and switching processes of 215 converters, an RL filter has been considered between the charging station and power grid. The

230
This section provides details of the control systems of the converter station in different modes.

Converter Station Control Systems
As stated in Section 3.1, the converter station can work in two modes: (1) the regulation mode, and (2) the charge mode, and is capable of compensating reactive power, and consequently, regulating the voltage of the power grid during the charging and discharging processes of PHEVs. This section provides details of the control systems of the converter station in different modes.

Grid Regulation Mode
In order to contribute to the grid regulation, two controllers have been designed: (1) a grid regulation controller, and (2) a grid regulation power generation. Figure 4 shows the grid regulation controller scheme. This controller is fed by the maximum regulated active power, P max_reg .

251
. Changing these two gains has a direct impact on the SoC of all the cars in the charge mode. A 252 zero-crossing detection integrator has been considered to minimize the disturbance and steady-state 253 error of the input signal. The output signal of the integrator has been rechecked to avoid the 254 maximum allowable regulated active power that is fed into the grid regulation power generation 255 system. Figure 6 illustrates a detailed diagram of the grid regulation controller.  To achieve the maximum active power regulation, a control system that consistently checks the nominal active power, P nom , is proposed, as shown in Figure 5. In this controller, the nominal active power, the number of cars in regulation, N, and an online key to enable the V2G mode are matter. Lastly, the output power has been limited within the standard range to be considered as the maximum regulated active power. There is a threshold (0.5) for passing the first input to the second input, C 1 , of this controller.  In order to contribute to the grid regulation, real-time measurement of the frequency, ω grid , is required. By comparing ω grid and the reference frequency, ω ref , the frequency deviation can be obtained. The frequency deviation should be less than 0.05%. Otherwise, the controller stops the process. To prevent sudden changes in the frequency deviation, the controller's derivative has been utilized. By considering that the frequency deviation is within the standard range, two gains for the grid regulation controller have been set by the operator, the open-loop gain, K 1 , and the loop gain, K 2 . Changing these two gains has a direct impact on the SoC of all the cars in the charge mode. A zero-crossing detection integrator has been considered to minimize the disturbance and steady-state error of the input signal. The output signal of the integrator has been rechecked to avoid the maximum allowable regulated active power that is fed into the grid regulation power generation system. Figure 6 illustrates a detailed diagram of the grid regulation controller.
Furthermore, by controlling the voltage, and consequently, the current through another control system, the proposed control strategy can ensure a contribution to the grid regulation power generation, as shown in Figure 7.
utilized. By considering that the frequency deviation is within the standard range, two gains for the 250 grid regulation controller have been set by the operator, the open-loop gain, , and the loop gain,

251
. Changing these two gains has a direct impact on the SoC of all the cars in the charge mode. A 252 zero-crossing detection integrator has been considered to minimize the disturbance and steady-state 253 error of the input signal. The output signal of the integrator has been rechecked to avoid the 254 maximum allowable regulated active power that is fed into the grid regulation power generation 255 system. Figure 6 illustrates a detailed diagram of the grid regulation controller. The grid regulation power generation controller captures the voltage of pair phases. Therefore: where V ab is the voltage between phases a and b, and V bc is the voltage between phases b and c. Moreover: By using Equation (7) and decomposing the real and imaginary parts from the apparent power, S, the current can be derived as follows: where V and I denote the voltage and current, respectively. S * and V * represent the complex conjugate of the apparent power and the complex conjugate of the voltage, respectively. Accordingly, the controller feeds constant current into the power grid and regulates the voltage and frequency, simultaneously.

261
The grid regulation power generation controller captures the voltage of pair phases. Therefore: where is the voltage between phases a and b, and is the voltage between phases b and 263 c.

264
Moreover: By using Equation (7) and decomposing the real and imaginary parts from the apparent power,

266
, the current can be derived as follows: where and denote the voltage and current, respectively. * and * represent the complex

Charge Mode
In order to control the PHEV station in charge mode, two states have been studied: (1) SoC, and (2) plug. The charge power generation controller requires the nominal active power and the number of cars in charge, M, as its inputs. Same as the grid regulation mode, a threshold (0.5) is used for passing the first input to the second input, C 4 , of the charge power generation control system. The threshold can guarantee safe operation. Figure 8 shows the outer control diagram of the charge power generation controller. Same as the previous section, by regulating the voltage, and decomposing the real and imaginary parts of the apparent power of the charging system, a constant current, I reg , is obtained from the controller, and fed into the power grid. Figure 9 illustrates the inner control diagram of the charge power generation controller. Each group of cars has a certain charging profile. As mentioned, the car profile has been investigated by checking the SoC and plug states. Figure 10 demonstrates the control diagram of the profile of each PHEV in charge and regulation modes. In this control design, the SoC initialization and plug state have been implemented by using the Binary Search Method (BSM). Therefore, the SoC initialization and plug state have stochastic, but linear behavior. Complementary descriptions for the different profiles are provided in Section 3.7. In order to control the output changes of the SoC initialization and plug state within limits, two state limiters have been considered. By capturing the SoC initialization and plug state, and the present values of the SoC in different profiles, the state estimator for each SoC controller has been designed. Figure 11 indicates the SoC controller, where the output of this controller is the State Estimator (SE%), and regulated for the charger controller. The SoC controller needs accurate information of the active power of the cars in charge, P charge , the number of cars in charge mode, M, the number of cars in the specific charging profile, L i (where i = 1, . . . , 5), the number of cars in regulation mode, N, the active power of the cars in EV mode, P EV , and the regulated output of the SoC initialization and plug state.  can be either in charge or EV mode. Therefore, there should be a switch to toggle between these two 309 modes. By reaching the maximum level of the charge, the controller terminates the charging process.

310
In the meantime, the controller checks the plug state dynamically, and if the PHEV is unplugged 311 from the grid, it sends zero signal, , as shown in figure 11, and terminates the charging process.

312
Assuming the PHEV is in charge mode, the charge/discharge efficiency has been taken into 313 consideration. These two are modeled as two direct gains, and , so that: where shows the efficiency.

315
The SoC, which is converted to real-time by multiplying the present capacity by 1000×3600, the 316 plug state, and the charging state are sent to an integrator with the initial condition and dynamic 317 saturation, and lastly, the output is multiplied by the number of cars in a particular profile to obtain 318 the state estimation. State estimation from this stage is used as the SoC of the vehicles. Deriving the 319 state estimation, the cars are checked whether they are either in the charge mode or regulation mode 320 through the charger controller. Figure 12 indicates the charger control diagram. In order to guarantee 321 a high-efficiency output during the charging process, the state estimation has been set within the 322 range of 85% and 95%. Otherwise, the charger terminates the process. In fact, this can ensure both The state estimation of batteries in PHEVs requires checking the mode of vehicles. The PHEV can be either in charge or EV mode. Therefore, there should be a switch to toggle between these two modes. By reaching the maximum level of the charge, the controller terminates the charging process. In the meantime, the controller checks the plug state dynamically, and if the PHEV is unplugged from the grid, it sends zero signal, C 6 , as shown in Figure 11, and terminates the charging process.
Assuming the PHEV is in charge mode, the charge/discharge efficiency has been taken into consideration. These two are modeled as two direct gains, K 14 and K 15 , so that: where η shows the efficiency. The SoC, which is converted to real-time by multiplying the present capacity by 1000 × 3600, the plug state, and the charging state are sent to an integrator with the initial condition and dynamic saturation, and lastly, the output is multiplied by the number of cars in a particular profile to obtain the state estimation. State estimation from this stage is used as the SoC of the vehicles. Deriving the state estimation, the cars are checked whether they are either in the charge mode or regulation mode through the charger controller. Figure 12 indicates the charger control diagram. In order to guarantee a high-efficiency output during the charging process, the state estimation has been set within the range of 85% and 95%. Otherwise, the charger terminates the process. In fact, this can ensure both injecting power with high quality to the power grid during the regulation mode and charging the batteries during the charging mode.

308
can be either in charge or EV mode. Therefore, there should be a switch to toggle between these two 309 modes. By reaching the maximum level of the charge, the controller terminates the charging process.

310
In the meantime, the controller checks the plug state dynamically, and if the PHEV is unplugged 311 from the grid, it sends zero signal, , as shown in figure 11, and terminates the charging process.

312
Assuming the PHEV is in charge mode, the charge/discharge efficiency has been taken into 313 consideration. These two are modeled as two direct gains, and , so that: where shows the efficiency.

315
The SoC, which is converted to real-time by multiplying the present capacity by 1000×3600, the  Proper operation of the charging station of PHEVs lead to the energy balance of ESSs in PHEVs subject to the maximum and minimum operating limitations in charging and discharging power as follows: subject to: 0 ≤ P s,i,t,c ≤ k s,i,t,c × P s,i,c_max 0 ≤ P s,i,t,disc ≤ k s,i,t,disc × P s,i,disc_max (13) k s,i,t,c + k s,i,t,disc ≤ 1 (14) k s,i,t,c + k s,i,t,disc ∈ {0, 1} (15) where indices s, i, and t refer to the sth energy storage system at the ith bus in the tth time interval. Therefore, E s,i,t is the energy storage of the sth energy storage system at the ith bus in the tth time interval in MWh. η s,i,c and η s,i,disc are charging and discharging efficiencies, respectively. P s,i,t,c and P s,i,t,disc are charge and discharge power, and k s,i,t,c and k s,i,t,disc are the binary variables for charging and discharging operations of the sth energy storage system at the ith bus in the tth time interval, respectively. Figure 13 shows the flow chart of the proposed bidirectional power charging strategy. According to the collected data from the installed meters, the amount of the active and reactive power in the system is checked. When V2G is not activated, the existing microgrid(s) satisfy the total load consumption, whether there is a contingency in the system or not. When V2G is activated, the SoC initialization and plug state of PHEVs are checked and based on them, the SoC can be estimated. According to the estimated SoC, PHEVs mode can be either in charge or regulations mode. By considering that there is no contingency in the system, the required power to charge PHEVs is supplied by the existing microgrid(s). Otherwise, all PHEVs in charge and regulation modes are passed through a regulation unit, and the regulated voltage and frequency are then used to update the active and reactive power.

332
Therefore, , , is the energy storage of the s th energy storage system at the i th bus in the t th time

Diesel Generator
A three-phase synchronous machine in the dq-rotor reference frame with the engine governor and excitation system has been modeled and considered as the diesel generator to feed 15 MW active power to the power grid. The nominal power, line-to-line voltage, and frequency of the generator are 15 MW, 25 kV, and 60 Hz, respectively. The IEEE type 1 synchronous generator voltage regulator combined with an exciter has been implemented as the excitation system. Moreover, the diesel governor has been modeled, where the desired and actual rotor speeds are the inputs and the mechanical power of the diesel engine is the output. Further, the motor inertia has been combined with the generator. The design considerations for the governor are made through the regulation of the controller and actuator as follows: where H c is the controller transfer function, K is the regulator gain, and T 1 , T 2 , and T 3 are the regulator time constants, respectively. Furthermore: where H a is the actuator transfer function, and T 4 , T 5 , and T 6 are the regulator time constants, respectively. The engine time delay, T d , has been set to 0.024 sec. It should be noted that ω re f and V re f of the diesel engine governor and excitation system have been set to 1 p.u. Accordingly: where T m = P m ω m , T e = P e ω e , and ∆ω = ω − ω rated . T m , T e , ω m , and ω e are the mechanical torque of the synchronous generator rotor shaft input from the prime mover, stator electromagnetic torque, mechanical speed of the rotor, and synchronous speed, respectively. D indicates the damping coefficient, ω and ω rated are the actual electrical and rated angular velocities, respectively. P m and P e are the mechanical and electromagnetic power, respectively. J shows the rotational inertia, and θ indicates the electrical angle.
In addition: where E 0 , V s , and I are the three-phase stator winding electromotive force, the stator voltage and current, respectively. Moreover, r a and x s indicate the armature resistance and stator reactance, respectively.

Wind Farm
As the second source of energy, a wind farm with 4.5 MW nominal power capacity, with 13.5 m/s as the nominal wind speed, and 15 m/s as the maximum wind speed, is studied in this paper. The wind speed fluctuations provide a situation to study the power grid under a stochastic condition (uncertainty). The generated power by the wind farm can be obtained as follows: where P wind is the active power generated by the wind farm, P r shows the rated power of the wind farm, v i indicates the wind speed, and v cut−in , v r , and v cut−out are the cut-in, rated, and cut-out speeds of the wind turbine, respectively. The output power of the wind farm has been treated as a negative load so that the power factor can be kept at a constant level.

Loads
A three-phase squirrel-cage asynchronous machine 1.5 MVA, 600 V, 60 Hz in the dq-reference frame (as the industrial load), and a set of loads with the nominal power of 10 MW at 0.95 power factor (as the residential load) have been modeled as the loads' case study. This model can represent the impact of inductive loads on the microgrid. The residential load follows a specific profile with the assigned power factor during the day. Further, the industrial load has been controlled by the square relation between the mechanical torque and the rotor speed.

Power Transformers
Two three-phase power transformers, a 20 MVA, 25kV/25kV, 60Hz transformer for the voltage regulation with Yg-Yg winding connections and a 20 MVA, 25kV/600V, 60 Hz step-down transformer with Yg-Yg winding connections have been modeled as a part of transmission systems for the power system.

Power System Modeling
As shown in Figure 3, a single-line diagram of a power system consisting of different microgrids and PHEVs has been modeled, where the total peak load is 10.15 MW, and the total generated power is 19.5 MW. One of the contributions of this paper is to consider variable power loading levels for PHEVs, which lead to different profiles for the charging stations. Five different profiles have been assigned to PHEVs. Profile 1 is for vehicles with the possibility to be charged during the working hours. Profile 2 is for vehicles with the possibility to be charged during working hours but with a longer ride. Profile 3 is for vehicles with no possibility to be charged during the working hours. Profile 4 is for vehicles which are parked at home and charged during the whole day. Profile 5 is for vehicles that are charged during the night shift. In this case, the impact of charging on the power grid has been investigated. In order to differentiate between the SoC of the PHEVs and the stand-alone battery packs, different charging and discharging cycles have been studied in this paper. The generator balances the power and load demand. The generator determines the frequency deviations of the grid at the rotor speed. By using transformers, the voltage level has been stepped-down to suitable voltage levels for the power grid. Table 2 shows the corresponding values of the control parameters for the charging station system in the power grid. Table 2. Control parameters of the charging station.
Two scenarios have been investigated in 24 h. The wind speed varies during the day and has multiple maximum and minimum values. The residential load consumption profile is similar to that of the real world. The demand is low during the day, increases to the peak value during the evening and night, and gradually decreases during the late night. Two events have significantly affected the grid frequency during the day: (1) event 1, which is the asynchronous machine (industrial load) start-up at t = 03:00 a.m., and (2) event 2, which is the wind farm outage at t = 10:00 p.m., when the wind speed exceeds the maximum speed. The case study has been simulated under two different conditions for vehicles in regulation and charging modes.

Results and Discussions
The case study in this paper conducts the power profile (the generated and consumed power) as the bidirectional power flow during a 24-h. Contributions of the diesel generator and wind farm and the impact of PHEVs on the peak load reduction have been studied in this section. To study the bidirectional power flow, the active and reactive power balance of the system have been determined as follows: subject to: where indices i, j, s, and t refer to the bus i, bus j, the sth energy storage system, and the tth time interval. P g i,t , P w i,t , P L i,t , Q g i,t and Q L i,t show the active power generated by the non-renewable energy source, the active power generated by the wind farm, the active power consumed by the load, the reactive power generated by the non-renewable energy source, and the reactive power consumed by the load at the ith bus in the tth time interval, respectively. Further, V, θ, and Z indicate the voltage magnitude, and angle, and the impedance of the bus, respectively. P ij,max and Q ij,max are the maximum allowable active and reactive power that can be transferred between the buses, respectively.

V2G Mode is Deactivated
Based on the results of the simulation for 86,400 sec. (24 h), which is shown in Figure 14, when the V2G system is not under operation, due to the defined scenarios during two different time intervals, one at t = 03:00 a.m. (10,800 sec.) and the second one at t = 10:00 p.m. (79,200 sec.), the industrial load bus voltage shows a significant change. Due to the first event, the voltage at all buses changes. Based on the nature of the load profile, the industrial load is not under operation before the third hour (the output power is 0 MVA), and the residential load reaches its minimum value (5.446 MVA), because of less usage of the normal resistive and inductive loads, such as lightings, refrigerators, etc. Therefore, the amount of current, and consequently, the drained power from the grid is not significant. At t = 10,800 sec., the industrial load starts up, and the power flow in the grid changes. The voltage at the industrial load bus drops, and the current increases drastically (from 0 to 2184 A). Hence, 445.3 kW power is extracted as the power losses due to this event, and accordingly, this power is supplied by the diesel generator and wind farm. The total load demand at that time reaches 7.235 MVA, and the power grid supplies the load through the amount of generated power by the two microgrids, where the generation contributions of the diesel generator and wind farm are 5.328 MVA and 2.446 MVA, respectively. Thus, the total generated power is derived as 7.774 MVA, which is more than the total load demand. It should be noted that when the V2G mode is deactivated, by increasing or decreasing the corresponding values of the controller's gains (K 1 and K 2 ), the SoC of the batteries of PHEVs in the charge mode does not change. Figure 14. Voltage, current, the apparent power, active power and reactive power curves of (a) the diesel generator, (b) wind farm, (c) residential load, and (d) industrial load during 24 hours when the V2G system is not under operation As shown in figure 15, the total load consumption increases from 6.0980 MVA at 05:00 a.m. (21,600 sec.) to 8.1800 MVA at 10:00 p.m. (79,200 sec.). Based on the results of the simulation, the diesel generator and wind farm successfully supply the load demand, even during the contingency. The transient time related to the voltage regulation at each bus is minimized by proper operating of the controllers. This is achieved by defining the power flow constraints (Equations 24 and 25) for the power grid. When the wind farm has less generation or is not under operation for a certain period of the time, the diesel generator acts as a fast-response power supply to supply the load without interruption. Table 3 shows the power flow of the power grid during the entire day. As shown in Figure 15, the total load consumption increases from 6.0980 MVA at 05:00 a.m. (21,600 sec.) to 8.1800 MVA at 10:00 p.m. (79,200 sec.). Based on the results of the simulation, the diesel generator and wind farm successfully supply the load demand, even during the contingency. The transient time related to the voltage regulation at each bus is minimized by proper operating of the controllers. This is achieved by defining the power flow constraints (Equations 24 and 25) for the power grid. When the wind farm has less generation or is not under operation for a certain period of the time, the diesel generator acts as a fast-response power supply to supply the load without interruption. Table 3 shows the power flow of the power grid during the entire day.  Table 3 shows the power flow of the power grid during the entire day.    Figure 16 shows the dynamic behavior of the converter station during the simulation time. As long as the breaker of the converter station is open and the V2G system is not under operation, the power consumption by the converter station is completely insignificant. However, the station detects the two events during the simulation time. It should be noted that the consumed power by the converter station is considered as the power losses in Table 3. As shown in Figure 16, in the regulation and charge modes, the consumed power by the converter station is close to zero. Figure 16 shows the dynamic behavior of the converter station during the simulation time. As long as the breaker of the converter station is open and the V2G system is not under operation, the power consumption by the converter station is completely insignificant. However, the station detects the two events during the simulation time. It should be noted that the consumed power by the converter station is considered as the power losses in table 3. As shown in figure 16, in the regulation and charge modes, the consumed power by the converter station is close to zero.
(a) (b) Figure 16. Voltage, current, the apparent power, active power, and reactive power curves of the converter station in (a) the charge mode and (b) the regulation mode in 24 hours when the V2G system is not under operation

V2G Mode is Activated
When the V2G mode is activated, the operating impact of the V2G system changes the power flow of the grid. Theoretically, it is expected that when the V2G system is under operation, more power is supposed to be drained from the power grid. The more power consumed by the converter station, the greater the power required from the diesel generator and wind farm. Unlike the previous mode that the V2G mode was deactivated, the different car profiles change the total load profile. Therefore, the peak load is expected to be more than the previous operating mode. Figure 17 shows the results of the simulation in the V2G system operation.

V2G Mode is Activated
When the V2G mode is activated, the operating impact of the V2G system changes the power flow of the grid. Theoretically, it is expected that when the V2G system is under operation, more power is supposed to be drained from the power grid. The more power consumed by the converter station, the greater the power required from the diesel generator and wind farm. Unlike the previous mode that the V2G mode was deactivated, the different car profiles change the total load profile. Therefore, the peak load is expected to be more than the previous operating mode. Figure 17 shows the results of the simulation in the V2G system operation.
Unexpected events (contingency and/or outage) in the power system lead to a change in the voltage and frequency. Heavy load or generator outages can be considered as such changes that influence the voltage and frequency variations. As shown in Figure 18, based on the two defined scenarios, at t = 10,800 sec., the industrial load starts up and drains power from the generation buses. The total generated power should satisfy the total load demand, including the cars in profiles 4 and 5. Due to the sudden changes in the power, the converter station detects the voltage and frequency variations, and the controllers switch to the regulation mode and contribute to the grid regulation, as shown in Figure 18. However, the voltage curve in both charge and regulation modes fluctuates around its nominal value, the frequency deviations related to the power changes after the contingency are more visible. Due to rapid fluctuations in the voltage of the power supply or loads, a momentary flicker can also be observed in the power system. The designed system attempts to mitigate and eliminate this momentary flicker by regulating (or stabilizing) the voltage. Figure 17. Voltage, current, the apparent power, active power, and reactive power curves of (a) the diesel generator, (b) wind farm, (c) residential load, and (d) industrial load during 24 hours when the V2G system is under operation Unexpected events (contingency and/or outage) in the power system lead to a change in the voltage and frequency. Heavy load or generator outages can be considered as such changes that influence the voltage and frequency variations. As shown in figure 18, based on the two defined scenarios, at t = 10,800 sec., the industrial load starts up and drains power from the generation buses. The total generated power should satisfy the total load demand, including the cars in profiles 4 and 5. Due to the sudden changes in the power, the converter station detects the voltage and frequency variations, and the controllers switch to the regulation mode and contribute to the grid regulation, as shown in figure 18. However, the voltage curve in both charge and regulation modes fluctuates around its nominal value, the frequency deviations related to the power changes after the contingency are more visible. Due to rapid fluctuations in the voltage of the power supply or loads, a momentary flicker can also be observed in the power system. The designed system attempts to mitigate and eliminate this momentary flicker by regulating (or stabilizing) the voltage.  Figure 18. Voltage, current, the apparent power, active power, and reactive power curves of the converter station in (a) the charge mode and (b) the regulation mode in 24 hours when the V2G system is under operation According to the descriptions of the car profiles in Section 3.7, the behavior of the SoC varies based on the car profile. Figure 19 illustrates the SoC of the different car profiles during the day, when the V2G system is under operation. When the second scenario occurs at t = 79,200 sec., the level of the generated power is reduced significantly. Consequently, PHEVs switch to the regulation mode to contribute to the voltage and frequency regulation and restore the system to its previous condition. Because the cars in profile 4 are connected to the grid for the entire day, their contributions to the grid regulation are more severe. Also, due to the grid mode controller settings, a gradual increase in the SoC is expected. Due to the fact that the wind farm outage decreases the level of generated power, the system can reach a critical condition without utilizing proper control systems.
It is observed that when the V2G mode is activated, by decreasing 1 , the SoC of the batteries decreases very slightly during the simulation time. By increasing 1 , the SoC of the cars in profile 4 According to the descriptions of the car profiles in Section 3.7, the behavior of the SoC varies based on the car profile. Figure 19 illustrates the SoC of the different car profiles during the day, when the V2G system is under operation. When the second scenario occurs at t = 79,200 sec., the level of the generated power is reduced significantly. Consequently, PHEVs switch to the regulation mode to contribute to the voltage and frequency regulation and restore the system to its previous condition. Because the cars in profile 4 are connected to the grid for the entire day, their contributions to the grid regulation are more severe. Also, due to the grid mode controller settings, a gradual increase in the SoC is expected. Due to the fact that the wind farm outage decreases the level of generated power, the system can reach a critical condition without utilizing proper control systems.
It is observed that when the V2G mode is activated, by decreasing K 1 , the SoC of the batteries decreases very slightly during the simulation time. By increasing K 1 , the SoC of the cars in profile 4 increases from 90.0 to 90.6. Decreasing K 2 causes an inverse trend in the SoC variations. This means that the SoC of the cars in profile 4 increases, and then, gradually decreases. By increasing K 2 , the SoC of the batteries of the cars in profile 4 moderately decreases during the simulation time. It should be noted that the minimum level of the SoC is 10%.  Figure 20 illustrates the total generated and consumed power curves when the V2G system is under operation. As shown in this figure, the total load demand varies throughout the day and is met by the dispatchable generation unit. The generation units adjust operations to follow the load pattern. When the V2G system is not under operation, there is only one peak point during the entire simulation time. However, when the V2G mode is activated, the number of peak points is increased due to the different car profiles. The peak points are met when the number of car-users is increased, and the generation units are forced to generate more power. The maximum peak point has been detected between t = 17:00 and t = 18:00, because cars in profiles 1, 3, 4, and 5 are all in the charging mode. Although the wind farm has been under operation, the diesel generator has been operated close to its maximum capacity. The total power at t = 10,800 sec. has reached its first peak point of 8.107 MVA as the generated power, and 7.435 MVA as the total load demand. The loads have met the minimum value of 5.616 MVA at t = 14,400 sec. where the generated power has been 6.062 MVA. Between t = 14,400 sec. and t = 16,550 sec., the total load demand has increased to 6.303 MVA (due to the different charging profiles), and the generation units have followed the load profile, and have generated 6.831 MVA. Over time, the total load level has shown an overall increasing trend and increased from 6.100 MVA at t = 18,800 sec. to 6.317 MVA at t = 21,600 sec. and 8.071 MVA at t = 28,800 sec., where the total generated power has reached 6.766 MVA, 6.802 MVA, 8.771 MVA, respectively. The power grid has experienced the second increase between t = 28,800 sec. and t = 30.160 sec. in which more cars have been in the charging mode. During this time interval, the total load demand has increased from 9.916 MVA to 10.200 MVA, and the generated power has been 10.680 MVA and 11.020 MVA, respectively. The same trend has been observed between t = 30,940 sec. and t = 64,800 sec. in which the number of PHEVs in charge has been increased. The demand has changed from 8.591 MVA to 10.270 MVA, and correspondingly, the generated power has varied from 9.365 MVA to 11.440 MVA, respectively. At the third peak point, the generated power has reached its maximum capacity where approximately the total load demand has been 12.650 MVA. From t = 66.200 sec. to t = 79,200 sec., both the total load demand and generated power have decreased, but in general, their corresponding  Figure 20 illustrates the total generated and consumed power curves when the V2G system is under operation. As shown in this figure, the total load demand varies throughout the day and is met by the dispatchable generation unit. The generation units adjust operations to follow the load pattern. When the V2G system is not under operation, there is only one peak point during the entire simulation time. However, when the V2G mode is activated, the number of peak points is increased due to the different car profiles. The peak points are met when the number of car-users is increased, and the generation units are forced to generate more power. The maximum peak point has been detected between t = 17:00 and t = 18:00, because cars in profiles 1, 3, 4, and 5 are all in the charging mode. Although the wind farm has been under operation, the diesel generator has been operated close to its maximum capacity. The total power at t = 10,800 sec. has reached its first peak point of 8.107 MVA as the generated power, and 7.435 MVA as the total load demand. The loads have met the minimum value of 5.616 MVA at t = 14,400 sec. where the generated power has been 6.062 MVA. Between t = 14,400 sec. and t = 16,550 sec., the total load demand has increased to 6.303 MVA (due to the different charging profiles), and the generation units have followed the load profile, and have generated 6.831 MVA. Over time, the total load level has shown an overall increasing trend and increased from 6.100 MVA at t = 18,800 sec. to 6.317 MVA at t = 21,600 sec. and 8.071 MVA at t = 28,800 sec., where the total generated power has reached 6.766 MVA, 6.802 MVA, 8.771 MVA, respectively. The power grid has experienced the second increase between t = 28,800 sec. and t = 30.160 sec. in which more cars have been in the charging mode. During this time interval, the total load demand has increased from 9.916 MVA to 10.200 MVA, and the generated power has been 10.680 MVA and 11.020 MVA, respectively. The same trend has been observed between t = 30,940 sec. and t = 64,800 sec. in which the number of PHEVs in charge has been increased. The demand has changed from 8.591 MVA to 10.270 MVA, and correspondingly, the generated power has varied from 9.365 MVA to 11.440 MVA, respectively. At the third peak point, the generated power has reached its maximum capacity where approximately the total load demand has been 12.650 MVA. From t = 66.200 sec. to t = 79,200 sec., both the total load demand and generated power have decreased, but in general, their corresponding values have remained at a high level. At t = 79,200 sec., the power grid has lost 4.5 MW active power due to the outage of the wind farm and accordingly, there has been an intensive drop in the generated power, and the load demand has been more than the generated power. This could interrupt the power flow, and there has been this need to use an auxiliary system, such as the V2G system to restore power. As shown in Figure 20, PHEVs have supported the grid and contributed to the voltage and frequency regulation, and also the robustness of the proposed control system has been illustrated. The decreasing trend in both the generated power and total load demand has continued until the load level has decreased.

Conclusions
This paper reveals the impact of PHEVs charging on the power grid. A bidirectional charging station with a novel control strategy is proposed to solve the problem of voltage and frequency regulation in the power system due to the charging of PHEVs. A central AC/DC VSC converter station is investigated to inject active and reactive power into the power grid to regulate the voltage and frequency and reduce the peak load, as well as power quality improvement by considering the SoC and available active power in power grids. The proposed control strategy allows PHEVs to contribute to the grid regulation when an event occurs in a DG-based power grid consisting of different microgrids, diesel generator and wind farm, PHEVs with several charging profiles, and different loads. The simulation results show the robustness of the proposed control strategy.
Author Contributions: F. Mohammadi was responsible for methodology, collecting resources, data analysis, writing-original draft preparation, and writing-review and editing. G. A. Nazri and M. Saif were responsible for the supervision, and writing-review and editing.

Conclusions
This paper reveals the impact of PHEVs charging on the power grid. A bidirectional charging station with a novel control strategy is proposed to solve the problem of voltage and frequency regulation in the power system due to the charging of PHEVs. A central AC/DC VSC converter station is investigated to inject active and reactive power into the power grid to regulate the voltage and frequency and reduce the peak load, as well as power quality improvement by considering the SoC and available active power in power grids. The proposed control strategy allows PHEVs to contribute to the grid regulation when an event occurs in a DG-based power grid consisting of different microgrids, diesel generator and wind farm, PHEVs with several charging profiles, and different loads. The simulation results show the robustness of the proposed control strategy.
Author Contributions: F.M. was responsible for methodology, collecting resources, data analysis, writing-original draft preparation, and writing-review and editing. G.-A.N. and M.S. were responsible for the supervision, and writing-review and editing.

Conflicts of Interest:
The authors declare no conflicts of interest.