An Optimal Charging Solution for Commercial Electric Vehicles

New government regulations and incentives promote the deployment of commercial electric vehicles to reduce carbon emissions from gasoline-fueled vehicles. For commercial electric vehicles (CEVs) operating in a fleet, charging processes are often performed at the depot where they begin and end their daily driving cycles, as well as at public stations on their routes. With the large penetration of CEVs in depots, simultaneous charging increases peak demand, which in turn impacts the electric network and increases the demand cost of a facility. These depot charging conditions influence the charging schedules of CEVs along their routes and the total service cost of logistic companies. This paper investigates optimal charging problems for CEVs that are supported by charging stations at depot and on-route public charging stations. The optimal charging and routing problems of CEVs are modelled as an optimization problem and relevant solutions are provided. The charging variants considered in the optimization model are peak demand of depot charging, time of use tariffs during the day, partial recharging, waiting times and characteristics of public stations. The results indicate the effectiveness of the developed algorithm in achieving optimal routes that maximize the benefits of logistics companies provided all constraints are satisfied.

Cost of running one vehicle.

C Depot
Total charging cost at depot stations. C Distance Total distance cost of routes.

C Public
Total charging cost at public stations.

C Vehicle
Total cost of used vehicles.

D ij
Travel distance between customers i and j.

E Dep
CEVs' energy at departure from the depot.

E i
Remaining energy at arrival to node i. E Init n Initial energy at arrival to depot for vehicle n.  Decision variable of route selection.

