MAE175a Moment Gyroscope Control Experiment (MAE175a) Prof: Raymond de Callafon email: callafon@ucsd.edu TAs: Jeff Narkis, email: jnarkis@ucsd.edu Gil Collins, email: gwcollin@ucsd.edu this lecture and lab handouts will be available on http://maecourses.ucsd.edu/labcourse/ MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 1 Main Objectives of Laboratory Experiment: modeling and feedback control of a gyroscopic system rotor drum motor with encoder encoder 3 rotor (body D) rotor drum (body C) brake for axis 3 rotor motor 1 with encoder 1 inner gimbal (body B) outer gimbal (body A) encoder 4 and brake for axis 4 MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide
Main Objectives of Laboratory Experiment: modeling and feedback control of a gyroscopic system Overview of experiments can also be found in a short (online) movie: download at http://maecourses.ucsd.edu/labcourse/movies/gyroscope Control.WMV MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 3 Main Objectives of Laboratory Experiment: modeling and feedback control of a gyroscopic system Ingredients: modeling of dynamic behavior of moment exchange gyro estimation of model parameters using lumped mass system application of control theory for servo/positioning control design, implementation & verification of control sensitivity and error analysis Background Theory: Kinematics and Newton s Law (F = ma), Ordinary Differential Equations (derivation & solutions) Linear System Theory (Laplace transform, Transfer function, Bode plots) Proportional, Integral and Derivative (PID) control analysis and design (root-locus, Nyquist stability criterion) MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 4
Outline of this lecture purpose of control & aim of lab experiment hardware description - schematics - hardware in the lab theory on modeling - modeling a moment exchange gyro - step response of a 1st order system - step response of a nd order system outline of laboratory work - estimation of parameters: experiments - validation of model: simulation & experiments - design and implementation of controllers: P- & PD- & PID summary what should be in your report MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 5 Purpose of Control & Some Applications Application of automatic control: to alter dynamic behavior of a system and/or reduce effect of disturbances. industrial processes - thickness control of steel plates in a rolling-mill factory - consistency control in papermaking machines - size and thickness control in glass production processes - control of chemical, distillation or batch reactors electromechanical systems - anti-lock brakes, cruise control and emission control - position control in optical or magnetic storage media - accurate path execution for robotic systems - vibration control in high precision mechanical systems aerospace and aeronautical systems - flight control of pitch, roll and angle-of-attack in aeroplanes - reduction of sound and vibration in helicopters and planes - gyroscope for altitude control of satellites MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 6
Aim of Lab Experiment Focus on a (relatively simple) mechanical system of rotating masses/inertias connected in gimbals. Objective is to create a stabilizing feedback system to position mass/inertia at a specified location within a certain time and accuracy. Control is needed to reduce: stabilize rotation (progression of gyro) reduce oscillatory behavior (nutation frequency of gyro) Aim of the experiment: insight in control system principles design and implement control system evaluation of stability & performance error analysis and robustness MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 7 Schematics of Hardware Description block diagram w r K actuator u G y sensor Feedback is essential in control to address stability, disturbance rejection and robustness. For implementation of feedback: gyroscope G is equipped with sensors (to measure signals) and actuators (to activate system) For flexibility of control system K: computer control or digital control and is a combination of: ADC (analogue to digital converter) DSP (digital signal processor) DAC (digital to analogue converter) MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 8
Detailed Hardware Description components disturbances encoder amplifier u actuator mech. system sensor y DAC DSP ADC feed forward PC reference plant or partial gyroscope (map from input u to output y) (actuator, inertias, gimbals and encoder) real-time controller (ADC, DSP, DAC, amplifier) Personal Computer (PC) (to run ECP-software and to program DSP) MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 9 Hardware in the Lab moment gyroscope Gimbal: pivoted support that allows rotation about a single axis. Gyroscope: 4 rotating inertias/bodies mounted in gimbals. rotor drum motor with encoder encoder 3 rotor (body D) rotor drum (body C) brake for axis 3 rotor motor 1 with encoder 1 inner gimbal (body B) outer gimbal (body A) encoder 4 and brake for axis 4 MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 10
Hardware in the Lab moment gyroscope rotor drum motor with encoder encoder 3 rotor (body D) rotor drum (body C) brake for axis 3 rotor motor 1 with encoder 1 inner gimbal (body B) outer gimbal (body A) encoder 4 with brake for axis 4 Electro-mechanical brakes to restrict axis rotation Inputs: u = voltage V 1 to rotor motor 1 OR u = voltage V to rotor drum motor Outputs: y = angle θ from encoder (rotor drum) OR y = angle θ 3 from encoder 3 (inner gimbal) OR y = angle θ 4 of encoder 4 (outer gimbal) MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 11 Hardware in the Lab real-time control system real time controller and host PC real-time controller: To implement control algorithm and perform digital signal processing. Contains ADC, DSP, DAC & amplifiers. host-pc: To interact with DSP (run ECP software) and MatLab software. MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 1
Background theory: modeling a moment exchange gyro motor & encoder encoder 3 rotor (body D) rotor drum (body C) brake for axis 3 motor 1 & encoder 1 inner gimbal (body B) outer gimbal (body A) T 1 θ 1 T 3 θ3 θ T T 4 θ 4x1 x 3 encoder 4 with brake for axis 4 x T i = torque applied to bodies (inputs). θ i = angular position of bodies measured by encoders (outputs). T 1 T gyroscope θ 1 θ θ 3 θ 4 MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 13 Background theory: modeling a moment exchange gyro Important parameters (notation) for intertia modeling: body definition angular position inertia A outer gimbal θ 4 I A B inner gimbal θ 3 I B C rotor drum θ I C D rotor θ 1 I D I b = I b 0 0 0 J b 0 0 0 K b, b = body A,B,C or D where I b denotes the inertia along the x 1 -axis, J b denotes the inertia along the x axis and K b denotes the inertia along the x 3 axis for b = A,B,C,D. MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 14
Background theory: modeling a moment exchange gyro motor & encoder encoder 3 rotor (body D) rotor drum (body C) brake for axis 3 motor 1 & encoder 1 inner gimbal (body B) outer gimbal (body A) T 1 θ 1 T 3 θ3 T θ T 4 θ 4x1 x 3 encoder 4 with brake for axis 4 x Model found via (non-linear) equations of motion are found by combining: Kinematic relations Newton s Law ( T = I θ) Result: relation between angular velocity ω i = θ i and inertia I i for rotor (i = 1), rotor drum (i = ), inner gimbal (i = 3) and outer gimbal (i = 4) MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 15 Background theory: modeling a moment exchange gyro Non-linear equations of motion are of the form: T 1 = f 1 (θ,θ 3,ω,ω 3,ω 4, ω 1, ω 3, ω 4 ) (1) T = f (θ,θ 3,ω 1,ω 3,ω 4, ω 1, ω ) () 0 = f 3 (θ,θ 3,ω 1,ω,ω 3,ω 4, ω 1, ω 3, ω 4 ) (3) 0 = f 4 (θ,θ 3,ω 1,ω,ω 3,ω 4, ω 1, ω, ω 3, ω 4 )(4) and are very hard to work with! Simplification we will use during experiments in the lab: Make approximation by considering small perturbations around: ω 1 = Ω (fixed rotational speed of rotor) θ = θ (initial position of rotor drum) θ 3 = θ 3 (initial position of inner gimbal) for model approximation by linearization. MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 16
Background theory: modeling a moment exchange gyro Example of derivation with effects of linearization: J D ω 1 = T 1 J D cos θ ω 3 J D sin θ cos θ 3 ω 4 (1) (I C +I D ) ω = T J D Ωsin θ ω 3 +J D Ωcos θ cos θ 3 ω 4 +(I C +I D )sin θ 3 ω 4 () (J B +J C +J D (J C +J D I D K C )sin θ ) ω 3 = J D cos θ ω 1 +J D Ωsin θ ω J D Ωsin θ sin θ 3 ω 4 sin θ cos θ cos θ 3 (3) (I B +I C K B K C (J C +J D I D K C )sin θ )sin θ 3 ) ω 4 = J D sin θ cos θ 3 ω 1 J D Ωcos θ cos θ 3 ω +(I C +I D )sin θ 3 ω + J D Ωsin θ sin θ 3 ω 3 (J C +J D I D K C )sin θ cos θ cos θ 3 ω 3 (I D +K A +K B +K C +(J C +J D I D K C )sin θ (4) Looks complicated, don t expect you to remember this... However, note: all red terms are constant! Basically: 4 coupled linear equations that relate ω,ω 3,ω 4, ω 1, ω, ω 3, ω 4 to the torques T 1 and T. MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 17 Background theory: modeling a moment exchange gyro The 4 coupled linear equations that relate ω,ω 3,ω 4, ω 1, ω, ω 3, ω 4 to the torques T 1 and T can be written in the matrix notation J ω(t) = Dω(t)+QT(t) where the vector ω(t) of rotational speeds is given by ω 1 (t) [ ] ω ω(t) = (t) T1 (t) and T(t) = ω 3 (t) T (t) ω 4 (t) and where J, D and Q are all previous red terms based on a linearization around ω 1 = Ω (fixed rotational speed of rotor) θ = θ (initial position of rotor drum) θ 3 = θ 3 (initial position of inner gimbal) MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 18
Background theory: modeling a moment exchange gyro Choose: ω 1 = Ω (constant rotor speed) θ = θ = 0 (rotor drum perpendicular) θ 3 = θ 3 = 0 (inner gimbal perpendicular) then the 4 coupled linear differential equations reduce to J D ω 1 +J D ω 3 = T 1 (I C +I D ) ω = J D Ωω 4 +T (J B +J C +J D ) ω 3 +J D ω 1 = 0 (I D +K A +K B +K C ) ω 4 = J D Ωω and we see J ω(t) = Dω(t)+QT(t) with J D 0 J D 0 0 (I J = C +I D ) 0 0 J D 0 (J B +J C +J D ) 0 0 0 0 (I D +K A +K B +K C ) 0 0 0 0 1 0 0 0 0 J D = D Ω 0 0 0 0, Q = 0 1 0 0 0 J D Ω 0 0 0 0 MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 19 Background theory: modeling a moment exchange gyro If we extend the vector ω(t) of angular velocities to also contain (some of) the angular positions x(t) = [ θ (t) θ 3 (t) θ 4 (t) ω 1 (t) ω (t) ω 3 (t) ω 4 (t) ] T then we can write down a so-called state space model ẋ(t) = Ax(t)+Bu(t) y(t) = Cx(t) where u(t) are inputs (torques by motor 1 or motor ) and y(t) are outputs (angular rotation from encoders). In our case matrix C will be C = 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 for θ, θ 3 and θ 4 as output With θ i (t) = ω i (t) and J ω(t) = Dω(t)+QT(t) we see [ ] [ ] 03 3 U A = 3 4 03 3 0 4 4 J 1, B = D J 1, U Q 3 4 = 0 1 0 0 0 0 1 0 0 0 0 1 MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 0
Background theory: modeling a moment exchange gyro Format of linearized model of gyro in state space form: ẋ(t) = Ax(t)+Bu(t), where y(t) = Cx(t) u(t) = [ T1 (t) T (t) ], y(t) = θ (t) θ 3 (t) θ 4 (t) x(t) = [ θ (t) θ 3 (t) θ 4 (t) ω 1 (t) ω (t) ω 3 (t) ω 4 (t) ] T and, 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 A = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 J 0 0 0 0 DΩ I D+K A+K B+K C 0 0 C = J DΩ I C+I D, B = 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 J B+J C+J D J D(J B+J C) 0 0 1 1 I C+I D J B+J C 0 0 0 MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 1 Background theory: modeling a moment exchange gyro T 1 T gyroscope θ 1 θ θ 3 θ 4 Resulting model of gyro is a linear and multivariable model. Further assumptions for your laboratory experiment: Voltage applied to motor 1 & motor can be used to create external torque T 1 and T. Angular positions θ i = angular position for i =,3,4 can be measured via angular encoders. Further simplifications for your laboratory experiment: Lock one or more axis using brake switches for axis 3 or 4 and virtual brake for axis. Consider only ONE motor to create torgue T j and ONE measurement θ i at the time for simplified Single Input Single Output (SISO) control. MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide
Background theory: modeling a moment exchange gyro Impact of this simplification: Using only ONE motor to create a torgue T j and ONE measurement θ i at the time, reduces the multivariable model to a different SISO models. This SISO model can be written as a transfer function G ij (s) MAIN RESULT Let C i be the ith row of the matrix C and let B j denotes the jth column of the matrix B, then G ij (s) = C i (si A) 1 B j where i =,3,4 due to encoder, 3 or 4 and i = 1, due to motor input 1 or. Example: transfer function from motor to encoder 4 ΩJ D θ 4 (s) = G 4 (s)t (s), G 4 (s) = (I C +I D )(I D +K A +K B +K C )s +Ω JD 1 s MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 3 Background theory: modeling a moment exchange gyro motor & encoder encoder 3 rotor (body D) rotor drum (body C) brake for axis 3 motor 1 & encoder 1 inner gimbal (body B) outer gimbal (body A) T 1 θ 1 T 3 θ3 θ T T 4 θ 4x1 x 3 encoder 4 with brake for axis 4 x Configurations of the simplified gyroscope during your lab: Week 1: brake 4 on and (virtual) brake on. Measure θ 3, control motor 1: inertial control. Week : brake 3 on and ω 1 = Ω. Measure θ, control motor : nutation frequency control. Week 3: brake 3 on and ω 1 = Ω. Measure θ 4, control motor : precession control. MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 4
Background theory: modeling a moment exchange gyro Models during your lab: Week 1: brake 4 on and (virtual) brake on leads to 1 y 3 (s) = G 31 (s)u 1 (s), with G 31 (s) = (J B +J C )s Week : brake 3 on and ω 1 = Ω: y (s) = G (s)u (s) with I D +K A +K B +K C G (s) = (I C +I D )(I D +K A +K B +K C )s +Ω JD Week 3: brake 3 on and ω 1 = Ω: y 4 (s) = G 4 (s)u (s) with G 4 (s) = ΩJ D (I C +I D )(I D +K A +K B +K C )s 3 +Ω J D s MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 5 Background theory: reduction to 1DOF system Transfer functions G 31 (s), G (s) and G 4 (s) look complicated, but are basically of the form: G 31 (s) = G (s) = G 4 (s) = 1 (J B +J C )s = I D +K A +K B +K C (I C +I D )(I D +K A +K B +K C )s +Ω J D ΩJ D (I C +I D )(I D +K A +K B +K C )s 3 +Ω J D s = = K 0 s +β 0 s K 1 ω n s +βω n s+ω n K ω n s +βω n s+ω n 1 s where we have the (lumped) parameters: scaling K 0, (additional) damping β 0 scaling K 1, damping β and nutation frequency ω n scaling K, damping β and nutation frequency ω n MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 6
Background theory: reduction to 1DOF system To be able to do control design, you need to find the parameters of the transfer functions G 31 (s) = G (s) = G 4 (s) = 1 (J B +J C )s = I D +K A +K B +K C (I C +I D )(I D +K A +K B +K C )s +Ω J D ΩJ D (I C +I D )(I D +K A +K B +K C )s 3 +Ω J D s = = K 0 s +β 0 s K 1 ω n s +βω n s+ω n K ω n s +βω n s+ω n 1 s Hence, for modeling we would need to determine inertia of bodies in three different axes... Alternative to determining inertia of bodies in three different axes: determine (lumped) parameters K 0, K 1, K, β 0, β 1 and ω n via dynamic experiments (step response experiments). MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 7 Background theory: step response of a 1st order system Let us consider G 31 (s) = K 0 s +β 0 s as our model for our 1st week laboratory experiment: Instead of using the position θ 3 (t) as output, consider using the velocity ω 3 (t) as output. With ω 3 (t) = d dt θ 3(t) we have ω 3 (s) = sθ 3 (s) using Laplace. Hence, choosing ω 3 (t) as an output y 3 (t) modifies G 31 (s) s to a simple 1st order system: y 3 (s) = K 0 s+β 0 u 1 (s) You can determine (K 0,β 0 ) from a dynamic (step response) experiment... MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 8
Background theory: step response of a 1st order system MAIN RESULT Consider a 1st order system with a transfer function G ij (s) = K s+β then a step input u(t) = U, t 0 of size U results in the output response y(t) = K [ β U 1 e βt] Result follows directly from inverse Laplace transform of y(s) = G ij (s) U s = KU s+β 1 s MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 9 Background theory: step response of a 1st order system Typical picture of y(t) = K β U [1 e βt] for a step size of U = 1, scaling K = 5, and (inverse) time constant β = 0.: 30 5 y(t) 0 15 10 5 0 0 5 10 15 0 5 30 How about the inverse problem of finding β and K from (velocity) measurement y(t)? MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 30
Background theory: step response of a 1st order system With d dt y(t) t=0 and y from velocity step response: 30 5 d dt y(t) t=0 0 15 y 10 5 0 0 5 10 15 0 5 30 We see d dt y(t) t=0 = K Ue βt t=0 = K U and hence ˆK = 1 U d dt y(t) t=0 Knowing that the (velocity) lim t y(t) = y = K β ˆβ = ˆK y U U we find MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 31 Background theory: step response of a nd order system Let us consider K G (s) = 1 ω n s +βω n s+ω n as our model for our nd week laboratory experiment: This is a standard second order system, where ω n = undamped (nutation) frequency, 0 β 1 is the damping ratio, K is the gain. This is similar to the transfer function of a 1DOF mechanical system (with possibly zero damping d)! d F(t) k m x(t) mẍ(t)+dẋ(t)+kx(t) = F(t) x(s) = 1 ms +ds+k F(s) MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 3
Background theory: step response of a nd order system In case k > 0 we can write where G(s) = 1 ms +ds+k = Kω n s +βω n s+ω n K := 1 k (compliance), k ω n := m (resonance), β := 1 d (damping ratio) mk Note the resemblance with the nd week lab experiment model I D +K A +K B +K C K 1 ω n G (s) = (I C +I D )(I D +K A +K B +K C )s +Ω JD = s +βω n s+ω n You you determine (K 1,ω n,β) from a dynamic (step response) experiment... MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 33 Background theory: step response of a nd order system MAIN RESULT Consider a nd order system with a transfer function Kω n G ij (s) = s +βω n s+ωn then a step input u(t) = U, t 0 of size U results in the output response y(t) = K U [ 1 e βωnt sin(ω d t+φ) ] where ω d = ω n 1 β damped resonance frequency in rad/s φ = tan 1 1 β phase shift of response in rad β MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 34
Background theory: step response of a nd order system DERIVATION for 1DOF (second order) system Compute the dynamic response via inverse Laplace transform! Consider a step input u(t) = U, t 0 of size U. Then u(s) = U s and for the 1DOF system we have Kω n y(s) = G(s)u(s) = s +βω n s+ωn U s and the inverse Laplace transform is given by y(t) = K U [ 1 e βω nt sin(ωd t+φ) ] where ω d = ω n 1 β damped resonance frequency in rad/s φ = tan 1 1 β phase shift of response in rad β MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 35 Background theory: step response of a nd order system Typical picture of y(t) = K U [ 1 e βω nt sin(ω d t+φ) ] for a step size of U = 1, scaling K = 5, undamped resonance frequency ω n = π 1.566 rad/s and damping ratio β = 0.: 8 7 6 5 y(t) 4 3 1 0 1 0 0.5 1 1.5.5 3 3.5 4 How about the reverse problem of finding ω n, β and K from y(t)? MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 36
Background theory: step response of a nd order system With the times t 0, t n and the values y 0, y n and y from (position or velocity) step response: 8 7 6 5 4 3 y 0 y n y 1 0 1 t 0 t n 0 0.5 1 1.5.5 3 3.5 4 Allows us to estimate: n ˆω d = π (damped resonance frequency) t n t 0 ( ) βω 1 y0 y n = ln (exponential decay term) t n t 0 y n y where n = number of oscillations between t n and t 0. MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 37 Background theory: step response of a nd order system With the estimates n ˆω d = π t n t 0 ( ) βω 1 y0 y n = ln t n t 0 y n y (damped resonance frequency) (exponential decay term) we can now compute ˆω n and ˆβ: ˆω n = ˆω d +( βω n ) (undamped resonance frequency) βω n ˆβ = ˆω n and K follows from ˆK = y U (damping ratio) (compliance) MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 38
Background theory: step response of a nd order system Let us now consider K G 4 (s) = ωn s +βω n s+ωn 1 s as our model for our 3nd week laboratory experiment: Instead of using the position θ 4 (t) as output, consider using the velocity ω 4 (t) as output. With ω 4 (t) = d dt θ 4(t) we have ω 4 (s) = sθ 4 (s) using Laplace. Hence, choosing ω 4 (t) as an output y 4 (t) modifies G 4 (s) s back into a standard nd order system y 4 (s) = K ωn s +βω n s+ωn u (s) NOTE: we can use the same step response results and parameter estimation as we did in our nd week laboratory experiment to estimate K, β and ω n. MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 39 Outline of Lab Work: estimation of model parameters Important observation: gyroscope in 1st week lab experiment appears (dynamically) equivalent to a second order system with G ij (s) = K 0 s +β 0 s and can be reduced to a 1st order system G ij (s) s = K 0 s+β 0 when using the velocity ω 3 (t) as output y 3 (t). Main Idea: Experiment: use a step response laboratory experiment to formulate parameter estimates ˆK and ˆβ 0. Validate model, so that measured step response looks similar to simulated step response MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 40
Outline of Lab Work: estimation of model parameters Important observation: gyroscope in nd and 3rd week lab experiment appears (dynamically) equivalent to a single 1DOF with a transfer function where Main Idea: G ij (s) = Kω n s +βω n s+ω n K := scaling, ω n := nutation frequency, β := damping ratio Experiment: use a step response laboratory experiment to formulate parameter estimates ˆK, ˆω n and ˆβ. Validate model, so that measured step response looks similar to simulated step response MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 41 Outline of Lab Work: estimation of model parameters 8 EXAMPLE: step of U = 0.5V on motor 7 6 5 Read from plot: t 0 = 0.5, t n = 1.5, y 0 = 7.5, y n = 5.5, y = 5 n ˆω d = π = π t n t 0 ( 1.5 0.5 ) = 4π 1 y0 y βω n = ln = t n t 0 y n y ˆω n = 1 1.5 0.5 ln 4 3 1 0 1 y 0 y n y t 0 t n ˆω d +( βωn ) = 16π +ln(10) 1.78 ˆβ = βω n ln(10) ˆω n 1.78 0.18 ˆK = y U = 5 0.5 = 10 0 0.5 1 1.5.5 3 3.5 4 ( ) 7.5 5 = ln(10) 5.5 5 Units of ˆK? Does it matter? MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 4
Outline of Lab Work: estimation of model parameters Conclusions and summary of work: Verify transfer function you are working with (week 1, or 3) It will be of the form G ij (s) = K ( ) s+β 1 s or G ij (s) = Kω ( ) n 1 s +βω n s+ω n s Estimate the parameters model parameters (K, ω n, β) via the measurement of a step response. Verify the simulation of your step response with the measurement of a step response. Substitute parameter values to create your dynamic model G(s) to be used for control design Luckely, we have Matlab and a matlab script/function called maelab.m to help you with his. Simply enter your models in a file called models.m MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 43 Outline of Lab Work: estimation of model parameters NOTES: During week 1 you DO NOT use a constant rotor speed Ω, as you will be controlling the rotor motor 1 yourself. During week & 3 you DO use a constant rotor speed Ω. For each laboratory section a different constant rotational rotor speed Ω is used. The rotational rotor speed you will be working with is given in the config.txt or info.txt file. Model parameters (K, ω n, β) will depend on physical quantities (mass, inertia, damping, etc.) and need to be determined during laboratory Important in validation of laboratory work: comparison of actual (dynamic) experiments with a (dynamic) simulation of your model G(s) before you start doing control design! With a bad model you cannot do a proper control design... MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 44
Outline of Lab Work: model validation w r K actuator u G y sensor Keep in mind: From parameter estimation experiments we know obtain a model specified as a transfer function model y(s) = G ij (s)u(s) G ij (s) = K s +βs or G ij(s) = Kω ( n s +βω n s+ω n where u(s) = is control input (motor Voltage or Force) and y(t) = system output (position in encoder counts) Model G(s) is created automatically for you via maelab.m script file by modifying the models.m file. You are going to use the model G(s) to design a controller K(s), so model G(s) should be validated first! MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 45 1 s ) Outline of Lab Work: model validation What is suitable for model validation: Validate the estimation of each set of model parameters by comparing actual experiments with a simulation of a 1DOF model G ij (s). This can be done with the maelab.m script file. With a bad (unvalidated) model G ij (s) you cannot do a proper model-based control K(s) design! MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 46
Outline of Lab Work: design of controllers Each week you construct feedback loop around G(s): r e K(s) u G(s) y Schematic view of closed loop configuration Find a feedback controller K(s) that satisfies: move a mass/inertia to a certain (angular) position as fast as possible limit overshoot during control/positioning to 5% no steady-state error e illustrate disturbance rejection when control is implemented Trade off in design specifications: high speed overshoot overshoot robustness MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 47 Outline of Lab Work: design of controllers Controller configurations that can be implemented: P-control PD-control PID control u(t) = k p e(t), e(t) = r(t) y(t) d u(t) = k p e(t)+k d e(t), e(t) = r(t) y(t) dt t u(t) = k p e(t)+k i e(τ)dτ +k d d e(t), e(t) = r(t) y(t) τ=0 dt MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 48
Outline of Lab Work: design of controllers All controllers are implemented in a discrete-time! Let T s = sample time, t = kt s and e(k) = r(k) y(k) we get P-control u(k) = k p e(k) PD-control PID control u(k) = k p e(k)+ k d T s [e(k) e(k 1)] u(k) = k p e(k)+k i T s k l=0 e(l)+ k d T s [e(k) e(k 1)] Templates will be available for you to enter your control parameters k p, k d and/or k i. MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 49 Outline of Lab Work: design of controllers Example of template ;***********define user variables ************** #define kp q ; proportional gain #define kd q3 ; derivative gain #define ki q4 ; integral gain #define Ts q5 ; sampling time for scaling of derivative and integral gain #define kdd q6 ; scaled derivative gain #define kii q7 ; scaled integral gain #define enc_prev q8 ; keep track of previous encoder measurement for derivative #define error q9 ; keep track of error signal for integration ;************Initialize variables**************** Ts=.0044 ; For local use only. Must ALSO be set in SETUP CONTROL ALGORITHM dialog box! kp=0. ; set proportional gain kd=0.0 ; set derivative gain ki=0. ; set integral gain kdd=kd/ts ; divide by Ts here to save real-time processing kii=ki*ts ; multiply by Ts here to save real-time processing error=0 ; initialize integrator error ;PID Controller that uses encoder and motor (nutation control) ;********* real time code which is run every servo period *** begin error=error+cmd_pos-enc_pos control_effort=kp*(cmd_pos-enc_pos)+kii*error+kdd*(enc_prev-enc_pos) enc_prev=enc_pos end MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 50
Outline of Lab Work: design of controllers (loop gain) Model G(s) of plant should be used for design of controller K(s)! r e K(s) u G(s) y For design of controller K(s), consider the loop gain: L(s) := K(s)G(s) r e L(s) y loop gain: series connection of K(s) and G(s) Dynamics of loop gain L(s) consists of fixed part G(s) (plant dynamics) and to-be-designed part K(s) (controller) MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 51 Outline of Lab Work: design of controllers (stability) Loop gain L(s) := K(s)G(s) important for: Stability Design specification STABILITY: With closed-loop poles found by those values of s C that satisfy 1+L(s) = 0 all closed-loop poles should have negative real values (lie in the left part of the complex plane) Stability can be checked by: Actually computing the solutions to L(s) = 1 as a function of k p, k i, k d : Root Locus Method See if Nyquist plot of L(s) encircles the point 1 as a function of k p, k i, k d : Nyquist or Frequency Domain Method MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 5
Outline of Lab Work: design of controllers (design specs) r e L(s) y Error rejection transfer function: E(s) = 1 1+L(s) (map from r to e) To avoid a steady state error e(t) as t, one specification for the loop gain can be found via the final value theorem. With L(s) = G(s)K(s) we have: lim e(t) = lim t s 1 s 0 1+L(s) r(s) With r(t) = (unit) step input, r(s) = 1 s and lim L(s) = s 0 is needed for zero steady-state behavior! MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 53 Outline of Lab Work: design of controllers (design specs) r e L(s) y Closed loop transfer function: T(s) = L(s) 1+L(s) (map from r to y) To make sure y follows r, we would like to make T(s) = 1 as close as possible. Notice that with Error rejection transfer function: we have E(s) = 1 1+L(s) (map from r to e) T(s)+E(s) = 1 Hence, if you can make E(s) 0 small, then T(s) 1. MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 54
Outline of Lab Work: design of controllers (graphical design) Computation of K(s): translate design specifications to L(s), E(S) or T(s) specifications. Use graphical analysis and design utilities (root locus or frequency domain methods) to shape loop gain L(s) and design controller K(s). Root-locus and frequency domain design method is implemented in Matlab via the rltool command. Frequency domain design method has also been implemented in a Matlab script file maelab provided during the lab. Stability via Nyquist criterion (do not encircle point -1) Phase and amplitude margin (stability and robustness) translate to shape Bode plot of loop gain L(s) = G(s)K(s): phase margin: when L(s) = 1, L(s) > π rad amplitude margin: when L(s) = π rad, L(s) < 1 MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 55 Outline of Lab Work: design of controllers (graphical design) Example of figures produced by maelab script file 10 magnitude L(s) L(s)=G(s)*C(s) 4 Nyquist contour L(s) 10 1 magnitude 10 0 imag 0 10 1 10 10 10 0 10 frequency [Hz] phase L(s) 50 4 4 0 4 real 10 1 magnitude L(s)/(1+L(s)) [r(s) > y(s)] phase [deg] 0 50 100 150 00 10 10 0 10 frequency [Hz] magnitude 10 0 10 1 closed loop stable 10 10 10 0 10 frequency [Hz] MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 56
Outline of Lab Work: design of controllers (general trend) Effects of control parameters: for PD-control and a standard nd order plant model this can be analyzed as follows: ωn s +βω n s+ωn ωn T(s) = L(s) (k p +k d s) 1+L(s) = 1+(k p +k d s) s +βω n s+ωn which yields the closed-loop transfer function T(s) = ω n (k p +k d s) s + β ω n + ω n with ω n = ω n 1+k p and β = β +ω nk d / 1+kp In this case T(s) is also a second order system and with knowledge of the step response, we can conclude that the following influence of the controller parameters: k p speed of response k p damping k p steady-state error k d damping MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 57 Outline of Lab Work: design of controllers (summary) Model G(s) of plant should be used for design of your controller K(s)! Think about the controller needed (P, PD or PID) to stabilize your system Obviously, controllers K(s) for week 1, and 3 are all different and G(s) is different! Keep in mind the requirement of 5% overshoot, and no steady state error, e.g. r(t) = y(t) as t. Use graphical design tools to design your P, PD and PID control: Root-locus and frequency domain design method is implemented in Matlab via the rltool command. Frequency domain design method also implemented in a Matlab script file maelab provided during the lab. MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 58
Outline of Lab Work: design of controllers (summary) Consider how the frequency resp of P- and PD- and PID controller modifies the loop gain L(s) = G(s)K(s). Look at asymptotes of Bode plot of controller K(s) = k ds +k p s+k i s Phase and amplitude margin (stability and robustness) translate to shape Bode plot of loop gain L(s) = G(s)K(s): phase margin: when L(s) = 1, L(s) > π rad amplitude margin: when L(s) = π rad, L(s) < 1 Argument and motive your control design in rapport. No trial-and-error control design results are accepted. MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 59 Summary of Lab Work first week Study laboratory handout. Get familiar with the multi-input-multi-output (MIMO) moment gyroscope system, introduction to ECP software used for experiments and controller implementation. Engage axis 4 brake (lock outer gimbal) and virtual brake (lock rotor drum). Design and implement feedback using motor 1 as input and encoder 3 as output. Propose experiments to estimate (unknown) parameters in your model of the system. Design controller based on model in Matlab and implement/verify on actual system. second week Engage axis 3 brake (lock inner gimbal). Bring rotor at fixed speed Ω. Design and implement feedback using motor as input and encoder as output. Propose experiments to estimate (unknown) parameters in your model of the system. Validation of model parameters via comparison of simulation and experiments.design controller based on model in Matlab and implement/verify on actual system. third week Engage axis 3 brake (lock inner gimbal). Bring rotor at fixed speed Ω. Design and implement feedback using motor as input and encoder 4 as output. Propose experiments to estimate (unknown) parameters in your model of the system. Validation of model parameters via comparison of simulation and experiments. Validation of nutation & precession of MIMO moment gyroscope dynamics.design controller based on model in Matlab and implement/verify on actual system. MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 60
What should be in your report (1-) Abstract Standalone - make sure it contains clear statements w.r.t motivation, purpose of experiment, main findings (numerical) and conclusions. Introduction Motivation (why are you doing this experiment) Short description of the main engineering discipline (controls) Answer the question: what is the aim of this experiment/report? Theory Feedback system Modeling Parameter estimation Control design MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 61 What should be in your report (-) Experimental Procedure Short description of experiment How are experiments done (detailed enough so someone else could repeat them) Results Estimation of parameters K, ω n and β Validation of models G ij (s) Design of controller K(s) and Implementation Discussion Why are simulation results different from experiments? Could the model be validated? Are designed controller parameters O.K. from model? Conclusions Error Analysis Mean, standard deviation and 99% confidence intervals of estimated parameters ω n, β and K from data MAE175a Control Experiment, Winter 014 R.A. de Callafon Slide 6