Documentation Center 
Package: TuningGoal
Step response requirement for control system tuning
Use the TuningGoal.StepResp object to specify a target step response from specified inputs to specified outputs of a control system. Use this requirement with control system tuning commands such as systune or looptune.
Req = TuningGoal.StepResp(inputname,outputname,refsys) creates a tuning requirement that constrains the step response between the specified signal locations to match the step response of a stable reference system, refsys. The constraint is satisfied when the relative difference between the tuned and target responses falls within a tolerance specified by the RelGap property of the requirement (see Properties). inputname and outputname can describe a SISO or MIMO response of your control system. For MIMO responses, the number of inputs must equal the number of outputs.
Req = TuningGoal.StepResp(inputname,outputname,tau) specifies the desired step response as a firstorder response with time constant tau:
Req = TuningGoal.StepResp(inputname,outputname,tau,overshoot) specifies the desired step response as a secondorder response with natural period tau, natural frequency 1/tau, and percent overshoot overshoot:
The damping is given by zeta = cos(atan2(pi,log(overshoot/100))).
inputname 
Input signal for requirement, specified as a string or a cell array of strings for vectorvalued signals. The signals available to designate as input signals for the tuning requirement are as follows.
If inputname is a loopswitch channel of a generalized model, the input signal for the requirement is the implied input associated with the switch:

outputname 
Output signal for requirement, specified as a string or a cell array of strings for vectorvalued signals. The signals available to designate as output signals for the tuning requirement are as follows.
If outputname is a loopswitch channel of a generalized model, the output signal for the requirement is the implied output associated with the switch:

