43917 - week 1

~ ()
(no date)

Hello,

I am giving a course in multivariable control this spring (43917 refers
to the course number).

The course meets weekly for 10 weeks and we then have a 4 week project.

I am sending out some information about the course to the students
as it goes along.

*** Please send me a email if you want me to keep sending you ***
*** this information. ***

ANY comments are welcome!

Best regards,
Sigurd

***************************************************************************
Sigurd Skogestad, Professor Fax: +47-7359-4080
Chemical Engineering Phone: +47-7359-4154
Norwegian University of Science and Technology Home: +47-7393-6855
N-7034 Trondheim e-mail: skoge@kjemi.unit.no
Norway http://www.kjemi.unit.no/~skoge
***************************************************************************

******************************************************
WEEK 1.
******************************************************

----------------------------------------------------
Ojectives of course:
---------------------------------------------------

Generalize classical control theory to MIMO systems.
Understand MIMO feedback.
Be able to do practical designs (Matlab)

---------------------------------------------------
Short overview of course
---------------------------------------------------

The plan for the semester is as follows:

Week 1 (24 Jan): Overview, Chapter 1 and 2.
Week 2 (30 Jan): Review of Chapter 2. Start Chapter 3. Appendix.
Week 3 (06 Feb): Finish Chapter 3.
Week 4 (13 Feb): Chapter 4 (including zeros and norms).
Week 5 (20 Feb): Chapter 5 (SISO controllability)
Week 6 (27 Feb): Chapter 6 (MIMO)
Week 7 (05 Mar): Chapter 7 (SISO uncertainty)
Week 8 (12 Mar): Chapter 8 (MIMO, Structured singular value)
Week 9 (19 Mar): Finish Chapter 8. Chapter 9. Start thinking about project!
Week 10(26 Mar): Chapter 10 and 11
Week 11 (2 Apr): Summary and approval of plan for project (item 1)
Final 4 weeks (which includes Easter): Work on project

Lectures/discussions are Tuesday 13.15-15.00

Chapters 1 and 2 are mainly intended to be read individually by the
students. Important topics are notation, scaling (!!) and classical
SISO control including understanding loopshaping in the frequency domain.
IMPORTANT! In Chapter 2 read carefully the section on Weighted sensitivity.

Chapter 3 is important for the course and gives a tutorial introduction
to MIMO control systems.

Chapter 4 covers system theory - parts of it will be covered.

Chapter 5 and 6 discusses inherent control limitations imposed by the
plan G(s) which cannot be overcome by any controller - most of this
will be covered.

Chapters 7 and 8 discusses uncertainty (how to model) and how to test
if the system is robust with respect to the uncertainty. An important
tool is the structured singular value. Most of this chapter will be
covered.

Note that there are two main approaches to get a robust design:
1. Make it robust to some general class of uncertainty. For SISO
systems one may consider GM and PM or the peak of S or T.
For MIMO systems the normalized coprime uncertainty provides
a good general class, and the corresponding Glover-McFarlane
H-infinity loopshaping design has proved useful in many applications.
2. Model the uncertainty in detail and make the system robust with
respect to it. This may require a large effort both in terms if
uncertainty modelling (in particular for parametric uncertainty)
and in terms of analysis and design (which involves the structured
singular value).

In pratice, one will therefore often start with approach 1, and
switch to approach 2 if the resulting control performance is not
satisfactory.

Chapter 9 discusses controller design. In this book we are mainly users
of the methods, so most of this material is left for a separate course.
But you should look up this material when doing practical designs for the
project.

Chapter 10 discusses control structure design and decentralized control.
We will cover parts of this in the course (it is very interesting but
we do not have time to cover everything).

Chapter 11 discusses model reduction. This is usueful for applications and
we will cover most of this (but briefly).

Chapter 12 provides three case studies.

Appemdix A gives an overview of matrix theory.

Appendix B gives the text for the project work.

----------------------------------------------------
A little about the Appendix
----------------------------------------------------

Note that matrix theory and norms overview given in Appendix.
Note in particular the eigenvalue decomposition

A = T Lambda T^-1 (T contains the eigenvectors, Lambda the eigenvalues)

