NUST
School of Electrical Engineering and Computer Science
Faculty Member: Ma’am Neelma Naz Date: 24th FEBRUARY, 2022
Semester: 6th Section: BEE 12-C
Department of Electrical Engineering
EE-379: Control Systems
LAB 03: System Modeling
Pre-lab Lab Report Viva
Student Name Reg. No. Total /15
Marks /5 Marks /10 Marks /5
Saaram Ali 344924
Chaudhry
Amina Bashir 343489
Saad Bakhtiar 341150
EE-379: Control Systems, Lab Page1
03
1. Objectives:
• Learn the modeling of a DC motor using first principles.
• Given a set of differential equations that describe a system, learn how to create a model in Simulink.
• Given a set of differential equations describing a system, learn how to find the transfer function of the
system.
2. Introduction:
Modeling is the process of finding a mathematical model of a system. A mathematical model is a description
of a system and helps us to understand the behavior of that system.
Obtaining a model is usually the first step in controller design. In this handout we will see how we can derive
a model using first principles. First principles are the established physical laws, e.g. Kirchhoff’s voltage law,
Newton’s laws of motion, etc. Modeling based on first principles doesn’t involve the value of system
parameters like mass, spring constant etc.
These parameters should either be known or have to be estimated using system identification techniques.
Dynamical systems have some quantity that changes with time, and therefore the rate of change of that
quantity is often necessary to describe that dynamical system. For this reason, most of the dynamical systems
can be modeled with a set of differential equations. In this handout we will derive the model of a DC motor
using first principles and will see that it is also a set of differential equations.
In some cases, the model is provided by the system manufacturer/designer and we don’t have to find out the
differential equation ourselves. Once we have a set of differential equations, we will see how to represent
those differential equations (or the dynamical system) in Simulink. We will also learn how to find a transfer
function of a system from a set of differential equations.
Exercise 1
Using equations (9) and (10), make a model of the rotary inverted pendulum in Simulink.
EE-379: Control Systems, Lab Page2
03
For the parameters, use the values given in the table above, which are for the QNET inverted pendulum
available in our control laboratory.
Simulink Block Diagram
Parameter Initialization (Callbacks: InitFcn)
EE-379: Control Systems, Lab Page3
03
Exercise 2
Use the set differential equations and the Laplace transforms to find the following. transfer functions
(Perform this on paper and attach scans/photos in lab report).
1. Transfer function between the speed and voltage of the motor
EE-379: Control Systems, Lab Page4
03
2. Transfer function between the position and voltage of the motor
EE-379: Control Systems, Lab Page5
03
3. Transfer function between the position of the pendulum and voltage of the of
the attached motor
EE-379: Control Systems, Lab Page6
03
Exercise 3
Using the things you have learnt in lab 1, create all the transfer functions of Exercise 2 in MATLAB.
Code:
%Defining Model
Properties ng=1;
nm=0.69;
L=0.0955;
g=9.8;
Kt=0.0334;
R=8.7;
EE-379: Control Systems, Lab Page7
03
e=0.000271;
L=0.000001;
Jeq=0.00000184
; m=0.027;
r=0.0826;
Kg=1;
Jm=0.000180;
a=Jeq+m*r^2+ng*(Kg)^2*Jm;
b=m*L*r;
c=(4/3)*m*L^2;
d=m*g*L;
f=(nm*ng*Kt*Kg)/R;
%Transfer Function of Part
a numerator = [f];
doniminator = [a-c e -
d];
tf(numerator,doniminator
)
%Transfer Function of Part
b numerator = [f 0];
doniminator = [a-c e -d];
tf(numerator,doniminator)
%Transfer Function of Part
c numerator = [f*c 0 -f*d];
doniminator = [a*b-b*c e*b -b*d 0 0];
tf(numerator,doniminator)
EE-379: Control Systems, Lab Page8
03
Output
:
EE-379: Control Systems, Lab Page9
03
Exercise 4
Using the things you have learnt in lab 1, create all the transfer functions of Exercise
2 in Simulink using the Transfer function block.
Simulink Block Diagram (Pendulum Arm Angle)
Parameter Initialization (Callbacks: InitFcn)
10 | P a g e
Conclusion:
In this lab, we familiarized ourselves with the differential equations used for modelling
DC motor and a rotatory inverted pendulum, learned the modelling of a DC motor using
first principles and implemented these equations in Simulink. We also derived the transfer
function relating two physical variables of a system by hand and implemented those in
MATLAB and Simulink using the techniques we learned in the previous labs.
11 | P a g e