SLSpy: Python-Based System-Level Controller Synthesis Framework

Page created by Jesse Mccarthy
 
CONTINUE READING
SLSpy: Python-Based System-Level Controller Synthesis Framework
                                                                                        Shih-Hao Tseng and Jing Shuang (Lisa) Li

                                              Abstract— Synthesizing controllers for large, complex, and                implementable controllers can present significant challenges
                                           distributed systems is a challenging task. Numerous proposed                 to control practitioners who are not theory experts. From
                                           methods exist in the literature, but it is difficult for practitioners       the users’ perspective, it is more accessible if the synthesis
                                           to apply them – most proposed synthesis methods lack ready-to-
                                           use software implementations, and existing proprietary compo-                methods work as a black box: given the system information
                                           nents are too rigid to extend to general systems. To address this            and goals, derive a time-domain controller that takes the
arXiv:2004.12565v3 [eess.SY] 29 Sep 2020

                                           gap, we develop SLSpy, a framework for controller synthesis,                 input x(t) and returns the control u(t). This can be realized
                                           comparison, and testing.                                                     via a software implementation. Most methods described in
                                              SLSpy implements a highly extensible software framework                   the literature do not come with a ready-to-use software
                                           which provides two essential workflows: synthesis and simu-
                                           lation. The workflows are built from five conceptual compo-                  implementation. For those that do, the software may be
                                           nents that can be customized to implement a wide variety of                  proprietary and expensive and/or extend poorly to general
                                           synthesis algorithms and disturbance tests. SLSpy comes pre-                 systems.
                                           equipped with a workflow for System Level Synthesis (SLS),                      Even when the software is available, it often comes in the
                                           which enables users to easily and freely specify desired design              form of toolboxes, which, though easy-to-use, are difficult
                                           objectives and constraints. We demonstrate the effectiveness
                                           of SLSpy using two examples that have been described in                      to customize. Different toolboxes contain different sets of
                                           the literature but do not have ready-to-use implementations.                 tools with different logical dependencies among them. Intro-
                                           We open-source SLSpy to facilitate future controller synthesis               ducing new features involves fighting through these tangled
                                           research and practical usage.                                                dependencies. Meanwhile, different toolboxes could contain
                                                                    I. I NTRODUCTION                                    similar components, e.g., linear system models, but imple-
                                                                                                                        mented in different manners. Modifying such components
                                              Many of the systems we seek to control are large, com-                    could bog the user down in various logical threads behind
                                           plex, distributed, and multi-agent. Controlling such systems                 the toolboxes and become an error-prone nightmare.
                                           is a nontrivial task, and there is a rich body of work                          To avoid these hurdles and facilitate customization, we
                                           surrounding this topic, with numerous proposed controller                    instead seek a framework for controller synthesis. A frame-
                                           synthesis methods [1]–[6]. Mostly, the methods deal with                     work is a structure that defines some conceptual components
                                           some mathematical program in the following form                              and dictates the dependencies among them – the work-
                                                             min g(x, u)                                                flows. To use it, the users provide customized component
                                                              s.t. u = K(x),         (x, u) ∈ S                         instances, which are then invoked by the framework to
                                                                                                                        fulfill designated purposes of the workflows. Customization
                                           where g is the objective, x the input signal, u the control                  of components can be done via inheritance in software, and
                                           signal, and S the feasibility constraints (including state                   customized components are easily used in conjunction with
                                           dynamics, internal states, etc.). The synthesis methods then                 existing components thanks to the predefined workflows.
                                           produce the desired controller map K.                                        Thus, frameworks provide a natural and easy way to extend
                                               Although mathematically rigorous, these synthesis meth-                  and compare various algorithms and methods; they are used
                                           ods are often inaccessible to engineers and control prac-                    in domains such as robotics [8]–[10] and networking [11].
                                           titioners who want to test them out, customize them, or                         In this paper, we introduce SLSpy: an open-source frame-
                                           compare them with other methods. For instance, many syn-                     work for discrete-time controller synthesis, which expedites
                                           thesis methods utilize frequency domain signals x to obtain                  the implementation and comparison of various synthesis
                                           controller K and control signals u, usually in the frequency                 methods. Although we provide SLSpy as a Python-based
                                           domain as well. In practice, the raw input signal x(t) the                   implementation, our proposed framework can work with
                                           engineers have access to is in the time domain, and the                      components implemented in any other programming lan-
                                           control signal u(t) should also be in time domain. Mapping                   guage (or even hardware) as long as the components obey the
                                           the frequency domain controller K(x) to a time-domain                        framework with an appropriate interface to exchange time-
                                           implementation is not trivial. Furthermore, a recent study [7]               domain signals. The framework provides two key workflows
                                           shows that there exist multiple ways to implement the same                   – synthesis and simulation – and can accommodate any
                                           frequency domain controller, each leading to different system                synthesis algorithm that follows the workflow described in
                                           properties. Thus, translating controller synthesis theories into             [7].
                                                                                                                           We demonstrate how SLSpy facilitates implementation
                                             Shih-Hao Tseng and Jing Shuang (Lisa) Li are with the Division of Engi-
                                           neering and Applied Science, California Institute of Technology, Pasadena,   and customization of synthesis methods through implemen-
                                           CA 91125, USA. Emails: {shtseng,jsli}@caltech.edu                            tations of System Level Synthesis (SLS) and Input-Output
TABLE I
Parametrization (IOP) [12]–[14] in the framework. This is
                                                                         S TATE - OF - THE -A RT C ONTROL & S IMULATION S OFTWARE
