Switched Systems

Switched Systems#

This is example synthesizes an unconstrained optimization algorithm in which the gradient operator \(\nabla f\) is interfaced through a network. The network switches between four subsystems in a ring pattern: at each time step \(k\), the mode either stays the same, or increases by 1. An example mode sequence is \(\theta = (1,1,2,3,3,3,4,4,1,2,3,3,\ldots)\).

The individual subsystems are described by the state-space matrices

\[\begin{split}\begin{align*} P_1 &: \mat{cc|cc}{0 & 0 & 1 & 0\\0 & 0.2 & 0 & 1 \hl 0 & 1 & 0 & 0 \\ -1 & 0 & 0 & 0}\otimes I, & P_2 &: \mat{cc|cc}{0.2 & 0 & 0.25 & 0\\0 & 0.9 & 0 & 1 \hl 0 & 1 & 0 & 0 \\ -0.4 & 0 & -0.5 & 3}\otimes I, \\ P_3 &: \mat{cc|cc}{-0.3 & 0 & 0.5 & 0\\0 & -0.5 & 0 & 1 \hl 0 & 1 & 0 & 0 \\ -0.3 & 0 & 0.5 & 1}\otimes I, & P_4 &: \mat{cc|cc}{1.2 & 0 & 1 & 0\\0 & -0.2 & 0 & 1 \hl 0 & 1 & 0 & 0 \\ 1 & 0 & 0 & 2}\otimes I. \end{align*}\end{split}\]

Synthesis is performed for a function \(f \in S_{1, 2}\). The returned mode-scheduled controller has a worst-case bound of \(\rho \leq 0.9493\) across all switching sequences.

Figure 1 plots an execution of the switched optimization algorithm.

../../_images/ring_uncons_state_dark.png

Figure 1: Trace of algorithm simulation convergence#

../../_images/ring_uncons_state_light.png

Figure 1: Trace of algorithm simulation and convergence#

Figure 2 plots the tracking error over this simulation.

../../_images/ring_uncons_track_dark.png

Figure 2: Trace of tracking error#

../../_images/ring_uncons_track_light.png

Figure 2: Trace of tracking error#

Periodicity can be enforced in two ways. The first is by imposing a periodic switching structure in the adjacency graph as in opt_system_switched.adj = circshift(4, -1). The second method is to use opt_system_periodic instead of opt_system_switched. With the subsystems and function classes in this example, the \(\rho\) bound for the first method is \(0.8212\), while the \(\rho\) bound for the second method is \(0.7028\). This gap is present because the LMIs in the general switched system program are more conservative than the LMIs for the more targeted periodic system program.

Code for ring-switched synthesis at \(m=1, L=2\)#
 1%generate the state space subsystems
 2P =cell(4, 1);
 3nx = 2;
 4P{1} = [0 , 0 , 1 , 0;
 5    0 , 0.2 , 0 , 1; 
 6    0 , 1 , 0 , 0 ; 
 7    -1 , 0 , 0 , 0];
 8
 9P{2} = [0.2 , 0 , 0.25 , 0;
10    0 , 0.9 , 0 , 1 ; 
11    0 , 1 , 0 , 0 ; 
12    -0.4 , 0 , -0.5 , 3];
13
14P{3} = [-0.3 , 0 , 0.5 , 0;
15    0 , -0.5 , 0 , 1 ;
16    0 , 1 , 0 , 0 ; 
17    -0.3 , 0 , 0.5 , 1];
18
19P{4} = [1.2 , 0 , 1 , 0;
20    0 , -0.2 , 0 , 1 ;
21    0 , 1 , 0 , 0 ;
22    1 , 0 , 0 , 2];
23
24%break up the subsystems into genplants
25Plist = cell(4, 1);
26n = struct('nw', 1, 'nz', 1, 'ny', 1, 'nu', 1);
27for i = 1:4
28    A = P{i}(1:nx, 1:nx);
29    B = P{i}(1:nx, (nx+1) : end);
30    C = P{i}((nx+1) : end, 1:nx);
31    D = P{i}((nx+1) : end, (nx+1) : end);
32    Plist{i} = genplant(ss(A, B, C, D, 1), n);
33end
34
35network = genplant_poly(Plist);
36
37
38%ring switching transition graph
39Gring = [1, 1, 0, 0;
40         0, 1, 1, 0;
41         0, 0, 1, 1;
42         1, 0, 0, 1];
43
44
45%define the operator
46m = 1; L = 2;
47ops = {op_sml(m, L)};
48
49sys = opt_system_switched(ops, network, [], Gring);
50
51%only allow gradients
52config =opt_config();
53config.syn.prox = 0;
54
55%pose and solve
56man= opt_synthesis(sys, config);