You are on page 1of 40

Mohammad Ali Jinnah University, Islamabad.

Control Systems Lab


Course Code: EE3811


LAB # 1:

BASIC PROGRAMMING FOR MATLAB


Nameofstudent:..

RollNo:....

DateofLAB:

Reportsubmittedon:....

Section:....


Marksobtained:




Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
2
LAB # 1

FOR MATLAB COURSE WORK

Question no 1.
A Linear System

a) A network structure of the form shown below is employed in a Neural
Network architecture of ADALINE (Adaptive Linear Combiner).




w1
U1

w2 Y1
U2

w3
U3


As shown, inputs from three different sensors are applied to the weights
of the network and after being multiplied by the corresponding weights the
inputs are summed together to produce the corresponding output Y. The
system is described by the following set of linear equations
Y=w1 *U1 + w2*U2 + w3*U3
Where the data set is as shown in the table below

U1 U2 U3 Y
2 3 4 6
1 2 3 8
5 6 4 9


Define a data matrix using the data given above and form a simple set of linear
equations of the form

U*w=Y

Where U, w and Y are matrices.

b) Solve the set of linear equations by employing the inverse of U and using
the Cramer Rule to find out the solution set for w (weights of the net) .
w
+
Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
3

Cramers rule:
For a 2 dimensional problem if a1 and a2 are the columns of matrix A
Then A=[a1 a2] and if
Ax=b
Then x1=det ([b a2])/det (A)
And x2=det ([a1 b])/det (A)

c) Solve the same problem for an extended network involving 4 weights. The data
set is given below

U1 U2 U3 U4 Y
2 3 4 1 6
1 2 3 2 7
5 4 4 1 8
3 5 4 2 9


Question no 2


INTELLIGENT CRICKET SCORECARD


This is an exercise in matrix manipulation. Suppose that two teams A and B
score the following runs in a game of ten over. Below the number of runs scored
and no of wickets fallen in each over are displayed.

TEAM A
Runs : 8 6 9 0 11 13 6 0 10 3
Wickets : 1 0 2 0 0 0 1 0 0 0

TEAM B
Runs : 9 5 3 0 0 8 13 15 9 0
Wickets : 1 1 0 0 0 0 1 2 0 0

These are to be declared as two 2 x 10 matrices in MATLAB. Write a routine that
takes these matrices as input and generates an intelligent score card for both the
teams considering that team A played first.







Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
4
TEAM X

Over
No
Runs in
this over
Total
score
Run
average
Wickets in
this over
Total no of
wickets
Run rate
required to
win
1
2
3
4
5
6
7
8
9
10

This table should be returned in the form of a MATRIX for team A and B both. Of
course the last column in the table would hold true only for team playing second.



























Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
5
Mohammad Ali Jinnah University, Islamabad
Control Systems Lab
Course Code: EE3811



LAB # 2

Introduction to Control Systems and MATLAB


Nameofstudent:..

RollNo:....

DateofLAB:

Reportsubmittedon:....

Section:....


Marksobtained:

Control System Lab.


Mohammad Ali Jinnah University,
Islamabad.
6
LAB # 2

Objectives:

1. Introduction to Control Systems Analysis.
2. Introduction to Matlab/Simulink.
3. Example: Inverted Pendulum



Introduction to Control Systems:
Suppose a slave who used to fan his
master using some kind of a cloth and he does this all day long. To make his life easy,
fans were introduced. To this Modern day, different types of engineering techniques
are being put together to make the life easy for a normal man. Control systems is just
one and the most important of these fields.
Whenever the name of Control systems is taken, it always comes with the name
of Control Systems Analysis. It basically analyses the system parameters like velocity,
temperature, mass, damping ratio, etc which are necessary for its quality output.
Using these parameters one can judge its real life state and then implement it.
WWII accelerated the development of classical control theory and practice.
Heavy guns had to be rapidly and accurately positioned. Precise navigation and target
tracking were increasingly important, and aircraft performance was improved greatly
with the incorporation of complex control systems to aid the pilot.
Today, control systems are pervasive in industry and in our everyday lives. They
range from governmental regulation (such as that governing monetary policy) to
automated and highly flexible manufacturing plants to sophisticated automobiles,
household appliances, and entertainment systems. It is our purpose to learn to design
control systems for a wide variety of applications.