the first open-source implementation of IOP, and is the
first Python-based implementation of SLS; we previously                                                            Properties
                                                                         Software
developed a MATLAB toolbox for SLS, SLS-MATLAB                                                  Purpose           Open-Source            Framework
[15]. SLSpy includes additional functionality for SLS not             Simulink [16]       general
found in SLS-MATLAB, such as output feedback and LQG                   PSpice [17]        circuits
objectives, and as a framework, allows for much easier               SOSTOOLS [18]     optimization
                                                                                                                           √
customization than SLS-MATLAB.                                          CVX [19]       optimization
                                                                                                                           √
   The main contributions of SLSpy are to introduce a frame-          ACADO [20]       optimization
                                                                                                                           √
work for general discrete-time controller synthesis, and to           pyRobots [8]        robotics
                                                                                                                           √
create the first Python implementations of SLS and IOP with           SMACH [21]          robotics
                                                                                                                           √
modularized objectives and constraints. We define and further          V-REP [9]          robotics
                                                                                                                           √                 √
motivate the necessity and extensibility of a framework, and                          temporal logic                       √
                                                                     TuLiP [22], [23]
describe the benefits of modularized objective and constraint                            planning
design in Section II. The architectures of the framework and        SLS-MATLAB [15]
                                                                                        controller                         √1
the modules are described in Section III. We then demon-                                 synthesis
                                                                                        controller                         √                 √
strate the usefulness of SLSpy in Section IV through two                 SLSpy
                                                                                         synthesis
examples: controller synthesis via IOP and output-feedback
LQG. Finally, we summarize and list open questions and
extensions for future work in Section V.                                              parameters:         g
                                                                                                              S
                                                                                                                   h
                                                                                                                       C
                                                                                                                                gγ
                                                                                                                                 S

A. Notation                                                           SynthesisAlgorithm conceptual component
   Let RH∞ denote the set of stable rational proper transfer              inherit
matrices, and z −1 RH∞ ⊂ RH∞ be the subset of strictly                                                                      myAlgorithm          g
                                                                                                                                                     S

proper stable transfer matrices. Lower- and upper-case letters         myAlgorithm      g
                                                                                            S       instantiate
(such as x and A) denote vectors and matrices respectively,                                                                 myAlgorithm          h
                                                                                                                                                     C
while bold lower- and upper-case characters and symbols                   inherit
(such as u and Φu ) are reserved for signals and transfer                                           instantiate
matrices. We use Φu [τ ] to denote the τ th spectral element          theirAlgorithm    gγ
                                                                                         S                                 theirAlgorithm        gγ
                                                                                                                                                  S
                                           ∞
of a transfer function Φu , i.e., Φu =        z −τ Φu [τ ]. For
                                           P
                                                                      specific components                                            instances
                                             τ =0
                              ub
simplicity, we write (x ∗      [t] as a shorthand notation for
                            y)lb
                                       ub
                                                                  Fig. 1. An example of customization via inheritance. The first specific
                                                                  component (myAlgorithm) inherits from the conceptual component (Syn-
the discrete-time finite convolution
                                      P
                                          x[τ ]y[t − τ ].         thesisAlgorithm) and adds detailed behavior to create a usable algorithm.
                                     τ =lb
                                                                  We can then use this specific component in code by instantiating it, i.e.
           II. M OTIVATION AND BACKGROUND                         by calling it with some specific parameters. Here, we have two instances
                                                                  of myAlgorithm, each with different parameters. Another specific compo-
   We begin with the preliminaries of frameworks and Sys-         nent (theirAlgorithm) can inherit from myAlgorithm and add customized
tem Level Synthesis (SLS). We describe the inversion of           behavior of its own on top of the original algorithm.
control concept, which differentiates a framework from a
toolbox/library, and explain why a framework is more ex-
                                                                     There are several ways to pack algorithms/methods
tensible than a toolbox/library. Additionally, we illustrate
                                                                  into software. Two major options are frameworks and li-
how modularization can make SLS more accessible and
                                                                  braries/toolboxes. A framework defines some workflows,
customizable.
                                                                  which govern how various conceptual components (e.g.
A. Towards Framework: Inversion of Control                        system model, controller model) interact. The users can then
                                                                  customize the workflows of interest by defining specific
   Software is a crucial tool in the synthesis and design
                                                                  components (e.g. a linear system with system matrices A,
of controllers for large-scale systems. It allows synthesis
                                                                  B, C, D) from the conceptual components or other specific
algorithms to be distributed and used without the overhead of
                                                                  components via inheritance, a mechanism in software that
learning them in detail and implementing them. We summa-
                                                                  allows a “child” component to include behavior from its “par-
rize some state-of-the-art control and simulation software in
                                                                  ent” component while also adding customized behavior of its
Table I. Overall, most of the available tools for controller
                                                                  own. Finally, the user instantiates the component with some
synthesis are proprietary, which are hard to extend and
                                                                  parameters (e.g. specific system matrices for some plant of
usually require license (and cost) to use. There are multiple
                                                                  interest) to obtain desired behavior. This is demonstrated in
open-source alternatives, but they do not directly serve the
                                                                  Fig. 1. On the other hand, a library/toolbox consists of several
