Vous êtes sur la page 1sur 80

Mechatronics Lab II (MCT 3159)

Laboratory Manual

Experiment 1

Modeling of First- and Second-Order Systems


Using MATLAB/Simulink

by
Dr.-Ing. Wahju Sediono

Department of Mechatronics Engineering


International Islamic University Malaysia
Laboratory Manual Version 1.4 February 2012

Table of Contents
0. Objectives

1. Mathematical review

2. Method of Laplace transform

3. References

4. Procedure of experiment

Appendix A. List of useful MATLAB commands and functions

21

Appendix B. Modeling differential equations with Simulink

25

2/29

0. Objectives
The objectives of this experiment are:

To model a first-order system and investigate the effect of system parameters on its response
to a step/impulse input.

To model a standard second-order system and to investigate the effect of system parameters
and feedback on its response to a step/impulse input.

To identify specific system parameters that affect system response.

1. Mathematical Review
Linear time-invariant dynamical systems are categorized under first-order systems, second-order
systems and higher-order systems.

1.1 First order equations


The transfer function of all first-order systems has a standard form. This enables us to investigate the
response of first-order systems collectively for any specific input. A linear first order equation with
constant coefficients can be written as

a0

dy (t )
+ a1 y (t ) = f (t ) with y (0) = y0 ,
dt

(1.1)

where y(t) is the output of the system with initial value y0, f(t) is the input and a1, a0 are constant
coefficients.
The solution to (1.1) consists of two parts, namely a complementary and particular solution. The
complementary solution is the solution of the system when the input function f(t) = 0. It governs the
transient response of the system [1].
We can write the complementary solution as

y(t ) = y0e t .

(1.2)

Regarding the particular solution of the system, it depends on the input function f(t). The particular
solution determines the steady state behavior of the solution. Among many methods to obtain it, the
Laplace transform method is probably the easiest for the student, since it has the advantage of giving
both the complementary and particular solution. The sum of these two solutions gives the whole
solution of the system.

1.2 Second order equations


A second order equation can be represented as

a0

d 2 y (t )
dy (t )
+ a1
+ a 2 y (t ) = f (t ) .
2
dt
dt

3/29

(1.3)

Without any lost of generality, we can divide the above equation throughout by a0 and rewrite the
system as

d2y
dy
+ b1
+ b2 y = g (t ) ,
2
dt
dt

(1.4)

where b1, b2 and g(t) are the corresponding coefficients and input respectively.
To find the complementary solution to the above system, we find the auxiliary equation of the system
as in the first order case. This is given by

2 + b1 + b2 = 0 .
The complementary solution of the above system is given by

y (t ) = C1e1 t + C2e 2 t

(1.5)

where C1 and C2 are constants to be determined from the initial conditions.

2. Method of Laplace Transform (adopted from [6])


2.1 First order systems
The standard form of the transfer function of a first-order system is:

G( s) =

Y ( s)
K
=
U ( s) ( s + 1)

(2.1)

where Y(s) and U(s) are the Laplace transforms of the output and input variables, respectively, K is the
DC (steady-state) gain, and is the time constant.
For a unit step input U(s) = 1/s, the response of the system is:

Y ( s ) = G ( s ) U ( s) =

K 1
K
=
( s + 1) s s ( s + 1)

(2.2)

The inverse of the resulting Laplace transform is:

1
t /
y (t ) = L1
= K L1

= K (1 e )
s
(

s
+
1
)
s
(

s
+
1
)

(2.3)

It is clear from (2.3) that the value of y approaches K as t . The DC gain can therefore be
interpreted as the final value of the output for a unit step input. The time constant is the time required
for y(t) to reach 63.2% of its final value. So, for a unit step input, at t= , y(t) = 0.632K. In general, for
a step input of magnitude M, at t= we will have y(t) = 0.632 MK.
Fig. 2.1 shows the response of the first-order system to a unit step input for two cases. For a system
gain K < 1, the systems output change is less than the input change applied. For a system gain K > 1
the systems output change is more than the input change applied.

4/29

Figure 2.1: First-order system step response.

2.3 Second order systems


The standard form of transfer function of a second-order system is

G (s) =

Y (s)
Kn2
= 2
U ( s ) s + 2n s + n2

(2.11)

where Y(s) and U(s) are the Laplace transforms of the output and input functions, respectively, n is
the Eigenfrequency (natural frequency), and is the damping ratio. For a unit step input, U(s) = 1/s,
the response of the system in Laplace domain can be written as

Y (s) =

Kn2
s( s + 2n s + n2 )

(2.12)

Assuming poles of G(s) are complex ( < 1) and the DC gain G(0) = K = 1, the time-domain unit step
response can be written as

y (t ) = 1 1 e n t sin( nt + ),

= 1- 2 ,

= arctan( / )

(2.13)

The step response of a second-order system with varying damping ratios is shown in Fig. 2.4. The plot
is normalized by frequency and amplitude. From Fig. 2.4 it is shown that the response of the system is
oscillatory, but damped. The amount of damping is characterized by the damping ratio , and the
frequency of damped oscillation is n.
The settling time of a second order system is defined as the time it takes for the system to settle within
2% of its steady state value. It is given by the expression Ts = 4, where is the time constant, and is
given as = 1/n. Notice how the time constant appears in the exponential term of (2.13).
The peak time, Tp, is the time required for the output to reach its most extreme value, and is given as

Tp =

n 1 2

5/29

(2.14)

Figure 2.4: Step response of second-order system (normalized).

Another useful response characteristic, percentage overshoot, is defined as the ratio of the difference
ypeak1 to y(), where ypeak1 is the amplitude of the first peak. Unlike the damped oscillation frequency,
Eigenfrequency, settling time, and peak time, it is independent of n; it is only a function of . The
following relation gives the percentage overshoot:
=

/12

100%

(2.15)

In case that the poles of G(s) are real ( 1), the time domain response can be critically damped ( =
1), or overdamped ( > 1).

3. References
[1] E. W. Kreyszig, Advanced Engineering Mathematics, 9e, John Wiley & Sons, 2006.
[2] R. C. Dorf and R. H. Bishop, Modern Control Systems, 9e, Addison-Wesley, 2000.
[3] C. L. Phillips and R. D. Harbor, Feedback Control Systems, 3e, Prentice Hall, 1996.
[4] Mathworks, R2011a Documentation - MATLAB, 2011. [Online] http://www.mathworks.com/
help/techdoc/ [Accessed: 15 Aug. 2011]
[5] S. T. Karris, Introduction to Simulink with Engineering Applications, 2e, Orchard Publications,
2008.
[6] C. Radcliffe, Control Systems Laboratory. [Online] http://www.egr.msu.edu/classes/me451/
radcliff/lab/index.html [Accessed: 15 Aug. 2011]

6/29

4. Procedure of Experiment
4.1 First-order systems (15 minutes)
a. A first-order system is composed of an amplifier and a plant (Fig. 4.1). Find the system transfer
function in standard first-order form, K/(s+1).

Figure 4.1: First-order system consisting of an amplifier and a plant.

Answer:

b. Sketch, as detailed as possible, the output of the above system (Fig. 4.1) for a unit input.
Answer (use a new blank page if there is not enough space to answer):

7/29

4.2 RC transient analysis (25 minutes).

(a)

(b)
Figure 4.2: A simple RC filter.

a. Derive the differential equations for the transient state shown in Fig. 4.2.
Answer:

b. Find vC(t) immediately after the switch is closed (on).


Answer:

c. If V0 = 5V, R = 10 k, and C = 100 F, plot the transient curve of vC(t) and vR(t) in MATLAB for
t 8 . Compute the time constant, , of the system. Show your work.
Answer:

8/29

d. What kind of filter does the above circuit represent? Using MATLAB, draw a Bode plot justifying
your answer.
Answer (use a new blank page if there is not enough space to answer):

9/29

e. Now we change the resistor to R = 1 M. What happened to the transient curve and Bode plot?
Write your conclusions.
Answer (use a new blank page if there is not enough space to answer):

10/29

4.3 DC servomotor system (35 minutes)


A schematic diagram of an armature controlled DC servomotor is shown in Fig. 4.3b. The system
variables include:
ea : armature drive potential (V).
eb : back EMF or counter-electromotive-force (V)
ia : armature current (A)
T : torque produced by servomotor (Nm)
: angular position of rotor (rad)
& : angular speed of rotor (rad/s)
The parameters of the system include:
Ra : armature electric resistance ()
La : armature electric inductance (H)
J : rotors moment of inertia (kg m2)
b : damping ratio (Nms)

