<<

An Overview of and Digital

Luca Matone Columbia Experimental Gravity group (GECo) LHO Jul 18-22, 2011 LLO Aug 8-12, 2011 LIGO-G1100863 Syllabus (tentative)

Day Topic Textbooks Control theory: Physical systems, models, linear systems, block Chau, Pao C. Process Control: 1 diagrams, differential equations, feedback loops, cruise control A First Course with MATLAB®. example, MATLAB implementation. Cambridge University Press, Control theory: and its inverse , transfer 2002. ISBN 0-521-00255-9. functions, partial fraction expansion, first-order and second- 2 order systems, dynamic response, bode plots, stability criteria, Ingle, Vinay K. and John G. MATLAB implementation. Proakis. Digital Signal Processing using Matlab®. Control theory: robustness, typical compensators, noise Brooks/Cole 2000. ISBN 0- 3 suppression, one arm cavity lock example, MATLAB 534-37174-4. implementation and time-domain simulations with SIMULINK. Smith, Steven W. The Scientist DSP: Discrete-time signals and systems, impulse response, and Engineer’s Guide to system stability, and correlation, differential to Digital Signal Processing. 4 difference equations, the Z transform, the Discrete-time Fourier California Technical Transform (DTFT), the Discrete (DFT), MATLAB Publishing 1999. implementation. http://www.dspguide.com/ DSP: The Fast-Fourier Transform (FFT), power , sampling theorem, aliasing, analog-to-digital transformations, 5 digital filtering, FIR filters, IIR filters, moving average filter, filter design, ADC and DACs, MATLAB implementation. LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 2 Objective Control System • Manages and regulates a set of variables in a system – SISO – single-input-single- output – MIMO – multiple-input- multiple-output • A quantity is measured then controlled • Requirements – Bandwidth – Rise time – Overshoot – Steady state error – …

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 3 Objective Digital Signal Processing • Measure and filter an analog signal • Digital signal – Created by sampling an analog signal – Can be stored • Analog filters – Cheap, fast and have a large dynamic range in both amplitude and frequency • Digital filters – Can be designed and implemented “on- the-fly” – Superior level of performance. • Example: a low pass can have a gain of 1 ± 0.0002, a frequency cutoff at 1000 Hz, and a gain of less than 0.0002 for frequencies above 1001 Hz. A transition of 1 Hz! LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 4 Control Theory 1

• Given a physical system – Objective: sense and control a variable in the system • Examples – As basic as • a car’s cruise control (SISO) or – Not so basic as • Locking the full LIGO interferometer (MIMO)

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 5 Example: Cruise Control Direction of motion Normal • Objective force (n) – Car needs to maintain Friction Force from a given speed engine (f) force (ffr) • Physical system includes – car’s inertia Weight – friction (mg)

Force or free body diagram: allows to analyze the forces at play

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 6 Physical model • Physical system described Direction of motion by the following equation Normal of motion force (n) Friction Force from 푓 = 푓 − 푓푓푟 = 푚푎 engine (f) force (ffr) ∥ 푡표 푟표푎푑 • Simplifying and assuming friction force 푓푓푟 is Weight proportional to speed (mg) 푓푓푟 = 푏푣 푑푣 푚푎 = 푚 = 푓 − 푏푣 푑푡

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 7 First-order differential equation Direction of motion • Solving for first-order differential equation (assuming 푓 is a constant) Friction Engine force (f ) force (f) fr 푑푣 푚 = 푓 − 푏푣 푑푡 Speed at regime yields the solution Time 푣푟 = 푓/푏 constant −푡/휏 푣 = 푣푟 1 − 푒 휏 = 푚/푏

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 8 MATLAB implementation The linear differential equation describing the Direction dynamics of the system of motion 푑푣 푚 = 푓 − 푏푣 푑푡 Friction Engine force (f) force (ffr)

Using MATLAB’s Symbolic Math Toolbox

>> dsolve('m*Dy=f-b*y','y(0)=0') ans = (f - f/exp((b*t)/m))/b

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 9

−푡/휏 Results: 푣 = 푣푟 ∙ 1 − 푒 푚 = 1000 푘푔 푏 = 50 푘푔 푠

푓 = 500 푁 c 푓 푚 ruise_timedomain.m 푣 = = 10 푟 푏 푠

