# LMIs in Control/pages/Switched systems Hinf Optimization

LMIs in Control/pages/Switched systems Hinf Optimization

Switched Systems ${\displaystyle H_{\infty }}$ Optimization

## The Optimization Problem

This Optimization problem involves the use of the State-feedback plant design, with the difference of optimizing the system with a system matrix which "switches" in properties during optimization. This is similar to considering the system with variable uncertainty; an example of this would be polytopic uncertainty in the matrix ${\displaystyle A}$ . which ever matrix is switching states, there must be an optimization for both cases using the same variables for both.

This is first done by defining the 9-matrix plant as such: ${\displaystyle A\in \mathbb {R} ^{m\times m}}$ , ${\displaystyle B_{1}\in \mathbb {R} ^{m\times n}}$ , ${\displaystyle B_{2}\in \mathbb {R} ^{m\times p}}$ , ${\displaystyle C_{1}\in \mathbb {R} ^{n\times m}}$ , ${\displaystyle D_{11}\in \mathbb {R} ^{n\times n}}$ , ${\displaystyle D_{12}\in \mathbb {R} ^{n\times p}}$ , ${\displaystyle C_{2}=I}$ , ${\displaystyle D_{21}=0}$ , and ${\displaystyle D_{22}=0}$ . Using this type of optimization allows for stacking different LMI matrix states in order to achieve the controller synthesis for ${\displaystyle H_{\infty }}$ .

## The Data

The data is dependent on the type the state-space representation of the 9-matrix plant; therefore the following must be known for this LMI to be calculated: ${\displaystyle A\in \mathbb {R} ^{m\times m}}$ , ${\displaystyle B_{1}\in \mathbb {R} ^{m\times n}}$ , ${\displaystyle B_{2}\in \mathbb {R} ^{m\times p}}$ , ${\displaystyle C_{1}\in \mathbb {R} ^{n\times m}}$ , ${\displaystyle D_{11}\in \mathbb {R} ^{n\times n}}$ , ${\displaystyle D_{12}\in \mathbb {R} ^{n\times p}}$ , ${\displaystyle C_{2}=I}$ , ${\displaystyle D_{21}=0}$ , and ${\displaystyle D_{22}=0}$ . What must also be considered is which matrix or matrices will be "switched" during optimization. This can be denoted as ${\displaystyle A(\delta )}$ .

## The LMI: Switched Systems ${\displaystyle H_{\infty }}$ Optimization

There exists a scalar ${\displaystyle \gamma }$ , along with the matrices ${\displaystyle X>0}$  and ${\displaystyle Z}$  where:

{\displaystyle {\begin{aligned}||S(P,K(0,0,0,F))||_{H_{\infty }}\leq \gamma \\\\{\begin{bmatrix}XA(\delta )^{T}+Z^{T}B_{2}^{T}+A(\delta )X+B_{2}Z&B_{1}&XC_{1}^{T}+Z^{T}D_{12}^{T}\\B1_{1}^{T}&-\gamma I&D_{11}^{T}\\C_{1}X+D_{12}Z&D_{11}&-\gamma I\end{bmatrix}}&<0\\\end{aligned}}}

Where ${\displaystyle F=ZX^{-1}}$  is the controller matrix. This also assumes that the only switching matrix is ${\displaystyle A}$ ; however, other matrices can be switched in states in order for more robustness in the controller.

## Conclusion:

The results from this LMI gives a controller gain that is an optimization of ${\displaystyle H_{\infty }}$  for a switched system optimization.

## Implementation

% Switched System Hinf example
% -- EXAMPLE --

clear; clc; close all;

%Given
A  = [ 1  1  0  1  0  1;
-1 -1 -1  0  0  1;
1  0  1 -1  1  1;
-1  1 -1 -1  0  0;
-1 -1  1  1  1 -1;
0 -1  0  0 -1 -1];

B1 = [ 0 -1 -1;
0  0  0;
-1  1  1;
-1  0  0;
0  0  1;
-1  1  1];

B21= [ 0  0  0;
-1  0  1;
-1  1  0;
1 -1  0;
-1  0 -1;
0  1  1];

B22= [ 0   0   0;
-1   0   1;
-1   1   0;
1   1   0;
1   0   1;
0  -3  -1];

C1 = [ 0  1  0 -1 -1 -1;
0  0  0 -1  0  0;
1  0  0  0 -1  0];

D12= [ 1    1    1;
0    0    0;
0.1  0.2  0.4];

D11= [ 1  2  3;
0  0  0;
0  0  0];

%Error
eta = 1E-4;

%sizes of matrices
numa  = size(A,1);    %states
numb2 = size(B21,2);  %actuators
numb1 = size(B1,2);   %external inputs
numc1 = size(C1,1);   %regulated outputs

%variables
gam = sdpvar(1);
Y   = sdpvar(numa);
Z   = sdpvar(numb2,numa,'full');

%Matrix for LMI optimization
M1 = [Y*A'+A*Y+Z'*B21'+B21*Z   B1                Y*C1'+Z'*D12';
B1'                      -gam*eye(numb1)    D11';
C1*Y+D12*Z                D11              -gam*eye(numc1)];

M2 = [Y*A'+A*Y+Z'*B22'+B22*Z   B1                Y*C1'+Z'*D12';
B1'                      -gam*eye(numb1)    D11';
C1*Y+D12*Z                D11              -gam*eye(numc1)];

%Constraints
Fc = (M1 <= 0);
Fc = [Fc; M2 <= 0];
Fc = [Fc; Y >= eta*eye(numa)];

opt = sdpsettings('solver','sedumi');

%Objective function
obj = gam;

%Optimizing given constraints
optimize(Fc,obj,opt);

%Displays output Hinf gain
fprintf('\n\nHinf for Hinf optimal state-feedback problem is: ')
display(value(gam))

F = value(Z)*inv(value(Y)); %#ok<MINV>

fprintf('\n\nState-Feedback controller F matrix')
display(F)