How to programmatically tune this closed loop system with desired response time and robustness?
2 次查看(过去 30 天)
显示 更早的评论
I have a closed loop system with a transfer function:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/398654/image.png)
I can pid tune using the tuner app and specify robustness and response time or bandwidth and phase margin. I would like to do this programmatically so it can retune for slightly different input coeffiecients in the transfer function. The tranfer function coefficients are applied programmatically, I have linearized the system and saved it to a variable ClosedPID. I can output the step response of this system using step(ClosedPID). I am trying to use the pidTuner function to open to tuner and update the block but it I don't know how to programmatically change phase margin and bandwidth and apply it to the block. On top of this the plant it uses is slightly different and doesn't produce the same PID values even after manualy entering in the phase margin and bandwidth values. I am wondering what I am doing wrong.
TLDR; How can I programmatically automate the process of:
Clicking on the PID controller in simulink
Clicking Tune... (next to Transfer Function Based)
Entering Xrad/s for bandwidth and Ydeg for phase margin (where X and Y are numbers I choose)
Update block
0 个评论
采纳的回答
Siddharth Jawahar
2020-11-2
编辑:Siddharth Jawahar
2020-11-3
Hi Jack,
You can do the list of actions you mentioned by using the pid, pidtuneOptions, pidtune functions. As an example, using a similar third order system you have shown, you can do something like this:
sys = tf(1,[1 3 3 1]);
C_0 = pid(1,1,1); % Parallel form PID controller object with initial gains
gm = 0.80 % Gain margin
pm = 45 % Phase margin
opts = pidtuneOptions('PhaseMargin',pm,'DesignFocus','disturbance-rejection');% Set your tuning options
[C,info] = pidtune(sys,C_0, gm,opts);
>> C
C =
1
Kp + Ki * --- + Kd * s
s
with Kp = 1.99, Ki = 1.11, Kd = 0.885
Continuous-time PID controller in parallel form.
>> info
info =
struct with fields:
Stable: 1
CrossoverFrequency: 0.8000
PhaseMargin: 45
5 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!