# A Novel Charging and Discharging Algorithm of Plug-in Hybrid Electric Vehicles Considering Vehicle-to-Grid and Photovoltaic Generation

^{1}

^{2}

^{3}

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Application of Particle Swarm Optimization and Artificial Neural Network (PSO-ANN) for Predicting Penetration of Plug-in Electric Vehicles (PHEVs) Battery State of Charge (SOC)

#### Implementation of Hybrid PSO-ANN for Predicting PHEV Battery SOC

- Initialize the PSO algorithm by specifying the parameters such as the population size, N = 10; number of dimensions, D = 5; number of iterations, T = 500; max weight = 0.9, minimum weight = 0.4; and acceleration coefficient c
_{1}= c_{2}= 2. - Randomly generates the initial positions within feasible solution combinations and obtains the initial pbest and gbest.
- Select the number of hidden neurons (Ne) and hidden layers (HLs) and train the ANN.
- Train the ANN and evaluate the fitness value by calculating the objective functions of MAE and RMSE.
- Update the local best (pbest), the best previous position of each particles and global best (gbest) position of all particles.
- Update the velocity using (6) within the velocity interval of −Vmax and +Vmin.
- Update the particle position using (7). There are possibilities that the position is rejected. Therefore, look for other combinations.
- Repeat steps (iii) and (iv).
- Check if the maximum population size is reached. If not, compare the pbest value with the global best (gbest), if it has a minimum value, save it as the new global best.
- Repeat steps (v) to (ix) until reaching the stopping criterion so as to obtain the optimal hidden layers and hidden neurons.

## 3. Management Control Method

#### 3.1. Charging Load Forecasting Model

#### 3.2. Charging and Discharging Control Algorithm

_{j}is the root mean square (RMS) value of the $i\mathrm{th}$ bus voltage.

- Obtain input network information of the test distribution systems such as bus, line and load data.
- Obtain the PHEV battery characteristics, like voltage, current and temperature, to be later controlled upon arriving at the parking lots.
- Initialize OPENDSS start-up in MATLAB and initialize different daily load profiles to the system.
- Run OpenDSS daily load profile using MATLAB and run power flow to obtain the total power loss and voltage magnitude.
- Predict the SOC of vehicles using the developed ANN prediction model.
- Sort the vehicles such that the vehicles with a SOC less than 60% are charged first, and other vehicles with SOC >60% are put on standby. When backup power sources are needed during the charging process, PHEVs with SOC >60% will start the discharging V2G process.
- Power demand is verified first, such that if it is not on peak demand, the grid power is used as the charging power supply to the vehicles, otherwise PV power output is activated to provide power to PHEVs for charging.
- Prioritize the vehicle to three levels: high priority, medium priority and low priority. Charging starts with high priority level when SOC is less than 30%, and then considers medium priority, when SOC is in the range of 30%–45%, and lastly low priority when SOC is in the range of 45%–60%.
- Run OpenDSS power flow using the MATLAB software to obtain the updated total power loss and voltage magnitude.
- Check the bus voltage magnitude and total power loss constraints, if both do not exceed their limits, consider the other vehicles in the queue and repeat steps from (vii) to (ix).
- Set V2G variable to 1, when there is a violation on the threshold value of both voltage magnitude and power loss.
- Start discharging the first vehicle in the queue to limit the impact of PHEVs on the voltage profile and power loss such that the voltage and power loss are within permissible limits.
- Run power flow using the OpenDSS to obtain the new updated values of voltage magnitude and power loss.
- Check for violations in the voltage magnitude and power loss constraints, if violation exists repeat steps (xi) to (xiii).
- Go to step (x) to take another vehicle from the queue for charging process.

## 4. Results and Discussion

#### 4.1. Results of Hybrid PSO-ANN for Predicting Battery SOC of PHEV