I. INTRODUCTION
The electrification of different transportation modes has become a critical step towards the reduction of global greenhouse gas emissions [1], [2]. Commercial vehicles are one of the main contributors to global greenhouse gas emissions [3]. Commercial vehicles are known for contributing almost 40% of global CO2 emissions from the road transport sector in 2015, where their life-cycle emissions are estimated to double by 2050 according to the business-as-usual scenario [4]. This makes electrifying commercial vehicles an important area that can contribute heavily in the reduction of greenhouse gas emissions [5], [6]. Accordingly, several governments have set policies and plans to electrify their transportation sectors by 2050 [7]. Recent improvements in lithium battery technology, the potential benefits of electric trucks (ETs) over their life cycle, and government incentives supporting zero-emission vehicles have made commercial electric vehicles (CEVs) technically and economically viable [8]. This has motivated several truck manufacturers to announce promising plans to electrify their production of medium-duty and heavy-duty vehicles [9]. Moreover, many logistics companies, such as DHL, Walmart Inc, Amazon, Anheuser-Busch, and FedEx have started integrating ETs into their fleets [10], [11]. Generally, CEVs are classified according to their gross vehicle weights into light-duty CEVs (< 3.5 tonnes), mediumduty (3.5 to 15 tonnes), and heavy-duty CEVs (> 15 tonnes). These CEVs can be used in a wide variety of applications ranging from long-haul applications, such as regional freight CEVs, to vocational work applications, such as urban freight CEVs [9]. In this paper, we target the types of CEVs utilized in urban vocational work applications, such as urban cargo, freight, and delivery applications. Depending on the applications, the weights and ranges of these CEVs can vary. Many logistic commercial companies such as FedEx, UPS, DHL, JD, and TNT [12] utilize urban CEVs. In these companies, the CEVs operate on daily operational schedules that start from the depot to provide logistic services to a specific number of customers before returning back to the same depot at the end of the operational schedules. For these types of CEVs, there are conditions and constraints that should be considered carefully. These conditions are the time windows at which each customer should be serviced [13], the time required to serve each customer [14], and limited load capacity of CEVs [15]. In addition, the CEVs should not run out of electricity during the journey in order to not disturb their operational schedules.
Due to these conditions and strict operational schedules, most operators of commercial enterprises prefer to charge their CEVs at their facilities applying a ''return-to-base'' strategy, where charging stations are located at facilities, such as depots and industrial micro-grids, enabling the charging of electric trucks between shifts or overnight, as depicted in Fig. 1 [16]. In a return-to-base strategy, CEVs should have heavy battery banks that accommodate changes to operational schedules over time, including multi-shift operations and seasonal deviations [9], [17]. However, this large-size battery bank impacts the payload of CEVs and requires a high-power charging infrastructure to be installed in the facility. With an increase in the number of CEVs adopted in a fleet, the power limits of existing electrical networks can restrict the capacity of charging infrastructure installed in a facility, and require upgrading of these networks [17], [18]. Enabling the CEVs charging at public charging stations during daily driving cycles can help to reduce the capital cost investment of charging infrastructure and electrical networks. In addition, commercial enterprises may leverage the large capacity of CEVs to provide ancillary services for the grid by controlling the charge of CEVs during low demand periods of the grid, and supporting the grid during high demand periods [19]- [22].
To meet growing demand for CEVs, many governments have provided subsidies and incentives for deploying multiple types of charging station networks at public locations and highways [3], [23], [24]. This has motivated a diversified set of private sector stakeholders, such as large charging station operators and vehicle original equipment manufacturers, to invest and set targets to deploy publicly accessible charging stations [3], [25], [26]. Most of these charging stations are expected to incorporate renewable energy sources, which in turns impacts energy prices at these stations during daytime, according to time-of-use (TOU) tariffs. As a result, besides the initial SoC and battery capacity of vehicles, CEV charging at public charging stations depends on the location, capacity, and TOU tariffs of stations along driving routes [27]- [30]. These variants require CEV charging to be optimally scheduled at different charging stations along a route.
As CEV charging at public charging stations occurs during services provided by their logistics companies, the scheduling problem of CEV charging has been addressed in the Electric Vehicle Routing Problem (EVRP), as depicted in Fig. 1. EVRP is an extension of the vehicle routing problem (VRP), aiming to find the most efficient routes for conventional commercial vehicles and maximize benefits for logistics companies. Much research has addressed the VRP with regard to different variants such as capacitated routing [31], [32], time window (TW) constraints [33]- [36], pickup and delivery [37]- [39], multiple depots [40], and the dynamic and stochastic routing [41]. However, since EVRP is comprised of two interdependent problems, which are the service schedule of customers and the charging schedule of CEVs, there are several variants of EVPR that should be addressed.
In the literature, different variants of EVRP have been considered. Authors in [42] have proposed a variant of the EVRP with intermediate nodes for the shuttle fleet. In their model, they considered the entire intersections of the real road networks, the changing in demand, the recharging behavior, vehicle dynamics, and battery. Yang et al. [15] have proposed a variant of the EVRP with pickup and delivery that can be conducted simultaneously. In their study, different constraints were considered such as capacity, time windows constraints, charging time, and battery capacity. Yang et al. [30] investigated the EVRP with pickup and delivery for a single depot with a single CEV. In their model, CEVs can be charged at fast and regular charging stations considering time-of-use tariffs. Authors in [13] introduced EVRP with time windows and charging stations. In their study, a hybrid heuristic of neighborhood search and Tabu search was proposed to address this problem. In [14], a look ahead strategy has been incorporated into ant colony optimization for addressing EVRP with time windows and recharging stations. To include the importance of charging stations locations, Wang et al. [43] have optimized a CEV route with charging detours. In their model, real-time traffic data and energy costs of the regenerative braking were considered in the optimization problem of CEVs moving between a single source and destination. Authors in [44] addressed the capacitated EVRP problem for multi depots with the objective of minimizing the total transportation distance. In their model, the client demand consists of two-dimensional weighted items, such as furniture, home appliances, or breakables.
CEV charging at fast charging stations requires large power demands as compared to passenger light-duty vehicles [9]. This large demand can significantly impact the stability of electric networks [45]- [50]. Therefore, authors in [49], [50] have addressed power imbalance between charging stations by routing CEVs to less congested stations to prevent the network stress. This was made possible by combining pricing mechanisms and allocation of power resources. In [51], an optimization model for the routing problem of CEVs considered with dynamic energy costs and energy consumption model of CEVs over a specific route. In the above study, starts and stops of vehicles were considered in energy consumption model, with CEVs being charged fully or partially at charging stations according to the characteristics of the available infrastructure of charging stations. Hulagu and Celikoglu [52] solved the EVRP problem to find the least energy-consuming routes considering the actual characteristics of battery, including discharging behaviour and braking energy recovery. Simultaneously, they introduced a model to optimally locate the recharging stations considering the limitations on the power of the grid system. Abdulaal et al. [53] have modelled G2V, V2G services, and charging stations demand stochastics in the EVRP optimization model. In their study, fast public charging stations and regular slow charging station at depot were considered in CEV charging, according to routing problem constraints. To approach the optimal solution, a solver incorporating a custom GA with embedded Markov decision and trust region optimization methods was developed. In [12], a bi-level optimization model was proposed to solve the EVRP as two sub-problems, namely CVRP and fixed route vehicle charging problem and the recharging schedules of vehicles. To generate fixed feasible routes from the upper sub problem, the max-min ant system algorithm was proposed.
A new heuristic method was designed to schedule charging of vehicles at charging stations along the fixed routes. The authors in [24] have investigated EVRP when charging stations are equipped with two recharging technologies, battery swapping and fast recharging. In their study, EVs can be partially recharged according to their requirements. To address this optimization model, an improved ant colony algorithm was developed and combined with insertion heuristics and local search strategies.
Although the aforementioned research studies have considered many variants of EVRP, none of these reviewed works have addressed EVRP with considering the impacts of CEVs charging conditions at depots on charging schedules at public charging stations, as depicted in Fig. 1. With an increased number of CEVs charging at depots, the peak demand of charging load impacts electrical infrastructure and charging cost at depots. The impact on the charging cost is a result of the demand charge that is applied, in addition to the energy charge, to commercial and industrial locations [54]. In the literature, the charging of CEVs has been considered individually in EVRP according to energy cost, without considering the impacts of total charging load on demand cost at depots. Additionally, most studies in the literature have relied on insertion methods to include charging stations in CEV routes prior to optimizing the charging process. However, due to government subsidies for building recharging infrastructure, there could be many charging stations with varied characteristics (e.g. power capacity, detour distance, and energy prices) between customers along CEVs routes. Therefore, the optimal scheduling of CEV charging requires optimizing charging processes amongst possible combinations of charging stations according to their characteristics, so that the logistic company benefits are maximized.
This paper incorporates the optimal charging problem (OCP) at both depot and public stations in the EVRP considering time window (TW) constraints. To address the EVRP-TW and OCP, an optimization algorithm is developed to divide the problem into sub-problems and find their optimal solutions. The main contributions of this paper are: 1) This paper jointly investigates the charging problem of CEVs at depot and public charging stations, considering the peak demand cost of charging load and TOU tariffs of stations.
2) The developed optimization algorithm provides a simultaneous solution to routing and optimal charging problems for a set of CEVs operating in the same depot.
3) The proposed solution considers multiple variants of the charging problem in an integrated way. These variants include delays and characteristics of public stations, partial recharging, and multiple visits to stations. The remainder of this paper is organized as follows. In Section II, the formulation of mathematical model is introduced. In Section III, delays at public charging stations are presented. Section IV introduces the developed optimization algorithm. Section V introduces the simulation results with analysis. Section VII presents the summary of this paper.

