Compute the output response of a system to a given input.
Simulate a dynamical system with a given input and return its output and state values.
NonlinearIOSystem
or list of NonlinearIOSystem
I/O system(s) for which input/output response is simulated.
Time steps at which the input is defined; values must be evenly spaced.
Input array giving input at each time in timepts
(default = 0). If a list is specified, each element in the list will be treated as a portion of the input and broadcast (if necessary) to match the time vector.
Initial condition (default = 0). If a list is given, each element in the list will be flattened and stacked into the initial condition. If a smaller number of elements are given that the number of states in the system, the initial condition will be padded with zeros.
List of times at which the time response should be computed. Defaults to timepts
.
If True, return the state vector when assigning to a tuple. See forced_response
for more details. If True, return the values of the state at each time Default is False.
Parameter values for the system. Passed to the evaluation functions for the system as default values, overriding internal defaults.
If True and if the system has a single output, return the system output as a 1D array rather than a 2D array. If False, return the system output as a 2D array even if the system is SISO. Default value set by config.defaults['control.squeeze_time_response']
.
TimeResponseData
Time response data object representing the input/output response. When accessed as a tuple, returns (time, outputs)
or (time, outputs, states
if return_x
is True. If the input/output system signals are named, these names will be used as labels for the time response. If sys
is a list of systems, returns a TimeResponseList
object. Results can be plotted using the plot
method. See TimeResponseData
for more detailed information.
Time values of the output.
Response of the system. If the system is SISO and squeeze
is not True, the array is 1D (indexed by time). If the system is not SISO or squeeze
is False, the array is 2D (indexed by output and time).
Time evolution of the state vector, represented as a 2D array indexed by state and time.
Input(s) to the system, indexed by input and time.
Parameters values used for the simulation.
If False (default), errors during computation of the trajectory will raise a RuntimeError
exception. If True, do not raise an exception and instead set response.success
to False and place an error message in response.message
.
Set the method used by scipy.integrate.solve_ivp
. Defaults to ‘RK45’.
Pass additional keywords to scipy.integrate.solve_ivp
.
If True, transpose all input and output arrays (for backward compatibility with MATLAB and scipy.signal.lsim
).
If the system is not an input/output system.
If time step does not match sampling time (for discrete-time systems).
Notes
If a smaller number of initial conditions are given than the number of states in the system, the initial conditions will be padded with zeros. This is often useful for interconnected control systems where the process dynamics are the first system and all other components start with zero initial condition since this can be specified as [xsys_0, 0]. A warning is issued if the initial conditions are padded and and the final listed initial state is not zero.
If discontinuous inputs are given, the underlying SciPy numerical integration algorithms can sometimes produce erroneous results due to the default tolerances that are used. The solve_ivp_method
and solve_ivp_keywords
parameters can be used to tune the ODE solver and produce better results. In particular, using ‘LSODA’ as the solve_ivp_method
, setting the rtol
parameter to a smaller value (e.g. using solve_ivp_kwargs={'rtol': 1e-4}
), or setting the maximum step size to a smaller value (e.g. solve_ivp_kwargs= {'max_step': 0.01}
) can provide more accurate results.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4