control room accelerator physics -...

47
CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Upload: others

Post on 18-Oct-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

CONTROL ROOM ACCELERATOR PHYSICS

Day 2 Introduction to Control Theory

Page 2: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Control Theory Introduction •  Control theory is an interdisciplinary branch of engineering and mathematics

that deals with the behavior of dynamical systems with inputs. When one or more output variables of a system needs to follow a certain reference over time, a controller manipulates the inputs to a system to obtain the desired effect on the output of the system.

•  A typical objective of a control theory is to calculate proper corrective action for inputs that results in system stability, that is, the system will hold the set point and not oscillate around it.

•  Branches of Control Theory •  Adaptive control: Adapt process and gain parameters to observed behavior •  Intelligent control: Application of AI techniques in controller design •  Optimal control: Controller is designed to extremize a given objective •  Robust control: Design controller to be insensitive to model errors (eg., H∞ control) •  Stochastic control: Design control to be insensitive to model uncertainties •  Energy shaping control: Plant and controller are viewed as energy transformers •  Self-organized criticality control: Controller is aware of self-organizing systems •  …

1/27/14 USPAS 2

Page 3: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Control Theory Introduction •  Control theory is relatively young and a very active research area.

•  Accelerator control utilizes very little formal control! Wide open.

•  Control theory is technical. •  Dynamical Systems •  Abstract algebra •  Functional analysis •  Signal processing •  Differential manifolds •  Abstract algebra (groups, rings, modules, …) •  Lie groups and algebras •  Representation theory (representing algebraic structure with matrices)

•  Applications in

•  Aerospace •  Automotive •  Robotics •  Biology •  Economics

1/27/14 USPAS 3

Page 4: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Outline

1.  Introduction

2.  Linear dynamical systems

3.  Modeling linear systems

4.  Control theory: Stability, observability, controllability

5.  Control examples: Perturbation and disturbance rejection

1/27/14 USPAS 4

We restrict our attention to the basic tenets of control theory and linear dynamical systems, with some examples found in accelerator control.

Page 5: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Linear Dynamical Systems Introduction

A Dynamical System is a system G that varies in time. Typically it has inputs u and outputs y. In control theory G is usually referred to as a plant.

Linear Dynamical Systems are dynamical

systems G where the input u and output y are linearly related •  If u = u1 + u2 is the input then output y is

y = G(u1 + u2) = G(u1) + G(u2)

•  Linear systems may be •  Continuous time (ODEs) •  Discrete time (delay equations) •  Typically these are related!

1/27/14 USPAS 5

Plant G u

y

plant input

plant output

Dynamical System

kkkk uybybyb

tutybtybtyb

=++

=++

−− 01122

