Sending PID gain values from Simulink PID block to Matlab workspace
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Emmanuel
el 6 de Mayo de 2012
Respondida: Mohit Bhatia
el 13 de Feb. de 2019
Hey Guys
Im in the process of tuning a PID controller. I have written a processing script to analyse the step and frequency response of the system. But I don't want to manually enter the PID gain values in the .m file every time I tune the PID using Simulink.
Is there any way to send the PID gain values from the PID block in Simulink to the Matlab workspace automatically after tuning manually?
I really appreciate any help as this would help me speed up tuning now and in the future.
Thanks E Sunil (TU Delft)
0 comentarios
Respuesta aceptada
TAB
el 7 de Mayo de 2012
You can retrieve the gain values of PID block in your m-script. See below piece of code.
% Get the values from block
P_str = get_param('PID_Block_Path','P');
I_str = get_param('PID_Block_Path','I');
D_str = get_param('PID_Block_Path','D');
% Convert string to values
P_val = str2double(P_str);
I_val = str2double(I_str);
D_val = str2double(D_str);
% If required send values to base workspace
assignin('base','P_val_base',P_val);
assignin('base','I_val_base',I_val);
assignin('base','D_val_base',D_val);
Más respuestas (1)
Mohit Bhatia
el 13 de Feb. de 2019
Hello
I want to tune the PID controller. For that how can i connect my model to .m file
Thank you
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!