MATLAB code for EV load demand rescheduling


Total downloads: 85

This MATLAB code schedule the Electric Vehicle charging load demand using optimization. The objectives considered here are: charging cost minimization, load variance minimization, grid loss minimization. It’s a multiobjective problem which has been bounded by several constraints like State of charge of vehicle battery, maximum-minimum battery capacity, charging rate, vehicle parking time, grid maximum power, voltage magnitude at each bus of grid etc.

This repository contains:

  • MATLAB code for the EV scheduling to minimize the losses at grid

Note: The free version of this code has a limited 5 trials and few protected files. Once the 5 trials are completed, the code will be deleted and MATLAB will be closed.

Download Code  Discuss Code


MATLAB code Highlights

  • the MATLAB code for EV load demand rescheduling uses the GWO optimization
  • the cost of charging and power losses on the grid are minimized
  • the SoC of the EV battery is the constraint which need to be managed during the optimization

In this work, we presented a MATLAB code for EV load demand rescheduling to minimize the charging cost, grid losses and load variance. An Electric vehicle (EV) is the most reliable and eco-friendly product of present days transportation system. EV has not polluted the environment because it does not consume any fossil oil. The main components of EV are an electric motor, battery, power electronic devices. In EV the battery is used as the storage bank of electricity. The electricity is provided for the EV charging by power grid. The grid is affected by the power losses during the charging of electric vehicles. The number of electric vehicles increases the power demand as well as grid losses. So a smart charging method or optimal scheduling of EV is necessary for the loss and cost minimization.

Work Statement

In this MATLAB code, we proposed Grey Wolf Optimization (GWO) [2] algorithm for the optimal EV load demand rescheduling on the IEEE 33 bus radial distribution system. The charging cost, power loss on grid and load variance minimization is the key objective of our work.

You can also check out our other work on Network reconfiguration to minimize the power losses in the IEEE 33 radial distribution system.

We have analyzed the proposed method for four different cases: low-level penetration of EV, high-level EV penetration, summer, and winter load of EV charging. The theoretical approach related to the GWO can be studied in the research paper [2] or from the

The GWO algorithm based project Hybrid Particle Swarm and Grey Wolf Optimization testing for benchmark function  is available at

Advantages of EV

  • Less dependency on the import of foreign
  • Minimum noise pollution compared to the ICE vehicle.
  • More economical and less maintenance
  • No release of air pollution and deliver improved

EV charging station

EV charging depends on the battery state of charge (SoC) during the initial and desired stage, charging time, and load on the grid line. The connection of EV on different buses of IEEE 33 radial bus system is shown in figure 1.

Figure 1 EV insert into the IEEE 33 radial bus system [3]

The entire work is designed in the MATLAB 2018a software. We take the IEEE33 bus radial distribution system model and inserted 10 EV charging stations on selected buses. The bus numbers 3, 6, 10, 14, 19, 22, 23, 25, 29, and 31 are selected for the installation of the charging station of electric vehicles. The plugin EV load connected to the charging station is divided into two categories low and high penetration level. The number of plug-in EV is higher in high penetration level and lower in low penetration level.

Objective Function to Optimize EV Charging Cost

  • Minimum cost of charging

The charging cost of EV should be minimum so that the extra burden of money on customer pocket is reduced. Equation 1 shows the objective function of minimum cost of charging

Where n represents the total number of a plug-in vehicle, the total number of time steps are shown by  m, Ck is the TOU price at time stamp k, pi, k reflects the ith plug-in EV charging power at each time, and time stamp is represented by delta t.

  • Load variance Minimization

While EV connected to the grid the power loss occurs, so the load variance is must required to reduce them. The equation of load variance is formulated as:

Pk is the grid forecasted load at time stamp k and t is the time stamp

  • Active power loss minimization

The active power loss of the distribution grid system is to be minimized at the time of EV load connected to the buses. The objective function is designed by estimating optimal scheduling coordination for the charging of EV load [3]. The equation is written as

F3= active power loss, Ik =branch current, Rk =branch impedance, ntl=total number of lines

A single objective function is formed by the combination of three multi-objective function

The objectives function of minimum cost (F1), minimum load variance (F2) and minimum active power loss (F3) of power grid are combined to form a multi-objective function.

Constraints in the EV Optimization

The constraints of the objective function are considered as

GWO optimized EV rescheduling

