Sliding mode control method, device, equipment and storage medium for permanent magnet synchronous motors
By iteratively optimizing the parameters of the sliding mode controller and using a genetic algorithm to determine the crossover and mutation probabilities, the problems of insufficient response speed and robustness of permanent magnet synchronous motors are solved, and more efficient power output control for electric vehicles is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-27
- Publication Date
- 2026-03-10
AI Technical Summary
In the existing technology, the sliding mode control method of permanent magnet synchronous motors is insufficient in terms of response speed and robustness, making it difficult to meet the high-efficiency and stable power output requirements of electric vehicles.
By iteratively optimizing the parameters of the sliding mode controller, and using a genetic algorithm to determine the crossover and mutation probabilities, more reasonable next-generation optimization parameters are generated, thereby improving the convergence speed and global search capability of the sliding mode controller.
It improves the efficiency and accuracy of the sliding mode controller's optimized parameters, enhances the control effect on the permanent magnet synchronous motor, and meets the high-efficiency and stable power output requirements of electric vehicles.
Smart Images

Figure CN118694227B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of control technology, and in particular to a sliding mode control method, device, equipment and storage medium for a permanent magnet synchronous motor. Background Technology
[0002] Permanent magnet synchronous motors (PMSMs) are a type of high-efficiency, high-precision AC motor. With technological advancements and increased environmental awareness, PMSMs are finding increasingly widespread application in the electric vehicle sector. Their use in electric vehicles effectively improves power utilization efficiency, ensures more stable and reliable power output, and enhances the driving experience.
[0003] Sliding mode control is a nonlinear control method with advantages such as fast response and good robustness, and is suitable for the control of permanent magnet synchronous motors (PMSMs). The basic idea of sliding mode control for PMSMs is to design a sliding surface so that when the state of the PMSM moves on the sliding surface, the output of the PMSM can quickly converge to the desired state. Summary of the Invention
[0004] This application provides a sliding mode control method, apparatus, device, and storage medium for a permanent magnet synchronous motor, which can improve the efficiency of travel path planning. The technical solution is as follows:
[0005] On the one hand, a sliding mode control method for a permanent magnet synchronous motor is provided, the method comprising:
[0006] The first-generation optimization parameters of the sliding mode controller are created. The first-generation optimization parameters include M sets of optimization parameters. Each set of optimization parameters includes the approach velocity parameter, sliding surface slope and sign function gain parameter of the sliding mode controller, where M is an integer greater than 1.
[0007] Determine the objective functions corresponding to the M groups of optimization parameters included in the first generation of optimization parameters;
[0008] Based on the objective functions corresponding to the M groups of optimization parameters included in the first generation of optimization parameters, the objective group of optimization parameters included in the first generation of optimization parameters is determined, and the objective function corresponding to the objective function of the objective function corresponding to the optimization parameter in the first generation of optimization parameters is the minimum value among the objective functions corresponding to the optimization parameters in the first generation of optimization parameters.
[0009] Based on the objective function corresponding to the M sets of optimization parameters included in the first generation of optimization parameters, the fitness of the M sets of optimization parameters included in the first generation of optimization parameters is determined, and the fitness of any set of optimization parameters is used to represent the ability of the set of optimization parameters to adapt to the sliding mode controller.
[0010] Based on the fitness of the M groups of optimization parameters included in the first generation of optimization parameters, the crossover probability and mutation probability corresponding to the M groups of optimization parameters included in the first generation of optimization parameters are determined respectively. The crossover probability and mutation probability corresponding to the optimization parameters of any group are used to represent the probability that the group of optimization parameters is retained in the next generation of optimization parameters.
[0011] Based on the crossover probability and mutation probability corresponding to the M sets of optimization parameters included in the first generation of optimization parameters, the next generation of optimization parameters for the sliding mode controller is generated, including the M sets of optimization parameters.
[0012] Based on the M sets of optimization parameters included in the next generation optimization parameters, the target set of optimization parameters included in the next generation optimization parameters are determined, and the next generation optimization parameters of the sliding mode controller are generated, including the M sets of optimization parameters, until the target set of optimization parameters included in the G generation optimization parameters are determined, where G is an integer greater than 2;
[0013] Based on the target group optimization parameters included in the G-generation optimization parameters, the optimization parameters of the sliding mode controller are determined, and the sliding mode controller is optimized based on the optimization parameters of the sliding mode controller.
[0014] The permanent magnet synchronous motor is controlled based on the optimized sliding mode controller.
[0015] In one possible implementation, determining the objective functions corresponding to the M sets of optimization parameters included in the first generation of optimization parameters includes:
[0016] Based on the M sets of optimized parameters, the speed loop model corresponding to the permanent magnet synchronous motor is run to obtain M sets of output results. Each set of output results includes system error, controller output, and system output.
[0017] For each set of output results, the objective function corresponding to the output result is determined by the following formula:
[0018] Formula 1:
[0019] Where J is the objective function, e(t) is the system error, y(t) is the system output, u(t) is the controller output, and t u Let e(y(t)) = y(t) - y(t-1) be the rise time, e(y(t)) = y(t) - y(t-1) be the system output error, and ω1, ω2, ω3, and ω4 be the weights, with ω4 >> max(ω1, ω2, ω3).
[0020] In another possible implementation, the step of determining the crossover probabilities corresponding to the M groups of optimization parameters included in the first generation of optimization parameters, based on their fitness, includes:
[0021] Based on the fitness of the M groups of optimization parameters included in the first generation of optimization parameters, determine the first maximum fitness, minimum fitness, and average fitness of the fitness of the M groups of optimization parameters included in the first generation of optimization parameters.
[0022] Determine multiple sets of optimization parameters corresponding to the crossover operation, and based on the fitness of the multiple sets of optimization parameters, determine the second maximum fitness of the fitness of the multiple sets of optimization parameters;
[0023] For the group optimization parameters corresponding to the second maximum fitness of the fitness of the multiple sets of optimization parameters, the crossover probability corresponding to the group optimization parameters is determined by the following formula two based on the first maximum fitness, the minimum fitness, the average fitness, and the second maximum fitness:
[0024] Formula 2:
[0025] Among them, P c P represents the crossover probability corresponding to the optimized parameters of the group. c1 Let P be the first preset probability. c2 f is the second preset probability, f' is the second maximum fitness, f max and f min f represents the first maximum fitness and the minimum fitness, respectively. avg The average fitness is denoted as .
[0026] In another possible implementation, the step of determining the mutation probability corresponding to each of the M groups of optimization parameters included in the first generation of optimization parameters based on the fitness of the M groups of optimization parameters included in the first generation of optimization parameters includes:
[0027] Based on the fitness of the M groups of optimization parameters included in the first generation of optimization parameters, determine the first maximum fitness, minimum fitness, and average fitness of the fitness of the M groups of optimization parameters included in the first generation of optimization parameters.
[0028] For each set of optimization parameters, based on the first maximum fitness, the minimum fitness, the average fitness, and the fitness of the set of optimization parameters, the mutation probability corresponding to the set of optimization parameters is determined by the following formula three:
[0029] Formula 3:
[0030] Among them, P m P represents the mutation probability corresponding to the optimized parameters of the group. m1 For the third preset probability, P m2 Let f be the fourth preset probability, and f be the fitness of the optimized parameters of the group. max and f minf represents the first maximum fitness and the minimum fitness, respectively. avg The average fitness is denoted as .
[0031] In another possible implementation, the generation of the next-generation optimization parameters for the sliding mode controller, based on the crossover probabilities and mutation probabilities corresponding to the M sets of optimization parameters included in the first-generation optimization parameters, includes:
[0032] For each set of optimization parameters, if the crossover probability corresponding to the set of optimization parameters is less than a first probability threshold and the mutation probability corresponding to the set of optimization parameters is less than a second probability threshold, the set of optimization parameters will be used as the next generation of optimization parameters.
[0033] If the crossover probability corresponding to the group of optimized parameters is not less than a first probability threshold or the mutation probability corresponding to the group of optimized parameters is not less than a second probability threshold, the group of optimized parameters are mutated to obtain the next generation of optimized parameters.
[0034] In another possible implementation, the mutation of the set of optimization parameters to obtain the next generation of optimization parameters includes:
[0035] Based on the crossover probability and mutation probability corresponding to the M groups of optimization parameters included in the first generation of optimization parameters, the target group of optimization parameters included in the first generation of optimization parameters is determined, and the target group of optimization parameters are the optimization parameters that will be used as the next generation of optimization parameters.
[0036] The target group optimization parameters are used as reference group optimization parameters, and the next generation optimization parameters are obtained by mutating the group optimization parameters based on the first value range of the approach velocity parameter of the sliding mode controller, the second value range of the sliding surface slope, and the third value range of the gain parameter of the sign function.
[0037] On the other hand, a sliding mode control device for a permanent magnet synchronous motor is provided, the device comprising:
[0038] A creation module is used to create the first-generation optimization parameters of the sliding mode controller. The first-generation optimization parameters include M sets of optimization parameters. Each set of optimization parameters includes the approach velocity parameter, sliding surface slope, and sign function gain parameter of the sliding mode controller, where M is an integer greater than 1.
[0039] The first determining module is used to determine the objective functions corresponding to the M groups of optimization parameters included in the first generation of optimization parameters;
[0040] The second determining module is used to determine the target group optimization parameters included in the first generation optimization parameters based on the objective functions corresponding to the M groups of optimization parameters included in the first generation optimization parameters, wherein the objective function corresponding to the target group optimization parameters is the minimum value among the objective functions corresponding to the optimization parameters in the first generation optimization parameters.
[0041] The third determining module is used to determine the fitness of the M groups of optimization parameters included in the first generation of optimization parameters based on the objective function corresponding to the M groups of optimization parameters included in the first generation of optimization parameters. The fitness of any group of optimization parameters is used to represent the ability of the group of optimization parameters to adapt to the sliding mode controller.
[0042] The fourth determining module is used to determine the crossover probability and mutation probability of the M groups of optimization parameters included in the first generation of optimization parameters based on their fitness. The crossover probability and mutation probability of any group of optimization parameters are used to represent the probability that the group of optimization parameters is retained in the next generation of optimization parameters.
[0043] The generation module is used to generate the next generation optimization parameters of the sliding mode controller based on the crossover probability and mutation probability corresponding to the M sets of optimization parameters included in the first generation optimization parameters.
[0044] The fifth determining module is used to determine the target group of optimization parameters included in the next generation optimization parameters based on the M groups of optimization parameters included in the next generation optimization parameters, and to generate the M groups of optimization parameters included in the next generation optimization parameters of the sliding mode controller, until the target group of optimization parameters included in the G generation optimization parameters are determined, where G is an integer greater than 2;
[0045] The sixth determining module is used to determine the optimization parameters of the sliding mode controller based on the target group optimization parameters included in the G-generation optimization parameters, and to optimize the sliding mode controller based on the optimization parameters of the sliding mode controller;
[0046] The control module is used to control the permanent magnet synchronous motor based on the optimized sliding mode controller.
[0047] In one possible implementation, the first determining module is used to run the speed loop model corresponding to the permanent magnet synchronous motor based on the M sets of optimization parameters to obtain M sets of output results, each set of output results including system error, controller output, and system output; for each set of output results, the objective function corresponding to the output result is determined by the following formula:
[0048] Formula 1:
[0049] Where J is the objective function, e(t) is the system error, y(t) is the system output, u(t) is the controller output, and t u Let e(y(t)) = y(t) - y(t-1) be the rise time, e(y(t)) = y(t) - y(t-1) be the system output error, and ω1, ω2, ω3, and ω4 be the weights, with ω4 >> max(ω1, ω2, ω3).
[0050] In another possible implementation, the fourth determining module is configured to: determine a first maximum fitness, a minimum fitness, and an average fitness of the M groups of optimization parameters included in the first generation of optimization parameters, based on the fitness of the M groups of optimization parameters included in the first generation of optimization parameters; determine multiple groups of optimization parameters corresponding to the crossover operation; and determine a second maximum fitness of the fitness of the multiple groups of optimization parameters based on the fitness of the multiple groups of optimization parameters; for the group optimization parameters corresponding to the second maximum fitness of the fitness of the multiple groups of optimization parameters, determine the crossover probability corresponding to the group optimization parameters based on the first maximum fitness, the minimum fitness, the average fitness, and the second maximum fitness using the following formula:
[0051] Formula 2:
[0052] Among them, P c P represents the crossover probability corresponding to the optimized parameters of the group. c1 Let P be the first preset probability. c2 f is the second preset probability, f' is the second maximum fitness, f max and f min f represents the first maximum fitness and the minimum fitness, respectively. avg The average fitness is denoted as .
[0053] In another possible implementation, the fourth determining module is used to determine a first maximum fitness, a minimum fitness, and an average fitness of the M groups of optimization parameters included in the first generation of optimization parameters, based on the fitness of the M groups of optimization parameters included in the first generation of optimization parameters; for each group of optimization parameters, based on the first maximum fitness, the minimum fitness, the average fitness, and the fitness of the group of optimization parameters, the mutation probability corresponding to the group of optimization parameters is determined by the following formula three:
[0054] Formula 3:
[0055] Among them, P m P represents the mutation probability corresponding to the optimized parameters of the group. m1 For the third preset probability, P m2 Let f be the fourth preset probability, and f be the fitness of the optimized parameters of the group. max and f minf represents the first maximum fitness and the minimum fitness, respectively. avg The average fitness is denoted as .
[0056] In another possible implementation, the generation module is configured to, for each set of optimization parameters, use the set of optimization parameters as the next generation optimization parameters if the crossover probability corresponding to the set of optimization parameters is less than a first probability threshold and the mutation probability corresponding to the set of optimization parameters is less than a second probability threshold; and mutate the set of optimization parameters to obtain the next generation optimization parameters if the crossover probability corresponding to the set of optimization parameters is not less than the first probability threshold or the mutation probability corresponding to the set of optimization parameters is not less than the second probability threshold.
[0057] In another possible implementation, the generation module is used to determine the target group optimization parameters included in the first generation optimization parameters based on the crossover probability and mutation probability corresponding to the M groups of optimization parameters included in the first generation optimization parameters, wherein the target group optimization parameters are the optimization parameters to be used as the next generation optimization parameters; and to mutate the group optimization parameters to obtain the next generation optimization parameters based on the first value range of the approach velocity parameter of the sliding mode controller, the second value range of the sliding surface slope, and the third value range of the gain parameter of the sign function.
[0058] On the other hand, a sliding mode controller is provided, which includes a processor and a memory. The memory stores at least one piece of program code, which is loaded and executed by the processor to implement the sliding mode control method of the permanent magnet synchronous motor described above.
[0059] On the other hand, a computer-readable storage medium is provided, wherein at least one piece of program code is stored in the storage medium, the at least one piece of program code being loaded and executed by a processor to implement the above-described sliding mode control method for a permanent magnet synchronous motor.
[0060] On the other hand, a computer program product is provided, the product storing at least one piece of program code, the at least one piece of program code being executed by a processor to implement the above-described sliding mode control method for a permanent magnet synchronous motor.
[0061] In this embodiment, the optimization parameters of the sliding mode controller are optimized iteratively. When determining the next generation of optimization parameters during the iteration process, the crossover probability and mutation probability of the M groups of optimization parameters included in the previous generation are used. This makes the determined next generation of optimization parameters more reasonable, enabling the iterative algorithm to have a faster convergence speed and better global search capability. This improves the efficiency and accuracy of the determined optimization parameters of the sliding mode controller, and thus improves the control effect of the sliding mode controller on the permanent magnet synchronous motor based on the parameter optimization.
[0062] It should be understood that the above general description and the following detailed description are merely exemplary and do not limit this disclosure. Attached Figure Description
[0063] Figure 1 This is a schematic diagram illustrating the implementation environment of a sliding mode control method for a permanent magnet synchronous motor, as shown in an exemplary embodiment of this application.
[0064] Figure 2 This is a flowchart illustrating a sliding mode control method for a permanent magnet synchronous motor, as shown in an exemplary embodiment of this application;
[0065] Figure 3 This is a schematic diagram illustrating a sliding mode control method for a permanent magnet synchronous motor, as shown in an exemplary embodiment of this application.
[0066] Figure 4 This is a schematic diagram illustrating the change process of the minimum objective function (Best J) determined by the ordinary genetic algorithm (GA) and the improved genetic algorithm (IGA) provided in the embodiments of this application, as shown in an exemplary embodiment of this application.
[0067] Figure 5 This is a schematic diagram illustrating the system output process of a common genetic algorithm (GA) in the related art and an improved genetic algorithm (IGA) provided in the embodiments of this application, as shown in an exemplary embodiment of this application;
[0068] Figure 6 This is a schematic diagram illustrating the system error convergence process of a conventional genetic algorithm (GA) and an improved genetic algorithm (IGA) provided in the embodiments of this application, as shown in an exemplary embodiment of this application.
[0069] Figure 7 This is a schematic diagram illustrating the controller output process of a common genetic algorithm (GA) and an improved genetic algorithm (IGA) provided in the embodiments of this application, as shown in an exemplary embodiment of this application.
[0070] Figure 8This is a schematic diagram of simulated rotational speed of a PID control method and an improved genetic algorithm-based sliding mode control method (IGA-SMC) illustrated in an exemplary embodiment of this application.
[0071] Figure 9 This is a schematic diagram of the speed error curves of a PID control method and an improved genetic algorithm-based sliding mode control method (IGA-SMC) as illustrated in an exemplary embodiment of this application.
[0072] Figure 10 This is a schematic diagram of a simulated three-phase current curve of a PID control method shown in an exemplary embodiment of this application;
[0073] Figure 11 This is a schematic diagram of the simulated three-phase current curve of the sliding mode control method (IGA-SMC) based on the improved genetic algorithm, as illustrated in an exemplary embodiment of this application.
[0074] Figure 12 This is a schematic diagram of the simulated speed error curve of the PID control method shown in an exemplary embodiment of this application;
[0075] Figure 13 This is a schematic diagram of the simulated torque curve of a sliding mode control method (IGA-SMC) based on an improved genetic algorithm, as illustrated in an exemplary embodiment of this application.
[0076] Figure 14 This is a block diagram illustrating a sliding mode control device for a permanent magnet synchronous motor, as shown in an exemplary embodiment of this application.
[0077] Figure 15 This is a block diagram illustrating a sliding mode controller in an exemplary embodiment of this application. Detailed Implementation
[0078] To make the technical solution and advantages of this application clearer, the embodiments of this application will be described in further detail below.
[0079] The terms "first," "second," "third," and "fourth," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.
[0080] It should be noted that all information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.), and signals involved in this application have been authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the optimization parameters involved in this application were obtained with full authorization.
[0081] Please refer to Figure 1 This illustration shows a schematic diagram of an implementation environment for a sliding mode control method for a permanent magnet synchronous motor, as illustrated in an exemplary embodiment of this application. The implementation environment includes a sliding mode controller 101 and a permanent magnet synchronous motor 102. The sliding mode controller 101 optimizes the approach speed parameter, the sliding surface slope, and the gain parameter of the sign function. Based on the optimized sliding mode controller 101, the permanent magnet synchronous motor 102 is controlled. For example, if the permanent magnet synchronous motor 102 is used in an electric vehicle, it provides power to the electric vehicle.
[0082] Please refer to Figure 2 This document illustrates a flowchart of a sliding mode control method for a permanent magnet synchronous motor, as shown in an exemplary embodiment of this application. The implementing entity of this application is a sliding mode controller. (Refer to...) Figure 2 The method includes:
[0083] Step 201: Create the first generation of optimized parameters for the sliding mode controller. The first generation of optimized parameters includes M sets of optimized parameters. Each set of optimized parameters includes the approach velocity parameter of the sliding mode controller, the sliding surface slope, and the gain parameter of the sign function.
[0084] Before this step, parameter initialization is performed. Parameter initialization includes initializing the first value range of M, E, G, the approach velocity parameter of the sliding mode controller, the second value range of the sliding surface slope, and the third value range of the gain parameter of the sign function. Here, M is the number of sets of optimized parameters included in each generation of optimization parameters, and M is an integer greater than 1; for example, M can be 50. E is the number of parameters that the sliding mode controller needs to optimize. Since in this embodiment, the approach velocity parameter, sliding surface slope, and gain parameter of the sign function of the sliding mode controller are optimized, the value of E is 3. G is the maximum number of iterations, which can also be called the maximum generation of optimized parameters; for example, G = 150, indicating that 150 generations of optimized parameters need to be generated.
[0085] The approach velocity parameter of the sliding mode controller primarily affects the dynamic transition process of the switching function. Appropriate adjustment of the approach velocity parameter can improve the system's dynamic quality by allowing the system to return to the sliding surface at the same approach velocity as the empty system. Furthermore, a larger approach velocity parameter results in a faster system reaching the sliding surface. The sliding surface slope ensures gradual stabilization of the sliding motion and a faster dynamic response. Adjusting the sliding surface slope significantly impacts the system's settling time; a larger slope results in a faster response during the sliding motion segment and better speed. Therefore, increasing both the approach velocity parameter and the sliding surface slope can correspondingly improve the system's speed. The gain parameter of the sign function is a key parameter for overcoming perturbations and disturbances. A larger gain parameter of the sign function strengthens the system's ability to overcome parameter perturbations and external disturbances.
[0086] The first range of the approach velocity parameter, the second range of the sliding surface slope, and the third range of the gain parameter of the sign function can all be set and changed as needed. In this embodiment, the first range of the approach velocity parameter, the second range of the sliding surface slope, and the third range of the gain parameter of the sign function are not specifically limited. For example, the first range of the approach velocity parameter is [200, 400], the second range of the sliding surface slope is [200, 400], and the third range of the gain parameter of the sign function is [0, 500].
[0087] Furthermore, the first value range of the approach speed parameter, the second value range of the sliding surface slope, and the third value range of the sign function gain parameter can be set by the user or by the sliding mode controller. The steps for the sliding mode controller to set the first value range of the approach speed parameter, the second value range of the sliding surface slope, and the third value range of the sign function gain parameter can be as follows: the sliding mode controller acquires multiple historical control records for the permanent magnet synchronous motor, each historical control record including the convergence speed of the sliding mode controller and the approach speed parameter, sliding surface slope, and sign function gain parameter corresponding to that convergence speed; based on multiple historical control base classes, multiple target control records with convergence speeds less than a preset speed are determined; based on the approach speed parameter, sliding surface slope, and sign function gain parameter corresponding to the multiple target control records, the first value range of the approach speed parameter, the second value range of the sliding surface slope, and the third value range of the sign function gain parameter are determined.
[0088] In this embodiment, the accuracy of the determined first range of the approach velocity parameter, the second range of the sliding surface slope, and the third range of the gain parameter of the sign function are improved by using a sliding mode controller based on a historical control base class to determine the first range of the approach velocity parameter, the second range of the sliding surface slope, and the third range of the gain parameter of the sign function.
[0089] Accordingly, step 201 can be: based on the value of M and the first value range of the approach velocity parameter of the sliding mode controller, the second value range of the sliding surface slope, and the third value range of the gain parameter of the sign function, generate the first generation of optimized parameters for the sliding mode controller. The first generation of optimized parameters includes M sets of optimized parameters. Each set of optimized parameters includes the approach velocity parameter of the sliding mode controller, the sliding surface slope, and the gain parameter of the sign function. The approach velocity parameter of the sliding mode controller included in each set of optimized parameters is within the first value range of the approach velocity parameter. The sliding surface slope included in each set of optimized parameters is within the second value range of the sliding surface slope. The gain parameter of the sign function included in each set of optimized parameters is within the third value range of the gain parameter of the sign function.
[0090] After determining that the first-generation optimization parameters include M sets of optimization parameters, the M sets of optimization parameters included in the first-generation optimization parameters are stored in MATLAB_Workspace so that the M sets of optimization parameters included in the first-generation optimization parameters can be called from MATLAB_Workspace for subsequent processing.
[0091] Step 202: Determine the objective function corresponding to each of the M groups of optimization parameters included in the first generation of optimization parameters.
[0092] The objective function is calculated based on the time integral performance index of the absolute value of error; correspondingly, step 202 can be achieved through the following steps (1) and (2), including:
[0093] (1) Based on the M-group optimization parameters, run the speed loop model corresponding to the permanent magnet synchronous motor to obtain the M-group output results. Each group of output results includes system error, controller output and system output.
[0094] The speed loop model of the permanent magnet synchronous motor is a MATLAB_Simulink model. In this step, the first-generation optimization parameters stored in MATLAB_Workspace, including M sets of optimization parameters, are called. The speed loop model is run through the Sim function to obtain M sets of output results. One set of optimization models corresponds to one output result.
[0095] For example, please refer to Figure 3 The speed loop model step signal, sliding mode speed controller, q-axis current loop transfer function module, permanent magnet synchronous motor transfer function module, system error, controller output and system output.
[0096] (2) For each set of output results, the objective function corresponding to the output result is determined by the following formula;
[0097] Formula 1:
[0098] Where J is the objective function, e(t) is the system error, y(t) is the system output, u(t) is the controller output, and t u Let e(y(t)) = y(t) - y(t-1) be the rise time, and let e(y(t)) = y(t) - y(t-1) be the system output error. Let ω1, ω2, ω3, and ω4 be weights, and let ω4 >> max(ω1, ω2, ω3). ω1, ω2, ω3, and ω4 can be set and changed as needed. In this embodiment, ω1, ω2, ω3, and ω4 are not specifically limited; for example, ω1, ω2, ω3, and ω4 are 0.999, 0.001, 2.000, and 100, respectively.
[0099] Step 203: Based on the objective functions corresponding to the M groups of optimization parameters included in the first generation of optimization parameters, determine the first target group of optimization parameters included in the first generation of optimization parameters. The objective function corresponding to the first target group of optimization parameters is the minimum value among the objective functions corresponding to the optimization parameters in the first generation of optimization parameters.
[0100] Based on the objective function corresponding to the M groups of optimization parameters included in the first generation of optimization parameters, the minimum value of the objective function is determined, and the group of optimization parameters corresponding to the minimum value of the objective function is the first objective group of optimization parameters.
[0101] Step 204: Based on the objective function corresponding to the M sets of optimization parameters included in the first generation of optimization parameters, determine the fitness of the M sets of optimization parameters included in the first generation of optimization parameters. The fitness of any set of optimization parameters is used to represent the ability of the set of optimization parameters to adapt to the sliding mode controller.
[0102] The fitness of any set of optimization parameters is negatively correlated with the objective function of that set of optimization parameters; for example, for each set of optimization parameters, the reciprocal of the objective function of that set of optimization parameters is determined to obtain the fitness of that set of optimization parameters.
[0103] Step 205: Based on the fitness of the M groups of optimization parameters included in the first generation of optimization parameters, determine the crossover probability and mutation probability of the M groups of optimization parameters included in the first generation of optimization parameters respectively. The crossover probability and mutation probability of any group of optimization parameters are used to represent the probability that the group of optimization parameters will be retained in the next generation of optimization parameters.
[0104] The step of determining the crossover probabilities corresponding to the M groups of optimization parameters included in the first-generation optimization parameters based on their fitness can be achieved through the following steps (1) to (3):
[0105] (1) Based on the fitness of the M groups of optimization parameters included in the first generation of optimization parameters, determine the first maximum fitness, minimum fitness and average fitness of the fitness of the M groups of optimization parameters included in the first generation of optimization parameters.
[0106] For each set of optimization parameters included in the first generation of optimization parameters, based on the fitness of that set of optimization parameters, the maximum fitness of that set of optimization parameters is determined as the first maximum fitness, and the minimum fitness and average fitness of that set of optimization parameters are determined. Since the first generation of optimization parameters includes M sets of optimization parameters, M first maximum fitness, minimum fitness and average fitness will be determined in this step.
[0107] (2) Determine multiple sets of optimization parameters corresponding to the crossover operation, and determine the second maximum fitness of the fitness of the multiple sets of optimization parameters based on the fitness of the multiple sets of optimization parameters.
[0108] For example, two sets of optimization parameters for the crossover operation are determined; based on the fitness of these two sets of optimization parameters, the largest fitness is determined as the second maximum fitness. Furthermore, in this step, two sets of optimization parameters for M crossover operations are determined, thereby enabling the determination of M second maximum fitnesss.
[0109] (3) For the group optimization parameters corresponding to the second maximum fitness of the fitness of multiple groups of optimization parameters, the crossover probability corresponding to the group optimization parameters is determined by the following formula: based on the first maximum fitness, minimum fitness, average fitness, and second maximum fitness.
[0110] Formula 2:
[0111] Among them, P c P represents the crossover probability corresponding to the group optimization parameters. c1 Let P be the first preset probability. c2 Let f' be the second preset probability and f' be the second maximum fitness. max and f min These are the first maximum fitness and the minimum fitness, f, respectively. avg The average fitness. Both the first and second preset probabilities can be set and changed as needed; in this embodiment, neither the first nor the second preset probability is specifically limited; for example, P c1 =0.9, P c2 =0.6.
[0112] In this embodiment, the optimization parameters with higher fitness in each iteration are assigned a lower P value. c This allows for the preservation of excellent optimization parameters; while optimization parameters with lower fitness will receive higher P values. c The value is thus beneficial for the mutation of poor optimization parameters, which improves the convergence speed of the algorithm. Furthermore, since the optimization parameters involved in the crossover operation are random, the crossover probability of the optimization parameters is also random, which improves the randomness of the algorithm.
[0113] The step of determining the mutation probability corresponding to each of the M groups of optimization parameters included in the first-generation optimization parameters based on their fitness can be achieved through the following steps (A) and (B):
[0114] (A) Based on the fitness of the M groups of optimization parameters included in the first generation of optimization parameters, determine the first maximum fitness, minimum fitness, and average fitness of the fitness of the M groups of optimization parameters included in the first generation of optimization parameters.
[0115] This step is the same as step (1), and will not be repeated here. Furthermore, when determining the crossover probability, the first maximum fitness, minimum fitness, and average fitness have already been determined; in this step, the first maximum fitness, minimum fitness, and average fitness can be used directly without repeating the determination, that is, step (A) can be skipped and step (B) can be executed directly.
[0116] (B) For each set of optimization parameters, based on the first maximum fitness, minimum fitness, average fitness, and the fitness of the set of optimization parameters, the mutation probability corresponding to the set of optimization parameters is determined by the following formula three:
[0117] Formula 3:
[0118] Among them, P m P represents the mutation probability corresponding to the group optimization parameters. m1 For the third preset probability, P m2 Let f be the fourth preset probability, and f be the fitness of the optimized parameters for the group. max and f min These are the first maximum fitness and the minimum fitness, f, respectively. avg The average fitness is denoted as P. Both the third and fourth preset probabilities can be set and changed as needed; in this embodiment, neither the third nor the fourth preset probability is specifically limited; for example, P... m1 =0.1, P m2 =0.001.
[0119] In this embodiment, the optimization parameters with higher fitness in each iteration are assigned a lower P value. m This allows for the preservation of excellent optimization parameters; while optimization parameters with lower fitness will receive higher P values. m The value is thus beneficial for the mutation of poor optimization parameters, which improves the convergence speed of the algorithm. Furthermore, since the optimization parameters involved in the mutation operation are random, the mutation probability of the optimization parameters is also random, which improves the randomness of the algorithm.
[0120] Step 206: Based on the crossover probabilities and mutation probabilities corresponding to the M sets of optimization parameters included in the first generation of optimization parameters, generate the M sets of optimization parameters included in the next generation of sliding mode controller.
[0121] This step can be achieved through the following steps (1) and (2), including:
[0122] (1) For each set of optimization parameters, if the crossover probability corresponding to the set of optimization parameters is less than the first probability threshold and the mutation probability corresponding to the set of optimization parameters is less than the second probability threshold, the set of optimization parameters shall be used as the next generation of optimization parameters.
[0123] If the crossover probability corresponding to the set of optimized parameters is less than the first probability threshold and the mutation probability corresponding to the set of optimized parameters is less than the second probability threshold, it indicates that the set of optimized parameters is a good set of optimized parameters. The set of optimized parameters is directly used as the next generation of optimized parameters, and the next generation of optimized parameters also includes the M set of optimized parameters.
[0124] (2) If the crossover probability corresponding to the set of optimization parameters is not less than the first probability threshold or the mutation probability corresponding to the set of optimization parameters is not less than the second probability threshold, the set of optimization parameters is mutated to obtain the next generation of optimization parameters.
[0125] In one possible implementation, the step of mutating the set of optimization parameters to obtain the next generation of optimization parameters can be: randomly mutating the approach velocity parameter, sliding surface slope, and sign function gain parameter included in the set of optimization parameters to obtain the next generation of optimization parameters; for example, mutating one parameter among the approach velocity parameter, sliding surface slope, and sign function gain parameter included in the set of optimization parameters; or, mutating two parameters among the approach velocity parameter, sliding surface slope, and sign function gain parameter included in the set of optimization parameters; or, mutating all of the approach velocity parameter, sliding surface slope, and sign function gain parameter included in the set of optimization parameters.
[0126] In addition, in step 201, a first range of values for the approach velocity parameter, a second range of values for the sliding surface slope, and a third range of values for the gain parameter of the sign function were determined. In this step, the approach velocity parameter included in the set of optimized parameters is mutated based on the first range of values for the approach velocity parameter, so that the mutated approach velocity parameter is within the first range of values; the sliding surface slope included in the set of optimized parameters is mutated based on the second range of values for the sliding surface slope, so that the mutated sliding surface slope is within the second range of values; and the gain parameter of the sign function included in the set of optimized parameters is mutated based on the third range of values for the gain parameter of the sign function, so that the gain parameter of the mutated sign function is within the third range of values.
[0127] In this embodiment, by setting a first value range, a second value range, and a third value range, constraints are imposed on the approach velocity parameter, the sliding surface slope, and the gain parameter of the sign function based on the first value range, the second value range, and the third value range, so that the approach velocity parameter, the sliding surface slope, and the gain parameter of the sign function obtained by mutation are respectively within the first value range, the second value range, and the third value range, thereby improving the convergence speed of the algorithm.
[0128] In another possible implementation, the optimization parameters are mutated by combining the first range of values for the crossover probability, mutation probability, and approach velocity parameter, the second range of values for the sliding surface slope, and the third range of values for the gain parameter of the sign function; correspondingly, step (2) can be implemented by the following steps (2-1) and (2-2), including:
[0129] (2-1) Based on the crossover probability and mutation probability corresponding to the M groups of optimization parameters included in the first generation of optimization parameters, the second target group of optimization parameters included in the first generation of optimization parameters is determined. The second target group of optimization parameters are the optimization parameters that will be used as the next generation of optimization parameters.
[0130] For each set of optimization parameters included in the first generation of optimization parameters, if the crossover probability corresponding to the set of optimization parameters is less than the first probability threshold and the mutation probability corresponding to the set of optimization parameters is less than the second probability threshold, the set of optimization parameters is determined as the second target set of optimization parameters. Through this step, one or more second target set optimization parameters can be obtained.
[0131] (2-2) The second target group optimization parameters are used as the reference group optimization parameters. Based on the first value range of the approach velocity parameter of the sliding mode controller, the second value range of the sliding surface slope, and the third value range of the gain parameter of the sign function, the next generation optimization parameters are obtained by mutating the group optimization parameters.
[0132] In the first implementation method, given that a second set of target group optimization parameters has been determined in step (2-1), the step of mutating this set of optimization parameters to obtain the next generation of optimization parameters can be as follows:
[0133] The steps for mutating the approach velocity parameters included in the optimization parameters of the second target group can be as follows: determine the approach velocity parameters included in the optimization parameters of the second target group, mutate the approach velocity parameters included in the optimization parameters of the group, such that the difference between the mutated approach velocity parameters and the approach velocity parameters included in the optimization parameters of the second target group is less than a first difference threshold, and the mutated approach velocity parameters are within a first value range.
[0134] The steps for mutating the sliding surface slope included in the set of optimization parameters can be as follows: determine the sliding surface slope included in the second target set of optimization parameters, mutate the sliding surface slope included in the set of optimization parameters, such that the difference between the mutated sliding surface slope and the sliding surface slope included in the second target set of optimization parameters is less than a second difference threshold, and the mutated sliding surface slope is within a second value range.
[0135] The steps for mutating the gain parameter of the sign function included in the set of optimization parameters can be as follows: determine the gain parameter of the sign function included in the second target set of optimization parameters, mutate the gain parameter of the sign function included in the set of optimization parameters, such that the difference between the gain parameter of the mutated sign function and the gain parameter of the sign function included in the second target set of optimization parameters is less than a third difference threshold, and the gain parameter of the mutated sign function is within a third value range.
[0136] The second implementation method, in which multiple second target group optimization parameters are determined in step (2-1), involves mutating these optimization parameters to obtain the next generation of optimization parameters as follows:
[0137] The step of mutating the approach velocity parameters included in the set of optimization parameters can be as follows: determine the average value of the approach velocity parameters included in multiple second target group optimization parameters, mutate the approach velocity parameters included in the set of optimization parameters such that the difference between the mutated approach velocity parameter and the average value is less than a first difference threshold, and the mutated approach velocity parameter is within a first value range. Alternatively, based on the approach velocity parameters included in the set of optimization parameters, select the reference approach velocity parameter that is closest to the approach velocity parameters included in the set of optimization parameters from among the multiple second target group optimization parameters, mutate the approach velocity parameters included in the set of optimization parameters based on the reference approach velocity parameter such that the difference between the mutated approach velocity parameter and the reference approach velocity parameter is less than a first difference threshold, and the mutated approach velocity parameter is within a first value range. Alternatively, based on the approach velocity parameters included in the optimization parameters of multiple second target groups, a range of approach velocity parameters is determined. Based on this range of approach velocity parameters, the first value range is modified to obtain a fourth value range. The approach velocity parameters included in the optimization parameters of this group are then mutated so that the mutated approach velocity parameters are within the fourth value range.
[0138] The step of mutating the sliding surface slope included in the set of optimization parameters can be as follows: determine the average value of the sliding surface slopes included in multiple second target group optimization parameters, mutate the sliding surface slopes included in the set of optimization parameters such that the difference between the mutated sliding surface slope and the average value is less than a second difference threshold, and the mutated sliding surface slope is within a second value range. Alternatively, based on the sliding surface slopes included in the set of optimization parameters, select the reference sliding surface slope that is closest to the sliding surface slopes included in the set of optimization parameters from among the multiple second target group optimization parameters, mutate the sliding surface slopes included in the set of optimization parameters based on the reference sliding surface slope such that the difference between the mutated sliding surface slope and the reference sliding surface slope is less than a second difference threshold, and the mutated sliding surface slope is within a second value range. Alternatively, based on the sliding surface slopes included in the optimization parameters of multiple second target groups, a sliding surface slope range is determined. Based on this sliding surface slope range, the second value range is modified to obtain a fifth value range. The sliding surface slopes included in the optimization parameters of this group are then mutated so that the mutated sliding surface slope is within the fifth value range.
[0139] The step of mutating the gain parameter of the sign function included in the set of optimization parameters can be as follows: determine the average value of the gain parameters of the sign functions included in multiple second target set optimization parameters, mutate the gain parameter of the sign functions included in the set of optimization parameters such that the difference between the mutated gain parameter of the sign function and the average value is less than a third difference threshold, and the mutated gain parameter of the sign function is within a third value range. Alternatively, based on the gain parameter of the sign function included in the set of optimization parameters, select the gain parameter of the reference sign function that is closest to the gain parameter of the sign function included in the set of optimization parameters from among the gain parameters of the sign functions included in multiple second target set optimization parameters, mutate the gain parameter of the sign function included in the set of optimization parameters based on the gain parameter of the reference sign function such that the difference between the mutated gain parameter of the sign function and the gain parameter of the reference sign function is less than a third difference threshold, and the mutated gain parameter of the sign function is within a third value range. Alternatively, based on the gain parameters of the sign functions included in the optimization parameters of multiple second objective groups, the gain parameter range of the sign functions is determined. Based on this gain parameter range of the sign functions, the third value range is modified to obtain the sixth value range. The gain parameters of the sign functions included in the optimization parameters of this group are mutated so that the gain parameters of the mutated sign functions are within the sixth value range.
[0140] Step 207: Based on the M sets of optimization parameters included in the next generation optimization parameters, determine the first target group of optimization parameters included in the next generation optimization parameters, and generate the M sets of optimization parameters included in the next generation optimization parameters of the sliding mode controller, until the first target group of optimization parameters included in the G generation optimization parameters are determined.
[0141] After determining the M sets of optimization parameters included in the next generation of optimization parameters, the objective functions corresponding to the M sets of optimization parameters included in the next generation of optimization parameters are determined respectively. Based on the objective functions corresponding to the M sets of optimization parameters included in the next generation of optimization parameters, the first target group of optimization parameters included in the next generation of optimization parameters is determined. The objective function corresponding to the first target group of optimization parameters is the minimum value among the objective functions corresponding to the optimization parameters in the next generation of optimization parameters. Based on the objective functions corresponding to the M sets of optimization parameters included in the next generation of optimization parameters, the fitness of the M sets of optimization parameters included in the next generation of optimization parameters is determined. Based on the fitness of the M sets of optimization parameters included in the next generation of optimization parameters, the crossover probability and mutation probability corresponding to the M sets of optimization parameters included in the next generation of optimization parameters are determined respectively. Based on the crossover probability and mutation probability corresponding to the M sets of optimization parameters included in the next generation of optimization parameters, the next generation of optimization parameters included in the next generation of optimization parameters is generated. Then, based on the next generation of optimization parameters included in the next generation of optimization parameters, the iteration continues until the first target group of optimization parameters included in the G generation of optimization parameters is determined, where G is the maximum number of iterations and G is an integer greater than 2. G can be set and changed as needed. In this embodiment of the application, G is not specifically limited. For example, G can be 150.
[0142] And please refer to Figure 2 After determining the target optimization parameters for the current generation, it is determined whether the number of iterations has reached the maximum number of iterations. If the number of iterations reaches the maximum number of iterations, the process ends. If the number of iterations has not reached the maximum number of iterations, the fitness of the M sets of optimization parameters included in the current generation is determined. Then, based on the fitness of the M sets of optimization parameters included in the current generation, the crossover probability and mutation probability corresponding to the M sets of optimization parameters included in the current generation are determined.
[0143] Step 208: Based on the first target group optimization parameters included in the G-generation optimization parameters, determine the optimization parameters of the sliding mode controller, and optimize the sliding mode controller based on the optimization parameters of the sliding mode controller.
[0144] Based on the first target group optimization parameters included in the G-generation optimization parameters, the objective function corresponding to the first target group optimization parameters included in the G-generation optimization parameters is determined. Based on the objective function corresponding to the first target group optimization parameters included in the G-generation optimization parameters, the first target group optimization parameters corresponding to the minimum value of the function are determined. The first target group optimization parameters corresponding to the minimum value of the function are used as the optimization parameters of the sliding mode controller.
[0145] Step 209: Control the permanent magnet synchronous motor based on the optimized sliding mode controller.
[0146] For example, when permanent magnet synchronous motors are used in electric vehicles, the motors are controlled by an optimized sliding mode controller, which then powers the electric vehicle.
[0147] In this embodiment, the optimization parameters of the sliding mode controller are optimized iteratively. When determining the next generation of optimization parameters during the iteration process, the crossover probability and mutation probability of the M groups of optimization parameters included in the previous generation are used. This makes the determined next generation of optimization parameters more reasonable, enabling the iterative algorithm to have a faster convergence speed and better global search capability. This improves the efficiency and accuracy of the determined optimization parameters of the sliding mode controller, and thus improves the control effect of the sliding mode controller on the permanent magnet synchronous motor based on the parameter optimization.
[0148] Through the following Figures 4-13 The beneficial effects of the embodiments of this application can be verified. Among them, Figure 4 This diagram illustrates the process of the change of the minimum objective function (Best J) determined by the conventional genetic algorithm (GA) and the improved genetic algorithm (IGA) provided in the embodiments of this application. Figure 4 It can be seen that, compared with the ordinary genetic algorithm, the improved genetic algorithm enables Best J to converge faster. Specifically, Best J converges in 129 generations under the ordinary genetic algorithm, while it converges in 57 generations under the improved genetic algorithm. Furthermore, Best J = 68.7474 when Best J converges under the ordinary genetic algorithm, while Best J = 54.7929 when Best J converges under the improved genetic algorithm, which is smaller than that of the ordinary genetic algorithm, effectively avoiding getting trapped in local optima. Therefore, the method in this application has a faster convergence speed and better global search capability compared to the ordinary genetic algorithm. When the number of iterations reaches 150, the optimal values of the sliding mode controller parameters corresponding to Best J output by the improved genetic algorithm are: sliding surface slope = 399.2384, approach velocity parameter = 393.1901, and sign function gain parameter = 36.1183.
[0149] Figures 5-7 These are schematic diagrams illustrating the system output, system error convergence process, and controller output process of the ordinary genetic algorithm (GA) and improved genetic algorithm (IGA) systems provided in the embodiments of this application, respectively. Figures 5-7 It can be seen that the improved genetic algorithm outperforms the ordinary genetic algorithm in terms of system output, system error, and controller output convergence speed. Therefore, the improved genetic algorithm has a faster iteration speed and better global search capability compared to the ordinary genetic algorithm.
[0150] Figure 8 and Figure 9The diagram shows simulated speed and speed error curves for the PID control method and the sliding mode control method based on the improved genetic algorithm (IGA-SMC) provided in the embodiments of this application. As can be seen from the simulated speed curves, compared to the PID control method, the IGA-SMC exhibits no overshoot and a fast response time of 0.025s at startup; when a 0.2 N·m load is applied at 0.5s, it can adjust to a steady state more quickly, with an adjustment time of 0.020s; when the speed is increased to 1200 rpm at 0.8s, there is still no overshoot, and the adjustment time is even faster at 0.02s. Figure 9 As shown in the simulated speed error curve, when a load of 0.2 N·m is applied for 0.5 s, the speed error of IGA-SMC is 70 rpm, which is 34 rpm less than that of the PID control method.
[0151] Figure 10 and Figure 11 A schematic diagram of simulated three-phase current curves for the PID control method and the sliding mode control method based on the improved genetic algorithm (IGA-SMC) provided in the embodiments of this application. Figure 10 and Figure 11 It can be seen that, compared with the PID control method, the IGA-SMC can reach a steady state faster during startup, when load is applied and speed is increased, and the amplitude is the smallest.
[0152] Figure 12 and Figure 13 The diagram shows simulated torque curves of the PID control method and the sliding mode control method (IGA-SMC) based on an improved genetic algorithm provided in the embodiments of this application. Figure 12 and Figure 13 It can be seen that, compared with the PID control method, the IGA-SMC can reach a steady state faster during startup, when load is applied and speed is increased, and the amplitude is the smallest.
[0153] By comparing the simulation results, it can be concluded that the method proposed in this application has significant advantages over the traditional PID control method in terms of overshoot, response speed and robustness, effectively improving the control effect of permanent magnet synchronous motor. Moreover, the proposed improved genetic algorithm not only improves the convergence speed but also has better global search capability compared with the ordinary genetic algorithm.
[0154] Please refer to Figure 14 This illustration shows a block diagram of a sliding mode control device for a permanent magnet synchronous motor, as illustrated in an exemplary embodiment of this application. The device includes:
[0155] Create module 1401 to create the first generation of optimized parameters for the sliding mode controller. The first generation of optimized parameters includes M sets of optimized parameters. Each set of optimized parameters includes the approach velocity parameter of the sliding mode controller, the sliding surface slope, and the gain parameter of the sign function. M is an integer greater than 1.
[0156] The first determining module 1402 is used to determine the objective functions corresponding to the M groups of optimization parameters included in the first generation of optimization parameters;
[0157] The second determining module 1403 is used to determine the target group optimization parameters included in the first generation optimization parameters based on the objective functions corresponding to the M groups of optimization parameters included in the first generation optimization parameters. The objective function corresponding to the target group optimization parameters is the minimum value among the objective functions corresponding to the optimization parameters in the first generation optimization parameters.
[0158] The third determining module 1404 is used to determine the fitness of the M groups of optimization parameters included in the first generation of optimization parameters based on the objective function corresponding to the M groups of optimization parameters included in the first generation of optimization parameters. The fitness of any group of optimization parameters is used to represent the ability of that group of optimization parameters to adapt to the sliding mode controller.
[0159] The fourth determining module 1405 is used to determine the crossover probability and mutation probability of the M groups of optimization parameters included in the first generation of optimization parameters based on the fitness of the M groups of optimization parameters included in the first generation of optimization parameters. The crossover probability and mutation probability of any group of optimization parameters are used to represent the probability that the group of optimization parameters is retained in the next generation of optimization parameters.
[0160] The generation module 1406 is used to generate the next-generation optimization parameters of the sliding mode controller based on the crossover probability and mutation probability corresponding to the M sets of optimization parameters included in the first-generation optimization parameters.
[0161] The fifth determining module 1407 is used to determine the target group of optimization parameters included in the next generation of optimization parameters based on the M groups of optimization parameters included in the next generation of optimization parameters, and to generate the M groups of optimization parameters included in the next generation of sliding mode controller, until the target group of optimization parameters included in the G generation of optimization parameters is determined, where G is an integer greater than 2;
[0162] The sixth determining module 1408 is used to determine the optimization parameters of the sliding mode controller based on the target group optimization parameters included in the G-generation optimization parameters, and to optimize the sliding mode controller based on the optimization parameters of the sliding mode controller;
[0163] Control module 1409 is used to control the permanent magnet synchronous motor based on the optimized sliding mode controller.
[0164] In one possible implementation, the first determining module 1402 is used to run the speed loop model corresponding to the permanent magnet synchronous motor based on M sets of optimization parameters to obtain M sets of output results. Each set of output results includes system error, controller output, and system output. For each set of output results, the objective function corresponding to the output result is determined by the following formula:
[0165] Formula 1:
[0166] Where J is the objective function, e(t) is the system error, y(t) is the system output, u(t) is the controller output, and t u Let e(y(t)) = y(t) - y(t-1) be the rise time, e(y(t)) = y(t) - y(t-1) be the system output error, and ω1, ω2, ω3, and ω4 be the weights, with ω4 >> max(ω1, ω2, ω3).
[0167] In another possible implementation, the fourth determining module 1405 is used to determine, based on the fitness of the M groups of optimization parameters included in the first-generation optimization parameters, a first maximum fitness, a minimum fitness, and an average fitness of the fitness of the M groups of optimization parameters included in the first-generation optimization parameters; determine multiple groups of optimization parameters corresponding to the crossover operation; and, based on the fitness of the multiple groups of optimization parameters, determine a second maximum fitness of the fitness of the multiple groups of optimization parameters; for the group of optimization parameters corresponding to the second maximum fitness of the fitness of the multiple groups of optimization parameters, based on the first maximum fitness, the minimum fitness, the average fitness, and the second maximum fitness, determine the crossover probability corresponding to the group of optimization parameters using the following formula:
[0168] Formula 2:
[0169] Among them, P c P represents the crossover probability corresponding to this set of optimized parameters. c1 Let P be the first preset probability. c2 Let f' be the second preset probability and f' be the second maximum fitness. max and f min These are the first maximum fitness and the minimum fitness, f, respectively. avg This represents the average fitness.
[0170] In another possible implementation, the fourth determining module 1405 is used to determine the first maximum fitness, minimum fitness, and average fitness of the M groups of optimization parameters included in the first generation of optimization parameters based on their fitness. For each group of optimization parameters, the mutation probability corresponding to that group of optimization parameters is determined by the following formula three based on the first maximum fitness, minimum fitness, average fitness, and the fitness of that group of optimization parameters:
[0171] Formula 3:
[0172] Among them, P m P represents the mutation probability corresponding to this set of optimized parameters. m1 For the third preset probability, P m2 Let f be the fourth preset probability, and f be the fitness of this set of optimized parameters.max and f min These are the first maximum fitness and the minimum fitness, f, respectively. avg This represents the average fitness.
[0173] In another possible implementation, the generation module 1406 is used to, for each set of optimized parameters, if the crossover probability of the set of optimized parameters is less than a first probability threshold and the mutation probability of the set of optimized parameters is less than a second probability threshold, use the set of optimized parameters as the next generation of optimized parameters; if the crossover probability of the set of optimized parameters is not less than the first probability threshold or the mutation probability of the set of optimized parameters is not less than the second probability threshold, mutate the set of optimized parameters to obtain the next generation of optimized parameters.
[0174] In another possible implementation, the generation module 1406 is used to determine the target group of optimization parameters included in the first generation of optimization parameters based on the crossover probability and mutation probability corresponding to the M groups of optimization parameters included in the first generation of optimization parameters. The target group of optimization parameters are the optimization parameters that will be used as the next generation of optimization parameters. The target group of optimization parameters are used as the reference group of optimization parameters, and the next generation of optimization parameters are obtained by mutating the group of optimization parameters based on the first value range of the approach velocity parameter of the sliding mode controller, the second value range of the sliding surface slope, and the third value range of the gain parameter of the sign function.
[0175] In this embodiment, the optimization parameters of the sliding mode controller are optimized iteratively. When determining the next generation of optimization parameters during the iteration process, the crossover probability and mutation probability of the M groups of optimization parameters included in the previous generation are used. This makes the determined next generation of optimization parameters more reasonable, enabling the iterative algorithm to have a faster convergence speed and better global search capability. This improves the efficiency and accuracy of the determined optimization parameters of the sliding mode controller, and thus improves the control effect of the sliding mode controller on the permanent magnet synchronous motor based on the parameter optimization.
[0176] It should be noted that the sliding mode control device for permanent magnet synchronous motors provided in the above embodiments is only illustrated by the division of the above functional modules when performing sliding mode control of permanent magnet synchronous motors. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the sliding mode controller can be divided into different functional modules to complete all or part of the functions described above. In addition, the sliding mode control device for permanent magnet synchronous motors provided in the above embodiments and the sliding mode control method embodiments for permanent magnet synchronous motors belong to the same concept, and the specific implementation process is detailed in the method embodiments, which will not be repeated here.
[0177] Figure 15This is a structural block diagram of a sliding mode controller provided in an embodiment of this application. The sliding mode controller 1500 can vary considerably due to different configurations or performance. It may include a processor (central processing unit, CPU) 1501 and a memory 1502. The memory 1502 stores at least one line of program code, which is loaded and executed by the processor 1501 to implement the methods provided in the above-described method embodiments. Of course, the sliding mode controller 1500 may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The sliding mode controller 1500 may also include other components for implementing device functions, which will not be elaborated here.
[0178] This application also provides a computer-readable storage medium storing at least one line of program code, which is loaded and executed by a processor to implement the sliding mode control method for a permanent magnet synchronous motor as described in any of the above implementations. Optionally, the storage medium may be a non-transitory computer-readable storage medium, such as ROM (Read-Only Memory), RAM (Random Access Memory), CD-ROM (Compact Disc Read-Only Memory), magnetic tape, floppy disk, and optical data storage devices.
[0179] This application also provides a computer program product that stores at least one piece of program code, which is loaded and executed by a processor to implement the sliding mode control method for a permanent magnet synchronous motor as shown in the above embodiments.
[0180] In some embodiments, the computer program product involved in the present application embodiments may be deployed and executed on a sliding mode controller, or on multiple sliding mode controllers located in one location, or on multiple sliding mode controllers distributed in multiple locations and interconnected through a communication network. Multiple sliding mode controllers distributed in multiple locations and interconnected through a communication network may form a blockchain system.
[0181] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0182] The above description is only for the purpose of enabling those skilled in the art to understand the technical solution of this application, and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A sliding mode control method of a permanent magnet synchronous motor, characterized by, The method comprises: creating a first generation of optimization parameters of a sliding mode controller, the first generation of optimization parameters comprising M groups of optimization parameters, each group of optimization parameters comprising a reaching speed parameter, a sliding mode surface slope and a gain parameter of a sign function of the sliding mode controller, M being an integer greater than 1; determining target functions corresponding to the M groups of optimization parameters comprised in the first generation of optimization parameters respectively; based on the target functions corresponding to the M groups of optimization parameters comprised in the first generation of optimization parameters, determining a target group of optimization parameters comprised in the first generation of optimization parameters, the target function corresponding to the target group of optimization parameters being the minimum value among the target functions corresponding to the optimization parameters in the first generation of optimization parameters; based on the target functions corresponding to the M groups of optimization parameters comprised in the first generation of optimization parameters, determining fitnesses of the M groups of optimization parameters comprised in the first generation of optimization parameters, the fitness of any group of optimization parameters being used to represent the ability of the group of optimization parameters to adapt to the sliding mode controller; based on the fitnesses of the M groups of optimization parameters comprised in the first generation of optimization parameters, determining a crossover probability and a mutation probability corresponding to each of the M groups of optimization parameters, the crossover probability and the mutation probability corresponding to any group of optimization parameters being used to represent the probability of the group of optimization parameters being retained to a next generation of optimization parameters; based on the crossover probability and the mutation probability corresponding to each of the M groups of optimization parameters comprised in the first generation of optimization parameters, generating M groups of optimization parameters comprised in a next generation of optimization parameters of the sliding mode controller; based on the M groups of optimization parameters comprised in the next generation of optimization parameters, determining a target group of optimization parameters comprised in the next generation of optimization parameters, and generating M groups of optimization parameters comprised in a next next generation of optimization parameters of the sliding mode controller, until a target group of optimization parameters comprised in a Gth generation of optimization parameters is determined, G being an integer greater than 2; based on the target group of optimization parameters comprised in the Gth generation of optimization parameters, determining optimization parameters of the sliding mode controller, and optimizing the sliding mode controller based on the optimization parameters of the sliding mode controller; controlling a permanent magnet synchronous motor based on the optimized sliding mode controller; the determining, based on the fitnesses of the M groups of optimization parameters comprised in the first generation of optimization parameters, of the crossover probability and the mutation probability corresponding to each of the M groups of optimization parameters comprised in the first generation of optimization parameters, comprises: determining a first maximum fitness, a minimum fitness and an average fitness of the fitnesses of the M groups of optimization parameters comprised in the first generation of optimization parameters based on the fitnesses of the M groups of optimization parameters comprised in the first generation of optimization parameters; determining a plurality of groups of optimization parameters corresponding to a crossover operation, determining a second maximum fitness of the fitnesses of the plurality of groups of optimization parameters based on the fitnesses of the plurality of groups of optimization parameters; and determining, for the group of optimization parameters corresponding to the second maximum fitness of the fitnesses of the plurality of groups of optimization parameters, the crossover probability corresponding to the group of optimization parameters based on the first maximum fitness, the minimum fitness, the average fitness and the second maximum fitness by using the following Formula Two: Equation Two: wherein, P c a cross probability corresponding to the parameter pair optimized for the group, P c1 a first preset probability, P c2 a second preset probability, f’ the second maximum fitness, f max and f min the first maximum fitness and the minimum fitness, respectively, f avg the average fitness; determine a first maximum fitness, a minimum fitness and an average fitness of the M groups of optimization parameters included in the first generation of optimization parameters based on the fitnesses of the M groups of optimization parameters included in the first generation of optimization parameters; for each group of optimization parameters, determine a mutation probability corresponding to the group of optimization parameters by Formula Three based on the first maximum fitness, the minimum fitness, the average fitness and the fitness of the group of optimization parameters: Equation Three: wherein, P m is a mutation probability corresponding to the set of optimization parameters, P m1 is a third preset probability, P m2 is a fourth preset probability, f is a fitness of the set of optimization parameters, f max and f min are the first maximum fitness and the minimum fitness, respectively, f avg is the average fitness. generate the M groups of optimization parameters included in the next generation of optimization parameters of the sliding mode controller based on the respective crossover probabilities and mutation probabilities of the M groups of optimization parameters included in the first generation of optimization parameters, including: for each group of optimization parameters, in a case where the crossover probability corresponding to the group of optimization parameters is less than a first probability threshold and the mutation probability corresponding to the group of optimization parameters is less than a second probability threshold, take the group of optimization parameters as the next generation of optimization parameters; in a case where the crossover probability corresponding to the group of optimization parameters is not less than the first probability threshold or the mutation probability corresponding to the group of optimization parameters is not less than the second probability threshold, determine a target group of optimization parameters included in the first generation of optimization parameters based on the respective crossover probabilities and mutation probabilities of the M groups of optimization parameters included in the first generation of optimization parameters, the target group of optimization parameters being an optimization parameter taken as the next generation of optimization parameters; take the target group of optimization parameters as a reference group of optimization parameters, and mutate the group of optimization parameters based on a first value range of a reaching speed parameter of the sliding mode controller, a second value range of a slope of a sliding mode surface and a third value range of a gain parameter of a sign function to obtain the next generation of optimization parameters.
2. The method of claim 1, wherein, the respective determination of the objective functions corresponding to the M groups of optimization parameters included in the first generation of optimization parameters includes: run a speed loop model corresponding to the permanent magnet synchronous motor based on the M groups of optimization parameters to obtain M groups of output results, each group of output results including a system error, a controller output and a system output; for each group of output results, determine an objective function corresponding to the output result by Formula One; Equation One: where J is the objective function, e(t) is the system error, y(t) is the system output, u(t) is the controller output, t u is the rise time, e(y(t)) = y(t) - y(t - 1) is the system output error, ω1, ω2, ω3, ω4are weight values and ω4» max(ω1, ω2, ω3).
3. A sliding mode control device for a permanent magnet synchronous motor, characterized by, the apparatus includes: a creating module configured to create a first generation of optimization parameters of a sliding mode controller, the first generation of optimization parameters including M groups of optimization parameters, each group of optimization parameters including a reaching speed parameter of the sliding mode controller, a slope of a sliding mode surface and a gain parameter of a sign function, M being an integer greater than 1; a first determining module configured to respectively determine objective functions corresponding to the M groups of optimization parameters included in the first generation of optimization parameters; a second determining module configured to determine a target group of optimization parameters included in the first generation of optimization parameters based on the objective functions corresponding to the M groups of optimization parameters included in the first generation of optimization parameters, the objective function corresponding to the target group of optimization parameters being a minimum value among the objective functions corresponding to the optimization parameters in the first generation of optimization parameters; a third determining module configured to determine fitnesses of the M groups of optimization parameters included in the first generation of optimization parameters based on the objective functions corresponding to the M groups of optimization parameters included in the first generation of optimization parameters, the fitness of any group of optimization parameters being used to represent an ability of the group of optimization parameters to adapt to the sliding mode controller; The fourth determining module is configured to determine, based on the fitness of the M groups of optimization parameters included in the first generation of optimization parameters, the crossover probability and the mutation probability corresponding to each of the M groups of optimization parameters included in the first generation of optimization parameters, the crossover probability and the mutation probability corresponding to any group of optimization parameters representing the probability of the group of optimization parameters being retained in the next generation of optimization parameters; The generating module is configured to generate, based on the crossover probability and the mutation probability corresponding to each of the M groups of optimization parameters included in the first generation of optimization parameters, the M groups of optimization parameters included in the next generation of optimization parameters of the sliding mode controller; The fifth determining module is configured to determine, based on the M groups of optimization parameters included in the next generation of optimization parameters, the target group of optimization parameters included in the next generation of optimization parameters, and generate the M groups of optimization parameters included in the next next generation of optimization parameters of the sliding mode controller, until the target group of optimization parameters included in the Gth generation of optimization parameters is determined, G being an integer greater than 2; The sixth determining module is configured to determine, based on the target group of optimization parameters included in the Gth generation of optimization parameters, the optimization parameters of the sliding mode controller, and optimize the sliding mode controller based on the optimization parameters of the sliding mode controller; The control module is configured to control the permanent magnet synchronous motor based on the optimized sliding mode controller. The fourth determining module is configured to determine, based on the fitness of the M groups of optimization parameters included in the first generation of optimization parameters, the first maximum fitness, the minimum fitness, and the average fitness of the fitness of the M groups of optimization parameters included in the first generation of optimization parameters; determine a plurality of groups of optimization parameters corresponding to the crossover operation, determine the second maximum fitness of the fitness of the plurality of groups of optimization parameters based on the fitness of the plurality of groups of optimization parameters; and for the group of optimization parameters corresponding to the second maximum fitness of the fitness of the plurality of groups of optimization parameters, determine the crossover probability corresponding to the group of optimization parameters based on the first maximum fitness, the minimum fitness, the average fitness, and the second maximum fitness by using Formula Two: Equation Two: wherein, P c a cross probability corresponding to the parameter pair optimized for the group, P c1 a first preset probability, P c2 a second preset probability, f’ the second maximum fitness, f max and f min the first maximum fitness and the minimum fitness, respectively, f avg the average fitness; The fourth determining module is configured to determine, based on the fitness of the M groups of optimization parameters included in the first generation of optimization parameters, the first maximum fitness, the minimum fitness, and the average fitness of the fitness of the M groups of optimization parameters included in the first generation of optimization parameters; for each group of optimization parameters, determine the mutation probability corresponding to the group of optimization parameters based on the first maximum fitness, the minimum fitness, the average fitness, and the fitness of the group of optimization parameters by using Formula Three: Equation Three: wherein, P m a mutation probability corresponding to the set of optimization parameters, P m1 a third preset probability, P m2 a fourth preset probability, f a fitness of the set of optimization parameters, f max and f min the first maximum fitness and the minimum fitness, respectively, f avg the average fitness; The generation module is configured to, for each group of optimization parameters, if the cross probability corresponding to the group of optimization parameters is less than a first probability threshold and the mutation probability corresponding to the group of optimization parameters is less than a second probability threshold, take the group of optimization parameters as next generation optimization parameters; if the cross probability corresponding to the group of optimization parameters is not less than the first probability threshold or the mutation probability corresponding to the group of optimization parameters is not less than the second probability threshold, determine a target group of optimization parameters included in the first generation of optimization parameters based on the cross probability and the mutation probability corresponding to the M groups of optimization parameters included in the first generation of optimization parameters, the target group of optimization parameters being the optimization parameters taken as the next generation optimization parameters; take the target group of optimization parameters as a reference group of optimization parameters, and mutate the group of optimization parameters based on a first value range of an approaching speed parameter of the sliding mode controller, a second value range of a sliding mode surface slope, and a third value range of a gain parameter of a sign function to obtain the next generation of optimization parameters.
4. A sliding mode controller characterized by The sliding mode controller comprises a processor and a memory, and the memory stores at least one program code, which is loaded and executed by the processor to implement the sliding mode control method of the permanent magnet synchronous motor according to any one of claims 1 to 2.
5. A computer readable storage medium, characterized in that, The storage medium stores at least one program code, which is loaded and executed by the processor to implement the sliding mode control method of the permanent magnet synchronous motor according to any one of claims 1 to 2.
6. A computer program product, characterised in that, The product stores at least one program code, which is used to be executed by the processor to implement the sliding mode control method of the permanent magnet synchronous motor according to any one of claims 1 to 2.
Citation Information
Patent Citations
Stereoscopic garage optimization method based on self-adaption genetic algorithm
CN106682254A
Permanent magnet synchronous motor terminal sliding mode control method based on periodic event triggering
CN112019107A