Sending PID gain values from Simulink PID block to Matlab workspace
11 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
TAB
2012 年 5 月 7 日
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);
その他の回答 (1 件)
Mohit Bhatia
2019 年 2 月 13 日
Hello
I want to tune the PID controller. For that how can i connect my model to .m file
Thank you
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!