This action might not be possible to undo. Are you sure you want to continue?
Digital Control Tutorial
Introduction Zero-order hold equivalence Conversion using c2dm Stability and transient response Discrete Root-Locus
Key Matlab Commands used in this tutorial are: c2dm pzmap zgrid dstep stairs rlocus Note: Matlab commands from the control system toolbox are highlighted in red.
The figure below shows the typical continuous feedback system that we have been considering so fur in this tutorial Almost all of the continuous controllers can be built using analog electronics.
I r(t) I I ..
The continuous controller, enclosed in the dashed square, can be replaced by a digital controller, shown below, that performs same control task as the continuous controller. The basic difference between these controllers is that the digital system operates on discrete signals (or samples of the sensed signal) rather than on continuous signals.
y(t) y(k) • t r(k) e(k) u(k) • • •• k ••••• k • • •• • •• k ••• k The purpose of this Digital Control Tutorial is to show you how to work with discrete functions either in transfer function or state-space form to design digital control systems...... For this technique. I U(t).cJ~~kk 1-' G(z) DA Jo1d ak 1 I. When designing a digital control system..1-----------------1 1 Digital Controller r~) --r-t . we will consider the following portion of the digital control system and rearrange as follows. ... L.. + r4J()_ e4J() I EcpIar:: I ~) oore .. Zero-order hold equivalence In the above schematic of the digital control system.. 0-::. III r-.. we see that the digital control system contains both discrete and the continuous portions. we need to find the discrete equivalent of the continuous portion so that we only need to deal with discrete functions.-_----l _j1 : fIJI:) y(t) Different types of signals in the above digital schematic can be represented by the following p1ots..
..-----. the sampled output of the continuous system equals the discrete output..r(l) ~'-I_AJ_D___'t----1r..1 _----L---I . and I u(t)~ I Clock -1. The sketch below shows that the uhat(t) is held constant at u(k) over the interval kT to (k+ 1)T.. .. The purpose of having this pulse is to require that Hzoh(z) have only samples u(k) to work on and produce only samples of output y(k). This operation of holding uhat(t) constant over the sampling time is caned zero-order hold. I Clock The clock connected to the D/A and AID converters supplies a pulse every T seconds and each D/A and AID sends a signal only when the pulse arrives. thus.~+.----u. y(t) I y(k) .----- .. We want to :find a discrete function Hzoh(z) so that for a piecewise constant input to the continuous systemH(s).--A-/-D--.:I-l:---I._i -------'- y(t) r. 1 DlA IUId I I Hold I I ~I.. I eo:.~ .. Hzoh(z) can be realized as a discrete function The philosophy of the design is the following. I y4t)1 r- == ~ ~1 G(z) I I r-------------. Suppose the signal u(k) represents a sample of the input signal There are teclmiques for taking this sample u(k) and holding it to produce a continuous signal uhat(t). I ) Hzoh(z) u(t) ..----.
- uhat(t) .... Note: There are certain cases where the discrete response does not match the continuous response due to a hold circuit implemented in digital control systems..(k) o 0 __ ~~~Ir-~-A-mm--'I ~rl-l......order held signal uhat(t) 1. placing Hzoh(z) in place of the continuous portion .(k)~ i u(k! 1(k) '----------' G(z) I Hzoh(z) y(k) By placing Hzoh(z)... we can design digital control systems dealing with only discrete fimctions..5 <. see Lagging effect associated with the hold. I -H-(s)---:_.n--(-S-)~I ~Ir-A-/-D--'I 0 o o o ~ r= ~r-I u(t) r_(k_)---l..5 o+-~--~----~------~----~----~ o 2 3 4 (k+x)T sec 5 The zero-order held signal uhat(t) goes through H2(s) and AID to produce the output y(k) that will be the piecewise same signal as if the continuous u(t) goes through H(s) to produce the continuous output y(t). For information. Conversion using c2dm .u(k) 0. u(k) o o o o 00 .j~ Y~ .Samples u(k) and zero.. ~ ~ N ow we will redraw the schematic.
denDz]=c2dm(num. Transfer function Suppose you have the following continuous transfer fimction Xes) --F(s) 1 MS2 + bs -i k • • • • M= 1 kg b=10N.4678) z2 -1.4837 0. 'zoh') Running this m.file and enter the following commands.9048 F(z) . numDz = 1. den= [M b k]. 'zoh') The sampling time (Ts in sec/sample) should be smaller than 1/(30*BW).There is a Matlab fimction called c2dm that converts a given continuous system (either in transfer fimction or state-space form) to discrete system using the zero-order hold operation explained above. 0000 -1.B.D. the discrete transfer fimction can be written as X(z) --- 0. The basic corrnnand for this c2dm is one of the following. 9029z + O. b=10. create an new m. M=l.Ts. where BW is the closed-loop bandwidth frequency. 9029 0.Ts.den.C. [numDz.Ts. Ts=1/100. num=[l]. 1. k=20. 'zoh') [F.9048 From these matrices. 4837z + O.denDz] = c2dm (num.s/m k=20N/m F(s) = 1 Assuming the closed-loop bandwidth frequency is greater than 1 rad/sec.0e-04 * 0.den. we will choose the sampling time (Ts) equal to 1II 00 sec.J] = c2dm (A.4678 o denDz 1. [numDz.file in the command window should give you the following numDz and denDz matrices.0001(0.H.G. Now.
file and copy the above commands. For more information on Matlab representation. M=l. [F. please refer to Matlab representation.B. N ow you have the transfer :fimctionin discrete form.G.J] = c2dm (A. A=[O -kiM 1. k=20. 0=  .0095 0. 2.9990 -0.file in the Matlab command window should give you the following matrices. -b/M] .D.Note: The numerator and denominator matrices will be represented by the descending powers of z. 'zoh') Create an new m.Ts. Running this m. 11M]. State-Space Suppose you have the following continuous state-space model All constants are same as before The following m-file converts the above continuous state-space to discrete state-space. C= [1 0].0095 . b=10.C.1903 0.9039 G 0. Ts=1/100. F= 0.0000 0. B= [ 0.H.
a system is unstable when any pole is located to the right of the imaginary axis. please refer to Discrete State-Space.H = 1 J= 0 o From these matrices.9990 0. the discrete state-space can be written as X(k)] [0. we can analyze the system behaviors from different pole locations in the z-plane.0095][X(k-l)] = [v(k) --0. we know that certain behaviors results from different pole locations in the s-plane.0095 ] [F(k-l)] X(k-l)] +[OIF(k-l)] [ v(k-l) N ow you have the discrete time state-space model Note: For more information on the discrete state-space.1903 0. . For discrete systems.9039 v(k -1) y(k-l)=[l 0] + [ 0 0. The characteristics in the z-plane can be related to those in the s-plane by the expression z=c • T = Sampling time (sec/sample) • s = Location in the s-plane • z = Location in the z-plane sT The figure below shows the mapping of lines of constant damping ratio (zeta) and natural frequency (Wn) from the s-plane to the z-plane using the expression shown above. For instance. Stability and transient response For continuous systems.
.. .f..6 0.Natural frequency and damping loci in z -plane 0. ....6 Ts w.. ~ .6 0. ..: :'. ~ .6 -0.:~ . the Wn must be in the unit of radlsec.•.8 0. :: :: ' . . ..2 4JJ/5T . .. -:'.: : .·. .::. ~ ":" ': :. . but when you use the equations shown above. . . : .. :.: :..8 Tr l+rnM~r where • • • • • zeta = Damping ratio Wn = Natural frequency (rad/sec) Ts = Settling time Tr = Rise time Mp = Maximum overshoot rnM~~s Important: The natural frequency (Wn) in z-plane has the unit of radlsample. lOT ... . ..4 -0.. .·i•••i ...6 -0.9: . . . .2 -0. . .. 7JJ/l0T. . 5T 9JJ/l0T .. but is the unit circle Izl=1.: . For analyzing the transient response from pole locations in the z-plane. .~- 1.. . The system is stable when all poles are 10cated inside the unit circle and unstable when any pole is located outside.: ::.....~- 4. ..••..4 0... Suppose we have the following discrete transfer :fimction .. t=O .8 -0. 0 -0. ": ~ ...: 1:: .0.: :.·....••• i ..:"':'/•i ••••.4 0.-.. i= ::-w.!j.. the following three equations used in continuous system designs are still applicable.8 If you noticed in the z-plane. .~ .: . ····t=O.......... - -0. . ....2 0.2 0 Re (z) 0. ".. .f·.. the stability boundary is no longer imaginary axis. ....8 -1 -1 Wn=JJIT .... ~ D.. .. . .....i ......4 -0.\.
: .' .r··.: . - . [x] = dstep (numDz. ". ~.5 :. ~.. .' . Assuming that we have the sampling time ofl/20 sec (which leads to Wn = 28.... •• rn I . .... denDz=[l -0.- ~ .:.. . : : . .3 0..plane . . __ ~~~~L_ -1 -1 L_ ~L_~~ ~ -0.. . '..'..'. .25. .51)... ~ •• ..2.: ..O.. ~ ": • ".~ ••• ...05:2.··..... .5 . .5]..: ..F·~~t:::::::::·::·::.x :·2. stairs (t. the settling time of 0.65 sec and the maximum overshoot of 45% (0. ..'.45 more than the steadystate value)....06 sec. :. : '..' ':" . '.5.. we can determine that this system should have the rise time of 0. .. x" '.. we see poles are located approximately at the natural frequency of9pil20T (rad/sample) and the damping ratio of 0.file and rerun it in the command window...·. ~ -0..:.' " " '.3z +0. • ~":' .~' ' ~ ~ ·x (f) « ro E 0 . You should get the following step response. : ~ ....denDz. .5 From this plot. ':'.'.:~" '...~5i:..*~. pzmap(numDz... Let's obtain the step response and see if these are correct. ..:':..Y(z) --F(z) 1 Z2 . Rurming this m-file in the command window gives you the following plot with the lines of constant damping ratio and natural frequency.2 rad/sec) and using three equations shown above.. ::'. :. . :" .: .5 o Real Axis (z) 0.:' :'.. :. '~.denDz) axis([-ll -11]) zgrid Pole locations in z. ': ... ' . Add the following commands to the above m.Q·. . ....x) t . :' '. ... ".: :'.0::3·:. 0.. .. -. numDz=[l]. : .:··:·:·····::··' .' -': . . = 0:0. . 5 Create an new m-file and enter the following commands. : . -.:t·~.::: ·.. ..~".
2 -g 0. The mechanics of drawing the root-loci are exactly the same in the z-plane as in the s-plane.5 Time (sec) 2 2.-----.5 1 1. sampling time (sec/sample) and three equations shown in the previous section).3 -1.---------.6 « Q) D.----.2 o~--~--~--~--~-~ o 0. 1.) =0 where G(z) is the compensator implemented in the digital controller and Hzoh(z) is the plant transfer fimction inz.4 rad/sample (these can be found from design requirements. see Transient Response.-----. For the discrete root-locus analysis. The command zgrid (zeta.6 0. the settling time and the overshoot came out to be what we expected. Discrete Root-Locus The root-locus is the locus of points where roots of characteristic equation can be found as a single gain is varied from zero to infinity. Rurming this m-file should give you the following root-locus plot..-----.6 and the natural frequency greater than 0. The characteristic equation of an unity feedback system is 1+ KG(z)Hwh(z. We proved you here that we can use the locations of poles and the above three equations to analyze the transient response of the system For more analysis on the pole locations and transient response.5 As you can see from the plot.4 . all of the rise time. E 0. . Recall from the continuous Root-Locus TutoriaL we used the Matlab fimction called sgrid to find the root-locus region that gives the right gain (K). The following commands draws the root-locus with the lines of constant damping ratio and natural frequency. Suppose we have the following discrete transfer fimction Y(z) F(z) Z2 z-O. 7 and the requirements of having damping ratio greater than 0. 6z +0. we use the fimction zgrid that has the same characteristics as the sgrid.4 0. Wn) draws lines of constant damping ratio (zeta) and natural frequency (Wn). Create an new m-:file and enter the following commands.Stairstep Response 1 .
L.7]i rlocus (numDz. - L.8 0.l. The natural frequency is greater than 0. Also. Wn) 0. - U • oJ Ji denDz=[l -1.Wn) Discrete Root . you see two dotted lines of constant damping ratio and natural frequency.5 o 0.11 UlLL. a gain (K) chosen from one of the loci in the desired region should give you the response that satisfies design requirements.5 Real his From this plot. we do have the root-locus drawn in the desired region Therefore. This feedback is anonymous.4 -0. errors that you round. Submit Feedback Reset Digital Control Examples Cruise Controt RL I Motor Speed: PID I Motor Position: RL I Bus Suspension: SS I Inverted Pendulum: SS I Pitch Controller: SS I Ball and Beam: PID Tlltori~l~ . In this example. User Feedback We would like to hear about difficulties you had with the tutorials.3i zgrid (zeta. or any other comments that you have.6 -0.denDz) axis ([-11 -11]) zeta=0. suggestions you have for improvement.6 0.8 -1L-------~--~~~~=---~------~ -1 -0.4 inside the constantzeta line. include your email address if you want a reply.4 -0.Wn line.3 outside the constant.Locus with zgrid (zeta.J £. and the damping ratio is greater than 0. you should realize that the system is stable because all poles are located inside the unit circle.6 0.4i Wn=0.
Basics I Modeling I PID I Root Locus I Freguency Response I State Space I Digital Control I Examples Home Index Conunands I 8/26/97 DK .
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue listening from where you left off, or restart the preview.