II. MATHEMATICAL MODEL FORMULATION A. PROBLEM DEFINITION
In this paper, the problem of routing and charging a set of CEVs operating in the same depot is solved simultaneously.
, v N } be the set of customers that need to be serviced. Each vehicle departs the depot (v 0 ) and serves a number of customers before returning to the depot (v N +1 ) by the end of the driving cycle. Each customer needs to be serviced within specific time windows (L i , U i ), where L i is the earliest arrival time and U i is the latest arrival time of customer i ∈ V . Once a customer is visited, a CEV spends time (T Service i ) servicing the customer. During a daily driving cycle, CEVs can be charged at a set of public charging stations S = {s 1 , s 2 , s 3 . . . ., s M } that are available and publicly accessible. Then the set of all nodes is denoted by V = V ∪S and the system set including depot is These charging stations have different characteristics in terms of charging power rates, location and energy cost rates. The energy pricing rates for a 24-h period ahead of time are assumed to be available at each charging station. In addition, as charging stations are available for all CEVs, there may be a waiting time of T wait i at each charging station i ∈ S before the charging service is available. The waiting time can depend also on queue length during the congestion time at charging stations.
Before departing the depot, CEVs are required to be charged with required energy during the dwell time. The simultaneous charging of CEVs increases significantly peak demand of a depot as compared to base-load. This has impacts in increasing peak demand cost, which is much higher than energy cost in commercial enterprises. This problem of CEV charging at depots should be included in the optimization model of the routing problem. Therefore, in addition to optimizing CEV routing through the costumers, the charging schedules of CEVs at public and depot charging stations should be simultaneously optimized. The solution scheme of charging should allow CEVs to provide ancillary services to the grid by charging during low demand periods, whilst maximizing the benefits to the logistic companies.

B. OBJECTIVE FUNCTION
The main objective of the vehicle routing problem is to maximize the benefits of logistic companies by minimizing the travel costs of these vehicles. In the traditional VRP, minimizing total travel cost is related to minimizing the traveled distance. However, travel costs in EVRP are determined by the costs of distance traveled and the charging process of CEVs. Therefore, the objective function of EVRP is formulated as a multi-objective form, where travel distance cost, used vehicles cost, public charging cost, and depot charging cost must be minimized. The objective function of the optimization problem is formulated as follows The different costs of objective function (1) are explained in detail in the following sections The traveled distance cost of CEVs depends mainly on the distance of feasible paths between customers served by the vehicle, and detour distances required to reach charging stations along a traveling path. The total traveled distance cost can be calculated as D i,j denotes the travel distance between customers i, j ∈ V , x ij is a binary variable that indicates the decision of traveling along the path i, j, and ρ dist is the cost per unit of distance.

