varyingGoal
Variable tuning goal for gain-scheduled controllers
Description
When tuning fixed or gain-scheduled controllers at multiple design points
(operating conditions), you might need to adjust the tuning goals as a function of
operating condition, for example, to relax performance in some regions of the operating
range. Use varyingGoal
to construct tuning goals that depend
implicitly or explicitly on the design point.
specifies
a varying goal using a template and sets of goal-parameter values.
The template VG
= varyingGoal(FH
,par
1,par
2,...)FH
is a function handle that specifies
a function, TG = FH(p1,p2,...)
, that evaluates
to one of the TuningGoal
objects. The arrays par1,par2,...
specify
the values of the tuning-goal parameters p1,p2,...
at
each design point. Use VG
as you would use any TuningGoal
object
in an input to systune
.
configures additional properties of the tuning goal.VG
= varyingGoal(___,Name,Value
)
Examples
Varying Tuning Goal
Create a tuning goal that specifies variable gain and phase margins across a grid of design points.
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));
Suppose further that you have 5-by-5 arrays of target gain margins and target phase margins corresponding to each of the design points, such as the following.
[GM,PM] = ndgrid(linspace(7,20,5),linspace(45,70,5));
To enforce the specified margins at each design point, first create a template for the margins goal. The template is a function that takes gain and phase margin values and returns a TuningGoal.Margins
object with those margins.
FH = @(gm,pm) TuningGoal.Margins('u',gm,pm);
Use the template and the margin arrays to create the varying goal.
VG = varyingGoal(FH,GM,PM);
To make it easier to trace which goal applies to which design point, use the SamplingGrid
property to attach the design-point information to VG
.
VG.SamplingGrid = struct('alpha',alpha,'V',V);
Use VG
with systune
as you would use any other tuning goal. Use viewGoal
to visualize the tuning goal and identify design points that fail to meet the target margins.
Varying Tuning Goal with LTI Parameter
Create a tuning goal that specifies a loop shape that varies with one scheduling variable, a
.
Suppose you want to specify a loop shape with a crossover frequency that varies as 2*a
over three design points. To enforce this requirement, first create a template for the loop-shape goal. The template is a function that takes a numeric scalar input parameter and returns a TuningGoal.LoopShape
object. The function input must be scalar, so the function constructs the LTI models representing the loop shapes.
a = [5;10;15]; s = tf('s'); FH = @(A) TuningGoal.LoopShape('u',2*A/s);
Here, 'u'
is an Analysis Point in the system, the location at which you want to impose the loop-shape requirements.
Use the template and the array to create the varying goal.
VG = varyingGoal(FH,a);
Attach the design-point information to VG
.
VG.SamplingGrid = struct('a',a);
Now each value of a
is associated with a tuning goal that enforces the corresponding loop shape. For example, confirm that the third entry in a
, a = 15
, is associated with the third loop shape, 30/s
.
LS3 = getGoal(VG,'index',3);
tf(LS3.LoopGain)
ans = 30 -- s Continuous-time transfer function.
Varying Tuning Goal with Frequency Focus and Loop Opening
Create a tuning goal that specifies variable gain and phase margins across a grid of design points. Configure the tuning goal to be evaluated with a loop opening at a location 'LO'
and to apply only in the frequency range between 1 and 100 rad/s.
Specify the grid of design points and the corresponding grid of target gain margins and phase margins. Also, create the template function for the varying margins goal.
[alpha,V] = ndgrid(linspace(0,20,5),linspace(700,1300,5));
[GM,PM] = ndgrid(linspace(7,20,5),linspace(45,70,5));
FH = @(gm,pm) TuningGoal.Margins('u',gm,pm);
Use the template function and the margin arrays to create the varying goal. Also, use Name,Value
pairs to specify:
The location at which the loop is opened for evaluating the tuning goal (
Openings
property).The frequency range in which the varying goal applies (
Focus
property).
The property names and values that you specify for the underlying tuning goal are stored in the Settings
property of the varying goal.
VG = varyingGoal(FH,GM,PM,'Openings','LO','Focus',[1,100])
VG = varyingGoal with properties: Template: @(gm,pm)TuningGoal.Margins('u',gm,pm) Parameters: {[5x5 double] [5x5 double]} Settings: {'Openings' 'LO' 'Focus' [1 100]} SamplingGrid: [1x1 struct] Name: '' Variable tuning goal acting over a 5x5 grid of (gm,pm) values.
To make it easier to trace which goal applies to which design point, use the SamplingGrid
property to attach the design-point information to VG
.
VG.SamplingGrid = struct('alpha',alpha,'V',V);
Input Arguments
FH
— Template for varying goal
function handle
Template for varying goal, specified as a function handle. FH
specifies
a function of one or more parameters that evaluates to one of the TuningGoal
objects.
For example, suppose you want to constrain the overshoot in the step
response from an input r
to an output y
in
your system, and you want to allow the constraint to vary across different
design points. Specify the template as a function that returns a TuningGoal.Overshoot
object.
For example, you can specify FH
as an anonymous
function.
FH = @(os) TuningGoal.Overshoot('r','y',os);
Because TuningGoal.Overshoot
has only one
parameter besides the input and output signals, FH
is
a handle to a function of one argument. For other tuning goals, use
more arguments. For example, TuningGoal.Margins
has
two parameters, the gain margin and phase margin. Therefore, for a
variable margin goal, FH
has two arguments.
FH = @(gm,pm) TuningGoal.Margins('u',gm,pm);
The template function allows great flexibility in constructing
the design goals. For example, you can write a function, goalspec(a,b)
,
that constructs the tuning goal specification as a nontrivial function
of the parameters (a,b)
, and save the function
in a MATLAB® file. Your template function then calls goalspec
as
follows.
FH = @(a,b) TuningGoal.Margins('u',goalspec(a,b));
Similarly, if the tuning-goal parameters do not fit in numeric
arrays, you can use the design-point index as input to FH
.
For example, suppose the gain and phase margin data is stored in a
struct array, S
, with fields GM
and PM
,
you can use the following.
FH = @(idx) TuningGoal.Margins('u',S(idx).GM,S(idx).PM);
idx
is an absolute index into the grid of design points.
par
— Tuning goal parameters
numerical array
Tuning goal parameters, specified as a numerical array with
the same dimensions as the model array used for gain-scheduled tuning. Provide
an array for each parameter in the tuning goal, where each entry in
the array is the parameter value you want to apply to the corresponding
design point. For example, the TuningGoal.Overshoot
goal
has only one parameter, the maximum overshoot. Therefore, specify
the parameters as follows.
par = osvals;
osvals
is an array of overshoot values to
enforce at each design point.
The TuningGoal.Margins
goal has two parameters,
the gain margin and phase margin. Therefore, for a variable margin
goal, specify the parameters as follows:
par1 = GM; par2 = PM;
Here, GM
is an array of gain-margin values
and PM
is an array of phase-margin values to enforce
at each design point.
To make the variable tuning goal inactive at a particular design
point, set the corresponding entry of the par
array
(or arrays) to NaN
.
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Use Name,Value
pairs to specify properties of the underlying
tuning goal. For instance, suppose you want to create a varying gain goal that
specifies a variable gain profile between points 'L'
and
'V'
. You also want to enforce the gain goal only in the
frequency band [0 pi/Ts]
, with a loop opening at an analysis
point labeled OuterLoop
. You use Name,Value
pairs to specify these properties for the gain goal.
FH = @(w) TuningGoal.Gain('F','V',tf(w,[1 w])); VG = varyingGoal(FH,wdata,'Focus',[0 pi/Ts],'Openings','OuterLoop');
Which properties you can set depends on which of the TuningGoal
objects your function FH
evaluates to. For instance, for most
varying tuning goals, you can set properties such as Openings
,
Models
, and Focus
. For a variable
TuningGoal.Gain
goal, you can also use
Name,Value
pairs to set properties such as
Stabilize
, InputScaling
, and
OutputScaling
. See the individual
TuningGoal
object reference pages for a list of the
properties of each tuning goal.
Output Arguments
VG
— Variable tuning goal
varyingGoal
object
Variable tuning goal, returned as a varyingGoal
object.
This object captures the tuning goal and its variation across design
points in a MATLAB variable. Use VG
in an
input argument to systune
just as you would use
any TuningGoal
object.
VG
has the following properties.
Property | Description |
---|---|
Template | Template for the varying goal, stored as a function handle
to a function of one or more parameters whose values change over the
operating range for tuning. The initial value of this property is
set by the |
Parameters | Tuning goal parameters at each design point, stored as a cell array. Each entry in the cell array is a numeric array containing the parameter values at each design point. For example, for a variable margins goal with template FG = FH = @(gm,pm) TuningGoal.Margins('u',gm,pm); {GM,PM} , where GM and PM are
arrays containing the desired gain and phase margins at each design
point. The initial value of this property is set by the
input arguments |
Settings |
Property names and values to be applied to each goal instance in the varying goal, stored as a cell array. Default: |
SamplingGrid | Design points, stored as a structure containing an array
of values for each sampling variable. The design points need not lie
on a rectangular grid and can be scattered throughout the operating
range. The sizes of the arrays in the For more information about sampling grids,
see the Default: |
Name | Name for the variable goal. Set Default: |
Tips
Use
viewGoal
to visualize tuning goals. For varying tuning goals, the tuning-goal plot generated byviewGoal
lets you examine the tuning goal at each design point. For more information, see Validate Gain-Scheduled Control Systems.
Version History
Introduced in R2017b
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)