## 3 Control Strategy Development and Optimization
### Meta-Heuristic Optimization of the PID Controller  
#### 3.2.1 GA-PID Controller  
The traditional tunning approach, such as trial and error and Ziegler-Nichols methods combined in a heuristic, makes achieving optimal performance difficult, especially for nonlinear dynamics systems [58]. Therefore, more advanced design approaches for the PID control have been adopted to handle the issue of nonlinear effects, such as fractional-order PID (FOPID) in [59], PSO-PID in [60], fuzzy PID in [61; 62]. However, the GA is an optimization algorithm inspired by the principles of natural selection. The GA is applied to find the optimal solution to complex problems. For example, it is utilized to find optimal  
Figure 15: Classical PID Control Architecture. solutions in control systems in machine learning (ML), scheduling, tuning controllers such as PID, NN, fuzzy logic, and so on. Figure 16 shows the steps or process in flowchart for tuning the PID controller using GA. While Figure 17 shows the enhanced PID structure based on the GA technique used to obtain the optimal gains of the classical PID controller of Figure 15 to reduce the fuel consumption and CO2 emission for designed hybrid Crafter in this research. The following are the detailed steps for PID tuning using GA as illustrated in Figure 16 and implemented on Figure 17: Step 1. The initial random population should be generated. Therefore, in this case, every individual represents the three control gains of the PID controller such as \(K_{pi}\), \(K_{ii}\), \(K_{di}\), where i = 1, 2, \(\ldots\), \(\ldots\) ps and ps is the ith individual gain from the total number of individuals from the population. Step 2. Initialize the PID parameters' lower and upper bound values, such as the Kp, Ki, and Kd values. Step 3. Encode the PID parameters, i.e., \(K_{p}\), \(K_{i}\), and \(K_{d}\) parameters, into strings known as chromosomes. Step 4. Define the error criteria, such as the value of fit (fitness value) such as ITAE. The error criteria are defined in terms of the PID integral square error, such as the integral. These values of error should be minimum if maximum iteration is met. The following equations define the mathematical formulations of the errors as expressed in [63]:  
\[ \begin{cases}IAE=\int_{0}^{\infty}|e(t)|dt\\ ISE=\int_{0}^{\infty}|e(t)|^{2}dt\\ ITAE=\int_{0}^{\infty}t|e(t)|dt\\ ITSE=\int_{0}^{\infty}t|e(t)|^{2}dt\end{cases}  \tag{24}\]  
where IAE is the absolute error, ISE is the integral square error, ITAE is the integral time absolute error, and ITSE is the integral time square error. Step 5. Apply the operators of the GA techniques, i.e., reproduction, mutation, and crossover, to evaluate the fitness value for every chromosome (the encoded Kp, Ki, Kd of the PID controller). Step 6. Decoding. Step 7. This is called the evaluation criteria. In this step, check if the fitness value (error) is minimum. If yes, go to step 8; if not, go back to step 4. Step 8. The best values of the PID parameters are found. Therefore, in this research, the algorithm is repeatedly used to refine a population parameter setting using selection, crossover, and mutation operations until it converges on a solution that represents minimum values of the objective functions (in this case, the errors), which gives optimum tuning for the PID parameters. However, the set-point refers to the desired vehicle speed, which serves as the reference input for the PID controller. The controller's input signal is the speed error, e(t), calculated as the difference between the reference speed (drive cycle in km/h) and the vehicle's actual speed (also in km/h). This error signal enables the PID controller to generate the appropriate control signal to regulate the vehicle's speed. In addition, the controller determines the required motor and engine speed and torque for propelling the vehicle's wheels.