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.