0% found this document useful (0 votes)
51 views

EEE 3106 Control Systems Lab Manual

The document describes modeling and simulating a DC motor system in Simulink. It discusses the dynamics and characteristics of a DC motor and how to represent it as a mathematical model. Simulation diagrams are shown to observe the motor's angular displacement, velocity and armature current responses under different input signals.
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)
51 views

EEE 3106 Control Systems Lab Manual

The document describes modeling and simulating a DC motor system in Simulink. It discusses the dynamics and characteristics of a DC motor and how to represent it as a mathematical model. Simulation diagrams are shown to observe the motor's angular displacement, velocity and armature current responses under different input signals.
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/ 36

Heaven’s Light is Our Guide

Rajshahi University of Engineering & Technology, Rajshahi-6204, Bangladesh.

Control Systems Lab Manual

Department of Electrical & Electronic Engineering, RUET.


Experiment 1
1.1 Experiment No.: 01
1.2 Experiment Name
To get familiar with Simulink

1.3 Objectives
 To gain basic knowledge about the Simulink platform.
 To know about the blocks associated with different operations on signals.
 To know how to use the basic functions related to control system.

1.4 Theory
Simulink is a graphical programming environment for modeling, simulating and
analyzing multi-domain dynamical systems. Before implementing a controller on a system, one
must have to analyze the particular system to find out which controller will be suitable for the
system. Simulation is performed on this purpose and to know about the characteristics
parameter of the system. To perform the simulation process, we need to use different
components based on our requirement which is available on Simulink library.

Fig.1.1. Outlook of Simulink library browser.


1.4.1 Blocks
The basic outlook of Simulink library browser is shown on Fig.1.1. A lot of components
is available on library and we need to choose those based on our system. Some commonly used
blocks are briefly described below-
1.4.1.1 Scope
Scope is used the observe the simulation output of a system. Out of the simulated system
is connected to the input port of the scope. If the simulation is performed correctly the scope
will show the graphical result. It’s just like the oscilloscope we use in our laboratory. The
diagram of scope is shown on Fig.1.2.

Fig.1.2. Simulink block diagram of scope.


1.4.1.2 Sources
Different types of input such as sinusoidal, step, triangular etc. may be applied to a system
which are available in library browser on the folder named “sources”.

Fig.1.3. Sources available in library.


From Fig.1.3. a lot of sources is seen and we need to choose those according to the input
of the system.
1.4.1.3 Sum/Subtract
This block is used to perform summation or subtraction of two or more signals. The block
is available on “Math Operations”. Also it is available on commonly used blocks.

Fig. 1.4. Simulink block representation of adder, subtractor and summer.


1.4.1.4 Product/Divide
This block is used to perform summation or subtraction of two or more signals. The block
is available on “Math Operations”. Also it is available on commonly used blocks.

Fig. 1.5. Simulink block representation of product and divider.


1.4.1.5 Mux/Demux
Mux Combines input signals of same data type and numeric type into virtual vector. We
can easily compare two signals using Mux. It has usually two input ports which we can increase
as per our system requirements and one output port which is connected to the scope. Block
diagram of mux and demux is shown on Fig. 1.6. Demux performs opposite functions of mux.
Both are available on commonly used blocks.

Fig.1.5. Simulink block representation of mux and demux.

1.4.1.6 Gain
When using waveform function generation channels, Gain represents the value by which
the scaled waveform data is multiplied to get the output data. It is available on commonly used
blocks.
Fig. 1.6. Simulink block representation of gain.
1.4.1.7 Integrator
While dealing with the dyna\mics of a system necessity of integrator arises. It is available
in “Continuous” block.

Fig. 1.7. Simulink block representation of integrator.


1.4.1.8 State-space and Transfer function
State-space is the time domain representation of the dynamic equations of a system and
transfer function is the frequency domain representation of a system. Both are the essential part
for controlling purpose of a system. Both are available in the library in “Continuous” block.

Fig.1.8. Simulink block representation of state-space and transfer function.


1.4.2 Basic operations on signals in Simulink platform
1.4.2.1 Plotting a sine wave
Simulink block diagram for the purpose is given below:

Fig.1.9.1. Simulink diagram for plotting a sine wave.