012 )()()()( continuous time

discrete time

Page 6: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Linear Dynamical Systems Example: Linear Beam Optics, a Discrete “Time” Case

1/27/14 USPAS 6

Beam

Beamline

Φ(u1)

Φ(u2)

Φ(un-1)

Φ(un-2)

Model of Beamline (cascade of transfer matrices) Dynamical System

z0(t)

System state (e.g., beam location)

Page 7: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Linear Dynamical Systems Note on Modeling Physics and Engineering Problems

•  Most linear dynamical systems in physics and engineering are not naturally expressed in the form G(u) = y (output as function of input) •  The output y is generally a combination of differentials of itself! •  For example, consider the 2nd order linear operator L

•  Then our model appears as

•  This is a linear equation, but the wrong direction! By comparing equations we find (abstractly)

1/27/14 USPAS 7

)()()()( 012 tybtybtyby ++≡ L

uy =)(L

)()( 1 uLuGy −== What does L-1 mean?!

Page 8: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Linear Dynamical Systems The State Space Representation (Common in Control Theory) What is y = G(u) = L-1(u) for a linear differential system ? •  Start with our 2nd order linear differential equation

•  Define our state variables x1 and x2

•  Differentiate ; then differentiate x2 yielding

•  Arranging into matrix-vector format

1/27/14 USPAS 8

uybby

bbytutybtybtyb +−−==++

2

0

2

1012 or),()()()(

yxyx≡

2

1

uxbbx

bbyx +−−== 1

2

02

2

12

( ) ⎟⎟⎠

⎞⎜⎜⎝

⎛=

⎟⎟⎠

⎞⎜⎜⎝

⎛+⎟⎟⎠

⎞⎜⎜⎝

⎟⎟⎟

⎜⎜⎜

−−=⎟⎟⎠

⎞⎜⎜⎝

2

1

2

1

2

0

2

12

1

01

1010

xx

y

uxx

bb

bb

xx

dtd

x1 = y = x2

)()()()()(

ttttt

CxyBuAxx

=

+=This has form

output

Page 9: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Linear Time-Invariant Dynamical System State Space Representation

•  The general representation of an nth-order Linear Time-Invariant (LTI) dynamical system is (for continuous case)

•  A, B, C, D are matrices of the appropriate dimensions

•  x is the state vector (plant internal dynamics – e.g., the beam) •  y is the output vector (sensor output, what we can observe – e.g., BPM response) •  u is the input vector (actuator input – e.g., magnet strengths)

•  Often we drop the matrix D since we can renormalize output y

•  The above is called the state space representation

1/27/14 USPAS 9

x(t) =Ax(t)+Bu(t), x(t)∈ Rn, y(t)∈ Rm, u(t)∈ R p

y(t) =Cx(t)+Du(t), A ∈ Rn×n, B∈ Rn×p, C∈ Rm×n, D∈ Rm×py = G(u)

Page 10: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

¡  The matrices A, B, C determine plant properties l  Matrix A determines the internal plant dynamics l  Matrix B determines how input affects internal dynamics l  Matrix C determines coupling between internal dynamics and output

LTI Dynamical System Block Diagram of State Space Representation

x

1/27/14 USPAS 10

Internal Dynamics (beam dynamics)

A

x B

Actuators (correctors)

C

Sensors (BPMS)

u y input output

x =Ax+Buy =Cx

Page 11: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

LTI Dynamical System Solution to the State Equations

Solution to state vector equations is

•  This is completely analogous to the scalar case

•  Internal dynamics x(t) are the sum of natural system response etA and the natural response convolved with the driving term Bu(t) •  Note A is square and the matrix exponential function etA is well-defined

•  Thus, the system dynamics are dictated by the matrix etA •  The control properties are dictated by matrix B •  The observation properties are dictated by matrix C

1/27/14 USPAS 11

x(t) =Ax(t)+Bu(t) A ∈ Rm×m, B∈ Rm×n

y(t) =Cx(t) C∈ Rk×m

x(t) = etAx0 + e(t−τ )ABu(τ )dτ0

t

∫y(t) =Cx(t)

x(t) = ax(t)+ bu(t), y(t) = cx(t)

Page 12: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

LTI Dynamical System Discrete Case

•  For discrete case the state representation looks like

•  The solution to the state variable equation is

•  This solutions is analogous to the continuous case, only the natural response is dictated directly by matrix Ak rather than etA, as we shall see.

1/27/14 USPAS 12

kk

kkk

CxyBuAxx

=

+=+1

∑−

=

−−+=1

0

10

k

ik

ikkk BuAxAx

Page 13: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

0 0

uqh (ush1,usv1) uqv (ush2,usv2)

(x,y,z)Qh S1 S2Qh Qv QvD1

D2

LTI Dynamical System Example: Discrete State Space Modeling Beam Steering

Say we have Beam Position Monitors (BPMs) as our sensors, then our observables are the coordinates (x,y,z); that is, we do not have access to the full state vector – no momentum components.

Note state vector z and observation vector y •  State vector z = (x, x’,y,y’,z,z’)

•  Observation vector

•  Then

•  where

•  With {Φk} as the transfer matrices, our modeling equations are

1/27/14 USPAS 13

( )Tzyx≡y

yk =Czk (t)

⎟⎟⎟

⎜⎜⎜

010000000100000001

C

zk+1 =Φk (uk )zkyk =Czk

These are in the form of the discrete state space representation

Page 14: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Control Theory Application of Control Theory to Dynamical Systems OUTLINE

• Dynamical System •  Stability •  Controllability •  Observability

• Control •  Closed-loop/Open-loop •  Regulator •  State Observer •  PID Control

1/27/14 USPAS 14

Page 15: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Control Theory Stability

•  Loosely, the stability of a dynamical system at equilibrium point y0 indicates that the output y(t) always “stays near” y0 for sufficiently small inputs u(t).

•  A linear system is stable if all bounded inputs u produce bounded outputs y (||u(t)|| < ∞ => ||y(t)|| < ∞ all t)

•  If the system eventually returns to y0, it is said to be asymptotically stable: the variables of an asymptotically stable control system do not permanently oscillate.

•  If the response to an input u(t) neither decays nor grows over time, it is marginally stable. The output may oscillate indefinitely about y0 but will not blow up.

•  Otherwise the system is unstable.

1/27/14 USPAS 15

See http://vimeo.com/2952236

•  Examples •  An ideal pendulum is marginally stable at y0 = 0˚ •  A damped pendulum is asymptotically stable at y0 = 0˚ •  An (inverted) pendulum is unstable at y0 = 180˚

•  However, we can stabilize an inverted pendulum with

active stabilization u(t) = u[y(·),t] •  “Fly by wire” •  (Stability is the opposite of maneuverability)

Page 16: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Control Theory Controllability

Roughly speaking, the concept of controllability denotes the ability to move a system around in its entire configuration space using only certain admissible inputs. The exact definition varies slightly within the framework or the type of models applied.

For us, controllability means there exists at least one valid control strategy u(·) : R+ → Rp that brings the system to any output y ∈ Rm.

1/27/14 USPAS 16

Is the Rubik’s cube controllable?

G(u)

y(t)

u(t) y

Page 17: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Control Theory Observability

•  Informally, observability is a measure of how well the internal states x of a system can be inferred by knowledge of its external outputs y.

•  More formally, a system is said to be observable if, for any possible sequence of control vectors u(·) we can determine the current state x(t) in finite time t < ∞ only by watching the outputs y(·). Note we know both u(t) and y(t) for all t.

1/27/14 USPAS 17

•  If a system is not observable, this means the current values of some of its states cannot be determined through output sensors. Their value is unknown to the controller (although they might be estimated through various means).

•  The observability and controllability of a system are mathematical duals.

•  The concept of observability was introduced by American-Hungarian scientist Rudolf E. Kalman for linear dynamic systems.

Page 18: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

¡  The matrices A, B, C determine plant properties l  Matrix A determines stability (we cover this) l  Matrices A and B determine controllability (outputs we can reach) l  Matrices A and C determine observability (watching the output says?)

Internal Dynamics (beam dynamics)

Control Theory Stability, Controllability, and Observability of an LTI System

x

1/27/14 USPAS 18

A

B u y

C

x

Actuators (correctors)

Sensors (BPMS)

input output

x =Ax+Buy =Cx

Page 19: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

•  Consider the scalar case •  x(t), y(t), a, b, c ∈ R

•  “Solution” to is

•  Differentiate to prove it (Exercise) •  Internal dynamics are the sum of natural response eat x0 at initial condition x0,

plus the natural response convolved (“folded”) with the driving term bu(t).

•  Finally, system solution y(t) is proportional to x(t),

Control Theory An Example LTI System: Continuous Scalar System

1/27/14 USPAS 19

x(t) = ax(t)+ bu(t)y(t) = cx(t)

)()()( tbutaxtx +=

x(t) = eat x0 + ea(t−τ )bu(τ )dτ0

t

y t( ) = cx(t) = ceat x0 + c ea(t−τ )bu(τ )dτ0

t

= ceat x0 + b e−aτu(τ )dτ0

t

∫#

$%

&

'(

Page 20: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Observability •  So long as c ≠ 0

Controllability •  So long as b ≠ 0

Infer about Matrix-Vector Systems •  Look at eigenvalues/singular values of A, B, C

•  Positive eigenvalues of A indicate instability •  Zero singular values of B indicate uncontrollable modes •  Zero singular values of C indicate unobservable modes

Stability

Control Theory Stability, Controllability, and Observability of Example System System

With solution

•  For natural response [eat term] •  a > 0 eat unbounded •  a = 0 eat is stable •  a < 0 eat decays

1/27/14 USPAS

20

cxybuaxx

=

+=

Unstable Asymptotically stable

Marginally stable

y(t) = ceat x0 + c ea(t−τ )bu(τ )dτ0

t

a 0

Scalar Stability Region

Stability with Inputs •  Consider driven response (u ≠ 0)

•  Note (t - τ) > 0 so ea(t - τ) amplifies or attenuates u(t) according to whether a > 0 or a < 0, respectively.

•  Thus, system is stable iff a ≤ 0. •  Stability dominated by natural response eat

eatx0

x0

Stable system iff a ≤ 0

Page 21: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Control Theory Stability, Controllability, and Observability of the General LTI System

Solution to vector equations is

•  This is completely analogous to the scalar case

•  Again, internal dynamics are the sum of natural response etA plus the natural response convolved with the driving term Bu(t) •  Note A is square and the matrix exponential function etA is well-defined

•  The state dynamics are dictated by the matrix H(t) = etA •  The control dynamics are dictated by matrix B •  The observation dynamics are dictated by matrix C

•  Positive eigenvalues of A indicate instability •  Zero singular values of B indicate uncontrollable modes •  Zero singular values of C indicate unobservable modes

1/27/14 USPAS 21

x(t) =Ax(t)+Bu(t) A ∈ Rm×m, B∈ Rm×n

y(t) =Cx(t) C∈ Rk×m

y(t) =CetAx0 +C e(t−τ )ABu(τ )dτ0

t

Page 22: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Unstable: exponentially

increasing

Control Theory Stability of Continuous LTI Systems

•  Let λ be an eigenvalue of A •  Dynamics of eigenmode eλ are determined by etλ

•  λ on the complex plane

then

•  A finite imaginary part of λ (ω≠0) implies oscillation •  A zero imaginary part of λ (ω=0) implies none

•  A negative real part of λ (σ<0) indicates exponential

decay – asymptotically stable

•  A positive real part of λ (σ>0) indicates exponential growth – unstable

1/27/14 USPAS 22

Re λ = σ

Im λ = ω

Marginally stable, oscillatory

Asymtotically stable: exponentially

decreasing

Non-oscillatory Let λ =σ + jω σ ,ω ∈ R

etλ = eσ t cosωt + ieσ t sinωt

Page 23: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Control Theory Controllability of LTI Systems •  The LTI state solution

•  Recall system is controllable iff we can steer to any output η ∈ Rn •  There exist a u1(•) and t1 > 0 such that y[t1;u1(t1)] = η .

•  LTI controllability criteria: 1.  Matrix etAB has full row rank (true?) 2.  Augmented matrix [B | AB | … | An-1B] has full row rank

•  That is, there are n linearly independent columns 3.  Show 2. implies 1. (hint, expand etA)

1/27/14 USPAS 23

x(t) = etAx0 + e(t−τ )ABu(τ )dτ0

t

Page 24: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Control Theory Observability of an LTI System •  The LTI output solution

•  Recall system is observable iff we can deduce the system state x ∈ Rm by observing input u(•) and output y(•) for finite t>0.

•  LTI observability criteria: 1.  Matrix CetA has full row rank 2.  Augmented matrix [CT | (CA)T | … | (CAk-1) T]T has full row rank

•  That is, there are n linearly independent columns 3.  Show 2. implies 3. (hint, expand etA)

1/27/14 USPAS 24

x(t) = etAx0 + e(t−τ )ABu(τ )dτ0

t

∫y(t) =Cx(t)

CCA

CAk−1

"

#

$$$$$

%

&

'''''

Page 25: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Control Theory The Discrete LTI Dynamical System •  The state solution to discrete LTI system

is

•  The important point is that the natural response is dictated by matrix power Ak rather than the matrix exponential etA as before.

•  The state dynamics are dictated by the matrix Hk = Ak •  By diagonalizing we have Ak = TΛkT-1 •  The dynamics are controlled by eigenvalue powers λk rather than etλ

1/27/14 USPAS 25

kk

kkk

CxyBuAxx

=

+=+1

∑−

=

−−+=1

0

10

k

ik

ikkk BuAxAx

Page 26: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Stability of LTI System Discrete Systems •  Let λ be an eigenvalue of A

•  Dynamics of eigenmode for λ are determined by value of λk

•  Magnitude-angle representation of λ on the complex plane

•  That is, ρ = |λ|, and θ =ang λ

•  This yields

•  θ = 0 indicates no oscillation

•  |λ| = 1 indicates (marginally) stable oscillation

•  |λ| < 1 indicates exponential decay

•  |λ| > 1 indicates exponential growth

1/27/14 USPAS 26

Let λ = ρe jθ ρ,θ ∈ R

Unstable: exponentially

increasing

Non-oscillatory

Re λ

Im λ

+1 -1

-i

+i

Asymtotically stable: exponentially

decreasing λ k = ρ ke jkθ = ρ k coskθ + iρ k sinkθ

Looks like a Z transform

Stable, oscillatory

Page 27: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Control Theory Controllability and Observability of a Discrete LTI System •  State solution to the discrete LTI system

•  The system is controllable iff we can steer to any state η ∈ Rn •  There exists a k > 0 and sequence {u0, u1, …, uk-1} such that yk = η .

•  LTI controllability criteria: 1.  Matrix (I+A+…+Am-1)B has full row rank 2.  Augmented matrix [B | AB | … | Am-1B] has full row rank

•  That is, there are n linearly independent columns

•  Observability is analogous to the continuous case •  Augmented matrix [CT | (CA)T | … | (CAk-1) T]T has full row rank

1/27/14 USPAS 27

xk =Akx0 + Ak−1−iBui

i=0

k−1

Page 28: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Classical Control Example Stabilization: The Role of Feedback

•  Typically in classical control we pick a feedback control law of the form

u(t) = Ky(t)

•  The matrix K is chosen to move the system response (eigenvalues λ1 and λ2 of A) from the right half-plane to the left half-plane •  Location in C determines feedback response •  Open loop stability depends upon •  Closed loop stability depends upon •  Show this!

1/27/14 USPAS 28

Re λ

Im λ

Asymtotically stable: exponentially

decreasing

Unstable: exponentially

increasing

λ1

λ2

Note: “Classical Control” refers to the use of transfer functions in frequency domain to design feedback loops. Modern methods are more general, more applicable, and do not necessarily involve feedback

feedback

λ1

λ2

etA

et (A+KCB)

Page 29: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Classic Control Example: Disturbance Rejection • What if control signal u(t) is perturbed by a small amount δu(t)?

•  That is u → u + δu

•  Let us choose a special perturbation

•  Then the (open loop) perturbed response is given by

1/27/14 USPAS 29

⎪⎩

⎪⎨

>+

<

= ∫ −1

)(

1

1 for)(

for)(

)(

1

ttdet

ttt

tt

t

t Bvx

x

x A ττ

t

δu(t) =0 ∈ Rm   for t < t1v ∈ Rm for t > t1

"#$

%$

x(t)

x1(t)

x0

t1

Bv

Page 30: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Closed System

x(t) =Ax(t)+Bu(t) A ∈ Rm×m, B∈ Rm×n

y(t) =Cx(t) C∈ Rk×m

e(t) = y(t)− y0u(t) =Ke(t)                   K ∈ Rm×k

Classical Control Example Linear Regulator with Disturbance Rejection

1/27/14 USPAS 30

Σ

Controller K e error Dynamical

System (beamline)

environmental disturbance

δu Plant G

user output/

“readback”

u y plant input

plant output

(beam position)

Δ

user input/ “set-point”

y0

(desired beam position) Controller

•  How do we get this to work??? •  How fast to react? •  Ignore certain frequencies? •  etc.

Page 31: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Classical Control Example Design of Linear Regulator

•  Recall governing equations for continuous LTI plant with linear feedback K

•  Let’s try a scalar example •  a = 1, b = 1 •  c = ½,

•  Choose •  y0 = 2 •  δu = 3

•  Feedback •  k = ??

1/27/14 USPAS 31

x(t) =Ax(t)+Bu(t) A ∈ Rm×m, B∈ Rm×n

y(t) =Cx(t) C∈ Rk×m

e(t) = y(t)− y0u(t) =Ke(t)                   K ∈ Rn×k

Pick k = -3/2 a+bkc = 1+1(-3/2)½ = ¼

Pick k = -3 a+bkc = 1+1(-3)½ = -½

Stability governed by matrix A + BKC

x(t) =Ax(t)+BKe(t)      =Ax(t)+BK Cx(t)− y0( )       = (A+BKC)x(t)−BKy0

Page 32: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Classical Control – A Final Word The Transfer Function

•  Transfer function H(s) of plant G is input/output relation in frequency domain •  Take Laplace transform ∫ · e-stdt of everything in sight (s is on the right half plane)

•  Stability of H(s) requires that s cannot be an eigenvalue of A •  This will not happen if all eigenvalues are on the left half plane as before!

•  Lets apply this to the perturbed regulator

•  It can be shown this is equivalent to existence of for Re(s) > 0

1/27/14 USPAS 32

sx(s) =Ax(s)+Bu(s)y(s) =Cx(s)

⇒ y(s) =C A− sI( )−1Bu(s) ⇒    H(s) ≡C A− sI( )−1B

e =Hu− y0u = δu+Ke

have solution eu

!

"#

$

%&=

0 (I−HK)−1H(I−KH)−1K (I−KH)−1

!

"

##

$

%

&&y0δu

!

"##

$

%&&Loop equations

Thus, the regulator is stable if (I - KH)-1 exists and is stable for all s (or equivalently (I - KH)-1 )

I −K(s)−H(s) I

"

#$$

%

&''

−1

Page 33: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Control and LTI Systems Review

•  Most LTI system can be put into state variable form •  First-order, n-dimension matrix-vector ODE or difference equation

•  For continuous case stability is determined by the matrix exponential etA

•  For discrete case stability is determined by the matrix power Ak

•  Stability ⇒ Where are the eigenvalues of A!?

•  Closed loop stability depends upon A + BKC

1/27/14 USPAS 33

Page 34: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Supplemental Material • More detail on Linear System theory

1/27/14 USPAS 34

Page 35: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Accelerator Control Controlling a “Deadbeat System”

• Controlling accelerator systems is atypical •  Individual shots cannot be controlled (speed of light) •  Shots are correlated •  Noise •  Discrete systems in location index k •  Continuous systems in time t •  Sampled systems in time tk

• Many applications require “deadbeat controllers” •  Feedback control that steers system to set-point in fewest number of steps

•  Matching •  Orbit correction •  Twiss parameter observer

1/27/14 USPAS 35

Page 36: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Accelerator Control A Beam Position State Observer

1/27/14 USPAS 36

Page 37: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Accelerator Control Perturbations: Control and Orbit Difference •  The former type of perturbation (of the control signal) is of the

type used for orbit difference applications •  A magnet value along the beamline is perturbed from its nominal value. •  The perturbed orbit remain identical to the nominal orbit until it reaches

the perturbed magnet, from there it diverges according to the effects of the magnet

•  By subtracting the nominal trajectory from the perturbed trajectory we can observe the first-order response of the magnet

•  We may perform the same procedure using a model of the beamline then compare the two magnet responses. Such a tool is valuable in diagnosing beamline irregularities.

1/27/14 USPAS 37

Page 38: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Linear Dynamical Systems Motivation •  The material on stability and control is important for…

•  Light sources, where beam positions must be maintained to tight tolerances

•  RF systems where, for example, resonant tuning is essential in a highly disruptive environment

• We restrict the analysis to linear dynamical systems, however… Most beamlines are designed to be linear systems •  At least most be treated as such •  The XAL online model is designed using these principles.

1/27/14 USPAS 38

Page 39: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

The State Representation Putting Linear Differential Equations in State Variable Form

Earlier we questioned the meaning of y = G(u) = L-1(u), well here it is…

•  Start with our 2nd order linear differential equation

•  Define our state variables x1 and x2

•  Differentiate x2 yielding

•  Arranging into matrix-vector format

1/27/14 USPAS 39

uybby

bbytutybtybtyb +−−==++

2

0

2

1012 or),()()()(

yxyx≡

2

1

uxbbx

bbyx +−−== 1

2

02

2

12

( ) ⎟⎟⎠

⎞⎜⎜⎝

⎛=

⎟⎟⎠

⎞⎜⎜⎝

⎛+⎟⎟⎠

⎞⎜⎜⎝

⎟⎟⎟

⎜⎜⎜

−−=⎟⎟⎠

⎞⎜⎜⎝

2

1

2

1

2

0

2

12

1

01

1010

xx

y

uxx

bb

bb

xx

dtd

)()()()()()(tttttt

DuCxyBuAxx

+=

+=This has form

Page 40: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Eq: Constant Coefficient ODE (cont.) • Thus, 2nd order equation

in standard form

has the state representation where

1/27/14 USPAS 40

)()()()( 012 tutybtybtyb =++ )()()()()()(tttttt

DuCxyBuAxx

+=

+=

( ) 0,01

10

,10

2

0

2

1

==

⎟⎟⎠

⎞⎜⎜⎝

⎛=

⎟⎟⎟

⎜⎜⎜

−−=

DC

BAbb

bb

• The state representation is generally easier to solve on the computer.

• There is a plethora of literature on the state representation properties.

Page 41: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

The Matrix Exponential What is etA?

•  Say square matrix A admits a diagonalization

•  For example,

•  Then etA has a very simple form

•  The explicit form of etΛ is very easy to compute…

1/27/14 USPAS 41

,...),diag(),(,21

1

λλ=

⊂∈Λ=

×−

ΛTTTA

nnnGL

( ) ( )

1

133

22

31321

21

322

3221

−Λ

−−−Λ

=

⎟⎟⎠

⎞⎜⎜⎝

⎛+

⋅+++=

+Λ⋅

+Λ+Λ+==−

TT

TΛΛΛIT

TTTTTTITTA

t

tt

e

ttt

tttee

1

1111

3001

1111

1221 −

⎟⎟⎠

⎞⎜⎜⎝

⎛−⎟⎟⎠

⎞⎜⎜⎝

⎛−⎟⎟⎠

⎞⎜⎜⎝

⎛−=⎟⎟

⎞⎜⎜⎝

⎛=A

[ ] 11

32

3211

211

−− Λ=Λ

+⋅⋅

+++=

TTTT nn

a aaae …

Formulae:

Page 42: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Matrix Exponential Exponential of a Diagonal Matrix

•  Let Λ be diagonal with entries {λi}, then

•  The stability (behavior) of etΛ and, hence, etA = TetΛT-1 is completely determined by the eigenvalues of A according to etλ

•  The matrix T determines coupling between these natural modes

1/27/14 USPAS 42

⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

=

⎟⎟⎟⎟⎟⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜⎜⎜⎜⎜⎜

==

∑∞

=

=

=

=nt

t

t

in

n

i

i

n

i

i

n

i

i

u

it

e

ee

it

it

it

ite

λ

λ

λ

λ

λ

λ

2

1

0

20

10

0

!

!

!

!ΛΛ

Page 43: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Matrix Exponential Notes on the General Case

•  Say A is not diagonalizable •  A Jordon form always exists so that A = TΛT-1 where Λ is the Jordan

block diagonal matrix (Λ has 1’s to the right of the diagonal)

•  Once again etA = TetΛT-1

•  The exponential etΛ is not as easy to compute this time but the qualitative results are the same. •  (Λ is triangular and we have terms like λketλ floating around) •  The eigenvalues {λi} of A (the diagonal of Λ) determine the stability of the

system according to etλ •  The matrix T determines the coupling between the natural modes of the system

1/27/14 USPAS 43

Page 44: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Matrix Exponential Notes on the General Case (continued)

•  Singular value decomposition does not work for decomposing the matrix exponential

•  Factor A = UDVT where D is the diagonal matrix of singular values and now U and V are both in SO(n) since A is square

•  However, since VTU ≠ I in general, etA ≠ UetDVT •  For example, (UDVT)2 = (UDVT) (UDVT) ≠ UD2VT

• However, Jordan decomposition always exist and allow for generalized eigenvalues, i.e., eigenvalues with value zero. •  The natural modes for zero eigenvalues are called the center manifold of

the dynamical system

1/27/14 USPAS 44

Page 45: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

The Matrix Exponential Existence

• Define exponential of a square matrix A by Taylor series

•  Note for any A and t < ∞ that

•  In fact for induced norm ||⋅|| and

1/27/14 USPAS 45

+⋅

+++=≡∑∞

=

33

22

0 322!AAAIAA ttt

nte

n

nn

t (well-defined operations)

0!

⎯⎯ →⎯∞→n

nn

nt A (well-defined values)

)(maxmax AA Λ=≤ λ

max

3max

32max

2

max

33

22

0

3221

322!

λ

λλλ

t

n

nn

t

e

ttt

tttnte

=

+⋅

+++≤

+⋅

+++≤= ∑∞

=

AAAIAA

Page 46: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Linear Systems: A Note on the Time-Varying Case

•  The homogeneous solution is the generalization of the one-dimensional ODE

•  If the coefficient a is a function of time, a = a(t), then the solution to the scalar ODE is

•  This does not generalize! •  The solution to is given by x(t) = Φ(t,0)x0 where Φ(t,0) is given by the Peano-Baker series

•  (It is possible to define and say )

1/27/14 USPAS 46

0)( xx Atet =0)0();()( xxtaxtx ==

0)(

0)( xetxt

da∫=ττ

( ) ∫≡t

t daaL0

)( ττ ( ))()0,( tet tL AΦ =

0)0();()()( xxxAx == ttt

∫ ∫ ∫∫ ∫∫ ++++=t t tt tt

dtdtdttttdtdtttdttt0

10

20

33210

10

2210

11

1 21

)()()()()()()0,( AAAAAAIΦ

Page 47: CONTROL ROOM ACCELERATOR PHYSICS - USPASuspas.fnal.gov/materials/14Knoxville/Day2-Lec2-IntroToControlTheory... · CONTROL ROOM ACCELERATOR PHYSICS Day 2 Introduction to Control Theory

Transfer Function Approach Relationship of H(t) and Ĥ(s)

•  Recall that in frequency domain x and u are related by

where Ĥ(jω) is the Laplace transform of etA evaluated at s = jω.

•  If A is diagonalizable, i.e., A = TΛT-1, then

•  Thus, Ĥ(s) has “poles” at s = {λi} = Λ(A) •  By the Residue Theorem and Laplace Transform

•  If the poles are in the right half plane Ĥ(jω) does not exist (is unstable) •  If the poles are in the left half plane Ĥ(jω) exists for all ω (is stable)

1/27/14 USPAS 47

)(ˆ)(ˆ)(ˆ ωωω jjj uBHx =

( ) ( ) ( ) ( ) )(maxRefor)(ˆ 1

0

1

00

AAIAIH AIAIA Λ>−=−−=== −∞=

=

−−−∞

−−∞

− ∫∫ ssesdtedteest

tststtst

( ) TΛITH 11)(ˆ −− −= ss