You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Go control-system toolbox for modeling, analyzing, transforming, and designing continuous-time and discrete-time linear time-invariant models.
The state-space model is the fundamental representation. Transfer-function, zero-pole-gain, frequency-response data, model-array, generalized-model, and tunable-block workflows convert to or build on that core representation where needed.
Install
go get plantcontrol.org/v2/controlsys/v2
Formerly github.com/jamestjsp/controlsys (releases up to v1.8.0). From v1.9.0 the module path is plantcontrol.org/v1/controlsys; for v2.0.0–v2.2.0 it is plantcontrol.org/v1/controlsys/v2; from v2.3.0 it is plantcontrol.org/v2/controlsys/v2.
Linear algebra uses plantcontrol.org/v1/gonum, PlantControl's Gonum fork with additional LAPACK routines. It is an ordinary module dependency; no replace directive is needed.
Production Readiness
This package is intended to be usable in production control and estimation code, with the usual caveat that numerical software still needs application-specific validation.
Pin controlsys and plantcontrol.org/v1/gonum to explicit versions.
Validate mission-critical models against an external reference, especially for ill-conditioned realizations and delay-heavy systems.
System values are mutable. Use Copy before sharing a model across goroutines that may mutate names, delays, notes, or other receiver state. Use Validate after direct field edits.
The repository CI runs go fix ./..., go vet ./..., go test -v -count=1 -race ./..., and a downstream consumer import check; those are the recommended baseline checks for downstream integrations.
Features
Model interfaces: state-space, transfer function, zero-pole-gain (ZPK), frequency-response data (FRD), model arrays, generalized models, and tunable blocks
Frequency response: Bode, Nyquist, Nichols, singular values
Stability and response analysis: gain/phase margins, disk margins, bandwidth, damping, root locus, passivity, step-response metrics
Control design: LQR, LQE (Kalman), LQI, LQG, H2 synthesis, H-infinity synthesis, pole placement, Ackermann placement, Riccati solvers (CARE/DARE)
PID and fixed-structure tuning: PID/PID2 controller models, standard/parallel forms, Pidtune, tunable blocks, generalized closed-loop models, tuning goals, Systune, and Looptune
State estimation: Extended Kalman Filter (EKF) for nonlinear systems
System identification: Eigensystem Realization Algorithm (ERA) and frequency-response estimation from I/O data
Nonlinear systems: Jacobian linearization around operating points; Smith predictor for time-delay plants
Model arrays and physical assembly: compatible model grids for parameter sweeps and descriptor assembly of connected physical ports
Model reduction & decomposition: controllability/observability staircase, balanced realization, balanced truncation, stable/unstable and modal separation, modal truncation
System norms & covariance: H2/H-infinity norms, Hankel singular values, state covariance
Interconnection: series, parallel, feedback (with feedin/feedout channel selection), append, block diagonal, named/indexed connect, FRD interconnections, sum blocks, and LFT
MATLAB TuningGoal.LoopShape and disk-based TuningGoal.Margins
NewPolesGoal
MATLAB TuningGoal.Poles decay, damping and frequency region
GridTune
Bounded Cartesian-grid tuning over free parameters and point-specific goals
Systune / Looptune
MATLAB systune/looptune argument shapes, solved by the same bounded grid search
Frequency Response & Plotting
Method
Description
FreqResponse
H(jw) at given frequencies
FreqResponsePointwise
H(jw) with each frequency bit-identical to a single-point FreqResponse call, regardless of sweep length
Bode
Magnitude (dB) and phase (deg) vs frequency
Nyquist
Nyquist plot with encirclement counting
Nichols
Nichols chart (magnitude vs phase)
Sigma
Singular value frequency response
DefaultFrequencyGrid
Automatic grid Bode/Sigma/Nichols use when omega is nil, without evaluating the response
EvalFr
Evaluate at arbitrary complex s
FRD Workflows
Function/Method
Description
(*System).FRD
Sample a system on a frequency grid and build an FRD model
(*FRD).Bode
Bode data from FRD samples
(*FRD).Nyquist
Nyquist contour from FRD samples
(*FRD).Sigma
Singular values from FRD samples
(*FRD).Abs
Magnitude-only FRD response
(*FRD).SelectFrequencies
Select samples by frequency index
(*FRD).SelectFrequencyRange
Select samples within a frequency band
(*FRD).MapResponse
Transform each sampled complex response matrix
(*FRD).PeakGain
Peak gain over sampled frequencies
FRDConcat
Concatenate compatible FRD models along the frequency grid
FRDMargin
Gain/phase margins from SISO FRD data
FRDSeries
Cascade composition of FRD models
FRDParallel
Parallel composition of FRD models
FRDFeedback
Closed-loop feedback composition of FRD models
Stability & Margins
Function/Method
Description
Poles
Eigenvalues of A
Zeros
Transmission zeros
IsStable
Stability check
IsStabilizable
Stabilizability test (unstable modes reachable from input)
IsDetectable
Detectability test (unstable modes observable from output)
DCGain
Steady-state (DC) gain
Damp
Natural frequency, damping ratio, time constant
Margin
Gain and phase margins (SISO)
AllMargin
All gain/phase crossover points
DiskMargin
Disk-based stability margin (balanced skew σ=0)
DiskMarginSkew
Disk margin for skew σ (MATLAB diskmargin(L,sigma))
Bandwidth
-3 dB bandwidth
RootLocus
Root locus as a function of loop gain
Pzmap
Poles and transmission zeros for plotting/inspection
SampledPassive / FRDPassive
Passivity evidence on an explicit frequency grid; passing samples are not an analytic certificate. The grid must be strictly increasing, finite, non-negative, and at or below the Nyquist frequency for sampled models
Passive
Compatibility alias for SampledPassive
SpectralFactor
Spectral factor for supported static-gain models
Control Design
Function
Description
Lqr
Continuous-time LQR regulator
Dlqr
Discrete-time LQR regulator
Lqrd
Discrete LQR obtained from continuous data and sample time
Lqe
Kalman filter (observer) gain, as MATLAB lqe(A,G,C,Qn,Rn,Nn)
Kalman
Kalman estimator from a System model, as MATLAB kalman(sys,Qn,Rn,Nn)
Kalmd
Discrete-time Kalman estimator from sampled model data
Estim
Observer model from a plant and observer gain, as MATLAB estim(sys,L,sensors,known)
Reg
Observer-based regulator assembled from plant, state-feedback gain, and observer gain
Lqi
LQR with integral action from a System model (MATLAB lqi: integrates r - y with D, forward Euler with Ts in discrete time)
Lqg
LQG regulator or servo controller (MATLAB lqg: QXU/QWV weights, G = I noise model, optional QI, 1-DOF, current estimator)
H2Syn
H2 optimal controller synthesis from generalized plant
HinfSyn
H-infinity controller synthesis from generalized plant