2) VEHICLES COST (C Vehicle )
The total vehicles cost depends on the number of vehicles used to service all the customer and the cost of running one VOLUME 10, 2022 vehicle (ρ veh ), as shown in (3).
The cost of CEV charging at a public station i ∈ S depends on charging power rate (P i ) and energy pricing rates (ρ P i,t ). Since pricing rate follows TOU tariff, the time at which a CEV starts charging at a station is crucial in calculating public charging cost. Assume that CEV moves from the customer to station i along the route. Thus, the total public charging cost of CEV along a path is calculated as The energy cost of CEV charging at a depot is usually cheaper because of the lower power rates (P depot ) of charging stations and lower energy price rates (ρ D t ). However, CEVs returning to a depot are charged simultaneously in between services, which in turn increases peak demand of the total charging load of CEVs. This increase in peak demand may introduce a new cost for charging CEVs related to the demand charge rate (ρ demand ). Let W = {1, . . . , Z } be the set of CEVs used to serve the customers, where Z can be calculated as follows Therefore, the CEVs charging between arrival time (t arr n ) to a depot and departure time (t dep n ) from a depot (∀n ∈ W ) should be optimized simultaneously to ensure minimum charging costs in terms of energy costs and demand costs. As the dwell period of CEVs at the depots is considerably long, the charging requirement of each CEV can be coordinated by optimizing P depot over the dwell time. Thus, depot charging costs of CEVs can be formulated as In (8), (P max total −P max base ) indicates increase in the peak demand as a result of optimized total charging load of CEVs, where P max total represents the maximum power demand of the aggregate load profile in the depot, consisting of the base-load profile of the depot and total charging load profile of CEVs, whilst P max base is the maximum power demand of the base-load profile of the depot.

C. OPTIMIZATION VARIABLES 1) DECISION VARIABLES
The main objectives of EVRP are to select the best routes and charging schedules for CEVs in order to maximize benefits for logistic companies. Therefore, different decision variables need to be optimized, which increases substantially the complexity of the problem. For route optimization, the binary variable x ij has been selected to determine whether a CEV is moving between the two vertices. This decision variable is defined as follows To optimize the public charging of CEVs, T Char i has been optimized at all stations along its route. Whilst in depot charging, the P depot of CEV is optimized over the charging interval at the depot. These variables are defined as follows: where T min i and T max i are the minimum and maximum limits of charging time at the station respectively. P max is the power capacity of depot station.

2) OPTIMIZATION CONSTRAINTS
The objective function in (1) is subject to the following constraints.
j∈V ,i =j T Arrival Constraints (12) and (13) ensure that each customer is assigned exactly once, and that outgoing arcs are similar to incoming arcs at each vertex. Constraints (14) and (15) define the load capacity of all customers. The time allowance of each customer is ensured by Constraints (16), (17), and (18). Constraints (19) and (20) define the remaining energy at arrival at each node. Constraint (21) ensures the battery capacity of CEV in each station. Constraints (22)-(24) apply for the charging process in the depot. The required energy that should be charged before departure from the depot is met by Constraints (22) and (23). Constraint (24) defines the minimum energy required to be charged for each CEV.

III. DELAY AT PUBLIC CHARGING STATIONS
The increased number of CEVs and longer charging time of these vehicles may result in station congestion and; thus, a CEV needs to wait in a queue before the charging service starts. The waiting time in the queue depends on the number of vehicles in the queue, the charging rate of the station, and the number of servers in the stations. Waiting times at charging stations can cause significant delays in the charging process of CEVs; thus, they should be considered in the charging optimization model of these vehicles.
To estimate the waiting time at each charging station, the M/M/k/R model [55], [56] of the queuing system is used, where the first and second M denotes the Markovian property of arrival and service time distributions respectively, k is the number of servers, and R is the number of vehicles that can be parked at a station. Based on Markovian property, the service rates of servers can be represented exponentially with mean service rates (µ) and constrained by charging rates. Further, arrival rates follow a Poisson distribution with mean arrival rates (λ) and can be extracted from historical data.
The transition of states of M/M/k/R is a stochastic process that can be derived by Markov chains [57], as depicted in Fig. 2, where each state represents the number of vehicles in the queue. The transition between stages occurs when a CEV arrives at station or a CEV finishes the charging service. This stochastic process of the state transition is represented by the state transition probability matrix P [56]. Based on matrix P, the row vector can be determined as P T . π T =0 T , where π = [π r , r = 0, 1, 2, . . . , R] represents the probability that r vehicles are in the station. Since the number of CEVs at any moment can be the greater or smaller than the number of servers, the rth π can be obtained as where ρ r = λ r µ r . As R r=0 π r = 1, π 0 can be obtained as follows Knowing the formula of π, the mean length and waiting of queue at each charging station can be obtained, as in (22) and (23) respectively