Figure 4.3a: Sketch of a DC motor [2].

Figure 4.3b: Schematic diagram of DC servomotor.

The system parameters not shown in Fig. 4.3b include:


KT: torque constant (Nm/A)
Ke: back EMF constant (Nm/A)
The torque constant KT models the relationship between the electric current input, ia, and servomotor
torque output, T:

T ( s ) = KT ia ( s )
11/29

The back EMF (counter electromotive force) constant, Ke , models the relationship between the
rotational servomotor speed, & , input and the electrical back EMF, eb , produced by the servomotor:

eb (t ) = K e&(t )
The transfer function of the servomotor, with armature drive potential, ea(s), as input and motor speed,
s(s), as output, can be written as [3]
=

=
+ + +

(2.4)

Typically, the inductance of the motor armature, La, is relatively small. Neglecting La yields the low
speed approximation for the DC servomotor transfer function

G (s) =

s ( s)
KT
=
ea ( s) JRa s + (bRa + KT K e )

(2.5)

Rewriting (2.5) in the standard first order transfer function yields

G ( s) =

s ( s)
KT /(bRa + KT K e )
=
ea ( s) [ JRa /(bRa + KT Ke )]s + 1

(2.6)

Comparing it with (2.1), we obtain the expression for the servomotors gain:

Km =

KT
(bRa + KT K e )

(2.7)

m =

JRa
(bRa + KT Ke )

(2.8)

and the servomotors time constant:

Km

ms +1
Figure 4.4: Block diagram of the servomotor and amplifier system.

An amplifier is often used to generate the power required to drive the armature voltage on the
servomotor. The amplifier is modeled as a constant gain, Ka. Together, the servomotor and the
amplifier can be modeled as a single first-order system with steady-state gain:

K = Ka Km

(2.9)

= m

(2.10)

and the time constant:

12/29

Modeling DC servomotor
For the model of DC servomotor the following parameters are available:

Simulation interval, 0 3 s
Time step (for simulation), t = 0.1 ms
Rotors moment of inertia, J = 0.01 kg m2
Damping ratio, b = 0.1 Nms
Back EMF constant, Ke = 0.01 Nm/A
Torque constant, KT = 0.01 Nm/A
Amplifier gain, Ka = 25
Armature electric resistance, Ra = 1
Armature electric inductance, La = 0.01 H 0.5 H (varying)

a. For the time being we assume that the armature electric inductance, La 0 (negligible
small). Write a MATLAB routine for simulating the step response of the open-loop DC
servomotor system with amplifier driver, ed, as the input and angular speed, & , as the output.
Answer (use a new blank page if there is not enough space to answer):

13/29

b. Now we apply varying armature electric inductances, La, from 0.5 H, 0.3 H, 0.1 H, 0.05 H
down to 0.01 H to our model. Change your MATLAB routine so that it is suitable for such
conditions.
Answer (use a new blank page if there is not enough space to answer):

c. Write your conclusions about the investigated DC servomotor model.


Answer (use a new blank page if there is not enough space to answer):

14/29

4.4 Torsional mass-spring-damper system (50 minutes)


Consider the torsional mass-spring-damper system in Fig. 4.5.

Figure 4.5: Diagram of torsional mass-spring-damper system.

The system variables are


T

&

external torque applied on rotor (Nm)


angular position of rotor (rad)
angular speed of rotor (rad/s).

The parameters of the system in Fig. 4.5 include


J
b
k

rotors moment of inertia (kg m2)


torsional damping coefficient (Nms/rad)
angular stiffness (Nm/rad).

The transfer function of the mass-spring-damper system, defined with external torque as input and
angular position of the rotor as output, can be written as

G ( s) =

( s)
T ( s)

1
1
k/J
= 2
Js + bs + k k s + (b / J ) s + k / J

(2.16)

The transfer function above bears close resemblance with the standard second-order transfer function.
By comparing (2.11) and (2.16), the expressions for Eigenfrequency and damping ratio can be
obtained as

n2 = k / J

and

2n = b / J so that =

b
2 kJ

(2.17)

It is clear from (2.17) that n and are functions of system parameters J, b, and k, which are typically
fixed. The block diagram of such a system is shown in Fig. 4.6. This system has a transfer function
closely related to the idealized transfer function with the addition of a motor to provide input torque.

1
k/J

2
k s + (b / J ) s + k / J

Figure 4.6: Block diagram of the open-loop torsional mass-spring-damper system.

15/29

This torsional system has an electromechanical gain, Kx that gives the torque-to-voltage-ratio of the
motor drive. If we build the system in Fig. 4.6, we will have a specific second-order response of the
form

(s)
E (s)

= Kx

(s)
T (s)

= K xG ( s ) =

Kx
K
k/J
= x 2
Js + bs + k
k s + (b / J ) s + k / J
2

(2.18)

The Eigenfrequency and damping ratio for this system are the same as (2.16) with a revised DC gain
of Kx /k.
For studying the effect of system parameters on the response, we must be able to change J, b, and k.
We can achieve this by programming the motor to generate the required torques. The torque generated
by the motor is given by the relation

T = K x K h ( K d d K1 K 2&)

(2.19)

where Kh is the amplifier gain, Kd is a voltage-to-angular-deflection ratio and d is the desired output.
Note that KxKhK1 is the type of torque generated by a spring, and K x K h K 2& is the type of torque
generated by a damper. When these torques are applied on the rotor, the feedback will generate
different apparent stiffness and damping, so that the dynamic equation of the system becomes

J&& + b& + k = T

J&& + b& + k + K x K h K 2& + K x K h K1 = K h K x K d d

(2.20)

1
k/J
k s 2 + (b / J ) s + k / J

Figure 4.7: Block diagram of the closed-loop torsional mass-spring-damper system.

Taking the Laplace Transform of (2.20) gives us

Js 2 + bs + k + K h K x K 2 s + K h K x K1 = K h K x K d d

(2.21)

The block diagram of the programmed system is shown in Fig. 4.7. The transfer function of this
system, with T as input and as output, is

G (s) =

(KhK x Kd )
( k + K h K x K1 ) / J
(s)
=
2
d ( s ) ( k + K h K x K1 ) s + s (b + K h K x K 2 ) / J + ( k + K h K x K1 ) / J

which has the same structure as that in (2.18). The system DC gain is now

16/29

(2.22)

K=

(Kh K x Kd )
(k + K h K x K1 )

(2.23)

and the systems Eigenfrequency and damping ratio are given by the relations

n2 = (k + K h K x K1 ) / J ;

2n = (b + K h K x K 2 ) / J ;

(b + K h K x K 2 )
(k + K h K x K1 ) J

1
2

(2.24)

One of the objectives of this experiment is to study the effects of varying the Eigenfrequency n and
the damping ratio on step response of the torsional mass-spring-damper system. We will investigate
this by varying the gains K1 and K2.
Modeling torsional mass-spring-damper
For modeling the torsional mass-spring-damper system (Fig. 4.5) the following parameters are
available:

Simulation interval, 0 0.4 s


Time step (for simulation), t = 0.1 ms
Rotors moment of inertia, J = 0.1 kg m2
Angular stiffness, k = 100,000 Nm/rad
Torsional damping coefficient, b = 0.1 Nms/rad
Electromechanical gain, Kx = 0.2 As
Amplifier gain, Kh = 25
Voltage-to-angular-deflection ratio, Kd = 5,000 V/rad
Voltage-to-angular-deflection ratio, K1 = 0.1 1,000 V/rad (varying)
Voltage-to-angular-speed ratio, K2 = 0.5 15 Vs/rad (varying)

a. Write a MATLAB program to find the step response of the above torsional mass-springdamper system with d(s) as input and (s) as output. Investigate the system behavior by
varying the gains K1 and K2. For each combination of K1 and K2 find the systems
Eigenfrequency n and damping ratio . Describe the effect of K1, and K2 respectively, on the
system.
Answer: Please use an extra sheet/page

b. Use Simulink to study the model behavior of torsional mass-spring-damper (Fig. 4.5).
Compare the result with Problem 4.4a.
Answer: Please use an extra sheet/page

c. Write your conclusions.


Answer:

17/29

4.5 Shock absorber (30 minutes)


