Phys 253 Lecture 5 1. Get ready for Design Reviews Next Week!! 2. Comments on Motor Selection 3. Introduction to Control (Lab 5 Servo Motor) Different performance specifications for all 4 DC motors supplied in lab Motors Geared Barber Coleman motor info (at 12): 500 rpm noload speed, 0.1A 30 ozin stall torque, current 1.5A GHM10 (at 12): 416 rpm noload, 0.12 A 50 oz in stall torque, current 2.05A Ungeared Barber Coleman motor info (at 12): 7500 rpm noload speed, 0.13A 6 ozin stall torque, current 2.5A ESCAP motor specs (at 12): 60 rpm noload 23 oz in stall torque, current 0.17A Futaba Servo Motor S3003 operates just like servomotor from lab (motor builtin encoder), but all in one unit max 44 ozin torque Instructions in Sec 11.1.2 of IC Manual ** TIP: for max torque with Futaba, use external 5 supply ** 1
Motor Selection Comments To determine whether motor has adequate power: 1. Estimate required power for final mechanism P Fv 2. Check that motor can provide adequate power (max power at ½ max torque, ½ max velocity) P Tω P (torque) * (ang velocity) 0 when T0 0 when ω 0 maximum when ½ max T * ½ max ω (approx) Motor Selection Comments, cont. 3. Work gearing to go from initial torque to get to the final torque/force. Drops in efficiency at each stage: spur gears 90% worm gears 1060% lead screw 1060% chain 80% cable 090% rack & gear 5080% 2
Lecture 5 Introduction to control Transfer functions revisited (Laplace transform notation: s~jω) (s) is the Laplace transform of v(t). Some rules: 1) Proportionality: H(s) (s)/ in (s) 10log H(s) log() v (t) *v in (t) (s) * in (s) H(s) st ( s) v( t) e dt 0 Time domain Frequency domain 0 2) Integration: 10log H(s) v ( t) vin ( t) dt in ( s) ( s) s H ( s) s Time domain Frequency domain 10 db/dec 0 90 3
3) Differentiation: v dvin ( t) ( t) dt ( s) s ( s) in 10log H(s) H ( s) s 10 db/dec 90 0 Low pass filter: H ( s) ( s ω 0 ) 10log H(s) log(/ω 0 ) ~/ω 0 10 db/dec ω 0 /10 ω 0 10ω 0 ω 0 ~/jω 0 90 4
Feedback loops Y variable you d like to control (eg: shaft angle of a servo motor) X your desired value of Y (eg: 10 degrees) X(s) Y G(XHY) Y(1GH) GX Y/X G/(1GH) Error G(s) H(s) Y X Motor and amplifier behavior Y(s) Sensor behavior G 1 GH G forward transfer function, GH loop transfer function Feedback loops Eg. Servo system with DC motor and Handy Board. HandyBoard knob: in code F(s) analog(0) Pwm motor G(s) Mechanical connection in FG 1 FG potentiometer 5
Feedback loops: stability Y X G 1 GH This loop will be unstable if GH 1 GH 1, phase(gh) ±180 deg. G(s)H(s) 1 implies Y X for some value of s i.e. there will exist a frequency for which the loop will provide infinite amplification Loop Stability Y X G 1 GH Partial stability criterion: GH < 1 where the phase of GH is ± 180 deg. 10log GH STABLE 0 db 8 db Gain Margin ω 0 0 180 270 ω 0 6
Loop Stability Y X G 1 GH Partial stability criterion: GH < 1 where the phase of GH is ± 180 deg. 10log GH UNSTABLE ω 0 0 db 0 ω 0 Increasing loop gain eventually makes all systems unstable 180 270 Steady state error Steady state error: The difference between actual and desired values when these values are not fluctuating with time (DC behavior). Error X(s) Y(s) G(s) Error XY Y G* Error SSError Y G(0) Make G 0 (DC gain) large to minimize error. This can increase loop gain at high frequencies and lead to instability. 7
Steady state error and stability EXAMPLE: look at negative feedback in an opamp: in R1 A simple model for an opamp is: R2 G(s) /s (look at datasheet for TL082) Error in G(s) H(s) H ( s) R1 R R 1 2 Steady state error and stability Another look at negative feedback in an opamp: in /s R 1 /(R 1 R 2 ) in / s R1 1 s R R 1 2 R1 s R R For large and low frequency, this reduces to 1 2 R 1 2 R in 1 8
Steady state error and stability Another look at negative feedback in an opamp: in error /s Stability: GH s R1 ( R R ) 2 1 R 1 /(R 1 R 2 ) Phase of GH is 90 for all frequencies. This is inherently stable as GH will never 1 Steady state error and stability Another look at negative feedback in an opamp: in Steady state error: s error error /s R 1 /(R 1 R 2 ) s error error 0 GH At s0 (DC)! Integration (1/s) in the loop reduces steady state error to zero with need for infinite loop gain at higher frequencies! s R1 ( R R ) 2 1 9
Compensation in H(s) G(s) A feedback system is usually divided into two transfer functions: The plant function (G(s)) which usually you cannot alter (motor characteristics etc.) A compensator circuit H(s) that you can design to optimize the feedback loop A common type of allpurpose compensation is PID: Proportional ( p ) Integral ( i /s) Derivative (s d ) PID Compensation in H(s) G(s) Typical PID transfer function: H(s) tot ( p i /ss d ) The various gains ( tot, p, i, d ) are adjusted to control how much of each type of compensation is applied for a specific plant function G(s). This adjustment is referred to as tuning and is often done iteratively (a slightly improved form of trial and error) when the plant function G is not well known. 10
PID example: position servo (demo) in nob set error k HandyBoard knob: in code H(s) analog(0) pot PID H(s) k Pot Pwm Motor /(s(sa)) motor G(s) Mechanical connection k potentiometer PID example: position servo in nob k set Motor transfer function: dt ω max error pot PID H(s) k Pot Motor (at low frequencies: G/s) /(s(sa)) αdt (at high frequencies: G/s 2 ) Torque α Inertia G( s) ω s( s a) ω α 11
PID example: position servo in nob k set error pot PID H(s) k Pot Motor /(s(sa)) Loop transfer function (stability analysis): G( s) s( s a) H(s)? Try proportional control: H(s) p Stability: position servo P control Loop transfer function (P only): GH ( s) a log GH p s( s a) 10a 0 db Gain Margin Stable for limited gain error error 90 180 p s( s a) p error s s a ( ) 0 at s0! 10a 12
Stability: position servo I control Open loop transfer function (I only): GH ( s) 2 s ( s i a) H ( s) s i 180 270 Phase crosses 180 at DC, with infinite DC gain! Inherently unstable at s0 Stability: position servo D control Open loop transfer function (D only): d GH ( s) ( s a) 0 H ( s) s d Phase always less than 180 Stable even for large gains! 90 error ( s a ) SS error 0! Problems: May be hard to implement due to amplification of fast transients. Can be combined with P gain to add high gain stability and low SS error Model is not complete loop will still be unstable at very high gains. d 13
loop pot analog(6); set knob(); PID in software Feedback potentiometer Set point error setpot; pkp*error; Proportional dkd*(errorlasterr); Derivative iki*errori; if (i>maxi) i maxi; Integration if (i<maxi) i maxi; g pid; Antiwindup motor(3,g); lasterrerror; Because i is an integral, it will build up to large values over time for a constant error. An antiwindup check must be put in place to avoid it overwhelming P and D control when the error is removed. Tuning PID Often PID tuning is done by nearly trial and error. Here is a common Procedure which works for many (but not all) plant functions. USE external pots or menus to adjust!!!!! Set PID0 Increase P slightly and ensure that the sign of the gains is correct. Increase P until oscillations begin Increase D to dampen oscillations Iterate increasing P and D until fast response is achieved with little overshoot Increase I to remove any Steady State error. If overshoot is too large try decreasing P and D. Test with step response: Crit. damped over damped under damped 14
Please consider the following problem for a robot with differential rear drive steering: Which robot configuration has more poles in the transfer function between I (current to motors) and x (distance of sensors from tape)? sensors sensors x x pivot 1 pivot 2 x SENSOR: r 1 v in 0 (we want robot to follow tape) x 0 Actual x value in time domain: x l sin vsindt in l vdt l Actual X in frequency domain: v X ~ l at low v X l s v X for l 0 s CHASSIS ( the plant ): bot I pwm s( s a) (looks similar to the model for a motor from position servo example) where a 1 I bot I bot is the chassis moment of inertia 15
Linearization of nonlinear functions Control can be very difficult if G is nonlinear. PWM drive (combined with friction) yields a very nonlinear torque curve: T PWM Solution: Linearize this curve in software by mapping PWM to desired Torque PWM PWMin 16