^{−3}after 79 iterations. Table 1 shows the optimum learning rate (LR), number of neurons in the hidden layers (Ne1, Ne2, Ne3) and number of hidden layers (HLs), obtained by using the hybrid PSO-ANN technique considering different population sizes. From the table, the PSO-ANN optimum values acquired for the LR, HL, Ne1 and Ne2 are 0.3663, 3, 13, 13 and 10, respectively. The best value of the optimized four parameters are indicated in bold at a population size of 20. Table 2 illustrates three statistical indices, namely, RMSE, mean square error (MSE) and MAE to evaluate the ANN accuracy at the optimized parameters found.

#### 4.2. Results of Charging and Discharging Control Algorithm of PHEVs

## 5. Conclusions

## Author Contributions

## Funding

## Conflicts of Interest

## References

- Salah, F.; Llg, J.P.; Flath, C.M.; Basse, H.; Van Dinther, C. Impact of electric vehicles on distribution substations: A Swiss case study. Appl. Energy
**2015**, 137, 88–96. [Google Scholar] [CrossRef] - Jason, T.; Maitra, A.; Alexander, M.; Brooks, D.; Duvall, M. Evaluation of the impact of plug-in electric vehicle loading on distribution system operations. In Proceedings of the IEEE Power and Energy Society General Meeting, Calgary, AB, Canada, 26–30 July 2009; pp. 1–6. [Google Scholar]
- Poullikkas, A. Sustainable options for electric vehicle technologies. Renew. Sustain. Energy Rev.
**2015**, 41, 1277–1287. [Google Scholar] [CrossRef] - Rottondi, C.; Fontana, S.; Verticale, G. Enabling privacy in vehicle-to-grid interactions for battery recharging. Energies
**2014**, 7, 2780–2798. [Google Scholar] [CrossRef] - Dharmakeerthi, C.H.; Mithulananthan, N.; Saha, T.K. Impact of electric vehicle fast charging on power system voltage stability. Int. J. Electr. Power Energy Syst.
**2014**, 57, 241–249. [Google Scholar] [CrossRef] - Liu, N.; Chen, Q.; Liu, J.; Lu, X.Y.; Li, P.; Lei, J.Y.; Zhang, J.H. A heuristic operation strategy for commercial building microgrids containing EVs and PV system. IEEE Trans. Ind. Electron.
**2015**, 62, 2560–2570. [Google Scholar] [CrossRef] - Nguyen, H.K.; Song, J.B. Optimal charging and discharging for multiple PHEVs with demand side management in vehicle-to-building. J. Commun. Netw.
**2012**, 14, 662–671. [Google Scholar] [CrossRef] - Han, S.; Han, S.; Sezaki, K. Development of an optimal vehicle-to-grid aggregator for frequency regulation. IEEE Trans. Smart Grid
**2010**, 1, 65–72. [Google Scholar] - Clement-Nyns, K.; Haesen, E.; Driesen, J. The impact of charging plug-in hybrid electric vehicles on a residential distribution grid. IEEE Trans. Power Syst.
**2010**, 25, 371–380. [Google Scholar] [CrossRef] - Deilami, S.; Masoum, A.S.; Moses, P.S.; Masoum, M.A.S. Realtime coordination of plug-in electric vehicle charging in smart grids to minimize power losses and improve voltage profile. IEEE Trans. Smart Grid
**2011**, 2, 456–467. [Google Scholar] [CrossRef] - Ota, Y.; Taniguchi, H.; Nakajima, T.; Liyanage, K.; Baba, J.; Yokoyama, A. Autonomous distributed v2g (vehicle-to-grid) consideringn charging request and battery condition. In Proceedings of the 2010 IEEE PES Innovative Smart Grid Technologies Conference Europe (ISGT Europe), Gothenburg, Sweden, 11 October 2010; pp. 1–6. [Google Scholar]
- Singh, M.; Kumar, P.; Kar, I. Implementation of vehicle to grid infrastructure using fuzzy logic controller. IEEE Trans. Smart Grid
**2012**, 3, 565–577. [Google Scholar] [CrossRef] - Wu, C.; Mohsenian-Rad, H.; Huang, J. Vehicle-to-aggregator interaction game. IEEE Trans. Smart Grid
**2012**, 3, 434–442. [Google Scholar] [CrossRef] - Qi, X.; Wu, G.; Boriboonsomsin, K.; Barth, M.J. Development and Evaluation of an Evolutionary Algorithm-Based OnLine Energy Management System for Plug-In Hybrid Electric Vehicles. IEEE Trans. Intell. Transp. Syst.
**2017**, 18, 2181–2191. [Google Scholar] [CrossRef] - Wang, X.; Liang, Q. Energy management strategy for plug-in hybrid electric vehicles via bidirectional vehicle-to-grid. IEEE Syst. J.
**2017**, 11, 1789–1798. [Google Scholar] [CrossRef] - Badawy, M.O. Power Flow Management of a Grid Tied PV-Battery Powered Fast Electric Vehicle Charging Station. IEEE Trans. Ind. Appl.
**2017**, 53, 4959–4966. [Google Scholar] [CrossRef] - Shojaabadi, S.; Abapour, S.; Abapour, M.; Nahavandi, A. Simultaneous planning of plug-in hybrid electric vehicle charging stations and wind power generation in distribution networks considering uncertainties. Renew. Energy
**2016**, 99, 237–252. [Google Scholar] [CrossRef] - Rahbari-Asr, N.; Chen, J.; Deng, R. Distributed real-time pricing control for large-scale unidirectional V2G with multiple energy suppliers. IEEE Trans. Ind. Inform.
**2016**, 12, 1953–1962. [Google Scholar] [CrossRef] - Quilumba, F.L.; Lee, W.J.; Huang, H.; Wang, D.Y.; Szabados, R.L. Using Smart Meter Data to Improve the Accuracy of Intraday Load Forecasting Considering Customer Behavior Similarities. IEEE Trans. Smart Grid
**2015**, 6, 911–918. [Google Scholar] [CrossRef] - Su, W.; Chow, M.Y. Computational intelligence-based energy management for a large-scale PHEV/PEV enabled municipal parking deck. Appl. Energy
**2012**, 96, 171–182. [Google Scholar] [CrossRef] - Jiménez-Bermejo, D.; Fraile-Ardanuy, J.; Castaño-Solis, S.; Merino, J.; Álvaro-Hermana, R. Using Dynamic Neural Networks for Battery State of Charge Estimation in Electric Vehicles. Procedia Comput. Sci.
**2018**, 130, 533–540. [Google Scholar] [CrossRef] - Jahangir, H.; Tayarani, H.; Ahmadian, A.; Golkar, M.A.; Miret, J.; Tayarani, M.; Gao, H.O. Charging demand of Plug-in Electric Vehicles: Forecasting travel behavior based on a novel Rough Artificial Neural Network approach. J. Clean. Prod.
**2019**, 229, 1029–1044. [Google Scholar] [CrossRef] - Zhao, J.X.; Ma, Y.Y.; Zhang, Z.D.; Wang, S.W.; Wang, S. Optimization and matching for range-extenders of electric vehicles with artificial neural network and genetic algorithm. Energy Convers. Manag.
**2019**, 184, 709–725. [Google Scholar] [CrossRef]

