Main Content

tunableSS

Tunable fixed-order state-space model

Description

Model object for creating tunable fixed-order state-space models.

tunableSS lets you parametrize a state-space model of a given order for parameter studies or for automatic tuning with tuning commands such as systune or looptune.

tunableSS is a part of the Control Design Block family of parametric models. Other Control Design Blocks include tunablePID, tunableGain, and tunableTF.

Creation

Description

example

blk = tunableSS(name,Nx,Ny,Nu) creates the continuous-time parametric state-space model named name. The state-space model blk has Nx states,Ny outputs, and Nu inputs. The tunable parameters are the entries in the A, B, C, and D matrices of the state-space model.

blk = tunableSS(name,Nx,Ny,Nu,Ts) creates a discrete-time parametric state-space model with sample time Ts.

blk = tunableSS(name,sys) uses the dynamic system sys to dimension the parametric state-space model, set its sample time, and initialize the tunable parameters.

example

blk = tunableSS(___,Astruct) creates a parametric state-space model whose A matrix is restricted to the structure specified in Astruct. Use this syntax with any of the previous syntaxes.

Input Arguments

expand all

Parametric state-space model Name, specified as a character vector such as 'C0'. See Properties.

Number of outputs of parametric state-space model blk, specified as a nonnegative integer.

Number of outputs of the parametric state-space model blk, specified as a nonnegative integer.

Sample time, specified as a scalar.

Constraints on the form of the A matrix of the parametric state-space model blk, specified as 'tridiag', 'full', or 'companion'.

Value for AstructStructure of A matrix
'tridiag'A is tridiagonal. In tridiagonal form, A has free elements only in the main diagonal, the first diagonal below the main diagonal, and the first diagonal above the main diagonal. The remaining elements of A are fixed to zero.
'full'A is full (every entry in A is a free parameter).
'companion'A is in companion form. In companion form, the characteristic polynomial of the system appears explicitly in the rightmost column of the A matrix. See canon for more information.

Dynamic system model providing number of states, number of inputs and outputs, sample time, and initial values of the parameters of blk, specified as a dynamic system model object. To obtain the dimensions and initial parameter values, tunableSS converts sys to a state-space model with the structure specified in Astruct. If you omit Astruct, tunableSS converts sys into tridiagonal state-space form.

Properties

expand all

Parametrization of the state-space matrices A, B, C, and D of the tunable state-space model blk, stored as param.Continuous objects. For general information about the properties of these param.Continuous objects, see param.Continuous (Simulink Design Optimization).

These fields of blk.A, blk.B, blk.C, and blk.D are used when you tune blk using hinfstruct.

FieldDescription
Value

Current values of the entries in the parametrized state-space matrix. For example, blk.A.Value contains the values of the A matrix of blk.

hinfstruct (Robust Control Toolbox) tunes all entries in blk.A.Value, blk.B.Value, blk.C.Value, and blk.D.Value except those whose values are fixed by blk.Gain.Free.

Free

2-D array of logical values determining whether the corresponding state-space matrix parameters are fixed or free parameters. For example:

  • If blk.A.Free(i,j) = 1, then blk.A.Value(i,j) is a tunable parameter.

  • If blk.A.Free(i,j) = 0, then blk.A.Value(i,j) is fixed.

Defaults: By default, all entries in B, C, and D are tunable. The default free entries in A depend upon the value of Astruct:

  • 'tridiag' — entries on the three diagonals of blk.A.Free are 1; the rest are 0.

  • 'full' — all entries in blk.A.Free are 0.

  • 'companion'blk.A.Free(1,:) = 1 and blk.A.Free(j,j-1) = 1; all other entries are 0.

Minimum

Minimum value of the parameter. This property places a lower bound on the tuned value of the parameter. For example, setting blk.A.Minimum(1,1) = 0 ensures that the first entry in the A matrix remains positive.

Default: -Inf

Maximum

Maximum value of the parameter. This property places an upper bound on the tuned value of the parameter. For example, setting blk.A.Maximum(1,1) = 0 ensures that the first entry in the A matrix remains negative.

Default: Inf

State names, stored as one of these values:

  • Character vector — For first-order models, for example, 'velocity'.

  • Cell array of character vectors — For models with two or more states

  • '' — For unnamed states.

State units, stored as one of these values:

  • Character vector — For first-order models, for example, 'velocity'

  • Cell array of character vectors — For models with two or more states

  • '' — For states without specified units

    Use StateUnit to keep track of the units each state is expressed in. StateUnit has no effect on system behavior.

Sample time, stored as a scalar. For continuous-time models, Ts = 0. For discrete-time models, Ts is a positive scalar representing the sampling period. This value is expressed in the unit specified by the TimeUnit property of the model. To denote a discrete-time model with unspecified sample time, set Ts = -1.

Changing this property does not discretize or resample the model.

Units for the time variable, the sample time Ts, and any time delays in the model, stored as one of these values:

  • 'nanoseconds'

  • 'microseconds'

  • 'milliseconds'

  • 'seconds'

  • 'minutes'

  • 'hours'

  • 'days'

  • 'weeks'

  • 'months'

  • 'years'

Changing this property has no effect on other properties, and therefore changes the overall system behavior. Use chgTimeUnit to convert between time units without modifying system behavior.

