#### Lithium-ion power battery system cycle life fitting

Using the data obtained from the lithium-ion power battery pack cycle life test, combined with the Matlab genetic algorithm toolbox, the functional relationship between the battery system capacity retention rate η and the number of charge-discharge cycles n was fitted. Referring to the research methods of general engineering problems, combined with the observation of the relationship between the capacity retention rate and the number of cycles in Figure 1, a 3rd degree polynomial can be used to fit the relationship between the two, namely:
η=a0+a1n+a2n²+a3n3——(1) Figure 1 Relationship between the capacity retention rate of lithium-ion power battery system and the number of cycles of charge and discharge

According to a certain test result, we can know the test data [ηi, ni ] of the capacity retention rate η and the number of charge-discharge cycles n. In order to prevent the magnitude of the undetermined coefficients a0, a1, a2, and a3 from being too small, the number of cycles of charge and discharge is converted to 1000 times as a unit. The data of ηi,ni are shown in Table 1.

1 Steps for fitting based on Matlab genetic algorithm toolbox
The following describes the process of using the Matlab Genetic Algorithm Toolbox to determine the undetermined coefficients a0, a1, a2, a3 in the polynomial (1):

① Determine the fitness function. The fitness function designed in Matlab Genetic Algorithm can only obtain its minimum value. If the maximum value is to be solved, appropriate changes must be made. Let η’²i be the capacity decay rate corresponding to the number of cycles ni calculated by the fitting function formula (3-26), then the sum of squares of the total errors of ηi and η’i is

Generally, it can be considered that the smaller the error squared sum e, the better the fitting effect, even if the values ​​of the undetermined coefficients a0, a1, a2, and a3 with the smallest e are the optimal results.

② Write the m file of the fitness function and save it to the Matlab working path with the function name “bat_cyclelife3”. The function written in this article is as follows:
function y=bat_cyclelife3(a)
C=[103.53035498.45161596.41157494.62567793.27196492.11820590.86393389.384969]; Ne=[0.001, 0.36, 0.72, 1.08, 1.44, 1.80, 2.16, 2.52];
[r, s] = size(c);
y=0
For i=1: s
y=y+(C(i)-(a(1)+a(2)Ne(i)+a(3)(Ne(i)^2)+a(4)*(Ne(i)^ 3)))^2
% Error sum of squared minimization principle
end

③ Open the Matlab Genetic Algorithm Toolbox to make relevant settings, run and obtain the test results. Enter the handle of the fitness function “@bat_cyclelife3” in the Fitness function, enter “4” for the number of variables, check Best fitness and Best individual in the running display (Plots), and set the Selection function in the selection parameter (Selection) to roulette For Roulette, in Stopping Criteria, Generations is set to 100, Fitness limit is set to 0, Stall generations is set to 100, and Stall time limit is set to Inf. The parameters such as crossover and mutation are default values, which are set in the default toolbox. After completing the settings, click the “Start” button, and the genetic algorithm starts to operate.

2 Algorithm calculation process and results
When the maximum number of iterations (Generations) of the stopping condition is set to 100, the display of the best fitness and the current best individual during the calculation process is shown in Figure 2. It can be seen from this that the optimal fitness (that is, the sum of squares of errors) gradually decreases as the number of iterations progresses, and the optimal fitness of each generation is gradually approaching the average fitness, indicating that the algorithm is constantly being optimized. The best fitness after 100 iterations is 21542.86, and the values ​​of a0, a1, a2, and a3 are shown in Table 2.