Real-Time Implementation of Green Light Optimal Speed Advisory for Electric Vehicles

: Intelligent Transportation Systems (ITS), such as Green Light Optimal Speed Advisory (GLOSA) systems, can be used to reduce the energy consumption in modern vehicles. In particular, GLOSA systems provide driving strategies that can decrease both energy consumption and travel time. In this paper, we present a new method to calculate the optimal driving speeds based on trafﬁc light data. To this end, a detailed formulation for the optimization problem is presented for a multi-segment route, based on an electric vehicle (EV) and trafﬁc light models in an urban environment. Since this formulation results in a nonconvex optimization problem, a relaxation procedure is applied with a low calculation time. By using this procedure, a dynamic real-time speed advisory algorithm is developed. Numerical simulations showed improved performance over benchmark techniques. In particular, the proposed Dynamic-GLOSA solution’s performance was shown to be very close to that with a brute-force optimal solution but with a much shorter calculation time and has signiﬁcant potential for energy saving.


Problem Formulation
In this section, the energy consumption and the travel time models are developed based on those of Schaltz [30] and Kaloko et al. [31]. First, we present the force and powertrain models that are the basis for the energy consumption model. Then, a traffic light model and a standard speed profile are used to define the energy consumption and the travel time models as a function of the driving speed. It should be noted that this general formulation calculates the energy consumption based on generic models. Since the amount of energy needed for travelling is the same for all types of vehicles, this model can be adopted for gas-fueled, electrical, or hybrid vehicles; with various sets of parameters, such as mass, transmission ratios, and motor efficiency; and with minor differences at the power source model.

Force Model
We consider a force model consisting of the gravitational force, aerodynamic drag, rolling resistance, and inertial force, as shown in Figure 1. In particular, the gravitational force is given by where α is the road slope, g is the gravity of earth, and m is the vehicle mass. The aerodynamic drag force is given by where ρ is the air density, A is the vehicle frontal area, C d is the vehicle form coefficient, and v is the velocity. The rolling resistance force is given by where µ rr is the static resistance coefficient and C rr is the dynamic resistance coefficient. The inertial force is given by where a is the acceleration, I is the shaft moment of inertia, G is the gear ratio, and R wheel is the wheels radius. In general, G is a function of the driving speed. In the case of an EV, the gear ratio should be replaced with a constant. The sum of the forces equals the traction effort extracted by the motor, F traction , and satisfies F traction = F total = F g + F ad + F rr + F I .

Powertrain Model
The powertrain supplies the power from the battery to the wheels, which provides the required traction force according to Equation (6). The powertrain considers the gear box, the shaft, the three-phase AC motor, the inverter, and the regenerative braking mechanism. Nonlinear motor efficiency, η motor , and gear-box discontinuity should be taken into account in order to calculate the power extracted from the battery. A standard motor efficiency map and a four gears transmission system were implemented based on [32]. According to those models, both gear ratio selection and motor efficiency are functions of velocity. The motor torque, T motor , and the motor angular velocity, ω motor , are given by T motor = T traction Gη gear = F total R wheel Gη gear (7) and respectively, where η gear is the gear efficiency. The power consumed from the battery, P batt , is therefore known and can be expressed by where η inv is the inverter efficiency. The inverter and gear efficiencies are assumed to be constant. By substituting Equations (7) and (8) into Equation (9), one obtains In cases of negative F total , generally when decelerating, energy can be used for recharging the battery. This regenerative braking mechanism [33] changes η motor to 1 η generator in the powertrain model from Equation (10). The generator effectiveness, η generator , is relatively low due to the additional mechanical braking and is assumed to be constant [33].

