CDS 101/110a: Lecture 10-2 Control Systems Implementation Richard M. Murray 5 December 2012 Goals Provide an overview of the key principles, concepts and tools from control theory - Classical control - frequency domain, inner loop methods - Modern control - state space feedback, estimation Briefly describe how controllers are implemented in modern systems Reading: Åström and Murray, Feedback Systems, Ch 2-11
Main Principles of Control Management of Uncertainty Feedback allows high performance in the presence of uncertainty (parameters, noise,...) Example: repeatable performance of amplifiers with 5X component variation Key idea: accurate sensing to compare actual to desired, correction thru computation & actuation Design of Dynamics Feedback allows the dynamics of a system to be modified Example: stability augmentation for highly agile, unstable aircraft Key idea: interconnection gives closed loop that modifies natural behavior Maintaining Modularity Feedback can maintain input/output properties, providing simplified abstractions for higher levels Enables layered design abstractions by hiding details of dynamics and uncertainty CDS 101/110, 5 Dec 2012 Richard M. Murray, Caltech CDS 2
Frequency Response, Transfer Functions, Block Diagrams y ss = A G(i ) sin( t + arg G(i )) 101 Phase (deg) Magnitud e 100 10-1 10-2 0-50 -100-150 G(s) =C(sI A) 1 B + D G y2 u 1 = G y2 u 2 G y1 u 1 = n 1n 2 d 1 d 2-200 100 101 Frequency (rad/sec) Parallel Σ Feedback Σ CDS 101/110, 5 Dec 2012 Richard M. Murray, Caltech CDS 3
Design Patterns for Control Systems Frequency Domain Control State Space Control Reference input shaping Feedback on output error Compensator dynamics shape closed loop response Uncertainty in process dynamics + external disturbances and noise Goals: stability, performance (tracking), robustness Environment Explicit computation of trajectories given a model of the process and environment CDS 101/110, 5 Dec 2012 Richard M. Murray, Caltech CDS 4
Linearization Around an Equilibrium Point 2 Linearize around x=x e x 2 0-2 -2π 0 2π x 1 Remarks In examples, this is often equivalent to small angle approximations, etc Only works near to equilibrium point Full nonlinear model Linear model (honest!) CDS 101/110, 5 Dec 2012 Richard M. Murray, Caltech CDS 5
0 Stability of Linear Systems Q: when is the system asymptotically stable? Stability is determined by the eigenvalues of the matrix A Simple case: diagonal system More generally: transform to Jordan form Stable if λ i 0 Asy stable if λ i < 0 Unstable if λ i > 0 Asy stable if Re(λ i ) < 0 Unstable if Re( λ i ) > 0 Indeterminate if Re( λ i ) = 0 Form of eigenvalues determines system behavior Linearization captures behavior near eq pt local nonlinear stability CDS 101/110, 5 Dec 2012 Richard M. Murray, Caltech CDS 6
Step and Frequency Response Effect of eig values on step response Complex eigenvalues with small real part lead to oscillatory response Frequency of oscillations ω i MATLAB: step Imag Axis 2 1 0-1 Pole-zero map ω p -2-15 -10-5 0 5 Real Axis Amplitude 0.2 0.15 Step Response T 2π/ω p 0.1 0.05 0 0 5 10 15 20 25 30 Time (sec.) Effect of eig values on freq response Eigenvalues determine break points for frequency response Complex eigenvalues lead to peaks in response function near ω I MATLAB: bode Phase (deg); Magnitude (db) -50-100 0-100 -200 Bode Diagrams 0 ω p 10-1 10 0 10 1 Frequency (rad/sec) CDS 101/110, 5 Dec 2012 Richard M. Murray, Caltech CDS 7
Control Design Concepts System description: single input, single output system (MIMO also OK) Stability: stabilize the system around an equilibrium point Given equilibrium point x e R n, find control law u=α(x) such that Reachability: steer the system between two points Given x 0, x f R n, find an input u(t) such that x 0 xf Tracking: track a given output trajectory Given y d(t), find u=α(x,t) such that y(t) y d (t) t CDS 101/110, 5 Dec 2012 Richard M. Murray, Caltech CDS 8
Canonical Feedback Example: PID Control d e u r + C(s) + P(s) y -1 Three term controller Present: feedback proportional to current error Past: feedback proportional to integral of past error - Insures that error eventual goes to 0 - Automatically adjusts setpoint of input Future: derivative of the error - Anticipate where we are going PID design Choose gains k, k i, k d to obtain the desired behavior Stability: solutions of the closed loop dynamics should converge to eq pt Performance: output of system, y, should track reference Robustness: stability & performance properties should hold in face of disturbances and plant uncertainty CDS 101/110, 5 Dec 2012 Richard M. Murray, Caltech CDS 9
r + e C(s) d -1 + Determine stability from (open) loop transfer function, L(s) = P(s)C(s). Use principle of the argument from complex variable theory (see reading) Enables loop shaping: design open loop to enable closed loop properties Thm (Nyquist). Consider the Nyquist plot for loop transfer function L(s). Let P # RHP poles of L(s) N # clockwise encirclements of -1 Z # RHP zeros of 1 + L(s) Then Z = N + P u P(s) Nyquist Criterion y To: Y(1) 6 4 2 0-2 -4 +j -j Imag + r R Nyquist Diagrams From: U(1) iω < 0 ω=+i ω=-i iω > 0 Real ω=0 N=2-6 -6-4 -2 0 2 4 6 8 10 12 Nyquist D contour Take limit as r 0, R Trace from 1 to +1 along imaginary axis Trace frequency response for L(s) along the Nyquist D contour Count net # of clockwise encirclements of the -1 point Real Axis CDS 101/110, 5 Dec 2012 Richard M. Murray, Caltech CDS 10
The Art of Loop Shaping Loop Shaping for Stability & Performance Steady state error, bandwidth, tracking response Specs can be on any input/output response pair L(s) 1 BW GM L(s) < 1 Main ideas Performance specs give bounds on loop transfer function Use controller to shape response Gain/phase relationships constrain design approach Standard compensators: proportional, lead, PI PM H yr = L 1+L H yd = P 1+L Things to remember (for homework and exams) Always plot Nyquist to verify stability/robustness Check gang of 4 to make sure that noise and disturbance responses also look OK ( H < 1) H n = C 1+L H er = 1 1+L CDS 101/110, 5 Dec 2012 Richard M. Murray, Caltech CDS 11
Example: Magnetic Levitation System Nominal design gives low perf Not enough gain at low frequency Try to adjust overall gain to improve low frequency response Works well at moderate gain, but notice waterbed effect Bode integral limits improvement Must increase sensitivity at some point 10 Sensitivity Function Electromagnet Ball Magnitude (db) 0-10 -20 CDS 101/110, 5 Dec 2012 IR receivier IR transmitter -30-40 Richard M. Murray, Caltech CDS 10 0 10 1 10 2 10 3 10 4 Frequency (rad/sec) Fix: redesign
Robust Control Theory (CDS 212) Model components as I/O operators Δ W 2 y( ) = P(u( ), d( ), w( )) d disturbance signal d P W 1 z z output signal Δ uncertainty block C W 1 W 2 performance weight uncertainty weight Goal: guaranteed performance in presence of uncertainty for all Compare energy in disturbances to energy in outputs Use frequency weights to change performance/uncertainty descriptions Can I get X level of performance even with Y level of uncertainty? Generalizations to nonlinear systems (along trajectories) available [Tierno et al] CDS 101/110, 5 Dec 2012 Richard M. Murray, Caltech CDS 13
Digital implementation Sample inputs at fixed rate (eg 10 Hz) For each sample, compute the desired output Send output to actuators ( analog) Use input filter to avoid aliasing (signal changing faster than sampling) Implementing Control Laws Control law computation State space (easy): u = -K x + kr r Transfer function tf2ss H(s) =C(sI A) 1 ẋ = Ax + Bu B! y = Cx c2d! x(t + h) =x(t)+h Ax(t)+Bu(t) y(t) =Cx(t) - Actual implementations are smarter, but mainly transparent (SIMULINK code) CDS 101/110, 5 Dec 2012 Richard M. Murray, Caltech CDS 14
Alice 300+ miles of fully autonomous driving 8 cameras, 8 LADAR, 2 RADAR 12 Core 2 Duo CPUs + Quad Core ~75 person team over 18 months Software 25 programs with ~200 exec threads 237,467 lines of executable code Example: Alice (DGC07) Team Caltech, Apr 07 Richard M. Murray, Caltech CDS 15
DGC07 System Architecture Logging/ Visualization LADAR (6) Simulation Feature Classificat n Process Manager Systems Health Manager World Map Mission Planner Traffic Planner Linux, TCP/IP,... Stereo/Road Finding Gimbaled Sensor Elevation Mapping Obstacle Detect/Track Obstacle Map Vehicles Path Planner Path Follower Actuation Interface Application of existing controls technology in Alice Receding horizon (optimization-based) control for path planning with obstacles; ~100 msec iteration rate Multi-layer sensor fusion: sensor bus allows different combinations of sensors to be used for perceptors + fusion at map level Low level (inner loop) controls: PID w/ anti-windup (but based on a feasible trajectory from RHC controller) Team Caltech, Apr 07 Sensing Richard M. Murray, Caltech CDS Vehicle State Estimator Navigation Vehicle Properties Highly modular Rapidly adaptable Constantly viable Resilient??? 16
Final Exam CDS 101: Four questions, worth a total of 40 points. Time limit = 2 hours CDS 110: Five questions, worth a total of 80 points. Time limit = 3.5 hours Point values listed for each part (most parts are 5 points each) Make sure to answer the right parts of the problems (some are 101 or 110 only) Answer as completely as possible and explain your work Exam is due at 5 pm, 14 Dec 2013. Must be handed in to Anissa Scott in 107 STL OK to turn in the exam to homework box outside 102 Steele, but at your own risk Please write your solutions in a fresh exam book (blue book) Exam is open book Course text (Astrom and Murray) + optional texts (see web page) are OK Course handouts, posted lecture notes, problem sets, posted solutions are OK Handwritten notes are OK. No other materials allowed. Computers and MATLAB/Python are OK for numerical calculations OK to use for computing numerical values and making plots, but not required Symbolic computations using Mathematica, MATLAB,... are not allowed (nor needed) All of your answers must be hand written or hand drawn (do not turn in code or plots) No use of the Internet (except MATLAB licenses, course materials [.caltech.edu]) CDS 101/110, 5 Dec 2012 Richard M. Murray, Caltech CDS 17