**Figure 1.**Artificial neural network (ANN) structure with three inputs, one output and multi hidden nodes.

**Figure 2.**Flowchart of the hybrid particle swarm optimization and artificial neural network (PSO-ANN). Abbreviations: RMSE, root-mean-square error; MAE, mean absolute error; ANN, artificial neural network.

**Figure 4.**Photovoltaic (PV) generation output power of Universti Kebangsaan Malaysia (UKM) solar system.

**Table 1.**Optimum value of optimized parameters in hybrid particle swarm optimization and artificial neural network (PSO-ANN) at different population sizes.

Population Size | Parameters | Hybrid PSO-ANN |
---|---|---|

10 | Learning rate (LR) | 0.7195 |

Hidden Layers | 3 | |

Neurons (Ne)1 | 14 | |

Ne2 | 9 | |

Ne3 | 8 | |

20 | LR | 0.3663 |

Hidden Layers | 3 | |

Ne1 | 13 | |

Ne2 | 13 | |

Ne3 | 10 | |

30 | LR | 0.5645 |

Hidden Layers | 3 | |

Ne1 | 8 | |

Ne2 | 20 | |

Ne3 | 7 | |

40 | LR | 0.9667 |

Hidden Layers | 3 | |

Ne1 | 12 | |

Ne2 | 13 | |

