Main Content

getBlockValue

Get current value of Control Design Block in Generalized Model

Description

example

val = getBlockValue(M,blockname) gets the current value of the Control Design Block blockname in the Generalized Model M. For uncertain blocks, the current value is the nominal value of the block.

[val1,val2,...,valn] = getBlockValue(M,blockname1,blockname2,...,blocknamen) gets the values of the specified Control Design Blocks.

example

S = getBlockValue(M) gets the values of all Control Design Blocks of the generalized model, and returns them in a structure. This syntax enables you to transfer the block values from one generalized model to another model that uses the same Control Design Blocks. For example, this code transfers the values S of model M1 to model M2.

S = getBlockValue(M1);
setBlockValue(M2,S);

Examples

collapse all

Get the current value of a Control Design Block from a generalized state-space LTI model.

You can use the getBlockValue function to retrieve the tuned values of the Control Design Blocks after using a tuning command, such as systune, to tune the genss model.

Create a genss model.

G = zpk([],[-1 -1],1);
C = tunablePID("C",'PID');
a = realp("a",10);  
F = tf(a,[1 a]);
T = feedback(G*C,1)*F;

Get the current value of a Control Design Block by specifying its name as the blockname input argument to the getBlockValue function.

Cval = getBlockValue(T,'C')
Cval =
 
        1 
  Ki * ---
        s 

  with Ki = 0.001
 
Name: C
Continuous-time I-only controller.

Get the current value of another Control Design Block.

aval = getBlockValue(T,'a')
aval = 10

Get the current values of all Control Design Blocks from a generalized state-space LTI model.

You can use the getBlockValue function to retrieve the tuned values of the Control Design Blocks after using a tuning command, such as systune, to tune the genss model.

Create a genss model.

G = zpk([],[-1 -1],1);
C = tunablePID("C",'PID');
a = realp("a",10);  
F = tf(a,[1 a]);
T = feedback(G*C,1)*F;

Get the current values of all Control Design Blocks in a structure.

S = getBlockValue(T)
S = struct with fields:
    C: [1x1 pid]
    a: 10

Input Arguments

collapse all

Generalized LTI model or matrix, specified as a genss object, genfrd object, or a genmat object. For more information on generalized LTI models, see Generalized and Uncertain LTI Models. For more information on generalized matrices, see Generalized Matrices.

Name of a Control Design Block in input model M, specified as a character vector.

Example: To get a list of the Control Design Blocks in input model M, enter M.Blocks at the command prompt.

Output Arguments

collapse all

Numeric value of the LTI block, returned as a scalar. This is the current value of the Control Design Block blockname.

Current values of all Control Design Blocks in input model M, returned as a structure. The structure contains a field for each block in the input model M, and each field has the same name as its corresponding block. The values of the fields are numeric LTI models or numeric values equal to the current values of the corresponding Control Design Blocks.

Version History

Introduced in R2011b