Lab1 - Introduction To Digital Control Laboratory - 17-10-2018
Lab1 - Introduction To Digital Control Laboratory - 17-10-2018
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;
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)
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