and the (for us more useful) singular value decomposition (SVD)

A = U Sigma V^H (U and V contain the output and input singular values)

The first (maximum) element in the diagonal matrix Sigma is the
maximum singular value, which is equal to the induced 2-norm of the
matrix A. Note that the columns in U and V are orthonormal, but that
this is not the case for the eigenvectors in T.

Norms are used to generalize the concept of gain, and are
extensively discussed in the Appendix.

The Appendix also lists the properties of the RGA-matrix

Lambda(A) = RGA(A) = A x A^-T (x denotes element-by-element multiplication)

Note that Lambda is here used for the RGA-matrix (and NOT the eigenvalue
matrix). In the book Lambda (as a matrix) always means the RGA-matrix, and
lambda_ij (as a scalar with two indices) refers to the ij'th element in the
RGA-matrix, whereas lambda_i (as a scalar with one index) referes to the
i'th eigenvalue.

--------------------------------------------
Chapter 1.
--------------------------------------------

1.1: This course covers more than the traditional controller
design and control system analysis (steps 9-10).

1.2 Note defs of NS,NP,RS and RP

1.3 Note definition of proper, strictly proper, etc.

1.4 SCALING!! Very IMPORTANT in applications, both for model analysis
(input-output controllability) and for controller design.
Main idea: Variables are dimensionless with 1 as maximum value.

With scaling you make initial decision regarding performance.
Makes weight selection simple later (may often select identity weights
if initial scaling is reasonable!)

1.5 Linear models.

Everything in this book is based on linear models which are often obtained
by numerical differentiation of first-principle model. This is illustrated
by an example (room hesating).

1.6 Notation

Most important notation: G,K,L,S and T=I-S.

Other implementations of two deegrees-of-freedom controller: see Fig. 4.5.

General control configuration: P and K (will get back to in Chapter 3), see
for example Fig. 3.13 which shows one-degree-freedom control system in
PK-structure. P is "generalized" plant

Generalized control system: Let all signals affecting the
system (which we cannot do anything about) be collected in w (disturbances,
noise, reference changes). Let the signals we want to be small be collected
in z (typically control errors and manipulated inputs).
The control objective is then: based on measurements and
other signal information in v (including references), use a controller
(algorithm) K to generate maniuplated input signals u, such that
the norm from w to z is small (z remains small in spite of variations in
w).

Note: A reference r can be included in both w (exogeneous signals)
and v (sensed signals) and indirectly also in z (e.g. as y-r).

What other signals can be included several places?

------------------------------------------------------
Chapter 2.
------------------------------------------------------

This chapter is mostly intended for individual reading.

It is a review on classical feedback control, except for
the section on weighted sensitivity which should be read carefully.
Most of the same ideas are used for MIMO systems later.

Some points worth noting:

2.1 Nin-mimimum phase systems are systems with time delays or RHP-zeros
(inverse response for SISO system).

2.2 Note agin the definition of L, S and T and how they are related to
the closed-loop response.

2.4 The time domain specifications in Fig. 2.9 are not used later, mainly
because of difficulties in formulating easily solvable mathematical
problems.

Note maximum peaks of S and T, denoted Ms amd Mt - these are the
H-infinity norms!

Note definitions of bandwidth (wB in terms of S) and gain crossover
frequency (wc in terms of L).

2.6 Loop shaping. This is the classical trial-and-error approach where
we at the end of the section show how the phase correction step can be
"automized" by the Glover-McFarlane H-infinity loopshaping.

Note that for disturbance rejection we typically want |L|=|Gd| if we
want to avoid using excessive inputs.
For disturbances at the inputs, Gd=G, this means that we want a controller
which is a constant gain, |K|=1 (no dynamics required for performance, but
may need it for robustness, and may also want some integral action
at low frequencies).

2.7 A reasonable design specification is weighted sensitivity, p1= |wP S| < 1.
To avoid excessive inputs we also want p2= |w_u KS| small . We combine these
into sqrt(p1*p1 + p2*p2), see (2.80) which should be minimized. This is
equivalent to a mixed sensitivity (S/KS) problem as discussed in
Exercise 2.11