Control systems in Human body:

Human body contains various control mechanism like the balancing mechanism
is carried out by gyros in our ear, all the six senses are very good example of control
systems as they are giving feedback required by the body to function accurately, if any
one of our senses gets disturbed we can our self feel the malfunctioning of our body
like this example, Just stand with your feet one in front of other and place your hands
on your back and make sure your eyes are open. After you are in the desired position
close your eyes, you will notice the importance of feedback control systems.





Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
7
Introduction to Simulink:
SIMULINK is a program for simulating dynamic
systems. As an extension to MATLAB, SIMULINK adds many features specific to
dynamic systems while retaining all of MATLABs general-purpose functionality.
SIMULINK has two phases of use: model definition and model analysis. A typical
session starts by either defining a model or retrieving a previously defined model, and
then proceeds to analysis of that model. These two steps are often performed
iteratively until the model achieves the desired behavior.
To facilitate model definition, SIMULINK adds a new class of windows called block
diagram windows. In these windows, models are created and edited principally by
mouse driven commands. Part of mastering SIMULINK is to become familiar with the
manipulation of model components within these windows. After you define a model,
you can analyze it either by choosing options from the SIMULINK menus or by entering
commands in MATLABs command window.

Constructing a Simple Model:
At the MATLAB prompt type >>simulink. This
command displays a new window containing icons for the subsystem blocks that make
up the standard library. These subsystems can be opened (by double-clicking) to
produce the windows containing the prototype blocks to be copied into your models.
Click on File and New, and then move the window to a comfortable position.



Open Sources, Sinks, Continuous, and Connectionsby double-clicking on the icon
with the left mouse button. Move the windows to a comfortable position. Blocks can be copied
from one window to another by dragging them from the original location to the new location by
holding down the left mouse button. Assemble the following diagram in your working window.
[e.g. Step Input -> Sources; Sum ->Math operations, Transfer Fcn -> Continuous; Scope ->
Sinks ]

Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
8































Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
9



(1) Enlarge the blocks, arrange into order, and wire them together as shown. Blocks
are expanded by dragging the corner indicators outward with the mouse. To wire a
block, drag the blocks output arrow to the input arrow of the next icon using the left
mouse button.
(2) Double click on the Transfer Function block and change the coefficients.
(3) Click on File, then Save and name your model.
(4) Click on Simulation, then Parameters and set these according to your need.
(5) Click on Simulation, then Start and observe the trace on the scope.

http://www.mathworks.com/access/helpdesk/help/toolbox/simulink/

a good link for the tutorials related to simulink.

Demo Simulink:




Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
10
The above two figures shows Simulation 1 and Simulation 2 for the same system.

Simulation 1:
The system
which is usually
represented by G is
shown as Integrator. Input
to this system is a step
function. In response to
this input, the integrators
output will be a Ramp.
Another block, Gain, is
attached in between the
input and system. This
gain will affect the output.
Higher the value of this
gain, more rapid will be the
slope.





Simulation 2:

An advantage associated
with this system is that it
has faster response. As
can be seen from the
graph that the output is
achieved in a less time
due to faster response.










Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
Inverted Pendulum:
An inverted pendulum is a physical device consisting in a
cylindrical bar (usually of aluminum) free to oscillate around a fixed pivot. The pivot is
mounted on a carriage, which in its turn can move on a horizontal direction. The
carriage is driven by a motor, which can exert on it a variable force. The bar would
naturally tend to fall down from the top vertical position, which is a position of
equilibrium. The goal of the LAB
position.
This is possible by exerting a force on the carriage through the motor, which tends to
contrast the 'free' pendulum dynamics. The correct force has to be calculated
measuring the instant values of the horizontal position and the pendulum angle.



Why it is used? The inverted pendulum is a traditional example (neither difficult nor
trivial) of a controlled system. Thus it is used in simulations and
performance of different controllers (e.g. PID controllers, state space controllers, fuzzy
controllers....).






