getname
Retrieve I/O signal names from MPC plant model
Description
Examples
Get Names of Input and Output Signals from MPC Object
Create a plant and an MPC object, and then retrieve the names of some input and output signals.
mpcverbosity off; % turn off mpc messages % create plant model plant = rss(4,4,4); % random state space plant.D = 0; % set D matrix to zero % set signals type in plant model plant = setmpcsignals(plant,'MV',1,'MD',3,'UD',4,'MO',1,'UO',[3 4]); % create MPC object mpcobj=mpc(plant,1); % sampling time = 1 second
Get names of input signals.
% get input signal names getname(mpcobj,'input',1) % get name of first input signal ans = 'MV1' getname(mpcobj,'input',2) % get name of second input signal ans = 'MV2' getname(mpcobj,'input',3) % get name of third input signal ans = 'MD1' getname(mpcobj,'input',4) % get name of fourth input signal ans = 'UD1'
Get names of output signals.
% get output signal names getname(mpcobj,'output',1) % get name of first output signal ans = 'MO1' getname(mpcobj,'output',2) % get name of second output signal ans = 'MO2' getname(mpcobj,'output',3) % get name of third output signal ans = 'UO1' getname(mpcobj,'output',4) % get name of fourth output signal ans = 'UO2'
% alternative ways to retrieve names mpcobj.Model.Plant.InputName{2} % second plant input ans = 'MV2' mpcobj.ManipulatedVariables(2).Name % second manipulated variable ans = 'MV2' mpcobj.Model.Plant.InputName{4} % fourth plant input ans = 'UD1' mpcobj.DisturbanceVariables(2).Name % second disturbance variable ans = 'UD1' mpcobj.Model.Plant.OutputName{4} % fourth plant output ans = 'UO2' mpcobj.OutputVariables(4).Name % fourth plant variable name ans = 'UO2'
Note that signals not specified with setmpcsignals
are assumed to
be measured inputs (for non-specified inputs) or measured outputs (for non-specified
outputs).
Input Arguments
mpcobj
— Model predictive controller
mpc
object
Model predictive controller, specified as an MPC controller
object. To create an MPC controller, use mpc
.
i
— Signal number selection
'integer'
greater than zero
This integer specify that the name of the i
th signal needs to be
retrieved.
Signal number to be retrieved.
Example: 2
Output Arguments
name
— Signal name
character array
This character array is the name of the i
th input or output
signal (and it does not affect whether the signal is categorized as a manipulated
variable, measured or unmeasured disturbance, measured or unmeasured output).
For input signals, this is the content of
mpcobj.Model.Plant.InputName{i}
, while for output signals, this is
the content of mpcobj.Model.Plant.OutputName{i}
.
If the specified signal is a manipulated variable, this field is typically
'MV1'
, 'MV2'
, and so on, up to the number of
manipulated variables, unless specifically set otherwise. This is also identical to the
content of the Name
field of the corresponding structure in
mpcobj.ManipulatedVariables
.
If the specified signal is a disturbance input, this field is typically
'MD1'
, 'MD2'
, and so on, up to the number of
measured disturbance variables, or 'UD1'
, 'UD2'
,
and so on, up to the number of unmeasured disturbance variables, unless specifically set
otherwise. This is also the content of the corresponding Name
field
of mpcobj.DisturbanceVariables
.
If the specified signal is an output signal, this field is typically
'MO1'
, 'MO2'
, and so on, up to the number of
measured output variables, or 'UO1'
, 'UO2'
, and so
on, up to the number of unmeasured output variables, unless specifically set otherwise.
This is also the content of the corresponding Name
field of
mpcobj.OutputVariables
.
Version History
Introduced before R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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)