Ne3 | 1 |

Parameter | Population Size | |||
---|---|---|---|---|

10 | 20 | 30 | 40 | |

Root-mean-square error (RMSE) (%) | 0.9451 | 0.9320 | 0.9408 | 0.9368 |

Mean square error (MSE) (%) | 0.0089 | 0.0087 | 0.0089 | 0.0088 |

Mean absolute error (MAE) (%) | 0.6349 | 0.6306 | 0.6344 | 0.6478 |

Vehicle | Bus Name | Stored (kWh) | Stored (SOC %) | Enabled | Parking Type | Duration (h) |
---|---|---|---|---|---|---|

PHEV12 | 735 | 50 | 16 | Charging | Commercial | 1 |

PHEV42 | 735 | 50 | 16 | Charging | Governmental | 8 |

PHEV20 | 735 | 50 | 17 | Charging | Governmental | 8 |

PHEV37 | 735 | 50 | 18 | Charging | Commercial | 6 |

PHEV4 | 735 | 50 | 20 | Charging | Governmental | 8 |

PHEV21 | 735 | 50 | 21 | Charging | Governmental | 8 |

PHEV24 | 735 | 50 | 22 | Charging | Commercial | 5 |

PHEV28 | 735 | 50 | 22 | Charging | Commercial | 4 |

PHEV49 | 735 | 50 | 27 | Charging | Governmental | 8 |

PHEV3 | 735 | 50 | 28 | Charging | Governmental | 8 |

PHEV5 | 735 | 50 | 29 | Charging | Commercial | 4 |

PHEV34 | 735 | 50 | 29 | Charging | Commercial | 3 |

. . . . | . . . . | . . . . | . . . . | . . . . | . . . . | . . . . |

PHEV43 | 735 | 50 | 60 | Charging | Governmental | 8 |

Vehicle | Bus Name | Stored (kWh) | Stored (SOC %) | Enabled | Parking Type | Duration (h) |
---|---|---|---|---|---|---|

PHEV41 | 735 | 50 | 99 | Idling | Governmental | 8 |

PHEV47 | 735 | 50 | 98 | Idling | Commercial | 2 |

PHEV15 | 735 | 50 | 94 | Idling | Commercial | 3 |

PHEV45 | 735 | 50 | 93 | Idling | Governmental | 8 |

PHEV39 | 735 | 50 | 91 | Idling | Governmental | 8 |

PHEV8 | 735 | 50 | 88 | Idling | Commercial | 6 |

PHEV23 | 735 | 50 | 88 | Idling | Governmental | 8 |

PHEV9 | 735 | 50 | 87 | Idling | Governmental | 8 |

PHEV13 | 735 | 50 | 87 | Idling | Commercial | 8 |

PHEV40 | 735 | 50 | 87 | Idling | Commercial | 6 |

PHEV6 | 735 | 50 | 85 | Idling | Governmental | 8 |

PHEV2 | 735 | 50 | 84 | Idling | Governmental | 8 |

. . . . | . . . . | . . . . | . . . . | . . . . | . . . . | . . . . |

PHEV26 | 735 | 50 | 61 | Idling | Governmental | 8 |

Vehicle | Bus Name | Stored (kWh) | Stored (SOC %) | State | Time (min) | kW | Voltage (p.u) |
---|---|---|---|---|---|---|---|

Storage.phev24 | 735 | 16.4642 | 32.9284 | Charging | 15 | 25 | 0.9794 |

21.9284 | 43.8569 | Charging | 15 | 25 | 0.9794 | ||

