SystemLevelControl is a Julia toolbox for synthesizing controllers using the System Level Synthesis (SLS) methodology. We aim at providing a straightforward, @Distributed
-enabled, interface for optimal and robust control of large-scale cyberphysical systems.
This package is currently not in the official registry.
In order to use SystemLevelControl.jl, you can add this repository directly:
using Pkg; Pkg.add(url="https://github.com/aaltoKEPO/SystemLevelControl.jl")
or entering ]add https://github.com/aaltoKEPO/SystemLevelControl.jl
in the Julia REPL.
The following example illustrates how a spatiotemporal-localized controller can be synthesized using this toolbox. Consider the
where
using SystemLevelControl, LinearAlgebra, SparseArrays
# Definition of the (generalized) state-space model
Nx, Nu = (59, 20);
A = I + spdiagm(1 => 0.2ones(Nx-1)) - spdiagm(-1 => 0.2ones(Nx-1));
B₁ = I(Nx);
B₂ = spdiagm(0 => ones(Nx))[:,vec((1:2).+6(0:9)')];
P = Plant(A, B₁, B₂);
# Definition of (d,T)-localization constraints
d,T,α = (9, 29, 1.5);
𝓢ₓ = [ (A .≠ 0)^min(d, floor(α*(t-1))) .≠ 0 for t = 1:T];
𝓢ᵤ = [(B₂' .≠ 0)*(A .≠ 0)^min(d+1,floor(α*(t-1))) .≠ 0 for t = 1:T];
# Solves the 𝓗₂ state-feedback problem
Φₓ,Φᵤ = SLS_𝓗₂(P, [𝓢ₓ,𝓢ᵤ]);
Finally, the closed-loop response, with a unit impulse disturbance
w(t) = (t==50)*I(59)[:,30]
x = spzeros(Nx,250);
β = similar(x); u = spzeros(Nu,250)
for t = 1:250-1
β[:,t+1] = sum([Φₓ[τ+1]*(x[:,t+1-τ] - β[:,t+1-τ]) for τ = 1:min(t,T-1)]);
u[:,t] = sum([Φᵤ[ τ ]*(x[:,t+1-τ] - β[:,t+1-τ]) for τ = 1:min(t,T) ]);
x[:,t+1] = A*x[:,t] + B₁*w(t) + B₂*u[:,t];
end
The above script solves the SLS problem using distributed computation if Julia is started with a desired number of workers (e.g., with julia -p 8
, or by using the command addprocs
in the REPL). This can dramatically speed up computation and effectively distribute the synthesis problem across multiple CPUs (however, with an increase in memory usage if distributed locally).
This package is under development and is intended to provide a framework for efficiently solving System Level Synthesis problems. Although general-purpose, the SLS methodology is focused on large-scale cyber-physical systems with sparse communication and actuation networks. As such, our toolbox is designed for linear discrete-time systems, restricted to SparseArrays
data-types, and we focus on the linear fractional transformation (LFT) framework (see Zhou's & Doyle's textbook). We hope to improve SystemLevelControl.jl (and the research on SLS methods) so that in the future it can serve as a general-purpose control framework.
For doing analysis or solving more general control problems, we recommend other excellent Julia packages:
ControlSystems.jl
and its associated Ecosystem provide a wide collection of tools for analysis and design of control systems. It provides a similar interface as that of the popular Control Systems Toolbox in MATLAB®.JuMP.jl
is perhaps the most popular modelling framework for mathematical optimization in Julia. A wide class of optimal control problems (including LMIs/SDPs) can be solved with this package. SystemLevelControl.jl actually use JuMP to solve SLS problems for the general cases.TrajectoryOptimization.jl
is a popular framework for solving trajectory optimization problems in Julia, specially for applications in robotics. A distinct feature is the possibility to easily model nonlinear control problems.JuliaSimControl.jl
is the package within the JuliaSim Ecosystem that allows for the modelling, analysis and deployment of control systems in a centralized package.