Adc Sysid
Adc Sysid
Adc Sysid
Lecture Outline
Introduction Optimization: MATLAB Toolbox System Identification Control Design Conclusions Problems
u(t) D(s)
-
Continuous controller can be built using analog electronics A digital controller can take the place of continuous controller The mechanical system or plant considered analog or continuous
(REF: CMU)
r(k) e(k)
+ -
u(t)
D/A and Hold
y(k)
A/D
Digital controller operates on discrete signals (or samples) rather than continuous signals Implementation: Normally as discrete functions either in transfer (REF: CMU) function or state-space forms (difference equations)
vi
The electrical time constant L/R considered negligible: & )/R i = ( vi K e m && + ( B + K K / R ) & + T sgn( & ) = K v / R J m m t e m f m t i L
Motor Datasheet: Resistance Inductance Torque constant Back EMF constant Simplifications: Direct drive (N=1) No Gear Backlash (hysteresis, deadzone)
(REF: Wen)
Controller outputs +/- 10 Volts. Employ current amplifier to convert voltage to current Current energizes motor to produce torque at shaft Amplifier Options:
Linear: output current proportional to input voltage PWM: output current switched between max/min voltages at high frequency (20-50Khz) with duty cycle proportional to input voltage (such as 50%)
(REF: Wen)
Current controlled voltage source internal portion of PWM amplifier voltage characteristics: Required Voltage
When PWM frequency is Applied much larger than the Voltage Reference system frequency of Voltage interest then applied Ka voltage can be reduced to average value established Linearized for one PWM cycle Applied voltage voltage supply saturation Result: PWM and power (constant gain) stage considered as perfect voltage source as long as Voltage supply smaller than maximum available DC voltage If required voltage realizable then will
be fully applied otherwise limited to maximum available (REF: Friedrich)
Effectively: i = K aVD / A is subject to saturation due to max amp current, max supplied voltage, and back EMF
(REF: Wen)
Rotational encoder generates counts from the up/down edges of A/B channels. Quadrature decoding gives an effective multiplier of 4 For a 1000 line encoder the resolution will give 2pi/(1000*4) or
K enc
Ideally, encoder can be modeled as a gain with a fixed integer resolution of 1 count = 1.57 mrad = 0.09 deg Other types of sensors (tachometers, potentiometers) may have additional dynamics, such as low pass 1st or 2nd order filters used to minimize noise, etc.
(REF: Wen)
Quantization: analog signal with D/A and A/D conversions are defined in terms of finite word length For 12-bit word that represents +/- 10 V the resolution becomes 20/212 =2.44 mv. Effects control output and measured input signals Encoder quantization can effect velocity estimation through finite differencing Therefore a detailed simulation model would need to take into consideration
(REF: Wen)
C ( s) / E ( s) = K P + K I / s + K D s
e( kT ) e[( k 1)T ] CD ( z ) z 1 = T E ( z) Tz Integral action: to preserve 1 both regions of stability and C I ( s ) = sys = C I ( z ) = c 2d ( sys, T , ' tustin' ) instability when mapping from s s to z employ the bilinear C I ( z ) T ( z + 1) transformation: = 2 ( z 1) Resulting z-transform model of E ( z ) cD ( kT ) =
PID controller:
( z 1) C( z) T ( z + 1) = KP + KI + KD 2( z 1) E ( z) Tz
(REF: Background Matl)
If sampling is fast enough, even w/o bilinear, no problems should occur. However, when under-sampled the results are instability and inaccuracy.
T f ( s ) + Td ( s )
r(k) e(k)
-
u(k)
VD / A
T ( z + 1) KI 2 ( z 1)
1 ( z 1) KD T z
Ka s a + 1
Current Amplifier
Kt J T s 2 + Bs
DC Motor plus load
clock
y(k)
Digital controller
K enc
y (t ) = m (t )
What if encoder generates spurious signal creating a large error term which in term generates a large correction term? What happens if the correction term is larger than the maximum D/A output? Saturation nonlinearity term coded before the D/A converter for prevention needs further investigation. What about integrator anti-reset windup? Reset windup or integrator saturation can occur if output saturates and the controller continues to integrate the error. Problem automatically avoided when velocity form of algorithm is used, then integration stops automatically when the output is limited. If using the position form then one way to stop updating the integrator when the output is limited is to use conditional integration, where the integral part of the controller is used only when the error is sufficiently small. Additional logic and coding implementation needs to be considered.
(REF: Background Matl, Klafter)
Mechanical system with embedded controller prototype (hardware) Model development (physics/mechatronics) Plant model system identification Digital control system design Experimental/predicted correlation and performance results
Formal control design methods invariably rely on a plant model. The plant model can be derived from first principles but often contains unknown parameters. Experiments must be conducted to gather information on the behavior of the plant dynamics to help estimate these parameters. Typically, values for physical parameters such as moments of inertia, masses, rod lengths, and gear ratios are well known and can be incorporated into the model. Parameters such as friction coefficients, viscosity, and stiction behavior, however, are not precisely known. Measured data from the rapid prototyping system can be used with the first-principle description to calibrate these parameters using Simulink Parameter Estimation (SPE) SPE allows the selection of a set of parameters and states to be estimated. Min/max values of the parameters and initial states can be set, in addition to the expected values. SPE uses optimization algorithms from the Optimization Toolbox and, optionally, the Genetic Algorithm and Direct Search Toolbox.
3.
4.
Linear system identification tools are useful if the dynamics of a system behave in a near-linear manner about a given operating condition, but cannot be modeled from first principles. The System Identification Toolbox computes linear discrete and continuous models using both time and frequency domain data. Transfer function estimation is another process that takes experimental data and converts it using spectral estimation techniques to compute the frequency response of a system. The Signal Processing Toolbox has many functions to support the estimation of a transfer function. If linear models do not describe the model accurately and the underlying equations of motion are not well known, a nonlinear black box neural network can be created using the Neural Network Toolbox.
Applied SYS-ID (Jer-Nan Juang). The Observer/Kalman filter Identification (OKID) algorithm, is formulated entirely in the time-domain. The method computes the Markov parameters of a linear system, from which the state-space model and corresponding observer are determined simultaneously. The OKID method can effectively identify statespace models using time-domain (and frequency response data) I/O data. Flexible Robot Dynamics and Control, Chapter 4 SYS-ID (Robinett, et.al.). SYS-ID plays a key role in control system design. The first thing that a controls engineer learns in the real world is that the transfer function is not written on the outside of the H/W container. SYS-ID is used to obtain the transfer function and the critical parameters of plant models for controller design. Several SYS-ID techniques are reviewed with examples: Linear Least Squares, Nonlinear Least Squares (NLS), Frequency Domain NLS Optimization Techniques: VFO2AD Fortran optimization programs from Harwell Subroutine Library (freeware) for minimizing arbitrary performance index as a function of parameter constants and subject to both equality and inequality constraints (UPDATE: LANCELOT code?) http://hsl.rl.ac.uk/archive/hslarchive.html. MATLAB Optimization Toolbox: fmincon constrained nonlinear optimization functions.
Multi-objective optimization is concerned with the minimization of a vector of objectives f(x) that can be the subject of a number of constraints or bounds.
x c( x ) 0 ceq( x ) = 0
f ( x)
Subject to:
A x b Aeq x = beq lb x ub
Where x, b, beq, lb, and ub are vectors, A and Aeq are matrices, c(x) and ceq(x) are functions that return vectors, and f(x) is a function that returns a scalar. f(x), c(x), and ceq(x) can be nonlinear functions.
(REF: MATLAB Opt. Toolbox)
tf
Simulink model
kp encoder From Workspace ENCODER DESIRED encoderdot From Workspace ENCODER RATE DESIRED KP proportional gain kd KD derivative gain ka AMP Gain AMP Saturation Kt Jt.s+B DC Motor plus load 1 s Integrator
Zero-Order Hold
velocity
Ts=1 msec
motor_sysid_opt.mdl
6 4 2 0 -2
Calibration runs used skeleton PD controller to generate experimental closed-loop data sets Model parameters are frozen for validation run Friction may be both velocity and position dependent due to offset in position response Friction model refinements
50 40 30 20 10 0 -10
100 80 60 40 20 0 -20 0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.2
0.4
0.6
0.8
1.2
1.4
Time (sec)
Time (sec)
10
0.1
0.2
0.3
0.4
0.5
0.6
0.7
-5
0.2
0.4
0.6
0.8
1.2
1.4
Time (sec)
Time (sec)
amp_out
torque_out
Simulink model
1 s
ka
z+1 z-1
1/z
ki*ts/2 KI kd/ts KD
Integrator
yout To Workspace
ZOH
z-1 z
1/z
encoderdot From Workspace ENCODER RATE DESIRED ncoderdot_ex From Workspace ENCODER RATE EXP
velocity
pid_sysid_opt.mdl
Discussed servo modeling, assumptions, and limitations Introduced some SYS-ID methods Reviewed fmincon in MATLAB optimization toolbox Simulated servo system optimization for model matching and calibration Set-up controller gain optimization problem
1000
1000
800
800
Theta (counts)
600 input shaped reference in 400 experimental response . simulation response 200
400
0 0
0.5
1.5
2 Time (sec)
2.5
3.5
-200 0
0.5
1 Time (sec)
1.5
2.5
Optimization based on high fidelity model help ID nonlinear friction and generate an input profile that compensated for this nonlinearity
(REF: Wilson)
May include an extra credit portion during projects Potential extra credit problem set
Carnegie Mellon University (CMU), Digital Control Tutorial, on internet. J. Wen, ECSE 4962 Control Systems Design, Lecture #4, Dept. ECSE, RPI, Feb. 2003, on internet. Robbins & Myers/Electro-Craft, DC Motors Speed Controls Servo Systems, Electro-Craft. P.G. Friedrich, Modelling of a Wound Rotor Salient Pole synchronous Machine and its Converter in the Constant Power Zone, on internet. P. Mosterman, et. al., Embedded Real-Time Control via MATLAB, Simulink, and xPC Target, on internet. R.D. Klafter, et. al., Robotic Engineering an Integrated Approach, PrenticeHall, 1989. Jer-Nan Juang, Applied System Identification, Prentice-Hall, 1994. R.D. Robinett, III, et. al., Flexible Robot Dynamics and Controls, Chapter 4, Kluwer Academic/Plenum Publishers, 2002. MATLAB, Optimization Toolbox, Users Guide, The Mathworks, 2005. D.G. Wilson, D. Stokes, G.P. Starr, and R.D. Robinett, III, Optimized Input Shaping for a Single Flexible Robot Link, In SPACE 96: 5th International Conference and Exposition on ECOS, Albuquerque, NM, June 1996.
R.G. Jacquot, Modern Digital Control Systems, Marcel Dekker, Inc., 1981. K.J. Astrom and B. Wittenmark, Computer Controlled Systems, Prentice-Hall, 1984 C.L. Phillips and H.Troy Nagle, Digital Control System Analysis and Design, 2nd Ed., Prentice Hall, 1990.