Ninevah University College of Electronics Engineering Systems & Control Engineering Department Digital Control -I Lab. 'Third stage' Group : B Exp. No .5 Step Response of a Discrete Time System and Effect of Sampling Time on System Response REPRESENTED BY: الوليد خالد موسى محمد عزيز ايه محمد حازم Date 2021\11\29 1 OBJECTIVE : To study I. Closed loop response of a discrete time system II. Comparison of time responses of continuous time and discrete time systems III. Effect of sampling time on system response and system parameters Software Used: MATLAB/ SIMULINK Procedure Example : Consider a unity feedback control system having forward path transfer function 1 𝑠(𝑠+1) Determine (i) step response in continuous and discrete domain. (ii) effect of sampling time on system response Clc;clear all;close all; n=[1]; d=[1 1 0]; sys=tf(n,d) sysd=c2d(sys,1,'zoh') syscl=feedback(sys,1) syscld=feedback(sysd,1) step(syscl,'y') stepinfo(syscl) hold on step(syscld,'b') stepinfo(syscld) hold on sysd1=c2d(sys,.6,'zoh') syscld2=feedback(sysd1,1) step(syscld2,'r') stepinfo(syscld2) hold on sysd2=c2d(sys,.1,'zoh') syscld3=feedback(sysd2,1) step(syscld3,'m') stepinfo(syscld3) hold on grid legend('sysc','sysd_T=1','sysd_T=0.6','sysd_T=0.1') 2 = sys 1 ------s^2 + s .Continuous-time transfer function Sample time: 0.6 seconds Discrete-time transfer function = syscld2 = sysd 0.1488 z + 0.1219 -------------------z^2 - 1.4 z + 0.6707 z + 0.2642 0.3679 ---------------------z^2 - 1.368 z + 0.3679 Sample time: 0.6 seconds .Discrete-time transfer function Sample time: 1 seconds .Discrete-time transfer function = syscl 1 ----------s^2 + s + 1 .Continuous-time transfer function = ans RiseTime: 1.8000 SettlingTime: 11.4000 SettlingMin: 0.9037 SettlingMax: 1.3133 Overshoot: 31.3289 Undershoot: 0 Peak: 1.3133 PeakTime: 3.6000 = syscld 0.3679 z + 0.2642 ----------------z^2 - z + 0.6321 = sysd2 Sample time: 1 seconds .Discrete-time transfer function 0.004837 z + 0.004679 ---------------------z^2 - 1.905 z + 0.9048 = ans RiseTime: 1.6390 SettlingTime: 8.0759 SettlingMin: 0.9315 SettlingMax: 1.1629 Overshoot: 16.2929 Undershoot: 0 Peak: 1.1629 PeakTime: 3.5920 Sample time: 0.1 seconds .Discrete-time transfer function = syscld3 0.004837 z + 0.004679. --------------------z^2 - 1.9 z + 0.9095 = ans Sample time: 0.1 seconds .Discrete-time transfer function RiseTime: 1 SettlingTime: 16 SettlingMin: 0.8015 SettlingMax: 1.3996 Overshoot: 39.9576 Undershoot: 0 Peak: 1.3996 PeakTime: 3 = ans RiseTime: 1.6000 SettlingTime: 8.3000 SettlingMin: 0.9090 SettlingMax: 1.1837 Overshoot: 18.3712 Undershoot: 0 Peak: 1.1837 PeakTime: 3.6000 = sysd1 0.1488 z + 0.1219 ---------------------z^2 - 1.549 z + 0.5488 3 Step Response 4 DISCUSSION : 1. How sampling time affects rise time, peak time, % overshoot, settling time of a system? Sampling time 1 0.6 0.1 Rise time 1 1.8 1.6 Peak time 3 3.6 3.6 Overshoot % 39.97 31.32 18.37 Settling time 16 11.4 8.3 We see an increase of peak time with a decrease of sampling time, that is, there is a direct relationship between them. But there are decrease in (overshoot, Rise time and Settling time). That is, there is an inverse relationship between them. The sampling time has affecting on stability 5 2. How practical sample and hold circuit works? Practical Sample and Hold Circuit Control input open and closes solid-state switch at sampling rate fs . Modes of operation - tracking ( switch closed) hold (switch open) Sample and Hold Parameters acquisition time - time for instant switch closes until Vi within defined % of input. Determined by input time constant τ = RinC 5τ value = 99.3% of final value aperture time - time it takes switch to open decay rate - rate of discharge of C when circuit is in hold mode The zero-order hold (ZOH) is a mathematical model of the practical signal reconstruction done by a conventional digital-to-analog converter (DAC). That is, it describes the effect of converting a discrete-time signal to a continuous-time signal by holding each sample value for one sample interval. It has several applications in electrical communication. 6 7 3.Write down matlab code to obtain step respons of a unity feedback system having forward path transfer function of.Also show effect of sampling time on time response specification parameters. G(s )= 1 𝑠2 +4𝑠+3 clc clear all close all n=[1]; d=[1 4 3]; sys=tf(n,d) sysd=c2d(sys,1,'zoh') syscl=feedback(sys,1) syscld=feedback(sysd,1) step(syscl,'y') stepinfo(syscl) hold on step(syscld,'b') stepinfo(syscld) hold on sysd1=c2d(sys,.6,'zoh') syscld2=feedback(sysd1,1) step(syscld2,'r') stepinfo(syscld2) hold on sysd2=c2d(sys,.1,'zoh') syscld3=feedback(sysd2,1) step(syscld3,'m') stepinfo(syscld3) hold on grid on legend('sysc','sysd_T=1','sysd_T=0.6','sysd_T=0.1') 8 = sys 1 ------------- = sysd1 s^2 + 4 s + 3 .Continuous-time transfer function = sysd 0.1577 z + 0.04252 z^2 - 0.7141 z + 0.09072 0.08648 z + 0.03906 -----------------------Sample time: 0.6 seconds .Discrete-time transfer function = syscld2 0.08648 z + 0.03906 -----------------------z^2 - 0.4177 z + 0.01832 Sample time: 1 seconds .Discrete-time transfer function = syscl ----------------------z^2 - 0.6276 z + 0.1298 Sample time: 0.6 seconds .Discrete-time transfer function = ans RiseTime: 1.2000 SettlingTime: 3 SettlingMin: 0.2272 SettlingMax: 0.2505 Overshoot: 0.1922 Undershoot: 0 Peak: 0.2505 PeakTime: 3.6000 = sysd2 0.004384 z + 0.003837 1 ------------s^2 + 4 s + 4 .Continuous-time transfer function = syscld 0.1577z + 0.04252 ---------------------z^2 - 0.26 z + 0.06084 Sample time: 1 seconds .Discrete-time transfer function = ans RiseTime: 1.6790 SettlingTime: 2.9170 SettlingMin: 0.2252 SettlingMax: 0.2498 Overshoot: 0 Undershoot: 0 Peak: 0.2498 PeakTime: 4.6900 = ans RiseTime: 1 SettlingTime: 3 SettlingMin: 0.2412 SettlingMax: 0.2533 Overshoot: 1.3326 Undershoot: 0 Peak: 0.2533 PeakTime: 3 ---------------------z^2 - 1.646 z + 0.6703 Sample time: 0.1 seconds .Discrete-time transfer function = syscld3 0.004384 z + 0.003837 ---------------------z^2 - 1.641 z + 0.6742 Sample time: 0.1 seconds .Discrete-time transfer function = ans RiseTime: 1.7000 SettlingTime: 2.9000 SettlingMin: 0.2284 SettlingMax: 0.2500 Overshoot: 0 Undershoot: 0 Peak: 0.2500 PeakTime: 8.9000 9 4. Build Simulink model to obtain step response of a unity feedback system whose closed loop transfer function 1 is given by: G(s)=𝑠2+1𝑠+1 . Also show effect of sampling time on time response specification parameters. 10 Sampling time 1 0.6 0.1 Rise time 1 1.2 1 Peak time 2 2.4 2.4 Overshoot % 46.7243 44.9308 32.5997 Settling time 16 10.8 7.9 We see an increase of peak time with a decrease of sampling time, that is, there is a direct relationship between them. But there are decrease in (overshoot, Rise time and Settling time). That is, there is an inverse relationship between them. The sampling time has affecting on stability 11