Travel Time and Energy Consumption Models
In this subsection, the travel time and energy consumption models are defined in terms of vehicle velocity and the traffic light model. These models describe a multi-segment and single vehicle problem. In urban environments, energy consumption is subject to traffic light status. When arriving at a red light, the driver is forced to stop, and this significantly increases energy consumption and travel time. In this paper, these stops are considered as time and energy penalties. The traffic signal status at each intersection is assumed to be periodic, with a specified time offset, green time, and cycle duration at each intersection. The typical traffic signal status is presented in Figure 2, where T is the period time, the green light timing is within the first T green seconds, the phase offset from time zero is θ, and k is the number of complete cycles that have passed from an arbitrary initial time until the vehicle arrives at intersection i, which can be referred to as the green window number. According to this traffic light model, the ith intersection is at the end of segment i and the intersection arriving time, t i , when the traffic light is green, satisfying The number of the green cycle that the car uses at intersection i, k i , is given by where div is an integer division. For the sake of simplicity, a standard driving profile [2,34] is used in this paper. According to the driving profile, the route is divided into several segments, where each segment ends with a traffic light and has a target speed. Then, each segment is divided into two intervals: transition and steady-state intervals. During the transition interval, the vehicle accelerates to the target speed of the segment. Since optimal speed planning will often result in not stopping at red lights, the acceleration is assumed to be relativity small and the duration of the acceleration phase is the same for each segment and defined by ∆t. This assumption simplifies the driving model but neglects constraints for the maximum power, as well as jerk constraint for driving comfort. The value of ∆t parameter can vary for different vehicles and is dependent on the vehicle's acceleration performance and the maximum speed limit. Then, as part of the steady-state interval, the vehicle travels at a constant speed for the remainder of the segment. Thus, the acceleration at time t is given by The distance covered in the transition interval is The travel time of each segment, consisting of the transition and steady-state times, is given by By substituting Equation (14) into Equation (15), we obtain In the case where the vehicle has not stopped at a red light, the arrival time at the ith intersection is obtained by summing the travel time of each segment, as presented in Equation (16): where V = [v 0 , v 1 , ..., v N ] is the velocity vector for the N-segment route and t 0 is the initial time. An example of a traffic light status map for a two-segment route is presented in Figure 3 with the parameters in Table 3, for t 0 = 0 and v 0 = 0. The green windows (when the vehicle arrives at both intersections at a green light) demonstrate the problem's complexity. Figure 3 shows that the traffic light condition from Equation (11) is neither a convex nor a continuous set. It can be seen that the vehicle will encounter green lights at the intersection at the end of the first segment if it drives, for example, at v 1 = 45 km/h or v 1 = 20 km/h. If it drives with v 1 = 45 km/h, to encounter green lights at the second intersection, it could drive at, for example, at 45 or 25 km/h.
where the deceleration time before the red light is considered as part of the waiting time and the stopping condition for each intersection, I i , is based on Equation (11) and is given by The total travel time, T total , is obtained by summing up the travel time from Equation (16) and the time stopping penalty from Equation (18) in each segment from the segments set, S = {1, ..., N}, in an N-segment route: By substituting Equations (16) and (18) into Equation (20), one obtains The energy consumption calculations consider both the auxiliary loads energy and the energy that is used for driving. Auxiliary loads power, P AUX , which includes radio, air conditioning, lights, and electrical control units, is assumed to be constant [30]. Therefore, the auxiliary loads energy is related to the total travel time and is given by The driving energy consumption is calculated by a numerical integration of power over time. According to the presented profile, each segment is divided into intervals, in which the battery power from Equation (10) is assumed to be constant. Therefore, the energy consumed in the transition interval is where α i is the segment slope that is assumed to be constant for each segment. Although the velocity during the transition interval is not constant, an average value of v i +v i−1 2 is considered in the power calculation from Equation (10). This approximation is relatively minor since v i−1 and v i are close to GLOSA systems, as the vehicle does not stop at red lights. The full equation is presented in Equation (28). In the remaining distance, L i − ∆L i , the vehicle maintains a constant speed until the next traffic light. Thus, the energy consumed in this steady-state interval is given by In cases when the vehicle stops, the total energy includes a stop penalty term that consists of two contributions: the vehicle stop and the re-acceleration that replaces the transition interval in Equation (23). Therefore, the energy consumption penalty satisfies The total energy consumption, E total , is obtained by summing the intervals energies in Equations (23)- (25), which results in Therefore, the total energy consumed from the battery is given by summing Equations (22) and (26), yielding By substituting Equations (22)-(26) into Equation (27), one obtains