*** Important *** Make sure you understand the meaning of the performance
weight wp. Weight which requires slope of -1 for L at lower frequencies:

wp(s) = s/M + wB / s + wB A

M = max peak on S
wB = frequency where magnitude of S crosses 1
A = steady-state offset

Study Fig. 2.26 and 2.27 carefully !!!!

---------------------------------------------------------
Homework for this week :
--------------------------------------------------------

Use H-infinity loopshaping and H-infinity S/KS to design controllers
for the disturbance process.

More precicely: Do Exercise 2.3 AND redo Example 2.11.
(also see files given below)

This will:
1. Give a good introduction to the software (MATLAB and mu-toolbox and
robust control toolbox).
2. Introduce you to design methods which by introducing the max. singular
value can be extended directly to MIMO systems.

---------------------------------------------------------------
Some useful MATLAB files for chapter 2.
---------------------------------------------------------------

Includes:
A. Inverse response process
B. Flexible structure
C. Disturbance process (with H-infinity loopshaping design and
H-infinity weighted sensitivity, S/KS)

----------------------------
A. INVERSE RESPONSE PROCESS.
---------------------------

% This is a simple second-order plant with RHP-zero at z=2.

g=nd2sys([-2,1],[50 15 1],3);

% frequency response of G

points=301;
omega=logspace(-3,1,points);
g_f=frsp(g,omega);

vplot('bode',g_f);

% P-control

Kc=0.5
gc=mmult(g,Kc); s = minv(madd(1,gc)); t = msub(1,s);
u=1; y1 = trsp(t,u,50);

Kc=1.5
gc=mmult(g,Kc); s = minv(madd(1,gc)); t = msub(1,s);
u=1; y2 = trsp(t,u,50);

Kc=2.5
gc=mmult(g,Kc); s = minv(madd(1,gc)); t = msub(1,s);
u=1; y3 = trsp(t,u,50);

Kc=3
gc=mmult(g,Kc); s = minv(madd(1,gc)); t = msub(1,s);
u=1; y4 = trsp(t,u,50);

subplot(111),vplot(y1,y2,y3,y4,':',1)
axis([0 50 -0.5 2.5]);
text(11,1.95,'Kc=2.5'); text(14,1.3,'Kc=1.5'); text(8,0.2,'Kc=0.5');
text(10,2.35,'Kc=3 (Unstable)');
xlabel('Time');ylabel('y');

% PI-control

Kc=2.5/2.2; ti=15.2/1.2; %1.136,12.7
c=nd2sys([ti,1],[ti 1.e-4],Kc);
gc = mmult(g,c); s = minv(madd(1,gc)); t = msub(1,s);
u=1; y1 = trsp(t,u,50);
%input signal
gs = mmult(c,s); u1=trsp(gs,u,50);

subplot(111),vplot(y1,u1,1,':')
axis([0 50 -0.5 2.5]);
text(40,1.3,'OUTPUT (y)');text(40,0.0,'INPUT (-u)');
xlabel('Time');%ylabel('y');

% Nyquist plot of 1+L
ny1 = madd(1,gc_f); ny2=cjt(ny1);
subplot(111);
vplot('nyq',ny1,ny2,'--',0,':');
axis([-1,1.5,-3,3]);

% Frequency responses of L, S, T

gc_f = frsp(gc,omega);
s_f = frsp(s,omega);
t_f = frsp(t,omega);

subplot(211),vplot('liv,lm',abs(gc_f),abs(s_f),abs(t_f),1,':')
ylabel('Magnitude'); xlabel('Frequency')
axis([.01,10,.01,100])

subplot(212), vplot('liv,p',gc_f,s_f,t_f)
ylabel('Phase'); xlabel('Frequency')
axis([.01,10,-270,100])

% Find GM, PM and the peak values of $S$ and $T$

[A,B,C,D]=unpck(gc); [Gm,Pm,Wcp,Wcg]=margin(A,B,C,D)
hinfnorm(s) % find peak is 3.92 at w=0.27
hinfnorm(t) % find peak is 3.35 at w=0.26

