*2.3. Vehicle Dynamics*

The computation starts from the driving cycle *vdc*(*k*), which gives the target speed for each time step *k*. The computation flows from the driving cycle to the inverter (Figure 2).

**Figure 2.** Signal flow in the vehicle model.

Vehicle speed and acceleration are computed by

$$v\_{vk}(k) = \begin{cases} \frac{v\_{dc}(k)}{2}, & k = 1\\ \frac{v\_{dc}(k) + v\_{dc}(k-1)}{2}, & k > 1 \end{cases} \tag{1}$$

$$a\_{\rm rbl}(k) = \begin{cases} \frac{v\_{dc}(k)}{h}, & k = 1\\ \frac{v\_{dc}(k) - v\_{dc}(k-1)}{h}, & k > 1 \end{cases} \tag{2}$$

where *vvh*(*k*) is the vehicle speed, *avh*(*k*) is acceleration, and *h* is the time step duration, which is constant for the cycle. Wheel axle angular speed and acceleration at the wheel are given by dividing corresponding vehicle speed and acceleration with the tire radius according to

$$
\omega\_{\text{vbl}}(k) = \frac{v\_{\text{vbl}}(k)}{r\_{\text{vbl}}} \tag{3}
$$

$$a\_{\rm ubh}(k) = \frac{a\_{\rm vh}(k)}{r\_{\rm uph}} \tag{4}$$

where ω*vh*(*k*) is axle angular speed, α*vh*(*k*) is the axle angular acceleration, and *rwh* is the tire radius. The torque on the axle τ*wh*(*k*), required for thrusting the vehicle forward at a given speed and acceleration, is determined by the tractive force *Fx*(*k*), which is the sum of the forces acting on the vehicle body.

Rolling resistance, aerodynamic drag and inertia forces as well as the resulting axle torque are given by

$$F\_{\mathbf{x}}(k) = M \mathbf{g} c\_{\mathbf{r}} + \frac{c\_{\mathbf{w}} \rho A v\_{\mathbf{v} \mathbf{h}}(k)^2}{2} + M a\_{\mathbf{v} \mathbf{h}}(k) \tag{5}$$

$$
\pi\_{\text{whl}}(k) = F\_{\text{x}}(k) r\_{\text{whl}} \tag{6}
$$

where *M* is the vehicle mass, *g* is gravitational acceleration, *cr* is the rolling resistance coefficient, *cw* is the aerodynamic drag coefficient, ρ is air density, and *A* is the frontal area of the vehicle. In the next step of the calculation flow, the torque and speed of the rear wheels are conveyed to the motor. The gearbox gear ratio determines the conversion, and in the case of the motor torque, the rotational inertia must also be taken into account. The motor speed ω*m*(*k*) and the torque τ*m*(*k*) are given by

$$
\omega\_{\rm w}(k) = \omega\_{\rm wh}(k)i \tag{7}
$$

$$
\pi\_m(k) = \frac{\pi\_{wb}(k)}{i\eta\_{l^\text{tr}}\eta\_{\mathcal{S}^b}} + \alpha\_{wb}(k)iI\_m \tag{8}
$$

where *i* is the total gear ratio, η*tr* is the transmission efficiency, η*gb* is the gearbox efficiency and *Im* is the motor moment of inertia. Finally, the motor input power requirement *Pm,in* is computed by

$$P\_{m,in}(k) = \frac{\omega\_m(k)\tau\_m(k)}{\eta\_m(\omega\_m(k), \tau\_m(k))\eta\_{inv}(\omega\_m(k), \tau\_m(k))}\tag{9}$$

where η*m*(ω*m*(*k*), τ*m*(*k*)) is the motor efficiency function, and where the arguments are the motor speed and torque. Likewise, η*inv*(ω*m*(*k*), τ*m*(*k*)) is the inverter efficiency function. In the case of regenerative braking, the efficiencies in Equations (8) and (9) become multipliers instead of dividers.

## *2.4. Optimal Shifting Policy*

The shifting policy for the two-speed gearbox is optimized with an integer programming model. The objective is to minimize energy consumption for the driving cycle by assigning the gear that translates to the most efficient motor operating point, taking into account the efficiency loss of shifting events and hysteresis. The optimization model is formulated as