Optimization Problem Formulation
Traffic light timing data enable an optimal speed planning that minimizes energy consumption and travel time. With this goal in mind, an appropriate objective function should be defined and optimization tools should be used to find the associated global optimum. In this paper, we consider a multiobjective function [17] that consists of total travel time from Equation (21) and energy consumption from Equation (28). In particular, the objective function is defined as: where λ is a tuning parameter that controls the trade-off between energy consumption and travel time costs, and C [Watt] is set as the time coefficient in order to quantify the time relative to the energy. Assuming that the vehicle turns the engine off while standstill (which is very common in EVs), C will be equal to Paux. The objective function is in terms of energy, but considers an adjustable trade-off between the energy and time. By substituting Equation (27) into Equation (29) and setting C = P AUX for simplification, the following GLOSA system objective function is obtained: It can be seen in Equation (30) that the objective function increases when the energy or the travel time increases. The advisory speed vector, V, must be between the minimum and maximum speed limits, V min and V max , respectively. Therefore, the GLOSA system's optimization problem can be formulated as: minimize Traffic light discontinuity, which is presented in Equation (11), results in a discontinuous stop penalty. Thus, the objective function turns out to be a nonconvex discontinuous function. The function complexity makes it impractical to solve with standard optimization toolboxes and in a reasonable computation time [17].
An example of the proposed objective function for a two-segment route is presented in Figure 4 for λ = 0.4, P AUX = 200 [watt], and the parameters of the traffic light status map as presented in Figure 3. The green windows from this map are reflected directly in the objective function shadows, demonstrating the direct relation between them. The stopping penalties can be viewed as the major jumps in the objective function. The objective function shows that slow driving is reflected as an increase in F values as travel time increases. Fast driving is also not optimal due to high energy consumption.

Dynamic-GLOSA
The optimization problem from Equation (31) is a nonconvex optimization problem that is intractable in real time scenarios. This section presents a real-time algorithm based on a relaxation procedure for solving the GLOSA optimization problem and offers improved optimization results and reduced calculation time. The algorithm, referred to as Dynamic-GLOSA, and the proposed method assume that avoiding stops is preferable to stopping at red lights. This assumption has been proven using a brute force search that seeks the true optimal driving profile. However, an edge case in which this assumption is invalid may occur. Based on that, a solution in three main steps is suggested.
According to the first step of the proposed algorithm, the traffic light status can be expressed indirectly and the objective function from Equation (30) is calculated without taking the traffic light stop penalties into consideration. Therefore, the relaxed objective function is given by substituting Equations (21) and (26) into Equation (30) and substituting I i = 0 for each intersection: It can be seen that the relaxed objective function from Equation (32), as presented in Figure 5, does not contain the major discontinuities caused by the traffic lights as in the original objective function from Equation (30), as presented in Figure 4. This modified model is still non-convex due to factors such as gear switching and motor efficiency. However, as the Results Section demonstrates, this relaxation can be assumed not to affect the approximation of the global optimum that was calculated using a brute force search. Furthermore, the relaxation procedure enables the solution for this step to be found in real-time by using standard optimization toolboxes, which should make the implementation of this method easier [35]. This partial solution describes the optimal driving speeds of the relaxed problem, V relaxed , and is not really the optimal solution because it does not comply with the traffic light constraints in the real world (which are taken into account in the next steps). The second step of the proposed method considers the traffic light status and selects the green window for passing through each intersection. The green window is described by K = [k 1 , k 2 , ...], and should be determined according to Equation (12). The objective function from Equation (30) indicates that the green window, K, should be as close as possible to the relaxed optimal speed in each segment. In the case where the vehicle will arrive at the intersection when there is a green light, the velocity will be the advisory speed. In the case of arriving when there is a red light, two k i values are tested: before and after the relaxed optimal speed for the segment. These window values are given by and k i,a f ter = k i,be f ore In general, more k i values will improve the results but will increase the calculation time significantly. In this paper, the choice of two values for k i is proved to show satisfactory optimization results. Each of these windows reflects a different driving speed in order to arrive in the middle of the green phase: and According to the second step, the green widow selection is done from the first segment to the last. First, the objective function value is calculated for two of the close green windows by setting v i = v i,be f ore and v i = v i,a f ter . Second, the segment green window with the lowest objective function value is selected for the specific segment. Then, this step is repeated for each segment until K is determined. The search complexity is linear (2N), and as such it enables a short calculation time for multi-segment cases.
In the third and last step, after the green windows have been determined, each segment passing time is within a specific cycle: k i T i + θ i ≤ t i ≤ k i T i + θ i + T green,i , ∀i. Calculating the optimal speeds within this window can be done by using standard optimization tools, due to the significant reduction in problem complexity. Finally, the proposed GLOSA-dynamic algorithm is summarized in Algorithm 1 and visualized in Figure 6. Algorithm 1 Dynamic-GLOSA algorithm.
1: Initialize the problem parameters, road information, and vehicle parameters. 2: Step 1: Minimize F(V) for ∆T sp,i , ∆E sp,i = 0 to get V relaxed . 3: Step 2: Dynamic search for the best green window, K, between the near two green windows: 4: Set V = V relaxed . 5: for i ∈ S: do 6: Calculate v i,be f ore and v i,a f ter . 7: Calculate F(V) for v i = v i,be f ore and v i = v i,a f ter . 8: Determine k i which minimizes F(V) where 9: k i ∈ [k i,be f ore , k i,a f ter ]. 10: end for 11: Step 3: Minimize F(V) within the selected green window.

