Disclosure of Invention
Aiming at the problems in the prior art, the invention provides a permanent magnet synchronous motor parameter identification method which can improve the local searching capability on the basis of global optimization of parameter identification results, and has the advantages of short searching time, high convergence speed and high precision.
The technical scheme provided by the invention is as follows:
In a first aspect, the present application provides a method for identifying parameters of a permanent magnet synchronous motor, including the following steps:
The method comprises the steps of determining an adaptability function of a modified genetic algorithm based on a mathematical model of the permanent magnet synchronous motor in a d-q axis coordinate system, and carrying out parameter identification on the permanent magnet synchronous motor by using the modified genetic algorithm, wherein the modified genetic algorithm means that a result of the genetic algorithm is optimized once by adopting a quasi-Newton method every X generation of evolution of the genetic algorithm.
Further, for a Surface-mounted permanent magnet synchronous motor (SPMSM), a mathematical model thereof in a d-q axis coordinate system is established according to the following method:
(1) The d-q axis voltage equation of the permanent magnet synchronous motor is as follows:
(2) For SPMSM, it can be approximately considered that L d=Lq =l, so from the d-q axis voltage equation of the permanent magnet synchronous motor, the current equation of SPMSM can be derived as:
Wherein u d is d-axis voltage, u q is q-axis voltage, i d is d-axis current, i q is q-axis current, R s is stator resistance, ω e is electrical angular velocity, L d is d-axis inductance, L q is q-axis inductance, and ψ f is permanent magnet flux linkage;
(3) The current equation of the SPMSM is approximated and discretized by Pade, and a d-q axis current discrete state equation of the SPMSM can be obtained:
id(k)=θ1id(k-1)+θ2[ωe(k)iq(k)+ωe(k-1)iq(k-1)]+θ3[ud(k)+ud(k-1)]
iq(k)=θ1iq(k-1)-θ2[ωe(k)id(k)+ωe(k-1)id(k-1)]+θ3[uq(k)+uq(k-1)]+θ4[ωe(k)+ωe(k-1)]
Wherein:
Wherein i d (k) is the actual value of d-axis current of the permanent magnet synchronous motor at the moment k, i d (k-1) is the actual value of d-axis current of the permanent magnet synchronous motor at the moment k-1, i q (k) is the actual value of q-axis current at the moment k-1, i q (k-1) is the actual value of q-axis current at the moment k-1, u d (k) is the actual value of d-axis voltage at the moment k, u d (k-1) is the actual value of d-axis voltage at the moment k-1, u q (k) is the actual value of q-axis voltage at the moment k, u q (k-1) is the actual value of q-axis voltage at the moment k-1, ω e (k) is the actual value of electrical angular velocity at the moment k-1, ω e (k-1) is the actual value of electrical angular velocity at the moment k-1, T s is the sampling period, and k is the sampling moment number;
The parameter values of R s, L and psi are reversibly deduced from theta 1,θ2,θ3,θ4;
Wherein:
(4) Designing a d-q axis current discrete state equation of the SPMSM as a motor reference model, and then designing an SPMSM adjustable model as follows:
Wherein: is the d-axis current estimated value of the permanent magnet synchronous motor at the moment k, Is the q-axis current estimated value of the permanent magnet synchronous motor at the moment k,Respectively, an estimate of theta 1,θ2,θ3,θ4.
Specifically, the parameter identification of the permanent magnet synchronous motor by using the improved genetic algorithm comprises the following steps:
a) Population initialization, namely setting an evolution algebra counter m=1, setting a maximum evolution algebra M max, and randomly generating M individuals as an initial population P (M);
b) Individual evaluation, namely calculating the fitness of each individual in the population P (m);
c) Genetic operation is carried out on the population P (m), including selection, crossing and mutation, so as to obtain a next generation population P (m+1);
d) Judging whether the evolution algebra is a multiple of X, if so, adopting a quasi-Newton method to perform local search on individuals in the current population, otherwise, turning to the step e);
e) Judging whether a termination condition is met, if so, outputting an individual with the maximum fitness function value obtained by searching in the evolution process as an optimal solution, and terminating calculation, otherwise, making m=m+1, and returning to the step b).
Since genetic algorithms cannot directly handle parameters of the problem space, it is necessary to represent a viable solution of the problem as individuals (or chromosomes) in genetic space by encoding. Common coding methods are bit string coding, grey coding, real coding, etc. The real number coding can directly operate the genetic algorithm on the phenotype of the solution without numerical conversion, so that the operation time of the genetic algorithm can be saved, and the method has definite physical significance. In the present application, the improved genetic algorithm uses real number coding.
In said step a), the population is initialized, including some initial parameters given the improved genetic algorithm, such as initial population generation interval (i.e. problem solution space), population size, individual length, maximum evolutionary algebra, etc. The initial population generation interval is uniformly sampled, and M individuals are generated as initial populations in the interval.
Further, in the initial population generation interval, individuals in the initial population are randomly generated through the chaotic search system. The chaos search is based on ergodic property and randomness, and the global searching capability of the algorithm can be enhanced.
Further, the fitness function of the improved genetic algorithm is determined by:
Sampling 5 parameters of d-axis voltage, d-axis current, q-axis voltage, q-axis current and electric angular speed of the permanent magnet synchronous motor, wherein the number of sampling points is N, estimating the d-axis current and the q-axis current of the permanent magnet synchronous motor through an SPMSM adjustable model on each sampling point, and calculating the error square sum of a current estimated value and a true value to obtain an objective function of an improved genetic algorithm, wherein the objective function is as follows:
wherein E (θ i) is an individual I=1, 2,3,4, i d (k) is the actual value of the d-axis current of the permanent magnet synchronous motor at time k, i q (k) is the actual value of the q-axis current at time k,Is the d-axis current estimated value of the permanent magnet synchronous motor at the moment k,The current estimation value of the q axis of the permanent magnet synchronous motor at the moment k;
The fitness function is a standard for distinguishing the quality of individuals in the population, is the only basis for natural selection, and takes the reciprocal of the objective function as the fitness function of the individuals in the improved genetic algorithm. The smaller the objective function value, the larger the fitness function value, and the better the individual. In the application, the fitness function is set as follows:
Wherein Fitness (θ i) is an individual I=1, 2,3, 4.
When the solution vector [ theta 1,θ2,θ3,θ4 ] of different individuals in the generation is brought into the objective function, the objective function values of the different individuals are obtained, and then the fitness function values of the different individuals are obtained. Different individuals in the generation are screened by the fitness function value, and the individual with the largest fitness function value is the best individual in the generation, namely the optimal solution in the generation.
After the population is initialized, the fitness function is used as a standard for distinguishing the quality of individuals in the population. And selecting excellent individuals from the old population to form a new population with a certain probability so as to reproduce the next generation of individuals. In the application, the improved genetic algorithm selects the roulette method for selection operation, the selected probability of an individual is related to the fitness value, and the higher the fitness value of the individual is, the higher the selected probability is. Individuals are randomly selected from individuals, and the excellent characteristics of the father are inherited to the offspring through the exchange combination of the two individuals, so that new excellent individuals are generated. In order to maintain population diversity, individuals are randomly selected from the population for mutation operation to obtain more excellent individuals.
Further, in the step c), an elite protection strategy is adopted, that is, the individuals with the fitness function value of the current population ranked M 1 do not participate in the crossover and mutation links, so that the good individuals are protected from being destroyed, and the convergence speed of the algorithm is increased.
Optionally, M 1 =5 is set.
Further, in the traditional genetic algorithm, the crossover probability p c and the variation probability p m are constant, and in the iterative process of the improved genetic algorithm, the crossover probability and the variation probability in the genetic algorithm are dynamically adjusted by adopting a segmentation optimization strategy, so that different crossover probabilities p g and variation probabilities p m are set for different individuals in the genetic algorithm population iteration, the convergence speed of the genetic algorithm is increased, the overall optimal point is achieved more quickly, and the performance of the algorithm is improved. For individuals with fitness function values smaller than the average fitness function value of the population, a larger cross probability value p c is set to enhance the global searching capability of the algorithm, and a larger variation probability value p m is set to generate excellent individuals. And setting a smaller cross probability value p c and a smaller variation probability value p m for individuals with fitness function values higher than the average fitness function value in the population, so as to keep excellent individuals in the iterative process of the genetic algorithm and accelerate the convergence rate of the algorithm. In addition, the crossover probability p c and the variation probability p m are dynamically adjusted according to the increase of the iteration times, so that the convergence speed of the algorithm is increased, and the global optimal solution about the nonlinear equation set is obtained.
In step c) of the present application, the formula for segment optimization in the improved genetic algorithm is as follows:
Wherein p c is crossover probability, p m is mutation probability, F is the fitness function value of each individual, F avg is the average fitness function value of all individuals in the current population, p cmax is the maximum crossover probability, p cmin is the minimum crossover probability, p mmax is the maximum mutation probability, p mmin is the minimum mutation probability, m is the current evolution algebra (iteration number) of the genetic algorithm, and m max is the maximum evolution algebra of the genetic algorithm.
Optionally, p cmax=0.99,pmmax=0.1,pcmin=0.4,pmmin = 0.001 is set.
Further, the application improves the traditional genetic algorithm, adds a elimination operator, namely, in each generation of evolution process, after the crossover and mutation operations are completed, M 'new individuals are generated through a chaotic search system, the fitness function value of the newly generated individuals is calculated, the newly generated fitness function value is compared with the individuals at M' positions after the ranking of the fitness function values in the generation of population, the individuals at M 'positions after the ranking are eliminated in the 2M' individuals, and the individuals at M 'positions before the ranking in the 2M' individuals are supplemented into the population. By adding the elimination operator, the convergence speed of the traditional genetic algorithm can be increased, and the global searching capability of the traditional genetic algorithm can be enhanced.
The method for generating M 'new individuals through the chaotic search system comprises the following steps of randomly generating x (1) in a (0, 1) interval, generating y (t) according to a Logistic mapping formula y (t+1) =μy (t) (1-y (t)) of the chaotic system, wherein t=2, 3, M':
wherein mu epsilon (0, 4) is a system control coefficient, when mu=4, the system is in a complete chaotic state, and y (t) can not repeatedly traverse uniformly in a (0, 1) interval;
Based on y (t), t=1, 2, [ M '], Z (t) is generated using the following formula, t=1, 2, ··, M';
Z(t)=Zmin+y(t)·(Zmax-Zmin)
Wherein [ Z min,Zmax ] is the search upper and lower bounds of Z (i.e., solution space);
And obtaining values of the R s, L and psi of the M ' group by the method, so as to obtain values of the solution vector [ theta 1,θ2,θ3,θ4 ] of the M ' group, namely M ' new individuals.
Alternatively, M' =5 is set.
And when the termination condition is met, namely the current evolution algebra is equal to the maximum evolution algebra, namely m=m max, or the convergence condition is met, terminating the search, and taking an individual with the maximum fitness value obtained by searching in the evolution process as an optimal solution to be output.
The convergence condition is that an accuracy threshold epsilon is set, and when the difference between the maximum value of the individual fitness function in the mth generation population and the maximum fitness function value of the individual in the mth-1 generation population is smaller than the accuracy threshold epsilon, the 3 parameters (R s, L, phi) are considered to be correctly estimated, so that the convergence condition is met.
The convergence conditions are:
maxFitnessm-maxFitnessm-1<ε
wherein epsilon is a given precision threshold;
The present application sets the maximum evolutionary algebra m max of the improved genetic algorithm to 300. Considering that if the improved genetic algorithm does not meet the convergence condition in the iteration process, in order to reduce the calculated amount of the algorithm, the maximum iteration number of the algorithm is set to 300, the improved genetic algorithm is not iterated all the time, the algorithm is caused to fall into a dead loop, and if the algorithm can not reach the termination condition after the 300 th iteration, an individual with the maximum fitness value obtained in the search process is used as an optimal solution to be output. Meanwhile, the maximum iteration times are set to 300 times in consideration of the fact that the improved genetic algorithm generally achieves convergence before 300 iterations, namely the algorithm termination condition is met, so that the algorithm can be continuously carried out to obtain an optimal solution.
In the application, the genetic algorithm searches for the optimal solution by quasi-Newton method every time of iteration X times. The larger the X is, the smaller the operation amount of the algorithm is, and the weaker the local searching capability of the improved genetic algorithm is. The smaller X is, the larger the calculation amount of the algorithm is, and the stronger the local searching capability of the improved genetic algorithm is.
Preferably, x=5 is set. When x=5, the improved genetic algorithm can have stronger local searching capability while reducing the calculation amount of the algorithm.
Every evolution of the traditional genetic algorithm is performed for X generations, individuals in the population are locally searched by the probability p g through sampling quasi-Newton method, and each individual does not need to be locally searched by quasi-Newton method, so that the calculated amount of the improved genetic algorithm is reduced, the convergence speed of the genetic algorithm is increased, and the solving precision of the genetic algorithm is improved.
The quasi-Newton method local search is carried out on individuals in the population with probability p g, namely the result obtained by the genetic algorithm is used as an initial value, the quasi-Newton method local search is carried out, and more excellent new individuals are generated through the local search and added into the population. And (3) carrying out quasi-Newton method local search on each individual in the population by using the probability p g every time the traditional genetic algorithm evolves for X generations, and carrying out quasi-Newton method local optimal point search on the individual in the population as an initial value to obtain more excellent individual so as to update the population. Because the quasi-Newton method needs an initial value which is close to the global optimal solution to achieve good local searching capability, the genetic algorithm should be provided with a smaller probability p g for carrying out quasi-Newton method local searching on the individual in the early stage, the local searching capability of the algorithm should be enhanced in the later stage, and the probability p g for carrying out quasi-Newton method local searching on the individual should be gradually increased, so that the algorithm converges to the global optimal solution as soon as possible. The application dynamically adjusts p g by a sectional optimization strategy, sets the probability of local search of quasi-Newton method as p gmin for individuals with fitness function value smaller than the average fitness function value of the population, dynamically adjusts p g for individuals with fitness function value larger than the average fitness function value of the population, gradually increases p g with the increase of iteration times, and enhances the local search capability of the improved genetic algorithm. The formula of the segmentation optimization of the probability p g is as follows:
Wherein p g is the probability of carrying out quasi-Newton local search on an individual, p gmax is the maximum value of p g and the maximum search probability, p gmin is the minimum value of p g, namely the minimum search probability, F is the fitness function value of the corresponding individual, F avg is the average fitness function value of all individuals in the current population, m is the current evolutionary algebra of the genetic algorithm, m max is the maximum evolutionary algebra of the genetic algorithm, p gmin is set to 0.4, p gmax is set to 1.0, and m max is set to 300.
Optionally, p gmin = 0.4 is set.
The method adopts quasi-Newton method to search the individual U in the current population locally, and comprises the following steps:
1) Setting an accuracy threshold value (iteration termination allowable error value) larger than 0, setting the current iteration number of the quasi-Newton algorithm as h=0 and the maximum iteration number as H, initializing an approximate matrix B h of a Hessian matrix in the Newton method as an identity matrix;
2) Determining a search direction d (h) in the h iteration process of the quasi-Newton method:
Wherein B h is an approximate matrix of a Hessian matrix in Newton's method, In order to obtain a gradient of f (x) at x (h)=[θ1 (h),θ2 (h),θ3 (h),θ4 (h), the search direction is the direction pointing to the optimal point of the function, wherein f (x) is a nonlinear equation set for the quasi-Newton method local search;
3) Determining an optimal search step lambda (h) in the h iteration process:
Bringing x (h)+λd(h) into f (x), and letting f (x) =0, obtaining the optimal search step lambda (h);
4) And calculating to obtain the parameter identification value of the permanent magnet synchronous motor by applying a quasi-Newton method iteration formula, wherein the iteration formula is as follows:
x(h+1)=x(h)+λ(h)d(h)
I.e.
5) Judging whether an iteration termination condition is met, if so, taking the current solution x (h+1) as the optimized solution output of the individual U, and terminating the algorithm, otherwise, entering the step 8;
6) Iteration of the approximate matrix B h of the Hessian matrix in newton's method is performed according to the following formula:
Wherein s h=λ(h)d(h) is the difference between the solution of the h+1th time and the solution of the h time;
7) Let h=h+1, return to step 2).
The quasi-Newton method approximates the inverse matrix of the Hessian matrix in Newton method by using the matrix which does not contain the second derivative, so that the Hessian matrix and the inverse matrix thereof do not need to be calculated, and the calculation complexity is reduced. The quasi-Newton method adopts the BFGS method, and correspondingly, the formula in the step 6) is adopted as an iterative formula of an approximate matrix of the Hessian matrix in the Newton method.
Further, the iteration termination condition, that is, the current iteration number is equal to the maximum iteration number, that is, h=h, or the set accuracy condition is satisfied.
The set accuracy condition means that the difference between the solution x (h+1) obtained by the h+1th iteration process of the quasi-Newton method and the solution x (h) obtained by the h iteration process is smaller than the set accuracy thresholdI.e.
Further, in the step 2), the nonlinear equation set f (x) for the quasi-newton method local search is obtained according to the following method:
The application aims at the problem that a nonlinear equation set is needed to be provided for solving a quasi-Newton method, and the state equation of a permanent magnet synchronous motor is under-ranked, and lacks a nonlinear equation set which can be used for solving the quasi-Newton method, and the nonlinear equation set of the permanent magnet synchronous motor which can be used for solving the quasi-Newton method is obtained by sampling current values at different moments according to the d-q axis current discrete state equation, specifically, the d-axis voltage, the d-axis current, the q-axis voltage, the q-axis current and the electric angular velocity of the permanent magnet synchronous motor at corresponding moments are collected, and the d-q axis current discrete state equation is obtained by:
Wherein let t 2 be the current time, t 1=t2-1;t4 be the historical time, and t 4≠t2,t3=t4 -1, let
Let x= [ θ 1,θ2,θ3,θ4 ] be the solution vector of the nonlinear equation set, the nonlinear equation set for the quasi-newton local search can be described as:
Taking the result obtained by each evolution X of the traditional genetic algorithm as the initial value of the nonlinear equation set solution vector, performing Taylor expansion at the initial value X (0)=[θ1 (0),θ2 (0),θ3 (0),θ4 (0), and taking the linear term to obtain the following:
Wherein:
according to the nonlinear equation set, an individual optimization solution can be obtained according to the iteration step of the quasi-Newton method.
When the allowable iteration error value (precision threshold) is closer to 0, the solving precision of the quasi-Newton method is higher, but the iteration times of the quasi-Newton method are increased, the operation amount of the algorithm is increased, and therefore the proper precision threshold is selected in consideration of the balance between the solving precision and the operation amount of the algorithm.
Further, the present application sets the maximum number of iterations K of the quasi-newton method to 200. Considering that if the quasi-Newton method does not meet the algorithm termination condition in the iteration process, in order to reduce the calculated amount of the algorithm, the maximum iteration number of the algorithm is set to 200 times, the quasi-Newton method is not iterated all the time, the algorithm is put into a dead loop, and if the algorithm can not meet the termination condition after the 200 th iteration, the result obtained by the 200 th iteration is updated into the population as an optimal solution. Meanwhile, the quasi-Newton algorithm generally reaches the algorithm termination condition before 200 iterations, so that the maximum iteration number is set to 200 times, and the algorithm can be ensured to be continuously carried out so as to obtain an optimal solution.
And (3) obtaining the required parameter identification values of R s, L and psi by inverse pushing by the solution x= [ theta 1,θ2,θ3,θ4 ] of the nonlinear equation set. And adding more excellent individuals searched by the quasi-Newton method into the population to complete the updating of the population.
In a second aspect, the present application further provides an electronic device, including a memory and a processor, where the memory stores a computer program, and when the computer program is executed by the processor, the processor implements the method for identifying parameters of a permanent magnet synchronous motor.
In a third aspect, the present application further provides a computer readable storage medium, on which a computer program is stored, the computer program implementing the above-mentioned permanent magnet synchronous motor parameter identification method when executed by a processor.
The beneficial effects are that:
1. The method combines the genetic algorithm and the quasi-Newton method for parameter identification, wherein the genetic algorithm adopts selection, intersection and mutation operators for searching, has strong robustness, strong global searching capability and can be suitable for various occasions, wherein the quasi-Newton method has strong local searching capability, can make up the defect of poor local searching capability of the traditional genetic algorithm, is second-order convergence, has high algorithm convergence speed, simultaneously has the advantages of the two algorithms, can improve the local searching capability on the basis of global optimum parameter identification results, has the advantages of short searching time, high convergence speed, high precision, suitability for various occasions and the like, and is not influenced by parameters and models.
2. The application improves the crossing and variation links in the genetic algorithm, dynamically adjusts the crossing probability value and variation probability value in the iterative process of the genetic algorithm by adopting a sectional optimization strategy according to the change condition of the fitness function value of each individual in the iterative process, and if the fitness function value of each individual is smaller than the average fitness function value of the population, sets a larger crossing probability value p c for the individual to enhance the global searching capability of the algorithm, and sets a larger variation probability value p m for the individual to generate excellent individuals. If the individual fitness function value is greater than the population average fitness function value, dynamically adjusting the cross probability value p c and the variation probability value p m of the individual, and reducing the cross probability value p c and the variation probability value p m along with the increase of the iteration times of the genetic algorithm so as to keep the excellent individual generated in the iteration process. The convergence rate of the genetic algorithm can be increased by adopting a sectional optimization strategy.
3. On the basis of a crossover operator and a mutation operator of the traditional genetic algorithm, an elimination operator is newly added, M 'new individuals are generated through a chaotic search system, the fitness function value of the newly generated individuals is calculated, the newly generated fitness function value is compared with the individuals with M' positions after the ranking of the fitness function values in the generation of population, the M 'names after the ranking of the fitness function values in the 2M' individuals are eliminated, and the individuals with M 'names before the ranking of the fitness function values in the 2M' individuals are supplemented into the population. Because the chaos phenomenon has ergodic property and randomness, the chaos search is introduced into the genetic algorithm, the ergodic property can lead individuals in the population to spread over the whole interval, the randomness can lead the algorithm to break loose local optimal values to trend to global optimal values, the improvement of the algorithm can accelerate the convergence rate of the traditional genetic algorithm, and the global search capability of the traditional genetic algorithm is enhanced.
4. Based on a genetic algorithm, the application adds a means for carrying out local search on individuals in the population by using the quasi-Newton method as a population updating means so as to improve the local search performance.
5. The application aims at the problem that a nonlinear equation set for solving the quasi-Newton method is needed to be provided for solving the quasi-Newton method, and the state equation of a permanent magnet synchronous motor is of an underrank type, and lacks a nonlinear equation set for solving the quasi-Newton method.
6. Each time the traditional genetic algorithm evolves for X generations, a quasi-newton method local search is performed on each individual in the population with a different probability p g. And dynamically adjusting the probability p g of carrying out quasi-Newton local search on each individual by adopting a strategy of segment optimization according to the condition that the fitness function value of each individual changes in the evolution process. Because the quasi-Newton method needs an initial value which is close to the global optimal solution to realize good local searching capability, if the individual fitness function value is smaller than the population average fitness function value, a smaller p g is set for the individual, so that the quasi-Newton method local searching is not carried out on a large number of individuals, and the operand of the improved genetic algorithm is reduced. If the individual fitness function value is larger than the population average fitness function value, the probability p g of carrying out quasi-Newton local search on each individual is dynamically adjusted, and at the moment, along with the increase of the evolution algebra, the probability p g of carrying out quasi-Newton local search on the individual is increased so as to enhance the later local search capacity of the genetic algorithm, accelerate the convergence rate of the genetic algorithm and improve the solving precision of the genetic algorithm.
Detailed Description
The present invention will be described in further detail with reference to the drawings and the detailed description.
Referring to fig. 1, the embodiment takes a permanent magnet synchronous motor as an SPMSM as an example, and provides a parameter identification method for the permanent magnet synchronous motor, which includes the following steps:
step one, referring to fig. 2, a mathematical model is built for the SPMSM,
The d-q axis voltage equation is:
For SPMSM, approximately consider L d=Lq =l, and the permanent magnet synchronous motor current equation derived from the d-q axis voltage equation is:
Wherein u d is d-axis voltage, u q is q-axis voltage, i d is d-axis current, i q is q-axis current, R s is stator resistance, ω e is electrical angular velocity, L d is d-axis inductance, L q is q-axis inductance, and ψ f is permanent magnet flux linkage;
The d-q axis current discrete state equation of the SPMSM can be obtained by approximating and discretizing a current equation of the permanent magnet synchronous motor by using Pade:
id(k)=θ1id(k-1)+θ2[ωe(k)iq(k)+ωe(k-1)iq(k-1)]+θ3[ud(k)+ud(k-1)]
iq(k)=θ1iq(k-1)-θ2[ωe(k)id(k)+ωe(k-1)id(k-1)]+θ3[uq(k)+uq(k-1)]+θ4[ωe(k)+ωe(k-1)]
Wherein:
i d (k) is the actual value of the d-axis current of the permanent magnet synchronous motor at the time k, i d (k-1) is the actual value of the d-axis current of the permanent magnet synchronous motor at the time k-1, i q (k) is the actual value of the q-axis current at the time k-1, i q (k-1) is the actual value of the q-axis current at the time k-1, u d (k) is the actual value of the d-axis voltage at the time k, u d (k-1) is the actual value of the d-axis voltage at the time k-1, u q (k) is the actual value of the q-axis voltage at the time k, u q (k-1) is the actual value of the q-axis voltage at the time k-1, ω e (k) is the actual value of the electrical angular velocity at the time k-1, ω e (k-1) is the actual value of the electrical angular velocity at the time k-1, T s is the sampling period, and k is the sampling time sequence number;
The parameter values of R s, L and psi are reversibly deduced from theta 1,θ2,θ3,θ4;
Wherein:
Setting an objective function and an fitness function;
Referring to fig. 3, the d-q axis current discrete state equation is designed as a motor reference model, and the SPMSM tunable model is:
Wherein: is the d-axis current estimated value of the permanent magnet synchronous motor, Is the q-axis current estimated value of the permanent magnet synchronous motor, Estimated values of θ 1,θ2,θ3,θ4 respectively;
Sampling 5 parameters of d-axis voltage, d-axis current, q-axis voltage, q-axis current and motor rotating speed of the permanent magnet synchronous motor, wherein the sampling number is N, estimating the d-axis current and the q-axis current of the permanent magnet synchronous motor through an SPMSM adjustable model on each sampling point, and calculating the error square sum of a current estimated value and a true value to obtain an objective function of an improved genetic algorithm, wherein the objective function is as follows:
Wherein i d (k) is the actual value of the d-axis current of the permanent magnet synchronous motor at the moment k, i q (k) is the actual value of the q-axis current of the permanent magnet synchronous motor at the moment k, Is the d-axis current estimated value of the permanent magnet synchronous motor at the moment k,The current estimation value of the q axis of the permanent magnet synchronous motor at the moment k;
the fitness function is a standard for distinguishing the quality of individuals in the population, is the only basis for natural selection, and takes the reciprocal of the objective function value as the fitness value of the individuals in the improved genetic algorithm. The smaller the objective function value, the larger the fitness value, and the better the individual. The fitness function is:
wherein E (θ i) is an individual I=1, 2,3, 4.
The values of R s, L and psi are continuously searched and changed through improving a genetic algorithm, an accuracy threshold epsilon is set, and when the difference between the maximum value of the individual fitness function in the mth generation population and the maximum fitness function value of the individual in the mth-1 generation population is smaller than the accuracy threshold epsilon, 3 parameters are considered to be correctly estimated;
namely, the improved genetic algorithm convergence condition is as follows:
maxFitnessm-maxFitnessm-1<ε
wherein epsilon is a given precision threshold;
initializing a population;
Since genetic algorithms cannot directly handle parameters of the problem space, it is necessary to represent a viable solution of the required problem as individuals or individuals of the genetic space by encoding. Common coding methods are bit string coding, grey coding, real coding, etc. The real number coding can directly operate the genetic algorithm on the phenotype of the solution without numerical conversion, so that the operation time of the genetic algorithm can be saved, and the method has definite physical significance. The improved genetic algorithm adopts real number coding.
The initial population generation interval is uniformly sampled, and a certain number of individuals are generated in the initial population generation interval. Some initial parameters of the improved genetic algorithm are given, such as initial population generation interval, population size, individual length, algebra of evolution.
Referring to fig. 4, utilizing a quasi-newton method and a genetic algorithm to mix and search for a global optimal point of parameter identification, and accurately estimating parameter values of R s, L and psi;
After the population is initialized, the fitness function is used as a standard for distinguishing the quality of individuals in the population. And selecting excellent individuals from the old population to form a new population with a certain probability so as to reproduce the next generation of individuals. The improved genetic algorithm selects a roulette method for selection operation, the selected probability of an individual is related to the fitness value, and the higher the fitness value of the individual is, the higher the selected probability is. Two individuals are randomly selected from the individuals, and the excellent characteristics of the father are inherited to the offspring through the exchange combination of the two individuals, so that new excellent individuals are generated. In order to maintain population diversity, one individual is randomly selected from the population for mutation operation to obtain more excellent individuals. Every 5 generations of the traditional genetic algorithm evolves, the obtained result is used as an initial value, the quasi-Newton method local search is carried out, and more excellent new individuals are generated through the local search and added into the population. The specific steps of updating the population by the quasi-Newton method are as follows:
① And setting an accuracy threshold value larger than 0 by taking a result obtained by a traditional genetic algorithm as an initial value of quasi-Newton iteration, wherein the maximum iteration number is 200.
② Let t 2 be the current time, t 1=t2-1;t4 be the historical time, and t 4≠t2,t3=t4 -1 by the current discrete state equation. Collecting d-axis voltage, d-axis current, q-axis voltage, q-axis current and electric angular velocity of a permanent magnet synchronous motor at corresponding moments, and introducing the d-axis voltage, d-axis current, q-axis current and electric angular velocity into a current discrete equation to obtain a nonlinear equation set for quasi-Newton method local search:
The nonlinear equation set can be described as:
let x= [ θ 1,θ2,θ3,θ4 ] be the solution vector of the nonlinear equation set, take the result of the nonlinear equation set searched every 5 generations of evolution in the traditional genetic algorithm as the initial value, perform taylor expansion at the initial value x (0)=[θ1 (0),θ2 (0),θ3 (0),θ4 (0) ], and take the linear term to obtain:
Wherein:
③ Initializing an approximate matrix B h of the Hessian matrix as an identity matrix, wherein the searching direction of the quasi-Newton method is as follows:
Wherein B h is an approximate matrix of a Hessian matrix in Newton's method, To gradient f (x) at x (h)=[θ1 (h),θ2 (h),θ3 (h),θ4 (h), the search direction is the direction pointing to the function's optimal point;
determining an optimal search step lambda (h):
Bringing x (h)+λd(h) into f (x), and letting f (x) =0, obtaining the optimal search step lambda (h);
The iterative formula for the approximation matrix B h of the Hessian matrix is:
Wherein s h=λ(h)d(h) is the difference between the solution of the h+1th time and the solution of the h time;
④ And calculating to obtain the parameter identification value of the permanent magnet synchronous motor by applying a quasi-Newton method iteration formula, wherein the iteration formula is as follows:
And (3) obtaining the required parameter identification values of R s, L and psi by inverse pushing by the solution x= [ theta 1,θ2,θ3,θ4 ] of the nonlinear equation set. And adding more excellent individuals searched by the quasi-Newton method into the population to complete the updating of the population.
And finally, evaluating the adaptability of the new population, judging whether the new population is converged, and if the new population is not converged, improving the genetic algorithm operation until the new population is converged.
The embodiment also provides an electronic device, which comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor realizes the permanent magnet synchronous motor parameter identification method.
The present embodiment also provides a computer readable storage medium having a computer program stored thereon, which when executed by a processor, implements the above-described permanent magnet synchronous motor parameter identification method.
In summary, the method, the electronic device and the computer readable storage medium for identifying parameters of the permanent magnet synchronous motor provided by the embodiment can ensure that the motor has the advantages of short search time, high convergence speed, suitability for various occasions and the like on the basis that the parameter identification reaches the global optimum when in operation. The method provided by the invention is simple, easy to understand, easy to realize and high in accuracy, and is a feasible scheme for identifying the parameters of the permanent magnet synchronous motor.
The foregoing is only a preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art, who is within the scope of the present invention, should make equivalent substitutions or modifications according to the technical scheme of the present invention and the inventive concept thereof, and should be covered by the scope of the present invention.