푣 τ = 63% ∙ 푣푟

푚 τ = = 20 푠 푏

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 10 Block diagram: representing the physical system • To illustrate a cause-and-effect relationship • A single block represents a physical system • Blocks are connected by lines – Lines represent how signals flow in the system • In general, a physical system G has signal x(t) as input and signal y(t) as output • G is the of the system x(t) y(t) G

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 11 Car’s body

Transfer function G represents the car’s body – G converts the force from the engine 푓 (input signal, 푁) to the car’s actual speed 푣 (output signal, 푚/푠) 푣 = 퐺 ∙ 푓 푏 1 − 푡 with G = (1 − 푒 푚 ) 푏 – Units: 푠 푘푔 f(t) v(t) G

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 12 Setting the desired speed • Second transfer function H (the controller)

– Converts the desired speed (or reference) 푣푟 to a required force 푓 – Sets the throttle – For simplicity, H is set to a constant 푓 = 퐻 ∙ 푣 푟 → 푣 = 퐺 ∙ 퐻 ∙ 푣 푣 = 퐺 ∙ 푓 푟 – 퐺 ∙ 퐻 must be dimensionless vr f v H G

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 13

Plotting results • With 퐻 = 푏 the actual speed is the reference: 푣 = 푣푟 • Simulate: setting desired speed to 25 m/s (55 mph) cruisefeedback_timedomain.m Generated force by controller H

Resulting speed v

Desired speed vr

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 14 Introducing a disturbance – a hill

• In the presence of a hill the equation of motion needs to be re-visited Direction Force from of motion engine (f) • Assuming a small angle θ 푑푣 푚 = 푓 − 푏푣 − 푚푔 ∙ θ 푑푡

Weight Friction θ force (f ) (mg) Added term fr

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 15 Introducing a disturbance – a hill Assuming 푓 and 휃 are constants 푑푣 푚 = 푓 − 푏푣 − 푚푔 ∙ θ 푑푡

Direction Force from of motion engine (f)

푣 = 퐺 ∙ 푓 − 푚푔 ∙ θ

Friction Weight ϑ (mg) force (f ) fr Added term

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 16 Modifying the block diagram

푣 = 퐺 ∙ 푓 θ 퐾 = 푚푔

푣 = 퐺 ∙ 푓 − 퐾 ∙ 휃 K

vr f + - v H G

Summation junction

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 17 Modifying the block diagram

푣 = 퐺 ∙ 푓 θ 퐾 = 푚푔

푣 = 퐺 ∙ 푓 − 퐾 ∙ 휃 K

vr f + - v H G

Summation junction

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 18 Plotting results Setting desired speed to 25

m/s and slope of 휃 = 5° cruisefeedback_timedomain.m

Generated force by controller H

Resulting speed v

Desired speed

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 19 Negative Feedback 1. Let’s measure the car’s speed and 2. Correct for it by feeding back into the system a measure of the actual speed 푣 θ

K Error signal e - + vr f + v H G -

c Correction signal

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 20 Negative Feedback 1. Let’s measure the car’s speed and 2. Correct for it by feeding back into the system a measure of the actual speed 푣 θ Error signal e: the difference between the desired speed and K the measured speed. If null, then 풗 = 풗풓 + e f + - v vr H G -

c Correction signal c: in this case it is just a measure of the actual speed LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 21 Negative feedback

• Plot of force vs. time and speed vs. time with negative feedback cruisefeedback_timedomain2.m • Setting 퐻 = 103 푘푔/푠 • Result: – Faster response with feedback (compare blue against red curves) – Speed at regime: 23 푚/푠 (error of ~10%)

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 22 Negative feedback

• Increasing the controller’s gain (H) – decreases the rise time cruisefeedback_timedomain3.m – while decreasing the steady state error • Setting 퐻 = 104 푘푔/푠 • Result: – Even faster response

– Speed at regime:

24.8 푚/푠 (error of ~1%)

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 23 Signal flow and block diagrams

푣 = 퐺 ∙ (푓 − 퐾 ∙ 휃) 푓 = 퐻 ∙ 푒 푒 = 푣푟 − 푐 θ

K

v + e f + - v r H G -

c