$$\underset{y\_t, y\_t'}{\text{minimize}} \sum\_{t=1}^{T} \left( \mathbf{C}\_t - \mathbf{C}\_t y\_t + \mathbf{C}\_t' y\_t + \mathbf{S} y\_{-t}' \right) \tag{10}$$

$$\{y\_t - y\_{t+1} - y\_{\,\,t}' \le 0, \,\forall t \in \{1, \ldots, T-1\} \tag{11}$$

$$t - y\_t + y\_{t+1} - y\_{\;t}' \le 0, \; \forall t \in \{1, \ldots, T-1\} \tag{12}$$

$$\sum\_{m=0}^{M} y'\_{t+m} - 1 \le 0, \forall t \in \{1, \dots, T - M\} \tag{13}$$

$$y\_{t\prime} \ y\_t' \in \langle 0, 1 \rangle. \tag{14}$$

The objective function in Equation (10) to be minimized is the vehicle energy consumption for the cycle, composed of the sum of the consumptions of each time step *t* in the set {1,..,*T*}. The consumption for each step has three components: the vehicle propulsion, the actuator energy for the shifting procedure, and the friction loss. The first component, motor propulsion energy demand, is represented by the parameters *Ct* (*C't*), for the low (high) gear. The gearbox has in this case only two gear ratio options to select from, and either one is active at each step, which allows for modeling the gear selection with a single binary variable *yt*. The formulation in Equation (10) includes this binary variable to switch on and off the consumption parameter that corresponds to the active gear selection at each step. Both the actuator energy and the friction loss are included in the parameter *St*, which contributes to the objective function at step *t*. The shifting event at that step is indicated by the binary variable *y't* receiving a value of one.

Equations (11)–(13) define the downshift, upshift, and hysteresis constraints, respectively. The downshift constraint in Equation (11) forces the binary variable *y't,* which indicates a shifting event, to equal one when the gear indicator binary variable *yt* changes from one to zero in consecutive time steps. The logic in the constraint Equation (12) is the same as in Equation (11), but the functionality applies to upshifting instead of downshifting.

The hysteresis constraint Equation (13) sets a limit to the shifting frequency. A gear shift is allowed after M time steps have passed since the previous shifting event. The constraint formulation utilizes the binary variable *y't*, which receives a value of one when an upshift or downshift occurs in step *t* and zero otherwise.

The resulting objective function value is returned to the gear ratio optimizer function, which compares the consumption to the previous lowest value and replaces it in the case that the current run returns the lowest value.

### *2.5. Gear Ratio Optimization*

The two-speed gearbox gear ratios function as an input to the vehicle dynamic model and the shifting policy optimization model. The gear ratios are iterated through such that each combination is covered from a range for both gears. Before the gear ratio optimization is initiated, the search scope is determined by setting the starting and ending gear ratios and the increment. For example, a search between ratios 3.0 and 8.0 with a 0.1 increment is represented by the set {3.0, 3.1, ... , 7.9, 8.0}. In the following representation, the gear ratio choice set, which contains a sequence of gear ratios, is denoted with list 1 for the first gear and list 2 for the second gear.

Figure 3 shows the exhaustive search process for the gear ratios that produce the lowest consumption for a specific driving cycle. The process consists of an inner loop for the low gear ratio range and an outer loop for the high gear ratio range of the two-speed gearbox. The cycle energy consumption block in the chart constitutes the vehicle dynamics model, described by Equations (1)–(9) and the gear shifting optimization model in Equations (10)–(13). The energy consumption is therefore computed for each combination of gear ratios from the ranges that are selected at the beginning of the process. Finally, the lowest consumption, represented by the stored value, and the corresponding gear ratios are returned.

**Figure 3.** Flow chart of the gear ratio optimization process.

### **3. Numerical Case Study**

The case vehicle examined in this work is a fully electric city bus operating on a predetermined suburban route with a fast-charging station at one end of the route. The vehicle was first deployed for continuous operation at the beginning of 2016. The electric motor is a 180 kW permanent magnet synchronous machine (PMSM) and the energy storage system consists of a lithium-titanate (LTO) battery with 690 V nominal voltage and 55 kWh capacity. The bevel type differential has a ratio of 7.0. The curb weight is 10,500 kg and the maximum allowed payload is 5500 kg, which limits the passenger capacity to 78, assuming that the mean passenger mass is 70 kg. A constant 1500 kg load from 18 passengers and the driver was assumed in the case study. Increased mass from the multispeed gearbox options was considered negligible.
