Main Content


Construct tuning setup for looptune to tuning setup for systune using slTuner interface



[st0,SoftReqs,HardReqs,sysopt] = looptuneSetup(looptuneInputs) converts a tuning setup for looptune into an equivalent tuning setup for systune. The argument looptuneInputs is a sequence of input arguments for looptune that specifies the tuning setup. For example,

[st0,SoftReqs,HardReqs,sysopt] = looptuneSetup(st0,wc,Req1,Req2,loopopt)
generates a set of arguments such that looptune(st0,wc,Req1,Req2,loopopt) and systune(st0,SoftReqs,HardReqs,sysopt) produce the same results.

Use this command to take advantage of additional flexibility that systune offers relative to looptune. For example, looptune requires that you tune all channels of a MIMO feedback loop to the same target bandwidth. Converting to systune allows you to specify different crossover frequencies and loop shapes for each loop in your control system. Also, looptune treats all tuning requirements as soft requirements, optimizing them, but not requiring that any constraint be exactly met. Converting to systune allows you to enforce some tuning requirements as hard constraints, while treating others as soft requirements.

You can also use this command to probe into the tuning requirements enforced by looptune.


collapse all

Convert a set of looptune inputs for tuning a Simulink® model into an equivalent set of inputs for systune.

Suppose you have created and configured an slTuner interface, st0, for tuning with looptune. Suppose also that you used looptune to tune the feedback loop defined in st0 to within a bandwidth of wc = [wmin,wmax]. Convert these variables into a form that allows you to use systune for further tuning.

[st0,SoftReqs,HardReqs,sysopt] = looptuneSetup(st0,wc,controls,measurements);

The command returns the closed-loop system and tuning requirements for the equivalent systune command, systune(st0,SoftReqs,HardReqs,sysopt). The arrays SoftReqs and HardReqs contain the tuning requirements implicitly imposed by looptune. These requirements enforce the target bandwidth and default stability margins of looptune.

If you used additional tuning requirements when tuning the system with looptune, add them to the input list of looptuneSetup. For example, suppose you used a TuningGoal.Tracking requirement, Req1, and a TuningGoal.Rejection requirement, Req2. Suppose also that you set algorithm options for looptune using looptuneOptions. Incorporate these requirements and options into the equivalent systune command.

[st0,SoftReqs,HardReqs,sysopt] = looptuneSetup(st0,wc,Req1,Req2,loopopt);

The resulting arguments allow you to construct the equivalent tuning problem for systune.

Set up the control system of the Simulink® model rct_distillation for tuning with looptune. Then, convert the setup to a systune problem, and examine the resulting arguments. The results reflect the tuning requirements implicitly enforced when tuning with looptune.

Create an slTuner interface to the Simulink model, and specify the blocks to be tuned. Configure the interface for tuning with looptune by adding analysis points that define the separation between the plant and the controller. Also add the analysis points needed for imposing tuning requirements.


tuned_blocks = {'PI_L','PI_V','DM'};
st0 = slTuner('rct_distillation',tuned_blocks);


This system is now ready for tuning with looptune, using tuning goals that you specify. For example, specify a target bandwidth range. Create a tuning requirement that imposes reference tracking in both channels of the system, and a disturbance rejection requirement.

wc = [0.1,0.5];
req1 = TuningGoal.Tracking('r','y',15,0.001,1);
max_disturbance_gain = frd([0.05 5 5],[0.001 0.1 10],'TimeUnit','min');
req2 = TuningGoal.Gain({'dL','dV'},'y',max_disturbance_gain);

controls = {'L','V'};
measurement = 'y';

[st,gam,info] = looptune(st0,controls,measurement,wc,req1,req2);
Final: Peak gain = 1.04, Iterations = 66

looptune successfully tunes the system to these requirements. However, you might want to switch to systune to take advantage of additional flexibility in configuring your problem. For example, instead of tuning both channels to a loop bandwidth inside wc, you might want to specify different crossover frequencies for each loop. Or, you might want to enforce the tuning requirements, req1 and req2, as hard constraints, and add other requirements as soft requirements.

