Module 7: Continuous to Discrete Conversion Methods
This article is contained in Scilab Control Engineering Basics study module, which is used as course material for International Undergraduate Program in Electrical-Mechanical Manufacturing Engineering, Department of Mechanical Engineering, Kasetsart University.
Module Key Study Points
- Understand 3 methods to convert a continuous-time transfer function to discrete-time
- Understand sampling process and aliasing problem
- Discuss stability region mappings of the 3 conversion methods
(1)with continuous-time transfer functtion
(2)The solution for this system is
(3)with value at sampling instants
(4)As shown in Figure 1, the integral term in (4) can be approximated by 3 methods, namely forward difference, backward difference, and bilinear transformation (also known as Tustin or trapezoidal approximation). They can be described as
(7)Transforming (5) – (7) to discrete-time transfer function results in Forward Difference:
(10)Comparing the discrete-time transfer function from each method to the continuous-time counterpart in (2), we derive the following relationships Forward Difference:
(13)i.e., to convert a continuous-time transfer function using any of the 3 methods, we substitute the Laplace variable s with the term on the right for the corrsesponding relationship. This is best illustrated by an example. Ex. 1 Consider a continuous-time controller
(14)This can be converted to the following discrete-time transfer functions Forward Difference:
(17)One way to investigate accuracy of the three conversion methods is to compare their frequency responses. A tight match of Bode plots in Figure 2 results from conversion with ampling time T=0.001 sec.
(18)Given a sampling period T ,the integral term can be represented in discrete-from by Forward Difference:
(21)Similarly, the derivative term in (18) can be discretized as Forward Difference:
(24)Hence, the resulting discrete-time PID controllers are represented by Forward Difference:
(27)We want to simulate the step responses of these 3 controllers compared to the continuous-time (18). To aid in the process, an Xcos model dpidsim.zcos shown in Figure 4 is constructed. The upper loop has the continuous-time PID controller, and the lower loop has the discrete-time version, which can be set up to each of the 3 choices in (25) – (27) by a script file dpidsim_setup.sce, containing the following Scilab code.
// dpidsim_setup.sce // setup file for dpidsim_xx.zcos kp = 200; ki = 240; kd = 25; T = 0.01; N = 20; z = poly(0,'z'); // Forward Difference Method Inumz = T; Idenz = z-1; Dnumz = N*(z - 1); Ddenz = (z-1+N*T); // // Backward Difference Method //Inumz = T*z; //Idenz = z-1; //Dnumz = N*(z - 1); //Ddenz = (1+N*T)*z - 1; // // Bilinear Transform Method //Inumz = T*(z+1); //Idenz = 2*(z-1); //Dnumz = N*(z - 1); //Ddenz = (1+0.5*N*T)*z + 0.5*N*T -1; //
-->s=poly(0,’s’) -->Cs = kp + ki/s + kd*N*s/(s+N); -->Cs = syslin(‘c’,Cs) Cs = 12000 + 10240s + 1450s ---------------------- 2 50s + s
-->roots(Cs.den) ans = - 50. 0
-->z=poly(0,'z'); -->Inumz = T; -->Idenz = z-1; -->Dnumz = N*(z - 1); -->Ddenz = (z-1+N*T); -->Cz = kp + ki*Inumz/Idenz + kd*Dnumz/Ddenz; -->Cz = syslin('d',Cz) Cz = 2 968 - 2388z + 1450z ------------------- 2 - 1.5 + 0.5z + z
-->abs(roots(Cz.den)) ans = 1.5 1.
(28)Since the sampling period T is always positive, so . Let , we have
(29)From this result, we conclude that, using forward difference conversion method, the stability region in continuous-time domain is mapped to the area to the left of 1 in the Z plane. This explains the possibility that stable continuous-time transfer functions can be approximated by unstable discrete transfer functions. It is left to the reader to verify that the left half plane of S plane is mapped by each of the 3 conversion methods to the Z plane as shown in Figure 9. From this diagram, it is obvious that bilinear transformation is the best choice in terms of stability preservation, according to the fact that stability region in the Z plane is inside the unit circle. In the backward difference case, some unstable continuous-time systems may be mapped to stable discrete-time systems. This seems to pose less problem, in the general sense that analysis and design is often done in continuous-time domain and the resulting controller is converted to discrete-time at implementation phase.
- module7.zip : all Scilab and Xcos files used in this module