Lecture 5 Introduction to control Tranfer function reviited (Laplace tranform notation: ~jω) () i the Laplace tranform of v(t). Some rule: ) Proportionality: ()/ in () 0log log() v (t) *v in (t) () * in () t ( ) v( t) e dt 0 Time domain Frequency domain 0 2) Integration: 0log v ( t) vin ( t) dt in ( ) ( ) H ( ) Time domain Frequency domain 0 db/dec 0 90
3) Differentiation: v dvin ( t) ( t) dt ( ) ( ) in 0log H ( ) 0 db/dec 90 0 Low pa filter: H ( ) ( ω 0 ) 0log log(/ω 0 ) ~/ω 0 0 db/dec ω 0 /0 ω 0 0ω 0 ω 0 ~/jω 0 90 2
Feedback loop Y variable you d like to control (eg: haft angle of a ervo motor) X your deired value of Y (eg: 0 degree) X() Y G(XHY) Y(GH) GX Y/X G/(GH) Error G() Y X Motor and amplifier behavior Y() Senor behavior G GH G forward tranfer function, GH loop tranfer function Feedback loop Eg. Servo ytem with DC motor and Handy Board. HandyBoard knob: in code F() analog(0) Pwm motor G() Mechanical connection in FG FG potentiometer 3
Feedback loop: tability Y X G GH Thi loop will be untable if GH GH, phae(gh) ±80 deg. G() implie Y X for ome value of i.e. there will exit a frequency for which the loop will provide infinite amplification Loop Stability Y X G GH Partial tability criterion: GH < where the phae of GH i ± 80 deg. 0log GH STABLE 0 db 8 db Gain Margin ω 0 0 80 270 ω 0 4
Loop Stability Y X G GH Partial tability criterion: GH < where the phae of GH i ± 80 deg. 0log GH UNSTABLE ω 0 0 db 0 ω 0 Increaing loop gain eventually make all ytem untable 80 270 Steady tate error Steady tate error: The difference between actual and deired value when thee value are not fluctuating with time (DC behavior). Error X() Y() G() Error XY Y G* Error SSError Y G(0) Make G 0 (DC gain) large to minimize error. Thi can increae loop gain at high frequencie and lead to intability. 5
Steady tate error and tability Another look at negative feedback in an opamp: in R R2 Error in G() Model Opamp a G() / H ( ) R R R 2 Steady tate error and tability Another look at negative feedback in an opamp: in / R /(R R 2 ) in / R R R 2 R R R 2 For large and low frequency, thi reduce to R 2 R in 6
Steady tate error and tability Another look at negative feedback in an opamp: in error / Stability: GH R ( R R ) 2 R /(R R 2 ) Phae of GH i 90 for all frequencie. Thi i inherently table a GH will never Steady tate error and tability Another look at negative feedback in an opamp: in Steady tate error: error error / R /(R R 2 ) error error 0 GH At 0 (DC)! Integration (/) in the loop reduce teady tate error to zero with need for infinite loop gain at higher frequencie! R ( R R ) 2 7
Compenation in G() A feedback ytem i uually divided into two tranfer function: The plant function (G()) which uually you cannot alter (motor characteritic etc.) A compenator circuit that you can deign to optimize the feedback loop A common type of allpurpoe compenation i PID: Proportional ( p ) Integral ( i /) Derivative ( d ) PID Compenation in G() Typical PID tranfer function: tot ( p i / d ) The variou gain ( tot, p, i, d ) are adjuted to control how much of each type of compenation i applied for a pecific plant function G(). Thi adjutment i referred to a tuning and i often done iteratively (a lightly improved form of trial and error) when the plant function G i not well known. 8
PID example: poition ervo (demo) in nob et error k HandyBoard knob: in code analog(0) pot PID k Pot Pwm Motor /((a)) motor G() Mechanical connection k potentiometer PID example: poition ervo in nob k et Motor tranfer function: dt ω max error pot PID k Pot Motor (at low frequencie: G/) /((a)) αdt (at high frequencie: G/ 2 ) Torque α Inertia G( ) ω ( a) ω α 9
PID example: poition ervo in nob k et error pot PID k Pot Motor /((a)) Loop tranfer function (tability analyi): G( ) ( a)? Try proportional control: p Stability: poition ervo P control Loop tranfer function (P only): GH ( ) a log GH p ( a) 0a 0 db Gain Margin Stable for limited gain error error 90 80 p ( a) p error a ( ) 0 at 0! 0a 0
Stability: poition ervo I control Open loop tranfer function (I only): GH ( ) 2 ( i a) H ( ) i 80 270 Phae croe 80 at DC, with infinite DC gain! Inherently untable at 0 Stability: poition ervo D control Open loop tranfer function (D only): d GH ( ) ( a) 0 H ( ) d Phae alway le than 80 Stable even for large gain! 90 error ( a ) SS error 0! Problem: May be hard to implement due to amplification of fat tranient. Can be combined with P gain to add high gain tability and low SS error Model i not complete loop will till be untable at very high gain. d
loop pot analog(6); et knob(); PID in oftware Feedback potentiometer Set point error etpot; pkp*error; Proportional dkd*(errorlaterr); Derivative iki*errori; if (i>maxi) i maxi; Integration if (i<maxi) i maxi; g pid; Antiwindup motor(3,g); laterrerror; Becaue i i an integral, it will build up to large value over time for a contant error. An antiwindup check mut be put in place to avoid it overwhelming P and D control when the error i removed. Tuning PID Often PID tuning i done by nearly trial and error. Here i a common Procedure which work for many (but not all) plant function. USE external pot or menu to adjut!!!!! Set PID0 Increae P lightly and enure that the ign of the gain i correct. Increae P until ocillation begin Increae D to dampen ocillation Iterate increaing P and D until fat repone i achieved with little overhoot Increae I to remove any Steady State error. If overhoot i too large try decreaing P and D. Tet with tep repone: Crit. damped over damped under damped 2
Pleae conider the following problem for a robot with differential rear drive teering: Which robot configuration ha more pole in the tranfer function between I (current to motor) and x (ditance of enor from tape)? enor enor x x pivot pivot 2 x r v in 0 (we want robot to follow tape) x 0 Actual x value in time domain: x l in vindt in l l vdt Actual X in frequency domain: v X ~ l at low v X l v X for l 0 bot I pwm ( a) where I bot i the chai moment of inertia a I bot 3
Linearization of nonlinear function Control can be very difficult if G i nonlinear. PWM drive (combined with friction) yield a very nonlinear torque curve: T PWM Solution: Linearize thi curve in oftware by mapping PWM to deired Torque PWM PWMin 4