setmpcsignals
Set signal types in LTI plant model
Description
sets the MPC signal types for the input and output signals of the LTI system
outPlant
= setmpcsignals(inPlant
,Name,Value
)inPlant
, returning the result in outPlant
.
Specify the signal types and indices using one or more name-value pair arguments. If you do
not specify the type for input or output channels, they are configured as manipulated
variables and output variables, respectively.
Examples
Set MPC Signal Types and Create MPC Controller
Create a four-input, two output state-space plant model. By default all input signals are manipulated variables and all outputs are measured outputs.
plant = rss(3,2,4); plant.D = 0;
Configure the plant input/output channels such that:
The second and third inputs are measured disturbances.
The fourth input is an unmeasured disturbance.
The second output is unmeasured.
plant = setmpcsignals(plant,'MD',[2 3],'UD',4,'UO',2);
-->Assuming unspecified input signals are manipulated variables. -->Assuming unspecified output signals are measured outputs.
Create an MPC controller.
MPCobj = mpc(plant,1);
-->The "PredictionHorizon" property is empty. Assuming default 10. -->The "ControlHorizon" property is empty. Assuming default 2. -->The "Weights.ManipulatedVariables" property is empty. Assuming default 0.00000. -->The "Weights.ManipulatedVariablesRate" property is empty. Assuming default 0.10000. -->The "Weights.OutputVariables" property is empty. Assuming default 1.00000. for output(s) y1 and zero weight for output(s) y2
Change Signal Types of Existing Controller
To modify the signal types for an existing MPC controller, you must simultaneously modify any controller properties that depend on the signal type configuration.
Create a plant model with two outputs, one manipulated variable, one measured disturbance, and two unmeasured disturbances.
plant = rss(3,2,5); plant.D = 0; plant = setmpcsignals(plant,'MV',[1 2],'MD',3,'UD',[4 5]);
Create an MPC controller using this plant.
MPCobj = mpc(plant,0.1);
-->The "PredictionHorizon" property is empty. Assuming default 10. -->The "ControlHorizon" property is empty. Assuming default 2. -->The "Weights.ManipulatedVariables" property is empty. Assuming default 0.00000. -->The "Weights.ManipulatedVariablesRate" property is empty. Assuming default 0.10000. -->The "Weights.OutputVariables" property is empty. Assuming default 1.00000.
Configure the controller properties. For example, set the scaling factors for the disturbance signals.
MPCobj.DisturbanceVariables(1).ScaleFactor = 10; MPCobj.DisturbanceVariables(2).ScaleFactor = 5; MPCobj.DisturbanceVariables(3).ScaleFactor = 20;
Suppose you want to change the second unmeasured disturbance to be a measured disturbance. To do so, you must simultaneously update the DisturbanceVariables
property of the controller, since the order of its entries depend on the disturbance types (measured disturbances followed by unmeasured disturbances).
Create an updated disturbance variable structure array. To do so, move the third element to be the second element.
DV = MPCobj.DisturbanceVariables;
DV = [DV(1) DV(3) DV(2)];
DV(2).Name = 'MD2';
To set the internal plant model signal types, obtain the Model
property from the controller, and modify the signal types of its Plant
element.
model = MPCobj.Model; model.Plant = setmpcsignals(model.Plant,'MV',[1 2],'MD',[3 5],'UD',4);
Set the model and disturbance variable properties of the controller to their updated values.
set(MPCobj,'Model',model,'DisturbanceVariables',DV);
In general, it is best practice to not modify the signal types after controller creation. Instead, create and configure a new controller object with the new signal configuration.
Input Arguments
inPlant
— Input plant model
LTI model | identified linear model
Input plant model, specified as either an LTI model or a linear System Identification Toolbox™ model.
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.
Example: 'UnmeasuredDisturbances',[2 3]
configures the second and
third input arguments as measured disturbances
ManipulatedVariables
— Manipulated variable indices
vector of positive integers
Manipulated variable indices, specified as the comma-separated pair
'ManipulatedVariables'
followed by a vector of positive integers.
The maximum index value must not exceed the number of input channels in
inPlant
. The indices specified using
ManipulatedVariables
,
MeasuredDisturbances
, and
UnmeasuredDisturbances
must not overlap.
Instead of 'ManipulatedVariables'
, you can use the abbreviation
'MV'
.
MeasuredDisturbances
— Measured disturbance indices
vector of positive integers
Measured disturbance indices, specified as the comma-separated pair
'MeasuredDisturbances'
followed by a vector of positive integers.
The maximum index value must not exceed the number of input channels in
inPlant
. The indices specified using
ManipulatedVariables
,
MeasuredDisturbances
, and
UnmeasuredDisturbances
must not overlap.
Instead of 'MeasuredDisturbances'
, you can use the abbreviation
'MD'
.
UnmeasuredDisturbances
— Unmeasured disturbance indices
vector of positive integers
Unmeasured disturbance indices, specified as the comma-separated pair
'UnmeasuredDisturbances'
followed by a vector of positive
integers. The maximum index value must not exceed the number of input channels in
inPlant
. The indices specified using
ManipulatedVariables
,
MeasuredDisturbances
, and
UnmeasuredDisturbances
must not overlap.
Instead of 'UnmeasuredDisturbances'
, you can use the
abbreviation 'UD'
.
MeasuredOutputs
— Measured output indices
vector of positive integers
Measured output indices, specified as the comma-separated pair
'MeasuredOutputs'
followed by a vector of positive integers. The
maximum index value must not exceed the number of output channels in
inPlant
. The indices specified using
MeasuredOutputs
and UnmeasuredOutputs
must
not overlap.
Instead of 'MeasuredOutputs'
, you can use the abbreviation
'MO'
.
UnmeasuredOutputs
— Unmeasured output indices
vector of positive integers
Unmeasured output indices, specified as the comma-separated pair
'UnmeasuredOutputs'
followed by a vector of positive integers.
The maximum index value must not exceed the number of output channels in
inPlant
. The indices specified using
MeasuredOutputs
and UnmeasuredOutputs
must
not overlap.
Instead of 'UnmeasuredOutputs'
, you can use the abbreviation
'UO'
.
Output Arguments
outPlant
— Output plant model
linear dynamic model
Output plant model, returned as a linear dynamic model.
outPlant
has the specified input and output channel types.
Otherwise, outPlant
is identical to
inPlant
.
Tips
In general, set the plant signal types using setmpcsignals
before
creating your controller object.
If you modify the signal types of the internal plant model of an existing controller, you must ensure that the new input/output channel types are consistent with the following controller properties:
Weights
ManipulatedVariables
OutputVariables
DisturbanceVariables
Model.Noise
Version History
Introduced before R2006a
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 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)