Setting a Specific Formula for PID Controller in Simulink (Matlab)

12 views (last 30 days)
I need to add a PID Controller to a Simulink Project with formula 1/(s+4.54) but I couldn't find the proper constants for the formula.
I tried looking at the different types of PID crack Controller libraries. I also tried finding the constants by solving the equation but couldn't.

Answers (2)

Sam Chak
Sam Chak on 9 Nov 2023
  4 Comments
dorrin
dorrin on 9 Nov 2023
I posted the question on Stackoverflow and saw it here today (Maybe it's automatically reposted?).
Is it possible to use the PID Tuning feature to get the function ? This is the project I have to build:
Sam Chak
Sam Chak on 15 Nov 2023
The step response looks okay, no overshoot and settles within 6 seconds. Are the performance requirements satisfied?
% Plant
Gp = tf(30, [1 30 0])
Gp = 30 ---------- s^2 + 30 s Continuous-time transfer function.
% Compensator
Gc = tf(4, [1 4.54])
Gc = 4 -------- s + 4.54 Continuous-time transfer function.
% Pre-filter
Gf = tf(1, [1 1])
Gf = 1 ----- s + 1 Continuous-time transfer function.
% Closed-loop system
Gcl = feedback(Gc*Gp, 1)
Gcl = 120 ------------------------------- s^3 + 34.54 s^2 + 136.2 s + 120 Continuous-time transfer function.
% Closed-loop system with Prefilter
Gclf = Gf*Gcl
Gclf = 120 ------------------------------------------- s^4 + 35.54 s^3 + 170.7 s^2 + 256.2 s + 120 Continuous-time transfer function.
% Plot Step response
step(Gclf, 10), grid on
stepinfo(Gclf)
ans = struct with fields:
RiseTime: 3.1225 TransientTime: 5.6431 SettlingTime: 5.6431 SettlingMin: 0.9034 SettlingMax: 0.9989 Overshoot: 0 Undershoot: 0 Peak: 0.9989 PeakTime: 8.7038

Sign in to comment.


Sam Chak
Sam Chak on 15 Nov 2023
If you intend to use a PID controller to make the system behave similarly to the designed compensator, you'll need to make some slight modifications to the control loop configuration. The system under the PID controller should have the same settling time.
% Plant
Gp = tf(30, [1 30 0])
Gp = 30 ---------- s^2 + 30 s Continuous-time transfer function.
Gpp = feedback(Gp, 1);
% PID Controller
kp = 0.266920333340203;
ki = 0.516920333340203;
kd = -0.111860942402338;
Tf = 0.483633519278621;
Gc = pid(kp, ki, kd, Tf)
Gc = 1 s Kp + Ki * --- + Kd * -------- s Tf*s+1 with Kp = 0.267, Ki = 0.517, Kd = -0.112, Tf = 0.484 Continuous-time PIDF controller in parallel form.
% Closed-loop system
Gcl = feedback(Gc*Gpp, 1)
Gcl = 1.069 s^2 + 32.06 s + 32.06 ------------------------------------------- s^4 + 32.07 s^3 + 93.1 s^2 + 94.1 s + 32.06 Continuous-time transfer function.
% Plot Step response
step(Gcl, 10), grid on
stepinfo(Gcl)
ans = struct with fields:
RiseTime: 3.2484 TransientTime: 5.6431 SettlingTime: 5.6431 SettlingMin: 0.9019 SettlingMax: 0.9999 Overshoot: 0 Undershoot: 0 Peak: 0.9999 PeakTime: 11.5370

Community Treasure Hunt

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

Start Hunting!