Fig.1.9.2. Simulation output of Fig.1.9.1.

1.4.2.2 Addition of three sine wave of amplitude 5, 10 and 15 respectively

Fig. 1.10.1. Simulink diagram for adding three signals.


Fig.1.10.2. Simulation output of Fig.1.10.1.

1.4.2.3 Subtraction of two sine waves of amplitude 10 and 5 respectively

Fig. 1.11.1. Simulink diagram for subtracting two signals.


Fig.1.11.2. Simulation output of Fig.1.11.1

1.4.2.4 Product of three sine waves of amplitude 3, 2 and 5 respectively

Fig.1.12.1. Simulink diagram for multiplying three signals.


Fig.1.12.2. Simulation output of Fig.1.12.1.

1.4.2.5 Use of Mux

Fig.1.13.1. Simulink diagram for comparing three signals using Mux.


Fig.1.13.2. Simulation output of Fig.1.13.1.

1.4.2.6 Defining Transfer function in MATLAB/Simulink


We can define transfer function in m file or using block in Simulink. Let the transfer
function of a system be
𝑠+1
𝐺 (𝑠 ) =
𝑠2 + 2𝑠 + 3
To represent this system in m file the required code is
clc
clear all
numerator=[1 1];
denominator=[1 2 3];
system=tf(num,den);

The respective output is


system =
s+1
-------------
s^2 + 2 s + 3

Continuous-time transfer function.


In Simulink we need to take the Transfer function block from the library browser and need to
define the numerator and denominator according to the system requirement.

1.5 Discussion and conclusion


Write down the observation based on this experiment.
Experiment 2
2.1 Experiment No.: 02
2.2 Experiment Name
Modeling of a physical system using Simulink

2.3 Objectives
 To know about the dynamics of a physical system.
 To know how to model a physical system in Simulink platform.
 To observe different behavior such as displacement, velocity, acceleration etc. of a
system if any source of excitation is applied to the system.

2.4 Theory
Systems involved in our day to day life can be considered as physical systems such as
driving a car, pulling a block, mass spring system etc. Here a mass spring system is considered
to carry out the experiment.
The physical model is represented on Fig.2.1.

Fig.2.1. Physical representation of a mass spring system.


where
M=Mass,
B=Damping coefficient,
K=Spring compliance,
u(t)=Force &
y=Displacement.
The mathematical modeling of the system is given below-
𝑀𝑦̈ + 𝐵𝑦̇ + 𝑘𝑦 = 𝑢(𝑡)
1 𝐵 𝑘
or, 𝑦̈ = 𝑀 𝑢(𝑡) − 𝑀 𝑦̇ − 𝑀 𝑦

2.5 Simulation diagram and output


M-file for the parameter values
clc
clear all
M=2;
k=16;
B=4;

Fig. 2.2. Simulation diagram of a mass spring system.


Here mux has been used to compare the reference signal and the respective output response.
Fig. 2.3. Displacement of mass spring system to step input.

Fig. 2.4. Velocity of mass spring system to step input.


Fig. 2.5. Acceleration of mass spring system to step input.

2.6 Conclusion and discussion:


Write down the observation based on this experiment.
Experiment 3
3.1 Experiment No.: 03
3.2 Experiment Name
Analysis of the characteristics of DC motor in Simulink platform

3.3 Objectives
 To know about the dynamics and characteristics of a DC motor.
 To know how to model a DC motor in Simulink platform.
 To observe different behavior such as angular displacement, angular velocity, armature
current etc. of a DC motor if any source of excitation is applied to the motor.

3.4 Theory
DC motor which operates on the basis of the motor action i.e. a current carrying conductor
in presence of a magnetic field has a force induced on it, converts the dc electrical energy into
mechanical energy. The DC motor consists of two parts among which one is static and another
one is rotating part. Static part consists of field winding and rotating part consists of rotor
winding known as armature. Field winding is excited by DC source and DC voltage is supplied
to armature through brush. Starter is used as the resistance of the dc motor is very low since
there is no back emf at the starting. The general circuit diagram of a dc motor is shown below:

Fig.3.1. Circuit Diagram of a DC motor.


where,
J=Inertia,
B=Friction,

