A control systems design toolbox for Julia.
To install, in the Julia REPL:
using Pkg; Pkg.add("ControlSystems")
- Breaking:
Plots.jl
is no longer loaded byControlSystems.jl
. This improves loading times for the package, but means that users will have to runusing Plots
manually before plotting functions are available. - Deprecations: Functions
dare/dlyap/dkalman/dlqr
are now deprecated in favor of an interface that uses dispatch on the typesContinuous / Discrete
. Example:dare(A,B,Q,R)
is noware(Discrete,A,B,Q,R)
orare(sysd,Q,R)
.
- Time-domain simuations now return a result structure (non breaking)
- Breaking:
lsimplot, stepplot, impulseplot
have been replaced byplot(lsim())
etc. - Breaking:
pole, tzero
has been renamed to their plural form,poles, tzeros
. - Breaking:
c2d
now no longer returns thex0map
for statespace systems, see functionc2d_x0map
for the old behavior. - Breaking: The array layout of time and frequency responses has been transposed, i.e., in
y,t,x,u = lsim(sys, ...)
, the output arraysy,x,u
are now of shapesize(y) == (sys.ny, T)
. - New functions
observer_controller, observer_predictor, placePI
. - Breaking: The type
LQG
has been removed, see RobustAndOptimalControl.jl for its replacement. - Breaking:
balreal
andbaltrunc
return an additional value, the applied similarity transform. - A large set of bug fixes
- For a full list of changes, see here.
All functions have docstrings, which can be viewed from the REPL, using for example ?tf
.
A documentation website is available at http://juliacontrol.github.io/ControlSystems.jl/latest/.
Some of the available commands are:
ss, tf, zpk
poles, tzeros, norm, hinfnorm, linfnorm, ctrb, obsv, gangoffour, margin, markovparam, damp, dampreport, zpkdata, dcgain, covar, gram, sigma, sisomargin
are, lyap, lqr, place, leadlink, laglink, leadlinkat, rstd, rstc, dab, balreal, baltrunc
pid, stabregionPID, loopshapingPI, pidplots
step, impulse, lsim, freqresp, evalfr, bode, nyquist
lsimplot, stepplot, impulseplot, bodeplot, nyquistplot, sigmaplot, marginplot, gangoffourplot, pidplots, pzmap, nicholsplot, pidplots, rlocus, leadlinkcurve
minreal, sminreal, c2d
This toolbox works similar to that of other major computer-aided control systems design (CACSD) toolboxes. Systems can be created in either a transfer function or a state space representation. These systems can then be combined into larger architectures, simulated in both time and frequency domain, and analyzed for stability/performance properties.
Here we create a simple position controller for an electric motor with an inertial load.
using ControlSystems
# Motor parameters
J = 2.0
b = 0.04
K = 1.0
R = 0.08
L = 1e-4
# Create the model transfer function
s = tf("s")
P = K/(s*((J*s + b)*(L*s + R) + K^2))
# This generates the system
# TransferFunction:
# 1.0
# ---------------------------------
# 0.0002s^3 + 0.160004s^2 + 1.0032s
#
#Continuous-time transfer function model
# Create an array of closed loop systems for different values of Kp
CLs = TransferFunction[kp*P/(1 + kp*P) for kp = [1, 5, 15]];
# Plot the step response of the controllers
# Any keyword arguments supported in Plots.jl can be supplied
using Plots
plot(step.(CLs, 5), label=["Kp = 1" "Kp = 5" "Kp = 15"])
See the examples folder and ControlExamples.jl