control.model_reduction

control.model_reduction(sys, elim_states=None, method='matchdc', elim_inputs=None, elim_outputs=None, keep_states=None, keep_inputs=None, keep_outputs=None, warn_unstable=True)[source]

Model reduction by input, output, or state elimination.

This function produces a reduced-order model of a system by eliminating specified inputs, outputs, and/or states from the original system. The specific states, inputs, or outputs that are eliminated can be specified by either listing the states, inputs, or outputs to be eliminated or those to be kept.

Two methods of state reduction are possible: ‘truncate’ removes the states marked for elimination, while ‘matchdc’ replaces the eliminated states with their equilibrium values (thereby keeping the input/output gain unchanged at zero frequency [“DC”]).

Parameters
sysStateSpace

Original system to reduce.

elim_inputs, elim_outputs, elim_statesarray of int or str, optional

Vector of inputs, outputs, or states to eliminate. Can be specified either as an offset into the appropriate vector or as a signal name.

keep_inputs, keep_outputs, keep_statesarray, optional

Vector of inputs, outputs, or states to keep. Can be specified either as an offset into the appropriate vector or as a signal name.

methodstring

Method of removing states: either ‘truncate’ or ‘matchdc’ (default).

warn_unstablebool, option

If False, don’t warn if system is unstable.

Returns
rsysStateSpace

Reduced order model.

Raises
ValueError

If method is not either ‘matchdc’ or ‘truncate’.

NotImplementedError

If the ‘matchdc’ method is used for a discrete-time system.

Warns
UserWarning

If eigenvalues of sys.A are not all stable.

Notes

The model_reduction function issues a warning if the system has unstable eigenvalues, since in those situations the stability of the reduced order model may be different than the stability of the full model. No other checking is done, so users must to be careful not to render a system unobservable or unreachable.

States, inputs, and outputs can be specified using integer offsets or using signal names. Slices can also be specified, but must use the Python slice function.

Examples

>>> G = ct.rss(4)
>>> Gr = ct.model_reduction(G, [0, 2], method='matchdc')
>>> Gr.nstates
2