IV. DEVELOPED OPTIMIZATION ALGORITHM
To solve the vehicle routing problem with time windows and optimal charging problem of CEVs, both the customer order and charging schedule need to be addressed simultaneously.
In addition, the optimal charging problem of CEVs requires the simultaneous consideration of different aspects of CEV charging, such as charging stations alternatives along a route, TOU tariffs of charging stations, and charging costs at depot including demand cost. Evidently, this increases significantly the non-linearity of the problem; whereby individual-based meta-heuristic algorithms, such as GA, Tabu search, and ACO, may require substantial computational time and not provide efficient solutions because of local optima solutions [12], [30]. Therefore, this paper develops an optimization algorithm that breaks the EVRP-TW and OCP problem into sub-problems, where the optimal solution is obtained by optimally solving all the sub-problems in a hierarchical approach. The developed optimization algorithm (DOA) uses ACO and GWO algorithms in addition to the Cplex solver for addressing the problem. The flowchart of DOA is presented in Fig. 3 and is described in the following sections.

A. FEASIBLE ROUTES GENERATION
The feasible routes are generated by using the ACO algorithm which has been used to solve EVRPTW in many works, including [12], [24]. In each iteration of the developed algorithm, the ACO generates a population of ants A = {1, 2, 3, ., A} that represents feasible solutions to serve all customers according to their loading and time window constraints. Each ant in the population may contain a single route or multiple routes to serve all customers. Let a = {ψ 1 , ψ 2 , ., ψ Z a } denotes the set of routes contained in ant a ∈ A, where Z a is the number of routes. Each route in a is assigned with one CEV, so the set of vehicles for ant a is W a = {1, 2, ., Z a }. Since the main objective routing problem is to reduce the travel cost, the ant a with the lowest distance is selected and the charging costs of its Z a vehicles are determined, as shown in the following stages of Fig. 3.

B. CHARGING STATION ASSIGNMENT
The optimal charging scheduling of CEV requires considering the different charging stations along its feasible route. Thus, more than one station may be assigned as a candidate station along the path between any two vertices. This assignment of stations to the feasible route is essentially based on proximity to both vertices of the route. In the developed algorithm, factor γ is used to identify the candidate stations along each path of the feasible route. This factor defines the increase in the distance of the path as a result of visiting a specific station, as shown in Fig. 4. The assignment factor γ is selected depending on the detour distance cost, and constrained by the time windows of each customer. Another criterion of selection for this factor is computational time for I ∈ do 5: Reduce the search space of each wolf based on vehicle characteristics 6: Initialize solutions for population size in the reduced research space 7: Calculate the fitness values for all wolfs and assign α, β,δ solutions 8: if fitness of wolfs are assigned high values then 9: Return high values for charging cost and zeros for charging times 10: end if 11: while Iteration number not met do 12: Update the current position of each wolf 13: Update search space of each wolf and ensure the limits of updated positions 14: Calculate the fitness values for all wolfs 15: Update the α, β,δ solutions 16: end while 17: end for 18: end for 19: return The I ∈ that achieves the best charging cost and charging times for each point of E Dep n , n ∈ W a cost, where large γ may increase the search space of public charging optimization problem. When stations are assigned to the feasible route, the possible combinations of stations for charging along the route are defined as depicted in Fig. 4 provided that one station is visited between any two vertices. Let = {I 1 , I 2 , .} be the set of possible combinations of stations available for CEV n ∈ W a

C. DEPARTURE ENERGY DEFINITION
Most works in EVRP assume that CEVs depart the depot fully charged, taking advantage of the minimum energy cost. However, when charging CEVs increases the peak power demand of a depot more than the base-load, the demand cost in industrial enterprises can increase the total charging cost significantly. Therefore, optimal charging may require the departure of CEVs not fully charged, provided the ability to charge CEVs with required energy along their routes.
CEVs' energy E Dep at departure from the depot is constrained by battery capacity E Cap and the minimum energy required E near for a CEV to reach the nearest charging station along the route. Therefore, E Dep should be optimized between these limits to ensure optimal charging schedules. In order to reduce the search space of the developed algorithm, we define E

