Main Content

tunableSS

Tunable fixed-order state-space model

Syntax

blk = tunableSS(name,Nx,Ny,Nu)
blk = tunableSS(name,Nx,Ny,Nu,Ts)
blk = tunableSS(name,sys)
blk = tunableSS(...,Astruct)

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 part of the Control Design Block family of parametric models. Other Control Design Blocks include tunablePID, tunableGain, and tunableTF.

Construction

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.

blk = tunableSS(...,Astruct) creates a parametric state-space model whose A matrix is restricted to the structure specified in Astruct.

Input Arguments

name

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

Nx

Nonnegative integer specifying the number of states (order) of the parametric state-space model blk.

Ny

Nonnegative integer specifying the number of outputs of the parametric state-space model blk.

Nu

Nonnegative integer specifying the number of inputs of the parametric state-space model blk.

Ts

Scalar sample time.

Astruct

Constraints on the form of the A matrix of the parametric state-space model blk, specified as one of the following values:

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.

If you do not specify Astruct, blk defaults to 'tridiag' form.

sys

Dynamic system model providing number of states, number of inputs and outputs, sample time, and initial values of the parameters of blk. 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

A, B, C, D

Parametrization of the state-space matrices A, B, C, and D of the tunable state-space model blk.

blk.A, blk.B, blk.C, and blk.D are param.Continuous objects. For general information about the properties of these param.Continuous objects, see the param.Continuous (Simulink Design Optimization) object reference page.

The following 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

StateName

State names, specified as one of the following:

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

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

  • '' — For unnamed states.

Default: '' for all states

StateUnit

State units, specified as one of the following:

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

Default: '' for all states

Ts

Sample time. 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.

Default: 0 (continuous time)

TimeUnit

Units for the time variable, the sample time Ts, and any time delays in the model, specified as one of the following 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.

Default: 'seconds'

InputName

Input channel names, specified as one of the following:

  • 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

Default: '' for all input channels

InputUnit

Input channel units, specified as one of the following:

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

Default: '' for all input channels

InputGroup

Input channel groups. The InputGroup property lets you assign the input channels of MIMO systems into groups and refer to each group by name. Specify input groups as a structure. 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')

Default: Struct with no fields

OutputName

Output channel names, specified as one of the following:

  • 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

Default: '' for all output channels

OutputUnit

Output channel units, specified as one of the following:

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

Default: '' for all output channels

OutputGroup

Output channel groups. The OutputGroup property lets you assign the output channels of MIMO systems into groups and refer to each group by name. Specify output groups as a structure. 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',:)

Default: Struct with no fields

Name

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

Default: ''

Notes

Any text that you want 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.'

Default: [0×1 string]

UserData

Any type of data you want to associate with system, specified as any MATLAB® data type.

Default: []

Examples

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
blk.InputName = {'Xerror','Yerror'} % assign input names

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