푐 = 푣 LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 24 푒 = 푣푟 − 푐 = 푣푟 − 푣 System’s open = 푣푟 − 퐺 ∙ 푓 − 퐾 ∙ 휃 loop gain = 푣푟 − 퐺 ∙ 퐻 ∙ 푒 − 퐾 ∙ 휃 (dimensionless)

θ

1 퐾 ∙ 퐺 푒 = ∙ 푣 + ∙ 휃 K 1 + 퐺 ∙ 퐻 푟 1 + 퐺 ∙ 퐻 v + e f + - v r H G -

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signalc Processing (1) 25 1 퐾 ∙ 퐺 푒 = ∙ 푣 + ∙ 휃 1 + 퐺 ∙ 퐻 푟 1 + 퐺 ∙ 퐻 퐈퐅 퐺 ∙ 퐻 ≫ 1 (high gain, closed loop, with feedback) 퐾 ∙ 퐺 퐾 퐈퐅 퐺 ∙ 퐻 ≪ 1(low 푒 ≈ 0 ∙ 푣 + ∙ 휃 ≈ 휃 푟 퐺 ∙ 퐻 퐻 gain, open loop, or no θ Error signal in closed loop: close to feedback) zero, proportional to angle 휃 퐾 푒 = 휃 K 퐻 푒 ≈ 1 ∙ 푣푟 + 퐾 ∙ 퐺 ∙ 휃 The higher the controller’s gain, the lower e v + e f + - v r H G -

26 LIGO-G1100863 Matone: An Overview ofc Control Theory and Digital Signal Processing (1) 푣 = 퐺 ∙ 퐻 ∙ 푒 − 퐾 ∙ 퐺 ∙ 휃

= 퐺 ∙ 퐻 ∙ (푣푟 − 푣) − 퐾 ∙ G ∙ 휃

= 퐺 ∙ 퐻 ∙ 푣푟 − 퐺 ∙ 퐻 ∙ 푣 − 퐾 ∙ 퐺 ∙ 휃 With no feedback 푣 = 퐺 ∙ 퐻 ∙ 푣푟 − 퐾 ∙ 퐺 ∙ 휃

퐺 ∙ 퐻 퐾 ∙ 퐺 θ 푣 = ∙ 푣 − ( ) ∙ 휃 1 + 퐺 ∙ 퐻 푟 1 + 퐺 ∙ 퐻 K

v + e f + - v r H G -

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signalc Processing (1) 27 퐺 ∙ 퐻 퐾 ∙ 퐺 푣 = 푣 − 휃 1 + 퐺 ∙ 퐻 푟 1 + 퐺 ∙ 퐻 퐈퐅 퐺 ∙ 퐻 ≪ 1 (low gain, 퐈퐅 퐺 ∙ 퐻 ≫ 1 (high gain, closed open loop or no loop, with feedback) feedback) 퐾 ∙ 퐺 퐾 푣 ≈ 1 ∙ 푣푟 − ∙ 휃 ≈ 푣푟 − 휃 푣 ≈ 퐺 ∙ 퐻 ∙ 푣푟 − 퐾 ∙ 퐺 ∙ 휃 퐺 ∙ 퐻 퐻 θ Actual speed 푣: close to 푣푟 with an error proportional to 휃 when in closed loop. The higher the controller’s gain, the lower the speed error. K

v + e f + - v r H G -

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signalc Processing (1) 28 푓 = 퐻 ∙ 푒 1 퐾 ∙ 퐺 = 퐻 ∙ ( 푣 + 휃) 1 + 퐺 ∙ 퐻 푟 1 + 퐺 ∙ 퐻

θ 퐻 퐾 ∙ 퐺 ∙ 퐻 푓 = ∙ 푣푟 + ∙ 휃 1 + 퐺 ∙ 퐻 1 + 퐺 ∙ 퐻 K

v + e f + - v r H G -

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signalc Processing (1) 29 퐻 퐾 ∙ 퐺 ∙ 퐻 푓 = ∙ 푣 + ∙ 휃 1 + 퐺 ∙ 퐻 푟 1 + 퐺 ∙ 퐻 퐈퐅 퐺 ∙ 퐻 ≫ 1 (high gain, 퐈퐅 퐺 ∙ 퐻 ≪ 1 (low gain, closed loop, with feedback) open loop, or no feedback) 1 푓 ≈ 퐻 ∙ 푣 + 퐾 ∙ 퐺 ∙ 퐻 ∙ 휃 푓 ≈ 푣 + 퐾 ∙ 휃 푟 퐺 푟 θ Force 푓: at regime, it does not depend on the gain in 퐻 while proportional to angle 휃 K