----------------------
B. FLEXIBLE STRUCTURE
-----------------------
% This is a flexible loop shaping design with input disturbance.

omega=logspace(-2,3,410);
g1 = nd2sys([1 1.e-4], [1 1.e-4 0.25], 2.5);
g2 = nd2sys([1 1.e-4 1],[1 1.e-4 4]);
g = mmult(g1,g2); gd=g;

c=1;

l = mmult(g,c);
s = minv(madd(1,l));
sgd = mmult(s,gd);
r1=abs(frsp(l,omega));
u=1; time=20;
y1 = trsp(sgd,u,time);
yol= trsp(gd,u,time);

subplot(211),vplot('liv,lm',r1,1,':')
axis([.01,100,.01,100]);
xlabel('Frequency');ylabel('Magnitude');text(10,10, 'G = Gd')
drawnow;

subplot(212),vplot(y1,yol,0,':')
xlabel('Time');ylabel('y(t)');
text(5,1.5,'OPEN LOOP');text(13,-0.5,'CLOSED LOOP (solid line)')

---------------------------
C. DISTURBANCE PROCESS.
--------------------------

% Disturbance process

gd = nd2sys(1,[10 1],100);
g1 = nd2sys(1,[10 1],200); g2 = nd2sys(1,[0.05 1]);
g = mmult(g1,g2,g2); % g(0)=200

% Some settings
dist=1; time=3; w=logspace(-2,3,41);

c2 = nd2sys([1 2],[1 0],1); w1=c2; % PI controller with gain 1
gs = mmult(g,w1);

% Now do H-infinity loopshaping

% ALT. 1 : ROBUST CONTROL TOOLBOX (see coprimeunc.m below)
[a,b,c,d]=unpck(gs);
% Robustify this shaped plant with respect to coprime uncertainty
gamrel=1.1;
[Ac,Bc,Cc,Dc,gammin]=coprimeunc(a,b,c,d,gamrel); % see function below
cr=pck(Ac,-Bc,Cc,-Dc); % Change from positive to negative feedback

% ALT.2: USE MATLAB MUTOOLS INSTEAD
[sysk,emax]= ncfsyn(gs,gamrel); cr=mmult(-1,sysk); 1/emax

% NOW ANALYZE DESIGN:
ctotr = mmult(w1,cr);
lr = mmult(g,ctotr);

l=gs; % original shaped plant
s = minv(madd(1,l));
sgd = mmult(s,gd);
omega=logspace(-2,2,41);
rs=abs(frsp(l,omega));
sgd = mmult(s,gd); ksgd = mmult(mmult(-1,w1),sgd);
ys = trsp(sgd,dist,time); us = trsp(ksgd,dist,time);

l=lr; % robustified design
s = minv(madd(1,l));
sgd = mmult(s,gd);
rr=abs(frsp(l,omega));
sgd = mmult(s,gd); ksgd = mmult(mmult(-1,ctotr),sgd);
yr = trsp(sgd,dist,time); ur = trsp(ksgd,dist,time);

subplot(211); vplot('liv,lm',rr,rs,1,':');
axis([.01,1000,.001,10000]); drawnow;
title('LOOP SHAPES'); xlabel('Frequency');
%subplot(212),vplot(y3,ys,yr,0,':')
subplot(212),vplot(yr,ys,0,':')
axis([0,3,-0.5,1]);
title('RESPONSE TO DISTURBANCE');
xlabel('Time');ylabel('y');

% Check margins, etc.
[A,B,C,D]=unpck(gs); [Gm,Pm,Wcp,Wcg]=margin(A,B,C,D)
[A,B,C,D]=unpck(lr); [Gm,Pm,Wcp,Wcg]=margin(A,B,C,D)

% Now do "regular" mixed-sensitivity H-infinity

%weight Wp1: Require wb, slope 1 and peak less than 1.5
M=1.5; wb=10; Wp1 = nd2sys([1/M wb], [1 1.e-6]);

%weight Wp2: Require wb, slope 2 and peak less than 1.5
M=1.5; wb=10; break1 = [1/sqrt(M) wb]; break2 = [1 wb*1.e-3];
wtnum = conv(break1,break1); wtden = conv(break2,break2);
Wp2 = nd2sys(wtnum, wtden);

