Main Content


Current value of generalized model



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)).


collapse all

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

Create Closed-Loop System Model

Consider the following closed-loop system:

The following code creates a genss model of this system with G(s)=(s-1)(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)
Generalized continuous-time state-space model with 1 outputs, 1 inputs, 4 states, and the following blocks:
  C: Tunable PID controller, 1 occurrences.

Type "ss(Try)" to see the current value and "Try.Blocks" to interact with the blocks.

Find Current Values of Control Design Block and Feedback Loop Gain

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.

Evaluate C to obtain its current value

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

Cnow = getValue(C)
Cnow =
  Ki * ---

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

Evaluate Try to obtain its current value

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

Tnow = getValue(Try)
Tnow =
  A = 
                  ?        ?        ?  C.Integ
   ?             -1    1.414        0        0
   ?              0       -1        1        0
   ?              0        0       -1    0.002
   C.Integ   0.7071     -0.5        0        0
  B = 
   ?         0
   ?         0
   ?         0
   C.Integ   1
  C = 
             ?        ?        ?  C.Integ
   y1  -0.7071      0.5        0        0
  D = 
   y1   0
Continuous-time state-space model.

This example shows how to propagate changes in block values from one model to another using getValue.

Tune Your Model

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);

Access Tuned Values

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);

Input Arguments

collapse all

Generalized LTI model or Generalized matrix created using corresponding objects.

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.

Reference 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

collapse all

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.

Version History

Introduced in R2011b

See Also

| | | | (Robust Control Toolbox)