control.LTI
- class control.LTI(inputs=1, outputs=1, states=None, name=None, **kwargs)[source]
Bases:
InputOutputSystem
LTI is a parent class to linear time-invariant (LTI) system objects.
LTI is the parent to the StateSpace and TransferFunction child classes. It contains the number of inputs and outputs, and the timebase (dt) for the system. This function is not generally called directly by the user.
When two LTI systems are combined, their timebases much match. A system with timebase None can be combined with a system having a specified timebase, and the result will have the timebase of the latter system.
Note: dt processing has been moved to the InputOutputSystem class.
Methods
Evaluate the bandwidth of the LTI system for a given dB drop.
Make a copy of an input/output system
Natural frequency, damping ratio of system poles
Return the zero-frequency gain
Find the index for an input given its name (None if not found)
Return list of indices matching input spec (None if not found)
Find the index for an output given its name (None if not found)
Return list of indices matching output spec (None if not found)
Find the index for a state given its name (None if not found)
Return list of indices matching state spec (None if not found)
Evaluate the linear time-invariant system at an array of angular frequencies.
Check to see if a system is a continuous-time system.
Check to see if a system is a discrete-time system
ispassive
Check to see if a system is single input, single output.
Set the number/names of the system inputs.
Set the number/names of the system outputs.
Set the number/names of the system states.
Update signal and system names for an I/O system.
- bandwidth(dbdrop=-3)[source]
Evaluate the bandwidth of the LTI system for a given dB drop.
Evaluate the first frequency that the response magnitude is lower than DC gain by dbdrop dB.
- Parameters
dpdrop (float, optional) – A strictly negative scalar in dB (default = -3) defines the amount of gain drop for deciding bandwidth.
- Returns
bandwidth – The first frequency (rad/time-unit) where the gain drops below dbdrop of the dc gain of the system, or nan if the system has infinite dc gain, inf if the gain does not drop for all frequency
- Return type
ndarray
- Raises
TypeError – if ‘sys’ is not an SISO LTI instance
ValueError – if ‘dbdrop’ is not a negative scalar
- copy(name=None, use_prefix_suffix=True)[source]
Make a copy of an input/output system
A copy of the system is made, with a new name. The name keyword can be used to specify a specific name for the system. If no name is given and use_prefix_suffix is True, the name is constructed by prepending config.defaults[‘iosys.duplicate_system_name_prefix’] and appending config.defaults[‘iosys.duplicate_system_name_suffix’]. Otherwise, a generic system name of the form sys[<id>] is used, where <id> is based on an internal counter.
- damp()[source]
Natural frequency, damping ratio of system poles
- Returns
wn (array) – Natural frequency for each system pole
zeta (array) – Damping ratio for each system pole
poles (array) – System pole locations
- frequency_response(omega=None, squeeze=None)[source]
Evaluate the linear time-invariant system at an array of angular frequencies.
For continuous time systems, computes the frequency response as
G(j*omega) = mag * exp(j*phase)
For discrete time systems, the response is evaluated around the unit circle such that
G(exp(j*omega*dt)) = mag * exp(j*phase).
In general the system may be multiple input, multiple output (MIMO), where m = self.ninputs number of inputs and p = self.noutputs number of outputs.
- Parameters
omega (float or 1D array_like) – A list, tuple, array, or scalar value of frequencies in radians/sec at which the system will be evaluated.
squeeze (bool, optional) – If squeeze=True, remove single-dimensional entries from the shape of the output even if the system is not SISO. If squeeze=False, keep all indices (output, input and, if omega is array_like, frequency) even if the system is SISO. The default value can be set using config.defaults[‘control.squeeze_frequency_response’].
- Returns
response – Frequency response data object representing the frequency response. This object can be assigned to a tuple using
mag, phase, omega = response
where
mag
is the magnitude (absolute value, not dB or log10) of the system frequency response,phase
is the wrapped phase in radians of the system frequency response, andomega
is the (sorted) frequencies at which the response was evaluated. If the system is SISO and squeeze is not True,magnitude
andphase
are 1D, indexed by frequency. If the system is not SISO or squeeze is False, the array is 3D, indexed by the output, input, and, if omega is array_like, frequency. Ifsqueeze
is True then single-dimensional axes are removed.- Return type
- isctime(strict=False)[source]
Check to see if a system is a continuous-time system.
- Parameters
sys (Named I/O system) – System to be checked
strict (bool, optional) – If strict is True, make sure that timebase is not None. Default is False.
- isdtime(strict=False)[source]
Check to see if a system is a discrete-time system
- Parameters
strict (bool, optional) – If strict is True, make sure that timebase is not None. Default is False.
- ninputs
Number of system inputs.
- noutputs
Number of system outputs.
- nstates
Number of system states.
- set_inputs(inputs, prefix='u')[source]
Set the number/names of the system inputs.
- Parameters
inputs (int, list of str, or None) – Description of the system inputs. This can be given as an integer count or as a list of strings that name the individual signals. If an integer count is specified, the names of the signal will be of the form u[i] (where the prefix u can be changed using the optional prefix parameter).
prefix (string, optional) – If inputs is an integer, create the names of the states using the given prefix (default = ‘u’). The names of the input will be of the form prefix[i].
- set_outputs(outputs, prefix='y')[source]
Set the number/names of the system outputs.
- Parameters
outputs (int, list of str, or None) – Description of the system outputs. This can be given as an integer count or as a list of strings that name the individual signals. If an integer count is specified, the names of the signal will be of the form u[i] (where the prefix u can be changed using the optional prefix parameter).
prefix (string, optional) – If outputs is an integer, create the names of the states using the given prefix (default = ‘y’). The names of the input will be of the form prefix[i].
- set_states(states, prefix='x')[source]
Set the number/names of the system states.
- Parameters
states (int, list of str, or None) – Description of the system states. This can be given as an integer count or as a list of strings that name the individual signals. If an integer count is specified, the names of the signal will be of the form u[i] (where the prefix u can be changed using the optional prefix parameter).
prefix (string, optional) – If states is an integer, create the names of the states using the given prefix (default = ‘x’). The names of the input will be of the form prefix[i].
- update_names([name, inputs, outputs, states])[source]
Update signal and system names for an I/O system.
- Parameters
name (str, optional) – New system name.
inputs (list of str, int, or None, optional) – List of strings that name the individual input signals. If given as an integer or None, signal names default to the form u[i]. See
InputOutputSystem
for more information.outputs (list of str, int, or None, optional) – Description of output signals; defaults to y[i].
states (int, list of str, int, or None, optional) – Description of system states; defaults to x[i].