## 3 Controller Design and Genetic Algorithm Optimization Approach
### Genetic Algorithm  
The selection of parameters in the DAB control method has a significant impact on the control performance and quality of the DAB system. While the PI control and SMC control can be adjusted and designed using expected peak time and overshoot, for MPC control, parameter selection relies on basic theory and experience. Therefore, choosing the appropriate control method and parameters for optimization becomes a key issue in improving the control performance and response speed of DAB. In this paper, GA is used to optimize the parameters of PI control, SMC control, and MPC control in DAB. By establishing the system model and control algorithms mentioned earlier, GA is applied for parameter tuning to optimize the control performance and response speed of DAB. The concept of GA originates from evolutionary biology and is a random optimization search technique based on natural selection. The basic principle of the GA is to evolve better solutions by performing selection, crossover, and mutation operations on individuals (possible solutions) in the problem space. Each individual is represented as a chromosome, and the chromosome is composed of genes. Genes can be meaningful numerical values, symbols, or binary codes [21]. Figure 7 shows the flowchart of GA, while Algorithm 1 presents the pseudocode of GA, and its basic steps include the following. 1. **Population Initialization--**Create an initial random population consisting of multiple individuals, with each individual corresponding to a potential solution. For the method of encoding the initial population, this paper defines the optimized variable range within \(lb\) and \(ub\), and adopts real number encoding to encode the variables. Real number encoding is a common GA encoding method that transforms real-valued variables to gene values in the chromosome, where each gene represents a real-valued solution. In real number encoding, floating-point numbers are commonly used to represent gene values since the optimized variable range is usually a continuous real-valued range. Assuming the length of the chromosome is \(L_{C}\), each individual can be represented as an \(L_{C}\)-length binary string or floating-point string. For real number encoding, the representation can be done using floating-point strings instead of binary strings. In real number encoding, it is necessary to perform the conversion between gene values and actual variable values to ensure that the optimized solutions fall within the variable range [29]. The detailed process of real-valued encoding is as follows: 1. **Determine Chromosome Length--**Initially, the length of the chromosome (number of genes) is established, which governs the encoding precision. Typically, this length depends on the number of problem variables and the required accuracy. Let us denote the chromosome length as \(L_{C}\); 2. **Initialize Individuals--**For each individual, a random array of floating-point numbers is generated, with a length of \(L_{C}\). The range of each element (upper and lower limits) is set to \([0,1]\); 3. **Mapping Gene Values to Actual Variable Values--**Transform each gene value into the range of the actual variable. Assuming the range of the variables to be optimized is \([min_{val},\ max_{val}]\), the following formula is used to map the gene value \(gene_{value}\) to the actual variable value \(x{:}x=min_{val}+gene_{value}*(max_{val}-min_{val})\)  
Figure 6: Control block diagram of DAB model predictive control. Specifically, for each gene value \(gene_{value}\), it is mapped to an actual variable value \(x\), where \(x\) lies within the range \([min_{val},\ max_{val}]\);  
2. **Evaluation of Fitness**--Evaluate each individual in the population based on the problem's objective function to obtain its fitness value, which measures the quality of the solution. In GA, the fitness function plays a crucial role in assessing the superiority of each individual. In this paper, the fitness function is defined as \(Error=sum(|V_{\text{o}}^{*}-V_{\text{o}}|)\).