How can I mimic a specific PID Tuner App scenario with a GUI-less MATLAB script?

Hi there,
Using MATLAB 2019a with the Control Toolbox on MacOS Mojave.
I am trying to write a Matlab script to mimic what the PID Tuner App does in the following scenario:
Ts = 0.001
big1d = c2d( tf(0.71,[2.5 1]), Ts)
pidTuner
PID Tuner App
My script must be non-interactive.
Using pidtune() I'm able to set the controller type (PIDF), the Controller Options (Integrator and Derivator formulae), and the Design Focus = balanced (through the pidtuneoptions).
opt = pidtuneOptions('DesignFocus','balanced');
C0 = pid(1,1,1,1, Ts, 'IFormula','BackwardEuler', 'DFormula','ForwardEuler'); % template PID controller
C = pidtune(big1d,'pidf',C0,opt) % I assume the PID Form is Parallel by default
How can I programmatically set or imitate the Response Time slider = 1.4 and the Transient Behavior Slider = 0.83?
Thank you!
Philippe Couvignou
Brain Corporation - R &D

1 Comment

I just found the answer by reading the Help more carefully.
From the PID Tuner App, we can find the phase margin = 83 deg and the zero-dB crossover frequency = 1.43 rad/s of the tuned open-loop response as shown below.
Screen Shot 2019-07-31 at 3.13.52 PM.png
Then, the following commands will generate the same PID controller as the PID Tuner App.
opt = pidtuneOptions('PhaseMargin',83, 'DesignFocus','balanced')
wc = 1.43; % zero-dB crossover frequency in rad/sec
pidtune(big1d, C0, wc, opt)

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!