Simulation Results
In this section, the performance of the proposed Dynamic-GLOSA algorithm is evaluated for different methods and driving patterns.

Methods and Parameters
The Dynamic-GLOSA solution was compared with the optimal solution and with the performance of the following methods: 1.
BF-GLOSA: A brute force (BF) search is implemented to calculate the optimal solution of the optimization problem in Equation (31). The BF is time consuming and has computational complexity that grows exponentially with the number of segments. Thus, this search is impractical and is possible only in scenarios with a low number of road segments.

2.
GA-GLOSA [13]: This Genetic Algorithm (GA) statistically generates solutions, compares their scores, and selects the best solution [36]. This process is repeated several times to increase the natural selection. The parameters of the GA, including the genetic natural selection, score function, and mutations, are implemented according to the values in [13].

3.
MAX-GLOSA [7]: This method advises the fastest velocity in each segment for passing the traffic lights when they are green. Thus, it can be interpreted as the substitution of λ = 0 in the objective function from Equation (30) for a single segment route.

4.
Naive driver: The naive driver is an unassisted driver who travels at a constant velocity. In the following, the naive driver velocity is set at 34 km/h according to the average driving speed in the New European Driving Cycle (NEDC) profile [37] and the driver stops at the intersection when the light is red. The naive driver uses a naive strategy that is likely to be worse than that of real and intelligent drivers. The naive driver is used as a benchmark in order to evaluate the energy and time saving potential by using GLOSA.
The vehicle model parameters presented in Table 1 were based on [30,31]. These parameters reflect a small EV model adjusted for urban conditions. The route parameters were based on the NEDC model [37], which is characterized by short segments and includes 13 stops. To generate generic simulations, the route parameters were drawn according to a uniform random distribution, U[a, b], where the specific ranges for each parameter were set according to Table 2. The transition time, the initial time, and the initial speed were set to be ∆t = 3 s, t 0 = 0, and v 0 = 0, respectively. The constant auxiliary power consumption was assumed to be P AUX = 200 [watt].
In this research, MATLAB R FMI NCON was used to minimize the objective function. The simulations were performed on a standard LG R P510 laptop, with Intel(R) Core(TM) 2 Duo CPU, T9550 2.66 Ghz.