D. PUBLIC CHARGING OPTIMIZATION
The charging schedule of each CEV n ∈ W a at the assigned stations is optimized by the public optimizer. The public optimizer depends mainly on the GWO algorithm, which has been successfully applied to schedule charging of EVs with a strong global search ability [58]. In the public optimizer, the populations of the GWO algorithm are expanded to include E Dep n of each CEV. The process of public charging optimizer is explained in Algorithm 1. The public optimizer is initiated by defining the set of possible combinations of stations , and used vehicles W a . Then, the optimizer applies the GWO to each I ∈ of each n ∈ W a . The process public optimizer is finalized by returning the minimum fitness between all combinations.
To reduce computational load and the population size of GWO, the search space of charging time at each charging station is reduced and updated continuously during each iteration of GWO. To reduce the search space, the available time for charging a CEV at each station is defined in the interval [T min n,s , T max n,s ]. The limits of this interval depend on the logistic constraints of the route without considering the visiting of stations. Let ψ 1 and I 1 be the route and possible combination of stations under consideration, respectively. T max n,s of station s ∈ I 1 is the minimum difference between the arrival time and upper limit of time windows (L i − T Arrival i ) of all nodes i ∈ ψ 1 provided that i is located after the station s along ψ 1 . T min n,s depends on the energy required for CEV n ∈ W a to reach the nearest station from station s. At each iteration of GWO, when CEV charging is scheduling across the station s ∈ I 1 , search space limits are updated at each station. T max n,s is updated by including the time required to charge the CEV fully and the elapsed time at previous stations for charging CEV. T min n,s is updated by the CEV 's energy when it arrives at the station. To guarantee fast convergence, the initial and updated values for all the variables of GWO are ensured to be within the updated search space.

E. DEPOT CHARGING OPTIMIZATION
Once the scheduled stations are defined, the depot charging problem of CEVs, denoted by (6)-(8), is solved by using a Cplex optimizer. The Cplex is a commercial solver that uses the simplex algorithm to find the global optimal solution to linear optimization problems [59]. To solve the depot charging problem by Cplex solver, the dwell time of CEVs at depots is divided into small time slots of length t. Let T = {1, 2, 3, . . . .} denotes the set of time slots during dwell  [13], [24], [51].
time. Then, the depot charging problem can be rewritten as where AI n,t is the availability index of vehicle n at time slot t, which is defined by the arrival and departure time of the vehicle. P Base t is the base-load power of the depot at time slot t. The solving of depot charging problem is repeated for all points in E Dep of each CEV in the depot.

F. OPTIMAL ROUTE OPTIMIZATION
The fitness values obtained from public and depot charging optimizations are added for each point in E Dep and the lowest value is selected as the total charging cost. When CEVs charging on public or depot stations can not be scheduled due to constraints breaches, the total charging cost is assigned with very high value, and the route is found to be infeasible. In this case, the above steps are repeated for the second smaller ant in the initial population of ACO, where this process continues until a valid value of total charging cost is found. The valid value of total charging cost is added to the distance cost of the feasible route and the cost of used vehicles as in (1). New populations of ants are then generated after updating the local and global pheromone of ACO by the best-fit ant in the initial population. After several iterations of ACO, the optimal solution is the route that has the lowest fitness value.