purpose of controller synthesis and are often domain-specific.
We aim to develop an open-source general purpose software            1 Although SLS-MATLAB is open-source, it requires MATLAB, which
for controller synthesis.                                         is proprietary.
AB                                                                                                                         Φ0x
   parameters:        CD
                             system   g
                                          S   synthesizer            Φx
                                                                      Φu   controller           other parameters:      gγ
                                                                                                                        S    synthesizer          Φ0u
                                                                                                                                                            controller
                                   framework                                                                           framework
                                      inherit &                                                                                       AB
                 SystemModel                                 mySystem        AB                                       mySystem        CD
                                      instantiate                            CD
    workflow

                                                                                                                            inherit
               SynthesisAlgorithm                        myAlgorithm           g
                                                                                   S
                                                                                             myAlgorithm      g
                                                                                                                  S                            theirAlgorithm             gγ
                                                                                                                                                                           S

                                                                                                                                                                         Φ0x
                ControllerModel                          myController          Φx
                                                                                Φu
                                                                                             myController     Φx
                                                                                                               Φu                              myController               Φ0u

                                     toolbox                                                                                toolbox
                                                                                                                                                                  
                                                                                                                                                AB
                    Φx
                           = tool function          AB
                                                         ,   g
                                                                 S
                                                                                                  Φx
                                                                                                   Φu    = my algorithm function                CD
                                                                                                                                                        ,    g
                                                                                                                                                                 S
                     Φu                             CD

                                                                                                                                                                    
                                                                                                  Φ0x                                           AB
Fig. 2. Comparison between a framework and a toolbox. A framework                                  Φ0u   = their algorithm function             CD
                                                                                                                                                        ,    gγ
                                                                                                                                                              S
pre-defines some workflow that users can follow. The users inherit and
instantiate each conceptual component and execute the workflow. In contrast,
a toolbox provides some tools that help the users obtain some results of                Fig. 3.     Frameworks are highly extensible as we can reuse existing
interest. The users maintain the parameters and call the tools when needed.             components in a new workflow instance. In this example, we are able
                                                                                        to reuse the system model instance and controller model component (in
                                                                                        different instances holding different parameters) while modifying the syn-
                                                                                        thesis algorithm component via inheritance. In contrast, extending a toolbox
functions/tools that perform specific actions. The users plan                           requires directly modifying existing tool functions or introducing new tool
their workflows and choose the functions that fit in their                              functions, which is more involved.
schemes.
   A key property that distinguishes frameworks from li-                                   Fig. 3 shows an example in which we want to customize
braries/toolboxes is the inversion of control [24], [25] (also                          some aspect of an existing synthesis algorithm. Given some
dubbed the Hollywood Principle – “Don’t call us, we’ll call                             existing specific components (myModel, myAlgorithm, my-
you”). We illustrate this in the controller synthesis example                           Controller), only the algorithm component (myAlgorithm)
shown in Fig. 2.                                                                        needs to be customized. We customize the existing syn-
   To synthesize a controller, a possible workflow defined by                           thesis algorithm to obtain the new synthesis component
a framework consists of three phases: establishing a system                             (theirAlgorithm). This new component outputs some new
model, specifying the synthesis algorithm, and calculating                              parameters that are easily fed into the existing controller
the controller model. These are embodied by the conceptual                              model (myController) by the predefined workflow.
components SystemModel, SynthesisAlgorithm, and Con-                                       Consider the use case where we want to compare the
trollerModel. To use the framework, the user customizes                                 new synthesis algorithm with the original one. As they both
the conceptual components to create the specific components                             synthesize controllers for the same system, we only need
myModel, myAlgorithm, and myController; then, the user in-                              one system instance. The two different controller algorithms
stantiates the specific components with some parameters. The                            then generate two sets of parameters, which are fed into two
pre-defined workflow then feeds myModel into myAlgorithm                                instances of the myController component for comparison.
to calculate the desired controller model (myController).                               Overall, the framework allows us to reuse the myModel
   On the other hand, using a toolbox that contains some                                instance and the myController component.
suitable tool (tool function), users maintain their system and                             As demonstrated in the above example, customization in a
synthesizer parameters and obtain the controller parameters                             framework is less involved as a large portion of existing code
via tool function. The two procedures differ in which entity                            can be reused, and the customized components can be easily
controls the flow of the program; under a framework, the                                embedded thanks to the framework’s predefined workflow.
workflow is predetermined by the framework itself, whereas                              Conversely, in a toolbox, one would need to directly edit the
a toolbox allows the user to control the workflow. Therefore,                           source code or introduce a new toolbox function, which are
control of the program is “inverted” from the user to the                               more involved and likely to introduce code repetition.
framework.
                                                                                        C. Modularized System Level Synthesis
B. Framework-Enabled Extensibility                                                        Synthesizing an optimal controller for a networked cyber-
   A framework’s component-based architecture enables a                                 physical system is challenging. The recently proposed Sys-
user to easily customize select components as shown in                                  tem Level Synthesis (SLS) [12], [13] method provides a
Fig. 1. Once this component has been customized, it is                                  solution for the following system:
also easy to use alongside existing components, thanks to                                           x[t + 1] = Ax[t] + B1 w[t] + B2 u[t],
the framework’s predefined workflow; little additional effort
                                                                                                          z[t] = C1 x[t] + D11 w[t] + D12 u[t],
from the user is required to interface customized components
with existing components. We demonstrate this in Fig. 3.                                                  y[t] = C2 x[t] + D21 w[t] + D22 u[t],
where x[t] is the state, w[t] the noise, u[t] the control, z[t]                          SLS:    state feedback   output feedback

                                                                                                                                              ControllerModel
                                                                     SystemModel