The power transferred from the grid to the EV in each timestamp is the key factor of smart charging control. The smart charging of EV operation includes various unsure terms like available grid power, arrival and departure time of EV at charging station, and initial SoC of battery. The hourly charging time is evaluated with the probability density function (PDF) of the arrival and departure times of EV.

GWO algorithm is used to optimize the objective function, as designed in equation 4. GWO is an iterative algorithm inspired by the hunting nature of wolves. The searching space dimension in GWO is the number of tuning variables. We have considered 156 electric vehicles for a timestamp of 24 hrs. We need to optimize the power transmitted to these 156 electric vehicles for 24 hrs, which makes the number of tuning variables equal to 24*156=3744 in a low penetration case. During high penetration, the number of vehicles reaches 312, and tuning variables are calculated as per them. The wolves’ position is changed after each iteration and the process is repeated until the optimal value of equation 1 is computed. The flow chart of the complete process is shown in figure 2.

Figure 2 flow chart of proposed


The overall work is performed on the MATLAB software. All scripts and plots are generated with the help of MATLAB coding. We used the load data per hour, TOU price and flat rate from the historical Dominian Virgina Power system. The data is available on Verigina power website.  It contains the load information of many states of America for each appliance for every hour.  Three states dataset are used collectively in our case which are

  • USA_AK_Anchorage.Intl.AP.702730_TMY3_HIGH.csv
  • USA_AK_Fairbanks.Intl.AP.702610_TMY3_HIGH.csv
  • USA_KS_Hays.Muni.AWOS.724518_TMY3_HIGH.csv

The GWO controlled EV charging rescheduling minimizes the power loss of the grid, load variation and cost of charging power. Figure 3 shows the comparison among the three optimized objective functions which are formulated above.

Figure 3 Comparison of charging cost, load variance and active power loss during the uncontrolled and controlled cases for low penetration

Table 1 Cost, load variance and active power loss by GWO tuned power supplied to EV charging for summer load data

Comparison terms Uncontrolled Load GWO controlled
Cost ($/Kw/h) 2.4 1.7
Load variance 5.5*105 5*105
Active power loss (KW) 263.5 217.4

Figure 4 Active power loss comparisons

The power loss comparison among the GWO controlled, basic load and uncontrolled EV load is shown in figure 4. The minimum active power loss belongs to the GWO controlled category.


We tested the proposed EV rescheduling algorithm on IEEE 33 radial bus system model with inserting the EV charging station on 10 different buses. There are two cases tested as per the climate condition summer and winter. Further, the low-level penetration and high-level penetration EV cases are analyzed for both summer and winter connected load. The overall cost of electricity and active power loss of the grid are minimized using the GWO controller.


 1. Is the data used for EV and load of the grid of 24hrs?

This project has considered the 24hrs consumer load profile taken from the USA Fairbank power grid. The consumer data is categories into winter and summer load with load demand of individual home appliances. The Appliances list in the data is given below. The code is though clubbing few appliances into a single variable.

The EV demand is also generated for 24 hr with the help of the Gaussian Probability Distribution Function

% Date/Time	
%Electricity:Facility [kW](Hourly)
%Gas:Facility [kW](Hourly)	
%Heating:Electricity [kW](Hourly)
%Heating:Gas [kW](Hourly)	
%Cooling:Electricity [kW](Hourly)	
%HVACFan:Fans:Electricity [kW](Hourly)	
%Electricity:HVAC [kW](Hourly)	
%Fans:Electricity [kW](Hourly)	
%General:InteriorLights:Electricity [kW](Hourly)	
%General:ExteriorLights:Electricity [kW](Hourly)	
%Appl:InteriorEquipment:Electricity [kW](Hourly)	
%Misc:InteriorEquipment:Electricity [kW](Hourly)	
%Water Heater:WaterSystems:Electricity [kW](Hourly) 

2. How is the charging pattern of EVs defined and implemented?

The Gaussian Probability Distribution Function has been used to generate the charging profile for EV. The Mean of 20 and Standard Deviation of 2 are used to generate the profile.

pdf_normal=pdf('Normal',x,mu,sigma);    % normal pdf for a single vehicle

3. The per unit price of electricity changes at peak demand. Is it also taken considered in this MATLAB code of EV charging scheduling?

This is an appropriate question, but for the sake of the simplicity of this project, a uniform per unit price is considered in the code. This 24 hrs price can be easily integrated into the current code.

