Improved PID control method based on Kalman filtering
By adopting an improved PID control method based on Kalman filtering in the power supply system, the problem of traditional PID algorithms being susceptible to noise interference and large overshoot is solved, and a more stable output signal and higher signal-to-noise ratio are achieved.
Patent Information
- Application Number
- CN202411032504.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-12-10
AI Technical Summary
The traditional digital PID algorithm in the prior art is susceptible to noise interference in the power supply system, and is prone to excessive overshoot when the system is started, affecting the reliability and life of the equipment.
The improved PID control method based on Kalman filtering is adopted, and the performance and stability of the PID controller are optimized by adjusting the PID parameters and introducing variable speed integral and incomplete differential algorithms, combined with Kalman filtering to process noise.
It significantly improves the stability and performance of the PID controller, reduces the impact of noise, reduces the system's overshoot and oscillation times, and improves the stability and signal-to-noise ratio of the output signal.
Smart Images

Figure CN119105269A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the fields of PID control and Kalman filtering, and in particular to an improved PID control method based on Kalman filtering. Background Art
[0002] In power supply, stability and accuracy are very important indicators. For the power supply output voltage, if it cannot be kept stable and accurate, it may cause damage to the circuit, equipment and even the entire system. In the design of switching power supply, due to different workloads and environmental changes, the power supply system is often interfered by many known and unknown signals, which will have a great impact on the normal operation of the equipment.
[0003] The front-end compensation algorithm currently used is the traditional digital PID algorithm, which has general stability and is easily affected by noise. It also has the problem of excessive overshoot when the system starts up, causing the load device to pass a large current value in a short period of time, thereby reducing the system reliability of the device and damaging the life of the device. Summary of the invention
[0004] The invention provides an improved PID control method based on Kalman filtering to solve the problems of the prior art.
[0005] In a first aspect, the present invention provides an improved PID control method based on Kalman filtering, comprising:
[0006] Step 1: According to the actual situation model, obtain the system transfer function G(s) of the controlled object, specify the expected signal or target value yd of the system output, and then select the PID method according to the expected signal, including position PID, incremental PID, etc., and then select the PID proportional coefficient kp, integral coefficient ki, and differential coefficient kd.
[0007] Step 2: Continuously adjust PID parameters to find the best one. First, adjust the proportional coefficient, gradually increase it from 0, until the system static error reaches the minimum and just does not produce oscillation. Then continue to increase the integral coefficient to eliminate the static error, and appropriately reduce the proportional coefficient to prevent the system from oscillating. Finally, adjust the differential coefficient to reduce the adjustment time and overshoot, and adjust the proportional coefficient and integral coefficient at the same time until the system response curve reaches the best.
[0008] Step 3: According to the incremental PID method, the output value after the last error sampling is:
[0009]
[0010] The output value obtained by the current error sampling is subtracted from the previous one to obtain the incremental PID formula:
[0011] Δu(k)=u(k)-u(k-1)
[0012] Δu(k)=k p (error(k)-error(k-1))+k i error(k)+k d (error(k)-2error(k-1)+error(k-2))
[0013] According to the above formula, the error is obtained by subtracting the target value from the current feedback of the controlled object. The error value is calculated through three links: proportional term, integral term, and differential term to obtain the output component. The sum of these three components is the output of PID.
[0014] Step 4: Improve the integral term of incremental PID by introducing variable speed integral and integral separation algorithms to change the speed of integration according to the size of the deviation. That is, the expression of the integral term is:
[0015]
[0016] Where β is a function of the deviation, namely:
[0017]
[0018] Where A and B represent the set thresholds, then the expression of the variable speed integral PID algorithm is:
[0019]
[0020] Step 5: Apply the PID output obtained above to the controlled object, i.e. the load. After being driven by the load, a noisy and unstable output signal is obtained, which is then sent to the Kalman filter for processing.
[0021] Step 6: Use the Kalman equation to estimate the optimal value. First, based on the dynamic model of the system, use the state equation and control input to predict the current state estimate based on the state estimate at the previous moment. The predicted results include the state vector and the state covariance matrix, which describe the expected value and uncertainty of the state, namely:
[0022]
[0023] P k =F k P k-1 F k T +Qk
[0024] in Represents the posterior state estimate at time k-1, that is, the update result of the previous moment. is the prior state estimate at time k, that is, the optimal estimated prediction value obtained at the previous time (time k-1), which is the result of the prediction equation. k-1 represents the posterior estimated covariance at time k-1, that is The covariance of P k is the prior estimated covariance at the current k moment, that is The covariance of F k is the state transfer matrix, which is the model of the target state transition. Q is the covariance of the system process, which is used to represent the error between the state transfer matrix and the actual process.
[0025] Then, based on the observed data, the optimal estimate of the current state and the state uncertainty are calculated. Using the observation equation and the actual measured value, the state is corrected according to the state estimate obtained in the prediction step. The Kalman gain is calculated through the Kalman gain equation to weigh the reliability of the predicted value and the measured value. Then, based on the difference between the Kalman gain, the measured value, and the predicted value, the state estimate and covariance are updated, that is:
[0026] K=P k H k T (H k P k H k T +R k ) -1
[0027]
[0028] P k '=P k -KH k P k
[0029] Where K is the Kalman gain, which is the intermediate calculation result of the filter. k It is the state variable to measurement conversion matrix, which represents the relationship between the state and the observation, and is responsible for converting the m-dimensional measurement value to the n-dimensional one so that it conforms to the mathematical form of the state variable. k is the measurement noise covariance. represents the posterior state estimate at time k, i.e., the optimal estimate at the current time. T represents transposition. P k ' represents the posterior estimated covariance at time k, that is The covariance of represents the uncertainty of the current state. and P k ' is the result after filtering.
[0030] Step 7: The optimal value obtained by the Kalman equation processing is the final expected filtered output. The output is sampled and fed back to the PID input. Repeat steps 3 to 5, continuously iterate to make the feedback amount approach the target expected signal, and finally obtain a stable output signal.
[0031] The improved PID control method based on Kalman filtering provided by the present invention obtains the optimal estimation of the system state by predicting the current state and updating the observation data, thereby reducing the influence of measurement error and noise and improving the performance and stability of the PID controller. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The drawings described herein are used to provide a further understanding of the embodiments of the present invention, constitute a part of the present invention, and do not constitute a limitation of the embodiments of the present invention. In the drawings:
[0033] Figure 1 A schematic diagram of the system principle of an improved PID control method based on Kalman filtering provided by an exemplary embodiment of the present invention.
[0034] Figure 2 This is a diagram showing the effect of traditional PID control without Kalman filtering in Example 1 of the present invention.
[0035] Figure 3 This is a diagram showing the effect of PID control with Kalman filtering added in Example 1 of the present invention.
[0036] Figure 4 This is a comparison chart of the two PID control effects in Example 1 of the present invention. DETAILED DESCRIPTION
[0037] Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings.
[0038] Explanation of terms in the present invention:
[0039] PID, which stands for "proportional, integral, derivative", is a control algorithm;
[0040] The technical concept of the present invention:
[0041] The entire operation process of PID control based on Kalman filtering: First, a target value needs to be specified for the system, which is the expected signal. The target value is subtracted from the current feedback of the controlled object to obtain the error, and the error value is calculated through three links: proportional term, integral term, and differential term to obtain the output component. The three components are added together to obtain the output of PID. In order to strengthen the role of the integral term, variable speed integral and integral separation algorithms are added to enable it to change the speed of integration according to the size of the system deviation, thereby reducing system overshoot and improving system response speed. In order to prevent high-frequency interference caused by the differential signal, an incomplete differential algorithm is introduced, and a low-pass filter is added to the differential term. The output of PID is applied to the controlled object to obtain a noisy output signal, and then after Kalman filtering, the output is fed back to PID, and the feedback quantity is continuously iterated to approach the target value, and finally a stable output signal is obtained.
[0042] The improved PID control method based on Kalman filtering provided by the present invention is intended to solve the above technical problems in the prior art.
[0043] The embodiments of the present invention will be described below in conjunction with the accompanying drawings.
[0044] Embodiment 1: The embodiment of the present invention provides an improved PID control method based on Kalman filtering, such as Figure 1 As shown, including:
[0045] Based on steps 1-7 of the specification, the proportional link (P) is not improved, and a variable speed integral module is added to the integral link (I) to guide the PID feedback so that it can change the speed of integration according to the size of the system deviation. A low-pass filter is added to the differential link (D) to guide the PID to prevent high-frequency interference caused by the differential signal. The output is added with the control interference term w, and the PID output and the control interference term w act on the controlled object. Then the output is added with the measurement noise v and output to the Kalman filter. It also includes a branch from adding the PID output to the control interference term w directly to the Kalman filter, the Kalman filter output value, and the output is sampled and fed back to the PID input. The above steps 3 to 5 are repeated, and the feedback amount is continuously iterated to approach the target expected signal, and finally a stable optimal output signal is obtained.
[0046] The controlled object is a second-order system, and the system transfer function is G(s)=400 / (s 2 +50s), the sampling time is 1ms, and the interference noise w(k) and the measurement noise v(k) are both white noise with a covariance of 1 and an amplitude of 0.01, that is, Q=1, R=1. The input expected signal is a PWM wave signal with a period of 2s, and the simulation time is 4s. Incremental PID is used, and the three PID coefficients are: kp=12.0, ki=0.80, kd=0.20.
[0047] The comparison chart of the effect of PID control with and without Kalman filtering is obtained. The simulation results are as follows: Figures 2 to 4 As shown. The PID control performance without Kalman filtering: signal-to-noise ratio is 18.9dB, overshoot sigma = 3.6%, and adjustment time ts = 2.207s. The PID control performance with Kalman filtering: signal-to-noise ratio is 20.8dB, overshoot sigma = 0%, and adjustment time ts = 2.089s.
[0048] From the above comparison results, it can be seen that after using the Kalman filter, the waveform tracking becomes more stable, the waveform tracking error is reduced, and the signal-to-noise ratio is significantly increased. At the same time, the use of Kalman filtering will shorten the convergence time of PID control, eliminate the overshoot introduced by the system, significantly reduce the impact of noise and reduce the number of oscillations, so that the system can quickly reach stability and obtain a stable system output.
[0049] In the several embodiments provided by the present invention, it should be understood that the disclosed method can be implemented in other ways. For example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another device, or some features can be ignored or not executed.
[0050] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. Improved PID control method based on Kalman filtering, It is characterized in that include: In the process of obtaining the target value of the expected signal, the target value is subtracted from the current feedback value of the controlled object to obtain the error value, and the output of PID is obtained from the error value. The output of PID is applied to the controlled object to obtain a noisy output signal, and then the output is fed back to PID after Kalman filtering. The feedback value is continuously iterated to get closer to the target value, and finally a stable output signal is obtained; Among them, the variable speed integral and integral separation algorithm are added to the integral term of PID to change the integral speed according to the size of the system deviation, and the incomplete differential algorithm and low-pass filter are added to the differential term of PID to prevent high-frequency interference.
2. The improved PID control method based on Kalman filtering according to claim 1, It is characterized in that The process of obtaining the target value of the expected signal specifically includes the following steps: Step 1: Obtain the system transfer function G(s) of the controlled object, obtain the dynamic behavior information of the system through the complex frequency domain variable s, specify the target value of the system output, that is, the expected signal yd, select the PID method according to the expected signal, and then select the PID proportional coefficient kp, integral coefficient ki, and differential coefficient kd; Step 2: Continuously adjust PID parameters to find the best PID parameters; Step 3: According to the PID method, calculate the output value u(k-1) after the last error sampling, where k is the number of times; Step 4: Introduce a variable speed integral and integral separation algorithm for improving the integral term by changing the speed of the integral according to the size of the deviation; Step 5: The obtained PID output is applied to the controlled object, i.e. the load. After being driven by the load, a noisy and unstable output signal is obtained, which is then sent to the Kalman filter for processing; Step 6: Use the Kalman equation to estimate the optimal value; Step 7: Based on the filtered output optimal value obtained in step 6, sample the optimal value and feed it back to the PID input, and continue to repeat steps 3 to 5, continuously iterating to make the feedback amount approach the target expected signal, and finally obtain a stable output signal.
3. The improved PID control method based on Kalman filtering according to claim 2, It is characterized in that In step 1, the PID method includes: position PID, incremental PID; When the incremental PID method is selected, in step 3, the output value obtained after the last error sampling is: The output value obtained by the current error sampling is subtracted from the previous one to obtain the incremental PID formula: Δu(k)=u(k)-u(k-1) Δu(k)=k p (error(k)-error(k-1))+k i error(k)+k d (error(k)-2error(k-1)+error(k-2)) According to the above formula, the error is obtained by subtracting the target value from the current feedback of the controlled object. The error value is calculated through three links: proportional term, integral term, and differential term to obtain the output component. The sum of the three components obtained is the output of PID.
4. The improved PID control method based on Kalman filtering according to claim 3, It is characterized in that The step 2 specifically includes: firstly adjusting the proportional coefficient, gradually increasing it from 0, until the static error of the system reaches the minimum and just no oscillation occurs, then continuously increasing the integral coefficient to eliminate the static error, and finally adjusting the differential coefficient to reduce the adjustment time and overshoot, and simultaneously jointly adjusting the proportional coefficient and the integral coefficient until the response curve of the system reaches the best; Among them, the proportional coefficient is appropriately reduced to prevent the system from oscillating.
5. The improved PID control method based on Kalman filtering according to claim 4, It is characterized in that In step 4, specifically including: The expression of the integral term is: Where β is a function of the deviation, namely: Where A and B represent the set thresholds, then the expression of the variable speed integral PID algorithm is:
6. The improved PID control method based on Kalman filtering according to claim 5, It is characterized in that In step 6, using the Kalman equation to estimate the optimal value specifically includes: First, based on the dynamic model of the system, the state equation and control input are used to predict the state estimate at the current moment based on the state estimate at the previous moment. The prediction results include the state vector used to describe the state expectation value and the state covariance matrix used to describe the state uncertainty. State vector: State covariance matrix: Q k =F k Q k-1 F k T +Qk in represents the posterior state estimate at time k-1, that is, the update result at the previous moment, is the prior state estimate at time k, that is, the optimal estimated prediction value obtained at the previous time (time k-1), which is the result of the prediction equation; P k-1 represents the posterior estimated covariance at time k-1, that is The covariance P k is the prior estimated covariance at the current k moment, that is The covariance of k is the state transfer matrix, which is the model of the target state transition. Q is the covariance of the system process, which is used to represent the error between the state transfer matrix and the actual process.
7. The improved PID control method based on Kalman filtering according to claim 6, It is characterized in that In step 6, the specific process of calculating the optimal estimate of the current state and the state uncertainty according to the observed data includes the following: using the observation equation and the actual measurement value, according to the state estimate obtained in the prediction step, the state is corrected, and the Kalman gain is calculated through the Kalman gain equation to weigh the reliability of the predicted value and the measured value, and then according to the difference between the Kalman gain, the measured value and the predicted value, the state estimate and covariance are updated, that is: Kalman gain: K = P k H k T (H k P k H k T +R k ) -1 The posterior state estimate at time k is: The posterior estimated covariance at time k: P k '=P k -KH k P k Where K is the Kalman gain, which is the intermediate calculation result of the filter; H k It is the conversion matrix from state variables to measurements, which represents the relationship between states and observations and is responsible for converting m-dimensional measurements to n-dimensional measurements to conform to the mathematical form of state variables. k is the measurement noise covariance; T represents transpose; represents the posterior state estimate at time k, that is, the optimal estimate at the current time; P k ' represents the posterior estimated covariance at time k, that is The covariance of represents the uncertainty of the current state; and P k ' is the result after filtering.
Citation Information
Cited By
Automatic focusing control method based on displacement sensor
CN119767140A
Real-time anomaly detection and parameter self-adaption method for precision motion control loop
CN120802621A
Flow control method, device and equipment of magnetorheological fluid circulation system and medium
CN121478001A
Improved PID control method based on kalman filtering
WO2026026003A1