ω =Angular velocity,
Vi=Input voltage,
Vb=Back emf and
ia=Armature current.
The governing equations of a DC motor is as follow
𝑑𝑖𝑎 𝑉𝑖 𝑅𝑖 ω
= - - Kb …….......................................................(1)
𝑑𝑡 𝐿 𝐿 𝐿
𝑑ω 𝐾𝑡 𝐵ω
= ia - ..............................................................(2)
𝑑𝑡 𝐽 𝐽
𝑑𝜗
= ω ...............................................................(3)
𝑑𝑡

3.5 Simulation diagram and output


Required M-file to simulate:
clc
clear
R=7.94;
Kb=39.3*10^-3;
B=15*10^-6;
L=0.154;
j=40*10^-7;
Kt=0.0393;

Fig.3.2. Simulation diagram of a DC motor.


Fig. 3.3. Angular velocity of a DC motor to a unit step input.

Fig.3.4. Angular displacement of a DC motor to a unit step input.


Fig.3.5. Armature Current of a DC motor to a unit step input.

3.6 Discussion and conclusion


Write down the observation based on this experiment.
Experiment 4
4.1 Experiment No.: 04
4.2 Experiment Name
Speed control of a DC motor by using PID Controller

4.3 Objectives
 To know about the dynamics and characteristics of a DC motor.
 To know how to model a DC motor in Simulink platform.
 To observe different behavior such as angular displacement, angular velocity, armature
current etc. of a DC motor if any source of excitation is applied to the motor.
 To know about the basic knowledge about PID controller.
 To know how to implement a PID controller on a closed loop system.
 To compare between the controlled and uncontrolled response on the system

4.4 Theory
DC motor which operates on the basis of the motor action i.e. a current carrying conductor
in presence of a magnetic field has a force induced on it, converts the dc electrical energy into
mechanical energy. The DC motor consists of two parts among which one is static and another
one is rotating part. Static part consists of field winding and rotating part consists of rotor
winding known as armature. Field winding is excited by DC source and DC voltage is supplied
to armature through brush. Starter is used as the resistance of the dc motor is very low since
there is no back emf at the starting. The general circuit diagram of a dc motor is shown below:

Fig.3.1. Circuit Diagram of a DC motor.


where,
J=Inertia,
B=Friction,
ω =Angular velocity,
Vi=Input voltage,
Vb=Back emf and
ia=Armature current.
The governing equations of a DC motor is as follow
𝑑𝑖𝑎 𝑉𝑖 𝑅𝑖 ω
=𝐿 - - Kb …….......................................................(1)
𝑑𝑡 𝐿 𝐿
𝑑ω 𝐾𝑡 𝐵ω
= ia - ..............................................................(2)
𝑑𝑡 𝐽 𝐽
𝑑𝜗
=ω ...............................................................(3)
𝑑𝑡

A proportional–integral–derivative controller (PID controller or three term controller) is


a control loop feedback mechanism widely used in industrial control systems and a variety of
other applications requiring continuously modulated control. A PID controller continuously
calculates an error value ,e(t) which is the difference between a desired set point and a measured
process variable and applies a correction based on proportional, integral, and derivative terms
(denoted P, I, and D respectively) which give their name to the controller.

In practical terms it automatically applies accurate and responsive correction to a control


function. The PID algorithm restores the actual speed to the desired speed in the optimum way,
without delay or overshoot, by controlling the power output of the vehicle's engine.
Basic state-space representation of a system is as follows
𝑥̇ = 𝐴𝑥 + 𝐵𝑢
𝑦 = 𝐶𝑥 + 𝐷𝑢

where
A=System Matrix,
B=Input Matrix,
C=Output Matrix,
D=Direct Feedthrough Matrix.
Now for a DC motor

For the PID controller we can write


𝑑𝑒(𝑡)
𝑢(𝑡 ) = 𝑘𝑝 + 𝑘𝑖 ∫ 𝑒 (𝑡 )𝑑𝑡 + 𝑘𝑑
𝑑𝑡
𝑈(𝑠) 𝑘𝑖
or, = 𝑘𝑝 + + 𝑠𝑘𝑑
𝐸(𝑠) 𝑠

