Main Content

getGoal

Evaluate variable tuning goal at specified design point

Description

When tuning controllers for multiple operating conditions, varyingGoal lets you adjust the tuning objectives as a function of the design point. Use getGoal to evaluate a variable goal at a particular design point or for particular values of the sampling variables.

TG = getGoal(VG,'index',k) returns the effective tuning goal at the kth design point. The absolute index k is relative to the arrays of parameter values in the Parameters property of the varying goal VG. If you have specified VG.SamplingGrid, then k is relative to the grid of design points in that property.

TG = getGoal(VG,'index',k1,k2,...) returns the effective tuning goal at the design point with coordinates (k1,k2,...). These coordinates are indices into the multidimensional arrays in VG.Parameters and VG.SamplingGrid. This syntax is useful when your design grid includes multiple scheduling variables.

example

TG = getGoal(VG,'value',x1,x2,...) returns the effective tuning goal at the design point whose scheduling-variable values are (x1,x2,...). Use this syntax only if you have specified design points in VG.SamplingGrid. For example, if VG.SamplingGrid specifies a grid of design points (a,b), then TG = getGoal(VG,'value',-1,3) returns the tuning goal at the design point (a,b) = (-1,3). If (x1,x2,...) does not match any point in VG.SamplingGrid, then getGoal returns the nearest point, in a relative sense.

example

Examples

collapse all

Suppose you use the following 5-by-5 grid of design points to tune your controller.

[alpha,V] = ndgrid(linspace(0,20,5),linspace(700,1300,5));

Create a variable tuning goal that specifies gain and phase margins at a signal named 'u' that vary across a grid of design points.

[GM,PM] = ndgrid(linspace(7,20,5),linspace(45,70,5));
FH = @(gm,pm) TuningGoal.Margins('u',gm,pm);
VG = varyingGoal(FH,GM,PM);

Use the grid to specify the SamplingGrid property of VG.

VG.SamplingGrid = struct('alpha',alpha,'V',V);

Evaluate this variable design goal at (alpha,V) = (5,1150). This point is the second alpha value and the fourth V value, so you can index into the varyingGoal using (k1,k2) = (2,4).

TGi = getGoal(VG,'index',2,4);

Because you have the specific (alpha,V) values at which you want the tuning goal, you can use those values instead of indexing.

TGv = getGoal(VG,'value',5,1150)
TGv = 
  Margins with properties:

      GainMargin: 10.2500
     PhaseMargin: 63.7500
    ScalingOrder: 0
           Focus: [0 Inf]
        Location: {'u'}
          Models: 17
        Openings: {0x1 cell}
            Name: ''

Input Arguments

collapse all

Varying tuning goal, specified as a varyingGoal object. VG captures the variation of a tuning goal over a grid of design points for gain-scheduled tuning (see tunableSurface).

Index into design point grid, specified as an integer. You can provide one integer index, k, or multiple indices k1,k2,....

If you provide a single index, k, then getGoal treats k as a linear index into the parameter arrays of VG.Parameters or the structures of VG.SamplingGrid that specify the design points.

  • If VG varies over a 1-D sampling grid (one scheduling variable), then TG = getGoal(VG,'index',k) returns the tuning goal for the kth entry in VG.Parameters.

  • If VG varies over two or more scheduling-variables, then TG = getGoal(VG,'index',k) returns the kth entry in that grid, determined by linear indexing. (See Array Indexing.)

If you provide multiple indices, k1,k2,..., then getGoal treats them as indices into the multidimensional arrays of VG.Parameters or VG.SamplingGrid.

Variable value at design point, specified as a scalar. Use inputs x1,x2,..., to get the tuning goal for a particular set of scheduling-variable values. Provide as many values as you have scheduling variables in your system. For example, if the operating conditions are described by two scheduling variables (a,b), then use (x1,x2) to specify the (a,b) value at which you want to extract the tuning goal.

Output Arguments

collapse all

Tuning goal at the specified design point, returned as a TuningGoal object. If any of the tuning goal parameters is NaN at the specified design point, then TG = []. (See varyingGoal).

Version History

Introduced in R2017b