Typical Solution
This subsection presents a typical speed profile for a four-segment route, based on the driving profile from the previous subsections. The smoothness of the generated speed trajectory can be seen in the given example. Each segment was divided into three intervals: transition, steady-state, and stopping intervals. The travel times which each interval takes are given by ∆t, Equations (16), and (18), respectively. The energy consumption in each of these intervals is calculated by Equations (23)-(25), respectively. The vehicle parameters used for this simulation are in accordance with Table 1, and the arbitrary route parameters are presented in Table 3 and can be seen in Figure 7. It should be noted that the intersection can be defined by different parameters sets, which can imply different sizes of intersections or approaches from a side road to a main road. Therefore, the parameters for each intersection were drawn randomly to ensure generic simulations for comparison. The initial time and the initial speed can be set to any values, but, to simplify the calculation, they were set to t 0 = 0 and v 0 = 0, respectively. The velocities vector was set to V = [0, 35, 40, 30, 35 km/h], and the transition time was set at ∆t = 3. The driving profile example is given in detail in Table 4, where the division of the intervals is presented.  According to the given velocities vector for the given example, the vehicle will stop at the first and second intersections. Figures 7 and 8 show that these stops are described by traffic light stop and idling intervals. For the presented route and velocities vector, the total energy consumption is E total = 7.1175e + 06 Joules and the total travel time is T total = 163.62 s.

Energy and Time Trade-Off
The objective function from Equation (30) is a function of the parameter λ that represents the trade-off between energy consumption and travel time. The forces equation from Equation (6) presents an increasing function depending on the velocity v, which reflects the increasing nature of the energy consumption in Equation (26). It can be seen that the total travel time from Equation (16) is a decreasing function depending on the velocity v, due to the inverse relation. Therefore, one contradicts the other and an energy/time trade-off must be determined according to a specific criterion. The trade-off value is increased to attribute more weight to the energy saving, while its decrease indicates a higher weight attributed to the time criterion.
The energy consumption and travel time results for a four-segment route, calculated by the BF-GLOSA solution, are presented in Table 5 for λ = 0, 0.1, 0.2, 0.4, 1. The optimal driving strategies were calculated for the same route and relate to the different values of λ in Figure 9.  9. The optimal speed profiles according to various λ values for a four-segment route. Figure 9 and Table 5 demonstrate that, for a small value of λ, the travel time decreases. In particular, for λ = 0, the shortest travel time and highest energy consumption are obtained. Conversely, as λ increases, the energy consumption decreases. Therefore, the value of λ should be chosen according to the desired trade-off between time and energy. The quantitative relationship of this trade-off is discussed in [38].
Different values for λ were tested to demonstrate each method's behavior. In the following simulation, different values of λ from 0 to 1 were tested, and the energy and time results of each method were calculated based on the advisory speed profile and according to Equations (21) and (26). Then, a Pareto front was derived from the results to show the quantitative relationship between energy consumption and travel time. As in the previous simulation, this simulation was based on fixed and arbitrary route parameters that are presented in Table 3.
In Figure 10, it can be seen that, for every value of λ, the BF-GLOSA, which represents the optimal solution, and Dynamic-GLOSA are better than the other methods. It can also be seen that the Dynamic-GLOSA results approach those of the BF-GLOSA. The GA-GLOSA and MAX-GLOSA methods perform well in terms of travel time optimization, but their performance decreases as λ increases. The GA-GLOSA method uses a random algorithm, thus it is not smooth [36]. The MAX-GLOSA and naive driver results are reflected as dots since λ is not considered as part of the velocity calculation.