v + e f + - v r H G -

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signalc Processing (1) 30 Plotting 퐺퐻 and 퐺퐻 1 + 퐺퐻 • Open loop

푣 = 퐺 ∙ 퐻 ∙ 푣푟 cruisefeedback_timedomain2.m • Closed loop 퐺 ∙ 퐻 푣 = ∙ 푣 1 + 퐺 ∙ 퐻 푟 • Setting 퐻 = 103 푘푔/푠 • Plotting the open loop transfer function vs. time and the closed loop transfer function vs. time • Notice the rapid rise time for the closed loop case

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 31 The error signal e • Plot of error signal e vs

time cruisefeedback_timedomain2.m • Error signal decreases to 3 m/s. • Notice a ~10% steady

state error

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 32 Open and closed loop TF with 퐻 = 104 푘푔/푠

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 33 Error signal e with 퐻 = 104 푘푔/푠

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 34 Cruise control example

• First-order differential equation • Simplest controller: simply a gain with no time constants involved • How to handle more complicated problems?

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 35 Block diagram reduction

x y x P1 P2 y P1P2

+ x P1 y ± x P1 ±P2 y

P2

+ x P1 y ∓ 푃1 x y 1 ± 푃1푃2 P2 LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 36 Practice

Determine the output C in terms of inputs U and R.

U R + + + C 퐺1 퐺2 -

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 37 Practice Determine the output 퐶 in terms of inputs 푈1, 푈2 and 푅.

U1 R + + C 퐺1 퐺2 + +

+ 퐻1 퐻2 +

U2

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 38 More practice (a) 퐺2 R + + 퐺 1 + C Determine C/R for the + following systems. 퐻 1

(c) (b) 퐺2 퐺2 R + + + + C 퐺 퐺1 1 C R + + + +

퐻1 퐻1

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 39 How do we MEASURE the OL TF of a system when the loop is closed? 1. Add an injection point in a closed loop system

2. Inject signal 푥 and read signal 푦1 (just before the injection) and 푦2 (right after the injection) 푦 3. Solve for the ratio 1 푥 푦 2 + + 푦1 푦2

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 40 So far… • Control theory builds on differential equations • Block diagrams help visualize the signal flow in a physical system • The cause-and-effect relationship between variables is referred to as a transfer function (TF) • The system’s open-loop TF is the product of transfer functions – cruise control example: 퐺 ∙ 퐻 – Two cases: 퐺 ∙ 퐻 ≪ 1 and 퐺 ∙ 퐻 ≫ 1 • MATLAB implementation – Functions used: dsolve

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 41

Laplace Transforms

• The technique of Laplace transform (and its inverse) facilitates the solution of ordinary differential equations (ODE). • Transformation from the time-domain to the frequency-domain. • Functions are complex, often described in terms of magnitude and phase

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 42 Linear systems • To map a model to frequency space – System must be linear – Output proportional to input x y • Given system P P – Input signals: 푥1 and 푥2 – Output signals (response): 푦1 and 푦2 • System P is linear

– If input signal: 푎 푥1 + 푏 푥2 – Then output signal: 푎 푦1 + 푏 푦2 –

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 43 Example

푑푥 • Is 푦 = a ? 푑푡 푑푥 푑푥 Knowing that 푦 = 1 and 푦 = 2 1 푑푡 2 푑푡 If input is 푐1푥1 + 푐2푥2, output is 푑 푐 푥 + 푐 푥 = 푑푡 1 1 2 2 푑 푑 푐 푥 + 푐 푥 = 1 푑푡 1 2 푑푡 2 푐1 푦1 + 푐2 푦2 System is linear

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 44 Example

