Generalized state-space model
Generalized state-space (
are state-space models that include tunable parameters or components.
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
To construct a
Convert any numeric LTI model, control design block, or
slTuner interface (requires Simulink® Control Design™),
gensys = genss(sys)
sys is an
all the tunable blocks and analysis points specified in this interface.
To compute a tunable model of a particular I/O transfer function,
the analysis points of interest. (Use
get the full list of analysis points.) Similarly, to compute a tunable
model of a particular open-loop transfer function, use
loc is the analysis point of interest.
Structure containing the control design blocks included in the
generalized LTI model or generalized matrix. The field names of
You can change some attributes of these
control design blocks using dot notation. For example, if the generalized
LTI model or generalized matrix
M.Blocks.a.Value = -1;
Vector storing internal delays.
Internal delays arise, for example, when closing feedback loops on systems with delays, or when connecting delayed systems in series or parallel. For more information about internal delays, see Closing Feedback Loops with Time Delays in the Control System Toolbox™ User's Guide.
For continuous-time models, internal delays are expressed in
the time unit specified by the
You can modify the values of internal delays. However, the
number of entries in
Input delay for each input channel, specified as a scalar value
or numeric vector. For continuous-time systems, specify input delays
in the time unit stored in the
For a system with
You can also set
For a system with
Default: 0 for all output channels
Sample time. For continuous-time models,
Changing this property does not discretize or resample the model.
Units for the time variable, the sample time
Changing this property has no effect on other properties, and
therefore changes the overall system behavior. Use
Input channel names, specified as one of the following:
Alternatively, use automatic vector expansion to assign input
names for multi-input models. For example, if
sys.InputName = 'controls';
The input names automatically expand to
You can use the shorthand notation
Input channel names have several uses, including:
Input channel units, specified as one of the following:
Input channel groups. The
sys.InputGroup.controls = [1 2]; sys.InputGroup.noise = [3 5];
creates input groups named
Default: Struct with no fields
Output channel names, specified as one of the following:
Alternatively, use automatic vector expansion to assign output
names for multi-output models. For example, if
sys.OutputName = 'measurements';
The output names automatically expand to
You can use the shorthand notation
Output channel names have several uses, including:
Output channel units, specified as one of the following:
Output channel groups. The
sys.OutputGroup.temperature = ; sys.InputGroup.measurement = [3 5];
creates output groups named
Default: Struct with no fields
System name, specified as a character vector. For example,
Any text that you want to associate with the system, specified
as a character vector or cell array of character vectors. For example,
Any type of data you want to associate with system, specified as any MATLAB® data type.
Sampling grid for model arrays, specified as a data structure.
For model arrays that are derived by sampling one or more independent variables, this property tracks the variable values associated with each model in the array. This information appears when you display or plot the model array. Use this information to trace results back to the independent variables.
Set the field names of the data structure to the names of the sampling variables. Set the field values to the sampled variable values associated with each model in the array. All sampling variables should be numeric and scalar valued, and all arrays of sampled values should match the dimensions of the model array.
For example, suppose you create a 11-by-1
array of linear models,
sysarr.SamplingGrid = struct('time',0:10)
Similarly, suppose you create a 6-by-9
[zeta,w] = ndgrid(<6 values of zeta>,<9 values of w>) M.SamplingGrid = struct('zeta',zeta,'w',w)
When you display
M(:,:,1,1) [zeta=0.3, w=5] = 25 -------------- s^2 + 3 s + 25 M(:,:,2,1) [zeta=0.35, w=5] = 25 ---------------- s^2 + 3.5 s + 25 ...
For model arrays generated by linearizing a Simulink model
at multiple parameter values or operating points, the software populates
This example shows how to create a low-pass filter with one tunable parameter a:
You cannot use
tunableTF to represent
F, because the numerator and denominator coefficients of a
tunableTF block are independent. Instead, construct
F using the tunable real parameter object
Create a tunable real parameter with an initial value of
a = realp('a',10);
tf to create thetunable filter
F = tf(a,[1 a]);
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 example, see Control System with Tunable Components.
This example shows how to create a state-space
model having both fixed and tunable parameters.
where a and b are tunable parameters, whose initial values are
Create the tunable parameters using
a = realp('a',-1); b = realp('b',3);
Define a generalized matrix using algebraic expressions of
A = [1 a+b;0 a*b];
A is a generalized matrix whose
Blocks property contains
b. The initial value of
[1 2;0 -3], from the initial values of
Create the fixed-value state-space matrices.
B = [-3.0;1.5]; C = [0.3 0]; D = 0;
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
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 the control system of the following illustration.
Suppose that the plant response is , and that the model of the sensor dynamics is . The controller is a tunable PID controller, and the prefilter 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 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
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: Parametric 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
ans = struct with fields: C: [1×1 tunablePID] a: [1×1 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.