Function Reference
The Python Control Systems Library (python-control) provides common functions for analyzing and designing feedback control systems.
The initial goal for the package is to implement all of the functionality required to work through the examples in the textbook Feedback Systems by Astrom and Murray. In addition to standard techniques available for linear control systems, support for nonlinear systems (including trajectory generation, gain scheduling, phase plane diagrams, and describing functions) is included. A MATLAB Compatibility Module is available that provides many of the common functions corresponding to commands available in the MATLAB Control Systems Toolbox.
Documentation is available in two forms: docstrings provided with the code, and the python-control User Guide, available from the python-control homepage.
The docstring examples assume the following import commands:
>>> import numpy as np
>>> import control as ct
Available subpackages
The main control package includes the most common functions used in analysis, design, and simulation of feedback control systems. Several additional subpackages and modules are available that provide more specialized functionality:
flatsys
: Differentially flat systemsmatlab
: MATLAB compatibility moduleoptimal
: Optimization-based controlphaseplot
: 2D phase plane diagrams
These subpackages and modules are described in more detail in the subpackage and module docstrings and in the User Guide.
System Creation
Functions that create input/output systems from a description of the system properties:
|
Create a state space system. |
|
Create a transfer function system. |
|
Construct a frequency response data (FRD) model. |
|
Create a nonlinear input/output system. |
|
Create a transfer function from zeros, poles, gain. |
|
Create a linear system that approximates a delay. |
|
Create a stable random state space object. |
|
Create a stable, discrete-time, random state space system. |
Functions that transform systems from one form to another:
|
Convert a system into canonical form. |
|
Convert a system into modal canonical form. |
|
Convert a system into observable canonical form. |
|
Convert a system into reachable canonical form. |
|
Convert a continuous-time system to discrete time by sampling. |
|
Similarity transformation, with optional time rescaling. |
|
Transform a state space system to a transfer function. |
|
Transform a transfer function to a state space system. |
|
Return transfer function data objects for a system. |
System Interconnections
|
Series connection of I/O systems. |
|
Parallel connection of I/O systems. |
|
Return the negative of a system. |
|
Feedback interconnection between two I/O systems. |
|
Interconnect a set of input/output systems. |
|
Group LTI models by appending their inputs and outputs. |
|
Combine array of transfer functions into MIMO transfer function. |
|
Split MIMO transfer function into SISO transfer functions. |
|
Create a summing junction as an input/output system. |
|
Print table of connections inside interconnected system. |
|
Combine array of transfer functions into MIMO transfer function. |
|
Split MIMO transfer function into SISO transfer functions. |
Time Response
|
Compute the output of a linear system given the input. |
|
Compute the impulse response for a linear system. |
|
Compute the initial condition response for a linear system. |
|
Compute the output response of a system to a given input. |
|
Compute the step response for a linear system. |
|
Plot the time response of an input/output system. |
|
Combine individual time responses into multi-trace response. |
Phase plane plots
Generate 2D phase portraits.
This module contains functions for generating 2D phase plots. The base
function for creating phase plane portraits is phase_plane_plot
,
which generates a phase plane portrait for a 2 state I/O system (with no
inputs). Utility functions are available to customize the individual
elements of a phase plane portrait.
The docstring examples assume the following import commands:
>>> import numpy as np
>>> import control as ct
>>> import control.phaseplot as pp
|
Plot phase plane diagram. |
|
Generate list of points along the edge of box. |
|
Generate list of points around a circle. |
|
Plot equilibrium points in the phase plane. |
|
Generate list of points forming a mesh. |
|
Plot separatrices in the phase plane. |
|
Plot stream lines in the phase plane. |
|
Plot a vector field in the phase plane. |
|
Plot streamlines in the phase plane. |
Frequency Response
|
Bode plot for a system. |
|
Nyquist plot with describing function for a nonlinear system. |
|
Compute the describing function response of a system. |
|
Frequency response of an LTI system. |
|
Nyquist response for a system. |
|
Nyquist plot for a system. |
|
Compute response of "Gang of 4" transfer functions. |
|
Plot response of "Gang of 4" transfer functions. |
|
Nichols plot for a system. |
|
Plot Nichols chart grid. |
Control System Analysis
Time domain analysis:
|
Compute system's natural frequencies, damping ratios, and poles. |
|
Step response characteristics (rise time, settling time, etc). |
Frequency domain analysis:
|
Find first frequency where gain drops by 3 dB. |
|
Return the zero-frequency (or DC) gain of the given system. |
|
L-infinity norm of a linear system. |
|
Gain and phase margins and associated crossover frequencies. |
|
Stability margins and associated crossover frequencies. |
|
Computes the input/output norm of system. |
Compute Nyquist plot real-axis crossover frequencies and gains. |
|
|
Plot the singular values for a system. |
|
Singular value response for a system. |
|
Collection of plots inspired by MATLAB's sisotool. |
Pole/zero-based analysis:
|
Compute system poles. |
|
Compute system zeros. |
|
Compute the pole/zero map for an LTI system. |
|
Plot a pole/zero map for a linear system. |
|
Create axes for pole/zero plot. |
|
Compute the root locus map for an LTI system. |
|
Root locus plot. |
Passive systems analysis:
|
Input feedforward passivity (IFP) index for a system. |
|
Return the output feedback passivity (OFP) index for the system. |
|
Indicate if a linear time invariant (LTI) system is passive. |
|
Compute passivity indices and/or solves feasibility via a LMI. |
Control System Synthesis
State space synthesis:
|
Create an I/O system using a (full) state feedback controller. |
|
Discrete-time linear quadratic regulator design. |
|
Linear quadratic regulator design. |
|
Place closed loop eigenvalues. |
|
Pole placement using Ackermann method. |
|
Place closed loop eigenvalues using Varga method. |
Frequency domain synthesis:
|
H2 control synthesis for plant P. |
|
H-infinity control synthesis for plant P. |
|
Mixed-sensitivity H-infinity synthesis. |
|
Manual PID controller design based on root locus using Sisotool. |
System ID and Model Reduction
|
Eliminate uncontrollable or unobservable states. |
|
Balanced reduced order model of system of a given order. |
Calculate the Hankel singular values. |
|
|
Model reduction by input, output, or state elimination. |
|
Calculate ERA model based on impulse-response data. |
|
Calculate Markov parameters [D CB CAB ...] from data. |
Nonlinear System Support
|
Find an operating point for an input/output system. |
|
Linearize an input/output system at a given state and input. |
Describing functions
|
Numerically compute describing function of a nonlinear function. |
Backlash nonlinearity for describing function analysis. |
|
Relay w/ hysteresis for describing function analysis. |
|
|
Saturation nonlinearity for describing function analysis. |
Differentially flat systems
Flat systems subpackage.
This subpackage contains a set of classes and functions to compute trajectories for differentially flat systems.
A differentially flat system is defined by creating an object using the
FlatSystem
class, which has member functions for mapping the
system state and input into and out of flat coordinates. The
point_to_point
function can be used to create a trajectory
between two endpoints, written in terms of a set of basis functions defined
using the BasisFamily
class. The resulting trajectory is return
as a SystemTrajectory
object and can be evaluated using the
SystemTrajectory.eval
member function. Alternatively, the
solve_flat_optimal
function can be used to solve an optimal control
problem with trajectory and final costs or constraints.
The docstring examples assume that the following import commands:
>>> import numpy as np
>>> import control as ct
>>> import control.flatsys as fs
|
Create a differentially flat I/O system. |
|
Compute trajectory between an initial and final conditions. |
|
Compute trajectory between an initial and final conditions. |
Optimal control
Optimization-based control module.
This module provides support for optimization-based controllers for
nonlinear systems with state and input constraints. An optimal
control problem can be solved using the solve_optimal_trajectory
function or set up using the OptimalControlProblem
class and then
solved using the compute_trajectory
method.
Utility functions are available to define common cost functions and
input/state constraints. Optimal estimation problems can be solved
using the solve_optimal_estimate
function or by using the
OptimalEstimationProblem
class and the
compute_estimate
method..
The docstring examples assume the following import commands:
>>> import numpy as np
>>> import control as ct
>>> import control.optimal as opt
|
Create a model predictive I/O control system. |
|
Create constraint for bounded disturbances. |
|
Create cost function for Gaussian likelihoods. |
|
Create input constraint from polytope. |
|
Create input constraint from polytope. |
|
Create output constraint from polytope. |
|
Create output constraint from range. |
|
Create quadratic cost function. |
|
Compute the solution to an optimal control problem. |
|
Compute the solution to a finite horizon estimation problem. |
|
Create state constraint from polytope. |
|
Create state constraint from range. |
Stochastic System Support
|
Compute the correlation of time signals. |
|
Create an I/O system implementing a linear quadratic estimator. |
|
Discrete-time linear quadratic estimator (Kalman filter). |
|
Continuous-time linear quadratic estimator (Kalman filter). |
|
Generate a white noise signal with specified intensity. |
Matrix Computations
|
Solves the continuous-time algebraic Riccati equation. |
|
Controllability matrix. |
|
Solves the discrete-time algebraic Riccati equation. |
|
Solves the discrete-time Lyapunov equation. |
|
Solves the continuous-time Lyapunov equation. |
|
Observability matrix. |
|
Gramian (controllability or observability). |
Utility Functions
|
Augment plant for mixed sensitivity problem. |
|
Block-diagonal Schur decomposition. |
|
Convert a gain in decibels (dB) to a magnitude. |
|
Check to see if a system is a continuous-time system. |
|
Check to see if a system is a discrete-time system. |
|
Return representation of an I/O system. |
|
Check to see if a system is single input, single output. |
|
Convert a magnitude to decibels (dB). |
Reset configuration values to their default (initial) values. |
|
Reset rcParams to default values for control plots. |
|
|
Set default values of parameters for a module. |
|
Return state space data objects for a system. |
|
Return the timebase for a system. |
|
Unwrap a phase angle to give a continuous curve. |
Use Feedback Systems (FBS) compatible settings. |
|
|
Sets the defaults to whatever they were in a given release. |
Use MATLAB compatible configuration settings. |