the regulated output, and y[t] the measurement at time t. SLS
                                                                                           min
aims to synthesize a controller, the transfer function K that
maps the state x or the output y to the control u, subject to                               s.t. SLS constraints
some system-level objective g and constraint S. To do so,
SLS introduces a new parametrization such that by solving
                                                                              locality   my constraint      robustness    H∞        LQ   L1
             min g(Φx , Φu )
                               
                              Φx
                                                            (1)   Fig. 4.   We automate the synthesis process and modularize objectives
                  
             s.t. zI − A −B2      = I,
                               Φu                                 and constraints so that users can focus on selecting, customizing, or even
                                                                  combining the modules according to their needs without learning and
                   Φx , Φu ∈ z −1 RH∞ ,                           implementing the underlying theories of System Level Synthesis (SLS).
                    
                    Φx
                         ∈ S,
                    Φu
                                                                  desired objective and constraint modules. The framework
for a state-feedback system and
                                                                  then carries out the synthesis and generates the controller
   min g(Φxx , Φux , Φxy , Φuy )                                  model for the users. Through modularization, we aim to
                        
                        Φxx Φxy
                                                                 make SLS more accessible to not only researchers but also
                                                          (2a)
                                                  
   s.t. zI − A −B2                    = I          0 ,            control practitioners.
                          Φux Φuy
                                                                                                III. A RCHITECTURE
                              
          Φxx Φxy zI − A           I
                                 =    ,                   (2b)
          Φux Φuy       −C2        0                                 We design SLSpy, a software framework for system-level
         Φxx , Φux , Φxy ∈ z −1 RH∞ , Φuy ∈ RH∞ ,                 controller synthesis. Our framework addresses the controller
                                                                  synthesis problem at the system level; component-wise de-
                     
           Φxx Φxy
                        ∈ S,                                      tails are omitted and the system is described by a map
          Φux Φuy
                                                                  between its sensors and actuators.
for an output-feedback system, we can derive the controllers
                                                                     The extensibility of a framework relies on the ability to
of the corresponding systems by
                                                                  customize components via inheritance. For this reason, we
      state-feedback:   u = Φu Φ−1                                implement our framework in Python, an objected-oriented
                                      
                                   x    x,
    output-feedback:    u = Φuy − Φux Φ−1
                                                                 language with good support for inheritance. An additional
                                            xx Φxy y.
                                                                  benefit of Python is that it is open-source and commonly
For simplicity, we denote by Φ the set of SLS parameters,         used, which makes our framework more accessible. We
i.e., {Φx , Φu } or {Φxx , Φux , Φxy , Φuy }.                     remark that the concepts in this paper are not Python-specific;
   We refer the interested reader to [12], [13] for details,      our framework can be implemented in any programming
where the motivation, derivation, and benefits of the SLS         language that supports inheritance or some equivalent in-
parametrization are thoroughly discussed.                         stantiation process.
   A key feature of SLS is that it enforces the constraint           Below, we illustrate the details of our framework and its
S explicitly through the optimization. As such, it decouples      SLS modules.
the solving procedure from the structure of constraints. This
entanglement greatly confined the capability of legacy meth-      A. Framework Overview
ods, e.g., [26]–[28], to approach only certain constraints and       To design a framework for system-level controller syn-
systems. With SLS, we can now specify the constraints freely      thesis, we focus on two essential workflows: synthesis and
and let the corresponding convex program determine the            simulation, as shown in Fig. 5. We further partition the
feasibility. To facilitate the usage of SLS, we have developed    workflows into five core conceptual components: System-
and released the SLS-MATLAB toolbox [15], [29]. However,          Model, SynthesisAlgorithm, ControllerModel, NoiseModel,
the toolbox does not easily extend to novel or custom SLS-        and Simulator. The synthesis workflow takes a SystemModel
based methods, which often require edits to the core code         and synthesizes a desired ControllerModel. The simulation
of the toolbox; here, again, we seek a framework to enable        workflow allows users to verify the behavior of the resulting
customization.                                                    ControllerModel fed back to the SystemModel, and examine
   From a practical perspective, users of SLS care more           the impact of external disturbances from the NoiseModel.
about obtaining a controller that meets their specifications         We design the simulation workflow to lie in the time
than about the details of the underlying optimization. User-      domain. As a result, all conceptual components should
specified requirements on the controller correspond to objec-     handle and produce time domain signals with the excep-
tives and constraints in the SLS problem. Motivated by this,      tion of SynthesisAlgorithm. This design decision allows the
we propose to automate the synthesis process and modularize       components to collaborate with real cyber-physical systems.
the objectives and constraints as shown in Fig. 4. This allows    For example, with appropriate hardware-software interfaces,
the users to specify the synthesis type (state-feedback or        a ControllerModel can generate control signals to control a
output-feedback) and select, customize, or even combine their     real system; a physical controller can be tested with different
u, w → x, y, z
                                                                                                  inherit
                SystemModel                                                     SystemModel                 LTI System
                                       history of
                                      x, y, z, u, w                                                                         SLS Objective
  synthesis
                                                            w
              SynthesisAlgorithm     Simulator        NoiseModel             SynthesisAlgorithm                SLS
                                                                                                                         SLS Constraint
               ControllerModel                                                 ControllerModel         SLS FIR Controller
                    y→u                                 simulation