a. A shock absorber is a mechanical device designed to smooth out or damp shock impulse, and
dissipate kinetic energy. Sketch a mass-spring-damper model of a spring-based shock absorber
(Fig. 4.8) and derive a second-order differential system from it.

Figure 4.8: Spring-based shock absorber.

Answer (use a new blank page if there is not enough space to answer):

Model of shock absorber


For the model of shock absorber the following parameters are available:

Mass, m = 2 kg
Spring constant, k = 300 3,000 N/m (varying)
Damping ratio, b = 10 200 kg/s (varying)
Simulation interval, 0 3 s
Time step (for simulation), t = 0.1 ms

b. Draw the block diagram of your model (Fig. 4.8) and simulate the impulse response of the
system using Simulink.
Answer (use a new blank page if there is not enough space to answer):

18/29

c. By using MATLAB/Simulink, investigate the dynamic system behavior in response to a unit


impulse. Plot the impulse response of your system for various k and b.
Answer (use a new blank page if there is not enough space to answer):

19/29

d. Find the system frequency response, i.e. G(s=j), using Bode plot for
i. k = 300 N/m and b = 10 kg/s
ii. k = 3,000 N/m and b = 200 kg/s
Examine these two Bode plots thoroughly. Write your conclusions.
Answer (use a new blank page if there is not enough space to answer):

20/29

Appendix A
List of Useful MATLAB Commands and Functions (adopted from [4])
This is neither a manual nor a course on MATLAB. The only goal is to enable the reader to use the
necessary commands, with bare essential explanation of their syntax and meaning. For a
comprehensive explanation, referring to the help system and the documentation is mandatory.

A.1 Defining dynamic systems


Here we limit the scope to Linear, Time-Invariant (LTI), continuous-time (CT), Single-Input, SingleOutput (SISO) dynamic systems represented by rational transfer functions. In MATLAB, such a
transfer function is defined by
>> G = tf(num, den);

where num and den are two vectors containing the coefficients of the numerator and denominator
polynomials, ordered by decreasing power of the complex variable s. Once transfer functions are
defined, the mathematical operators +, -, *, and / can be used with them. For example, to define the
transfer functions
= 5

1+
1
, =
1 + 51 + 10
1 + 2

and compute their series S(s), their parallel P(s), and the closed-loop transfer function F(s) of the
negative feedback system having S(s) in the forward path and P(s) in the feedback path, the following
commands are needed.
>> G1 = tf( 5*[1 1], conv( [5 1], [10 1] ) );
>> G2 = tf( 1, [2 1] );
>> S = G1*G2;
>> P = G1+G2;
>> F = S/( 1+S*P );

Note that the MATLAB conv function computes the convolution of two vectors, i.e., the product of
the polynomials having the elements of those vectors as coefficients.

A.2 Simulating LTI continuous-time (CT) interconnected systems


For our purpose, we focus attention at systems composed by LTI CT SISO blocks. Once the transfer
function from the input to the output of interest has been computed as shown above, it is possible to
simulate the system response to canonic inputs (e.g., typically, the unit impulse or step) or to
arbitrarily defined signals. The MATLAB commands for that purpose are
output = impulse( transfer_function, time_vector );
output = step( transfer_function, time_vector );
output = lsim( transfer_function, input_vector, time_vector );

Some additional arguments can be given, and some are optional (e.g., the time vector can be omitted,
and in that case it is chosen automatically), see the MATLAB documentation and help for full details.
The following example computes the responses yi,s,u(t) of the system

21/29

1
1 + 3

to an impulse of area 2, to a step of amplitude 3, and to u(t) = (t+0.2t2+cos(2t))/100, for a length of


20s and with a time step of 0.05s.
>> G = tf( 1, [1 3] );
>> t = 0:0.05:20;
>> u = ( t + 0.2*t.^2 + cos( 2*t ) )/100;
>> yi = 2*impulse( G, t );
>> ys = 3*step( G, t );
>> yu = lsim( G, u, t );

Note that operator ^ to be applied element by element have a preceding dot. Plotting the results can be
done for example as follows (Fig. A.1).
>> subplot( 3, 1, 1 );
>> plot( t, yi );
>> subplot( 3, 1, 2 );
>> plot( t, ys );
>> subplot( 3, 1, 3 );
>> plot( t, yu );

Figure A.1: Impulse, step and system response.

A.3 Analysis of LTI continuous-time (CT) systems


For our purpose, we limit the scope to the frequency domain analysis of open-loop and closed-loop
LTI CT systems composed of SISO blocks, and we only show the commands
to compute the frequency response of a system,
to plot Nyquist and Bode diagrams.
The MATLAB functions to be used are numerous, and a full description of them would be too long.
Therefore, the choice was made to show the required information by examples: stepping carefully
through the following sequences of commands provides the reader with all he/she has to know, at
least initially. The rest is in the MATLAB manual and help system.
Sequence 1. In this sequence of commands we define a system, compute its frequency response, and
plot it in the form of Bode diagrams with basic commands, i.e., without using the bode function
described later on. You may want to access the help system to learn more about logspace, phasemag,
and unwrap. Note also that MATLAB natively operates in rad/s.
>> num = [10 1]; den = conv([1 1], [100 1]);
>> G = tf(num, den);
>> [hG, w] = freqs(num, den);
>> mGdb = 20*log10(abs(hG));

22/29

>> phG = unwrap(angle(hG));


>> figure( 1 );
>> subplot(211);
>> semilogx(w, mGdb);
>> subplot(212);
>> semilogx(w, phG);
>> w = logspace(-3, 2, 500)
>> hG = freqresp(G, w);
>> mGdb = 20*log10(abs(hG));
>> phG = unwrap(angle(hG));
>> figure( 2 );
>> subplot(211);
>> semilogx(w, mGdb(:));
>> subplot(212);
>> semilogx(w, phG(:));

Figure A.2: Bode plot.

A.4 Analyzing a control loop graphically


In this example we define the transfer functions of a continuous-time LTI rational SISO process P
and regulator R as

= , = 5

Then, we compute the open-loop transfer function L(s) = R(s)P(s), the sensitivity S(s) = 1/(1+R(s)P(s)),
the complementary sensitivity T(s) = R(s)P(s)/(1+R(s)P(s)), and the control sensitivity C(s) =
R(s)/(1+R(s)P(s)).
Finally, we plot the Bode diagrams of L(jw), S(jw), T(jw), and the responses of the process output y and
the control signal u to a unit step of the reference signal, sampled at 0.01s, for a length of 20s. The
result is shown in Fig. 10.
>> P = tf(1, [1 2 1]);
>> R = 5*(1+tf(1, [1 0]));
>> L = R*P;
>> S = 1/(1+L);
>> C = R*S;
>> T = C*P;
>> t = 0:0.01:20;
>> y = step(T, t);

23/29

>> u = step(C, t);


>> subplot(211);
>> bode(L, S, T);
>> subplot(212);
>> plot(t, y, t, u);

Figure A.3: Bode plot, unit step and system response.

24/29

Appendix B
Modeling Differential Equations with Simulink (adopted from [5])
To run Simulink, we must first invoke MATLAB. Make sure that Simulink is installed in your
system. At the MATLAB command prompt (>>), we type:
>> simulink

Alternately, we can click the Simulink icon


on the top bar of the MATLAB Command Window.
Upon execution of the above command, the following popup window will appear on the screen.

Figure B.1: The Simulink library browser.

Now, let us express a differential equation:

d 2vc (t )
dv (t )
= k 2 c + k1vc (t ) + k0u0 (t ) .
2
dt
dt

(B.1)

Figure B.2: Block diagram for the above differential equation.

A block diagram representing Eq. B.1 is shown in Fig. B.2. We will use Simulink to draw a similar
block diagram by performing the following steps:

25/29

1. On the Simulink Library Browser, we click the leftmost icon shown as a blank page
on the
top title bar. A new model window named untitled in which we will enter our block diagram
will appear on the screen. We save this later as model file Equation_1.

Figure B.3: Model window for Equation_1.mdl

This is done from the File drop menu where we choose Save as and name the file as
Equation_1. Simulink will automatically add the extension .mdl.

Figure B.4: Dragging the unit step function into Equation_1 model window

