View tuning requirements; validate design against requirements
viewSpec(Req) displays a graphical view of a TuningGoal tuning requirement or vector of tuning requirements.
Create a tuning requirement that constrains the response from a signal, 'd', to another signal, 'y', to roll off at 20 dB/decade at frequencies greater than 1. The requirement also imposes disturbance rejection (maximum gain of 1) in the frequency range [0,1].
gmax = frd([1 1 0.01],[0 1 100]); Req = TuningGoal.MaxGain('du','u',gmax);
When you use a frequency response data (frd) model to sketch the bounds of a gain constraint or loop shape, the tuning requirement interpolates the constraint. This interpolation coverts the constraint to a smooth function of frequency.
Examine the interpolated gain constraint using viewSpec.
The yellow region represents gain values that violate the tuning requirement.
Validate a control system tuned with systune to determine whether small violations of tuning requirements are acceptable.
When you tune a control system using tuning commands such as systune, use viewSpec to compare the tuned result against the tuning requirements. Doing so can help you determine whether the tuned system comes sufficiently close to meeting your soft requirements.
Open a Simulink® model that contains a control system you want to tune.
Create requirements for tuning the control system. For this example, use tracking, roll-off, stability margin, and disturbance rejection requirements.
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);
Tune the model using these tuning requirements.
ST0 = slTuner('rct_airframe2','MIMO Controller'); addPoint(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 slTuner interface to the control system. ST1 contains the tuned values of the tunable parameters of the MIMO controller in the model.
Verify that the tuned system satisfies the margin requirement.
The yellow region denotes margins that do not satisfy the requirement. The red plot represents the actual stability margin of the tuned system, ST1. The blue plot represents the margin used in the optimization calculation, which is an upper bound on the actual margin. For ST1, the plot indicates that the margin requirement is satisfied at all frequencies.
Validate the tracking and disturbance rejection requirements in the frequency domain.
When you provide a vector of requirements, viewSpec puts all the requirements into a single figure window.
The first plot shows that the tuned system very nearly meets the tracking requirement. The slight violation suggests that setpoint tracking will perform close to expectations.
The second plot shows that the disturbance rejection levels off in violation of the requirement at very low frequencies. A small bump near 35 rad/s suggests possible damped oscillations at this frequency.
Use step and getIOTransfer to examine setpoint tracking and disturbance rejection in the time domain.
Tuning requirement to view or validate, 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.
The control system, 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, to ensure that viewSpec correctly scales open-loop requirements such as loop shapes and stability margins.
evalSpec | 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