27.3926 | 54.7852 | Charging | 15 | 25 | 0.9787 | ||

32.8567 | 65.7135 | Charging | 15 | 25 | 0.9787 | ||

38.3209 | 76.6417 | Charging | 15 | 25 | 0.9787 | ||

43.7841 | 87.5683 | Charging | 15 | 25 | 0.9813 | ||

49.2474 | 98.4948 | Charging | 15 | 25 | 0.9813 | ||

50 | 100 | Idling | 15 | 25 | 0.9813 |

Vehicle | Bus Name | Stored (kWh) | Stored (SOC %) | State | Time (min) | kW | Voltage (p.u) |
---|---|---|---|---|---|---|---|

Storage.phev1 | 735 | 21.4643 | 42.9286 | Charging | 15 | 25 | 0.9792 |

26.9286 | 53.8572 | Charging | 15 | 25 | 0.9792 | ||

32.3928 | 64.7856 | Charging | 15 | 25 | 0.9785 | ||

37.857 | 75.714 | Charging | 15 | 25 | 0.9785 | ||

43.3212 | 86.6424 | Charging | 15 | 25 | 0.9785 | ||

48.7845 | 97.569 | Charging | 15 | 25 | 0.9811 | ||

50 | 100 | Idling | 15 | 25 | 0.9811 |

Vehicle | Bus Name | Stored (kWh) | Stored (SOC %) | State | Time (min) | kW | Voltage (p.u) |
---|---|---|---|---|---|---|---|

Storage.phev32 | 735 | 27.9643 | 55.9287 | Charging | 15 | 25 | 0.9791 |

33.4287 | 66.8573 | Charging | 15 | 25 | 0.9791 | ||

38.8929 | 77.7858 | Charging | 15 | 25 | 0.9783 | ||

44.3572 | 88.7143 | Charging | 15 | 25 | 0.9783 | ||

49.8214 | 99.6428 | Charging | 15 | 25 | 0.9783 | ||

50 | 100 | Idling | 15 | 25 | 0.9809 |

Vehicle | Bus Name | Stored (kWh) | Stored (SOC %) | State | Time (min) | kW | Voltage (p.u) |
---|---|---|---|---|---|---|---|

Storage.phev2 | 735 | 27.9643 | 83.8567 | Discharging | 15 | 25 | 1.0400 |

33.4287 | 67.7134 | Discharging | 15 | 25 | 1.0400 | ||

38.8929 | 45.5705 | Discharging | 15 | 25 | 0.9789 | ||

44.3572 | 32.4277 | Discharging | 15 | 25 | 0.9789 | ||

49.8214 | 19.2848 | Discharging | 15 | 25 | 0.9789 | ||

50 | 10 | Idling | 15 | 25 | 0.9815 |

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

## Share and Cite

**MDPI and ACS Style**

Aljanad, A.; Mohamed, A.; Khatib, T.; Ayob, A.; Shareef, H.
A Novel Charging and Discharging Algorithm of Plug-in Hybrid Electric Vehicles Considering Vehicle-to-Grid and Photovoltaic Generation. *World Electr. Veh. J.* **2019**, *10*, 61.
https://doi.org/10.3390/wevj10040061

**AMA Style**

Aljanad A, Mohamed A, Khatib T, Ayob A, Shareef H.
A Novel Charging and Discharging Algorithm of Plug-in Hybrid Electric Vehicles Considering Vehicle-to-Grid and Photovoltaic Generation. *World Electric Vehicle Journal*. 2019; 10(4):61.
https://doi.org/10.3390/wevj10040061

**Chicago/Turabian Style**

Aljanad, Ahmed, Azah Mohamed, Tamer Khatib, Afida Ayob, and Hussain Shareef.
2019. "A Novel Charging and Discharging Algorithm of Plug-in Hybrid Electric Vehicles Considering Vehicle-to-Grid and Photovoltaic Generation" *World Electric Vehicle Journal* 10, no. 4: 61.
https://doi.org/10.3390/wevj10040061