Control system and method for permanent magnet synchronous motor
By introducing the Markov chain and immune algorithm optimization method in the random spread spectrum modulation technology, the problem of high harmonic amplitude at the switching frequency and its frequency doubling in the prior art is solved, and better electromagnetic compatibility and vibration noise reduction effect are achieved.
Patent Information
- Application Number
- CN202411743599.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-30
- Publication Date
- 2025-03-21
AI Technical Summary
The existing random spread spectrum modulation technology is still relatively high at the switching frequency and its frequency doubling, affecting the electromagnetic compatibility and vibration noise of the electric drive system.
The random spread spectrum technology based on Markov chain is adopted, and the spread spectrum parameters are optimized in combination with the immune algorithm. Random parameter values are generated through the two-state Markov chain, and the immune algorithm is used to find the optimal transfer probability and random gain, thereby generating a triangular carrier signal with random change in the period.
It effectively reduces the harmonic amplitude of the switching frequency and its frequency doubling, improves electromagnetic compatibility and reduces vibration noise, and improves the performance of permanent magnet synchronous motors.
Smart Images

Figure CN119675501A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of motor control and relates to a random spread spectrum modulation technology, in particular to a permanent magnet synchronous motor control method based on Markov chain random spread spectrum. Background Art
[0002] As the global ecological environment deteriorates and energy is in short supply, the demand for electric vehicles is increasing, and major domestic and foreign automakers are further improving the relevant technologies of electric vehicles. In the electric vehicle motor drive system, the inverter usually uses a fixed switching frequency modulation technology to make the power switch device turn on and off in a fixed manner, which will cause a large number of high-amplitude harmonics at the switching frequency and its multiples. These harmonics seriously affect the performance of the electric drive system in various aspects, such as electromagnetic compatibility, vibration noise, etc.
[0003] In order to solve these problems, random spread spectrum modulation technology came into being. Random spread spectrum modulation technology is based on Parsval's theorem, that is, if the energy distribution of the signal in the time domain remains unchanged, the energy of the signal in the frequency domain will also remain unchanged. If the high-order harmonic energy concentrated near the switching frequency and its multiples can be dispersed to the entire spectrum, the harmonic amplitude at the switching frequency and its multiples will be reduced. Therefore, it can suppress electromagnetic interference, improve electromagnetic compatibility, and reduce vibration noise.
[0004] However, there are also some problems with random spread spectrum modulation technology, such as uneven distribution of random numbers in a short period of time, improper selection of the switching frequency variation range, etc. These problems affect the final effect of random spread spectrum modulation technology and need to be solved urgently. Summary of the invention
[0005] The purpose of the present invention is to overcome the shortcomings of the prior art. The present invention provides a random spread spectrum modulation technology method with simple principle, easy implementation and excellent performance, improves the random performance of random numbers, selects the optimal spread spectrum parameters, improves the spread spectrum effect, and reduces the harmonic amplitude at the switching frequency and its multiples.
[0006] The present invention solves the technical problem by adopting the following technical solutions:
[0007] A control system for a permanent magnet synchronous motor; the permanent magnet synchronous motor control system includes a triangular carrier generator, a pulse width modulation module, a three-phase voltage source inverter and a permanent magnet synchronous motor; the permanent magnet synchronous motor control system also includes a spread spectrum parameter optimization module, a first spread spectrum unit and a second spread spectrum unit; wherein:
[0008] The spreading parameter optimization module optimizes the first spreading unit and the second spreading unit by using an immune algorithm; comprising:
[0009] The first spread spectrum parameter unit extracts the transition probability based on the two-state Markov chain method to obtain a random parameter value S, that is:
[0010]
[0011] Where: P is the transition probability value, which is [0,1];
[0012] The second spread spectrum parameter unit obtains the randomized carrier frequency f according to the following formula based on the random parameter value and the random gain: s ;
[0013] f s =f0+R·s
[0014] Among them, f s is the randomized carrier frequency, f0 is the fixed carrier frequency, s is a random value in the range of [-1,1], and R is the random gain parameter;
[0015] The triangular carrier generator obtains a triangular carrier signal with a randomly changing period according to the randomized carrier frequency;
[0016] The pulse width modulation module compares the triangular carrier signal and the modulation wave signal to obtain a three-phase pulse signal; the three-phase voltage source inverter processes the three-phase pulse signal and outputs a three-phase alternating current to supply power to the permanent magnet synchronous motor.
[0017] Furthermore, the spectrum spreading parameter optimization module performs an optimization process on the first spectrum spreading unit and the second spectrum spreading unit by using an immune algorithm, including:
[0018] 101. Use the transition probability and random gain as single antibodies to establish an antibody population. Set the range of random gain R to [1000, 2000] and the range of transition probability P to [0.5, 1] as the antibody value range.
[0019] 102. The following formula is used to construct an evaluation target model corresponding to different permanent magnet synchronous motor output current waveform spectra for each antibody value in the population:
[0020] y=1 / f(P,R)
[0021] In the formula, f is the selected permanent magnet synchronous motor model, and y is the inverse of the current spectrum peak value of the motor model under the set of variables R and P;
[0022] 103. Calculate the antibody population affinity value according to the evaluation target model using the following formula for the antibody population;
[0023] aff(n)=y=1 / f(a n )
[0024] Where n is the number of iterations of the immune algorithm, an is the antibody at the nth iteration, and aff(n) is the affinity corresponding to antibody an;
[0025] 104. By comparing each antibody with the antibody with the highest affinity value in the obtained antibody population in each iteration, the optimal affinity value of the antibody population is obtained; that is:
[0026]
[0027] Among them, affmax is the antibody with the highest affinity, and affopt is the global optimal antibody affinity;
[0028] 105. Determine whether the number of iteration steps is met according to the following conditions: if the maximum number of iteration steps is met, stop the optimization algorithm and output the result; otherwise, continue to iterate;
[0029]
[0030] Among them, N is the maximum number of iterations, aopt is the global optimal antibody, representing the best spreading parameter group, and Algor ithmout is the final output result of the immune algorithm;
[0031] 106. Perform immune selection on the antibody population: select high-quality antibodies for cloning according to the optimal affinity value of the antibody population, and perform mutation processing on the cloned antibodies according to the following formula to obtain a mutant antibody population;
[0032] C=clone(m,b n )
[0033] Where bn is the selected high-quality antibody, m is the number of antibody clones, clone(bn) is a set of m clones identical to bn, and C is the cloned antibody population;
[0034]
[0035] Where cn is the cloned antibody, δ is the defined neighborhood range, rand is the function that generates random numbers in the range of (0,1), pm is the mutation probability, and D is the antibody population that has undergone the mutation operation;
[0036] 107. Antibody population update: introduce high-value affinity antibodies from the variant antibody population to replace low-value affinity antibodies to obtain an updated population, and send the updated population to step 102 to continue iteration.
[0037] In order to solve the problems existing in the prior art, the present invention also adopts the following technical solutions:
[0038] S1. Combine the immune algorithm to optimize the two random parameters of transfer probability and random gain, where:
[0039] 101. Use the transfer frequency and random gain as single antibodies to establish an antibody population. Set the range of random gain R to [1000, 2000] and the range of transfer probability P to [0.5, 1] as the antibody value range.
[0040] 102. The following formula is used to construct an evaluation target model corresponding to different permanent magnet synchronous motor output current waveform spectra for each antibody value in the population:
[0041] y=1 / f(P,R) (1)
[0042] In the formula, f is the selected permanent magnet synchronous motor model, and y is the inverse of the current spectrum peak value of the motor model under the set of variables R and P;
[0043] 103. Calculate the antibody population affinity value by evaluating the target model according to the following formula for the antibody population;
[0044] aff(n)=y=1 / f(a n )
[0045] Where n is the number of iterations of the immune algorithm, an is the antibody at the nth iteration, and aff(n) is the affinity corresponding to antibody an;
[0046] 104. By comparing each antibody with the antibody with the highest affinity value in the obtained antibody population in each iteration, the optimal affinity value of the antibody population is obtained; that is:
[0047]
[0048] Among them, affmax is the antibody with the highest affinity, and affopt is the global optimal antibody affinity;
[0049] 105. Determine whether the number of iteration steps is met according to the following conditions: if the maximum number of iteration steps is met, stop the optimization algorithm and output the result; otherwise, continue to iterate;
[0050]
[0051] Among them, N is the maximum number of iterations, aopt is the global optimal antibody, representing the best spreading parameter group, and Algor ithmout is the final output result of the immune algorithm;
[0052] 106. Perform immune selection on the antibody population: select high-quality antibodies for cloning according to the optimal affinity value of the antibody population, and perform mutation processing on the cloned antibodies according to the following formula to obtain a mutant antibody population;
[0053] C=clone(m,b n )
[0054] Where bn is the selected high-quality antibody, m is the number of antibody clones, clone(bn) is a set of m clones identical to bn, and C is the cloned antibody population;
[0055]
[0056] Where cn is the cloned antibody, δ is the defined neighborhood range, rand is the function that generates random numbers in the range of (0,1), pm is the mutation probability, and D is the antibody population that has undergone the mutation operation;
[0057] 107. Antibody population update: introducing high-value affinity antibodies from the variant antibody population to replace low-value affinity antibodies to obtain an updated population, and sending the updated population to step 102 to continue iteration;
[0058] S2. In the case of the optimal solution of random numbers, random parameter values are generated based on the two-state Markov chain generation principle, and a triangular carrier signal with a randomly changing period is generated according to the random switching frequency formula, that is:
[0059] The random switching frequency formula is:
[0060] f s =f0+R·s
[0061] In the formula, f s is the randomized carrier frequency, f0 is the fixed carrier frequency, s is a random value in the range of [-1,1], and R is the random gain parameter;
[0062] S3: Compare the triangular carrier signal and the modulation wave signal to obtain a three-phase pulse signal, and send it to a three-phase voltage source inverter, and then supply the output three-phase AC power to the permanent magnet synchronous motor to provide power.
[0063] Beneficial Effects
[0064] The present invention can further weaken the harmonic amplitude at the switching frequency and its multiples, improve the effect of random spread spectrum modulation technology, and further enhance the performance of permanent magnet synchronous motors. Secondly, the two-state Markov chain model is introduced to optimize the random number generation effect, avoiding the random number value greater than or less than the average expected value in a certain time period during the random number generation process, so that the current harmonics are more evenly distributed on the spectrum and the amplitude is further reduced. Finally, the immune algorithm is applied to screen the transfer probability P and random gain R with the minimum harmonic amplitude of the current spectrum within a given parameter range, and the optimal parameters are input in practical applications, which can effectively reduce the harmonic amplitude.
[0065] The present invention generates random numbers using the two-state Markov chain generation principle, which effectively improves the random effect of random numbers; by using an immune algorithm, the two random spread spectrum parameter transfer probabilities and random gains in the method are optimized to obtain a parameter group with the best spread spectrum effect; compared with traditional random spread spectrum modulation technology, this method further reduces current harmonics and weakens the amplitude of the switching frequency and its multiples; in addition, the method can adapt to different application environments, thereby improving the applicability and flexibility of the method. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] Figure 1 This is a structural schematic diagram of a permanent magnet synchronous motor control system according to the present invention;
[0067] Figure 2 This is a control method flow for a permanent magnet synchronous motor of the present invention;
[0068] Figure 3 is a diagram of the output current harmonic spectrum of a fixed switching frequency in an embodiment of the present invention;
[0069] Figure 4 It is a diagram of the output current harmonic spectrum after random spread spectrum modulation based on the optimal parameter Markov chain in an embodiment of the present invention. DETAILED DESCRIPTION
[0070] The present invention will be further described in detail below with reference to the accompanying drawings and through specific embodiments. The following embodiments are only illustrative and not restrictive, and the protection scope of the present invention cannot be limited thereto.
[0071] like Figure 1 As shown, the present invention provides a control system and method for a permanent magnet synchronous motor; the permanent magnet synchronous motor control system includes a triangular carrier generator 110, a pulse width modulation module 112, a three-phase voltage source inverter 113 and a permanent magnet synchronous motor 114; the permanent magnet synchronous motor control system also includes a spread spectrum parameter optimization module 115, a first spread spectrum unit 151 and a second spread spectrum unit 152; wherein:
[0072] The first spread spectrum parameter unit 151 calculates the transfer probability based on the two-state Markov chain method to obtain a random parameter value; the random parameter value s is generated based on the two-state Markov chain, which can improve the random performance of the random number and solve the problem that the high-amplitude harmonics of the electric drive system cannot be effectively suppressed due to poor random performance. The random value s is generated based on the two-state Markov chain. It is assumed that the switching frequency is greater than f0 as state 1, and vice versa as state 2. When the switching frequency is in state 1, the probability that the switching frequency is in state 2 at the next moment is Pt, and the probability that it is in state 1 is 1-P, and vice versa. The transfer probability matrix is obtained as follows:
[0073]
[0074] Where: P is the transition probability value, which is [0,1];
[0075] The second spread spectrum parameter unit 152 obtains the randomized carrier frequency f according to the following formula based on the random parameter value and the random gain: s
[0076] f s =f0+R·s
[0077] Among them, f s is the randomized carrier frequency, f0 is the fixed carrier frequency, s is a random value in the range of [-1,1];
[0078] The spreading parameter optimization module 115 performs an optimization process on the first spreading unit and the second spreading unit by using an immune algorithm, including:
[0079] 101. Use the transfer frequency and random gain as single antibodies to establish an antibody population. Set the range of random gain R to [1000, 2000] and the range of transfer probability P to [0.5, 1] as the antibody value range. Considering the small number of optimization parameters, set the number of antibody populations to 30.
[0080] 102. The following formula is used to construct an evaluation target model corresponding to different permanent magnet synchronous motor output current waveform spectra for each antibody value in the population:
[0081] y=1 / f(P,R) (1)
[0082] In the formula, f is the selected permanent magnet synchronous motor model, and y is the inverse of the current spectrum peak value of the motor model under the set of variables R and P;
[0083] 103. Obtain the affinity value of the antibody population by calculating the antibody population through the evaluation target model;
[0084] aff(n)=y=1 / f(a n )
[0085] Where n is the number of iterations of the immune algorithm, an is the antibody at the nth iteration, and aff(n) is the affinity corresponding to antibody an; therefore, the higher the affinity of the antibody, the smaller the current spectrum peak under the set of variables R and P in the antibody;
[0086] 104. Comparing each antibody with the antibody with the highest affinity value in the obtained antibody population in each iteration to obtain the optimal affinity value of the antibody population;
[0087]
[0088] Among them, affmax is the antibody with the highest affinity, and affopt is the global optimal antibody affinity;
[0089] 105. Determine whether the number of iteration steps is met according to the following conditions: if the maximum number of iteration steps is met, stop the optimization algorithm and output the result;
[0090]
[0091] Wherein, N is the maximum number of iterations, aopt is the global optimal antibody, representing the best spreading parameter group, and Algor ithmout is the final output result of the immune algorithm; in order to prevent the antibody population from premature convergence or excessive iteration from non-convergence, the present invention uses the number of iterations as the termination condition and sets the number of iterations to 100.
[0092] 106. Perform immune selection on the antibody population: select high-quality antibodies for cloning according to the optimal affinity value of the antibody population, and perform mutation treatment on the cloned antibodies to obtain a mutant antibody population;
[0093] 107. Antibody population update: introduce high-value affinity antibodies from the variant antibody population to replace low-value affinity antibodies to obtain an updated population, and send the updated population to step 102 to continue iteration.
[0094] The triangular carrier generator obtains a triangular carrier signal with a randomly changing period according to the randomized carrier frequency;
[0095] The pulse width modulation module 112 compares the triangular carrier signal and the modulation wave information to obtain a three-phase pulse signal;
[0096] The three-phase voltage source inverter 113 processes the three-phase pulse signal and outputs three-phase alternating current to supply power to the permanent magnet synchronous motor 114 .
[0097] like Figure 2 As shown, the present invention provides a control method for a permanent magnet synchronous motor, comprising the following steps:
[0098] S1. Combine the immune algorithm to optimize the two random parameters of transfer probability and random gain, where:
[0099] 101. Use the transfer frequency and random gain as single antibodies to establish an antibody population. Set the range of random gain R to [1000, 2000] and the range of transfer probability P to [0.5, 1] as the antibody value range.
[0100] 102. The following formula is used to construct an evaluation target model corresponding to different permanent magnet synchronous motor output current waveform spectra for each antibody value in the population:
[0101] y=1 / f(P,R) (1)
[0102] In the formula, f is the selected permanent magnet synchronous motor model, and y is the inverse of the current spectrum peak value of the motor model under the set of variables R and P;
[0103] 103. Calculate the antibody population affinity value by evaluating the target model according to the following formula for the antibody population;
[0104] aff(n)=y=1 / f(a n )
[0105] Where n is the number of iterations of the immune algorithm, an is the antibody at the nth iteration, and aff(n) is the affinity corresponding to antibody an;
[0106] 104. By comparing each antibody with the antibody with the highest affinity value in the obtained antibody population in each iteration, the optimal affinity value of the antibody population is obtained; that is:
[0107]
[0108] Among them, affmax is the antibody with the highest affinity, and affopt is the global optimal antibody affinity;
[0109] 105. Determine whether the number of iteration steps is met according to the following conditions: if the maximum number of iteration steps is met, stop the optimization algorithm and output the result; otherwise, continue to iterate;
[0110]
[0111] Among them, N is the maximum number of iterations, aopt is the global optimal antibody, representing the best spreading parameter group, and Algor ithmout is the final output result of the immune algorithm;
[0112] 106. Perform immune selection on the antibody population: select high-quality antibodies for cloning according to the optimal affinity value of the antibody population, and perform mutation processing on the cloned antibodies according to the following formula to obtain a mutant antibody population;
[0113] C=clone(m,b n )
[0114] Where bn is the selected high-quality antibody, m is the number of antibody clones, clone(bn) is a set of m clones identical to bn, and C is the cloned antibody population;
[0115]
[0116] Where cn is the cloned antibody, δ is the defined neighborhood range, rand is the function that generates random numbers in the range of (0,1), pm is the mutation probability, and D is the antibody population that has undergone the mutation operation;
[0117] 107. Antibody population update: introducing high-value affinity antibodies from the variant antibody population to replace low-value affinity antibodies to obtain an updated population, and sending the updated population to step 102 to continue iteration;
[0118] S2. In the case of the optimal solution of random numbers, random parameter values are generated based on the two-state Markov chain generation principle, and a triangular carrier signal with a randomly changing period is generated according to the random switching frequency formula, that is:
[0119] The random switching frequency formula is:
[0120] f s =f0+R·s
[0121] In the formula, f s is the randomized carrier frequency, f0 is the fixed carrier frequency, s is the random value in the range of [-1,1], and R is the random gain of the pseudo-random number generation strategy;
[0122] S3: Compare the obtained triangular carrier signal with the modulation wave signal to obtain a three-phase pulse signal, and send it to a three-phase voltage source inverter, and then supply the output three-phase alternating current to the permanent magnet synchronous motor to provide power.
[0123] In this embodiment, Figure 3 The figure shows the output current harmonic spectrum at a fixed switching frequency. It can be seen that the current harmonics are very concentrated at a fixed switching frequency, mainly near the switching frequency and its multiples. These harmonics seriously affect various performances of the electric drive system, such as electromagnetic compatibility, vibration noise, etc.
[0124] In this embodiment, Figure 4 The figure shows the output current harmonic spectrum after random spread spectrum modulation based on the optimal parameter Markov chain. It can be seen that compared with the fixed frequency, the current spectrum distribution is more uniform and the current harmonic amplitude is significantly reduced, which effectively reduces the adverse effects of these harmonics on the operation of the motor.
[0125] From the above, it can be concluded that the immune algorithm can be used to obtain the transfer probability P and random gain R corresponding to the minimum harmonic peak of the current output spectrum. In practical applications, inputting the optimal parameter group can effectively reduce harmonics.
[0126] The above description of the functions and working processes of the present invention in combination with the drawings in the specification is only one of the preferred implementation cases, but the present invention is not limited to the above-mentioned specific functions and working processes. The above-mentioned specific implementation methods are only illustrative and not restrictive. Under the enlightenment of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the purpose of the present invention and the claims, which are all within the protection scope of the present invention.
Claims
1. A control system for a permanent magnet synchronous motor; the permanent magnet synchronous motor control system comprises a triangular carrier generator, a pulse width modulation module, a three-phase voltage source inverter and a permanent magnet synchronous motor; characterized in that: The permanent magnet synchronous motor control system further includes a spectrum spreading parameter optimization module, a first spectrum spreading unit and a second spectrum spreading unit; wherein: The spreading parameter optimization module optimizes the first spreading unit and the second spreading unit by using an immune algorithm; comprising: The first spread spectrum parameter unit extracts the transition probability based on the two-state Markov chain method to obtain a random parameter value S, that is: Where: P is the transition probability value, which is [0,1]; The second spread spectrum parameter unit obtains the randomized carrier frequency f according to the following formula based on the random parameter value and the random gain: s ; f s =f0+R·s Among them, f s is the randomized carrier frequency, f0 is the fixed carrier frequency, s is a random value in the range of [-1,1], and R is the random gain parameter; The triangular carrier generator obtains a triangular carrier signal with a randomly changing period according to the randomized carrier frequency; The pulse width modulation module compares the triangular carrier signal and the modulation wave signal to obtain a three-phase pulse signal; The three-phase voltage source inverter processes the three-phase pulse signal and outputs three-phase alternating current to supply power to the permanent magnet synchronous motor.
2. The permanent magnet synchronous motor control system according to claim 1, characterized in that: The spreading parameter optimization module performs an optimization process on the first spreading unit and the second spreading unit by using an immune algorithm, including:
101. Use the transition probability and random gain as single antibodies to establish an antibody population. Set the range of random gain R to [1000, 2000] and the range of transition probability P to [0.5, 1] as the antibody value range.
102. The following formula is used to construct an evaluation target model corresponding to different permanent magnet synchronous motor output current waveform spectra for each antibody value in the population: y=1 / f(P,R) In the formula, f is the selected permanent magnet synchronous motor model, and y is the inverse of the current spectrum peak value of the motor model under the set of variables R and P; 103. Calculate the antibody population affinity value according to the evaluation target model using the following formula for the antibody population; aff(n)=y=1 / f(a n ) Where n is the number of iterations of the immune algorithm, an is the antibody at the nth iteration, and aff(n) is the affinity corresponding to antibody an; 104. By comparing each antibody with the antibody with the highest affinity value in the obtained antibody population in each iteration, the optimal affinity value of the antibody population is obtained; that is: Among them, affmax is the antibody with the highest affinity, and affopt is the global optimal antibody affinity; 105. Determine whether the number of iteration steps is met according to the following conditions: if the maximum number of iteration steps is met, stop the optimization algorithm and output the result; otherwise, continue to iterate; Among them, N is the maximum number of iterations, aopt is the global optimal antibody, representing the best spreading parameter group, and Algorithmout is the final output result of the immune algorithm; 106. Perform immune selection on the antibody population: select high-quality antibodies for cloning according to the optimal affinity value of the antibody population, and perform mutation processing on the cloned antibodies according to the following formula to obtain a mutant antibody population; C=clone(m,b n ) Where bn is the selected high-quality antibody, m is the number of antibody clones, clone(bn) is a set of m clones identical to bn, and C is the cloned antibody population; Where cn is the cloned antibody, δ is the defined neighborhood range, rand is the function that generates random numbers in the range of (0,1), pm is the mutation probability, and D is the antibody population that has undergone the mutation operation; 107. Antibody population update: introduce high-value affinity antibodies from the variant antibody population to replace low-value affinity antibodies to obtain an updated population, and send the updated population to step 102 to continue iteration.
3. The method for controlling a permanent magnet synchronous motor according to claim 1, characterized in that: The steps include: S1. Combine the immune algorithm to optimize the two random parameters of transfer probability and random gain, where:
101. Use the transfer frequency and random gain as single antibodies to establish an antibody population. Set the range of random gain R to [1000, 2000] and the range of transfer probability P to [0.5, 1] as the antibody value range.
102. The following formula is used to construct an evaluation target model corresponding to different permanent magnet synchronous motor output current waveform spectra for each antibody value in the population: y=1 / f(P,R) (1) In the formula, f is the selected permanent magnet synchronous motor model, and y is the inverse of the current spectrum peak value of the motor model under the set of variables R and P; 103. Calculate the antibody population affinity value by evaluating the target model according to the following formula for the antibody population; aff(n)=y=1 / f(a n ) Where n is the number of iterations of the immune algorithm, an is the antibody at the nth iteration, and aff(n) is the affinity corresponding to antibody an; 104. By comparing each antibody with the antibody with the highest affinity value in the obtained antibody population in each iteration, the optimal affinity value of the antibody population is obtained; that is: Among them, affmax is the antibody with the highest affinity, and affopt is the global optimal antibody affinity; 105. Determine whether the number of iteration steps is met according to the following conditions: if the maximum number of iteration steps is met, stop the optimization algorithm and output the result; otherwise, continue to iterate; Among them, N is the maximum number of iterations, aopt is the global optimal antibody, representing the best spreading parameter group, and Algorithmout is the final output result of the immune algorithm; 106. Perform immune selection on the antibody population: select high-quality antibodies for cloning according to the optimal affinity value of the antibody population, and perform mutation processing on the cloned antibodies according to the following formula to obtain a mutant antibody population; C=clone(m,b n ) Where bn is the selected high-quality antibody, m is the number of antibody clones, clone(bn) is a set of m clones identical to bn, and C is the cloned antibody population; Where cn is the cloned antibody, δ is the defined neighborhood range, rand is the function that generates random numbers in the range of (0,1), pm is the mutation probability, and D is the antibody population that has undergone the mutation operation; 107. Antibody population update: introducing high-value affinity antibodies from the variant antibody population to replace low-value affinity antibodies to obtain an updated population, and sending the updated population to step 102 to continue iteration; S2. In the case of the optimal solution of random numbers, random parameter values are generated based on the two-state Markov chain generation principle, and a triangular carrier signal with a randomly changing period is generated according to the random switching frequency formula, that is: The formula for random switching frequency is: f s =f0+R·s In the formula, f s is the randomized carrier frequency, f0 is the fixed carrier frequency, s is a random value in the range of [-1,1], and R is the random gain parameter; S3. Compare the triangular carrier signal and the modulation wave signal to obtain a three-phase pulse signal, and send it to a three-phase voltage source inverter. Then the output three-phase alternating current is supplied to the permanent magnet synchronous motor to provide power.