control.flatsys.SystemTrajectory
- class control.flatsys.SystemTrajectory(sys, basis, coeffs=[], flaglen=[], params=None)[source]
Bases:
object
Trajectory for a differentially flat system.
The
SystemTrajectory
class is used to represent the trajectory of a (differentially flat) system. Used by thepoint_to_point
andsolve_flat_optimal
functions to return a trajectory.- Parameters
- sys
FlatSystem
Flat system object associated with this trajectory.
- basis
BasisFamily
Family of basis vectors to use to represent the trajectory.
- coeffslist of 1D arrays, optional
For each flat output, define the coefficients of the basis functions used to represent the trajectory. Defaults to an empty list.
- flaglenlist of int, optional
For each flat output, the number of derivatives of the flat output used to define the trajectory. Defaults to an empty list.
- paramsdict, optional
Parameter values used for the trajectory.
- sys
Methods
Compute state and input for a trajectory at a list of times.
Compute trajectory of a system as a TimeResponseData object.
- eval(tlist)[source]
Compute state and input for a trajectory at a list of times.
Evaluate the trajectory at a list of time points, returning the state and input vectors for the trajectory:
x, u = traj.eval(tlist)
- Parameters
- tlist1D array
List of times to evaluate the trajectory.
- Returns
- x2D array
For each state, the values of the state at the given times.
- u2D array
For each input, the values of the input at the given times.
- response(timepts, transpose=False, return_x=False, squeeze=None)[source]
Compute trajectory of a system as a TimeResponseData object.
Evaluate the trajectory at a list of time points, returning the state and input vectors for the trajectory:
response = traj.response(timepts) time, yd, ud = response.time, response.outputs, response.inputs
- Parameters
- timepts1D array
List of times to evaluate the trajectory.
- transposebool, optional
If True, transpose all input and output arrays (for backward compatibility with MATLAB and
scipy.signal.lsim
). Default value is False.- return_xbool, optional
If True, return the state vector when assigning to a tuple (default = False). See
forced_response
for more details.- squeezebool, optional
By default, if a system is single-input, single-output (SISO) then the output response is returned as a 1D array (indexed by time). If
squeeze
= True, remove single-dimensional entries from the shape of the output even if the system is not SISO. Ifsqueeze
= False, keep the output as a 3D array (indexed by the output, input, and time) even if the system is SISO. The default value can be set usingconfig.defaults['control.squeeze_time_response']
.
- Returns
- response
TimeResponseData
Time response data object representing the input/output response. When accessed as a tuple, returns
(time, outputs)
or(time, outputs, states
ifreturn_x
is True. If the input/output system signals are named, these names will be used as labels for the time response. Ifsys
is a list of systems, returns aTimeResponseList
object. Results can be plotted using theplot
method. SeeTimeResponseData
for more detailed information.- response.timearray
Time values of the output.
- response.outputsarray
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 orsqueeze
is False, the array is 2D (indexed by output and time).- response.statesarray
Time evolution of the state vector, represented as a 2D array indexed by state and time.
- response.inputsarray
Input(s) to the system, indexed by input and time.
- response