Parameter optimization method and related device
By building a control system model on the GCK platform and optimizing PID control parameters using genetic algorithms, the problem of PID control parameter optimization is solved, and efficient optimization of PID control is achieved.
Patent Information
- Application Number
- CN202510284938.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-11
- Publication Date
- 2025-05-30
AI Technical Summary
How to use the GCK platform to achieve optimization of PID control parameters and solve the problem of optimization of PID control parameters.
By building a control system model on the preset simulation platform, obtaining the variable range of the target variable, determining the variable set, setting the variable value of the target variable, using the interface to obtain the variable value of the intermediate variable, calculating the function value of the target performance function, and numerical adjustment of the variable set through a genetic algorithm until the iteration stop condition is met.
The GCK platform is used to optimize the PID control parameters, obtain the optimal set of target variables, and improve the control effect of PID control.
Smart Images

Figure CN120065698A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of PID (Proportion Integral Differential) control, and more specifically, to a parameter optimization method and related device. Background Art
[0002] PID control is the most widely used control algorithm in the industrial field. With the continuous development of PID control, the process of building a PID controller can be achieved through simulation software, such as a self-created simulation software like the GCK platform.
[0003] The control performance of a PID controller depends on the control structure and control parameters. Among them, the selection of control parameters directly affects the control effect of the controller. Therefore, the optimization of PID control parameters has increasingly become the focus of attention in the industrial community.
[0004] Then how to use the GCK platform to achieve parameter optimization of PID control is a technical problem that needs to be solved urgently by those skilled in the art. Summary of the Invention
[0005] In view of this, this application provides a parameter optimization method and related device to solve the problem of urgently needing to use the GCK platform to achieve parameter optimization of PID control.
[0006] To solve the above technical problems, this application adopts the following technical solutions:
[0007] A parameter optimization method includes:
[0008] Obtain a target variable in a control system model built on a preset simulation platform;
[0009] Use the variable range of the target variable to determine a variable set of the target variable, and the variable set includes a variable value of each target variable;
[0010] Set the variable value of the target variable in the control system model to the corresponding variable value in the variable set;
[0011] Use an interface configured on the preset simulation platform that can call the control system model to obtain the variable value of an intermediate variable in the control system model, and calculate the function value of a target performance function using the variable value of the intermediate variable;
[0012] In the case where the function value of the target performance function does not meet the iteration stop condition, perform a numerical adjustment operation on the variable set to obtain a new variable set;
[0013] Return to execute the step of setting the variable value of the target variable in the control system model to the corresponding variable value in the variable set, and execute sequentially until the target variable set corresponding to the function value of the target performance function that satisfies the iteration stop condition is obtained and then stop.
[0014] Optionally, the control system model is a PID model;
[0015] The target performance function is:
[0016] ;
[0017] Wherein, is the function value of the target performance function; is the number of iterations, , and are weights; is the deviation between the target value input to the PID model and the actual value corresponding to the target value; is the square term of the control input; is the overshoot.
[0018] Optionally, using the variable range of the target variable to determine the variable set of the target variable includes:
[0019] For the target variable, determine multiple variable values located within the variable range of the target variable;
[0020] Generate binary strings for each variable value located within the variable range of the target variable;
[0021] Randomly combine the binary strings of each target variable to obtain a variable set; the variable set includes one variable value of each target variable.
[0022] Optionally, determining multiple variable values located within the variable range of the target variable includes:
[0023] Within the variable range of the target variable, use a random function to randomly generate multiple variable values.
[0024] Optionally, using the interface configured by the preset simulation platform that can call the control system model to obtain the variable value of the intermediate variable in the control system model includes:
[0025] Determine the interface configured by the preset simulation platform that can call the control system model; the interface is an interface programmed in the Python language;
[0026] Invoke the said interface to obtain the variable values of the intermediate variables in the control system model; the intermediate variables include the deviation between the target value input to the PID model and the actual value corresponding to the target value, and the square term of the control input.
[0027] Optionally, perform a numerical adjustment operation on the variable set to obtain a new variable set, including:
[0028] Perform copy, crossover, and mutation operations on the variable set to obtain a new variable set.
[0029] Optionally, the iteration stop condition includes: the function value of the target performance function is the minimum among the function values of all target performance functions.
[0030] A parameter optimization device, comprising:
[0031] A variable acquisition module, configured to acquire target variables in a control system model built on a preset simulation platform;
[0032] A set determination module, configured to determine a variable set of the target variables by using the variable range of the target variables, where the variable set includes a variable value of each target variable;
[0033] A setting module, configured to set the variable values of the target variables in the control system model to the corresponding variable values in the variable set;
[0034] A function value calculation module, configured to use an interface that can call the control system model configured on the preset simulation platform to obtain the variable values of the intermediate variables in the control system model, and calculate the function value of the target performance function by using the variable values of the intermediate variables;
[0035] A numerical adjustment module, configured to perform a numerical adjustment operation on the variable set to obtain a new variable set when the function value of the target performance function does not meet the iteration stop condition;
[0036] The setting module is further configured to, after the numerical adjustment module performs a numerical adjustment operation on the variable set to obtain a new variable set, set the variable values of the target variables in the control system model to the corresponding variable values in the variable set;
[0037] A data determination module, configured to obtain a target variable set of the target variables corresponding to the function value of the target performance function that meets the iteration stop condition when the function value of the target performance function meets the iteration stop condition.
[0038] An electronic device, comprising at least one processor and a memory connected to the processor, wherein:
[0039] The memory is used to store a computer program;
[0040] The processor is used to execute the computer program so that the electronic device can implement the above-mentioned parameter optimization method.
[0041] A computer storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can implement the above-mentioned parameter optimization method.
[0042] This application provides a parameter optimization method and related devices. In this application, the target variables in the control system model built on a preset simulation platform, such as the GCK platform, are obtained. Using the variable range of the target variables, the variable set of the target variables is determined. The variable values of the target variables in the control system model are set to the corresponding variable values in the variable set. Using the interface configured on the preset simulation platform that can call the control system model, the variable values of the intermediate variables in the control system model are obtained. Using the variable values of the intermediate variables, the function value of the target performance function is calculated. When the function value of the target performance function does not meet the iteration stop condition, a numerical adjustment operation is performed on the variable set to obtain a new variable set, and the step of setting the variable values of the target variables in the control system model to the corresponding variable values in the variable set is returned and executed sequentially until the target variable set corresponding to the function value of the target performance function that meets the iteration stop condition is obtained and then stopped. In this application, by using the interface configured on the preset simulation platform that can call the control system model, the connection between the control system model and the iterative operation is established, so that the variable values of the intermediate variables in the control system model can be obtained, the iterative operation can be realized, the optimal target variable set can be obtained, and the purpose of completing the PID control parameter optimization using the GCK platform is realized. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required for use in the description of the embodiments or related technologies. Obviously, the drawings in the following description are only the embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained according to the provided drawings without creative efforts.
[0044] Figure 1 It is a flowchart of a parameter optimization method provided by an embodiment of the present invention;
[0045] Figure 2 It is a PID control flowchart provided by an embodiment of the present invention;
[0046] Figure 3Flowchart of a method for determining a variable set provided by an embodiment of the present invention;
[0047] Figure 4 Flowchart of a genetic algorithm provided by an embodiment of the present invention;
[0048] Figure 5 Schematic diagram of the change in the function value of an objective performance function provided by an embodiment of the present invention;
[0049] Figure 6 Schematic diagram of the change in a step response signal provided by an embodiment of the present invention;
[0050] Figure 7 Schematic diagram of the structure of a parameter optimization device provided by an embodiment of the present invention;
[0051] Figure 8 Schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Detailed implementation manners
[0052] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0053] PID control is the most widely used control algorithm in the industrial field. With the continuous development of PID control, the process of building a PID controller can be realized through simulation software, such as a self-developed simulation software like the GCK platform. Various simulation operations can be realized on the GCK platform, such as simulating vehicle architectures and simulation mathematical models. The GCK platform can support software such as the GCKontrol simulation software.
[0054] The control performance of a PID controller depends on the control structure and control parameters. Among them, the selection of control parameters directly affects the control effect of the controller. Therefore, the optimization of PID control parameters has increasingly become the focus of attention in the industrial community.
[0055] Then, how to use the GCK platform to achieve parameter optimization of PID control is a technical problem that those skilled in the art urgently need to solve.
[0056] To this end, the embodiments of the present application provide a parameter optimization method and related devices. By using the interface configured in a preset simulation platform, such as the GCK platform, which can call the control system model, a connection between the control system model and the iterative operation is established, so as to obtain the variable values of the intermediate variables in the control system model, realize the iterative operation, obtain the optimal set of target variables, and achieve the purpose of using the GCK platform to complete the PID control parameter optimization.
[0057] Based on the above, an embodiment of the present application provides a parameter optimization method, and the execution subject can be a preset simulation platform, such as the GCK platform. Referring to Figure 1 , a parameter optimization method may include:
[0058] S11. Obtain the target variables in the control system model built on the preset simulation platform.
[0059] In the embodiments of the present invention, the preset simulation platform can be the GCK platform, etc. Build the control system model of the controlled object in the GCK environment. The control system model can be configured according to the actual situation, such as it can be a PID model. The PID model is generally implemented by a mathematical model. Therefore, the control system model in the embodiments of the present invention is specifically a control system mathematical model.
[0060] The PID model can be applied to various scenarios, such as vehicle control scenarios, aircraft servo control scenarios, boiler control scenarios, motor control scenarios, etc.
[0061] The structure of the PID model can refer to Figure 2 as shown. Figure 2 In it, In is the input module, which is used to input the command signal of the PID control system, such as the target value. The target value is the control requirement to be achieved. According to different scenarios, the target value can be the flight altitude, the wheel rotation angle, the speed value, etc., specifically according to the actual configuration. Add_Sub_2 is the addition and subtraction operation module, which is used to calculate the deviation between the target value input to the PID model and the actual value corresponding to the target value . Integrator is the integration module, which has an integration algorithm built in. Derivative is the differential module, which has a differential algorithm built in. are the proportional module, the integration module and the differential module respectively. Add_Sub is the addition operation module, which is used to accumulate the outputs of the proportional module, the integration module and the differential module to obtain the square term of the control input , TransferFcn is the transfer function module, and the transfer function in the transfer function module represents the controlled object model after Laplace transform. After passing through the transfer function module, the control output quantity Out is obtained. The control output quantity represents the output signal of the controlled object, that is, the actual value corresponding to the above target value.
[0062] As can be seen from the above, the controller is in the form of a standard PID controller composed of proportional, integral, and derivative modules, and its coefficients are defined in the data dictionary of the GCK platform as . During the operation of the PID, the target value and the actual value pass through the addition and subtraction operation module to obtain the tracking deviation, which is used to drive the output of the controller.
[0063] The optimization of the PID parameters is to select appropriate target variables, that is, the numerical value of which makes the target performance function reach the optimal value. Among them, is an index function related to the tracking deviation, overshoot, control input amplitude, etc. of the control system response characteristics.
[0064] In one embodiment, to obtain satisfactory dynamic characteristics of the transient process, the time integral performance index of the absolute value of the tracking deviation is adopted, that is, the above deviation is used as an important part of the index function. To prevent the control input from being too large, a square term of the control input is added to the objective function. At the same time, to minimize the overshoot as much as possible, the overshoot is used as a part of the index function to form a complete index function, so that the function has the largest spatial range.
[0065] The target performance function in the embodiment of the present invention can be:
[0066] ;
[0067] Among them, is the function value of the target performance function; is the number of iterations, , and are weights; is the deviation between the target value input to the PID model and the actual value corresponding to the target value; is the square term of the control input; is the overshoot.
[0068] S12. Use the variable range of the target variable to determine the variable set of the target variable.
[0069] Among them, the variable set includes a variable value of each target variable.
[0070] When optimizing the parameters of PID control, parameter optimization methods that can be used include indirect optimization methods, gradient methods, simplex methods, etc. These algorithms are prone to falling into local optima or being sensitive to initial values, resulting in optimization failure. Genetic algorithms (abbreviated as GA), on the other hand, are a parallel random search optimization algorithm that simulates the genetic mechanism in nature and the biological evolution process. Based on the biological evolution principle of "survival of the fittest", by concatenating the codes formed by the parameters to be optimized into the population and simulating the replication, crossover, and mutation behaviors in genetics, and by selecting a suitable fitness function to screen individuals, the individuals with high fitness values are retained to form a new population. The new population not only inherits the information of the previous generation but also is superior to the previous generation. Repeating the above process, through continuous iteration, the fitness of individuals in the population is continuously improved until the conditions are met. It has the advantages of simple algorithm, parallel processing, and obtaining the global optimum, and is suitable for parameter optimization of PID controllers. Therefore, in the embodiments of the present invention, genetic algorithms are used for parameter optimization of PID controllers.
[0071] When running genetic algorithms on the GCK platform, since the GCKontrol simulation software itself does not have a genetic algorithm function configured, the operation of genetic algorithms and the operation of the PID model are two independent parts, and genetic algorithms cannot obtain the intermediate variables in the PID model, such as , the numerical values, and thus cannot calculate the function value of the target performance function.
[0072] For this reason, in the embodiments of the present invention, an interface programmed in the Python language is developed, and the interface name of this interface can be Jupyter. Jupyter is an open-source interactive computing environment interface. By developing Jupyter of Python scripts within GCKontrol-Jupyter, the function augmentation of the GCKonrtol model is realized, and the use of the GCKontrol simulation platform is improved and expanded.
[0073] GCKontrol internally integrates the Jupyter function, and through underlying development, the co-simulation of the PID model established by GCKontrol and Jupyter is realized, and the variable values of the intermediate variables in the PID model are obtained to transmit the collected intermediate variables to the genetic algorithm.
[0074] When specifically using genetic algorithms, the population of target variables (including the above ) can be determined. The population determined for the first time is called the initial population, and the populations determined for the second time and later are called subsequent populations. The size of the population can be determined according to the actual calculation complexity. The population in the embodiments of the present invention is called the variable set of target variables.
[0075] In an actual scenario, in order to improve the accuracy of target variable determination, a variable range of the target variable can be pre-configured. An embodiment of a variable range can be as follows:
[0076]
[0077] Among them, In the corresponding variable ranges respectively, 、 and are the left boundary values, that is, the minimum values, 、 and are the right boundary values, that is, the maximum values.
[0078] The above variable range is a relatively optimal range. Within this range, the performance of the PID control system can be relatively optimal. In the embodiment of the present invention, using in the above variable range, multiple variable sets are combined. Each variable set includes one 、one and one .
[0079] In one implementation manner, using the variable range of the target variable to determine the variable set of the target variable includes:
[0080] S21. For the target variable, determine multiple variable values located within the variable range of the target variable.
[0081] Specifically, for the above target variables 、 and , each target variable has a corresponding variable range. Refer to the above corresponding description for details.
[0082] In one embodiment, after obtaining the variable range of the target variable, multiple variable values can be randomly generated within the variable range of the target variable by using a random function.
[0083] Specifically, when the random function selects variable values, it can randomly generate from within the variable range. The randomly generated variable values can be decimals or integers. The number of generated variable values can be configured according to the actual situation. Generally, the more the number of variable values, the more accurate the finally iteratively determined. Therefore, within the processing capacity of the GCK platform, a larger number of variable values can be selected.
[0084] S22. Generate a binary string for each variable value located within the variable range of the target variable.
[0085] Specifically, for each variable value, its corresponding binary string can be generated using binary encoding, and the correspondence between the binary string and the corresponding variable value can be established.
[0086] During binary encoding, it can be encoded according to the requirements of controlling the precision.
[0087] In addition, during binary encoding, since decimals cannot be recognized by the binary encoding algorithm, for the random variable values between 0 and 1 generated by the random function, the variable values between 0 and 0.5 can be replaced with 0, and the variable values between 0.5 and 1 can be replaced with 1, so as to be encoded normally in subsequent binary encoding and reduce the computational complexity.
[0088] S23. Randomly combine the binary strings of each target variable to obtain a variable set.
[0089] Among them, the variable set includes one variable value of each target variable.
[0090] Specifically, for each target variable, there are multiple corresponding binary strings, and each binary string represents a variable value. Then, for the three target variables , their binary strings are randomly combined.
[0091] For example, select one binary string from the corresponding binary strings, select one binary string from the corresponding binary strings, select one binary string from the corresponding binary strings, and then combine the three selected binary strings in the order to obtain an initial population, which is also called a variable set. Then, perform the above process of selecting binary strings, repeat the above steps until each binary string is selected for combination, and obtain N variable sets, where N is a positive integer.
[0092] In this embodiment, N variable sets are randomly generated, and the individuals in each population are binary strings, so as to use more variable sets for the application of the genetic algorithm in the subsequent process.
[0093] S13. Set the variable values of the target variables in the control system model to the corresponding variable values in the variable set.
[0094] Specifically, each of the above variable sets includes one , one and one , to obtain multiple For the value examples, for each example, set the variable value of the target variable in the control system model to the corresponding variable value in the variable set, so as to input the target value into the PID model, and use this to perform PID control to obtain the above , numerical values to calculate the function value of the target performance function.
[0095] S14. Use the interface configured in the preset simulation platform that can call the control system model to obtain the variable values of the intermediate variables in the control system model, and calculate the function value of the target performance function using the variable values of the intermediate variables.
[0096] Specifically, according to the above discussion, since the GCKontrol simulation software itself does not have a corresponding genetic algorithm function, a Jupyter interface was developed to establish a connection between the genetic algorithm and the PID model.
[0097] In one embodiment, an interface configured in the preset simulation platform that can call the control system model can be determined from multiple interfaces. This interface is Jupyter, and Jupyter uses an API (Application Programming Interface) interface programmed in the Python language.
[0098] Then, call the interface to obtain the variable values of the intermediate variables in the control system model.
[0099] The intermediate variables include the deviation between the target value input to the PID model and the actual value corresponding to the target value and the square term of the control input .
[0100] Substitute and into , and the function value of the target performance function can be obtained. Among them, = (Maximum Out - Steady - state Out) / Steady - state Out.
[0101] S15. Determine whether the function value of the target performance function does not satisfy the iteration stop condition; if so, execute step S16; if not, execute step S17.
[0102] In one embodiment, the iteration stop condition means that the function value of the target performance function is the minimum value among all the function values of the target performance functions, that is, during multiple iterations, a function value of the target performance function obtained is less than the function value of the target performance function obtained before it and also less than the function value of the target performance function obtained after it.
[0103] Generally, in the first iteration operation, the function value of the obtained objective performance function will not be the optimal value. Instead, it is necessary to perform multiple iteration operations before the optimal value can be obtained.
[0104] For each obtained variable set, the function value of the corresponding objective performance function is obtained through the above steps. Through the first iteration, the function values of multiple objective performance functions can be obtained, and then the second iteration operation is continued.
[0105] S16. Perform a numerical adjustment operation on the variable set to obtain a new variable set.
[0106] Specifically, in the case where the function value of the objective performance function does not satisfy the iteration stop condition, a numerical adjustment operation is performed on the variable set to obtain a new variable set.
[0107] In one embodiment, since a genetic algorithm is used for parameter optimization, in this embodiment, performing the numerical adjustment operation specifically refers to performing copy, crossover, and mutation operations on the variable set to obtain a new variable set.
[0108] Specifically, perform the copy, crossover, and mutation operations of the genetic algorithm to generate the next generation population, that is, a new variable set.
[0109] In this embodiment, the genetic algorithm is a stochastic heuristic search algorithm formed by simulating the evolutionary development law of biological populations in nature based on the principle of "survival of the fittest and elimination of the unfit", with good robustness and powerful global search capabilities. The genetic algorithm has the characteristics of parallel computing, can improve the computing speed through large-scale parallel computing, is more suitable for the optimization of large-scale complex problems, does not require any initialization information, and is an efficient optimization combination method that can seek the global optimal solution. Without the need to give the initial parameters of the regulator, it can still find suitable parameters to meet the control objective requirements.
[0110] The genetic algorithm retains the global search strategy based on the population, has the advantages of convenient operation and fast speed, does not require complex rules, and only needs to simply copy, crossover, and mutate the encoded string to achieve optimization, thus avoiding a large number of simulation experiments. It starts parallel operations from many points and performs efficient heuristic search in the solution space, overcoming the drawbacks of starting from a single point and the blindness of the search, so that the optimization speed is faster and the local optimal solution can be avoided.
[0111] After using the copy, crossover, and mutation operations of the genetic algorithm to generate the next generation population, that is, a new variable set, return to execute step S13 to perform the next iteration operation to obtain the corresponding function value of the objective performance function.
[0112] S17. Obtain the set of target variables corresponding to the function value of the target performance function that satisfies the iteration stop condition.
[0113] Specifically, if the function value of a certain target performance function is less than the function value of the target performance function obtained before it and also less than the function value of the target performance function obtained after it, the iteration can be stopped, and the used to calculate the function value of this target performance function is taken as the set of target variables.
[0114] For example, after multiple iterations, the function value of a target performance function is obtained, which is less than the function value of the target performance function obtained before it. Then, the next iteration is continued to determine whether there is a smaller function value of the target performance function. After the next iteration, the function value of the target performance function obtained is greater than this function value of the target performance function. At this time, the iteration operation can be stopped. Or after the next-next iteration, it is found that the function value of the target performance function obtained is still greater than this function value of the target performance function. At this time, the iteration is stopped, the parameters converge, and the set of target variables is obtained.
[0115] In addition, the maximum number of iterations can also be configured. When the maximum number of iterations is reached, the iteration operation is stopped, and the function value of the smallest target performance function is selected. The variable set corresponding to it is the set of target variables.
[0116] In addition, other metric levels can also be set. When the predetermined metric level is reached, the iteration operation is stopped to obtain the set of target variables. Which specific method is used to obtain the set of target variables can be configured according to the actual situation.
[0117] In one embodiment, the entire implementation process of the genetic algorithm is as Figure 4 shown. First, obtain the above-mentioned target variables, then perform binary encoding on the variable values of the target variables to obtain binary strings, and combine the binary strings of different target variables to obtain a variable set. Each variable set is a population. Then, use the variable values of the target variables in the population, use the Python API of GCKontrol to obtain the name of the currently running model, and obtain the variable values of the intermediate variables required in the model. Use the variable values of the intermediate variables to calculate the function value of the target performance function.
[0118] If the function value of the target performance function does not satisfy the iteration stop condition, genetic operations such as replication, crossover, and mutation are performed to obtain a new variable set, and then the above operations are repeated.
[0119] If the function value of the target performance function satisfies the iteration stop condition, a decoding operation is performed on the variable set, and the binary strings in the variable set are decoded into decimal numbers to obtain the optimal variable values of the target variables, that is, The value of. Subsequently, the value of can be configured into the PID control system and corresponding control operations can be performed.
[0120] The above implementation process in this embodiment is realized by using the Jupyter module of Python programming in the GCK platform. The variable value of the intermediate variable is obtained through the Python API (Jupyter), and the variable value of the intermediate variable is brought into the GA algorithm in Jupyter for iterative loop until the optimal value of the objective performance function is obtained. The optimal value of the objective performance function at this time is the optimized optimal PID parameter value.
[0121] During the GA optimization process, as Figure 5 shown, the abscissa is the number of iterations, and the ordinate is the objective performance function value. The objective performance function continually decreases as the population iteration number increases, its value is continuously optimized, and finally tends to a stable value.
[0122] As Figure 6 shown, when the system is controlled using the control parameters obtained by the above genetic algorithm, the step response signal (dashed line) of the PID control system. The step response signal can quickly tend to the stable value (solid line) with the minimum overshoot.
[0123] In this embodiment, the parameters of the PID controller of the controlled object model built on the GCK platform can be automatically optimized, so that the design index of the control system reaches the optimum, effectively saving the time cost of the control system.
[0124] Based on the above embodiment of the parameter optimization method, another embodiment of the present application provides a parameter optimization device. Referring to Figure 7 , it may include:
[0125] A variable acquisition module 11, configured to acquire a target variable in a control system model built on a preset simulation platform;
[0126] A set determination module 12, configured to determine a variable set of the target variable by using the variable range of the target variable, where the variable set includes a variable value of each target variable;
[0127] A setting module 13, configured to set the variable value of the target variable in the control system model to the corresponding variable value in the variable set;
[0128] The function value calculation module 14 is configured to obtain the variable values of the intermediate variables in the control system model by using the interface of the preset simulation platform that can call the control system model, and calculate the function value of the target performance function by using the variable values of the intermediate variables;
[0129] The numerical adjustment module 15 is configured to perform a numerical adjustment operation on the variable set when the function value of the target performance function does not meet the iteration stop condition, to obtain a new variable set;
[0130] The setting module 13 is further configured to, after the numerical adjustment module 15 performs a numerical adjustment operation on the variable set to obtain a new variable set, set the variable value of the target variable in the control system model to the corresponding variable value in the variable set;
[0131] The data determination module 16 is configured to obtain the target variable set of the target variable corresponding to the function value of the target performance function that meets the iteration stop condition when the function value of the target performance function meets the iteration stop condition.
[0132] In one implementation, the control system model is a PID model;
[0133] The target performance function is:
[0134] ;
[0135] Wherein, is the function value of the target performance function; is the number of iterations, , and are weights; is the deviation between the target value input to the PID model and the actual value corresponding to the target value; is the square term of the control input; is the overshoot.
[0136] In one implementation, the set determination module 12 includes:
[0137] The variable value determination sub-module is configured to determine, for the target variable, a plurality of variable values within the variable range of the target variable;
[0138] The binary string generation sub-module is configured to generate a binary string for each variable value within the variable range of the target variable;
[0139] The combination sub-module is configured to randomly combine the binary strings of each target variable to obtain a variable set; the variable set includes one variable value of each target variable.
[0140] In one implementation, the variable value determination sub-module is specifically configured to:
[0141] In the variable range of the target variable, use a random function to randomly generate multiple variable values.
[0142] In one implementation, the function value calculation module 14 is specifically configured to:
[0143] Determine the interface that can call the control system model configured by the preset simulation platform; the interface is an interface programmed in the Python language; call the interface to obtain the variable values of the intermediate variables in the control system model; the intermediate variables include the deviation between the target value input by the PID model and the actual value corresponding to the target value, and the square term of the control input.
[0144] In one implementation, the numerical adjustment module 15 is specifically configured to:
[0145] Perform copy, crossover, and mutation operations on the variable set to obtain a new variable set.
[0146] In one implementation, the iteration stop condition includes: the function value of the target performance function is the minimum value among all the function values of the target performance functions.
[0147] In this application, obtain the target variables in the control system model built on a preset simulation platform, such as the GCK platform, use the variable range of the target variables to determine the variable set of the target variables, set the variable values of the target variables in the control system model to the corresponding variable values in the variable set, use the interface configured by the preset simulation platform that can call the control system model to obtain the variable values of the intermediate variables in the control system model, calculate the function value of the target performance function using the variable values of the intermediate variables, and in the case where the function value of the target performance function does not meet the iteration stop condition, perform a numerical adjustment operation on the variable set to obtain a new variable set, and return to execute the step of setting the variable values of the target variables in the control system model to the corresponding variable values in the variable set, and execute sequentially until the target variable set corresponding to the function value of the target performance function that meets the iteration stop condition is obtained and then stop. In this application, by using the interface configured by the preset simulation platform that can call the control system model, a connection is established between the control system model and the iterative operation, so that the variable values of the intermediate variables in the control system model can be obtained, the iterative operation can be realized, the optimal target variable set can be obtained, and the purpose of completing PID control parameter optimization using the GCK platform is realized.
[0148] It should be noted that for the working processes of each module and sub-module in this embodiment, please refer to the corresponding descriptions in the above embodiments, and details will not be repeated here.
[0149] An electronic device is further provided in an embodiment of the present application. The electronic device may be an electronic device configured with the above-mentioned GCK platform. The electronic device includes at least one processor and a memory connected to the processor, wherein:
[0150] The memory is used for storing a computer program;
[0151] The processor is used for executing the computer program so that the electronic device can implement the above-mentioned parameter optimization method.
[0152] Reference Figure 8 As shown, it shows a schematic structural diagram of an electronic device suitable for implementing the electronic device in an embodiment of the present application. The electronic device in an embodiment of the present application may include, but is not limited to, fixed terminals such as cloud, mobile phone, laptop, PDA (Personal Digital Assistant), PAD (Tablet Computer), desktop computer, and so on. Figure 8 The electronic device shown is only an example and should not impose any limitation on the functions and usage scope of the embodiments of the present application.
[0153] As Figure 8 shown, the electronic device may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 603. The processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0154] Generally, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a memory card, a hard disk, etc.; and a communication device 609. The communication device 609 can allow the electronic device to communicate with other devices wirelessly or wiredly to exchange data. Although Figure 8 the electronic device with various devices is shown, it should be understood that it is not required to implement or have all the shown devices. More or fewer devices may be alternatively implemented or had.
[0155] An embodiment of the present application further provides a computer program product, including computer-readable instructions, which, when running on an electronic device, enable the electronic device to implement any one of the parameter optimization methods provided by the embodiments of the present application.
[0156] An embodiment of the present application further provides a computer-readable storage medium, which carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, can enable the electronic device to implement any one of the parameter optimization methods provided by the embodiments of the present application.
[0157] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A parameter optimization method, characterized in that: include: Obtain target variables in the control system model built on a preset simulation platform; Determine a variable set of the target variable using the variable range of the target variable, wherein the variable set includes a variable value of each target variable; Setting the variable value of the target variable in the control system model to the corresponding variable value in the variable set; Using the interface configured by the preset simulation platform that can call the control system model, obtaining the variable value of the intermediate variable in the control system model, and calculating the function value of the target performance function using the variable value of the intermediate variable; When the function value of the target performance function does not satisfy the iteration stop condition, performing a numerical adjustment operation on the variable set to obtain a new variable set; Return to the step of setting the variable value of the target variable in the control system model to the corresponding variable value in the variable set, and execute sequentially until the target variable set of the target variable corresponding to the function value of the target performance function that meets the iteration stop condition is obtained.
2. The parameter optimization method according to claim 1, characterized in that: The control system model is a PID model; The objective performance function is: ; in, is the function value of the target performance function; is the number of iterations, , and is the weight; The deviation between the target value input to the PID model and the actual value corresponding to the target value; is the square term of the control input; is the overshoot.
3. The parameter optimization method according to claim 1 or 2, characterized in that: Using the variable range of the target variable, determining the variable set of the target variable includes: For the target variable, determining a plurality of variable values that are within a variable range of the target variable; Generate a binary string for each variable value in the variable range of the target variable; The binary strings of each target variable are randomly combined to obtain a variable set; the variable set includes a variable value of each target variable.
4. The parameter optimization method according to claim 3, characterized in that: Determining a plurality of variable values that are within a variable range of the target variable includes: In the variable range of the target variable, a plurality of variable values are randomly generated using a random function.
5. The parameter optimization method according to claim 1 or 2, characterized in that: Utilizing the interface capable of calling the control system model configured by the preset simulation platform to obtain the variable value of the intermediate variable in the control system model, including: Determine an interface configured by the preset simulation platform that can call the control system model; the interface is an interface programmed in Python language; The interface is called to obtain the variable value of the intermediate variable in the control system model; the intermediate variable includes the deviation between the target value input by the PID model and the actual value corresponding to the target value, and the square term of the control input.
6. The parameter optimization method according to claim 1 or 2, characterized in that: Performing a numerical adjustment operation on the variable set to obtain a new variable set includes: The variable set is copied, crossed and mutated to obtain a new variable set.
7. The parameter optimization method according to claim 1 or 2, characterized in that: The iteration stopping condition includes: the function value of the target performance function is the minimum value among the function values of all target performance functions.
8. A parameter optimization device, characterized in that: include: A variable acquisition module is used to obtain target variables in a control system model built on a preset simulation platform; A set determination module, used to determine a variable set of the target variable using the variable range of the target variable, wherein the variable set includes a variable value of each target variable; A setting module, used to set the variable value of the target variable in the control system model to the corresponding variable value in the variable set; A function value calculation module, configured to obtain the variable value of the intermediate variable in the control system model by using the interface capable of calling the control system model configured by the preset simulation platform, and calculate the function value of the target performance function by using the variable value of the intermediate variable; A numerical adjustment module, used for performing a numerical adjustment operation on the variable set to obtain a new variable set when the function value of the target performance function does not satisfy the iteration stop condition; The setting module is further configured to set the variable value of the target variable in the control system model to the corresponding variable value in the variable set after the value adjustment module performs a value adjustment operation on the variable set to obtain a new variable set; The data determination module is used to obtain a target variable set of the target variables corresponding to the function value of the target performance function that meets the iteration stop condition when the function value of the target performance function meets the iteration stop condition.
9. An electronic device, characterized in that: The method comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the parameter optimization method as described in any one of claims 1 to 7.
10. A computer storage medium, characterized in that: The storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can implement the parameter optimization method as described in any one of claims 1 to 7.