Main Content

getname

Retrieve I/O signal names from MPC plant model

Description

example

name= getname(MPCobj,'input',i)returns the name of theith input signal of the plant model inMPCobj. This is equivalent toname = MPCobj.Model.Plant.InputName{i}.

example

name= getname(MPCobj,'output',i)returns the name of theith output signal in variablename. This is equivalent toname=MPCobj.Model.Plant.OutputName{i}.

Examples

collapse all

Create a plant and an MPC object, and then retrieve the names of some input and output signals.

mpcverbosityoff;% turn off mpc messages% create plant modelplant = rss(4,4,4);% random state spaceplant.D = 0;% set D matrix to zero%设置如果gnals type in plant modelplant = setmpcsignals(plant,'MV',1,'MD',3,'UD',4,'MO',1,'UO',[3 4]);%创建MPC对象mpcobj = mpc(工厂,1);% sampling time = 1 second

Get names of input signals

% get input signal namesgetname(mpcobj,'input',1)% get name of first input signalans ='MV1'getname(mpcobj,'input',2)% get name of second input signalans ='MV2'getname(mpcobj,'input',3)% get name of third input signalans ='MD1'getname(mpcobj,'input',4)% get name of fourth input signalans ='UD1'

Get names of output signals

% get output signal namesgetname(mpcobj,'output',1)% get name of first output signalans =“MO1”getname(mpcobj,'output',2)% get name of second output signalans ='MO2'getname(mpcobj,'output',3)% get name of third output signalans ='UO1'getname(mpcobj,'output',4)% get name of fourth output signalans ='UO2'
% alternative ways to retrieve namesmpcobj.Model.Plant.InputName{2}% second plant inputans ='MV2'mpcobj.ManipulatedVariables(2).Name% second manipulated variableans ='MV2'mpcobj.Model.Plant.InputName{4}% fourth plant inputans ='UD1'mpcobj.DisturbanceVariables(2).Name% second disturbance variableans ='UD1'mpcobj.Model.Plant.OutputName{4}% fourth plant outputans ='UO2'mpcobj.OutputVariables(4).Name% fourth plant variable nameans ='UO2'

Note that signals not specified withsetmpcsignalsare assumed to be measured inputs (for non-specified inputs) or measured outputs (for non-specified outputs).

Input Arguments

collapse all

Model predictive controller, specified as an MPC controller object. To create an MPC controller, usempc.

This integer specify that the name of theith signal needs to be retrieved.

Signal number to be retrieved.

Example:2

Output Arguments

collapse all

This character array is the name of theith 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 ofMPCobj.Model.Plant.InputName{i}, while for output signals, this is the content ofMPCobj.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 theNamefield of the corresponding structure inMPCobj.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 correspondingNamefield ofMPCobj.DisturbanceVariables.

If the specified signal is a 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 correspondingNamefield ofMPCobj.OutputVariables.

Version History

Introduced before R2006a