• Is 푦 = 푥2 a linear system? 2 2 Knowing that 푦1 = 푥1 and푦2 = 푥2 If input is 푐1푥1 + 푐2푥2, output is 2 푐1푥1 + 푐2푥2 ≠ 푐1 푦1 + 푐2 푦2 System is not linear

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 45 In general Output 푑푛푦 푑푛−1푦 푎 + 푎 + ⋯ + 푎 푦 푛 푑푡푛 푛−1 푑푡푛−1 0 푑푚푥 푑푚−1푥 = 푏 + 푏 + ⋯ + 푏 푥 푚 푑푡푚 푚−1 푑푡푚−1 0 Input 푛 푚 푖 푖 푎푖퐷 푦 푡 = 푏푖퐷 푥 푡 푛 ≥ 푚 푖=0 푖=0 For a stable system

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 46 Laplace Transform L • Transforms a linear differential equation into an algebraic equation • Tool in solving differential equations • Laplace transform of function f 퐹 푠 = L 푓(푡) • Laplace inverse transform of function F 푓(푡) = L−1 퐹(푠) where 푠 = 푗휔 is the transform variable Imaginary unit 2휋푓

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 47 ↔ Laplace domain y(푡) f(푡) 푑푦

푓 = 푑푡

Input Output

푌(푠) F(푠) 퐺(푠)

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 48 Laplace Transform L

∞ 퐹 푠 = L 푓(푡) = 푓(푡)푒−푠푡푑푡 0

1 +푗휔 푓 푡 = L−1 퐹(푠) = 퐹(푠)푒푠푡푑푠 2휋푗 −푗휔

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 49 (Some) Laplace transform pairs 풇(풕) 푭(풔) 1 Unit step 푢(푡) 푠 Unit ramp 푡 1 푠2 Exponential 푒푎푡 1 푠 − 푎 휔 Sinusoid sin (휔0푡) 2 2 푠 + 휔0 1/푎 1 − 푒−푎푡 1 푠 푠 + 푎 휔0 2 SHO 푒−훿휔0푡 × 휔0 2 2 2 1 − 훿 푠 + 2훿휔0 푠 + 휔0 2 × sin( 1 − 훿 휔0푡)

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 50 Laplace transform properties

• Linearity L 푐1푓1 푡 + 푐2푓2 푡 = 푐1퐹1 푠 + 푐2퐹2 푠 • Derivatives 푑푓(푡) – First-order: L = 푠퐹(푠) 푑푡 푑2푓(푡) – Second-order: L = 푠2퐹(푠) 푑푡2 • Integral 푡 1 L 푓 푡 푑푡 = 퐹(푠) 0 푠

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 51 Solution to ODEs

1. Laplace transform the system’s ODE 2. Solve the algebraic equation in s 3. Inverse transform back to the time domain

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 52 Transfer Function 퐺 푠 푛 푚 푖 푖 푎푖퐷 푦 푡 = 푏푖퐷 푥 푡 푖=0 푖=0 Using 푛 푚 derivative 푖 푖 property 푎푖푠 푌 푠 = 푏푖푠 푋 푠 푖=0 푖=0 Algebraic equation 푌(푠) 푚 푏 푠푖 in s, the ratio of 2 푖=0 푖 polynomials in s 퐺 푠 = = 푛 푖 푋(푠) 푖=0 푎푖푠

Transfer function 퐺 푠 relates input 푋 푠 to output 푌 푠 . 53

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) Transfer Function 퐺 푠

The roots of the numerator are referred to as zeros.

Transfer function 퐺 푠 can 푚 푖 푌(푠) 푏푖푠 be defined by 퐺 푠 = = 푖=0 • The coefficients of s or 푛 푖 푋(푠) 푖=0 푎푖푠 • Its poles and zeros

The roots of the denominator are referred to as poles. 54

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) Let’s apply it to the cruise control example: transfer function 퐺 (the car’s body) Direction of motion 푑푣(푡) Engine 푚 = 푓(푡) − 푏푣(푡) Friction 푑푡 force (f ) force (f) fr

푚 푠 푉 푠 = 퐹 푠 − 푏 푉(푠) f(t) v(t) G(t)

푉 푠 = 퐺 푠 퐹 푠 F(s) V(s) G(s) 1 푚 where 퐺 푠 = 푠 + 푏/푚 Pole at − 푏 푚 LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 55 Dynamic response: using lookup tables to inverse transform Laplace inverse Input: step function, amplitude 퐹0 transform using 푓 푡 = 퐹0 푢(푡) 퐹 lookup tables 퐹 푠 = L 푓(푡) = 0 푠 1

