The PID block is initialized with its value in the Simulink model, which you can access
using getBlockValue. Note that the proportional and derivative gains are initialized to
zero.
getBlockValue(ST0,'PID Controller')
ans =
1
Ki * ---
s
with Ki = 0.01
Name: PID_Controller
Continuous-time I-only controller.
Next create a step tracking requirement to capture the target settling time of 5 seconds.
Use the signal names in the Simulink model to refer to the reference and output signals,
and specify the target response as a first-order response with time constant of 1 second.
TrackReq = TuningGoal.StepTracking('Ref','Speed',1);
You can now tune the control system ST0 subject to the requirement TrackReq.
ST1 = systune(ST0,TrackReq);
Final: Soft = 0.282, Hard = -Inf, Iterations = 64
The final value is close to 1 indicating that the tracking requirement is met. systune
returns a "tuned" version ST1 of the control system described by ST0. Again use
getBlockValue to access the tuned values of the PID gains:
getBlockValue(ST1,'PID Controller')
ans =
1 s
Kp + Ki * --- + Kd * --------
s Tf*s+1
with Kp = 0.00217, Ki = 0.00341, Kd = 0.000513, Tf = 1.09e-06
13 Control System Tuning Examples