Command To Open Inverted Pendulum In MATLAB:

On the Matlab Command Window, write penddemo.

An inverted pendulum is a physical device consisting in a
bar (usually of aluminum) free to oscillate around a fixed pivot. The pivot is
mounted on a carriage, which in its turn can move on a horizontal direction. The
tor, which can exert on it a variable force. The bar would
naturally tend to fall down from the top vertical position, which is a position of
LAB is to stabilize the pendulum (bar) on the top vertical
s possible by exerting a force on the carriage through the motor, which tends to
contrast the 'free' pendulum dynamics. The correct force has to be calculated
measuring the instant values of the horizontal position and the pendulum angle.
The inverted pendulum is a traditional example (neither difficult nor
trivial) of a controlled system. Thus it is used in simulations and LABs to show the
performance of different controllers (e.g. PID controllers, state space controllers, fuzzy

Command To Open Inverted Pendulum In MATLAB:
On the Matlab Command Window, write penddemo.
11
An inverted pendulum is a physical device consisting in a
bar (usually of aluminum) free to oscillate around a fixed pivot. The pivot is
mounted on a carriage, which in its turn can move on a horizontal direction. The
tor, which can exert on it a variable force. The bar would
naturally tend to fall down from the top vertical position, which is a position of unsteady
is to stabilize the pendulum (bar) on the top vertical
s possible by exerting a force on the carriage through the motor, which tends to
contrast the 'free' pendulum dynamics. The correct force has to be calculated
measuring the instant values of the horizontal position and the pendulum angle.
The inverted pendulum is a traditional example (neither difficult nor
s to show the
performance of different controllers (e.g. PID controllers, state space controllers, fuzzy
Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
12
Inverted Pendulum example using Simulink:



Figure 1
Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
13
Understanding Simulation:

1. Open the Lab1 simulation.
2. Identify different blocks.
3. Identify the basic feedback block diagram from figure 1 as given below.

Controller System
Sum

4. Double click on the inverted pendulum subsystem and identify the different
blocks in it.
________________________________________________________________
________________________________________________________________
_________________________________________________

5. Comment about each block you have identified in step 4.
________________________________________________________________
________________________________________________________________
_________________________________________________

6. Double click on the Controller block and identify different blocks present there,
commenting about each one.
________________________________________________________________
________________________________________________________________
_________________________________________________

7. Now start simulation by pressing the play button located in the toolbar.
8. An output window will appear showing the inverted pendulum, positioned with
respect to the slider given underneath.
9. Change the position of the slider to answer these questions:
o Does the triangle move when the position of the slider is changed?
________________________________________________________________
________________________________________________________________
_________________________________________________

o Is there any difference between the triangle and the pendulum?
________________________________________________________________
________________________________________________________________
_________________________________________________

Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
14
10. What is the value of error in the steady state?
________________________________________________________________
________________________________________________________________
_________________________________________________

11. Note down the value of K in the controller block.
________________________________________________________________
________________________________________________________________
_________________________________________________

12. Stop simulation now.
13. Change the values of K and K
i
in the controller block to zero.
14. Again start the simulation and note the changes you see.
________________________________________________________________
________________________________________________________________
_________________________________________________

15. Do you see some error, what is the value of error now?
________________________________________________________________
________________________________________________________________
_________________________________________________

16. Now give different values of the K and K
i
, and make a table of it, listing the
corresponding steady-state error.

K K
i
Steady-State Error




17. Explain how you felt when you performed the LAB explained in control system in
human body?
________________________________________________________________
________________________________________________________________
________________________________________________________________
____________________________________________





Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
15
ASSIGNMENT




QUESTION:

Write down note (not more than 10 lines strictly) on the following topics:

Matlab and its Capabilities.
Role of Matlab in Control Systems.































Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
16
Mohammad Ali Jinnah University, Islamabad
Control Systems Lab.
Course Code: EE 3813



LAB # 3

Modeling in Simulink using some basic examples



Nameofstudent:..

RollNo:....

DateofLAB:

Reportsubmittedon:....

Section:....


Marksobtained:



Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.

Objectives:

1. Simulating a Cruise Control Model in Simulink.
2. Modeling in Simulink.
3. Exercise: Suspension Model.


Cruise Control Model:
Following is the equation of motion for an automobile.

v + &
Using this differential equation, we can find the transfer function of this cruise control.

s U
s V
=
) (
) (

Now implement this transfer function using simulink and analyze its output. Use the
values of m = 1580 kg, and b = 26 N.sec/m
period of time. Its output will be quite similar to a car whose driver accelerates it for
instance and then leaves the car to decelerate at its own speed.
Also make use of the differential equation to make a second model of the same system
using simulink. Compare the output of both the systems now. It should be same.


















LAB # 3
Simulating a Cruise Control Model in Simulink.
Exercise: Suspension Model.
Following is the equation of motion for an automobile.
m
u
v
m
b
=

Using this differential equation, we can find the transfer function of this cruise control.
m
b
m
s +
1

Now implement this transfer function using simulink and analyze its output. Use the
b = 26 N.sec/m. Remember to give the input for a small
period of time. Its output will be quite similar to a car whose driver accelerates it for
instance and then leaves the car to decelerate at its own speed.
Also make use of the differential equation to make a second model of the same system
using simulink. Compare the output of both the systems now. It should be same.
17
Following is the equation of motion for an automobile.
Using this differential equation, we can find the transfer function of this cruise control.
Now implement this transfer function using simulink and analyze its output. Use the
. Remember to give the input for a small
period of time. Its output will be quite similar to a car whose driver accelerates it for an
Also make use of the differential equation to make a second model of the same system
using simulink. Compare the output of both the systems now. It should be same.
Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
18
Modeling in Simulink:


1. Open simulink by clicking on its icon on the toolbar or either typing in command
window simulink.
2. Library browser will open in front of the Matlab.
3. You can see different libraries contained in the library browser.
4. Each library contains its own specific components related to the subject.
5. Only practice can make you sharp in searching different components in different
libraries.
6. Now we consider modeling of cruise control in simulink.
7. Click on the Simulink library to open its sub-libraries.
8. Select the required components from this sub-library.
9. Click new file to work on it.
10. Using left click and drag from mouse, place the components in the blank
window.
11. Connect all the components now.
12. Double click on the blocks one by one and change their parameters as defined
by the user.
13. Save the simulation.
14. Now run the simulation by clicking on the play button in the toolbox.
15. Output of the system can be seen by double clicking the scope (if any).
16. Check if it is the required output or not.
17. If it is not the required output, stop the simulation and change the parameters.
18. Simulation can be stopped or paused by clicking on the stop or pause button in
the toolbox.
19. Parameters cannot be changed while simulation.


















Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
19
Location of Different Important Blocks:

Simulink > Continuous > Integrator.
Simulink > Continuous > Transfer Function.
Simulink > Continuous > Differentiator.
Simulink > Math Operations > Absolute.
Simulink > Math Operations > Gain.
Simulink > Math Operations > Slider Gain.
Simulink > Math Operations > Sum.
Simulink > Signal Routing > Demultiplexer.
Simulink > Signal Routing > Multiplexer.
Simulink > Sinks > Display.
Simulink > Sinks > Scope.
Simulink > Sources > Clock.
Simulink > Sources > Pulse Generator.
Simulink > Sources > Ramp.
Simulink > Sources > Signal Generator.
Simulink > Sources > Signal Builder.
Simulink > Sources > Sine Wave.
Simulink > Sources > Step Signal.


Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
Modeling a Toy train system:


Following are the differential equations
one cart.

x x M
M
k
k F x
& &
& &
2 2
1
( =
=

Which can be re-arranged as:

( ) (
) ( ) (
2
2
2
1
2
1
k s
s F s
X X s M
X s M
=
=

Relating both the equations, use simulink to draw the desired mathematical model.
Input to the system is r and output should be y, to fulfill the transfer function given as:

Use the following values:

M
1
=10 kg
M
2
=5 kg
g=9.8 m/sec
2

=0.002 N.m/sec
k=10









Exercise

Modeling a Toy train system:

Following are the differential equations for the toy train moving in one direction with
x M x x
x M x x
g
g k
&
&
2 2 2 1
1 1 2 1
)
) (





) ( )) ( ) (
( )) ( ) ( ( )
2 2 2 1
1 1 2 1
s gs s s
gs s s k
X M X X
X M X X




Relating both the equations, use simulink to draw the desired mathematical model.
system is r and output should be y, to fulfill the transfer function given as:
20

for the toy train moving in one direction with
) (s

Relating both the equations, use simulink to draw the desired mathematical model.
system is r and output should be y, to fulfill the transfer function given as:

Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
21
ASSIGNMENT

Attach all the code and the solution of all the tasks done in the lab.

QUESTION:

Read about the following topics and write brief detail about them along with the
examples?

State Space Model
Transfer Function with example
Simulink
































Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
22
Mohammad Ali Jinnah University, Islamabad
Control Systems Lab
Course Code: EE 3813

LAB # 4

Modeling of DC Motor in Simulink



Nameofstudent:..

RollNo:....

DateofLAB:

Reportsubmittedon:....

Section:....


Marksobtained:



Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
23
LAB # 4

Objectives:

1. Modeling of DC Motor.
2. Modeling of DC Motor in Simulink.
3. Exercise: Suspension Model.

DC Motor Model:

Physical setup:
A common actuator in control systems is the DC motor. It directly provides rotary
motion and, coupled with wheels or drums and cables, can provide transitional motion.
The electric circuit of the armature and the free body diagram of the rotor are shown in
the
following
figure:










For this example, we will assume the following values for the physical parameters.
* Moment of inertia of the rotor (J) = 1.16E-006 kg.m^2/s^2
* Damping ratio of the mechanical system (b) = 0.1 Nms
* Electromotive force constant (K=Ke=Kt) = 0.01 Nm/Amp
* Electric resistance (R) = 10.6 ohm
* Electric inductance (L) = 0.8m H
* Input (V): Source Voltage
* Output (theta): position of shaft
* The rotor and shaft are assumed to be rigid.

Main Figure:
Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.

Answer the following Question:

Q1) The Equation of Magnetic Force on current






Q2) The Equation of the Torque about the shaft caused by the single wire in the
motor at the distance r:







Q3) The equation for the following rotary mechanical system:


System Dynamics:





System Transfer Function:








Answer the following Question:
The Equation of Magnetic Force on current-carrying conductor:
The Equation of the Torque about the shaft caused by the single wire in the
equation for the following rotary mechanical system:

System Transfer Function:
24
The Equation of the Torque about the shaft caused by the single wire in the
Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
25
Q4) The equation of the armature circuit by using Kirchhoffs voltage law:

In Time Domain:






In Laplace Domain:







Q5) The motor electrical time constant
c
:





Q6) The equation of torque in term of mature current i
a:





Q7) The equation of the back emf voltage e in terms of the shafts rotational
velocity 0
m

:




Q8) The equation for the free body diagram of the rotor as shown in the Main
figure:

In Time Domain:




Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
26

In Laplace Domain:





Q9) Transfer Function
0
m
(s)
v
c
(s)
: (Output angle to input voltage)






























Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
27
Exercise

Modeling a Two mass system:
Following are the differential equations for the
suspension model of a quarter car system.

y m x y b x y k
x m r x k x y k x y b
s
w s
& & & &
& & & &
2
1
) ( ) (
) ( ) ( ) (
=
= +

Which can be re-arranged as:

0 ) ( ) (
) ( ) (
2 2
1 1 1 1
= + +
= + + +
x y
m
k
x y
m
b
y
r
m
k
x
m
k
y x
m
k
y x
m
b
x
s
w w s
& & & &
& & & &

Relating both the equations, use simulink to draw the desired mathematical model.
Input to the system is r and output should be y, to fulfill the transfer function given as:

Use the following values:
m
1
=20 kg, m
2
=375 kg, b=26 N.m/sec, k
s
=345.8, k
w
=37585.3
m2
m1
y
x
b
r
k
s
k
w
Road Surface
Inertial Reference
1 2
4 3 2
1 2 1 2 1 1 2 1 2
( )
( )
( )
( ) ( ) ( )
w s
s s w w w s
k b k
s
Y s m m b
b b k k k k b k k
R s
s s s s
m m m m m m m m m
+
=
+ + + + + + +
Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
28
ASSIGNMENT

QUESTION:

Transfer Function
0

m
(s)
v
c
(s)
: (Output speed to input voltage)



State-Space Model for the DC Motor.

































Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
29
Mohammad Ali Jinnah University, Islamabad
Control Systems Lab
Course Code: EE 3813

LAB # 5

Introduction to LabView and Lego Mindstorm 2.0



Nameofstudent:..

RollNo:....

DateofLAB:

Reportsubmittedon:....

Section:....


Marksobtained:



Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
30
LAB # 5

Objectives:

Introduction to LabVIEW
Introduction to LEGO Mindstorm NXT
Introduction to NXT Sensors
Introduction to NXT Actuators

Introduction to LabVIEW:
LabVIEW is a graphical programming environment used by millions of engineers and scientists
to develop sophisticated measurement, test, and control systems using intuitive graphical icons
and wires that resemble a flowchart. It offers unrivaled integration with thousands of hardware
devices and provides hundreds of built-in libraries for advanced analysis and data visualization
all for creating virtual instrumentation.
Introduction to LEGO Mindstorm NXT:
The NXT Intelligent Brick, your robots brain, features a powerful 32-bit microprocessor and
Flash memory, plus support for Bluetooth and USB 2.0! The NXT intelligent Brick includes:


32-bit ARM7 microprocessor.
Support for Bluetooth wireless communication.
1 USB 2.0 port.
4 input ports.
3 output ports.
Powered by 6 AA (1.5v) Batteries, not
included, or lithium Rechargeable Battery.
Up to three NXT Bricks can be connected at
the same time; however, you can only
communicate with one NXT Brick at a time.








Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
31
Introduction to NXT Sensors:
Following are the sensors given in the kit:
Ultrasonic Sensor:

The Ultrasonic Sensor helps your LEGO
MINDSTORMS NXT robot judge distances and "see"
where objects are! Using the NXT Brick, the
Ultrasonic Sensor is able to detect an object and
measure its proximity in inches or centimeters.

Compass Sensor:

Using the NXT Brick, the Compass Sensor is able to
measure the earth's magnetic field and calculates a
magnetic heading to tell which direction your robot is
facing. The compass has a built-in calibration to help
reduce magnetic interference from other sources.


Accelerometer Sensor:

Using the NXT Brick, the Accelerometer Sensor lets
your LEGO MINDSTORMS creation know which way
is up and when your robot tilts left or right, up or down,
or side to side. This three-axis accelerometer sensor also
measures acceleration so you can measure g forces just
like jet fighter pilots and astronauts.

Touch Sensor:

The Touch Sensor reacts to touch and release,
enabling your LEGO MINDSTORMS NXT robotic
creation to "feel" like never before! It can detect
single or multiple button presses, and reports back to
the NXT Intelligent Brick.

Colour Sensor:

Using the NXT Brick (sold separately), the Color
Sensor enables your robot to distinguish not only
between black and white, but also a range of bright
and pastel colors.
Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
32
Introduction to NXT Actuators:
The output sensor only contains Servo Motor which is given below:



Servo Motor:

The Servo Motor measures speed and
distance, and reports back to the NXT
Intelligent Brick.










Softwares used for NXT Mindstorm Programming :
Matlab
LabVIEW
RobotC
Mindstorm SDK
NXT++






Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
33
ASSIGNMENT

QUESTIONS:

Outline advantages of LabVIEW and its application in control systems.

Explain working phenomenon of sensors
Ultrasonic Sensor
Compass Sensor
Touch Sensor
Colour Sensor
Accelerometer Sensor

Explain working Phenomena of Servo Motor



























Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
34
Mohammad Ali Jinnah University, Islamabad.
Control Systems Lab.
Course Code: EE 3811



LAB # 6

Analyzing the time domain specification
Of obstacle avoiding robot


Nameofstudent:..

RollNo:....

DateofLAB:

Reportsubmittedon:....

Section:....


Instructorssignature:..

Control System Lab.


Mohammad Ali Jinnah University,
Islamabad.
35
LAB # 6

Objectives:

1. Find closed loop transfer function of robot
2. Understanding poles & zeros effect on the system.
3. Analyzing the time domain specifications



Robot:
The robot is composed of two motors and a ultra sonic sensor which helps us to
measure the distance from any obstacle. The open loop transfer function is




The above transfer function can be estimated as follows, as the term 0.004867 can be
neglected as its contribution is not much effective. After estimation our transfer function
comes out to be as




Closed Loop Transfer Function:
The following block diagram shows the working of obstacle avoiding robot, the
reference shows it will maintain 10 units distance from any obstacle.


p i
sk k
pi
s
+
=

Time Domain specifications:

Following are the time domain specifications which can be extracted from the
unit step response of the robot, the step response for our robot will be that while the
robot is maintaining the 10 unit distance from the obstacle, suddenly a new obstacle
2
2
0.004867 s + 1.947 s + 194.7
s + 333.7 s

2
1.947 s + 194.7
s + 333.7 s

Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
36
has been introduced in the way and it will remain there, showing the step input
behavior. this will show us the step response of the robot and wilol help in extracting
the time domain features.

Settling time:

The settling time e is the time elapsed from the application of an ideal
instantaneous step input to the time at which the amplifier output has entered and
remained within a specified error band, usually symmetrical about the final value.
4.6
s
t

=

Rise time:

Rise time refers to the time required for a signal to change from a specified low
value to a specified high value. Typically, these values are 10% and 90% of the step
height.
1.8
r
n
t

=


Overshoot:

Overshoot refers to an output exceeding its final, steady-state value. For a step
input, the percentage overshoot (PO) is the maximum value minus the step value
divided by the step value. In the case of the unit step, the overshoot is just the
maximum value of the step response minus one.

2
/ 1
Mp e

=

Peak time:

The time taken by the system to achieve the peak value in the step response.
p
d
t

=

Control System Lab.
Mohammad Ali Jinnah University,
Islamabad.
37



Poles and zeros effect:
The summary of poles and zeros effect on the system are shown in the
following diagram



Step Response
Time (sec)
A
m
p
lit
u
d
e
0 1 2 3 4 5 6 7 8 9 10
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
System: robot
Settling Time (sec): 5.69
System: robot
Rise Time (sec): 0.44
System: robot
Peak amplitude: 1.5
Overshoot (%): 50.2
At time (sec): 1.17
O
B
S
E
R
V
A
T
I
O
N
S


S
.
N
o

K
p

K
i

P
o
l
e
s


W
n

W
d





A
n
a
l
y
t
i
c

V
a
l
u
e

O
b
s
e
r
v
e
d

V
a
l
u
e

A
n
a
l
y
t
i
c

V
a
l
u
e

O
b
s
e
r
v
e
d

V
a
l
u
e

A
n
a
l
y
t
i
c

V
a
l
u
e

O
b
s
e
r
v
e
d

V
a
l
u
e

A
n
a
l
y
t
i
c

V
a
l
u
e

O
b
s
e
r
v
e
d

V
a
l
u
e

A
n
a
l
y
t
i
c

V
a
l
u
e

O
b
s
e
r
v
e
d

V
a
l
u
e

1

1

0











2

1
0

0











3

2

1
0











4














T
r

O
.
S

T
s

T
p

O
b
s
e
r
v
e
d

V
a
l
u
e

A
n
a
l
y
t
i
c

V
a
l
u
e

O
b
s
e
r
v
e
d

V
a
l
u
e

A
n
a
l
y
t
i
c

V
a
l
u
e

O
b
s
e
r
v
e
d

V
a
l
u
e

A
n
a
l
y
t
i
c

V
a
l
u
e

O
b
s
e
r
v
e
d

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