refsys 
Reference system for target step response, specified as a dynamic system model, such as a tf, zpk, or ss model. refsys must be stable and must have DC gain of 1 (zero steadystate error). refsys can be continuous or discrete. If refsys is discrete, it can include time delays which are treated as poles at z = 0. refsys can be MIMO, provided that it is square and that its DC singular value (sigma) is 1. If refsys is a MIMO model, then its number of inputs and outputs must match the dimensions of inputname and outputname. For best results, refsys should also include intrinsic system characteristics such as nonminimumphase zeros (undershoot). 
tau 
Time constant or natural period of target step response, specified as a positive scalar. If you use the syntax Req = TuningGoal.StepResp(inputname,outputname,tau) to specify a firstorder target response, then tau is the time constant of the response decay. In that case, the target is the step response of the system given by:
If you use the syntax Req = TuningGoal.StepResp(inputname,outputname,tau,overshoot) to specify a secondorder target response, then tau is the inverse of the natural frequency of the response. In that case, the target is the step response of the system given by:
The damping of the system is given by zeta = cos(atan2(pi,log(overshoot/100))). 
overshoot 
Percent overshoot of target step response, specified as a scalar value in the range (0,100). 
Input 
Input signal names, specified as a cell array of strings. These strings specify the names of the inputs of the transfer function that the tuning requirement constrains. The initial value of the Input property is set by the inputname input argument when you construct the requirement object. 
InputScaling 
Reference signal scaling, specified as a vector of positive real values. For a MIMO tuning requirement, when the choice of units results in a mix of small and large signals in different channels of the response, use this property to specify the relative amplitude of each entry in the vectorvalued step input. This information is used to scale the offdiagonal terms in the transfer function from reference to tracking error. This scaling ensures that crosscouplings are measured relative to the amplitude of each reference signal. For example, suppose that Req is a requirement that signals {'y1','y2'} track reference signals {'r1','r2'}. Suppose further that you require the outputs to track the references with less than 10% crosscoupling. If r1 and r2 have comparable amplitudes, then it is sufficient to keep the gains from r1 to y2 and r2 and y1 below 0.1. However, if r1 is 100 times larger than r2, the gain from r1 to y2 must be less than 0.001 to ensure that r1 changes y2 by less than 10% of the r2 target. To ensure this result, set the InputScaling property as follows. Req.InputScaling = [100,1]; This tells the software to take into account that the first reference signal is 100 times greater than the second reference signal. The default value, [] , means no scaling. Default: [] 
Output 
Output signal names, specified as a cell array of strings. These strings specify the names of the outputs of the transfer function that the tuning requirement constrains. The initial value of the Output property is set by the outputname input argument when you construct the requirement object. 
ReferenceModel 
Reference system for target step response, specified as a SISO or MIMO statespace (ss) model. When you use the requirement to tune a control system, the step response from inputname to outputname is tuned to match this target response to within the tolerance specified by the RelGap property. If you use the refsys input argument to create the tuning requirement, then the value of ReferenceModel is ss(refsys). If you use the tau or tau and overshoot input arguments, thenReferenceModel is a statespace representation of the corresponding firstorder or secondorder transfer function. ReferenceModel must be stable and have unit DC gain (zero steadystate error). For best results, ReferenceModel should also include intrinsic system characteristics such as nonminimumphase zeros (undershoot). 
RelGap 
Maximum relative matching error, specified as a positive scalar value. This property specifies the matching tolerance as the maximum relative gap between the target and actual step responses. The relative gap is defined as:
y(t) – y_{ref}(t) is the response mismatch, and 1 – y_{ref}(t) is the steptracking error of the target model. denotes the signal energy (2norm). Increase the value of RelGap to loosen the matching tolerance. Default: 0.1 
Models 
Models to which the tuning requirement applies, specified as a vector of indices. Use the Models property when tuning an array of control system models with systune, to enforce a tuning requirement for a subset of models in the array. For example, suppose you want to apply the tuning requirement, Req, to the second, third, and fourth models in a model array passed to systune. To restrict enforcement of the requirement, use the following command: Req.Models = 2:4; When Models = NaN, the tuning requirement applies to all models. Default: NaN 
Openings 
Feedback loops to open when evaluating the requirement, specified as a cell array of strings that identify loopopening locations. The available loopopening locations depend on what kind of system you are tuning:
All feedback loops are closed by default, except where there is a permanent loopopening defined in an slTuner interface. Default: {} 
Name 
Name of the requirement object, specified as a string. For example, if Req is a requirement: Req.Name = 'LoopReq'; Default: [] 
When you tune a control system using a TuningGoal object to specify a tuning requirement, the software converts the requirement into a normalized scalar value f(x). Here, x is the vector of free (tunable) parameters in the control system. The software then adjusts the parameter values to minimize f(x) or to drive f(x) below 1 if the tuning requirement is a hard constraint.
For the TuningGoal.StepResp requirement, f(x) is given by:
T(s,x) is the closedloop transfer function from Input to Output with parameter values x. denotes the H_{2} norm (see norm).
Create a requirement for the step response from a signal named 'r' to a signal named 'y'. Constrain the step response to match the transfer function H = 10/(s+10), but allow 20% relative variation between the target the tuned responses.
H = tf(10,[1 10]); Req = TuningGoal.StepResp('r','y',H);
By default, this requirement allows a relative gap of 0.1 between the target and tuned responses. To change the relative gap to 20%, set the RelGap property of the requirement.
Req.RelGap = 0.2;
Examine the requirement.
viewSpec(Req);
The dashed line shows the target step response specified by this requirement. You can use this requirement to tune a control system model, T, that contains valid input and output locations named 'r' and 'y'. If you do so, the command viewSpec(Req,T) plots the achieved step response from 'r' to 'y' for comparison to the target response.
Create a requirement that specifies a firstorder step response with time constant of 5 seconds. Create the requirement for the step response from a signal named 'r' to a signal named 'y'.
Req = TuningGoal.StepResp('r','y',5);
When you use this requirement to tune a control system model, T, the time constant 5 is taken to be expressed in the prevailing units of the control system. For example, if T is a genss model and the property T.TimeUnit is 'seconds', then this requirement specifies a target time constant of 5 seconds for the response from the input 'r' to the output 'y' of 'T'.
The specified time constant is converted into a reference statespace model stored in the ReferenceModel property of the requirement.
refsys = tf(Req.ReferenceModel)
refsys = 0.2  s + 0.2 Continuoustime transfer function.
As expected, refsys is a firstorder model.
Examine the requirement. The viewSpec command displays the target response, which is the step response of the reference model.
viewSpec(Req);
The dashed line shows the target step response specified by this requirement, a firstorder response with a time constant of five seconds.
Create a requirement that specifies a secondorder step response with a natural period of 5 seconds, and a 10% overshoot. Create the requirement for the step response from a signal named 'r' to a signal named 'y'.
Req = TuningGoal.StepResp('r','y',5,10);
When you use this requirement to tune a control system model, T, the natural period 5 is taken to be expressed in the prevailing units of the control system. For example, if T is a genss model and the property T.TimeUnit is 'seconds', then this requirement specifies a target natural period of 5 seconds for the response from the input 'r' to the output 'y' of 'T'.
The specified parameters of the response is converted into a reference statespace model stored in the ReferenceModel property of the requirement.
refsys = tf(Req.ReferenceModel)
refsys = 0.04  s^2 + 0.2365 s + 0.04 Continuoustime transfer function.
As expected, refsys is a secondorder model.
Examine the requirement. The viewSpec command displays the target response, which is the step response of the reference model.
viewSpec(Req);
The dashed line shows the target step response specified by this requirement, a secondorder response with 10% overshoot and a natural period of five seconds.
Create a requirement that specifies a firstorder step response with time constant of 5 seconds. Set the Models and Openings properties to further configure the requirement's applicability.
Req = TuningGoal.StepResp('r','y',5); Req.Models = [2 3]; Req.Openings = 'OuterLoop'
When tuning a control system that has and input 'r', an output 'y', and an optional loopopening location 'OuterLoop', you can use Req as an input to looptune or systune. Setting the Openings property specifies that the step response from 'r' to 'y' is measured with the loop opened at 'OuterLoop'. When tuning an array of control system models, setting the Models property restricts how the requirement is applied. In this example, the requirement applies only to the second and third models in an array.
evalSpec  looptune  looptune (for slTuner)  systune  systune (for slTuner)  TuningGoal.Overshoot  TuningGoal.Tracking  viewSpec