Fig. 5. The framework in SLSpy defines two workflows: synthesis and        Fig. 6. SLSpy includes an implementation of SLS within the general
simulation. The two workflows consist of five core conceptual compo-       framework, with SLS-specific objectives and constraints.
nents: SystemModel, SynthesisAlgorithm, ControllerModel, NoiseModel,
and Simulator. Besides the SysthesisAlgorithm, all components work on
time domain rather than frequency domain, which allows them to be ported
to real system directly.                                                   algorithms may assume and target specific classes of noise
                                                                           (e.g. Gaussian noise), but we argue that the assumptions
                                                                           should be part of their synthesis parameters. We instead
SystemModels; a NoiseModel can serve as a noise generator                  include NoiseModel in the simulation workflow, so that
for robustness tests of real systems. For flexibility of the               we can examine the system performance under different
synthesis workflow, we allow SynthesisAlgorithm to deal                    external disturbances. Of course, users are free to choose
with the frequency domain. Overall, our framework main-                    a NoiseModel that agrees with their assumptions.
tains flexibility to accommodate as many future synthesis
                                                                              Simulator simulates time-domain system behavior for a
algorithms as possible.
                                                                           specific system (SystemModel) and controller (Controller-
   We explain the functions of each component below:
                                                                           Model) in the presence of noise (NoiseModel), and outputs
    SystemModel, interfered by noise w, takes control input                the resulting history of state x, measurement y, regulated
u to generate state x, measurement y, and regulated output                 output z, control u, and noise w. Users can then analyze the
z. A SystemModel could have internal states, which allows                  history, visualize it using our pre-written visualization tools,
it to model a wide range of systems, including general linear              and compare simulations from different controllers.
or nonlinear, time-invariant or time-varying ones.                            We include the Simulator as a separate entity from the Sys-
                                                                           temModel for extensibility; when the system is known, the
   ControllerModel receives the measurement y (which
                                                                           coupling between SystemModel and Simulator is apparent.
equals to x under state-feedback schemes) to produce con-
                                                                           However, for applications with plant uncertainty or related to
trol input u. ControllerModel is flexible to accommodate a
                                                                           system identification, the SystemModel used in design is not
wide range of parametrizations of the represented controller.
                                                                           necessarily the same as the true system, which the Simulator
For example, we can parametrize the class of linear time-
                                                                           uses. Separating the SystemModel and Simulator also allows
invariant controllers in ControllerModel by a direct map
                                                                           us to test a single controller on a variety of systems.
K from y to u, the Youla parameter Q [26], or the SLS
parametrization [12], [13], which uses closed-loop maps                    B. System Level Synthesis Modules
from state disturbances and measurement error to the state
                                                                              As illustrated in Section II-C, SLS provides a new
and input (i.e., Φ). ControllerModel contains procedures that
                                                                           parametrization for both the formulation of the synthesis
turn measurement y into control u in time domain according
                                                                           problem and the corresponding controller models. In addition
to the parameters.
                                                                           to the conceptual components, SLSpy also includes some
   SynthesisAlgorithm takes a SystemModel and synthe-                      pre-defined specific components to facilitate usage of SLS,
sizes a ControllerModel according to its design parameters                 and to provide users with an example of how to use the
and constraints. In conventional toolboxes, such as TuLiP                  framework. Fig. 6 shows how SLS is implemented within
[22], [23] and SLS-MATLAB [15], the synthesis algorithm                    the SLSpy framework via inheritance; below, we describe
and controller model are often coupled. However, for the                   the details of the implementation.
framework, we separate the two for better extensibility and
                                                                              Constraints and Objectives Given an LTI System, the
reduced code duplication. For example, there are many ways
                                                                           SLS algorithm formulates an optimization problem with
to design a controller K, including LQR and pole-placement
                                                                           some specified objective g and constraint set S. As stated in
methods. These are two separate synthesis algorithms cor-
                                                                           Section II-C, we want to allow the user to specify arbitrary
responding to the same controller model; the code for the
                                                                           combinations of objectives and constraints. To this end, we
controller model would be duplicated if we combined the
                                                                           include the SLS Objective and SLS Constraint base classes.
synthesis algorithm and controller model.
                                                                           We then maintain two lists, as shown in Fig. 7, to keep
   NoiseModel models some disturbance or noise processes.                  track of the user-selected modules, which are derived from
A key design decision we made is to exclude NoiseModel                     SLS Objective and SLS Constraint. Below we explain how
from the synthesis workflow, and hence from the Sys-                       to combine those modules to form the corresponding SLS
temModel and SynthesisAlgorithm. Indeed, some synthesis                    optimization problem.
List of SLS Objective s                                                                                 −D22
                  customized L1                gmul          H2
                                                                                                                                                         β
                                                                                                             y       ⊕      Φ̃xy      ⊕           z −1       Φ̃ux       ⊕      u

                                                                               List of SLS Constraint s
                                                            2
                                                       Φx
        min                      2

                                                                         SLS
                  kΘkE1 +   kΦx kL1   + α     C1   D12
                                                         Φu   H2
                                                                                                                                              Φ̃xx
        s.t.      SLS feasibility: Φ ∈ SSLS

                                                                         MyC
                                                                                                                                              Φuy
                  my constraint: {Φ, Θ} ∈ SMyC

                  locality: Φ ∈ SLoc                                                                      Fig. 8. Block-diagram realization of SLS output feedback controller, where

                                                                         Loc
                                                                                                          Φ̃xx = z(I − zΦxx ), Φ̃ux = zΦux , and Φ̃xy = −zΦxy .

