How to programmatically tune this closed loop system with desired response time and robustness?
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Jack York
il 31 Ott 2020
Commentato: Siddharth Jawahar
il 3 Nov 2020
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 Commenti
Risposta accettata
Siddharth Jawahar
il 2 Nov 2020
Modificato: Siddharth Jawahar
il 3 Nov 2020
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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su PID Controller Tuning in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!