AUTOMATIC CONTROL AND SYSTEM THEORY CONTROL OF DIGITAL SYSTEMS Gianluca Palli Dipartimento di Ingegneria dell Energia Elettrica e dell Informazione (DEI) Università di Bologna Email: gianluca.palli@unibo.it G. Palli (DEI) Automatic Control & System Theory 1
Analog Control Systems Analog Control Systems ü The computation of the control action is carried out in the continuous-time domain, by means of electric, hydraulic or mechanical systems + - Controller power amplifier actuator plant transducer G. Palli (DEI) Automatic Control & System Theory 2
Digital Control Systems Digital Control Systems ü A computer is present in the control loop: ü The control action is computed in the discrete-time domain with period T ü Suitable interfaces are needed between: ü The plant (continuous time domain) ü The controller (discrete time domain) 11 11 + - A/D DIGITAL COMPUTER D/A actuator plant Clock (T) Discrete-time domain transducer G. Palli (DEI) Automatic Control & System Theory 3
Digital Control Systems vs. Analog Control Systems Better precision and computational capabilities More complex control algorithms Improved flexibility Different operating conditions can be managed by just changing the software Better reliability and repeatability No fatigue, thermal drift etc. Digital signals can be easily transmitted Digital signals are more robust than analog ones with respect to noise and disturbances A more difficult design process The designer must possess competences in the field of electronics and digital interfaces Weaker stability Transmission discontinuities, delays The choice of the sampling time is important Undesired and unmanaged system failures It is difficult to consider and evaluate all the possible failures during the software design Electric power is always needed G. Palli (DEI) Automatic Control & System Theory 4
Signals Typologies Analog continuous-time Sampled data Digital signal (quantized) Quantized continuous-time G. Palli (DEI) Automatic Control & System Theory 5
Digital Control Systems Controller D/A interface actuator plant A/D interface sensor 11 11 1111 T T T Digital discrete-time signals Analog continuous-time signals G. Palli (DEI) Automatic Control & System Theory 6
A/D Interface A/D interface: the input signal x(t) is sampled with period T The sequence of converted and quantized data x(kt) is given as output A/D Dirac impulse sampling: The switch closing time is null A Dirac impulse of area x(kt) is given as output A/D T G. Palli (DEI) Automatic Control & System Theory 7
D/A Interface Provides an analog signal from the input sequence of sampled data The solution of the signal reconstruction problem is not unique if the SHANNON THEOREM is not satisfied (ω s > 2 ω c, ω s = 2 π/t) Zero-Order Hold gives the output: Assuming an ideal sampling: G. Palli (DEI) Automatic Control & System Theory 8
Design of Discrete-Time Controllers Two approaches are possible to the design of digital control laws: 1. Direct method Discretization of the plant model Design of the controller in the discrete-time domain 2. Indirect Method Simplest approach, it does not requires specific knowledge of design techniques in the discrete-time domain Some limitations are given by the choice of the sampling time G. Palli (DEI) Automatic Control & System Theory 9
Design of Discrete-Time Controllers Digit Indirect method (discretization) x(t) e(t) u a (t) y a (t) R(s) G(s) x(t) e(t) u a (t) y a (t) R(z) H(s) G(s) T =? (as small as possible ) G. Palli (DEI) Automatic Control & System Theory 1
Design of Discrete-Time Controllers With the indirect method, four steps are usually involved: 1. Choice of the sample time T 2. Design of the continuous time control law R(s) 3. Discretization of the control function R(s) (e.g. bilinear transformation) 4. Verification of the result by simulation (and experiments) G. Palli (DEI) Automatic Control & System Theory 11
Design of digital controllers Digit 1) Choice of T and verification of the stability margins of the system In designing the control law R(s), the process to be considered is G. Palli (DEI) Automatic Control & System Theory 12
Design of digital controllers Digit Example: Given the system Design a digital lag net such that the phase margin results M f = 55 o 1 Impulse Response The smallest time constant, corresponding to the pole in p = -2, is τ =.5 s. Then, consider the sample time T =.1 s. Amplitude.9.8.7.6.5.4.3.2.1 1 2 3 4 5 6 7 8 9 1 Time (sec) G. Palli (DEI) Automatic Control & System Theory 13
Design of digital controllers Digit Bode diagrams of the original transfer function and of the sampled one 2 Bode Diagram Phase (deg) Magnitude (db) -2-4 -6-8 -1-9 -135-18 -225-27 G(s) G(z) -315-36 1-1 1 1 1 Frequency (rad/sec) G. Palli (DEI) Automatic Control & System Theory 14
Design of digital controllers Digit Considering the zero-order hold, the following system is obtained 2 Nyquist Diagram Imaginary Axis 1.5 1.5 -.5 G 1 (s) There is a small increase of the phase lag. In this case, is small since T is small. A similar result is obtained with the approximation -1 G(s) -1.5-2 -2-1.5-1 -.5.5 1 Real Axis G. Palli (DEI) Automatic Control & System Theory 15
Design of digital controllers Digit Let then consider G 1 (s) instead of G(s) The result of the design of the lag net for G 1 (s) (phase margin M F = 55 o ) is: By discretization of R(s) (ex. bilinear trans.) with T =.1 s: N.B. Possible numerical problems for similar numbers (round) G. Palli (DEI) Automatic Control & System Theory 16
Design of digital controllers Digit The controller R(z) has been obtained For its implementation on a computer, it is necessary to obtain the corresponding difference equation. Therefore: From which Then G. Palli (DEI) Automatic Control & System Theory 17
Design of digital controllers Digit Results with T =.1 s 1.5 Uscita del sistema Uscita del sistema 1.5 1 2 3 4 5 tempo (s) Azione di controllo.6.4.2 -.2 1 2 3 4 5 tempo (s) 1.8.6.4.2 1 2 3 4 5 tempo (s) Azione di controllo.4.3.2.1 1 2 3 4 5 tempo (s) G. Palli (DEI) Automatic Control & System Theory 18
Design of digital controllers Digit Results with T =.5 s 1.5 1.5 Uscita del sistema 1 2 3 4 5 tempo (s) Azione di controllo.6.4.2 -.2 1 2 3 4 5 tempo (s) 1.8.6.4.2 Uscita del sistema 1 2 3 4 5 tempo (s) Azione di controllo.4.3.2.1 1 2 3 4 5 tempo (s) G. Palli (DEI) Automatic Control & System Theory 19
Design of digital controllers Digit Results with T = 2 s 1.5 1.5 Uscita del sistema 1 2 3 4 5 tempo (s) Azione di controllo.6.4.2 -.2 1 2 3 4 5 tempo (s) 1.8.6.4.2 Uscita del sistema 1 2 3 4 5 tempo (s) Azione di controllo.5.4.3.2.1 1 2 3 4 5 tempo (s) G. Palli (DEI) Automatic Control & System Theory 2
Description of sampled data systems CONTINUOUS-TIME SYSTEMS Differential equations A/D DISCRETE-TIME SYSTEMS Finite-difference equations Laplace transform D/A Z transform G. Palli (DEI) Automatic Control & System Theory 21
Discretization of Continuous-Time Controllers Control algorithm D/A Hold Actuator Plant Y A/D S&H Sensor The control algorithm must be designed in such a way that the overall control system with the same input behaves as much as possible to the continuous-time regulator R(s) Main problem: selection of the sample time T so that the sampled data represent a good approximation of the continuous-time signals G. Palli (DEI) Automatic Control & System Theory 22
Data Sampling in MIMO Systems Given the continuous-time linear system: U(s) G(s) Y(s) and considering a discrete-time input u(kt), if a zero-order hold H (s) and a sample circuit with period T are introduced in the system, the following discrete-time system is obtained: u(kt) u(t) y(t) y(kt) G(s) The signal u(t) is piece-wise continuous: G. Palli (DEI) Automatic Control & System Theory 23
Data Sampling The signal u(t) is piecewise continuous: for u(kt) u(t) The signal y(t) sampled with a period T generates the sampled signal y(kt) y(t) 3 2 Segnale y(t) Segnale y(kt) 3 2 y(kt) 1 1-1 -1-2 -2-3 2 4 6 8 1 Tempo (sec) -3 2 4 6 8 1 Tempo kt (sec) G. Palli (DEI) Automatic Control & System Theory 24
Data Sampling in MIMO Systems u(kt) u(t) y(t) y(kt) G(s) The input-output behavior of the overall system is the same of the discrete-time system: U(z) G(z) Y(z) G. Palli (DEI) Automatic Control & System Theory 25
Data Sampling in MIMO Systems A relation exists between matrices (A, B, C) and matrices (F, G, H). It can be computed by solving the following linear differential equation in the interval [kt, (k+1)t]: The state x(t) that is reached starting from the initial state x(kt) at the time instant t=kt is: Hence, being u(t)=u(kt) constant, the state x((k+1)t) reached at the time instant t=(k+1)t is: G. Palli (DEI) Automatic Control & System Theory 26
Data Sampling in MIMO Systems By means of the following change of variable: the matrix G can be transformed as: The output y(kt) is obtained from the signal y(t) sampled at t=kt: G. Palli (DEI) Automatic Control & System Theory 27
Data Sampling in MIMO Systems Then, the relation between the matrices (A, B, C) and (F, G, H) is: The discrete-time system G(z) obtained from the continuous-time one G(s) in this way is called sampled-data system. Since matrices F and G depend on the sample time T, it is important to analyze how the structural properties of reachability and observability of the sampled-data system change in function of T. G. Palli (DEI) Automatic Control & System Theory 28
Reachability and Observability Being matrix F = e AT always invertible, in the sampled data system: The controllability is always equivalent to reachability The reconstructability is always equivalent to observability For single-input systems, the following property holds: THEOREM: Consider the completely reachable system (A, b) and the sampling period T. The corresponding sampled-data system is reachable iff each couple λ i, λ j of distinct eigenvalues of A with the same real part satisfies the relation: G. Palli (DEI) Automatic Control & System Theory 29
Reachability and Observability For single-output systems, the following property holds (dual property with respect to the previous one): THEOREM: Consider the completely observable system (A, c) and the sampling period T. The corresponding sampled data system is observable iff each couple λ i, λ j of distinct eigenvalues of A with the same real part satisfies the relation: Note: If all the eigenvalues of matrix A are real, the sampled-data system maintains always, for any T >, the same structural characteristics (reachability, controllability, observability, reconstructability) of the original continuous-time system (A, b, c). G. Palli (DEI) Automatic Control & System Theory 3
Data Sampling in MIMO Systems Example: compute the matrices of the sampled-data system obtained from the following continuous-time system: The matrices (F, G, H) result: G. Palli (DEI) Automatic Control & System Theory 31
Data Sampling in MIMO Systems Then, the corresponding sampled-data system is: where the following simplified notation has been used: The eigenvalues of matrix A are: G. Palli (DEI) Automatic Control & System Theory 32
Data Sampling in MIMO Systems - Reachability The reachability matrix of the sampled-data system is: For T=π the system is not fully reachable, indeed: From the theorem on the reachability of sampled data systems: G. Palli (DEI) Automatic Control & System Theory 33
Data Sampling in MIMO Systems - Observability The observability matrix of the sampled data system is: The sampled data system is fully observable iff: The characteristic polynomial of the matrix F is: Then, the eigenvalues of F are: G. Palli (DEI) Automatic Control & System Theory 34
Data Sampling in MIMO Systems Impulse Response 4 3 2 1-1 -2-3 T = π/2-4 5 1 15 2 8 6 4 2-2 -4-6 T = π/5-8 5 1 15 2 15 2 1 5-5 15 1 5-5 -1-1 -15 T = π/2-15 5 1 15 2 T = π -2 5 1 15 2 G. Palli (DEI) Automatic Control & System Theory 35
Data Sampling in MIMO Systems Impulse Response.6.6.4.4.2.2 -.2 -.2 -.4 -.4 -.6 T = π/2 -.8 5 1 15 2 -.6.6 T = π/5 -.8 5 1 15 2.4.2 The properties of controllability and observability degrades as the sampling period T grows -.2 -.4 -.6 T = π -.8 5 1 15 2 G. Palli (DEI) Automatic Control & System Theory 36
Data Sampling in MIMO Systems Transfer Function The transfer function G(s) of the continuous-time system is: The transfer function G(z) of the corresponding sampled data system is: G. Palli (DEI) Automatic Control & System Theory 37
Data Sampling in MIMO Systems Transfer Function The same result can be obtained by discretization of the transfer function G(s) preceded by the zero-order hold: G. Palli (DEI) Automatic Control & System Theory 38
Data Sampling in MIMO Systems Example: consider the following purely inertial system with unitary mass (m=1) subject to the external force u(t): m u(t) x The state vector is given by the position and the velocity The system output is the position of the mass G. Palli (DEI) Automatic Control & System Theory 39
Data Sampling in MIMO Systems The dynamic model in the state-space representation is: The matrices F and G of the corresponding sampled-data system are: G. Palli (DEI) Automatic Control & System Theory 4
Data Sampling in MIMO Systems Therefore, the sampled-data system can be written as: It can be easily verified that this system is fully reachable and observable We are interested in designing a dead-beat controller: a state feedback controller u(k)=k x(k) such that all the eigenvalues of the closed-loop system eig(f+gk) are zero. This implies that the desired characteristic polynomial of the closed loop system is: G. Palli (DEI) Automatic Control & System Theory 41
Data Sampling in MIMO Systems Assuming as state feedback matrix. Given u(k)=k x(k), the following system dynamic matrix is obtained: The characteristic polynomial of this matrix is: By imposing the desired characteristic polynomial we obtain: G. Palli (DEI) Automatic Control & System Theory 42
Data Sampling in MIMO Systems Since we are considering a dead-beat controller, the state feedback u(k)=k x(t) is able to drive the state exactly to zero in just two steps (since the order of the system is two) with an arbitrary small sample time T G. Palli (DEI) Automatic Control & System Theory 43
Data Sampling in MIMO Systems The control action u(k) in the time instants k= and k=1 increases as the sample time T decreases. Indeed: The state can not be driven to zero in a time interval of 2T by means of state feedback only in the case of continuous-time systems. In fact, in the case of continuous-time systems the state goes to zero (or any other final value) exponentially, that means the state is zero only for t ->. G. Palli (DEI) Automatic Control & System Theory 44
Data Sampling in MIMO Systems Simulink scheme t Clock To Workspace1 uo To Workspace6 yd To Workspace14 K*u K*u 1 s K*u y Pulse Kups Zero-Order B Integrator C To Workspace13 Generator Hold A K Zero-Order Hold1 K*u K*u xo To Workspace2 K*u ys C1 To Workspace3 G. Palli (DEI) Automatic Control & System Theory 45
Data Sampling in MIMO Systems Ts = 1 sec, x = [5, -2] T, null setpoint 6 4 2 Response of yd, y and ys 5 Control action u(k) 4 3-2 2 4 6 8 1 2 5 Response of x1 and x2 1-1 -5 2 4 6 8 1-2 1 2 3 4 5 6 7 8 9 1 Input values u(k) = -2, 4 G. Palli (DEI) Automatic Control & System Theory 46
Data Sampling in MIMO Systems Ts =.5 sec, x = [5, -2] T Ts = 2 sec, x = [5, -2] T 6 Response of yd, y and ys 6 Response of yd, y and ys 4 4 2 2-2 1 2 3 4 5 6 7 8 9 1 5-5 Response x1 and x2-1 1 2 3 4 5 6 7 8 9 1 2 1-1 Control actionu(k) -2 1 2 3 4 5 6 7 8 9 1 6 4 2-2 1 2 3 4 5 6 7 8 9 1 1.5 Response x1 and x2 Control action u(k) -2 1 2 3 4 5 6 7 8 9 1 -.5 1 2 3 4 5 6 7 8 9 1 Input values u(k) = -14, 18 Input values u(k) =.25,.75 G. Palli (DEI) Automatic Control & System Theory 47
Data Sampling in MIMO Systems Ts = 1 sec, x = [5, -2] T, square input setpoint with amplitude A = 1 15 1 5 Respose of yd, y and ys 3 Control action u(k) 2 1-5 1 2 3 4 5 6 15 1 Response of x1 and x2-1 5-2 -5-1 1 2 3 4 5 6-3 1 2 3 4 5 6 G. Palli (DEI) Automatic Control & System Theory 48
Data Sampling in MIMO Systems G If the state is not measureable, a dead-beat observer can be designed: in such an observer the state estimation error evolves with a dynamics characterized by two null eigenvalues (modes). This means that the eigenvalues of A+LC (or F+LH) are all zeros. F Example: design of a reduced-order dead-beat observer. Recalling the design of a generic reduced-order observer in the discrete-time case: the system output directly coincides with the first q=1 components of the state. Therefore, the observer dynamics is: G. Palli (DEI) Automatic Control & System Theory 49
Data Sampling in MIMO Systems The eigenvalues are imposed to be zero: The dynamics of the dead-beat reduced-order observeris then: it follows and the state estimation is: The transfer function G(s) of the continuous-time system is: The transfer function G(z) of the corrsponding discrete-time system is: G. Palli (DEI) Automatic Control & System Theory 5
Data Sampling in MIMO Systems Simulink scheme t uo Clock To Workspace1 To Workspace6 yd To Workspace14 K*u K*u 1 s K*u y Pulse Generator Kups Zero-Order Hold B Integrator A C To Workspace13 K Zero-Order Hold1 K*u K*u xo To Workspace2 xhat To Workspace4 K*u C. ys To Workspace3 K*u 1 x hat In1 y x hat L In2 u 1 In1 y -1 Z Integer Delay K*u -1/T Subsystem 2 In2 u -1 Z Integer Delay1 K*u T/2 G. Palli (DEI) Automatic Control & System Theory 51
Data Sampling in MIMO Systems Ts = 2 sec, x = [5, -2] T Ts = 1 sec, x = [5, -2] T 5 Andamento yd, y e ys -5-1 1 2 3 4 5 6 7 8 9 1 1 Andamento x1 e x2 5-5 -1 1 2 3 4 5 6 7 8 9 1 1 Azione di controllo u(k) 5-5 1 2 3 4 5 6 7 8 9 1 5 Andamento yd, y e ys -5-1 1 2 3 4 5 6 7 8 9 1 2 Andamento x1 e x2 1-1 -2 1 2 3 4 5 6 7 8 9 1 4 Azione di controllo u(k) 2-2 1 2 3 4 5 6 7 8 9 1 G. Palli (DEI) Automatic Control & System Theory 52
Data Sampling in MIMO Systems Ts = 2 sec, x = [5, -2] T Ts = 1 sec, x = [5, -2] T 15 Andamento yd, y e ys 1 5-5 1 2 3 4 5 6 2 Andamento x1 e x2 1-1 1 2 3 4 5 6 5 Azione di controllo u(k) 15 Andamento yd, y e ys 1 5-5 1 2 3 4 5 6 2 Andamento x1 e x2 1-1 -2 1 2 3 4 5 6 2 Azione di controllo u(k) 1-1 -5 1 2 3 4 5 6-2 1 2 3 4 5 6 G. Palli (DEI) Automatic Control & System Theory 53
AUTOMATIC CONTROL AND SYSTEM THEORY CONTROL OF DIGITAL SYSTEMS THE END G. Palli (DEI) Automatic Control & System Theory 54