Fig. 7. SLSpy maintains two lists of user-selected SLS modules derived
from the base classes SLS Objective and SLS Constraint. We then iterate                                   are generally applicable except in the case of robust SLS
through the lists to create the objective function and the list of constraints
using the modules. Since SLS Constraint modules might introduce new                                       [30]. Some SLS problems (e.g. robust SLS) are defined
variables and regularize them in the objective, SLS Constraint inherits from                              using a combination of new variables defined via equality
SLS Objective in our design.                                                                              constraints, and regularization terms on these new variables
                                                                                                          in the objective. In these cases, the constraint must be defined
                                                                                                          before the objective; for this reason, SLS Constraint inherits
   A naive assumption for combining objectives is that the
                                                                                                          from SLS Objective.
overall objective
             P g(Φ) is the sum of objective modules gi ,
i.e., g(Φ) = gi (Φ). However, this is not the most general                                                   Controllers SLS proposes controller realization in block
                 i
expression, and may lead to issues with more complex ob-                                                  diagrams, which are in the frequency domain.1 The block-
jectives. We instead make the more general assumption that                                                diagram realization of the SLS output feedback controller is
the objective modules can modify the cumulative objectives                                                shown in Fig. 8. However, as described in Section III-A, the
from previous modules. Specifically,                                                                      ControllerModel requires functionality in the time domain.
                                                                                                          This necessitates the translation of Fig. 8 into time-domain
               g(Φ) = . . . g3 (Φ, g2 (Φ, g1 (Φ, 0))).                                                    equations for implementation.
To demonstrate the flexibility of this structure, we consider                                                Fig. 8 corresponds to the time-domain equations
the following objective as an example. Consider
                                                                                                                  u[t] = (I + Φuy [0]D22 )−1 (u0 [t] + Φuy [0]y[t])                (3)
                               Φx 2
                                
                                                  2
        g(Φ) = α C1 D12                    + kΦx kL1 ,
                                Φu H
                                                         2
                                                                                                          where the internal states are
which can be decomposed as                                                                                                                T                         T
                                                                                                                 u0 [t] = (Φux ∗ β)1 [t − 1] + (Φuy ∗ y)1 [t − 2] ,
                  g(Φ) = g3 (Φ, g2 (Φ, g1 (Φ, 0)))                                                                                            T                         T
                                                                                                             β[t + 1] = − (Φxx ∗ β)2 [t − 2] − (Φxy ∗ y)1 [t − 1] ,
where                                                                                                             y[t] = y[t] − D22 u[t].
                                                                2
                                                 Φx
            g1 (Φ, h) =             C1       D12                       + h,                                  SLSpy implements the output-feedback SLS controller in
                                                   Φu             H2
                                                                                                          time domain as defined in (3), as well as the state-feedback
            g2 (Φ, h) = αh,
                                                                                                          standard SLS controller in [7].
                                         2
            g3 (Φ, h) = kΦx kL1 + h.
Besides Φ and h, each objective module can also take its                                                                             IV. E XAMPLES
own parameters to cover a larger class of objectives, e.g.,
                                                                                                            Through the following examples, we demonstrate how
gH2 (Φ, C1 , D12 , h) = g1 (Φ, h), gmul (Φ, α, h) = g2 (Φ, h).
                                                                                                          SLSpy can help the user perform and study controller
   We obtain g by iterating through the SLS Objective                                                     synthesis with ease. All codes used for the examples are
list and performing function compositions. Correspondingly,                                               available online at [31].
SLS Objective must include a function for function compo-
sition.                                                                                                   A. Setup
   Combining arbitrary constraints is trivial; we maintain
a list of constraints and allow constraint modules to add                                                    For all examples, we use a 10-node fully-actuated chain-
to the list. Correspondingly, SLS Constraint should include                                               like system, as shown in Fig. 9, with the following tridiagonal
a function that adds its constraint to the list. The core
SLS feasibility constraints ((1) for state feedback and (2a),                                                1 We differentiate the “realizations” (block diagrams) from “implementa-
(2b) for output feedback) can be included as modules; they                                                tions” (hardware/software architectures) of a controller according to [7].
0                             log10 (|y|)                           log10 (|u|)
                  10
                   9                                                                     10                                    10
                   8                                                −1
                                                                                          8                                     8
                   7

                                                                                 Space

                                                                                                                       Space
                                                                                          6                                     6
                   6
                                                                    −2                    4                                     4
                   5
                   4                                                                      2                                     2
      w[0]
                   3                                                −3
                                                                                              0       5          10                 0       5          10
                   2
                                                                                                    Time                                  Time
                   1
                                                                    −4
                       0                  5               10                     Fig. 10.    We implement Input-Output Parametrization (IOP) using the
                                        Time                                     SLSpy framework in only 282 lines of code. The plot shows the system
                                                                                 response to an impulse disturbance at the center of the chain; the IOP
Fig. 9. In the examples, we consider a 10-node fully-actuated chain-like         controller successfully stabilizes the system. Plots show the log magnitude
system. At time 0, an impulse disturbance w[0] = 10 hits its center, and         of the measurement y and the control u.
we plot the time series of the quantities of interest in log scale. Each row
of the plot shows the log-magnitude of the relevant signal (state, control, or
                                                                                                  log10 (|y|)                           log10 (|u|)
measurement) of a single node over time; each column of the plot shows
the log-magnitudes of all the nodes’ signals at a single moment in time.
                                                                                         10                                    10
                                                                                          8                                     8

                                                                                 Space

                                                                                                                       Space
