genss

Generalized state-space model

Description

Generalized state-space (genss) models are state-space models that include tunable parameters or components. genss models arise when you combine numeric LTI models with models containing tunable components (control design blocks). For more information about numeric LTI models and control design blocks, see Models with Tunable Coefficients.

You can use generalized state-space models to represent control systems having a mixture of fixed and tunable components. Use generalized state-space models for control design tasks such as parameter studies and parameter tuning with commands such as systune and looptune.

Construction

To construct a genss model:

• Use series, parallel, lft, or connect, or the arithmetic operators +, -, *, /, \, and ^, to combine numeric LTI models with control design blocks.

• Use tf or ss with one or more input arguments that is a generalized matrix (genmat) instead of a numeric array

• Convert any numeric LTI model, control design block, or slTuner (Simulink Control Design) interface (requires Simulink® Control Design™), for example, sys, to genss form using:

gensys = genss(sys)

When sys is an slTuner interface, gensys contains all the tunable blocks and analysis points specified in this interface. To compute a tunable model of a particular I/O transfer function, call getIOTransfer(gensys,in,out). Here, in and out are the analysis points of interest. (Use getPoints(sys) to get the full list of analysis points.) Similarly, to compute a tunable model of a particular open-loop transfer function, use getLoopTransfer(gensys,loc). Here, loc is the analysis point of interest.

Examples

collapse all

In this example, you will create a low-pass filter with one tunable parameter a:

$F=\frac{a}{s+a}$

Since the numerator and denominator coefficients of a tunableTF block are independent, you cannot use tunableTF to represent F. Instead, construct F using the tunable real parameter object realp.

Create a real tunable parameter with an initial value of 10.

a = realp('a',10)
a =
Name: 'a'
Value: 10
Minimum: -Inf
Maximum: Inf
Free: 1

Real scalar parameter.

Use tf to create the tunable low-pass filter F.

numerator = a;
denominator = [1,a];
F = tf(numerator,denominator)
F =

Generalized continuous-time state-space model with 1 outputs, 1 inputs, 1 states, and the following blocks:
a: Scalar parameter, 2 occurrences.

Type "ss(F)" to see the current value, "get(F)" to see all properties, and "F.Blocks" to interact with the blocks.

F is a genss object which has the tunable parameter a in its Blocks property. You can connect F with other tunable or numeric models to create more complex control system models. For an example, see Control System with Tunable Components.

This example shows how to create a state-space genss model having both fixed and tunable parameters.

$A=\left[\begin{array}{cc}1& a+b\\ 0& ab\end{array}\right],\phantom{\rule{1em}{0ex}}B=\left[\begin{array}{c}-3.0\\ 1.5\end{array}\right],\phantom{\rule{1em}{0ex}}C=\left[\begin{array}{cc}0.3& 0\end{array}\right],\phantom{\rule{1em}{0ex}}D=0,$

where a and b are tunable parameters, whose initial values are -1 and 3, respectively.

Create the tunable parameters using realp.

a = realp('a',-1);
b = realp('b',3);

Define a generalized matrix using algebraic expressions of a and b.

A = [1 a+b;0 a*b];

A is a generalized matrix whose Blocks property contains a and b. The initial value of A is [1 2;0 -3], from the initial values of a and b.

Create the fixed-value state-space matrices.

B = [-3.0;1.5];
C = [0.3 0];
D = 0;

Use ss to create the state-space model.

sys = ss(A,B,C,D)
sys =

Generalized continuous-time state-space model with 1 outputs, 1 inputs, 2 states, and the following blocks:
a: Scalar parameter, 2 occurrences.
b: Scalar parameter, 2 occurrences.

Type "ss(sys)" to see the current value, "get(sys)" to see all properties, and "sys.Blocks" to interact with the blocks.

sys is a generalized LTI model (genss) with tunable parameters a and b.

This example shows how to create a tunable model of a control system that has both fixed plant and sensor dynamics and tunable control components.

Consider the control system of the following illustration.

Suppose that the plant response is $G\left(s\right)=1/\left(s+1{\right)}^{2}$, and that the model of the sensor dynamics is $S\left(s\right)=5/\left(s+4\right)$. The controller $C$ is a tunable PID controller, and the prefilter $F=a/\left(s+a\right)$ is a low-pass filter with one tunable parameter, a.

