## 3 Modeling and Control Strategy Design
### Optimization with the PSO Algorithm  
The optimization target is to minimize fuel consumption during a given driving cycle. Furthermore, for an SHEV driving in charge-sustaining mode, the \(\Delta\)SOC between the start and the end of the cycle and the SOC fluctuations during the cycle should also be considered. Therefore, the cost function of evaluating the overall fuel economy can be written as:  
\[J=\int_{t_{0}}^{t_{f}}\dot{m}_{fuel}(t)dt+W_{1}\int_{t_{0}}^{t_{f}}\Big{(}SOC(t )-SOC_{ref}\Big{)}^{2}dt+W_{2}\Big{(}SOC\Big{(}t_{f}\Big{)}-SOC_{ref}\Big{)}^{2} \tag{25}\]  
where the first term on the right side of the equation denotes the total fuel consumption during the whole driving cycle, the second term is the penalty of SOC fluctuations, and the third term is the penalty of SOC deviations at the end of the driving cycle. \(W_{1}\) and \(W_{2}\) are the weightings. Based on the theory of ECMS, this global optimization problem can be converted to a local optimization problem where only the instantaneous equivalent fuel consumption is required to be minimized, which is illustrated by Equations (19) and (24); therefore, the online optimization is applicable. The EF plays an essential role in ECMS; however, it heavily depends on the driving cycle. An optimal EF for one particular driving cycle may not achieve optimal results for another one. Moreover, with multiple constraints and time-varying parameters, it is fairly difficult to obtain an analytical solution for this optimization problem. Therefore, in this study, PSO, a heuristic optimization algorithm, is adopted to search for an optimal solution. Inspired by the social behavior of bird flocking and fish schooling, the basic idea of solving an optimal control problem using PSO is that the candidate solution can be represented by particles; during the iteration, each particle updates the velocity and position according to the global best and personal best based on evaluating the fitness values obtained by the particle swarm. The iterative law can be written as  
\[v^{i}(k+1)=wv^{i}(k)+c_{1}r_{1}\Big{(}P_{best}^{i}-x^{i}(k)\Big{)}+c_{2}r_{2} \Big{(}G_{best}-x^{i}(k)\Big{)} \tag{26}\]  
Figure 7: Determination of the engine’s operating range in different combustion modes. \[x^{i}(k+1)=x^{i}(k)+v^{i}(k+1) \tag{27}\]  
where \(v^{i}(k)\) is the velocity of the \(i\)th particle at the \(k\)th iteration; \(x^{i}(k)\) is the position of the \(i\)th particle at the \(k\)th iteration; \(P^{i}_{best}\) is the personal best position of the \(i\)th particle; \(G_{best}\) is the global best position of all the particles; w is the inertia weight; \(c_{1}\) and \(c_{2}\) are learning factors, which are two constants between 0 and 2; and \(r_{1}\) and \(r_{2}\) are uniform random numbers between 0 and 1. Once the stopping criteria are satisfied (e.g., the maximum iteration number is achieved), the iteration will be ended and the global best, along with the corresponding optimal particle position, can be determined. In this study, in order to optimize the EF and solve the ECMS problem for a given driving cycle, a dual-loop PSO algorithm is adopted, as shown in Figure 8. The outer loop (see Figure 8a) is used to find out the optimal EF for ECMS, and each particle is a two-dimensional vector that represents the two parameters, \(\alpha\) and \(\beta\), in EF, as defined by Equation (23). With a fixed EF, the ECMS problem for a given driving cycle becomes solving the optimal control problem defined by Equation (24) at each time step of the cycle. Therefore, the inner loop of PSO (see Figure 8b) is used to find out the optimal \(p^{*}_{g}(t)\). For offline optimization, the dual-loop PSO algorithm operates as follows:  
1. Run the outer loop PSO. Each particle is a candidate solution of EF containing two parameters. The fitness function is defined in Equation (25). 2. At the beginning of one iteration, the position of a particle is fixed and the corresponding EF can be determined. 3.