V. RESULTS AND PERFORMANCE ANALYSES
In this section, simulations of different case studies are performed to evaluate the performance of the developed optimization algorithm for solving the EVRP-TW and OCP problem. The simulation was carried out using Python 3.7 on a desktop computer with Intel Core i7-8700 CPU @3.19 GHz. The total simulation time for scheduling was set to 24 hours.
In each case study, the depot serves a different number of customers. In Case 1, five customers are serviced and two charging stations are available publicly. Case 2 considers ten customers and three public charging stations. Case 3 considers 15 customers and four public charging stations. In Case 4, a large system of 21 customers and five public charging stations are considered.
The parameters (i.e. customers and stations locations, time windows, service time, loading capacity, . . . etc.) of case studies are extracted from the benchmark instances applied in works [13], [24], [51] as can be shown in Tables 1 -4. In these tables, the Node distribution and delivery loads for customers are similar to benchmark instances. The time windows and service time of customers have been modified so that a long scheduling horizon is provided for each case study, and thus a lower number of CEVs are required to serve all customers in the case study. This modification helps to study the impacts of the increased number of customers and CEVs on the charging cost and; thus, the routing problem of these vehicles.  [13], [24], [51].  [53], [60].
The CEVs used in the depot all had a similar battery capacity of 150 kW, a vehicle load capacity of 200 kg, a fuel consumption rate of 0.9 kW/km, and an average velocity of 60 km/h.
In this paper, five types of public charging stations have been considered with different characteristics, as shown in Table 5. The variety of public charging stations has been anticipated in accordance with the government subsidies that provide a chance for different stockholders to deploy public charging infrastructure with different characteristics. The TOU energy pricing tariffs at each charging station have been designed as shown in Fig. 5, depending on the charging rate and integrated renewable energy sources [53], [60].
The charging rate of depot station is 19.2 kW, which enables the full charging of CEVs during the average dwell time at the depot, ranging between 6-8 hours during different periods of the day, according to [61]. The TOU energy tariffs of charging at the depot are designed, as shown in Fig. 5, to follow industrial electricity tariffs [60], [62]. In addition, industrial electricity tariffs consist of a demand cost of $8/KW. We choose the average load profile of the LGS sector in the service area of South California Edison as the base-load profile of a commercial facility [63]. The arrival times of CEVs at their depot from the previous shift have been approximately uniformly distributed between 17:00 and 18:00 [64]. Similarly, the initial SoC at arrival at depots has been generated uniformly between 0.2 and 0.3.

A. SIMULATION RESULTS
The simulation results of the case studies are shown in Table 6. From these results, we can note the following observations: • In Cases 1 and 2, the total charging cost is dominated by public charging cost; thus, the optimization algorithm enables full charging at the depot and coordinates the charging schedules of CEVs at charging stations so that the minimum travel cost is achieved. In these cases, the number of used vehicles depends on logistic constraints and the charging schedules at public charging stations.
• In Cases 3 and 4, the total charging cost is dominated by depot charging costs due to demand cost. In these cases, the amount of CEVs charging at the depot is optimized in addition to charging schedules at public stations so that minimum charging cost is achieved. Further, the number of vehicles used is optimized to ensure that the minimum charging cost at the depot is obtained with consideration to logistic constraints and public charging of CEVs. The optimality of the simulation results depends on the optimal solutions of the sub-problems of EVRP-TW and OPC. The optimal solution of the CEVs charging problem requires the charging of all vehicles with the required energy to achieve their tasks, while ensuring minimum charging costs. To investigate the charging profile of CEVs, we have considered the simulation results of Case 1 in detail, as shown in Table 7. In Case 1, two candidate stations s 1 and s 2 with a capacity of 40 kW and 25 kW respectively, are available for public charging during (9:00-17:00). As can be observed from Table 7, station s 1 is assigned to two paths between (v 0 , v 1 ) and (v 1 , v 2 ),whilst s 2 is assigned between (v 3 , v 4 ) and  (v 4 , v 5 ) along the optimal route. Once the charging stations are assigned, the charging schedule of CEV is decided depending on the required energy to serve all customers and return back to the depot v 6 . The optimal solution for the CEV charging in Case 1 involves visiting station s 2 once along the path between (v 4 , v 5 ) due to its low TOU tariffs and the small detour distance. It should also be noted that the SoC at each node along the optimal route of CEV ensures the continuity of CEV until reaching the depot. In this simulation, the SOC at depot arrival is set to be more than 0.15. Fig. 6 shows the charging time at public and depot stations. As can be observed, the CEV charging at the depot overnight between (18:00-8:00) is optimized to minimize demand and energy costs. Therefore, the optimal solution for CEVs charging involves the charging of CEV at low price periods whilst maintaining the increase in peak demand due to charging as low as possible. This is evident in Fig. 7, which shows the aggregate load profile of the depot for Case 1. Since one CEV is used in Case 1, the charging load can be distributed according to TOU tariffs without increasing the peak demand of the aggregate load profile, and thus no demand cost due to charging. With increasing charging load requirements of CEVs, as in Case 3, the optimal solution involves peak demand reduction more than load shifting as illustrated in the aggregate load profile of the depot within Case 3 in Fig. 8. In this figure, the charging load is distributed over the dwell time of CEVs to minimize the increase in peak demand of aggregate load profile; thus, reducing peak demand cost, which is much higher than TOU tariffs.

