How to update PID after system identification with closed loop PID Autotuner?
Ahora está siguiendo esta pregunta
- Verá actualizaciones en las notificaciones de contenido en seguimiento.
- Podrá recibir correos electrónicos, en función de las preferencias de comunicación que haya establecido.
Se ha producido un error
No se puede completar la acción debido a los cambios realizados en la página. Vuelva a cargar la página para ver el estado actualizado.
0 votos
Comparte un enlace a esta pregunta
Respuesta aceptada
0 votos
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 comentarios

Dear @Sam Chak,
Thank you for your inquiry regarding the identification and application of PID parameters in control systems. I appreciate your engagement in this technical discussion, and I will address your concerns step by step to clarify the concepts involved.
Understanding PID Parameter Identification
PID (Proportional-Integral-Derivative) controller gains are typically identified through various methods, including system identification techniques, where the closed-loop response of a system is analyzed to derive optimal control parameters. The process involves observing how the system reacts to disturbances and setpoint changes, allowing for the tuning of PID parameters that best suit the dynamics of the plant.
Concerns About Cascading PID Controllers
Your observation about cascading two PID controllers is valid and warrants further explanation. The approach of directly combining old and new PID parameters in a series configuration can lead to complexities and potential instability. This method is generally not recommended unless there is a specific justification rooted in system dynamics or performance improvement strategies, such as gain scheduling or incremental tuning. These techniques allow for a more controlled adjustment of PID parameters based on real-time feedback without introducing significant complexity.
Common Practices in System Identification
The methodology suggested—extracting the transfer function from the closed-loop system to analyze its behavior without the existing controller—is a standard practice in control engineering. By decoupling the plant dynamics from the control influence, one can better understand how to apply new parameters effectively. This process ensures that the new PID gains are tuned specifically to the plant’s characteristics rather than being influenced by potentially outdated control strategies.
Simulation and Testing Before Deployment
As emphasized in my previous message, it is crucial to simulate any changes in a controlled environment prior to real-world implementation. This step helps identify potential issues such as instability or performance degradation that may arise from newly applied parameters. Continuous monitoring of performance metrics like overshoot, settling time, and steady-state error is also essential after implementation to ensure that the controller behaves as expected.
In nutshell, while the identification of new PID parameters is a critical aspect of control systems design, it requires careful consideration of existing configurations and potential interactions between old and new settings. The goal should always be to achieve stability and optimal performance while minimizing unnecessary complexity.
As I always mentioned you are extremely knowledgeable and I do learn a lot from you and rest of staff who are also technical experts such as @Robert Waterson, @Torsten, @Star Strider, @John D’Errico, and @dpb etc.
Hope this helps.

Hi @Cem,
After going through your comments, your primary challenge seems to stem from the transition from a second-order system identified via RLS to a more complex plant transfer function. This complexity arises when you attempt to implement GMVC for PID tuning on a higher-order system, which can lead to difficulties in maintaining control stability and performance.
Identifying the Plant Dynamics: To effectively derive the plant transfer function, it’s crucial to ensure that your RLS implementation accurately captures the dynamics of your quadcopter. Given that you’re observing an increase in order, consider these strategies:
Model Order Reduction: After obtaining your higher-order model, you could apply techniques such as balanced truncation or Hankel norm approximation to reduce its order while retaining essential dynamics.
Validation of Data: Ensure that the input-output data used for system identification is representative of actual flight conditions. Noise or disturbances in the data can lead to misleading dynamics.
Tuning with GMVC:Given that GMVC parameters are derived based on your identified model, ensure that your rise time and damping coefficient align with practical performance expectations for quadcopter maneuvers. You mentioned that GMVC yields minimal values; this could indicate over-tuning or sensitivity to noise:
- Parameter Adjustment: Experiment with slightly varying the rise time and damping coefficients within realistic bounds to observe changes in performance.
- Iterative Tuning: Use a systematic approach where you iteratively refine parameters based on simulation results before applying them in real-time tests.
Cascade PID Structure: Implementing a cascade structure with two PID controllers can indeed enhance control performance by allowing one controller to manage fast dynamics (like roll rate) while another manages slower dynamics (like roll angle):
Controller Design: Ensure that each PID controller is tuned independently before integrating them into a cascade structure. This will help isolate issues related to each control loop.
Simulation Testing: Use Simulink extensively to simulate different scenarios and evaluate how each controller responds under various conditions.
Here are some considerations for you to help you out further.
Since you are analyzing logs based on flight tests, consider implementing an automated tuning algorithm like Ziegler-Nichols or even more advanced optimization algorithms such as Genetic Algorithms or Particle Swarm Optimization for adaptive PID tuning.
When transitioning from simulation to real-time application, ensure robust testing under varied environmental conditions (e.g., wind, payload changes). It might be useful to have a fallback mode where you can revert to manual tuning if automated methods fail.
Continue logging parameters like rise time, settling time, and error deviation during flight tests. This data will provide invaluable insights into how well your tuned parameters perform under real-world conditions.
Here are some suggestions for your existing code:
% Suggestion: Validate Gz_r2 before proceeding with GMVC
if rank(Gz_r2) < 2
error('Identified model Gz_r2 is not valid for GMVC.');
end
% Use try-catch for robust error handling during GMVC
try
[Gp, Gi, Gd] = gmvcPid(Gz_r2, rise_time, damping_coeff);
catch ME
disp('Error during GMVC tuning:');
disp(ME.message);
end
% Suggestion: Visualize response comparison more effectively
figure;
step(Gz_r2,Gz_r3_closed,Gz_r4_closed);
grid on;
legend('Closed Loop RLS Response','Cascaded PID Response','GMVC
PID Response');
title('Closed-Loop Step Response');
xlabel('Time (seconds)');
ylabel('Response');
xlim([0 1]);
Hope this helps.
Más respuestas (0)
Categorías
Más información sobre PID Controller Tuning en Centro de ayuda y File Exchange.
Etiquetas
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
