Main Content

getValue

Current value of Generalized Model

Syntax

curval = getValue(M)
curval = getValue(M,blockvalues)
curval = getValue(M,Mref)

Description

curval = getValue(M) returns the current value curval of the Generalized LTI model or Generalized matrix M. The current value is obtained by replacing all Control Design Blocks in M by their current value. (For uncertain blocks, the “current value” is the nominal value of the block.)

curval = getValue(M,blockvalues) uses the block values specified in the structure blockvalues to compute the current value. The field names and values of blockvalues specify the block names and corresponding values. Blocks of M not specified in blockvalues are replaced by their current values.

curval = getValue(M,Mref) inherits block values from the generalized model Mref. This syntax is equivalent to curval = getValue(M,Mref.Blocks). Use this syntax to evaluate the current value of M using block values computed elsewhere (for example, tuned values obtained with tuning commands such as systune, looptune, or the Robust Control Toolbox™ command hinfstruct (Robust Control Toolbox)).

Input Arguments

M

Generalized LTI model or Generalized matrix.

blockvalues

Structure specifying blocks of M to replace and the values with which to replace those blocks.

The field names of blockvalues match names of Control Design Blocks of M. Use the field values to specify the replacement values for the corresponding blocks of M. The field values can be numeric values, dynamic system models, or static models. If some field values are Control Design Blocks or Generalized LTI models, the current values of those models are used to compute curval.

Mref

Generalized LTI model. If you provide Mref, getValue computes curval using the current values of the blocks in Mref whose names match blocks in M.

Output Arguments

curval

Numeric array or Numeric LTI model representing the current value of M.

If you do not specify a replacement value for a given Control Design Block of M, getValue uses the current value of that block.

Examples

Evaluate Model for Specified Values of its Blocks

This example shows how to replace a Control Design Block in a Generalized LTI model with a specified replacement value using getValue.

Consider the following closed-loop system:

The following code creates a genss model of this system with G(s)=(s1)(s+1)3 and a tunable PI controller C.

G = zpk(1,[-1,-1,-1],1);
C = tunablePID('C','pi');
Try = feedback(G*C,1)

The genss model Try has one Control Design Block, C. The block C is initialized to default values, and the model Try has a current value that depends on the current value of C. Use getValue to evaluate C and Try to examine the current values.

  1. Evaluate C to obtain its current value.

    Cnow = getValue(C)

    This command returns a numeric pid object whose coefficients reflect the current values of the tunable parameters in C.

  2. Evaluate Try to obtain its current value.

    Tnow = getValue(Try)

    This command returns a numeric model that is equivalent to feedback(G*Cnow,1).

Access Values of Tuned Models and Blocks

Propagate changes in block values from one model to another using getValue.

This technique is useful for accessing values of models and blocks tuned with tuning commands such as systune, looptune, or hinfstruct (Robust Control Toolbox). For example, if you have a closed-loop model of your control system T0, with two tunable blocks, C1 and C2, you can tune it using:

[T,fSoft] = systune(T0,SoftReqs);

You can then access the tuned values of C1 and C2, as well as any closed-loop model H that depends on C1 and C2, using the following:

C1t = getValue(C1,T);
C2t = getValue(C2,T);
Ht = getValue(H,T);

Version History

Introduced in R2011b

See Also

| | | | (Robust Control Toolbox)