ELEC-E80 Digital and Optimal Control (5 cr), autumn 205 Lectures Fridays at 2.5-4.00, room AS2 Lecturer: Kai Zenger, TuAS-house, room 3567, kai.zenger(at)aalto.fi Exercise hours Wednesdays at 4.5-6.00 room Tu AND Thursdays at 6.00 8.00 room AS3 (problem solving help, questions, doing exercises with friends., informal, Laskutupa ) Assistants: Juho Lindholm, e-mail: juholind(at)mappi.helsinki.fi Jyrki Parkkinen, jyrki.parkkinen(at)aalto.fi
Contents Introduction, discrete-time control problem, the z-transform Discrete-time systems, properties and analysis Controller design: pole placement by state space methods PID-controller and its discretized versions, the sampling theorem, choosing the sampling interval Discrete approximations of continuous-time controllers Stochastic disturbance models Optimal prediction and minimum variance control Dynamic programming Linear quadratic controllers (LQ, LQG); discrete-time and continuous-time cases
Passing the course: Final exam or two intermediate exams. Final exam: maximum 30 points (5 problems, max 6p. each). Alternatively two intermediate (Mid term) exams. Each has three problems, max. 5p./problem. Maximum of the two intermediate exams 30 p. Bonus points of (not mandatory) homeworks. 6 homework problems, altogether max 6 p. The bonus points are added to determine the final grade. The bonus points are true bonus, because the grade limits are not scaled up because of the possibility to get bonus points. To pass the course 5 points is always enough. Otherwise the grade limits can vary a bit.
Intermediate exams are suggested to pass the course. They are organised during the last week of each lecture period (2 hours). During the second exam time you can choose, after seeing the problems, whether you want to do intermediate exam or full exam. The full exams later are three hours in lenght; otherwise they are similar to the full exam during the lecture period. In the full exam 8.2.206 you can (re)do intermediate exam or 2. Bonus points and intermediate exam results are valid one year, until the course lectures start again (autumn 206). Exams: Fri 23.0.205 at 2:00-4:00 AS2 (intermediate exam ) Wed 9.2.205 at 4:00-6:00 AS2 (intermediate 2, full exam) Mon 8.2.206 at 6:30-9:30 AS2 (full exam) Mon 9.5.206 at 6:30-9:30 (full exam) Department of Automation and Systems Technology
Please register to the course (oodi), if you have not done that already. You do not have to register to intermediate exams. You have to register to full exams, starting from the exam 8.2 206. Important: Course substitutions: - if you have done the old courses AS-74.22 Digital control AND AS-74.323 Model-Based Control Systems, you do not have to do ELEC-E80 Digital and Optimal Control (it will be substituted by those two courses) - if you have done only AS-74.22 Digital control or only AS-74.323 Model- Based Control Systems, you have to do ELEC-E80 Digital and Optimal Control in a normal manner. The first part is however very similar to Digital Control course. If you know Digital control well, you can relax in the first period; it is suggested however that you do the homework problems to get bonus points. Department of Automation and Systems Technology
ELEC-E80 Introduction Study material Lecture slides (in English, ordinary and print versions) in MyCourses (mycourses.aalto.fi) Exercises with solutions (English) in MyCourses Web learning environment (in Finnish): http://autsys.aalto.fi/pub/control.tkk.fi/kurssit/verkkokurssit/as- 74.22/index.html Note: The above old web course material is a good introduction, but does not cover the whole ELEC-E80. It also contains some material (e.g. polynomial controllers), which are not discussed in ELEC-E80. The lectures, lecture slides and exercises with solutions cover the whole course. It is not absolutely necessary to purchase the book. In each lecture, topics to read for the following session are given. Note: not all slides are presented during the lectures; some are left for home study. Homework assignments (six altogether) are given regularly. They appear in MyCourses
ELEC-E80 Introduction Books for support: Åström K. J., Wittenmark B.: Computer Controlled Systems - Theory and Design (3rd ed.), Prentice-Hall, 997. (textbook) Franklin, Powell, Workman: Digital Control of Dynamic Systems. Third edition, Addison Wesley, 998. Ogata: Discrete-Time Control Systems, 2nd ed., Prentice-Hall, 994 Kuo, B. C. : Digital Control Systems (2nd ed.), Oxford University Press, 992. Santina, M. S., Stubberud, A. R., Hostetter, G. H.: Digital Control System Design, Saunders College Publishing, 994.
Analog (continuous time) control system Process controlled by an analog controller r (t) + _ e(t) Controller u(t) Process y(t) y(t)
Digital (discrete, discrete-time) control system r(tk) + _ e(tk) Controller u(tk) D/A u(t) Process y(t) A/D y(tk) y(t) In A/D-block the analog signal is sampled ; in D/A-block the discretetime signal is changed into an analog one (hold).
To think about... The system contains both analog and discrete signals (a hybrid system) Basic problem already in analog control: how do you treat these kinds of systems analytically? Are the traditional time domain and frequency domain methods available now? Can they be modified? How do you design digital controllers? What should be taken into account in implementation?
To think about... Is it so that a digital controller only imitates the corresponding analog controller and the result is somewhat worse then (due to loosing information in discretization)? Do discrete-time systems have properties that the corresponding analog systems do not have? Yes, but this is not so simple: sometimes a discrete controller can perform better than the analog one; on the other hand dicrete-time systems have anomalies that do not have a correspondence in the analog world.
An example of controller design (only an example:no need to learn very carefully) Controller design of a switched-mode power supply (Buck-type; output voltage smaller than input) The switch operates at high frequency, e.g. 00 khz. By changing the on/off time ratio of the switch (duty cycle) power is transferred into load and the output voltage level is controlled. Switch L r L + v in - Z in i L C r C Department of Automation and Systems Z Technology out + v out - i o
By connecting AC/DC power supplies in parallel, and providing a battery for back-up a suitable power system for a Telecom load (for example) is obtained. Rectifiers Telecom Switching System ~ = = = = = ~ = = = Storage Battery A difficult multivariable system, MIMO = multiple input, multiple output. C.f. SISO = single input, single output
DC Bus u in EMI EMI Load Load EMI Load Modern industrial power systems are complex and difficult; System blocks are connected in series and in parallel. They are provided with input filters (EMI), loads are changing and complex. Systematic methods are needed = theory is needed! Today s magic buzzword is digitalization!
Negative feedback = feedback control, RC-circuit is the load. The output voltage is compared to reference, and a discrete-time PID-controller is used to control the switch. + + v in DC/DC Converter - v out R V - d - Sawtooth waveform + Digital PID Controller - + v ref
Systems can be described by block diagrams PWM (pulse width modulation) transforms the controller output signal to the duty cycle of the switch; basically that belongs to the operation of the actuator Input voltage. V g and load current i load are disturbances from control viewpoint. Robustness means the ability of the controller to tolerate disturbances and modeling errors. Switching converter v g Disturbances i load v ref + - Compensator v c PWM d Control input v Sensor gain
By writing the dynamic equations of the system blocks the performance can be studied. v g (s) G vg (s) i load (s) v ref (s) + - v c (s) d(s) G c (s) /V m G vd (s) + + v(s) H(s) G G vg vd () s () s VR in scrc 2 LC R r s RCr RCr Cr r L s R r c c l l c l b g DR scr b g b c g 2 LC R r s RCr RCr Cr r L s R r c c l l c l
A lead/lag compensator has been designed for the process by using the Bode diagram as a design tool. The insufficient phase margin (2 degrees) of the open loop has been improved to (50 degrees). Stability must always be guaranteed. G ( s) G G c cm s l z s s 33.8, 068 ( rad/ s) 257( rad/ s), 906 ( rad/ s) l cm z p p * c c 4500 ( rad 30000 ( rad / s), * m / s), m 2 50
) ( ) ( s G s N T st st K s N T st st K s s s G s G PID d d i d d i p l z cm c But the compensator can be approximated by a PID-controller:
The control algorithm can be discretized directly for computer based control (details are presented later in the course) v ref + - e Digital PID Controller v c DC/DC Converter v out T z Td ( z) ( z) v ( z) K v ( z) v ( z) K v ( ) vc ( z) K bvref out ref out out z T z Td T i d T z N N The operating frequency of the measurement and control are now new concepts that must be considered. Here the sampling frequency is 20 khz meaning that the sampling time is /20000 s.
The performance of the controller can be simulated. Below the output voltage and inductor current are shown. The zoomed figures show clearly the operation of the switch.
The performance can be made faster by changing the tuning of the PID controller. That leads to increasing oscillations however.
Controller design procedure Construction of the process model from physical equations or by identification. The model analysis and linearisation when needed; construction of the transfer functions Formulation of the control problem Controller design in time or frequency domain Discretization and implementation of the controller e.g. by a digital signal processor (DSP) Alternatively: discretization of the process model and controller design directly in discrete time directly
Simulation To be used: Matlab/Simulink with different toolboxes... Control System Toolbox Identification Toolbox Optimization Toolbox Model Predictive Toolbox Fuzzy Toolbox Neural Networks Toolbox Symbolic Toolbox Statistical Toolbox Comsol Multiphysics
Process knowledge Measurement technology Computer technology Control Theory Challenges
History of discrete-time systems 2. world war, radars, computers, numerical computation Pioneering period ~955-40 (96) - 60 (962) applications (supervisory-mode, where setpoint values etc. are calculated to help the operator ) DDC ~ 962 (Direct Digital Control = computer controls the process directly) in 975 the first digital automation system (Honeywell TDC 2000) Programmable logic controllers (PLC) from the 70 s. Efficient signal procesors (DSP) from 90 s, embedded systems, mechatronics Wireless automation, networks, energy technology, digitalization = current trends New era: today and tomorrow belong to the digital age!
Process controlled by an analog controller r (t) + _ e(t) Controller u(t) Process y(t) y(t)
Process controlled by a digital controller r(tk) + _ e(tk) Controller u(t k ) D/A u(t) Process y(t) A/D y(t k ) y(t)
Two main design approaches: a. discretize the analog controller, b. discretize the process and do the design totally in discrete time a. r(t) A/D Controller D/A u(t) Process y(t) y(t) b. r(t k ) y(t k ) Controller Department of Automation and Systems Technology u(t k ) D/A Process A/D y(t k )
Example (a): How to design a digital controller based on an analog controller Servoproblem, control of robot arm Process (double integrator): Gs () s 2 Simple servo controller: 2s Us () Uc() s Ys () 2 s 2
Example: How to design a digital controller based on an analog controller A digital controller is derived from the analog one by replacing the differential with difference 2s U() s Uc () s Y() s 2 s 2 Multiplying by the Laplace-variable s corresponds to derivation in time domain (derivation operator p) sf() s p f() t f () t
Example: How to design a digital controller based on an analog controller By using the definition of the derivative f () t f ( t t) f( t) t Now t = kh and t = h. Let us further use the shift operator q (multiplying by q corresponds to moving forward in time; division by q corresponds to moving backwards in time) f( kh h) f( kh) q f( kh) f( kh) q f ( kh) f ( kh) h h h
Example: How to design a digital controller based on an analog controller The following approximative relationship between Laplace and Z domains is obtained q z sf() s f () t f( kh) F() z h h From the transfer function in Laplace domain an approximative pulse transfer function in Z-domain is obtained by replacing the Laplace-variable s with z s h
Example: How to design a digital controller based on an analog controller The imitating controller becomes z 2 2 2 ( ) ( ) h z h U z Uc z Y( z) Uc( z) Y( z) 2 z 2 2 z2h h 2 z( h2) U( z) Uc ( z) Y( z) 2 z (2h )
Example: How to design a digital controller based on an analog controller Let us include also the deadbeat-controller, which is based on digital control theory and simulate the operation of the robot arm by each controller. (Dead-beat-controller will be discussed during the course).
Example: How to design a digital controller based on an analog controller oho Analog controller compared to digital imitating controller in different sampling frequencies 0.6 0.4 0.2 0 h = 0. -0.2 0 5 0 0.5 0 robot arm h =. control control robot arm -0.5 0 5 0 0.8 0.6 0.4 0.2 0 h =.0-0.2 0 5 0 4 2 0-2 robot arm h =. control robot arm control -4 0 5 0 5 20
Example: How to design a digital controller based on an analog controller Analog controller compared to the deadbeatcontroller in different sampling frequencies 0.5 0-0.5-0.5 0 h=4 0 5 0 h=0.5-0.5 Department of - Automation and Systems 0 5 0 Technology h=.4 0.5 0-0.5-0 5 0 h=0. 0.5 0-0.5-0 5 0
Example (b): Synchronization Continuous process (. order low pass filter) Gs () s The corresponding discrete-time filter by using the sampling time h = e Details on how to obtain H( z) H(z) are shown later z e
Example: Synchronization Let us simulate both filters with the same input signal
Example: Synchronization D = 0.8 0.6 0.4 0.2 0 0 5 0 D =.66 0.8 0.6 0.4 0.2 0 0 5 0 D =.33 0.8 0.6 0.4 0.2 0 0 5 0 D = 2 0.8 0.6 0.4 0.2 0 0 5 0
Example: Synchronization With impulse and pulse inputs synchronization is even more important 0.8 0.6 0.4 0.2 0 0 5 0 0.8 0.6 0.4 0.2 0 0 5 0 0.8 0.6 0.4 0.2 0 0 5 0 0.8 0.6 0.4 0.2 0 0 5 0
z-transformation A sequence f0 f f k,,,, for short f k or f ( k) The z-transformation is defined i 2 k i 0 2 i0 F( z) Z( f ) f z f f z f z Continuous systems: (differential equations/laplacetransformation) Discrete systems: (difference equations/z-transformation)
Example. Discrete time impulse The sequence f0,0,0,0, f0 is an impulse (pulse) with the strength f0 f0 ( k) where Z-transformation:, k 0 ( k) 0, k 0 F( z) Z f( k) f( k) z f ( k) z f k k 0 0 k0 k0
Example. Discrete (unit) step function Sequence,,,, In the terms f k T T T k is a time index (0,,2,...). The absolute time at time instant k is kt, where T is the sampling interval Z-transformation: k Z f( k) z z z z z (sum of a geometric series)
k Example. f( k) a, a Pulse sequence 2 3, aa,, a, k k 2 2 F( z) a z az a z k 0 z az z a The sum converges in the complex plane region or a z az It is not necessary to consider the convergence regions in what follows.
Movement in time ( right =delay, left =prediction) Pulse sequence f(k): 0 2 3 4 5 k 2 3 F( z) Z f( k) f f z f z f z 0 2 3
Delay with one sampling interval: 0 2 3 4 5 6 k Z f( k) 0 f z f z f z 2 3 0 2 z f f z f z 2 0 2 ( ) z F z One sample delay thus means multiplication by n ; correspondingly by z when the delay is n steps z
Prediction by one sample interval: 0 2 3 4 5 Z f( k) f f z f z 2 2 3 z f f z f z zf zf( z) zf 2 0 2 0 Compare to the derivative of Laplace-transformation in the continuous time case. 0 k
The final value theorem Consider a pulse sequence f(k) and its z-transform F(z). If f(k) approaches a limit value as k approaches infinity, it holds lim f( k) lim ( z ) F( z) k z This is the final value theorem. Compare to the continuous time case lim yt ( ) lim sy( s) t s0
Discrete-time system Example. A first order difference equation y( k) ay( k) u( k) Initial conditions e.g. y(0)=0, u(0)=, u(k)=0, k >0 Calculation directly from the equation (which is directly an algorithm) y() u(0) Result is the pulse sequence y(2) ay() u() a k a, k 0,,2,... 2 y(3) ay(2) u(2) a
Note that the difference equation y( k) ay( k) u( k) means in absolute time y ( k) T ay( kt) u( kt) Take the Z-transformation zx( z) zy(0) ay( z) U( z) Initial conditions are considered to be zero when deriving the pulse transfer function, leading to ( z ay ) ( z) U( z)
The pulse transfer function Gz ( ) Y( z) U( z) z a With a unit impulse as input ( k) the output (pulse response) is the inverse transformation of the pulse transfer function. Y( z) y( k) a za za Compare to the continuous time case. k
z-transformation is used to make the analysis and calculations of discrete-time systems more tractable. Compare again to the continuous time case. The results are meaningful only at sampling instants t kt, k 0,,2, k Note the following transformation pairs (the latter deviates somewhat from the continuous time analogue). z a F( z) ; 0, k a, a0 f( ka), k a 2. zfz z f z f zf a a a a ( ) (0) () ( ) ; f( k a), a 0
In the inverse transformation similar ideas as in the continuous time case are applied (dividing terms into sums of smaller entities and then using tables) Example. A B ( z)( z2) z z2 No inverse transformation is found from the tables; so let us modify A B z z z z ( z)( z2) ( z)( z2) z z2 Alim ; Blim z2 z z z2
z z z z z ( z)( z2) z2 z z2 z The inverse transformation of the bracketed term is k f( k) 2, k 0,,2, 2 Taking the delay z into account gives finally 0 0 2 k f ( k), k or 0, k 0 k 2, k,2,3,
Stability We can operate with pulse transfer functions as with transfer functions. E.g. the closed loop pulse transfer function can be calculated, the denominator of which is the characteristic polynomial. Its zeros are the system poles. The zeros of the numerator are the system zeros. The pulse transfer function can be divided into a sum of terms like z z a ;the inverse transformation when a If even one term explodes, the system is unstable. a k stays bounded
Stability region: Im G K ( z) z a ( z b)( zc)( zd) - Re - A discrete-time system is stable, when the poles (b, c, d) are located inside the unit disc. Compare to the left half plane for continuous time systems.
Shift-operators A forward shift operator q (in time) qy( k) y( k ) A backward shift operator q y k y k ( ) ( ) q (in time) n Correspondingly q y( k) y( kn) n q y( k) y( k n) (Compare to the continuous time differential operator p)
Example. A difference equation (input-output representation of a system ) yk ( 2) ayk ( ) ayk ( ) buk ( ) buk ( ) can be written in which 2 0 Aq ( ) yk ( ) Bquk ( ) ( ) 2 A( q) q aq a2 Bq ( ) bqb 0 are operator polynomials. A similar equation can also q be written as a function of
Note the formal relationship p q s z continuous time discrete time However, when using p or q, we operate in time domain. When using s or z a transformation to Laplace or Z-domain has been done to deal with transfer functions. This can sound theoretical. However, in control engineering there are many design methods, in which either time domain or frequency domain (transfer functions) are used.
From state-space-representation to pulse transfer function A discrete state-space-representation is defined in an analog manner to the continuous time case; derivatives are replaced with a shift in time. x( k) Fx( k) Gu( k) yk ( ) Hxk ( ) Let us try to find the pulse transfer function. Take the Z-transformation and eliminate x. The derivation is quite analogous to the continuous time case.
zx ( z) FX ( z) GU ( z) ( zi F) X ( z) GU ( z) X z zi F GU z ( ) ( ) ( ) Y z HX z H zi F GU z ( ) ( ) ( ) ( ) The pulse transfer function is obtained as Y( z) ( ) ( ) U( z) z H zi F G compare to the continuous time case: CsI ( A) B
From input-output representation to state-space equations A similar method as in the continuous time case is available Example. y( k 2).3 y( k ) 0.4 y( k) u( k) 0.4 u( k) -state-space? -pulse transfer function? Write the equation as a function of the q-operator 2 qyk qyk yk quk uk ( ).3 ( ) 0.4 ( ) ( ) 0.4 ( )
Move q terms to the left side 2 q y k qy k qu k y k u k ( ).3 ( ) ( ) 0.4 ( ) 0.4 ( ) Develop the left side as factors according to q and choose the state variables as follows qqyk ( ).3 yk ( ) uk ( ) 0.4 yk ( ) 0.4 uk ( ) x ( k) x 2 ( k) x ( k) y( k); x ( k) x ( k).3 x ( k) u( k) 2 x ( k) 0.4 x ( k) 0.4 u( k) 2
The following state representation is obtained x ( k).3 x ( k) x ( k) u( k) 2 x ( k) 0.4 x ( k) 0.4 u( k) 2 yk ( ) x( k) and in matrix form F G x( k).3 x( k) uk ( ) x2( k ) 0.4 0 x2( k) 0.4 H x ( k) yk ( ) 0 x2( k)
Pulse transfer function Y( z) ( z) H( zi F) G U( z) z 0 0.4 z.3 0.4 z 0.4 zz (.3) 0.4 ( z0.8)( z0.5) Zeros: z 0.4 Poles: p p 2 0.8 0.5 The poles are inside the unit circle, and the system is therefore stable.
Is there a need for discrete-time control theory? Analog systems can be imitated There exists discrete-time systems without an analog correspondence Sampling can cause problems to discrete-time systems Digital controller can even beat the analog controller (fastness) Discrete-time control theory is needed!
Grounds and basic building blocks Sampling theorem (Shannon -49) Difference equations (-48) Integral transformations Z-transformation (Hurewicz -47) State-space-representation (Kalman -55)
Grounds and basic building blocks Optimal control (Bellman -57) Stochastic control, LQG (Kalman -65) Algebral system theory (Rosenbrock -70) Identification, Adaptive control Robust control (-80) Soft computing, -80, fuzzy control, neural networks, cloud computing, computational sciences (-2000)...