How to update PID after system identification with closed loop PID Autotuner?

8 views (last 30 days)
In the literature, system identification can be performed using various techniques like RLS, ARX, ARMAX, Kalman Filter, or frequency domain methods. In quadcopter systems, PX4 uses an autotune mode with the RLS method, and after that, GMVC law is applied to find optimal PID parameters. Similarly, Simulink has a 'Closed-loop PID autotuner' block.
What I'm confused about is the process of updating the PID parameters after system identification, which is typically done in a closed-loop setup. For example, let’s say I have an active PID with P: 3, I: 4, D: 2.8. If we use GMVC or another method to identify new PID parameters based on the closed-loop system response, how do we update these PID values?
Directly replacing the old parameters with the new ones seems problematic because the system identification itself was based on the current closed-loop response. I’m considering that we might need to combine the old and new PID parameters into a series configuration, which implies having two different PIDs in sequence. However, this doesn't seem ideal.
Would it make more sense to extract the transfer function of the closed-loop system, remove the contribution of the current PID, and then apply the new PID parameters based on the open-loop transfer function by adding the old ones and test?

Accepted Answer

Umar
Umar on 7 Oct 2024

Hi @Cem ,

After going through your comments, when you identify new PID parameters based on closed-loop performance, you are essentially analyzing how the entire system (including the current PID controller) responds to disturbances and setpoint changes. Therefore, the identified parameters reflect not just the dynamics of the plant but also the influence of the existing controller. So, directly replacing old PID parameters with newly identified values can lead to instability or degraded performance because the new parameters are tuned based on a different closed-loop configuration, which includes the effects of your current PID settings. My recommended approach would extracting the transfer function of your closed-loop system. This will give you a mathematical representation of how your system behaves with the current PID controller. Also, from this transfer function, remove the contribution of your existing PID controller. This allows you to understand how the underlying plant behaves without any control influence. After decoupling, apply your new PID parameters derived from system identification to this open-loop model. You can then reintroduce feedback to see how well these new parameters perform in combination with your plant's dynamics. While combining old and new parameters into a series configuration may seem tempting, it complicates control logic and may not yield desirable results. Instead, consider using techniques such as gain scheduling or incremental tuning where new parameters gradually replace old ones based on performance metrics. Below is an example using MATLAB to illustrate how you might approach this problem programmatically:

% Given initial PID parameters
Kp_old = 3;
Ki_old = 4;
Kd_old = 2.8;
% Create a transfer function for the existing closed-loop system
s = tf('s');
G = 1/(s^2 + 5*s + 6); % Example plant transfer function
C_old = pid(Kp_old, Ki_old, Kd_old);
T_old = feedback(G * C_old, 1); % Closed-loop transfer function
% Extracting open-loop characteristics
G_open_loop = G * C_old;
% Perform system identification here (using GMVC or other)
% Assume new identified PID parameters are:
Kp_new = 5;
Ki_new = 3;
Kd_new = 1;
% Create a new PID controller with identified parameters
C_new = pid(Kp_new, Ki_new, Kd_new);
% Simulate both controllers for comparison
t = 0:0.01:10; % Time vector
u = ones(size(t)); % Step input
y_old = lsim(T_old, u, t);
y_new = lsim(feedback(G * C_new, 1), u, t);
% Plot results for analysis
figure;
plot(t, y_old, 'b', t, y_new, 'r--');
title('Closed-Loop Response Comparison');
xlabel('Time (s)');
ylabel('Output');
legend('Old PID', 'New PID');
grid on;

Please see attached.

After implementing new PID parameters based on your identified model, continuously monitor performance metrics such as overshoot, settling time, and steady-state error. Also, consider employing adaptive control strategies that allow for dynamic adjustments of PID parameters based on real-time performance feedback.

Remember always to simulate changes in a controlled environment before deploying them to real systems to avoid potential instability or failure.

Hope this helps.

Please let me know if you have any further questions.

  6 Comments
Cem
Cem on 16 Oct 2024
Hi @Umar,
I appreciate for your response. I will consider your clear explanations. In terms of GMVC adaptation, I will be trying model order reduction after obtainin open loop transfer function. I will also search for Genetic Algorithms and other methods like Neural Network methods.
For now, I am examining the RLS method and PID effects to see how reliable the system and how correct the obtained transfer function. I am trying to simulate open loop dynamics by adding PID with different parameters and try to observe effects in real time. Also I am logging the flight data and check system response.
For those who are interested in this method, PX4 has open source code already, you can also check the detailed structure linked in below.
https://www.youtube.com/watch?v=Yzhjlo5FnCU&ab_channel=PX4Autopilot-OpenSourceFlightControl.
Umar
Umar on 17 Oct 2024
Hi @Cem,
Thank you for your thoughtful response. I appreciate your willingness to consider the explanations provided and your proactive approach towards GMVC adaptation.
It is great to hear that you are planning to implement model order reduction following the acquisition of the open-loop transfer function. Exploring Genetic Algorithms and Neural Network methods will undoubtedly enhance your research, and I look forward to seeing how these approaches unfold in your work.
Your examination of the RLS method and PID effects sounds promising, particularly as you aim to evaluate the reliability of the system and validate the accuracy of the obtained transfer function. Simulating open-loop dynamics with varying PID parameters should yield valuable insights into system behavior, and logging flight data will be instrumental in assessing system responses effectively.
Thank you for sharing the link to PX4’s open-source code; it will certainly be a helpful resource for those interested in this methodology.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!