where, kp = Proportional gain, ki=Integral gain and kd=Derivative gain.


4.5 Simulation diagram and output
Required M-file to make plot:
clc
clear all
R=7.94;
Kb=39.3*10^-3;
B=15*10^-6;
L=0.154;
j=40*10^-7;
Kt=0.0393;
A=[-R/L -Kb/L 0,Kt/j -B/j 0,0 1 0];
B=[1/L,0,0];
C=[0 1 0];
D=0;

Fig.4.2. Comparison of angular velocity with open-loop and closed loop control using PID on
a DC motor.
Fig.4.3. Comparison of angular velocity response of DC motor using PID and open-loop
response.

4.6 Discussion and Conclusion


Write down the observation based on this experiment.

Homework
i. Check the system response using PI, PD and ID controller and observe the changes in
the response.
ii. Control the speed of DC motor using Transfer Function approach.
iii. Control the displacement of a mass-spring system using PID controller.

***Perform the above home tasks on the next day in your laboratory.
Experiment 5
5.1 Experiment No.: 05
5.2 Experiment Name
Formation of transfer function, domain conversion and block diagram reduction

5.3 Objectives
 To know how to represent a system in time domain and frequency domain approach.
 To convert a system from time domain to frequency domain and vice-versa.
 To reduce the block diagram of a system connecting in cascade, parallel and feedback.

5.4 Theory
Transfer function of a linier, time-invariant system is defined as the ratio of the Laplace
transform of the output to the Laplace transform of the input under the assumption that all
initial condition are zero.
𝐿[𝑂𝑢𝑡𝑝𝑢𝑡] 𝑌(𝑠)
Transfer function=G(s)= = .
𝐿[𝐼𝑛𝑝𝑢𝑡] 𝑋(𝑠)

By using this concept of transfer function, it is possible to represent system dynamics


by algebraic equations in s domain or frequency domain.
The n-dimensional space whose coordinate axes consist of the x1 axis, x2 axis, x3 axis, -
- - - - -, xn axis, where x1, x2, - - - -,xn are state variable, is called a state space. Any state can
be represented by a point in the state space. Basic state-space representation of a system is as
follows
𝑥̇ = 𝐴𝑥 + 𝐵𝑢
𝑦 = 𝐶𝑥 + 𝐷𝑢
where
A=System Matrix,
B=Input Matrix,
C=Output Matrix,
D=Direct Feedthrough Matrix.
State-state is the time domain representation of a system. It is possible to convert the
transfer function approach into state-space approach using proper MATLAB command.
Block diagram of a system is a pictorial representation of the functions performed by
each component and of the flow of signals.

Input Transfer Function, G(s) Output


In the Figure, transfer function is an element of the block diagram. The arrowhead
pointing toward the block diagram indicating the input, and the arrowhead leading away from
the block represents the output.
Now we will discuss some block diagram connection type.
1. Summing point: A circle with cross symbol that indicating summing point.
2. Branch point: A branch point is a point from which the signal from a block goes to the
other blocks.

Summing point Branch Point

Input G(s) Output

Fig.5.1. Block diagram representation of a closed loop system.


5.4.1 Cascade, Parallel and Feedback block

Input G1(s) G2(s) Output

Fig.5.2. Cascade block representation.

G1(S)

Input
Output

G
G2(S)

Fig.5.3. Parallel block representation.

Input G(s) Output

Fig.5.4. Feedback block representation.


5.5 MATLAB operations
5.5.1 Formation of transfer function
clc
clear
num1=[1]
den1=[1 0.5 1 0]
sys=tf(num1,den1)
Output in the command window:
num1 =
1
den1 =
1.0000 0.5000 1.0000 0
sys =
1
-----------------
s^3 + 0.5 s^2 + s
Continuous-time transfer function.
5.5.2 Formation of state-space
clc
clear
A=[1 2;3 4];
B=[0;1];
C=[1 0];
D=0;
sys=ss(A,B,C,D)
Output in the command window:
sys =
A=
x1 x2
x1 1 2
x2 3 4

B=
u1
x1 0
x2 1
C=
x1 x2
y1 1 0

D=
u1
y1 0

5.5.3 Domain Conversion