2. With the Equation_1 model window and the Simulink Library Browser both visible, we click
the Sources appearing on the left side list, and on the right side we scroll down until we see
the unit step function block shown as Step block. We select and drag it into the Equation_1
model window (Fig. B.4).
3. Assume that the constants in Eq. B.1 are k0 = 3, k1 = -3 and k2 = -4, and the input u0 is a unit
step function. With reference to block diagram of Fig. B.2, we observe that we need to
connect an amplifier with Gain 3 to the unit step function block. The Gain block is under
Math Operation blocks. If the Equation_1 model window is no longer visible, it can be
recalled by clicking on the white page icon on the top bar of the Simulink Library Browser.

26/29

Figure B.5: Equation_1 with added Step and Gain blocks.

4. We choose the Gain block then drag it to the right of the Step block (unit step function). The
triangle on the right side of the unit step function block and the > symbols on the left and right
sides of the gain block are connection points. We point the mouse close to the connection
point of the unit step function until it shows as a cross hair, and draw a straight line to connect
the two blocks. We double-click the Gain block, and on the Function Block Parameters we
change the gain from unity to 3 (Fig. B.5).

Figure B.6: File Equation_1 with Add block and connections between the blocks.

5. Next, we need to add a three-input Adder or Sum. The Adder/Sum block appears on the right
side of the Simulink Library Browser under Math Operations. We select it, and we drag it into
the Equation_1 model window. We double click it, and on the Function Block Parameters
window which appears, we specify 3 inputs. We then connect the output of the Step block to
the input of the Gain block, and the output of the of the Gain block to the first input of the
Add block as shown in Fig. B.6.
6. Now, from the Continuous block we choose the Integrator block, drag it into the Equation_1
model window, and connect it to the output of the Add block. We repeat this step to add a
second Integrator block. We click the text Integrator under the first integrator block, and we
change it to Integrator 1. Then, we change the text Integrator 1 under the second Integrator
to Integrator 2 as shown in Fig. B.7.

Figure B.7: File Equation_1 with the addition of two integrators.

7. To complete the model, we add the Scope block which is found in the Sink blocks, then
connect it with the Integrator 2. Further we click the Gain block, and we copy and paste it
twice. We flip the pasted Gain blocks by using the Flip Block command from the Format
drop menu, and we label these as Gain 2 and Gain 3. Finally, we double-click these gain
blocks, and in the Function Block Parameters dialog box. We change the gains in Gain 2 and
Gain 3 blocks from unity to -4 and -3 as shown in Fig. B.8.

27/29

Figure
igure B.8:
B. File Equation_1 complete block diagram.

8. The initial conditions 

= 0, and vc(0) = 0.5 V are entered by double-clicking


double
the

Integrator blocks and entering the values for the first integrator, and for the second integrator
integrator,
respectively.. To obtain a true picture of the output, we double-click the Unit block and in the
Source Block Parameters window.
window We change the Step time value from 1 to 0. We leave all
other parameters in their default state. We also need to specify the simulation time. This is
done by specifying the simulation time to be 10 seconds on the Configuration Parameters
from the Simulation drop menu. We can start the simulatio
simulation
n by clicking the icon
.

Figure
igure B.9:
B. The waveform for the function vc(t).

9. To see the output waveform, we double click the Scope block, and clicking on the Autoscale
icon
. Then we right-click
click near the vertical axis, we click on Axes properties,
properties we specify
Y-min = 0, Y-max = 1.5, we click OK, and we obtain
in the waveform shown in F
Fig. B.9.

10. Impulse function


nction is useful in the simulation
simulat n of impact or sudden loads. Unit impulse function
at a desired time instant a is defined by

(t a ) = 0 for t a .

(t )dt = 1 .

(4.2)

Eq. (4.2) is also known as Dirac delta function. To simulate unit impulse in Simulink, we use
a two-block
block step function set as shown in Fig. B.10.

28/29

Figure B.10: Simulation of unit impulse in Simulink.

29/29

Laboratory Manual
Experiment 2

Experiment 4

PID controller design for DC motors speed control

by
Dr. Iskandar Al-Thani Mahmood

Department of Mechatronics Engineering


International Islamic University Malaysia
Laboratory Manual Version 1.3 April 2012

Table of Contents
1. Objectives

2. Background

2.1. Physical Model of Differential Equations

2.2. Transfer Function

3. PID Controller

4. MATLAB Simulation Procedure

4.1. PID Controller Tuning

5. Conclusion

12

2/15

1. Objectives
The objectives of this experiment are:
To tune a PID controller for a system/plant using MATLAB.
To investigate the features of each proportional (P), integral (I) and derivatives (D) controller to the plant.
In this experiment, DC motor speed control is chosen as the system/plant.

2. Background
The plant of DC motor is a good example of a dynamic system that includes both mechanical dynamic due to
inertia and viscous damping and the electrical dynamic due conductance and resistance of the motor. The
resulting model is a second order. The control objectives are to have a fast response to a step input (i.e. speed
change or position change) with small overshoot and small steady-state error

2.1. Physical Model of Differential Equations


A common actuator in control system is DC motor. It directly provides rotary motion and, coupled with
wheels or drums and cables can provide transitional motion. A sketch and a schematic diagram of an
armature controlled DC servo motor are shown in Figures 1 and 2 respectively.

Figure 1: (a) Schematic diagram and (b) sketch of a DC motor [1]


The system variables of a DC motor include:
ea: armature drive potential (V)
eb: back EMF or counter-electromotive-force (V)
ia: armature current (A)
T: torque produced by servomotor (Nm)
: angular position of rotor (rad)

& : angular speed of rotor (rad/s)

The physical parameters of the system include:


Ra: armature electric resistance () = 1.0
La : armature electric inductance (H) = 0.5 H
J: rotors moment of inertia (Nms2/rad) = 0.01 Nms2/ rad
b: damping ratio (Nms) = 0.1 Nms

3/15

KT: torque constant (Nm/A) = 0.01 Nm/A


Ke: back EMF constant (Nm/A) = 0.01 Nm/A
In this experiment, these given physical parameter values will be used in for the MATLAB simulation
studies.
The motor torque, T, is related to the armature current, ia, by a constant Kt. and the back EMF, eb, is related
to the rotational velocity by a constant Ke as shown in the following equations:

T ( s) = KT ia ( s)

(1)

eb (t ) = K e&(t )

(2)

In SI units, Kt. is equal to Ke, (KT = Ke = K). From the above figures, the following equations based on
Newtons law combined with Kirchhoffs law can be derived:

J&& + b& = Kia

(3)

di
+ Ria = ea K&
dt

(4)

2.2. Systems Transfer Function


Using Laplace transforms, the above modeling equations, can be expressed in term of s as:

s( Js + b ) (s ) = KI a (s )

(5)

(Ls + R )I a (s ) = Ea (s ) Ks (s )

(6)

By eliminating I(s), the open-loop transfer function where the rotational speed ( & ) is the output and the
voltage (Ea) is the input can be obtained as:
  

s 
 




     

0.01

(7)
(8)

0.0052 0.06 0.1001

Note that, we are going to design PID controller for this transfer function in this lab.

3. PID Controller
PID controller is the most popular controller in many applications. The block diagram of a closed-loop control
system is illustrated as:

U
R



Figure 2: Block diagram of closed-loop control system


Recall that the transfer function for a PID controller is:
 


  
 


  


4/15

(9)

In some cases only combination of PI or PD controller is sufficient to achieve the required specification.


 
 !
 
 




 

  
 " #

(10)
(11)

The value of the KP, KI and KD can be theoretically calculated or tuned to compensate the plant in order to achieve
the desired performance of the system, in terms of setting time, rise time, steady state error and percentage of
overshoot.

4. Simulation Procedure
Basic requirement of a motor is that it should rotate at the desired speed and the steady-state error of the
motor speed should be small. Other performance requirement is that the motor must accelerate to its
steady-state speed as soon as it turned on. Since any speed faster than the reference speed may damage
the motor, the percentage overshoot is also need to be limited.
For this lab, the motor speed output should have the following desired specifications:
Settling time (Ts) 2 seconds
Percentage overshoot (PO) 5 %
Steady-state error (Ess) 1 %

Note:
For step no. 1 to 6, please include in your answers the relevant MATLAB script, Simulink

block diagrams and plot of the step responses.

An example of MATLAB script may be used to define a transfer function:


>> G = tf([a1],[b1 b2])

In Simulink, the following block diagrams may be used to represent transfer function:

5/15

4.1. PID Controller Tuning


1. By using MATLAB/Simulink, obtain the open-loop unit step response of Gv(s). Calculate the:
Settling time (Ts)
Rise time (Tr)
Percentage overshoot (PO)
Steady-state error (Ess)
and give comments.

