Tuning a PID controller to desired Overshoot, settling time and rise time

180 views (last 30 days)
The uncompensated plant transfer function in this case is: as shown in the simulink model below:
I want to tune the PID so that the Rise time becomes 0.561 s, settling time becomes 2.6 s and overshoot narrows to 8.83%. However the PID tuner app is very inconvenient in this regard as it only varies the response time and transient behaviour, it is impossible to achieve the desired settling time and overshoot with such a PID tuner.

Answers (3)

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 24 Dec 2022
Simply double-click on PID block and its parameters window opens. Click on "Tune" button as shown in the attached screen shot - Step 1 - PID_tune_step1.jpg.
Then follow step 2 as shown in the attached file: PID_tune_step2.jpg
Alternative way is using pidtune() in MATLAB.
Good luck

Paul on 24 Dec 2022
The CST offers some tools to do this. Start from this doc page. Or from this doc page if you want to use Simulink.
Here is an example of the command line workflow. The result I got is not that good, so you'll have to make it work better to get the result you want
Define the plant model
G = tf(20,[1 4.5 64],'InputName','u','OutputName','y');
Define a tunable PID compensator
K = tunablePID('PID','PID');
K.InputName = 'e';
K.OutputName = 'u';
Create the closed loop system
S = sumblk('e = r - y');
CL0 = connect(G,K,S,'r','y');
Define a second order model response that meets the requirements for rise time, settling time, and overshoot.
Rtrack = TuningGoal.StepTracking('r','y',.30,8.8);
ans = struct with fields:
RiseTime: 0.5654 TransientTime: 1.7893 SettlingTime: 1.7893 SettlingMin: 0.9077 SettlingMax: 1.0880 Overshoot: 8.7988 Undershoot: 0 Peak: 1.0880 PeakTime: 1.1967
Use systune to design the PID gains
CL = systune(CL0,Rtrack);
Final: Soft = 3.09, Hard = -Inf, Iterations = 44
The PID controller is:
PID = 1 s Kp + Ki * --- + Kd * -------- s Tf*s+1 with Kp = -0.101, Ki = 6.45, Kd = -23.9, Tf = 1.37e+04 Name: PID Continuous-time PIDF controller in parallel form.
Those negative gains look peculiar!
The closed-loop step response is
ans = struct with fields:
RiseTime: 0.4233 TransientTime: 2.0735 SettlingTime: 2.0735 SettlingMin: 0.8039 SettlingMax: 1.0237 Overshoot: 2.3675 Undershoot: 0.0210 Peak: 1.0237 PeakTime: 1.5024
Presumably there are other Tuning Goals that can be applied to get the desired response.

Sam Chak
Sam Chak on 24 Dec 2022
Edited: Sam Chak on 24 Dec 2022
This is the Root Locus compensator design approach, first attempt.
s = tf('s');
Gp = 20/(s^2 + 4.5*s + 64)
Gp = 20 ---------------- s^2 + 4.5 s + 64 Continuous-time transfer function.
controlSystemDesigner('rlocus', Gp)
The app will show root locus of .
Fig. 1: Right-click the white area and add a new design requirement.
Fig. 2: Select Percent overshoot and insert the design value.
Fig. 3: An exclusion region is indicated by the yellow shaded area, separated from the white area by the thick black lines.
Fig. 4: Add a second design requirement, select Settling time and insert the design value.
Fig. 5: A second exclusion region overlaps with the first exclusion region. A new thick black line can also be seen.
Fig. 6: Right-click the white area, click on Edit compensator, and then add an Integrator, because the Plant is a Type-0 system.
Fig. 7: Right-click the white area, click on Edit compensator, and then add a Real Pole, placing it relatively far away from the Plant's poles
Fig. 8: Right-click the white area, click on Edit compensator, and then add the Complex Zeros to cancel out the Plant's stable Complex poles. Natural frequency , and Damping ratio .
Note: This doesn't work if the Plant is unstable.
Fig. 9: The "magenta dot markers" can be seen. The Plant's stable poles are cancelled out by the Compensator's zeros. Next, the design task is to drag one of the magenta markers (on the real axis) along the root locus until a response plot stays outside of the associated exclusion regions.
Fig. 10: The "magenta dot markers" are dragged to the breakaway point (My preference).
Fig. 11: This can also be directly adjusted through entering a design value to Compensator gain.
Fig. 12: Check the Step response if the performance is satisfactory.
Fig. 13: If satisfactory, then export the designed Compensator to Workspace. With the design values, they can be entered in the Transfer function block or zpk block in Simulink.
C = zpk(1.8*(s^2 + 4.5*s + 64)/(s*(s + 12)))
C = 1.8 (s^2 + 4.5s + 64) --------------------- s (s+12) Continuous-time zero/pole/gain model.
Gcl = tf(feedback(C*Gp, 1))
Gcl = 36 s^2 + 162 s + 2304 --------------------------------------- s^4 + 16.5 s^3 + 154 s^2 + 930 s + 2304 Continuous-time transfer function.
% Can check in MATLAB whether the design requirements are satisfied.
S = stepinfo(Gcl)
S = struct with fields:
RiseTime: 0.5599 TransientTime: 0.9725 SettlingTime: 0.9725 SettlingMin: 0.9055 SettlingMax: 1.0000 Overshoot: 0 Undershoot: 0 Peak: 1.0000 PeakTime: 2.1337
If satisfactory, find the equivalent PID gains via algebraic calculations.
% This step is unnecessary, because the Compensator works just as good!
kp = -0.125;
ki = 9.6;
kd = 77/480;
Tf = 1/12;
Cpid = pid(kp, ki, kd, Tf)
Gpid = 1 s Kp + Ki * --- + Kd * -------- s Tf*s+1 with Kp = -0.125, Ki = 9.6, Kd = 0.16, Tf = 0.0833 Continuous-time PIDF controller in parallel form.
% Proof
ans = 1.8 (s^2 + 4.5s + 64) --------------------- s (s+12) Continuous-time zero/pole/gain model.

Sign in to comment.




Community Treasure Hunt

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

Start Hunting!