Permanent magnet synchronous motor (PMSM) is a complex control system with non-linearity, time-varying and strong coupling. The conventional PID controller design method can not achieve good control quality (including stability, rapidity and robustness). Genetic algorithm is a kind of intelligent optimization algorithm, which has good global optimization ability, is not easy to fall into local optimal solution, and has good parallelism. Therefore, this paper uses genetic algorithm to realize parameter tuning of PID controller in PMSM AC servo system. MatLab/Simulink simulation results show that the proposed method has good control quality. Permanent magnet synchronous motor (PMSM) has the advantages of small size, light weight, high efficiency, simple structure and low loss. Compared with DC motor, PMSM has no shortcomings of commutator and brush; compared with induction motor, it does not need reactive excitation current, so it has high efficiency and power factor, large moment of inertia, **thermostatic element** reduced stator current and stator winding, and good control performance. The vector control system of permanent magnet synchronous motor (PMSM) can achieve high precision, wide range speed regulation and positioning control, which has attracted wide attention of experts and scholars at home and abroad [1]. Permanent magnet synchronous motor control system is mainly composed of permanent magnet synchronous motor (PMSM), current sensor, PWM inverter, speed sensor, position sensor, current controller and so on. Genetic Algorithms (GA) is a global search and optimization algorithm developed on the basis of Darwin’s evolutionary theory and Mendel’s theory by imitating the evolutionary process of organisms. GA algorithm has parallel, efficient and global search ability, and can acquire and accumulate search experience in the search process, and ultimately obtain the optimal solution. The basic idea of genetic algorithm is to construct a fitness function according to the objective function of the problem to be optimized. Then the initial population is generated to evaluate, cross, mutate and select the population. Through several evolutions, the individual with the highest fitness is obtained as the optimal solution of the problem. The initial population of genetic algorithm is generated by encoding. There are two common encoding methods, binary encoding and floating-point encoding. The idea of binary coding is to assume that the range of a parameter is [Xmin-Xmax].

If a binary string with length L is used to represent it, then Xmin represents 000… 000 and Xmax represents 111..

.111. Binary coding is simple and conducive to cross mutation operation, but this coding method can not reflect the actual characteristics of parameters. For large parameters to be optimized, a long binary number expression is needed, which leads to an increase in the search space of the system. In this paper, genetic algorithm is used to tune the PID parameters of PMSM control system. Because of the large parameters, binary coding is not suitable for this genetic algorithm. Floating-point coding is used in this paper. Floating-point encoding is similar to decimal encoding in that each individual’s gene value is represented by a specific range of floating-point numbers. The three parameters of PID controller that need to be optimized are the length of coding. Decimal coding is suitable to represent a large range of numbers in genetic algorithm. It is suitable for the coding of parameters of PID controller and does not need decoding link. Therefore, this paper chooses floating-point coding (decimal coding) method to code. Fitness function is an evaluation function to measure the superiority and inferiority of an individual or solution. According to the different types of problems, the definition of fitness function varies greatly. Each individual in the genetic algorithm corresponds to a fitness function, also known as the objective function.

The optimization effect of genetic algorithm depends on the fitness function. In PMSM control system, the unit step signal is usually used as the test signal when the parameters of PID controller are tuned. In the above formula, the absolute value of the system error, the output parameters of the controller, the weight coefficient and the rise time of t u are represented by u (t). Because the output of PID controller in PMSM control system is limited, the setting time increases with the increase of time u, and the absolute value of error increases with it, so it can be set to 0. Formula (3) shows that when the objective function f (x) > 0, the smaller the individual objective function f (x) of the PID controller parameters tuned by genetic algorithm is, the better.

In the process of floating-point coding, crossover and mutation operations need to be performed at the junction of genes. In this paper, the floating-point code length is 3, so two crosspoints are generated, and one or two genes are randomly selected to cross to generate a new individual population. The parameters of the PID controller of the control system are optimized by using the MATLAB/Simulink model. The parameters of the genetic algorithm and the system are set as shown in Table 1 below. The optimization curve of system objective function and the speed unit step curve of PMSM AC control motor are obtained by simulation on the platform of Matlab/simulink as shown in Fig. 2 and 3 respectively. The final parameters of the PID controller are SKP = 21672, SKi = 1.65, SKd = 0.87, IKP = 1200, IKd = 0.56. It can be seen from figs. 2 and 3 that the PID controller parameters of PMSM AC control system tuned by genetic algorithm are effective.

Although there are some steady-state errors, its overall control quality meets the speed control requirements of the permanent magnet synchronous motor speed control system. Based on the problem of PID parameter design of PMSM AC control system, this paper uses genetic algorithm to tune the parameters of current loop and speed loop PID of PMSM. Based on MATLAB / Simulink platform, the simulation results show that the PID controller parameters tuning method based on genetic algorithm is effective, and the PID controller parameters tuning results meet the dynamic and static performance requirements of PMSM control system.