MATLAB script / Simulink block diagrams

Open-loop unit response


TS

Tr

PO

Ess
Comments

6/15

2.

Modify the open-loop block diagram to include feedback system with a proportional controller
P with Kp = 100. Obtain the closed-loop step response and give comments on the performance (Ts, PO
and Ess).
Answer:

MATLAB script / Simulink block diagrams

Closed-loop unit response


TS

Tr

PO

Ess
Comments

7/15

3.

Replace the proportional P controller with a proportional-derivative PD controller with KP = 100 and KD
= 1 (small KD). Obtain the closed-loop step response and give comments on the PO and Ess as
compared to the P controlled in step no. 2.
Answer:

MATLAB script / Simulink block diagrams

Closed-loop unit response


TS

Tr

PO

Ess
Comments

8/15

4.

Replace the proportional-derivative controller PD with a proportional-integral-derivative PID controller


with KP =100, KI = 1 and KD = 1 (small KI and KD). Obtain the closed-loop step response. Determine
whether all the desired specifications have been satisfied and give comments.
Answer:

MATLAB script / Simulink block diagrams

Closed-loop unit response


TS

Tr

PO

Ess
Comments

9/15

5.

Tune the PID controller by increasing KI = 200 (KP =100, KD = 1). Obtain the closed-loop step response.
Determine whether all the desired specifications have been satisfied and give comments.
Answer:

MATLAB script / Simulink block diagrams

Closed-loop unit response


TS

Tr

PO

Ess
Comments

10/15

6.

Retune the PID controller by increasing KD = 10 (KP =100, KI = 200). Obtain the closed-loop step
response. Determine whether all the desired specifications have been satisfied and give comments.
Answer:

MATLAB script / Simulink block diagrams

Closed-loop unit response


TS

Tr

PO

Ess
Comments

11/15

