How can I adjust the PID values in Simulink?
Show older comments
I have set up a control loop, see attachment, and can't find any values for the PID controller once I install the sensor. I adjusted the values without the sensor using the frequency response method and verified them with Nyquist criterion. These methods are valid without a measuring device. The autotuning feature of Simulink keeps giving me incorrect values. In this system, an electromagnet is used to try to keep a metal ball suspended in air. The control loop consists of a controller, current controller (cascade control), process, and sensor. The upper control loop represents the actual control loop, while the lower one represents the linearized form. In both, the sensor is not installed, and the process is still stable.
Accepted Answer
More Answers (1)
Hi @Elli
I faced difficulties in effectively stabilizing the unstable 3rd-order system using solely the PID controller. Even though the closed-loop system was technically 'stable', the transient response did not meet my expectations. As a result, I had to employ a 3rd-order Compensator
and a Pre-filter
to achieve the desired outcome. The figure below illustrates a comparison with the Observer-based Controller (which I designed yesterday). Both approaches were designed to meet the settling time requirement of ≤ 1 second.


s = tf('s');
%% Plant, Gp
G1 = 0.1/(0.03*s + 1);
G2 = tf(0.884, [-0.01 0 39.07]);
Gp = minreal(series(G1, G2))
%% Compensator, Gc
cz = [-32.9308607744069 + 2.19341926182744i, -32.9308607744069 - 2.19341926182744i];
cp = [-2.3880571645169 + 67.9271543482382i, -2.3880571645169 - 67.9271543482382i, -34.0524593508891];
ck = -63840.8149251998;
Gc = tf(zpk(cz, cp, ck))
%% Prefilter, Gf
fz = [];
fp = [-32.9308607744069 + 2.19341926182744i, -32.9308607744069 - 2.19341926182744i];
fk = 0.160883340684378;
Gf = tf(zpk(fz, fp, fk))
%% Filtered closed-loop system, Gclf
Gcl = feedback(Gc*Gp, 1);
Gclf= minreal(series(Gf, Gcl))
%% Step response
step(Gclf, 4), grid on
%% Root locus
rlocus(Gc*Gp), grid on, axis([-80 80 -40 40])
Categories
Find more on PID Controller Tuning in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





