0% found this document useful (0 votes)
76 views19 pages

Lab1 - Introduction To Digital Control Laboratory - 17-10-2018

This document summarizes an introduction to digital control systems lecture. It discusses converting continuous systems to discrete equivalents using zero-order hold equivalence. An example mass-spring-damper system is converted from continuous transfer function and state-space models to discrete models in MATLAB. MATLAB representations of transfer functions and state-space models in the z-transform domain are also covered. The last section gives an example of converting the cruise control transfer function to discrete time and showing its step response. The next lab will cover stability, transients, and discrete root locus. Students are required to prepare for a quiz.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views19 pages

Lab1 - Introduction To Digital Control Laboratory - 17-10-2018

This document summarizes an introduction to digital control systems lecture. It discusses converting continuous systems to discrete equivalents using zero-order hold equivalence. An example mass-spring-damper system is converted from continuous transfer function and state-space models to discrete models in MATLAB. MATLAB representations of transfer functions and state-space models in the z-transform domain are also covered. The last section gives an example of converting the cruise control transfer function to discrete time and showing its step response. The next lab will cover stability, transients, and discrete root locus. Students are required to prepare for a quiz.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

University of Sana’a Digital Control System - MT401

Faculty of Engineering
Mechatronics Department

Lab1:
Introduction to Digital Control Laboratory
Eng Mohamed Doba

17 – 10 – 2018
 Term Project
 Quizzes / Reports
Introduction to Digital Control
Introduction to Digital Control
 Introduction
 Zero-Hold Equivalence
 Conversion Using c2d
 Example: Mass-Spring-Damper
 MATLAB Representation for Transfer function and State-Space in the Z-
Transform Form
 Example: Cruise Control System
Introduction
 The figure below shows the typical continuous-time feedback system that
we have been considering so far. Almost all continuous-time controllers can
be implemented employing analog electronics.
 The continuous controller, enclosed in the shaded rectangle, can be
replaced by a digital controller, shown below, that performs the same
control task as the continuous controller.
Zero-Hold Equivalence
 In the below schematic of the digital control system, we see that the system
contains both discrete and continuous portions.
 When designing a digital control system, we first need to find the discrete
equivalent of the continuous portion of the system.
 The philosophy of the design is the following. We want to find a discrete
function H(z), so that for an input to the continuous system H(s) the sampled
output of the continuous system equals the discrete output.
Zero-Hold Equivalence
 Now we will redraw the schematic, replacing the continuous portion of the
system with H(z).

 Now we can design a digital control system dealing with only discrete
functions.
Conversion Using c2d
 There is a MATLAB function c2d that converts a given continuous system
(either in transfer function or state-space form) to a discrete system using
the zero-order hold operation explained before.
 The basic syntax for this in MATLAB is sys_d = c2d(sys,Ts,'zoh')
Example: Mass-Spring-Damper
 Transfer Function:
If you have the following continuous transfer function model

m = 1;
b = 10;
k = 20;

 Now, create a new m-file and represent the discrete transfer function
model in matlab ?
 Assuming the closed-loop bandwidth frequency is greater than 1 rad/sec
Example: Mass-Spring-Damper
 Solution:
m = 1;
b = 10;
k = 20;

 we will choose the sampling time (Ts) equal to 1/100 sec.

m = 1;
b = 10;
k = 20;

s = tf('s');
sys = 1/(m*s^2+b*s+k);

Ts = 1/100;
sys_d = c2d(sys,Ts,'zoh')
Example: Mass-Spring-Damper
 State-Space:
A continuous-time state-space model of this system is the following:

m = 1;
b = 10;
k = 20;

 Now, create a new m-file and represent the State-Space model in matlab ?
Example: Mass-Spring-Damper
 Solution:

m = 1;
b = 10;
k = 20;

A = [0 1;
-k/m -b/m];
B = [ 0; output:
1/m];
C = [1 0];
Code: D = [0];

Ts = 1/100;

sys = ss(A,B,C,D);
sys_d = c2d(sys,Ts,'zoh')
Example: Mass-Spring-Damper
 Show the step response of the continuous/discrete transfer function?
 Show the step response of the continuous/discrete time state-space model ?
MATLAB Representation for Transfer function
and State-Space in the Z-Transform Form
1. Transfer Function
 Recall for continuous transfer function, the numerator and the denominator
matrices are entered in descending powers of s. The same applies to
discrete transfer functions. The numerator and the denominator matrices
are entered in descending powers of z.

numDz = [1 -0.95];
denDz = [1 -0.75];
sys = tf(numDz, denDz, -1)

 The -1 tells MATLAB that the sample time is undetermined.


 Alternatively, we can define transfer functions by defining the z variable as
follows:
z = tf('z',-1);
sys = (z-0.95)/(z-0.75);
MATLAB Representation for Transfer function
and State-Space in the Z-Transform Form
2. State-Space
 For discrete state-space models, we can define the model in the same
manner we did in the continuous case.

A = .75;
B = .5;
C = -.4;
D = 1;
sys = ss(A,B,C,D,-1);
Example: Cruise Control System
 The transfer function model for the cruise control problem is given below.

 Find the Discrete-time transfer function and show its step response?
References
- http://ctms.engin.umich.edu/CTMS/index.php
Next lab

Requirement from the students:


 Prepare for the Quiz to test your understanding for this lab

Subjects in the next lab:


 Stability and Transient Response
 Discrete Root Locus
Any Questions ?!

By: Mohamed Doba


fb.com/mnb.doba

You might also like