Wp=Wp1;
%Wp=Wp2;
Wu = 1;
G=g;

systemnames = 'G Wp Wu'
inputvar = '[ r(1); u(1)]';
outputvar = '[Wp; Wu; r-G]';
input_to_G = '[u]';
input_to_Wp = '[r-G]';
input_to_Wu = '[u]';
sysoutname = 'P';
cleanupsysic = 'yes';
sysic;

nmeas=1; nu=1; gmn=0.667; gmx=20; tol=0.001;
[khinf,ghinf,gopt] = hinfsyn(P,nmeas,nu,gmn,gmx,tol);
% Let final controller have 10% higher hinf-norm
%[khinf,ghinf] = hinfsyn(P,nmeas,nu,1.1*gopt,1.1*gopt,tol);
K=khinf;
l = mmult(g,K);
l_f = frsp(l,omega);

s = minv(madd(1,l)); t=msub(1,s);
r=abs(frsp(l,omega));
sgd = mmult(s,gd); ksgd = mmult(mmult(-1,K),sgd);
y = trsp(sgd,dist,time); u = trsp(ksgd,dist,time);
t=msub(1,s); yr=trsp(t,dist,time);

w1=minv(frsp(Wp,omega));
s1=frsp(s,omega);
subplot(111),vplot('liv,lm',s1,w1,'--',1,':');
axis([.01,100,.0001,10]);

subplot(211),vplot(yr,1,':')
axis([0,3,-0.2,1.5]);
xlabel('Time');ylabel('y');
title('RESPONSE TO CHANGE IN REFERENCE');
subplot(212),vplot(y,0,':')
axis([0,3,-0.2,1.5]);
xlabel('Time');ylabel('y');
title('RESPONSE TO DISTURBANCE');

%------------------------------------------------------------------
% For the H-infinity loopshaping with robust control toolbox:
% ******* coprimeunc.m ***************:

%function [Ac,Bc,Cc,Dc,gammin] = coprimeunc(a,b,c,d,gamrel)
%
% Finds the controller which optimally robustifies a given
% shaped plant in terms of tolerating maximum coprime uncertainty.
% Used in McFarlane-Glover H-infinity loopshaping procedure.
%
% a,b,c,d: State-space description of (shaped) plant
% gamrel: Final gamma used is gamrel*gammin [default: 1.1]
% Ac,Bc,Cc,Dc: State-space description of "robustifying" controller
% assuming positive feedback

function [Ac,Bc,Cc,Dc,gammin] = coprimeunc(a,b,c,d,gamrel)
if nargin <4,
disp('usage: [Ac,Bc,Cc,Dc] = coprimeunc(a,b,c,d,gamrel)'); return; end
if nargin <5, gamrel=1.1; end

% Find Normalized Coprime factors of the shaped plant
S=eye(size(d'*d))+d'*d;
R=eye(size(d*d'))+d*d';
Rinv=inv(R);Sinv=inv(S);

A1 = a-b*Sinv*d'*c; Q1 = c'*Rinv*c; R1 = b*Sinv*b';
[X1,X2,XAMP,XERR,XWELLPOSED,X]=aresolv(A1,Q1,R1); XWELLPOSED

A2 = A1'; Q2 = R1; R2 = Q1;
[Z1,Z2,ZAMP,ZERR,ZWELLPOSED,Z]=aresolv(A2,Q2,R2); ZWELLPOSED

% display optimal gamma
XZ = X*Z; gammin=sqrt(1+max(eig(XZ)))

% Use higher gamma
gam=gamrel*gammin; gam2 = gam*gam; gamconst = (1-gam2)*eye(size(XZ));
Lc = gamconst + XZ; Li = inv(Lc'); Fc = -Sinv*(d'*c+b'*X);
Ac = a + b*Fc + gam2*Li*Z*c'*(c+d*Fc);
Bc = gam2*Li*Z*c';
Cc = b'*X;
Dc = -d';
%---------------------------------------------------------------------