A matrix:                                                                                 6                                     6
                   
                    0.4          0.1     0       ...  0
                                                                                         4                                     4
                                        ..            ..                                 2                                     2
                                           .           . 
                   
                   0.1          0.3
                                                                                              0       5          10                 0       5          10
                                 ..     ..       ..
                                                        
                 A= 0              .        .      .                     (4)
                                                        
                                                      0                                            Time                                  Time
                    .                  ..
                                                        
                    ..                   .
                                                         
                                                 0.3 0.1                        Fig. 11. We implement LQG using output feedback SLS, and simulate the
                           0     ...     0       0.1 0.4                         system response to an impulse disturbance at the center of the chain, with
                                                                                 no measurement noise. The system is successfully stabilized. Plots show
The system is stable, with a spectral radius of 0.5. We zero-                    the log magnitude of the measurement y and the control u.
initialize the system and disturb it at time t = 0 with an
impulse disturbance w[0] = 10. Under different controller
models, we record the quantities of interest and plot their                      C. Output Feedback LQG
time series in log scale.                                                           We implement an LQG controller with nonzero expected
B. Input-Output Parametrization                                                  measurement noise. The SLS formulation of LQG can be
                                                                                 found in [32]. Since the framework decouples the expected
   The design of SLSpy framework allows the user to imple-
                                                                                 noise (which is a parameter for controller synthesis) and
ment novel synthesis algorithms with ease. For example, a
                                                                                 the actual noise (which is used in the simulator), we can
new parametrization – Input-Output Parametrization (IOP) –
                                                                                 simulate the response of the controller to noises it was
is proposed in [14] for the following system:
                                                                                 not designed for. We include a simulation of the LQG
           y = Gu + Pyw w,              z = Pzu u + Pzw w                        controller in a system with no measurement noise in Fig. 11,
                                                                                 and a simulation of the same controller in a system with
where y, u, and w are the measurement (system output),
                                                                                 measurement noise in Fig. 12.
control, and noise, respectively. Given a transfer function
                                                                                    Compared to the IOP controller, the LQG controller allows
G, IOP obtains the controller K = YX−1 for u = Ky by
                                                                                 the disturbance to spread more in both time and space.
solving
                                                                                 Since the LQG controller expects measurement noise, it does
                                                                                 not act as aggressively on sensor information as the IOP
                                      
           min      Pzw + Pzu YPyw
                 
                            
                           X W
                                     
                                                                               controller, which expects no measurement noise. A fairer
            s.t. I −G                  = I 0                                     comparison would be comparing the IOP controller with
                             Y Z
                                                                           the LQR controller, and in that case, we find that the two
                   X W −G               0
                                   =                                             controllers are identical, which matches the discussion in
                   Y Z         I        I
                                                                                 [33].
                       X, W, Y, Z ∈ RH∞ .
                                                                                                            V. C ONCLUSION
   We implement IOP in SLSpy with only 282 lines of code,
and we demonstrate the effectiveness of the IOP controller                          We propose a software framework for controller synthesis
in Fig. 10. Fig. 10 shows a simple example where the                             and implement it as SLSpy in Python. Our framework serves
disturbance hits the center of a chain-like system of 10 nodes.                  as a platform for comparison of different discrete-time con-
While the disturbance spreads, the IOP controller reacts and                     troller synthesis methods. We describe the architecture of the
stabilizes the system.                                                           framework and its supported workflows, and use it to deploy
log10 (|y|)                                       log10 (|u|)        [11] ns-3. [Online]. Available: https://www.nsnam.org
                                                                                      [12] Y.-S. Wang, N. Matni, and J. C. Doyle, “A system level approach to
        10                                           10                                    controller synthesis,” IEEE Trans. Autom. Control, vol. 34, no. 8, pp.
         8                                            8                                    982–987, 2019.
                                                                                      [13] J. Anderson et al., “System level synthesis,” Annual Reviews in
Space

                                             Space
         6                                            6                                    Control, vol. 59, no. 12, pp. 3238–3251, 2019.
         4                                            4                               [14] L. Furieri et al., “An input-output parametrization of stabilizing
         2                                            2                                    controllers: Amidst Youla and system level synthesis,” IEEE Control
                                                                                           Systems Letters, vol. 3, no. 4, pp. 1014–1019, 2019.
             0       5                 10                 0            5         10   [15] J. S. L. Li and S.-H. Tseng, “SLS-MATLAB toolbox: Do-it-yourself
                                                                                           system level synthesis [poster],” in Proc. IEEE ACC, jul 2020.
                   Time                                              Time             [16] Simulink. [Online]. Available: https://www.mathworks.com/products/
                                        log10 (|x|)                                        simulink.html
                                                                                      [17] Pspice.     [Online].    Available:     https://www.orcad.com/products/
                            10                                                             orcad-pspice-designer/overview
                             8                                                        [18] S. Prajna, A. Papachristodoulou, and P. A. Parrilo, “Introducing
                                                                                           SOSTOOLS: A general purpose sum of squares programming solver,”
                    Space

                             6                                                             in Proc. IEEE CDC. IEEE, 2002, pp. 741–746.
                             4                                                        [19] M. Grant and S. Boyd, “CVX: Matlab software for disciplined convex
                             2                                                             programming,” http://cvxr.com/cvx, Mar. 2014.
                                                                                      [20] B. Houska, H. J. Ferreau, and M. Diehl, “ACADO toolkit - An open-
                                 0            5               10                           source framework for automatic control and dynamic optimization,”
                                                                                           Optimal Control Applications and Methods, vol. 32, no. 3, pp. 298–
                                            Time                                           312, 2011.
                                                                                      [21] J. Bohren and S. Cousins, “The SMACH high-level executive,” IEEE