Convert the looptune input arguments to a set of input arguments for systune.

[st0,SoftReqs,HardReqs,sysopt] = looptuneSetup(st0,controls,measurement,wc,req1,req2);

This command returns a set of arguments you can feed to systune for equivalent results to tuning with looptune. In other words, the following command is equivalent to the looptune command.

[st,fsoft,ghard,info] = systune(st0,SoftReqs,HardReqs,sysopt);
Final: Peak gain = 1.04, Iterations = 66

Examine the tuning requirements returned by looptuneSetup. When tuning this control system with looptune, all requirements are treated as soft requirements. Therefore, HardReqs is empty. SoftReqs is an array of TuningGoal requirements. These requirements together enforce the bandwidth and margins of the looptune command, plus the additional requirements that you specified.

SoftReqs = 

  5x1 heterogeneous SystemLevel (LoopShape, Tracking, Gain, ...) array with properties:


For example, examine the first entry in SoftReqs.

ans = 

  LoopShape with properties:

       LoopGain: [1x1 zpk]
       CrossTol: 0.3495
          Focus: [0 Inf]
      Stabilize: 1
    LoopScaling: 'on'
       Location: {'y'}
         Models: NaN
       Openings: {0x1 cell}
           Name: 'Open loop GC'

looptuneSetup expresses the target crossover frequency range wc as a TuningGoal.LoopShape requirement. This requirement constrains the open-loop gain profile to the loop shape stored in the LoopGain property, with a crossover frequency and crossover tolerance (CrossTol) determined by wc. Examine this loop shape.


The target crossover is expressed as an integrator gain profile with a crossover between 0.1 and 0.5 rad/s, as specified by wc. If you want to specify a different loop shape, you can alter this TuningGoal.LoopShape requirement before providing it to systune.

looptune also tunes to default stability margins that you can change using looptuneOptions. For systune, stability margins are specified using TuningGoal.Margins requirements. Here, looptuneSetup has expressed the default stability margins as soft TuningGoal.Margins requirements. For example, examine the fourth entry in SoftReqs.

ans = 

  Margins with properties:

      GainMargin: 7.6000
     PhaseMargin: 45
    ScalingOrder: 0
           Focus: [0 Inf]
        Location: {2x1 cell}
          Models: NaN
        Openings: {0x1 cell}
            Name: 'Margins at plant inputs'

The last entry in SoftReqs is a similar TuningGoal.Margins requirement constraining the margins at the plant outputs. looptune enforces these margins as soft requirements. If you want to convert them to hard constraints, pass them to systune in the input vector HardReqs instead of the input vector SoftReqs.

Input Arguments

collapse all

Control system and requirements configured for tuning with looptune, specified as a valid looptune input sequence. For more information about the arguments in a valid looptune input sequence, see the looptune reference page.

Output Arguments

collapse all

Interface for tuning control systems modeled in Simulink, returned as an slTuner interface. st0 is identical to the slTuner interface you use as input to looptuneSetup.

Soft tuning requirements for tuning with systune, returned as a vector of TuningGoal requirement objects.

looptune expresses most of its implicit tuning requirements as soft tuning requirements. For example, a specified target loop bandwidth is expressed as a TuningGoal.LoopShape requirement with integral gain profile and crossover at the target frequency. Additionally, looptune treats all of the explicit requirements you specify (Req1,...ReqN) as soft requirements. SoftReqs contains all of these tuning requirements.

Hard tuning requirements (constraints) for tuning with systune, returned as a vector of TuningGoal requirement objects.

Because looptune treats most tuning requirements as soft requirements, HardReqs is usually empty. However, if you change the default MaxFrequency option of the looptuneOptions set, loopopt, then this requirement appears as a hard TuningGoal.Poles constraint.

Algorithm options for systune tuning, returned as a systuneOptions options set.

Some of the options in the looptuneOptions set, loopopt, are converted into hard or soft requirements that are returned in HardReqs and SoftReqs. Other options correspond to options in the systuneOptions set.

Version History

Introduced in R2014a