Evaluate tuning requirements for tuned control system
[Hspec,fval] = evalSpec(Req,T) returns the normalized value, fval, of a tuning requirement evaluated for a tuned control system T. The evalSpec command also returns the transfer function, Hspec, used to compute this value.
Tune a control system with systune , and evaluate the tuning requirements with evalSpec.
Open the Simulink® model rct_airframe2.
Create tracking, roll-off, stability margin, and disturbance rejection requirements for tuning the control system.
Req1 = TuningGoal.Tracking('az ref','az',1); Req2 = TuningGoal.Gain('delta fin','delta fin',tf(25,[1 0])); Req3 = TuningGoal.Margins('delta fin',7,45); MaxGain = frd([2 200 200],[0.02 2 200]); Req4 = TuningGoal.Gain('delta fin','az',MaxGain);
Create a slTunable interface and tune the model using these tuning requirements.
ST0 = slTunable('rct_airframe2','MIMO Controller'); addControl(ST0,'delta fin'); rng default [ST1,fSoft,~,Info] = systune(ST0,[Req1,Req2,Req3,Req4]);
Final: Soft = 1.15, Hard = -Inf, Iterations = 57
ST1 is a tuned version of the slTunable interface to the control system. ST1 contains the tuned values of the tunable parameters of the MIMO controller in the model.
Evaluate the margin requirement for the tuned system.
[hspec,fval] = evalSpec(Req3,ST1,Info); fval
fval = 0.5477
The normalized value of the requirement is less than 1, indicating that the tuned system satisfies the margin requirement. For more information about how the normalized value of this requirement is calculated, see the TuningGoal.Margins reference page.
Evaluate the tracking requirement for the tuned system.
[hspec,fval] = evalSpec(Req1,ST1,Info); fval
fval = 1.1498
The tracking requirement is nearly met, but the value exceeds 1, indicating a small violation. To further assess the violation, you can use viewSpec to examine the requirement against the tuned control system as a function of frequency.
Tuning requirement to evaluate, specified as a TuningGoal requirement object or vector of TuningGoal objects. TuningGoal requirement objects include:
Tuned control system, specified as a generalized state-space (genss) model or an slTuner interface to a Simulink® model. T is typically the result of using the tuning requirement to tune control system parameters with systune.
Example: [T,fSoft,gHard,Info] = systune(T0,SoftReq,HardReq), where T0 is a tunable genss model
Example: [T,fSoft,gHard,Info] = systune(ST0,SoftReq,HardReq), where ST0 is a slTuner interface object
System information, specified as the data structure returned by systune when you use that command to tune a control system. Use Info when validating tuned MIMO systems. Doing so ensures that viewSpec correctly scales open-loop requirements such as loop shapes and stability margins.
Transfer function associated with the tuning requirement, returned as a state-space (ss) model. evalSpec uses Hspec to compute the evaluated requirement, fval.
For example, suppose Req is a TuningGoal gain requirement that limits the gain, H(s), between some specified input and output to the gain profile, w(s). In that case, Hspec is given by:
fval is the peak gain of Hspec. If H(s) satisfies the tuning requirement, fval <= 1.
Normalized value of tuning requirement, returned as a positive scalar. The normalized value is a measure of how closely the requirement is met in the tuned system. The tuning requirement is satisfied if fval < 1. For information about how each type of TuningGoal requirement is converted into a normalized value, see the TuningGoal requirement objects.
genss | slTuner | systune | systune (for slTuner) | TuningGoal.ControllerPoles | TuningGoal.Gain | TuningGoal.LoopShape | TuningGoal.Margins | TuningGoal.MaxLoopGain | TuningGoal.MinLoopGain | TuningGoal.Overshoot | TuningGoal.Poles | TuningGoal.Sensitivity | TuningGoal.Tracking | TuningGoal.Variance | TuningGoal.WeightedGain | TuningGoal.WeightedVariance | viewSpec