Fig. 12. We implement LQG using output feedback SLS, and simulate the                      Robotics and Automation Magazine, vol. 17, no. 4, pp. 18–20, 2010.
system response to an impulse disturbance at the center of the chain, with            [22] T. Wongpiromsarn et al., “TuLiP: A software toolbox for receding
noisy measurements. Plots show the log magnitude of the measurement y,                     horizon temporal logic planning,” in Proc. ACM HSCC, 2011, pp.
control u, and state x. The measurement noise is apparent in the plot of y;                313–314.
however, if we look at the plot of x, we see that the system is successfully          [23] I. Filippidis et al., “Control design for hybrid systems with TuLiP:
stabilized.                                                                                The temporal logic planning toolbox,” in Proc. IEEE CCA. IEEE,
                                                                                           2016, pp. 1030–1041.
                                                                                      [24] R. E. Johnson and B. Foote, “Designing reusable classes,” Journal of
modularized implementations of two synthesis methods that                                  Object-Oriented Programming, vol. 1, no. 2, pp. 22–35, 1988.
                                                                                      [25] M. Fowler. Inversion of control. [Online]. Available: https://
previously had no open-source implementations.                                             martinfowler.com/bliki/InversionOfControl.html
   A direction for future work is exploring how additional                            [26] D. C. Youla, H. A. Jabr, and J. J. Bongiorno Jr., “Modern Wiener-
optimization solvers and techniques can be incorporated into                               Hopf design of optimal controllers – part II: The multivariable case,”
                                                                                           in Proc. IEEE ACC, vol. 21, no. 3, 2016, pp. 319–338.
the framework. Currently, all objectives and constraints are                          [27] A. Lamperski and J. C. Doyle, “Dynamic programming solutions
directly specified in CVX syntax. One possible solution                                    for decentralized state-feedback LQG problems with communication
is the inclusion of a translator component between objec-                                  delays,” in Proc. IEEE ACC, 2012.
                                                                                      [28] Ş. Sabău and N. C. Martins, “Youla-like parametrizations subject to
tives/constraints and the solver.                                                          QI subspace constraints,” IEEE Trans. Autom. Control, vol. 59, no. 6,
                                                                                           pp. 1411–1422, 2014.
                                     R EFERENCES                                      [29] Compilation of System Level Synthesis Codes. [Online]. Available:
                                                                                           https://github.com/sls-caltech/sls-code
 [1] A. Nayyar, A. Mahajan, and D. Teneketzis, “Decentralized stochastic              [30] N. Matni, Y. S. Wang, and J. Anderson, “Scalable system level
     control with partial history sharing: A common information approach,”                 synthesis for virtually localizable systems,” in Proc. IEEE CDC, 2018,
     IEEE Trans. Autom. Control, vol. 58, no. 7, pp. 1644–1658, 2013.                      pp. 3473–3480.
 [2] B. Bamieh and P. G. Voulgaris, “A convex characterization of dis-                [31] SLSpy. [Online]. Available: https://github.com/shih-hao-tseng/SLSpy
     tributed control problems in spatially invariant systems with commu-             [32] Y. S. Wang and N. Matni, “Localized LQG optimal control for large-
     nication constraints,” Systems and Control Letters, vol. 54, no. 6, pp.               scale systems,” in Proc. IEEE ACC, vol. 2016-July, 2016, pp. 1954–
     575–583, 2005.                                                                        1961.
 [3] M. Rotkowitz and S. Lall, “A characterization of convex problems in              [33] Y. Zheng et al., “On the equivalence of Youla, system-level and input-
     decentralized control,” IEEE Trans. Autom. Control, vol. 50, no. 12,                  output parameterizations,” arXiv preprint arXiv:1907.06256, 2019.
     pp. 1984–1996, 2005.
 [4] Y. C. Ho and K. C. Chu, “Team Decision Theory and Information
     Structures in Optimal Control Problems-Part I,” IEEE Trans. Autom.
     Control, vol. 17, no. 1, pp. 15–22, 1971.
 [5] B. Bamieh, F. Paganini, and M. A. Dahleh, “Distributed control of
     spatially invariant systems,” IEEE Trans. Autom. Control, vol. 47,
     no. 7, pp. 1091–1107, 2002.
 [6] A. Mahajan et al., “Information structures in optimal decentralized
     control,” in Proc. IEEE CDC, 2012, pp. 1291–1306.
 [7] S.-H. Tseng and J. Anderson, “Deployment architectures for cyber-
     physical control systems,” in Proc. IEEE ACC, jul 2020.
 [8] S. Lemaignan, A. Hosseini, and P. Dillenbourg, “PYROBOTS, a
     toolset for robot executive control,” in Proc. IEEE IROS, vol. 2015-
     Decem, 2015, pp. 2848–2853.
 [9] E. Rohmer, S. P. Singh, and M. Freese, “V-REP: A versatile and
     scalable robot simulation framework,” in Proc. IEEE IROS, 2013, pp.
     1321–1326.
[10] H. Bruyninckx et al., “The BRICS component model: A model-based
     development paradigm for complex robotics software systems,” in
     Proc. ACM SAC, 2013, pp. 1758–1764.
You can also read