푠 푠 + 푎 The response (in frequency space) is 1/푚 퐹0 푉 푠 = 퐺 푠 ∙ 퐹 푠 = ∙ 푠 + 푏/푚 푠 The time-domain response is 푣 푡 = L−1 푉(푠) = 1 퐹0 1 1 − 푒−푎푡 = L−1 ∙ 푎 푚 푠 (푠 + 푏 푚) LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 56 Dynamic response: using lookup tables to inverse transform

퐹0 1 Laplace inverse 푣 푡 = L−1 ∙ transform using 푚 푠 (푠 + 푏 푚) lookup tables 퐹0 1 = ∙ L−1 1 푚 푠 (푠 + 푏 푚)

푠 푠 + 푎

푏 퐹0 − 푡 푣 푡 = 1 − 푒 푚 푏 1 −푎푡 1 − 푒 1 푎 Pole 푎 = LIGO-G1100863 Matone: An Overview of Control Theory and Digital 휏Signal Processing (1) 57 First-order system

푝 퐺 푠 = 63 % 푠 + 푝

푝 = 5 푟푎푑/푠, 휏 = 0.2 푠

Pole p firstorder.m

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 58 MATLAB implementation

The step response of transfer function 5 퐺 푠 = 푠 + 5

>> G=tf(5, [1 5]); >> step(G);

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 59 Partial fraction expansion 1. Reduce a complex function to a collection of simpler ones

2. Then use lookup table Order m 푄(푠) 훼푖 퐹 푠 = = 푚 ≤ 푛 푃(푠) 푠 + 푎푖 Order n 푖 훼1 훼푛 푓 푡 = L−1 + ⋯ + L−1 푠 + 푎1 푠 + 푎푛 −푎1푡 −푎푛푡 = 훼1 푒 + ⋯ + 훼푛 푒 푛

−푎푖푡 푓 푡 = 훼푖 푒 푖=0

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 60 Comments

푛 훼푖 −푎푖푡 퐹 푠 = 푓 푡 = 훼푖 푒 푠 + 푎푖 푖 푖=0 1. Poles of F(s) determine the time evolution of f(t) 2. Zeros of F(s) affect coefficients 3. Poles closer to origin → larger time constants

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 61 Example Find 푓(푡) of the Laplace transform 6푠2 − 12 퐹 푠 = 푠3 + 푠2 − 4푠 − 4 Sol: Using MATLAB

>> [R,P,K]=residue([6 0 -12],[1 1 -4 -4]) R = 3.0000 3 1 2 1.0000 퐹 푠 = + + 2.0000 푠 + 2 푠 − 2 푠 + 1 P = -2.0000 2.0000 -1.0000 K = [] 푓 푡 = 3 푒−2푡 + 푒2푡 + 2 푒−푡

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 62 Example: LRC circuit

퐿 푅

푣푖푛(푡) 퐶 푣표푢푡(푡)

푣푖푛 푡 = 푣퐿 푡 + 푣푅 푡 + 푣퐶 푡 푡 푑 1 = 퐿 푖(푡) + 푅 푖(푡) + 푖 휏 푑휏 푑푡 퐶 0 1 1 = 퐿 퐷 푖 푡 + 푅 푖 푡 + 푖(푡) 퐶 퐷

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 63 Example: LRC circuit 퐿 푅

푣푖푛(푡) 퐶 푣표푢푡(푡)

1 1 푣 (푡) = 퐿 퐷 푖 푡 + 푅 푖 푡 + 푖(푡) 푖푛 퐶 퐷 푑 푖 푡 = 퐶 푣 푡 = 퐶 퐷 푣 푡 푑푡 표푢푡 표푢푡 2 푣푖푛 푡 = 퐿 퐶 퐷 + 푅 퐶 퐷 + 1 푣표푢푡(푡)

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 64 Example: LRC circuit 퐿 푅

푣푖푛(푡) 퐶 푣표푢푡(푡)