Optimization Results
Next, 100 Monte-Carlo [39] simulations were run for different numbers of segments. First, the route parameters were drawn randomly according to Table 2 and the parameters in Section 5.1. Second, the advisory speed profile of each method was evaluated based on the methods presented in Section 5.1. Finally, the objective function value for each method was calculated based on the advisory speed profile and the objective function from Equation (30) and the average results were calculated. In the following simulations, parameter λ was set to 0.2 to stress the importance of the energy criterion.
As expected, Figure 11 illustrates that F value increases as the number of segments increases. This simulation compares the described methods and shows that the Dynamic-GLOSA results are better than the other benchmark methods for every number of segments. A similar comparison in [40] shows that a Genetic Algorithm such as the GA-GLOSA is preferable to other methods. In addition, it can be seen that the performance of the proposed Dynamic-GLOSA algorithm is very close to the BF-GLOSA optimal solution. The optimal solution was not calculated for more than four segments because of the high complexity and the unrealistic calculation time. In Table 6, the simulation results for the four-segment case are compared with the optimal BF-GLOSA solution. In this simulation, the advisory speed profile was calculated according to each method for 100 random scenarios. Following this, the same profiles were used to calculate the methods' objective function values from Equation (30), F, the travel time from Equation (21), T, the energy consumption from Equation (26), E, and the computational complexity, i.e., calculation time.  Table 6 illustrates that, as expected, the BF-GLOSA solution has the lowest cost, F. The Dynamic-GLOSA F values are relatively close to the optimal BF-GLOSA solution, with only a 1.01% higher cost and a small variance of 1.96%. The Dynamic-GLOSA average calculation time, 0.45 s, allows real-time implementation. The GA-GLOSA shows reasonable optimization results but requires a lengthy calculation time. An overly simplified model, such as MAX-GLOSA, displays a short calculation time, but the objective function results are unsatisfying as the vehicle model is not taken into account. The naive driver solution presents both the highest energy consumption and the longest travel time. By comparison with the naive driver, the Dynamic-GLOSA consumes 50.2% less energy and takes 6.4% less travel time. The Dynamic-GLOSA results show that the energy saving is more significant than the travel time saving, because the objective function trade-off in this paper considers energy to be more important.
The 13-segment case was also tested, as the problem complexity grows significantly with the number of segments. The average objective function values, travel time, energy consumption, and calculation time are presented in Table 7 for 100 Monte-Carlo simulations and a 13-segment route. This simulation compared the Dynamic-GLOSA, GA-GLOSA, MAX-GLOSA, and the naive driver methods. The optimal BF-GLOSA solution was not calculated due to unrealistic calculation time. Similar to the results for the four-segment case, the objective function values for the Dynamic-GLOSA method are lower than for the other methods. Compared to the naive driver method, the Dynamic-GLOSA method presents 38.1% energy saving potential. The Dynamic-GLOSA calculation time remains relatively low even for the 13-segment route. Since changes in traffic are relatively slow, the calculation time results, together with the use of standard laptop and standard optimization toolbox, show that the method can run in real time with a vehicle equipped with a standard on-board computer.

Conclusions
In this paper, we investigate the optimization problem of the GLOSA system and propose a real-time solution. A new formulation of the GLOSA system is introduced that includes energy consumption, travel time, and traffic light models. In urban environments, stopping at traffic lights usually occurs without the use of preliminary information and, therefore, the energy consumption of an unassisted driver increases. In general, the energy saving potential increases when driving is based on a more sophisticated algorithm. The optimization problem is reformulated and it is now emphasized that the GLOSA optimization problem is a nonconvex optimization problem, due to the traffic light discontinuity, which is intractable in real time scenarios. Based on a smoother relaxation procedure for this problem, a dynamic real-time algorithm is presented with a high degree of optimization and low calculation time that can be used with all types of vehicles. Simulations showed that the performance of the proposed Dynamic-GLOSA algorithm is very close to that with optimal driving speeds obtained by the brute-force solution but with a much shorter calculation time. In addition, the proposed Dynamic-GLOSA driving strategy advisory was demonstrated to be better than existing methods for every number of segments and every time and energy trade-off value investigated, but is much superior in terms of energy saving potential. Due to the short calculation time in the Dynamic GLOSA method, a real-time implementation for the Dynamic-GLOSA is possible.
The paper deals with the mathematical challenges in calculating the optimal speed and presents a new mathematical approach, which proves capable of reducing calculation time and approximating the optimal solution. Future researchers can employ the presented method as the mathematical substrate for a real-time implementation to meet real-world randomness [41] and to avoid cumulated errors [26,27]. The proposed method can be extended for multiple vehicle solutions, for example by using vehicle-to-vehicle communication (V2V) [23]. By using V2X communication, information about nearby traffic can be analyzed in real time and used to recalculate the optimal driving profile.
Author Contributions: Research and writing, L.S.; and Supervision, R.R. All authors have read and agreed to the published version of the manuscript.

Funding:
The author wishes to thank the Israeli Ministry of National Infrastructures, Energy, and Water Resources for its financial support.