5.5.3.1 State-space to transfer function
clc
clear
A=[1 2;3 4];
B=[0;1];
C=[1 0];
D=[0];
[num,den]=ss2tf(A,B,C,D)

Output in the command window:


num =
0 0 2
den =
1.0000 -5.0000 -2.0000
5.5.3.2 Transfer function to state space
clc
clear
num=[1];
den=[1 0.5 1 0];
[A,B,C,D]=tf2ss(num,den)

Output in the command window:


A=
-0.5000 -1.0000 0
1.0000 0 0
0 1.0000 0
B=
1
0
0
C=
0 0 1
D=
0
5.5.4 Block Diagram Reduction
clc
clear
num1=[1 1]
den1=[1 2]
num2=[0 1]
den2=[500 0 0]
sys1=tf(num1,den1)
sys2=tf(num2,den2)
sys3=series(sys1,sys2)
sys4=parallel(sys1,sys2)
sys5=feedback(sys1,sys2)

Output in the command window:

num1 =

1 1

den1 =

1 2

num2 =

0 1

den2 =

500 0 0
sys1 =

s+1
-----
s+2

Continuous-time transfer function.

sys2 =

1
-------
500 s^2

Continuous-time transfer function.

sys3 =

s+1
------------------
500 s^3 + 1000 s^2

Continuous-time transfer function.

sys4 =

500 s^3 + 500 s^2 + s + 2


-------------------------
500 s^3 + 1000 s^2

Continuous-time transfer function.

sys5 =

500 s^3 + 500 s^2


--------------------------
500 s^3 + 1000 s^2 + s + 1

Continuous-time transfer function.

5.6 Discussion and Conclusion


Write down the observation based on this experiment.
Experiment 6
6.1 Experiment No.: 06
6.2 Experiment Name
Frequency response analysis using
a) Bode plot and b) Root locus

6.3 Objectives
 To know about frequency response analysis.
 To know how to plot a bode plot and root locus in MATLAB/Simulink.

6.4 Theory
A Bode diagram consists of two graphs. One is a plot of the logarithm of the magnitude
of a sinusoidal transfer function and the other is a plot of the phase angle; both are plotted
against the frequency on a logarithmic scale. The standard representation of the logarithmic
magnitude of G(jω) is 20log|G(jω)|.
Under this Bode plot,
Condition 1: Phase Margin=+ve, Gain Margin=+ve ,

Gain crossover frequency, ωcg < phase crossover frequency ωcp


The system is said to be stable.

Condition 2: Phase Margin=0, Gain Margin=0 ,

Gain crossover frequency, ωcg = phase crossover frequency ωcp


The system is said to be marginally stable.

Condition 3: Phase Margin=-ve, Gain Margin=-ve ,

Gain crossover frequency, ωcg > phase crossover frequency ωcp


The system is said to be unstable.
Matlab Code:
1. Bode plot

i) Input:
clc
clear all;
n1=[50]
d1=[1 3 2]
sys1=tf(n1,d1)
bode(n1,d1)

Output:
n1 =

50

d1 =

1 3 2

sys1 =

50

-------------

s^2 + 3 s + 2

Continuous-time transfer function.


Bode plot figure:

ii) Input:
clc
clear all;
n1=[1]
d1=[1 -2 -3]
sys1=tf(n1,d1)
bode(n1,d1)

Output:

n1 =

d1 =

1 -2 -3

sys1 =

1
-------------
s^2 - 2 s - 3
Continuous-time transfer function.
Bode plot figure:

2. Root locus

i) Input:
clc
clear all;
n1=[1]
d1=[1 -2 -3]
sys1=tf(n1,d1)
rlocus(n1,d1)

Output:
n1 =

d1 =

1 -2 -3

sys1 =

-------------

s^2 - 2 s - 3

Continuous-time transfer function.


Root locus figure:

ii) Input:
clc
clear all;
n1=[50]
d1=[1 3 2]
sys1=tf(n1,d1)
rlocus(n1,d1)

Output:
n1 =

50

d1 =

1 3 2

sys1 =

50

-------------

s^2 + 3 s + 2

Continuous-time transfer function.


Root locus figure:

6.5 Discussion and Conclusion


Write down the observation based on this experiment.

You might also like