5. Experimental Procedure
5.1. Assemble in accordance with the diagram (Fig.
(Fig.3).
5.2. Adjust the setpoint integrator to , S1=Off.
5.3. Adjust the setpoint value to =0o(360o), and the output voltage to U = 0.0v with the "zero" adjuster.
5.4. Adjust the setpoint value to =90o, and U= 5.0 v with the "scale" adjuster.
5.5. Connect the output of the set point potentiometer directly to the input of the DC-Servo
DC
with
amplifier (PID-controller
controller inputs and outputs are disconnected).
5.6. What does control mean?

P Controller
5.7. Make the connections with the PID controller block added and adjust Kp=1.0; Ki=off; Kd=off.
5.8. Record the values for Table 1.

5.9. Start with Kp=1*1, 2*1, 3*1. (Bottom gain adjuster is a multiplier)
5.10.
Then adjust the potentiometer to Kp=5*1 and Kp=1
Kp=10*1
5.11.
Subsequently, set Kp=10*100.
p=10*100. Explain the results!

5.12.

How does the control performance?

12/15

PI Controller
5.13.
5.14.
5.15.

5.16.
5.17.

Adjust Kp = 1.0 ; Ki=off; Kd=off. S1 = off and the adjusting disc of the servo to = 0o.
Connect S1 to "on". Now set Ki=0.5*1 and turn the Ioff switch up.
Record the step response of the control loop with the help of the oscilloscope, explain how the
integral control operates?

Make the following adjustments at the controller : Kp=200 , Ki=0.5.


Record the step response with the oscilloscope.

5.18. Make the following adjustments (PID Controller): Kp=200, Ki=0.5, Kd= 0.05.
5.19. Record the step response.

5.20.
5.21.

Do the same with the following adjustments: Kp=20, Ki=50, Kd=0.2.


How can the overshoot be reduced?

13/15

6. Conclusion
Answer:

14/15

Figure 3: Diagram of Experiment

15/15

MCT 3159
EXPERIMENTS 3: Application of
operational amplifiers and encoders in
control systems.
Part 1 Half wave and full wave precision rectifiers
(Analog Electronics Laboratory)

PLEASE READ THE INSTRUCTION CAREFULLY. FAILURE TO FOLLOW


SUCH INSTRUCTION MAY RESULTS IN REDUCED MARKS.

Half wave and full wave precision


rectifiers 1.1 OBJECTIVES
The objectives of the experiment are to:
1. Discover precision rectifiers.
2. Show limitation of simple diode rectifiers
3. Show the application of precision rectifiers.
4. Demonstrate Op-amp as a rectifier.
5. Simulate model in Pspice or Matlab

1.2 LEARNING OUTCOMES


[t is expected by completing the experiment, the students will be able to:
1. Develop the precision rectifiers
2. Solve the offset voltage problem in conventional diode rectifiers.
3. Design the half wave and full wave rectifiers

1.3 THEORY/BACKGROUND
Terms to Learn

Ideal diode a diode with zero forward voltage drop and zero reverse current.
Linearize change a nonlinear characteristic to a linear characteristic. Voltagecurrent characteristic the graph of voltage (X axis) versus current (Y axis) between
two terminals of a device.
A Basic Op-Amp Rectifier
Passive rectifiers those that use diodes in half or full wave configurations are fine for
rectifying large signals if the circuit is forgiving of the diodes forward voltage drop,
VF. For small signals, meaning those much smaller than VF, passive rectifiers dont
work well at all. Wouldnt it be nice if we could order an ideal diode? Vendors are often
out of stock of ideal diodes, but we can make one by using the analog designers
favorite tool, an op-amp. Semiconductor diodes turn on a little slowly before reaching
a relatively constant voltage drop of 0.6 to 0.7 V (silicon) or 0.3 V (germanium). In a
full wave circuit, this causes crossover distortion in the region the signal changes from
forward to reverse current. Signals much smaller than VF are attenuated as well, in both
full and half wave circuits. By using feedback in an active circuit as shown in Figure
1.1, we can use the op-amps high gain to liberalize the non-linear voltage-current (V-I)
characteristics of a diodes PN junction. (A resistors V-I characteristic is a straight line
with a slope of A/V equal to its resistance in ohms.)

1.4 EQUIPMENT:
Oscilloscope
Function Generator
Digital multimeter
15V DC Power Supply

Figure 1.1 The V-I characteristic curves for ideal and real diodes, showing VF
for real
Diodes. At B, a simple half-wave rectifier circuit with an adjustable load
for measurements.

Figure 1.2 A precision half-wave rectifier with adjustable gain controlled by


the ratio of R1 and R2 with a diode clamp (D1) to prevent op-amp saturation.

Laboratory Procedure:
NOTE: Set V+ to +15V and V- to -15V. The bypass capacitors can be 0.1NF to 1 NF
ceramic. Use LM741 op-amps and 1N4148 diodes unless directed otherwise.
Display VO vs time on the scope unless directed otherwise.

1. Build the precision half-wave rectifier circuit shown in Fig.1.3. You will need to
replace the diode and op-amp later so try to leave room to do this without having to
rebuild the whole circuit.
2. Apply a 3 Vpp sine wave at 500 Hz as Vin and capture the output waveform
across R1.
3. Use a square wave of 1Vpp and a period of 10 ms. for Vin. Capture VO.
4. Use a triangle wave of 1Vpp and a period of 10 ms. for Vin. Capture VO.
5. Reverse the polarity of D1 and repeat step 2.
6. Display VO versus Vin in x-y mode and capture the waveform.

7.

Increase the frequency from 500Hz to 5MHz in steps of one decade and record VOpeak.

8.

Replace the diode with a 1N4004 and repeat step 7.

Put the 1N4148 back in.

10. Connect a 0.22 F capacitor across R1 and capture VO at 500 Hz.


11. Build the Imprecise full-wave rectifier circuit shown in Fig. 1.4.
12. Use a 3 Vpp sine wave at 500 Hz as Vin and capture the output waveform across R3.
13. Reverse the polarity of D1 and D2 and repeat step 12.
14. Display VO versus Vin in x-y mode and capture the image.
15. Modify the circuit to produce the precision full-wave rectifier circuit as shown in Fig.
1.6.
16. Use a 3 Vpp sine wave at 500 Hz as Vin and capture the output wave form across R3.
17. Increase the frequency of the sine wave until distortion occurs. Note the frequency.
Capture the output wave form across R3. Return to 500Hz.
18. Display VO versus Vin in x-y mode and capture the waveform.
19. Build the single op-amp precision full-wave rectifier circuit shown in Fig. 1.6. Adjust
R3 to optimize symmetry.
20. Apply a 3 Vpp sine wave at 500 Hz to Vin and capture the output wave form across R3.
21. Increase the frequency of the sine wave until distortion occurs. Note the frequency.
Capture the output wave form across R3.
22. Display VO versus Vin in x-y mode and capture the waveform. Return to 500 Hz.
23. Build the single op-amp precision full-wave rectifier current output circuit shown in
Fig. 1.7. Pick an R1 value between 820f2 and 1.2Kf2. Measure IO for several different
AC input voltages. Choose a waveform and frequency. IO is measured where the
current source symbol is drawn. Determine a formula for IO with respect to Vin and R1.

Vplus
Vminus
4
5

D1
1N4148
Vo

2
3

GND

C1
0.1

C2
0.1

LF356

U1

R1
1K to 10K

Va

7
1

Vin

Vminus

GND
Vplus

Ceramic Bypass Caps


Caps in uF
1.0 uF Bypass Caps are better
Mount close to power pins

Fig. 1.3 Precision Half-Wave Rectifier

4
5

V m in u s

D1 1N4148

7
1

C1
0.1

Vplus
V m inu s
R1
2
1K to 10K

C2C 3
0.1 0.1

C4
0.1

4
5

GND

V m in u s

V p lu s

R2 = R1

D2 1N4148
6
LF356
U2
7
1

Vin

6
LF356
U1

Vplus

Vo

R3
1K to 10K

Ceramic Bypass Caps


Caps in uF
1.0 uF Bypass Caps are better
Mount close to power pins

GND

Fig. 1.4 Imprecise Full-Wave Rectifier

4
5

V m in u s

2
3

V p lu s

R2 = R1
C1
0.1

Vplus

GND

V m in u s

U1
7
1

Vin

D1 1N4148
6

LF356

C2C 3
0.1 0.1

C4
0.1

4
5

V m inu s
R1
2
3

Vo

U2
R3
1K to 10K

7
1

1K to 10K

Ceramic Bypass Caps


Caps in uF
1.0 uF Bypass Caps are better
Mount close to power pins

D2 1N4148
LF356

Vplus

GND

Fig. 1.5 Precision Full-Wave Rectifier

Vplus

R2
2

Vin
2R1

Vminus

R1 1K to 10K

4
5

Vminus

C1
0.1

D1 1N4148
LF356

Vo

U1

GND
7
1

C2
0.1

R3
10K

Vplus
GND

Ceramic Bypass Caps


Caps in uF
1.0 uF Bypass Caps are better
Mount close to power pins

Fig. 1.6 Single Op-Amp Precision Full-Wave Rectifier

Vplus
7
1

Vplus

Vin

GND

+
LF356

Vminus

6
C1
0.1

C2
0.1

4
5

U1

Vminus

Ceramic Bypass Caps


Caps in uF
1.0 uF Bypass Caps are better
Mount close to power pins

D1-D4
4 * 1N4148

Io

R1
820 to 1.2K

Fig 1.7 Single Op-Amp Precision Full-Wave Rectifier with current output.

Result
1. For the circuit given in Fig 1.3, Fig 1.4, Fig 1.5, Fig 1.6 and Fig 1.7 determine the values of
Vi and VO
DC volt
Vi
Vo
Vi
Vo

0.7

0.8

0.9

1.0

1.5

1.6

-0.7

-0.8

-0.9

-1.0

-1.5

-1.6

Voltage
1.7 1.8
-1.7

-1.8

1.9

2.0

2.5

-1.9

-2.0

-2.5

3.0

-3.0 -4

-5

2. Sketching VO with respect to time given Vin = 10 sin 2ft for the rectifier circuit
shown in Fig. 1.4. Assume f = 200 kHz (6 points).

3. Sketch the VO vs. Vin relationship for both the full wave rectifiers shown in Fig. 1.4 and Fig.
1.5. Compare them. Give the width of the dead zone for both cases. Assume that the open loop
gain of the op amp is 105. (7 points)

Discussion:
1. Explain the operation of one of the circuits tested. Specify the Fig. number of the
circuit you are explaining.
2. Explain what happens when the polarities of the diodes are reversed during parts of the
experiment.
3. Explain why one full-wave rectifier circuit is called "precision". Specify the Fig.
number of the circuit you are explaining.
4. Explain why the single op-amp rectifier output changes with frequency.
5. Explain which component is more important for frequency response in the half wave
precision rectifier circuit. The diode or the op-amp. Why?
6. Could any of these circuits be used to determine VRMS for sine waves? How would you
do that? How about for triangle waves?

Experiment 4

Part 2: Active filters: implementation of low pass, high


pass and band pass filters with operational amplifier.
(Measuring and Instrumentation Laboratory)

Active filters: implementation of low pass, high pass and band


pass filters with operational amplifiers.

3.1 OBJECTIVES
The objectives of the experiment are to:

1. Use operational amplifiers as .Active filters form one of the most


common application.
2. Design and compare different architecture of this lab is to design of activeRC filters. Two common architectures,
3. Find the frequency response of the different active filter and compare theoretical
and
practical results.
4. Find the suitability of different active filter for target application

3.2 THEORY/BACKGROUND
Background Theory:
An active filter is a type of analog electronic filter, distinguished by the use of one or
more active components i.e. voltage amplifiers or buffer amplifiers. Typically this will
be a vacuum tube, transistor or operational amplifier.
There are two principal reasons for the use of active filters. The first is that the amplifier
powering the filter can be used to shape the filter's response, e.g., how quickly and how
steeply it moves from its pass band into its stop band. (To do this passively, one must use
inductors, which tend to pick up surrounding electromagnetic signals and are often quite
physically large.) The second is that the amplifier powering the filter can be used to
buffer the filter from the electronic components it drives. This is often necessary so that
they do not affect the filter's actions.
A high-pass filter is a filter that passes high frequencies well, but attenuates (or reduces)
frequencies lower than the cutoff frequency. The actual amount of attenuation for each
frequency varies from filter to filter. It is sometimes called a low-cut filter; the

terms bass-cut filter or rumble filter are also used in audio applications. A high-pass
filter is the opposite of a low-pass filter, and a band-pass filter is a combination of a highpass and a low-pass.

It is useful as a filter to block any unwanted low frequency components of a complex


signal while passing the higher frequencies. Of course, the meanings of 'low' and
'high' frequencies are relative to the cutoff frequency chosen by the filter designer.

3.3 EQUIPMENT:

Equipment/Devices Required
Low Pass and High Pass Filters
Oscilloscope
Multimeter
Breadboard and wire
Power Supply (15 VDC)
Function Generator
Op-amp: LM741
Capacitors: 0.01uF, 0.1uF
Resistors: 1k ohm, 22k ohm, 10kohm
3.4 Laboratory Procedure
1. Using power supply voltages of 15 VDC for the op-amp, construct an inverting
amplifier circuit.
2. Calculate the cutoff frequency (f c ) for the circuit using the measured values of the
components. Add two extra 0.1 F capacitors to the circuit. One should be connected
between the + DC supply (pin 4) and ground the other should be connected between the
- DC supply(pin 11) and ground. These capacitors are to help prevent oscillation in the
amplifier circuit due to interaction between the circuit and the power supply. They
should be placed as close to the Op-Amp itself as physically possible. Make sure that
the circuit is correctly connected before turning on the power supply voltages. Failure
to do so may cause the op-amp to saturate and in some cases cause permanent damage
to the op-amp.
3. Set the signal input, V in, to zero. That is replacing the signal source, Vin, with a short
circuit to ground. Carefully measure the DC output voltage. Make sure you record the
proper sign; It should be between +50 mV and -50 mV, usually very small. This output
with no input is called the output offset voltage. It is an error in the output of the circuit.
It can be treated as an equivalent input offset voltage applied to the non-inverting input
of the op-amp. The equivalent input offset is calculated by dividing the measured output
offset by the gain of the amplifier from the non-inverting input, Av = (1 + R f /R i ). This
offset has no effect on the ac operation of the circuit, but can cause errors in dc
measurements of small voltages.
n

4. Use a signal input voltage, Vin, of 0.1 VDC and connect it to the amplifier signal input as Vin.
Using a digital Multi-meter, measure and record both Vin and Vout as accurately as possible.
Calculate the DC voltage gain both with and without correcting the output

voltage by subtracting the output offset voltage measured in step 2 from the measured
output voltage. Be sure to use the correct sign on the offset voltage. Repeat this
measurement and calculation with Vin = 1.0 VDC.

3.1 Low Pass Filter


A low pass filter (LPF) allows an incoming low frequency of a certain range to pass over while
much higher frequency is blocked. An ideal LPF has a specification that frequency from 0
Hz(DC) until the critical frequency (fc) is allowed to pass and the output voltage at fc is 70.7% of
the pass band voltage. After fc, the output voltage begins to drop instantaneously (roll-off point).
Figure 3.1 shows this illustration.

Vo
70.7% Vo

Pass Region
f
fc

Figure 3.1
A basic first order LPF is as shown in Figure 3.2 below. This is also known as single pole LPF
because it has a pole or intersection with one set of RC components. This LPF can yield a roll of
rate of approximately -20dB/decade above the critical frequency fc, as seen in Figure 3.3.

Figure 3.2

Av (dB)
0
-3
-20db/decade

-20
fc

10fc

Figure 3.3
The critical frequency is given as :

fc = 1/ 2R3C1 (Hz)

The bandwidth :

BW = fc

The close loop voltage gain is given as : Av = 1 + Rf/R1


For higher roll off rate, we can use higher orders of LPF. Figure 3.4 shows a basic 2nd order LPF
which can yield a roll off rate of -40dB/decade above the critical frequency fc.

Av (dB)
0

-40db/decade

-60 _
fc

Figure 3.4

100fc

The critical frequency of a 2nd order LPF :

fc =

1
2

Hz

R2 R3 C1 C2

Normally, R2=R3 & C1=C2

So, fc =

Hz

2RC

Procedures:
1. Connect the required DC power supply to the 15V, -15V & GND terminals.
2. Consider the 1st order LPF circuit. R1 is set to 1K Ohm.
3. Set RF to 1k Ohm, R3 = 22K Ohm and C1 = 0.01uF. Calculate the critical
frequency for this 1st order LPF. _________________________
4. Calculate the gain
5. Using a function generator, input a sine wave with a frequency below and above the
resonant frequency and observe the two set of output frequencies.
Explain you results. _______________________________
6. Consider the 2nd order LPF circuit. R1 is set to 1K Ohm.
7. Set RF to 1k Ohm, R2 = R3 = 22K-Ohm and C1 = C2 = 0.01uF.
8. Calculate the critical frequency for this 2nd order LPF
9. Calculate the gain
10.
Using a function generator, input a sine wave with a frequency below and above
the resonant frequency and observe the two set of output frequencies using an
oscilloscope.
Explain you results. _______________________________

3.2 High Pass Filter


A high pass filter (HPF) blocks the incoming signal frequency which is below its critical
frequency fc while all frequency higher then fc is passed. Just like the LPF, the fc occurs at a
point where the output voltage is 70.7% of the pass band voltage, as shown in Figure 3.5.
Vo
70.7% Vo
Pass region

fc

Figure 3.5

Figure 3.6 shows a standard 1st order HPF (single pole HPF) and its characteristic response plot.

Figure 3.6
Av(dB)
0
-3

-20
fc

The critical frequency fc is given as : fc = 1/2R2C2 (Hz)


The voltage gain is given as :

A = 1 + Rf/R1

A 2nd order HPF is shown in Figure 3.7 and is used when higher roll off rate is required.
The cut off frequency is given as :

fc = 1/2RC
Where R = R2 = R3
C = C1 = C2

Figure 3.7

Procedures:
Connect the required DC power supply to the 15V, -15V & GND terminals.
Consider the 1st order HPF circuit. R1 is set to 1K Ohm.
Set RF to 1k Ohm, R2 = 10KOhm and C2 = 0.1uF.
Calculate the cut off frequency for this 1st order HPF. ___________________________
Calculate the gain. __________________
Using a function generator, input a sine wave with a frequency below and above the resonant
frequency and observe these two set of output frequencies.
Explain you results. _______________________________
7. Now, consider the 2nd order HPF circuit. R1 is set to 1K Ohm.
8. Set RF to 1k Ohm, R2 = R3 = 10KOhm and C2 = C1 = 0.1uF.
9. Calculate the cut off frequency for this 2nd order HPF. ___________________________
10. Calculate the gain. __________________
11. Using a function generator, input a sine wave with a frequency below and above the resonant
frequency and observe these two set of output frequencies using an
oscilloscope. Explain you results. _______________________________
1.
2.
3.
4.
5.
6.

3.3 Result / GRAPHS:


1. Using a spreadsheet plot a graph of the gain (dB) vs. frequency response. Set the x-axis
scale to log instead of linear for the frequency. This can be done in Excell by selecting
the x-axis and then right clicking on it. Then click on Format Axis in the menu that
appears. Next click on the scale tab in the Format Axis menu. Finally check the
logarithmic scale box. Set the lower limit on the x-axis to 10Hz or 0.01kHz. The minor
grid lines can be turned on by Right clicking inside the chart area, then clicking on Chart
Options, then select the Gridlines tab and check the gridlines to be turned on. The gain in
dB is calculated: Gain (dB) = 20 log(Vo/Vin ) = 20 logAV. Determine the slope in dB per
decade (of frequency) in the capacitive "roll-off" region (the straight line portion above
the cutoff frequency). Do this by drawing a straight line tangent to the curve at the
highest frequency point and extend the line to cover one full decade (5kHz to 50kHZ) of
frequency. Then determine the difference in gain across the frequency decade for this
line.
2. Plot a graph of phase vs. frequency response with the frequency on a log scale.
3. From both graphs, determine the half-power frequency . On the gain graph use a
straight edge and draw a horizontal line 3 dB below the level of the low frequency gain.
The point where this line intersects the gain curve is the upper 3 dB or half power
frequency. On the phase graph draw the horizontal line at 135. Do the two values
agree? Show by drawing lines and labeling them on your graph how you determined
the cutoff frequency.

1. Apply an input of 1V AC and obtain plots for AC response plot of the output for a
frequency range of 1Hz to 1MHz.(Low pass filter)

2. Apply an input of 1V AC and obtain plots for AC response plot of the output for a
frequency range of 1Hz to 1MHz.(High pass filter)

3.4 Discussion:
Items For Discussion:
Questions and answers
1. List five important filter specifications and explain the importance of
each.
2. What are the advantages of active-RC implementations of filters
over passive RC implementations?
3. What happened to the high-pass filter responses at higher
frequencies? Should that happen ideally? If so why? If not explain
which component is responsible and how it is responsible.

Expeerimentt 5
Calibration & Characteriization of Senssors
Objectiive:
The
T purposes of this experiment
e
t are:
To
T acquaintt you with common analog
a
sensor,
To
T demonsttrate you how
h to integrate sensoor to the syystem
To
T familiar you to callibrate the sensor
To
T acquaintt you to ch
haracterize the sensorr
ng outcom
me
Learnin
Desiign and implement op
perational amplifiers in instrum
mentation aapplicationns.
Introdu
uction:
Force Sensing
S
Resistor (FSR
R) is a pollymer thickk film (PTF) device which exhhibits
a decreaase in resisstance with
h an increaase in the force appllied to the active surfface.
Its forcce sensitiviity is optiimized forr use in hhuman touuch controll of electrronic
devices. FSRs arre not a load
l
cell or strain gauge, though theyy have sim
milar
propertiies. FSRs are not suiitable for precision
p
m
measuremeents. Fig. 1 show typpical
construcction of FSR. In gen
neral, FSR
R response approxim
mately folloows an invverse
power-llaw characteristic (ro
oughly 1/R)).

Fig.
F 1 FSR constructio
on
EQUIPMEN
E
NT:

Oscilloscop
O
pe
Function
F
Generator
Digital
D
mulltimeter
15V

DC Power
P
Supp
ply

Laboratory
L
Proceduree:
Construct
C
th
he circuit as
a shown in
n Fig.2.

Value
V
of RM
M is given
n in table 1
Table
T
1:
RM
R
RM
R
RM
R
RM
R
RM
R
RM
R

Koohm
3
10
30
47
100

Graphs to be plotted and discussed for all RM


1.
2.
3.
4.
5.

Force Vs VOUT. Force should be varied from 10 g to 1000 g.


Plot Hysteresis curve and discuss
Find out the linearity range and discuss
Find out the sensitivity and discuss
What is the purpose of using voltage follower in this circuit? Explain
with elaborate discussion and sketch.

KULLIYYAH OF ENGINEERING
DEPARTMENT OF MECHATRONICS ENGINEERING

Laboratory Manual

MECHATRONICS
ENGINEERING LAB II

(MCT 3159)
Pneumatic control
EXPERIMENT 6

Pneumatic EXPERIMENTS
6.1
OBJECTIVES
Understand the operation of the single acting cylinder and its direct
control with a way N.C. valve.

DESCRIPTION
A single acting cylinder has to be controlled by a 3/2 way N.C. valve
operated by a push-button in such a way that when pressing it the
cylinder extends and when released the cylinder returns to the starting
position.

IMPLEMENTATION SEQUENCE
1. Make up the diagram with standard symbols.
2. Connect the pneumatic elements in the assembly panel and check
their working order.
3. Describe the sequence of operation.

6.2
OBJECTIVES
-To understand the concept of indirect control
-To understand the concept of OR operation
-To understand the concept of Memory valve
DESCRIPTION
-

A double acting cylinder will move by means of any of the push button

valve
- With the activation of a second 3/2 way valve operated by pushbutton the corresponding signal will be produced in order to activate
the valve that will move the cylinder.
- The cylinder will extend when pressing the push-button and will
retract after reaching the full extension.

IMPLEMENTATION SEQUENCE
1. Make up the diagram with standard symbols.
2. Connect the pneumatic elements in the assembly panel and check
their working order.
3. Describe the sequence of operation.

6.3
OBJECTIVES
-To understand the concept AND operation
-To understand the concept of reciprocating cycle for pneumatic
system
- To understand the use of limit switch valve
DESCRIPTION
-

A double acting cylinder will reciprocate by means of the selector

switch valve until the selector switch valve is closed


IMPLEMENTATION SEQUENCE
1. Make up the diagram with standard symbols.
2. Connect the pneumatic elements in the assembly panel and check
their working order.
3. Describe the sequence of operation.

KULLIYYAH OF ENGINEERING

DEPARTMENT OF MECHATRONICS ENGINEERING

Laboratory Manual

MECHATRONICS
ENGINEERING LAB II

(MCT 3159)
PLC control
EXPERIMENT 7

PLC EXPERIMENTS
7.1
OBJECTIVES
The objective of these experiments is to understand the concept of
PLC programming and PLC integration with various sensors, switches and
actuator.
DESCRIPTION
Typical PLC hardware connection is shown in Fig. 1 and Fig.2

Fig.1: NPN connection to PLC for input and output.

Fig.2: NPN connection to PLC for input and output.

Following programs are needed to be written and tested with


associated hardware. Discuss sequence of operation after testing
each program.
Program 1:
A. Design a ladder program that will use two inputs to turn on an
output.
B. Design a ladder program that will use anyone of two inputs to
turn on an output.
C. Repeat A and B with latch output.

Program 2:
A. Turn on an output ten second after a NO connection and a NC
connection is executed.
B. Keep an output ON for ten second as a NO connection and a
NC connection is executed.
Program 3:
A. Two inputs need to be true for a TON timer to be enabled.
Timer done bit will execute a double acting cylinder to move
forward. Another push button will cause it to move opposite.
A counter will count no of cycle of the double acting cylinder
and will execute a single acting cylinder move command after
five cycle.
B. Use RTO timer done bit and timing bit to move cylinders.
Describe the difference between RTO and TO timer.
Program 4:
Develop a complex program using several component of PLC which
you have learnt in this experiment.

MINI Prroject: MCT


T 3159
Design and
a Develop
pment of P,II,D based DC motor poosition contrrol
1. Objecttive:
1.
2.
3.
4.

To
T develop a model for position
p
contrrol for DC m
motor
To
T implemen
nt feedback control
c
for th
he DC motorr position coontrol in simuulation.
To
T implemen
nt op-amp baased DC mottor position ccontrol (clossed loop).
Compare
C
the performancee of the conttrol for P, PII and PID coontrol.

2. Review
w:
2.1. Mod
delling and Simulation
S
The plantt of DC motor is a good example
e
of a dynamic sysstem that inclludes both m
mechanical
dynamic due to inertia
a and viscous
s damping an
nd the electrrical dynamicc due conducctance and
or. The resultting model is
s a second orrder. The con
ntrol objectivves are to havve a
resistance of the moto
onse to a ste
ep input (i.e. speed
s
chang
ge or position
n change) witth small overrshoot and sm
mall
fast respo
steady-sttate error. Ex
xperiment 4 already
a
coverred the DC m
motor position
n control exp
periment for a
an
existing setup.
s
Fig. 1 (from experim
ment 4) show
ws electrical e
equivalent fo
or DC motor ssystem.

a (b) sketch of a DC mo
otor [1]
Figure 1: (a) Schemattic diagram and
em variables of a DC mottor include:
The syste
ea: armature drive potential
p
(V)
k EMF or cou
unter-electromotive-force (V)
eb: back
ia: arma
ature current (A)
T: torqu
ue produced by servomottor (Nm)
: angu
ular position of
o rotor (rad)
ddtsspeed of the
e rotor
: angular speed of rotor (rad/s)
sical parametters of the sy
ystem include
e:
The phys
Ra: arm
mature electric
c resistance ()

La : arm
mature electric
c inductance
e (H)
J: rotors moment off inertia (Nms
s2/rad)
b: damp
ping ratio (Nm
ms)
KT: torq
que constant (Nm/A)
Ke: back EMF consttant (Nm/A)
modeling and
d simulation o
of DC motor
Follow the procedure described in experiment 4 to do the m
c
The physical
p
para
ameters of th
he motor can be known w
when you purcchase the
position control.
compone
ents during ac
ctual implementation.
sical impleme
entation of the controller;
2.2. Phys
E
l setup:
a. Experimenta
sical setup fo
or DC motor position conttrol is describ
bed in Fig. 2.. You are
The approximate phys
t design you
ur system ac
ccordingly. Th
he potentiom
meter (feedba
ack sensor) iss connected to
required to
the motorr through gea
ar.

Fig 2: The
e physical se
etup for DC motor
m
position
n control.
S
Bufferring:
b. Signal
ple shows tha
at iA = 0 and vA = 0. Whicch gives from
m KVL (fig. 3)
Basic Op-AMP princip

And

oltage followe
er
Fig. 3: Vo

S
Subtra
action:
c. Signal

For the op
o amp, we see
s that vN vB , and thee current enteering the op amp inputs is zero.
From KC
CL we get (F
Fig.4)

Fig. 4: Sig
gnal subtracttion

at node vN:

------------------------------(1)

at node vB:

----------------------------------(2)

Assume

and realizing vN vB

Then

d. Signal
S
Gain and
a inversio
on:
uit in Fig. 5 sh
hows signal inversion and
d amplificatio
on.
The circu

Fig. 5: Inv
verting amplifier

This allows us to amp


plify the inp
put voltage by
b some gainn
A signal is inverted by
b setting thee gain equal to 1. If wee let

aabove then w
we get

This inveerts the sign of the input signal.


e. Derivative
D
by
y Op-Amp circuit:
c

Fig.6 : Op
p-amp based
d derivative circuit.
c

We have an op amp above


a
with negative
n
feed
dback in Figg. 6, so

es,
KCL and node vN give

Hence,

f. In
ntegration by
b Op-Amp
p circuit:

Fig.7 : Op
p-amp based
d integral circ
cuit.

KCL at node
n
vN givess (Fig. 7)

Hence,

g. Summing Am
mplifier:
Fig.8 sho
ows summing amplifier circuit.
c

Fig. 8: Su
umming amp
plifier
KCl at vN gives,

Realizing
g

h. PID
P Controller:
Fig. 9 sho
ows the com
mplete PID co
ontroller usiing differentt op-amp circcuits.

p-amp based PID controlller.


Fig.9: op
5

3. Conclusion:
In your PID controller you will start out by setting up two pots as voltage dividers; one to
represent the set point and the other to represent the process variable (this pot will be replaced by
actual pot geared with the motor as shown in Fig.2). The difference between the
voltage outputs will be the error. Therefore, when both pots are set to the same resistance the
two voltages will be the same, and there will be no error. You will also put buffer op amps in
front of the pots so that changing their resistances does not affect the voltages throughout the rest
of the controller.
Now that your controller is complete, you can hook it up to a motor and have it control a
physical system. However, the op amps you have been using are not designed to output large
currents. You will need to increase the current output of your controller using a power op amp
and a pot.

x: (PID Contro
oller)
Appendix

Vous aimerez peut-être aussi