Input channel names, stored as a character vector or a cell array of character vector.

  • Character vector — For single-input models, for example, 'controls'.

  • Cell array of character vectors — For multi-input models.

Alternatively, use automatic vector expansion to assign input names for multi-input models. For example, if sys is a two-input model, enter:

sys.InputName = 'controls';

The input names automatically expand to {'controls(1)';'controls(2)'}.

You can use the shorthand notation u to refer to the InputName property. For example, sys.u is equivalent to sys.InputName.

Input channel names have several uses, including:

  • Identifying channels on model display and plots

  • Extracting subsystems of MIMO systems

  • Specifying connection points when interconnecting models

Input channel units, stored as a character vector or a cell array of character vector.

  • Character vector — For single-input models, for example, 'seconds'.

  • Cell array of character vectors — For multi-input models.

Use InputUnit to keep track of input signal units. InputUnit has no effect on system behavior.

Input channel groups, stored as a structure. The InputGroup property lets you assign the input channels of MIMO systems into groups and refer to each group by name. In this structure, field names are the group names, and field values are the input channels belonging to each group. For example,

sys.InputGroup.controls = [1 2];
sys.InputGroup.noise = [3 5];

creates input groups named controls and noise that include input channels 1, 2 and 3, 5, respectively. You can then extract the subsystem from the controls inputs to all outputs using:

sys(:,'controls')

Output channel names, stored as a character vector or a cell array of character vector.

  • Character vector — For single-output models. For example, 'measurements'.

  • Cell array of character vectors — For multi-output models.

Alternatively, use automatic vector expansion to assign output names for multi-output models. For example, if sys is a two-output model, enter:

sys.OutputName = 'measurements';

The output names automatically expand to {'measurements(1)';'measurements(2)'}.

You can use the shorthand notation y to refer to the OutputName property. For example, sys.y is equivalent to sys.OutputName.

Output channel names have several uses, including:

  • Identifying channels on model display and plots

  • Extracting subsystems of MIMO systems

  • Specifying connection points when interconnecting models

Output channel units, stored as a character vector or a cell array of character vector.

  • Character vector — For single-output models. For example, 'seconds'.

  • Cell array of character vectors — For multi-output models.

Use OutputUnit to keep track of output signal units. OutputUnit has no effect on system behavior.

Output channel groups, stored as a structure. The OutputGroup property lets you assign the output channels of MIMO systems into groups and refer to each group by name. In this structure, field names are the group names, and field values are the output channels belonging to each group. For example,

sys.OutputGroup.temperature = [1];
sys.OutputGroup.measurement = [3 5];

creates output groups named temperature and measurement that include output channels 1, and 3, 5, respectively. You can then extract the subsystem from all inputs to the measurement outputs using:

sys('measurement',:)

System name, stored as a character vector. For example, 'system_1'.

Text to associate with the system, stored as a string or a cell array of character vectors. The property stores whichever data type you provide. For instance, if sys1 and sys2 are dynamic system models, you can set their Notes properties as follows:

sys1.Notes = "sys1 has a string.";
sys2.Notes = 'sys2 has a character vector.';
sys1.Notes
sys2.Notes
ans = 

    "sys1 has a string."


ans =

    'sys2 has a character vector.'

Data type to associate with the system, specified as any MATLAB data type.

Object Functions

systuneTune fixed-structure control systems modeled in MATLAB
looptuneTune fixed-structure feedback loops
genssGeneralized state-space model
hinfstruct (Robust Control Toolbox)H tuning of fixed-structure controllers

Examples

collapse all

Create a parametrized 5th-order SISO model with zero D matrix.

 blk = tunableSS('ssblock',5,1,1);
 blk.D.Value = 0;      % set D = 0
 blk.D.Free = false;   % fix D to zero

By default, the A matrix is in tridiagonal form. To parametrize the model in companion form, use the 'companion' input argument.

 blk = tunableSS('ssblock',5,1,1,'companion');
 blk.D.Value = 0;      % set D = 0
 blk.D.Free = false;   % fix D to zero

Create a parametric state-space model, and assign names to the inputs.

blk = tunableSS('ssblock',5,2,2) % 5 states, 2 outputs, 2 inputs
Tunable continuous-time state-space model "ssblock".
This model has 2 outputs, 2 inputs, 5 states, and 37 tunable parameters.

Type "ss(blk)" to see the current value.
blk.InputName = {'Xerror','Yerror'} % assign input names
Tunable continuous-time state-space model "ssblock".
This model has 2 outputs, 2 inputs, 5 states, and 37 tunable parameters.

Type "ss(blk)" to see the current value.

Tips

  • Use the Astruct input argument to constrain the structure of the A matrix of the parametric state-space model. To impose additional structure constrains on the state-space matrices, use the fields blk.A.Free, blk.B.Free, blk.C.Free, and blk.D.Free to fix the values of specific entries in the parameter matrices.

    For example, to fix the value of blk.B(i,j), set blk.B.Free(i,j) = 0. To allow hinfstruct (Robust Control Toolbox) to tune blk.B(i,j), set blk.B.Free(i,j) = 1.

  • To convert a tunableSS parametric model to a numeric (non-tunable) model object, use model commands such as ss, tf, or zpk.

Version History

Introduced in R2016a

expand all