4. The charging time of EVs can vary depending on the battery type. Is it taken care of in this code?

Yes, this is already implemented in the code. The SoC constraint is defined. Whenever this is matched, the charging of that vehicle is stopped. Moreover, since the vehicle connects for the charging at varying SoC present in the vehicle, different charging tome required is obvious. Though a total parking time of 7 hrs is kept fixed.


  1. Álvarez, Jorge García, Miguel Ángel González, Camino Rodríguez Vela, and Ramiro Varela. “Electric vehicle charging scheduling by an enhanced artificial bee colony algorithm.” Energies11, no. 10 (2018): 2752.
  2. Faris, Hossam & Aljarah, Ibrahim & Al-Betar, Mohammed & Mirjalili, Seyedali, “Grey wolf optimizer: a review of recent variants and applications” Neural Computing and Applications, 2017.
  3. Zalnidzam, Wan Iqmal Faezy Wan, Hasmaini Mohamad, Nur Ashida Salim, Hazlie Mokhlis, and Zuhaila Mat Yasin. “Optimal Charging Schedule Coordination of Electric Vehicles in Smart Grid.” Indonesian Journal of Electrical Engineering and Computer Science11, no. 1 (2018): 82-89.
  4. Balram, Pavan, Tuan Le Anh, and Lina Bertling Tjernberg. “Effects of plug-in electric vehicle charge scheduling on the day-ahead electricity market price.” In 2012 3rd IEEE PES Innovative Smart Grid Technologies Europe (ISGT Europe), pp. 1-8. IEEE, 2012.

Other Recommended Similar works

  1. Intelligent Charging Strategy of Electric Vehicle

  2. Network Reconfiguration in Power Distribution using Tie switches and DG Placements

  3. Power Congestion Management in IEEE30 Bus System



admin is an innovative and first of its kind platform created by Vidhilekha Soft Solutions Pvt Ltd, a Startup recognized by the Department For Promotion Of Industry And Internal Trade, Ministry of Commerce and Industry, Government of India recognised innovative research startup.

41 reviews for MATLAB code for EV load demand rescheduling

  1. papori.banik


  2. papori.banik


  3. nurain syahirah.saharenam (verified owner)

    i hope i can get the ebook as soon as possible. Thank you

  4. bijaydas123 (verified owner)

    I am working electric vehicle cost minimization. It will be helpful for my research work if I get the matlab code

  5. karim.hardani (verified owner)

    good job

  6. sowmya.r (verified owner)

    Very good resources

  7. fatir.burhan (verified owner)


  8. jim.sun (verified owner)


  9. jayati.vaish (verified owner)


  10. emmanuel.kinoti (verified owner)


  11. bijaydas123 (verified owner)

    I am working on electric vehicle charging cost minimization. The MATLAB coding will be helpful in my research

  12. sumeet.kumar (verified owner)


  13. jayati.vaish (verified owner)


  14. sowmya.r (verified owner)

    Very nice work.

  15. yasin.bektas (verified owner)

    very good

  16. amir.amiri (verified owner)


  17. David (verified owner)


  18. mohsen (verified owner)


  19. mohsen (verified owner)

    I want a free coupon code

  20. mohsen (verified owner)

    I want afree coupon code

  21. dark.vder (verified owner)


  22. kumar.das (verified owner)

    need matlab code

  23. kumar.das (verified owner)

    good one

  24. kumar.das (verified owner)

    p file

  25. shobhit.sharma (verified owner)


  26. shobhit.sharma (verified owner)


  27. magda.el-afifi (verified owner)

    very good

  28. akbaralipaper (verified owner)


  29. bijaydas123 (verified owner)

    I am working on Electric Vehicle charge scheduling. It will be helpful in my research

  30. asmaa


  31. vikaas.khan (verified owner)

    Please provide code asap

  32. shawon.chowdhury (verified owner)


  33. nandan.navin (verified owner)


  34. mehran.alizade (verified owner)


  35. sasmita.tripathy (verified owner)


  36. temitope.ajao (verified owner)

    i hope this will help me

  37. adibah.azhar (verified owner)


  38. amisha.maithil (verified owner)


  39. amisha.maithil (verified owner)


  40. tammisetty.koteswararao (verified owner)

    very helpful

  41. aya.desoky (verified owner)

    very good

Only logged in customers who have purchased this product may leave a review.