2 푣푖푛 푡 = 퐿 퐶 퐷 + 푅 퐶 퐷 + 1 푣표푢푡(푡) L 2 푉푖푛 푠 = 퐿 퐶 푠 + 푅 퐶 푠 + 1 푉표푢푡(푠)

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 65 LRC circuit: transfer function

1 푉 푠 = ∙ 푉 푠 표푢푡 퐿 퐶 푠2 + 푅 퐶 푠 + 1 푖푛

Setting L = 1 H, C = 1 F and R = 1 Ω

1 푉 푠 = ∙ 푉 푠 표푢푡 푠2 + 푠 + 1 푖푛

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 66 LRC circuit: dynamic response to step

Setting the input to a step of amplitude 1 V 1 푉 푠 = 푖푛 푠 The unit step response is 1 1 1 푉 푠 = ∙ = 표푢푡 푠2 + 푠 + 1 푠 푠3 + 푠2 + 푠

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 67 LRC circuit: dynamic response to step

1 훼푖 푉표푢푡(푠) = 3 2 = 푠 + 푠 + 푠 푠 + 푎푖 푖 Using MATLAB for the solution Coefficient vector for polynomial at numerator >> n = [1]; Coefficient vector for >> d = [1 1 1 0]; polynomial at denominator >> [α, a, k] = residue(n, d);

푎1푡 푎2푡 푎3푡 푣표푢푡 푡 = 훼1 푒 + 훼2 푒 + 훼3 푒

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 68 Plotting results of two methods

>> y=α.'*exp(a*t); >> plot(t, y, 'bo');

>> y2=step(1,[1 1 1],t); >> plot(t, y2, ‘r.’);

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 69 Second-order system step response

Overshoot

Period of oscillation Note: often the response of a high- secondorder.m Settling time: time to order system is settle to ±5% of final similar to the value (determined by second-order one the 푒−훿휔푡 term)

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 70 Verify the following

6푠2 − 12 퐹 푠 = 푠3 + 푠2 − 4푠 − 4 푓 푡 = 2푒−푡 + 3푒−2푡 + 푒2푡

6푠 퐹 푠 = 푠3 + 푠2 − 4푠 − 4 푓 푡 = 3푒−푡 − 6푒−2푡 + 3푒−3푡

푠 + 5 퐹 푠 = 푠2 + 4푠 + 13 푓 푡 = 2푒−푡 − 3푒−2푡 + 푒2푡

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 71 Back to cruise control: system’s step response 퐺 ∙ 퐻 푉(푠) = ∙ 푉 (푠) 1 + 퐺 ∙ 퐻 푟 1 푚 where 퐺 푠 = and 퐻 푠 = 퐾푔푎푖푛 푠 + 푏/푚 θ

K

e f - v v + H + G r -

c

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 72 Step response

퐾푔푎푖푛 퐺 ∙ 퐻 1 푚 푉 푠 = ∙ = 1 + 퐺 ∙ 퐻 푠 (푏 + 퐾 ) 푠2 + 푔푎푖푛 푠 푚

퐾푔푎푖푛 푚 푣 푡 = 1 − 푒−푡/휏 with τ = 퐾푔푎푖푛 + 푚 푏 + 퐾푔푎푖푛

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 73 Back to cruise control

>> n = [k/m]; >> d = [1 (b+k)/m 0]; >> [α, a, k] = residue(n, d); >> y=α.'*exp(a*t); >> plot(t, y, 'bo');

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 74 Back to cruise control

>> G = tf([1/m],[1 b/m]); >> H = k; >> CL = G * H / (1 + G * H); >> [y, t] = step(CL); >> plot(t, y, 'b.');

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 75 Transfer function, poles and zeros • It is convenient to express a transfer function G(s) in terms of its poles and zeros:

푄(푠) 퐺 푠 = 푃(푠) 푠 − 푧1 ∙ 푠 − 푧2 … 푠 − 푧푚 = 푘 ∙ 푠 − 푝1 ∙ 푠 − 푝2 … 푠 − 푝푛

• k is the gain of the transfer function

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 76 Summary of pole characteristics • Real distinct poles (often negative) 푐푖 푝푖푡 ↔ 푐푖 푒 푠 − 푝푖 • Real poles, repeated m times (often negative)

