Upload
ptyxaubl
View
213
Download
0
Embed Size (px)
Citation preview
7/29/2019 MIT16_30F10_lec20
http://slidepdf.com/reader/full/mit1630f10lec20 1/10
Topic #20 16.30/31 Feedback Control Systems
Digital Control Basics • Effective Delay
Emulation•
7/29/2019 MIT16_30F10_lec20
http://slidepdf.com/reader/full/mit1630f10lec20 2/10
Fall 2010 16.30/31 20–1Digital Control
Control picture so far • d r
Gc(s) G p(s) e u y −
Can implement this using analog circuits, but as you have seen, there • are many advantages to implementing these using a computer – much more flexible
In this case the new picture is: •
Gc(s) D2A A2D
G p(s)A2D r(t) ek uk u(t) y(t)
yk
−
Digital Computer
November 5, 2010
7/29/2019 MIT16_30F10_lec20
http://slidepdf.com/reader/full/mit1630f10lec20 3/10
Fall 2010 16.30/31 20–2Digital Control Mechanics
• Digital/discrete control runs on a clock • Only uses the input signals at discrete instants in time • So continuous e(t) is sampled at fixed periods in time e(kT s) • Where T s is the sampling period and k is an integer
• Must also get information into and out of the computer • Requires A/D and D/A operations
• The A/D consists of 2 steps: 1. Convert a physical signal (voltage) to a binary number, which is
an approximation since we will only have a 12-16 bits to cover a ±10V range.
2. Sample a continuous signal e(t) every T s seconds so that y(t) y(k)⇒
3. Sampler clearly ignores a large part of the continuous signal.
November 5, 2010
y(t) y(k)
Ts
Image by MIT OpenCourseWare.
7/29/2019 MIT16_30F10_lec20
http://slidepdf.com/reader/full/mit1630f10lec20 4/10
Fall 2010 16.30/31 20–3 • The D/A consists of 2 steps as well
1. Binary to analog 2. Convert discrete signal (at kT s) to a continuous one.
• Basic approach is to just hold the latest value of u(k) for the entire periods T s • Called a zero-order hold (ZOH)
• Need to determine what impact this “sample and hold” operation might have on the loop transfer function • Approximate the A/D as sample • Approximate D/A as ZOH • Set control law to 1, so u(k) = e(k)
November 5, 2010
k = 1 1 2 3 4 5 6 7
u(k)
u(t)
Easiest way is to justhold u(k) for period T
s
?
Image by MIT OpenCourseWare.
y(t) A/D CONTROL D/A u(t)
y(t) ZOH u(t)
Tsu(k) = y(k)
Image by MIT OpenCourseWare.
7/29/2019 MIT16_30F10_lec20
http://slidepdf.com/reader/full/mit1630f10lec20 5/10
Fall 2010 16.30/31 20–4Sample and Hold Analysis
• Can actually analyze the transfer function U (s)/E (e) analytically • Can also gain some insight by looking at basic signals
• u(k) has a standard box car shape • Smoothed u(k) by connecting mid-points ⇒ u(t)
• So sampled and held e(t) looks like input e(t), but delay is obvious.
• Analytic study of U (s)/E (e) shows that effective delay of sample and hold is T s/2 on average • Can be a problem if T s is too large
November 5, 2010
7/29/2019 MIT16_30F10_lec20
http://slidepdf.com/reader/full/mit1630f10lec20 6/10
Fall 2010 16.30/31 20–5 • So why not just make T s small?
• Key point is that T s is how long we have to compute the control command given the measurements received
• Usually wait period is short, but length of calc 1 and calc 2, A/D and D/A operations depend on the complexity of the algorithm and the quality of the equipment
• But quality ↑ ⇒ cost ↑↑ Typically would set sampling frequency ω2 = 2π ≈ 15ωBW • T s
November 5, 2010
Time
Calc #1 Calc #2 Wait
Read: y Read: yWrite: u
Image by MIT OpenCourseWare.
7/29/2019 MIT16_30F10_lec20
http://slidepdf.com/reader/full/mit1630f10lec20 7/10
Fall 2010 16.30/31 20–6Control Law
• Basic compensator s + z U (s)
Gc(s) = K c = s +
p E (s)
• Equivalent differential equation form
u + pu = K c(e + ze) • Differential equation form not useful for a computer implementation
- need to approximate the differentials u
1[u((k + 1)T s) − u(kT s)] ≡ uk+1 − uk
t=kT s| ≈
T s T s • This uses the forward approximation, but others exist
• Then u + pu = K c(e + ze) approximately becomes uk+1 − uk
+ puk = K c( ek+1 − ek + zek)
T s T s or
uk+1 = (1 − pT s)uk + K cek+1 − K c(1 − zT s)ek which is a recursive difference equation, that can easily be imple
mented on a computer. • Similar case for state space controllers
xc = Acxc + Bce u = C cxc + Dce
xc(k+1)−xc(k)and xc ≈ T s so thatxc(k + 1) − xc(k)
= Acxc + Bce T s xc(k
+ 1)
=
(I
+
T sAc)xc(k) +
T sBce(k)
u(k) = C cxc(k) + Dce(k)
November 5, 2010
7/29/2019 MIT16_30F10_lec20
http://slidepdf.com/reader/full/mit1630f10lec20 8/10
Fall 2010 16.30/31 20–7Computer Code Layout
• Given previous information uk and ek and new information yk+1 and rk+1, form ek+1
• Need to use the difference equation to find uk+1 uk+1 = (1 − pT s)uk + K cek+1 − K c(1 − zT s)ek
• Then let uold = (1 − pT s)uk − K c(1 − zT s)ek, so that uk+1 = K cek+1 + uold
• Also define constants γ 1 = (1 − pT s) and γ 2 = −K c(1 − zT s) • Then the code layout is as follows:
initialize uold
while k < 1000 dok = k + 1sample A/D’s (read yk+1, rk+1)compute ek+1 = rk+1 − yk+1update uk+1 = K cek+1 + uoldoutput to D/A (write uk+1)update uold = γ 1uk+1 + γ 2ek+1wait
end while • Note that this outputs the control as soon after the data read as
possible to reduce the delay • result
is
that
the
write
time
might
be
unknown
• Could write uk+1 at end of wait – delay is longer, but fixed
November 5, 2010
7/29/2019 MIT16_30F10_lec20
http://slidepdf.com/reader/full/mit1630f10lec20 9/10
Fall 2010 16.30/31 20–8Summary
• Using a digital computer introduces some extra delay • Sample and hold ≈ T s/2 delay • Holding u(k) to end of loop ≈ T s delay • So the delay is ≈ T s/2–3T s/2
• Emulation process – design the continuous control accounting for an extra ωcT s 180◦ ωc2π 180◦ ωc
= = 180◦ 2 ·
π 2ωs · π ωs
to the PM to account for the delay.
• With ωs ≈ 15ωBW , delay effects are small, and the cts and discrete controllers are similar
• c2dm.m provides simple ways to discretize the continuous controllers • Lots of different conversion approaches depending on what proper
ties of the continuous controller you want to preserve.
November 5, 2010
7/29/2019 MIT16_30F10_lec20
http://slidepdf.com/reader/full/mit1630f10lec20 10/10
MIT OpenCourseWarehttp://ocw.mit.edu
16.30 / 16.31 Feedback Control SystemsFall 2010
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.