Tuning a PID controller to desired Overshoot, settling time and rise time
503 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(3 个)
Sulaymon Eshkabilov
2022-12-24
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
0 个评论
Paul
2022-12-24
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);
stepinfo(Rtrack.ReferenceModel)
CL = systune(CL0,Rtrack);
The PID controller is:
showTunable(CL)
Those negative gains look peculiar!
The closed-loop step response is
stepplot(CL)
stepinfo(CL)
0 个评论
Sam Chak
2022-12-24
编辑:Sam Chak
2022-12-24
Hi @Muhammad
This is the Root Locus compensator design approach, first attempt.
s = tf('s');
Gp = 20/(s^2 + 4.5*s + 64)
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)))
Gcl = tf(feedback(C*Gp, 1))
% Can check in MATLAB whether the design requirements are satisfied.
S = stepinfo(Gcl)
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)
% Proof
zpk(Cpid)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!