Disclosure of Invention
The application aims to solve the technical problems that: in the prior art, the optimization efficiency of feedback parameters of a feedback controller is low.
In order to solve the technical problems, the application provides a method and a device for acquiring optimization parameters of a feedback controller.
A feedback controller optimization parameter acquisition method comprises the following steps:
acquiring an output actual value of a control system applying a feedback controller in an operation test and a parameter value of each feedback parameter of the feedback controller;
based on the output actual value and the parameter value of each feedback parameter, respectively calculating the gradient value corresponding to each feedback parameter;
calculating according to a preset output set value and the output actual value to obtain an output error;
and solving a parameter value which enables a preset error objective function to reach a minimum value based on the output error and the gradient value corresponding to the feedback parameter, and obtaining an optimized parameter value corresponding to the feedback parameter.
In one embodiment, before the obtaining the actual output value of the control system of the feedback controller and the parameter values of the feedback parameters of the feedback controller in the operation test, the method further includes:
performing a first operation test with input disturbance of 0 on a control system applying the feedback controller to obtain an output actual value of the first operation test;
calculating a difference value between a preset output set value and an output actual value of the first operation test to obtain an output error of the first operation test;
setting the input disturbance of the second operation test as the output error of the first operation test, and performing the second operation test on the control system to obtain the output actual value of the second operation test;
and performing a third operation test with the input disturbance of 0 on the control system to obtain an output actual value of the third operation test.
In one embodiment, the calculating the gradient value corresponding to each feedback parameter based on the output actual value and the parameter value of each feedback parameter includes:
where ρ represents a feedback parameter,representing the gradient value corresponding to the feedback parameter ρ, C fb Y is the transfer function of the feedback controller III For the output actual value of the third run test, y II And outputting an actual value for the second run test.
In one embodiment, the calculating the output error according to the preset output set value and the output actual value includes:
selecting an output actual value of any one of the first operation test, the second operation test and the third operation test;
and calculating a difference value between a preset output set value and an output actual value in the selected operation test to obtain the output error.
In one embodiment, the output actual values include a plurality of output actual values obtained by sampling according to a set frequency in the operation test, and the number of gradient values and the number of output errors corresponding to one feedback parameter are equal to the number of output values acquired in one operation test.
In one embodiment, the preset error objective function includes:
the step of solving the parameter value which enables the preset error objective function to reach the minimum value based on the output error and the gradient value corresponding to the feedback parameter to obtain the optimized parameter value corresponding to the feedback parameter comprises the following steps of solving the formula:
wherein ,
in the formula ,ρi+1 Optimizing parameter values, ρ, for the (i+1) th of the feedback parameter, ρ i Optimizing parameter values, gamma, for the ith of the feedback parameter ρ i For the step size of the ith iteration, H is the Hessian matrix,the gradient value of a preset error objective function corresponding to the feedback parameter rho is obtained; n represents the number of samples of said output actual value, < >>The gradient value corresponding to the feedback parameter ρ at the output actual value sampled at the t-th sampling time is represented, and the output error corresponding to the feedback parameter ρ at the output actual value sampled at the t-th sampling time is represented by e (t, ρ).
A feedback controller optimization parameter acquisition device, comprising:
the data acquisition module is used for acquiring the output actual value of a control system applying the feedback controller in the running test and the parameter value of each feedback parameter of the feedback controller;
the gradient calculation module is used for calculating gradient values corresponding to the feedback parameters respectively based on the output actual values and the parameter values of the feedback parameters;
the error calculation module is used for calculating an output error according to a preset output set value and the output actual value;
and the parameter optimization module is used for solving a parameter value which enables a preset error objective function to reach a minimum value based on the output error and the gradient value corresponding to the feedback parameter, and obtaining an optimized parameter value corresponding to the feedback parameter.
In one embodiment, the feedback controller optimization parameter obtaining device further includes a test data obtaining module, configured to:
performing a first operation test with input disturbance of 0 on a control system applying the feedback controller to obtain an output actual value of the first operation test;
calculating a difference value between a preset output set value and an output actual value of the first operation test to obtain an output error of the first operation test;
setting the input disturbance of the second operation test as the output error of the first operation test, and performing the second operation test on the control system to obtain the output actual value of the second operation test;
and performing a third operation test with the input disturbance of 0 on the control system to obtain an output actual value of the third operation test.
In one embodiment, the gradient calculation module is configured to calculate the gradient according to the formula:
calculating a gradient value corresponding to each feedback parameter; where ρ represents a feedback parameter,representing the gradient value corresponding to the feedback parameter ρ, C fb Y is the transfer function of the feedback controller III For the output actual value of the third run test, y II And outputting an actual value for the second run test.
In one embodiment, the error calculation module selects an output actual value of any one of the first run test, the second run test, and the third run test; and calculating a difference value between a preset output set value and an output actual value in the selected operation test to obtain the output error.
In one embodiment, the output actual values include a plurality of output actual values obtained by sampling according to a set frequency in the operation test, and the number of gradient values and the number of output errors corresponding to one feedback parameter are equal to the number of output values acquired in one operation test.
In one embodiment, the preset error objective function includes:
the parameter optimization module solves the formula:
wherein ,
in the formula ,ρi+1 Optimizing parameter values, ρ, for the (i+1) th of the feedback parameter, ρ i Optimizing parameter values, gamma, for the ith of the feedback parameter ρ i For the step size of the ith iteration, H is the Hessian matrix,the gradient value of a preset error objective function corresponding to the feedback parameter rho is obtained; n represents the number of samples of said output actual value, < >>The gradient value corresponding to the feedback parameter ρ at the output actual value sampled at the t-th sampling time is represented, and the output error corresponding to the feedback parameter ρ at the output actual value sampled at the t-th sampling time is represented by e (t, ρ).
One or more embodiments of the above-described solution may have the following advantages or benefits compared to the prior art:
the method comprises the steps of calculating the gradient value and the output error corresponding to the feedback parameter by adopting the output actual value of the control system and the parameter value of the feedback parameter in the operation test, solving the optimized parameter value which enables the preset error objective function to reach the minimum value based on the output error and the gradient value corresponding to the feedback parameter, realizing automatic acquisition of the optimized parameter value, avoiding manual adjustment and having high optimization efficiency. In addition, after the output actual value and the parameter value of the feedback parameter are obtained through the operation test, the optimized parameter value of each feedback parameter is obtained through calculation and solution, compared with the optimized data obtained through the adjustment parameter operation test, the coupling influence of the feedback parameter in the parameter adjustment process can be avoided, and the optimization effect is better.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the following detailed description of the implementation method of the present application will be given with reference to the accompanying drawings and examples, by which the technical means are applied to solve the technical problems, and the implementation process for achieving the technical effects can be fully understood and implemented accordingly.
In the prior art, taking a control loop of a feedback controller applied to a workpiece table as an example, manually adjusting parameters by running a section of track by applying current feedback parameters, and recording errors; then adding an increment on the basis of the current feedback parameters, running the same track again, and recording errors; and comparing the two errors, and adjusting the feedback parameters towards the direction of error reduction until the error is observed to be unable to be reduced. The method requires debugging personnel to move tracks respectively and adjust the three feedback parameters independently, and the adjustment direction and adjustment amount of the parameters for reducing the error are needed to be considered, so that time and labor are wasted, and the optimization efficiency of the feedback parameters is low. Furthermore, due to the coupling of the three P, I, D parameters, sometimes the optimal parameters cannot be found.
Based on the above, the application provides a scheme capable of improving the optimization efficiency.
In one embodiment, a method for obtaining optimized parameters of a feedback controller is provided, as shown in fig. 1, and the method includes the following steps:
s110: and obtaining the output actual value of a control system applying the feedback controller in the operation test and the parameter value of each feedback parameter of the feedback controller.
The operation test is to perform an operation track test on the control system, and the output actual value is the actual output value of the control system obtained by performing the operation test on the control system. For example, for a workpiece stage to which a feedback controller is applied, the actual value is output as an actual value representing the position. The control system is a system employing a feedback controller comprising a plurality of feedback parameters, such as for a PID controller, the feedback parameters comprise a P-parameter, an I-parameter, and a D-parameter; each time the control system is subjected to operation test, the parameter value of the feedback parameter and the output actual value of the control system are corresponding.
S130: and respectively calculating gradient values corresponding to the feedback parameters based on the output actual values and the parameter values of the feedback parameters.
Specifically, the gradient value corresponding to the feedback parameter is a bias derivative of the output actual value to the feedback parameter.
S150: and calculating according to a preset output set value and an output actual value to obtain an output error.
The output set value can be preset according to a target value reached by actual needs. For example, for a workpiece stage, the output set value is a target position value. Specifically, the output error is a difference between the output set value and the output actual value.
S170: and solving a parameter value which enables the preset error objective function to reach a minimum value based on the output error and the gradient value corresponding to the feedback parameter, and obtaining an optimized parameter value corresponding to the feedback parameter.
The preset error objective function is a function representing the output error of the output set value and the output actual value; the smaller the value of the preset error objective function is, the smaller the output error is, and the better the value of the parameter of the feedback parameter is.
And respectively solving different feedback parameters to obtain an optimized parameter value corresponding to the feedback parameter, thereby obtaining the optimized parameter value of each feedback parameter of the feedback controller. For example, based on the output error and the gradient value corresponding to the P parameter, solving the parameter value enabling the preset error objective function to reach the minimum value to obtain the optimized parameter value of the P parameter; based on the output error and the gradient value corresponding to the I parameter, solving a parameter value enabling a preset error objective function to reach a minimum value, and obtaining an optimized parameter value of the I parameter; and solving a parameter value which enables the preset error objective function to reach a minimum value based on the output error and the gradient value corresponding to the D parameter, and obtaining an optimized parameter value of the D parameter.
According to the method for obtaining the optimized parameters of the feedback controller, the output actual value of the control system and the parameter value of the feedback parameter in the operation test are adopted, the gradient value and the output error corresponding to the feedback parameter are calculated, and the optimized parameter value enabling the preset error objective function to reach the minimum value is solved based on the output error and the gradient value corresponding to the feedback parameter, so that the optimized parameter value is automatically obtained, manual adjustment is not needed, and the optimization efficiency is high. In addition, after the output actual value and the parameter value of the feedback parameter are obtained through the operation test, the optimized parameter value of each feedback parameter is obtained through calculation and solution, compared with the optimized data obtained through the adjustment parameter operation test, the coupling influence of the feedback parameter in the parameter adjustment process can be avoided, and the optimization effect is better.
By applying the feedback controller optimization parameter acquisition method to the control loop of the workpiece table, experiments prove that the working efficiency can be obviously improved, the degree of freedom feedback of the micro-motion table 6 is set to be lower than half a day, and the error can be reduced by at least 60%.
In one embodiment, step S110 is preceded by steps (a 1) to (a 4).
Step (a 1): and performing a first operation test with input disturbance of 0 on a control system applying the feedback controller to obtain an output actual value of the first operation test.
The control system of the feedback controller is applied, input data, output data, input disturbance, feedback parameters of the feedback controller and the like are generally set before operation, and the output data is obtained through operation. For the first operation test, setting the input disturbance to 0, setting other data to be set according to actual requirements, and operating to obtain the output actual value of the control system under the current feedback parameters.
Step (a 2): and calculating a difference value between a preset output set value and an output actual value of the first operation test to obtain an output error of the first operation test.
Specifically, the difference between the output set value and the actual output value of the first running test may be calculated to obtain the output error of the first running test.
Step (a 3): setting the input disturbance of the second operation test as the output error of the first operation test, and performing the second operation test on the control system to obtain the output actual value of the second operation test.
The difference between the second run test and the first run test is that the input disturbance of the second run test is set to be the output error of the first run test, and the other data settings may not be changed.
Step (a 4): and performing a third operation test with the input disturbance of 0 on the control system to obtain an output actual value of the third operation test.
Specifically, the third run test is identical to the first run test. The output actual value of the third run test is used for subsequent calculation, and the first run test is used for obtaining the input disturbance required by the second run test. The output actual value of the control system under the condition of the parameter value of the feedback parameter set by the feedback controller can be accurately obtained through the first operation test, the second operation test and the third operation test. Specifically, for each feedback parameter, one round of a first run test, a second run test, and a third run test was performed.
In one embodiment, step S130 includes:
where ρ represents a feedback parameter,representing the gradient value corresponding to the feedback parameter ρ, C fb For the transfer function of the feedback controller, y III For the output actual value of the third run test, y II The actual value is output for the second run test.
The gradient value corresponding to the feedback parameter ρ can be calculated by using the above formula 1. Specifically, for each feedback parameter, the parameter value thereof may be substituted into ρ in equation 1, and the gradient value corresponding to the feedback parameter is calculated.
Taking a system of a workpiece table as an example, a control block diagram is shown in fig. 2. Wherein r is input, y is output, C ff C is a feedforward controller fb The device is a feedback controller, P is a workpiece table, v is external disturbance, and w is input disturbance.
First run test:
setting w=0. Thus, the input-output expression of the system is:
wherein :
from the above expression, it is possible to obtain:
wherein S is a sensitivity function and T is a process sensitivity function; p represents the mechanical transfer function of the workpiece table; c (C) ff 、C fb Representing transfer functions of a feedforward controller and a feedback controller respectively; r is equal to the output set value, i.e. the input data, v I For the external disturbance value of the first running test, y I For the output actual value of the first run test, (r-y) I ) I.e. the output error e of the first run test I 。And the deviation of the actual output value of the first running test to the feedback parameter rho is adopted.
Second run test:
setting w=e I Namely, the output error of the first running test is taken as input disturbance to be input into the system, the input and output expression of the system is now:
in the formula ,vII For the external disturbance value of the second running test, y II The actual value is output for the second run test.
The purpose of the second run test is to obtainHowever, this requires ensuring that the noise and +.>Is not correlated and therefore requires a third run of the test trial.
Third run test:
the third run test is identical to the first run test, the input disturbance is set to zero, i.e. w=0, and then the input-output expression of the system is:
in the formula ,vIII For the external disturbance value of the third running test, y III The actual value is output for the third run test.
Through the three operation test tests, the following can be obtained:
T(r-y I )=y III -y II +S(v II -v III );
assuming that the noise is white, the expectations of the above equation are:
est{T(r-y I )}=y III -y II ;
then equation 1 can be derived:
by adopting three running test experiments and combining the formula 1, the gradient value corresponding to the feedback parameter can be accurately calculated.
In one embodiment, step S150 includes: selecting an output actual value of any one of the first operation test, the second operation test and the third operation test; and calculating a difference value between a preset output set value and an output actual value in the selected operation test to obtain an output error.
The output actual value which is optionally output once in three running test experiments is used for calculating the output error, so that the processing is simple and convenient. It will be appreciated that in other embodiments, step S150 may also be the actual value of the output obtained by performing additional operational tests on the control system.
In one embodiment, the output actual values include a plurality of output actual values obtained by sampling according to a set frequency in the operation test, and the number of gradient values and output errors corresponding to one feedback parameter is equal to the number of output values acquired in one operation test.
Specifically, each running test is sampled according to a set frequency to obtain a plurality of output actual values. Taking the sampling number as N as an example, obtaining N output actual values by the first operation test sampling, obtaining N output actual values by the second operation test sampling, and obtaining N output actual values by the third operation test sampling. Correspondingly, in step S130, based on the parameter value of the feedback parameter and the first output actual values of the second operation test and the third operation test, a first gradient value may be obtained, based on the parameter value of the feedback parameter and the second output actual values of the second operation test and the third operation test, a second gradient value may be obtained, and so on, N gradient values corresponding to the feedback parameter are calculated. In step S150, a difference between the preset output set value and the first output actual value is calculated to obtain a first output error, a difference between the preset output set value and the second output actual value is calculated to obtain a second output error, and thus, N output errors can be calculated.
Further, the preset error objective function includes:
based on the output error and the gradient value corresponding to the feedback parameter, solving the parameter value enabling the preset error objective function to reach the minimum value to obtain the optimized parameter value corresponding to the feedback parameter, and comprising the following steps of solving the formula:
wherein ,
in the formula ,ρi+1 Optimizing parameter values, ρ, for the (i+1) th of the feedback parameter, ρ i Optimizing parameter values, gamma, for the ith of the feedback parameter ρ i For the step size of the ith iteration, H is the Hessian matrix,the gradient value of the preset error objective function corresponding to the feedback parameter rho is the deviation of the preset error objective function to the feedback parameter rho; n represents the number of samples of the output actual value, +.>The gradient value corresponding to the feedback parameter ρ at the output actual value sampled at the t-th sampling time is represented, and the output error corresponding to the feedback parameter ρ at the output actual value sampled at the t-th sampling time is represented by e (t, ρ).
And solving rho which enables the preset error objective function to reach the minimum value in the formula 2 by applying the Gauss Newton method principle, wherein the iterative expression of rho is formula 3. Solving equation 3 based on equations 4 and 5 to obtain ρ i+1 In order to make the formula 2 reach the parameter value of the minimum value, namely the optimized parameter value of the feedback parameter ρ, the parameter optimization result is excellent.
In one embodiment, as shown in fig. 3, three tests, a first run test, a second run test, and a third run test, are performed for each of the three parameters P, I, D. Taking the P parameter as an example, substituting the value calculated by equation 1 obtained by three experiments based on the P parameter into Gauss Newton's method expression (equation 3-equation 5), namelyAnd (3) solving a parameter P which is equal to the value calculated by the formula 1 and enables the preset error objective function J to reach the minimum value as an optimal value of the parameter P. And similarly, obtaining the optimal values of the I parameter and the D parameter, and simultaneously setting the three parameters.
It should be understood that, although the steps in the flowchart of fig. 1 are shown in sequence as indicated by the arrows, the steps are not necessarily performed in sequence as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least a portion of the steps in fig. 1 may include a plurality of steps or stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily sequential, but may be performed in rotation or alternatively with at least a portion of the steps or stages in other steps or other steps.
In one embodiment, a feedback controller optimization parameter acquisition device is provided. As shown in fig. 4, the feedback controller optimization parameter acquisition device includes a data acquisition module 410, a gradient calculation module 430, an error calculation module 450, and a parameter optimization module 470.
The data acquisition module 410 is configured to acquire an actual output value of a control system to which the feedback controller is applied in the running test, and a parameter value of each feedback parameter of the feedback controller. The gradient calculating module 430 is configured to calculate gradient values corresponding to the feedback parameters based on the output actual values and the parameter values of the feedback parameters. The error calculation module 450 is configured to calculate an output error according to a preset output set value and an output actual value. The parameter optimization module 470 is configured to solve, based on the output error and the gradient value corresponding to the feedback parameter, a parameter value that makes the preset error objective function reach a minimum value, and obtain an optimized parameter value corresponding to the feedback parameter.
According to the feedback controller optimization parameter acquisition device, the output actual value of the control system and the parameter value of the feedback parameter in the operation test are adopted, the gradient value and the output error corresponding to the feedback parameter are calculated, and the optimization parameter value enabling the preset error objective function to reach the minimum value is solved based on the output error and the gradient value corresponding to the feedback parameter, so that the automatic acquisition of the optimization parameter value is realized, manual adjustment is not needed, and the optimization efficiency is high. In addition, after the output actual value and the parameter value of the feedback parameter are obtained through the operation test, the optimized parameter value of each feedback parameter is obtained through calculation and solution, compared with the optimized data obtained through the adjustment parameter operation test, the coupling influence of the feedback parameter in the parameter adjustment process can be avoided, and the optimization effect is better.
The feedback controller optimizing parameter obtaining device is applied to a control loop of a workpiece table, and experiments prove that the working efficiency can be obviously improved, the degree of freedom feedback of the micro-motion table 6 is set to be lower than half a day, and the error can be reduced by at least 60%.
In one embodiment, the feedback controller optimization parameter obtaining device further includes a test data obtaining module, configured to: performing a first operation test with input disturbance of 0 on a control system applying a feedback controller to obtain an output actual value of the first operation test; calculating a difference value between a preset output set value and an output actual value of the first operation test to obtain an output error of the first operation test; setting the input disturbance of the second operation test as the output error of the first operation test, and performing the second operation test on the control system to obtain the output actual value of the second operation test; and performing a third operation test with the input disturbance of 0 on the control system to obtain an output actual value of the third operation test.
In one embodiment, the gradient computation module 430 is configured to calculate the gradient according to the formula:
calculating a gradient value corresponding to each feedback parameter; where ρ represents a feedback parameter,representing the gradient value corresponding to the feedback parameter ρ, C fb For the transfer function of the feedback controller, y III For the output actual value of the third run test, y II The actual value is output for the second run test.
In one embodiment, the error calculation module 450 selects the output actual value of any one of the first run test, the second run test, and the third run test; and calculating a difference value between a preset output set value and an output actual value in the selected operation test to obtain an output error.
In one embodiment, the output actual values include a plurality of output actual values obtained by sampling according to a set frequency in the operation test, and the number of gradient values and output errors corresponding to one feedback parameter is equal to the number of output values acquired in one operation test.
In one embodiment, the preset error objective function includes:
the parameter optimization module 470 solves the formula:
wherein ,
in the formula ,ρi+1 Optimizing parameter values, ρ, for the (i+1) th of the feedback parameter, ρ i Ith optimization for feedback parameter ρParameter value, gamma i For the step size of the ith iteration, H is the Hessian matrix,the gradient value of a preset error objective function corresponding to the feedback parameter rho is obtained; n represents the number of samples of the output actual value, +.>The gradient value corresponding to the feedback parameter ρ at the output actual value sampled at the t-th sampling time is represented, and the output error corresponding to the feedback parameter ρ at the output actual value sampled at the t-th sampling time is represented by e (t, ρ).
For specific limitations on the feedback controller optimization parameter acquisition device, reference may be made to the above limitations on the feedback controller optimization parameter acquisition method, and no further description is given here. The above-mentioned respective modules in the feedback controller optimization parameter acquisition device may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules. It should be noted that, in the embodiment of the present application, the division of the modules is schematic, which is merely a logic function division, and other division manners may be implemented in actual implementation.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, or the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
Although the embodiments of the present application are disclosed above, the embodiments are only used for the convenience of understanding the present application, and are not intended to limit the present application. Any person skilled in the art can make any modification and variation in form and detail without departing from the spirit and scope of the present disclosure, but the scope of the present disclosure is still subject to the scope of the present disclosure as defined by the appended claims.