푐 푐 푐 푐 푖,1 + 푖,2 + ⋯ + 푖,3 + 푖,푚 푠 − 푝 2 3 푚 푖,1 푠 − 푝푖,2 푠 − 푝푖,3 푠 − 푝푖,푚 ↕ 1 푐푖,푚 푐 + 푐 푡 + 푐 푡2 + ⋯ + 푡푚−1 ∙ 푒푝푖푡 푖,1 푖,2 2! 푖,3 푚 − 1 !

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 77 Summary of pole characteristics • Complex-conjugate poles ∗ 푐푖 푐푖 ∗ 푝푖푡 ∗ 푝푖 푡 + ∗ ↔ 푐푖 푒 + 푐푖 푒 푠 − 푝푖 푠 − 푝푖 often re-written as a second-order term 휔2 ↔ ~ 푒훼푡 ∙ sin 훽푡 + 휑 푠2 + 2훿휔 푠 + 휔2 • Poles on imaginary axis – Sinusoid – Pole at zero: step function • Poles with a positive real part – Unstable time-domain solution LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 78

Summary • The Laplace transform is a tool to facilitate solving for ODEs. • Systems need to be linear • No need to do the transform (integral) – Use transform pairs, transform tables – Laplace transform properties: linearity, derivatives and integrals. • Once in the Laplace domain, a TF is simply the ratio of two polynomials in s. Carry out algebra to solve the problem. • No need to do the inverse transform – Use transform pairs, transform tables – For high-order TFs, use the partial-fraction expansion to reduce the problem to simpler parts • IMPORTANT: – Poles of a transfer function determine the time evolution of the system – Poles with a real positive part correspond to unstable and unphysical systems – The system TF needs to have poles with a negative real part • MATLAB implementation – Functions used: step, residue, tf

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 79 Solutions

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 80 Practice

Determine the output C in terms of inputs U and R. Sol: 퐺2 퐶 = ∙ 퐺1 푅 + 푈 1 + 퐺1퐺2 U R + + + C 퐺1 퐺2 -

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 81 Practice

Determine the output 퐶 in terms of inputs 푈1, 푈2 and 푅. Sol: 1 퐶 = ∙ 퐺1 퐺2 푅 + 퐺2푈1 + 퐺1퐺2퐻1푈2 1 − 퐺1퐺2퐻1퐻2 U1

R + + C 퐺1 퐺2 + +

+ 퐻1 퐻2 + U LIGO-G1100863 Matone: An Overview of Control Theory and Digital2 Signal Processing (1) 82 More practice (a) 퐺2 Determine C/R for the following R + + systems. Sol: 퐺 1 + C 퐶 퐺 +퐺 + a) = 1 2 푅 1−퐺1퐻1−퐺2퐻2 퐶 퐺 +퐺 b) = 1 2 푅 1−퐺1퐻1 퐻1 퐶 퐺 +퐺 1−퐺 퐻 c) = 1 2 1 1 푅 1−퐺1퐻1 (c) (b) 퐺2 퐺2 R + + + + C 퐺 퐺1 1 C R + + + +

퐻1 퐻1

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 83 How do we MEASURE the OL TF of a system when the loop is closed? 1. Add an injection point in a closed loop system

2. Inject signal 푥 and read signal 푦1 (just before the injection) and 푦2 (right after the injection) 푦 3. Solve for the ratio 1 푥 푦 2 + 푦1 + Sol: = −퐺푂퐿 푦2 푦1 푦2

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 84 Partial-fraction examples

• Denominator: has distinct, real roots – Example 2.4, 2.5, 2.6 • Denominator: complex roots – Example 2.7, 2.8 • Denominator: repeated roots – Example 2.9

LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 85 Practice: verify the following 6 퐹 푠 = (푠 + 1)(푠 + 2)(푠 + 3) 푓 푡 = 3푒−푡 − 6푒−2푡 + 3푒−3푡

푠 + 5 퐹 푠 = 푠2 + 4푠 + 13 휋 푓 푡 = 2푒−2푡 sin(3푡 + ) 4

2 퐹 푠 = 푠 + 1 3 푠 + 2 푡2 푓 푡 = 2 1 − 푡 + 푒−푡 − 푒−2푡 2 LIGO-G1100863 Matone: An Overview of Control Theory and Digital Signal Processing (1) 86