B. PERFORMANCE OF DEVELOPED OPTIMIZATION ALGORITHM 1) OPTIMAL SOLUTIONS COMPARISON
To the best of the authors knowledge, no other EVRP model in the literature has considered simultaneously these many variants of charging scheduling problems for CEVs operating in the same depot. These variants are alternatives of public VOLUME 10, 2022   charging stations, TOU tariffs of depots and public charging stations, and demand costs at depot stations. Therefore, direct comparison with proposed models in the literature is not possible. In order to compare the optimal solution of the developed algorithm, all the cases have been solved by ACO, considering different variants verified by works including [12], [24], [53]. These variants are full charging of CEVs in a depot, according to TOU tariffs, and assigning one station to each path of the route. The simulation results are listed in Table 8.
In Case 1, the performance of the developed algorithm is very similar to general ACO. In other cases, general ACO has better results in terms of computational time and number of vehicles used, but the developed algorithm can reduce the total cost substantially. This reduction reaches 36% in Case 4. Therefore, the overall results in Table 8 show that the developed algorithm performs better than the global ACO for large customers. Additionally, these results indicate the importance of including the demand cost in the EVRP model of CEVs operating at the same depot.

2) COMPUTATIONAL TIME
In EVRP-TW and OCP problem, the optimal charging problem is involved, impacting the computational time exponentially. In addition, breaking the main problem into sub-problems requires a combination of meta-heuristic algorithms to address each component, which can lead to time complexity. Therefore, many steps have been considered to reduce the computational time of the proposed solution as follows: • In the depot, the charging problem is formulated as a linear optimization problem so that commercial solvers, which use exact algorithms, can be applied to solve the problem.
• To reduce the computational time of the public charging solver, which includes GWO, the search space has been reduced substantially which helps in increasing the speed of convergence of the public charging solver.
• The ACO generates feasible routes depending on logistic constraints which are fixed. Therefore, eliminating repeated routes would reduce the computational time of the whole solver. A comparison of the computational time of the developed algorithm and the existing algorithm simulated in section V-B1 under different sizes of the problem is shown in Fig. 9. It can be observed here that the developed algorithm demonstrates a close performance to the existing algorithm under Cases 1 and 2, whilst the existing algorithm has better performance in terms of computational time under a large number of CEVs and charging stations as in Cases 3 and 4. The increase in computational time of the developed algorithm is due to the increase in search space, as compared to the existing algorithm, of the solution to include more combinations of charging stations as illustrated in section IV-B. The developed algorithm also optimizes the CEVs charging at the depot to achieve the least increase in demand charge, which is not covered in the existing algorithm. However, the developed algorithm demonstrates  good performance in terms of computational time with a large reduction in the total cost of operating CEVs by 36% compared to the existing algorithm as evident in Case 4 in Table 8.

C. IMPACT OF TIME WINDOWS AND ASSIGNMENT FACTOR
In the above noted results, the time windows of customers were relaxed to focus on the importance of depot charging optimization in EVRP. However, the performance of the developed algorithm under tight time windows also requires analysis. Moreover, as the assignment factor defines the stations that can be assigned to each path, its impacts under tight time windows should be investigated. Case 3 has been chosen to investigate the impact of reducing the time window by 1 h and 2 h under three values of the assignment factor. The results are summarized in Table 9. It can be seen that as the time windows decrease for a given γ , the time available for charging CEVs along some paths decreases which in turn results in increasing trip costs due to the consideration of longer routes, increasing depot charging, and increasing the number of used vehicles. Contrastingly, increasing the assignment factor decreases trip costs significantly, with tight time windows of customers. Increasing the γ assigns more stations to different paths and; thus, provides more routes to be optimized. When large time windows are allowed, the impact of increasing the assignment factor is small due to the high cost of detour distance.

VI. CONCLUSION
In this paper, the optimal charging problem of CEVs at their depot and public charging stations is investigated. The proposed optimal charging problem of CEVs includes various variants such as peak demand minimization of depot charging loads, time of use tariffs, partial recharging, multiple visits to stations, and different waiting times and characteristics of public stations. An optimization solution was developed to break the problem into a number of sub-problems, which were solved optimally using a hierarchical approach. The developed solution used ACO to generate feasible routes to serve all customers depending on the constraints of the logistic company. The charging of commercial EVs along these feasible routes was scheduled by the GWO algorithm, while the optimal charging problem of the depot was solved by a Cplex solver with the objective of maximizing the benefits of the logistic company.
The effectiveness of the developed algorithm was confirmed through simulation case studies. The simulation results showed the impacts of CEVs charging at the depot on the charging schedules at public charging stations. In addition, the results indicated that the proposed solution outperforms existing solutions in terms of reducing the total travel cost of CEVs, by up to 36 %. In future work, more analyses are required in order to maintain fast optimizing speed within large-scale systems. Moreover, more variants of charging problems should be investigated, such as V2G services at depots and public stations.