Create models representing the plant and sensor dynamics. Because the plant and sensor dynamics are fixed, represent them using numeric LTI models.

G = zpk([],[-1,-1],1);
S = tf(5,[1 4]);

To model the tunable components, use Control Design Blocks. Create a tunable representation of the controller C.

C = tunablePID('C','PID');

C is a tunablePID object, which is a Control Design Block with a predefined proportional-integral-derivative (PID) structure.

Create a model of the filter $F=a/\left(s+a\right)$ with one tunable parameter.

a = realp('a',10);
F = tf(a,[1 a]);

a is a realp (real tunable parameter) object with initial value 10. Using a as a coefficient in tf creates the tunable genss model object F.

Interconnect the models to construct a model of the complete closed-loop response from r to y.

T = feedback(G*C,S)*F
T =

Generalized continuous-time state-space model with 1 outputs, 1 inputs, 5 states, and the following blocks:
C: Tunable PID controller, 1 occurrences.
a: Scalar parameter, 2 occurrences.

Type "ss(T)" to see the current value, "get(T)" to see all properties, and "T.Blocks" to interact with the blocks.

T is a genss model object. In contrast to an aggregate model formed by connecting only numeric LTI models, T keeps track of the tunable elements of the control system. The tunable elements are stored in the Blocks property of the genss model object. Examine the tunable elements of T.

T.Blocks
ans = struct with fields:
C: [1x1 tunablePID]
a: [1x1 realp]

When you create a genss model of a control system that has tunable components, you can use tuning commands such as systune to tune the free parameters to meet design requirements you specify.

Create a genss model with labeled state names. To do so, label the states of the component LTI models before connecting them. For instance, connect a two-state fixed-coefficient plant model and a one-state tunable controller.

A = [-1 -1; 1 0];
B = [1; 0];
C = [0 1];
D = 0;
G = ss(A,B,C,D);
G.StateName = {'Pstate1','Pstate2'};

C = tunableSS('C',1,1,1);

L = G*C;

The genss model L preserves the state names of the components that created it. Because you did not assign state names to the tunable component C, the software automatically does so. Examine the state names of L to confirm them.

L.StateName
ans = 3x1 cell
{'Pstate1'}
{'Pstate2'}
{'C.x1'   }

The automatic assignment of state names to control design blocks allows you to trace which states in the generalized model are contributed by tunable components.

State names are also preserved when you convert a genss model to a fixed-coefficient state-space model. To confirm, convert L to ss form.

Lfixed = ss(L);
Lfixed.StateName
ans = 3x1 cell
{'Pstate1'}
{'Pstate2'}
{'C.x1'   }

State unit labels, stored in the StateUnit property of the genss model, behave similarly.

Create a generalized model with a tunable parameter, and examine the dependence of the A matrix on that parameter. To do so, examine the A property of the generalized model.

G = tf(1,[1 10]);
k = realp('k',1);
F = tf(k,[1 k]);
L1 = G*F;
L1.A
ans =

Generalized matrix with 2 rows, 2 columns, and the following blocks:
k: Scalar parameter, 2 occurrences.

Type "double(ans)" to see the current value, "get(ans)" to see all properties, and "ans.Blocks" to interact with the blocks.

The A property is a generalized matrix that preserves the dependence on the real tunable parameter k. The state-space matrix properties A, B, C, and D only preserve dependencies on static parameters. When the genss model has dynamic control design blocks, these are set to their current value for evaluating the state-space matrix properties. For example, examine the A matrix property of a genss model with a tunable PI block.

C = tunablePID('C','PI');
L2 = G*C;
L2.A
ans = 2×2

-10.0000    0.0010
0         0

Here, the A matrix is stored as a double matrix, whose value is the A matrix of the current value of L2.

L2cur = ss(L2);
L2cur.A
ans = 2×2

-10.0000    0.0010
0         0

Additionally, extracting state-space matrices using ssdata sets all control design blocks to their current or nominal values, including static blocks. Thus, the following operations all return the current value of the A matrix of L1.

[A,B,C,D] = ssdata(L1);
A
A = 2×2

-10     1
0    -1

double(L1.A)
ans = 2×2

-10     1
0    -1

L1cur = ss(L1);
L1cur.A
ans = 2×2

-10     1
0    -1

Tips

• You can manipulate genss models as ordinary ss models. Analysis commands such as bode and step evaluate the model by replacing each tunable parameter with its current value.