Lab Manual Control IT-4406
Lab Manual Control IT-4406
Control System
Variable = number;
Variable = expression;
The equality sign is used to assign values to the variables.
Task 1.1 (a):
Assign any constant value and an expression to two different variables, say ‘x’ and ‘y’.
NOTE: when a semi-colon ”;” is placed at the end of each command, the result is not displayed.
Function Meaning
Sin Sine
Cos Cosine
Tang Tangent
Exp Exponential
Task 1.3:
Make practice on the above built in functions in matlab.
LESSON No. 02
Vectors
A row vector in MATLAB can be created by an explicit list, starting with a left bracket,
entering the values separated by spaces (or commas) and closing the vector with a right
bracket.
A column vector can be created the same way, and the rows are separated by semicolons.
Task 1.4(a):
Create a row vector and a column vector and assign these to two different variables
Vector Addressing:
Task 1.4(b):
Task 1.4(c):
Address 1st to 3rd elements of vector ‘x’
Task 1.5:
Make practice on the above functions in matlab.
LESSON No. 03
Matrices
A Matrix array is two-dimensional, having both multiple rows and multiple columns,
similar to vector arrays:
it begins with [, and end with ]
spaces or commas are used to separate elements in a row
semicolon or enter is used to separate rows.
Task 1.6:
Create Matrices in matlab using the above techniques.
Matrix Addressing:
matrixname(row, column)
colon may be used in place of a row or column
reference to select the entire row or column.
Some useful commands:
zeros(n) returns a n x n matrix of zeros
zeros(m,n) returns a m x n matrix of zeros
ones(n) returns a n x n matrix of ones
ones(m,n) returns a m x n matrix of ones
rand(n) returns a n x n matrix of random number
rand(m,n) returns a m x n matrix of random number
size (A) for a m x n matrix A, returns the row vector [m,n] containing the
number of rows and columns in matrix.
Length(A) returns the larger of the number of rows or columns in A.
eye(n) returns an n x n identity matrix
eye(m,n) returns an m x n matrix with ones on the main diagonal and zeros
elsewhere.
B=A’ returns matrix B as Transpose of matrix A.
Table 1. 3: Matrix Operations:
LESSON No. 04
Scalar-Array Mathematics
For addition, subtraction, multiplication and division of an array by a scalar simply
apply the operations to all elements of the array.
Ax = b;
Task 1.7(c):
Find the unknowns (x1, x2, x3):
Task 1.8:
Plot the functions i) a = 2x, ii) b = x2 iii) c = 2 x3 iv) d = √x in the interval (-3,3)
in editor window.
LAB No. 02
Representing Polynomials
To enter this polynomial into MATLAB, use the coefficients of the variable in descending
order enclosed by braces.
Task 2.1(a):
Syntax: roots(p)
Task 2.1(b):
Syntax: poly(roots) ; where roots is the variable to which the roots of the polynomial has been
assigned.
Task 2.1(c):
‘residue’ finds the partial fraction expansion of the ratio of two polynomials. This is particularly
useful for applications that represent systems in transfer function form.
Task 2.2:
Use matlab command to find the partial fraction of the given algebraic expression:
The function ‘conv’ is used for multiplication and ‘deconv’ for division of polynomials,
particularly useful for Transfer Function handling.
Task 2.3:
Laplace transform is an important tool that is very useful while working with differential
equations. Steps to calculate the Laplace transform in MATLAB are:
i. Define a symbolic variable for time using the keyword sym
ii. Define the time domain function
iii. Find the Laplace transform by using the function laplace(function)
iv. The inverse Laplace transform can be found using the function ilaplace()
Task 2.4:
a) Find the laplace transform of the function, f= 5te-5t.
b) find the inverse Laplace transform of the function as in part (a)
We can create transfer function (TF) models by specifying numerator and denominator
coefficients.
Syntax: tf(numerator polynomial, denominator polynomial)
Task 2.5(a):
(𝒔+𝟐)
Find the transfer function of the given function. P(s)= (𝑠2 + 𝑠 + 10
A useful trick is to create the Laplace variable, ‘s’. That way, we can specify polynomials
using‘s’ as the polynomial variable.
Task 2.5(b):
To create zero-pole-gain (ZPK) models, you must specify each of the three components
in vector format.
Syntax: system=zpk([zeros],[poles],[gain])
Task 2.6:
Create zero, pole, gain model in matlab using the above command.
Model conversions are performed by tf and zpk. Given any TF and ZPK model sys, the
syntax for conversion to another model type is given by:
sys = tf(sys) % Conversion to TF
sys = zpk(sys) % Conversion to ZPK
Task 2.7:
Write a matlab code for conversion between transfer function and zpk model
You can simulate the LTI systems to inputs like impulse, step and other standard inputs
and see the plot of the response in the figure window. MATLAB command ‘impulse’ calculates
the unit impulse response of the system, ‘step’ calculates the unit step response of the system and
‘lsim’ simulates the (time) response of continuous or discrete linear systems to arbitrary inputs.
When invoked without left-hand arguments, all three commands plot the response on the screen.
Task 2.9:
(𝒔+𝟑)
Find the impulse and step responses of the system: G(s) = (3𝑠2 + 5𝑠 + 7
Procedure:
1. Click on the Simulink Library block in Home tool bar OR type “simulink” in Matlab
command prompt “Simulink Library Browser” window will appear.
2. Create a new file by selecting “model” from the file option(file->New->Model)
3. Drag the step function (from Sources block) from the simulink library browser to the new
file created followed by transfer function (from Continuous block) and scope (from Sinks
block). Scope is used to see the result (resulting waveform).
4. Give values to the transfer function according to the given system.
5. After saving followed by simulation, click on the scope in the figure to see the resulting
waveform (graph).
6. A window showing the step response will appear.
Impulse Response using Simulink
Procedure:
Repeat the same process as above, just insert differential (derivative) block after Step
block as derivative of Step function results in Impulse function.
Task 2.10:
(𝒔+𝟑)
Plot the impulse and step responses using Simulink of the system: G(s) = (3𝑠2 + 5𝑠 + 7
LAB No. 03
Objective:
The purpose of this lab is to learn about the implementation of different blocks and to
reduce it to a single block using the built in commands.
General Description:
Block diagram consist of Uni-directional operational block that represent the transfer
function of the variable of the interest. The block diagram of representation of a given system
often can be reduced to a simplified block diagram with fewer blocks than original blocks.
Useful Commands for block-reduction:
i) conv
Convolution and polynomial multiplication:
Syntax:
w = conv(u,v)
ii) tf
Create or convert to transfer function model.
sys = tf(num,den)
sys = tf(num,den,Ts)
sys = tf(M)
sys = tf(num,den,ltisys)
tfsys = tf(sys)
iii) Feedback
Syntax:
sys = feedback(sys1,sys2)
Task 3.1:
Find the Close-loop gain of a given system in Matlab using feedback.
Task 3.2:
Find the Close loop Transfer function of a given system using Matlab.
LAB No. 04
State-Space Modelling
Objective:
State Space modeling is a modern tool of analysis and design. The objective of this lab is
to able the students to perform operations in time domain analysis using matlab as compared to
manual work which is a cumbersome task.
General Description:
In control engineering, a state-space representation is a mathematical model of a
physical system as a set of input, output and state variables related by first-order differential
equations.
"State space" refers to the space whose axes are the state variables. The state of the
system can be represented as a vector within that space.
Useful Commands: ss
‘ss’ is used to create real- or complex-valued, state-space models (SS objects) or to convert
transfer function or zero-pole-gain models to state space.
Specify state-space models or convert LTI model to state space
Syntax
ss
sys = ss(a,b,c,d)
sys = ss(a,b,c,d,Ts)
sys = ss(d)
sys = ss(a,b,c,d,ltisys)
sys_ss = ss(sys)
The state-space representation consists of specifying the A, B, C, and D matrices followed by the
creation of an LTI state-space object using the MATLAB command, ss(A,B,C,D).
Task 4.1:
Let;
0 1 0 0
A=[ 0 0 1 ]; B=[0] ; C=[1 1 0]; D=0;
−4 − 5 − 8 4
As 𝑋̇ = 𝐴𝑋 + 𝐵𝑈
Y=CX+DU
Task 4.2:
For illustration of state space representation, consider the following simple model of an
electric motor.
Where θ is the angular displacement of the rotor and I is the driving current. The relation
between the input current u = I and the angular velocity y is described by the state-space
equations.
Task 4.3:
i) K=[1:1:20]
ii) For what value of K system will be stable.
Section:B Root Locus in Matlab:
Objective:
The students may become able to draw root locus and analyze the behavior of the system
from the root locus drawn.
General Description:
In control theory and stability theory, root locus analysis is a graphical method for
examining how the roots of a system change with variation of a certain system parameter,
commonly a gain within a feedback system.
The root locus technique can be used to analyze and design the effect of loop gain upon
the system's transient response and stability. This technique provides very useful information
about system parameters. As one says if you can measure it , you can control it so this technique
is very useful in this regard.
Root Locus in Matlab:
Syntax
rlocus
rlocus(sys)
rlocus(sys1,sys2,...)
Description:
rlocus computes the Evans root locus of a SISO open-loop model. The root locus gives
the closed-loop pole trajectories as a function of the feedback gain (assuming negative feedback).
Root loci are used to study the effects of varying feedback gains on closed-loop pole locations.
In turn, these locations provide indirect information on the time and frequency responses.
‘rlocus(sys)’ calculates and plots the root locus of the open-loop SISO model sys.
Task 5.2:
Objective:
The students may be able to get the desired performance of the system by reducing steady
state error and improving transient response of the system.
INTRODUCTION:
In control system we always deal with system and their performance by finding
mathematical models. Sometimes we don’t meet with desire system performance. Every system
has some parameters to analyze the behavior of the system.
These parameters include rise time, settling time, steady state error , phase margin, gain
crossover frequency and phase crossover frequency.
If the designed system does not satisfy desire performance (i.e rise time, settling time,
steady state error , phase margin, gain crossover frequency and phase crossover frequency), then
controllers are designed to achieve desired response.
Basic Modes:
Combined Modes:
eo (t) = Kp ei(t)
𝐸𝑂
GC (S)= = KP
𝐸𝐼
5
G(s) = (𝑠+1)(𝑠+2)(𝑠+3)
P-Controller
Gc (s) = 3.04
system by 1.
With I-Controller, Offset error of P-Controller is removed.
Steady state error in step response is also eliminated.
However, system’s response becomes slightly slower.
Oscillation in system’s response increases. Maximum overshoot increases. This can make
system unstable.
5
G(s) = (𝑠+1)𝑠+2)𝑠+3)
I-Controller
𝐾𝑖 0.369
Gc (s) = =
𝑆 𝑆
1
It’s transfer function is GC (s) = Kp( 1+ 𝑇 𝑆 )
𝑖
Kp is called ‘proportional Gain ‘ and Ti is called as ‘integral Time ’. 1/ Ti is known as ‘
Reset Time ‘.
Ti affects integral control action while Kp affects both proportional and integral control
action.
Advantage of both P-Controller and I-Controller are clubbed together in PI-Controller.
Due to P-Controller, response becomes faster while duo to I-Control, steady state error
becomes zero.
When Ti is increased, damping factor ζ also increase therefore, large oscillation duo to
P-Control can be made smaller.
5
G(s) = (𝑠+1)𝑠+2)𝑠+3)
PI-Controller
1.01
Gc (s) = (1.52+ )
𝑆
Task 6.1:
Write a matlab code for a unity feedback system with PI-Control to get the desired step response.
5
G(s) = (𝑠+1)𝑠+2)𝑠+3)
PD-Controller
Task 6.2:
Write a matlab code for a unity feedback system with PD-Control to get the desired step
response.
PROPORTIONAL + INTEGRAL + DERIVATIVE (PID) CONTROLLER:
1
It’s transfer function is Gc(s) = Kp ( 1+ TdS + 𝑇i S )
5
G(s) = (
𝑠+1)𝑠+2)𝑠+3)
PID-Controller
1.82
Gc (s) = (2.54 + 0.86S + )
𝑆
Fig. 6.4: Comparison between Output of System with and without PID-Control
PID CONTROLLER STRUCTURE:
Task 6.3:
Write a matlab code for a unity feedback system with PID-Control to get the desired step
response.
STEP RESPONSE OF PID CONTROLLER
Fig. 6.5: Comparison among all Output of System with and without PI, PD andPID-
Control
LAB No. 7
Objective
Tuning of PWM Driver
Characteristics of PWM driver and Motor Dead Band
Requirements
1. IT-4406 Trainer Board
2. 2mm Patch Cords
3. CRO
Experimental Setup
Refer to the following diagram to configure setup for the present experiment.
Fig 1.1
Procedure
1. Press the main switch (ON).
2. Connect the tip of the probe of channel CH1 of the oscilloscope to V6 TP34 of the
PWM DRIVER.
3. Regulate, on the oscilloscope screen, the width of the image, by selecting 5 V/DIV
through the relevant knob.
4. Adjust the knob TIME/DIV.
5. Move the three position selector (AC - GND - DC) to DC.
6. Regulate the trimmer ADJ1, turning it clockwise, to obtain a triangular wave equal to
10Vpp as shown in Fig 1.2.
Fig 1.2
7. Regulate the trimmer ADJ2, turning it counter-clockwise, until the maximum of the
triangular wave is at 0V as shown in Fig 1.2.
8. Move the probe of the oscilloscope to V7 TP35.
9. Insert a terminal of the digital voltmeter, set to dc, at TP36 and the other one at TP37.
10. Now connect the Setpoint 1 TP51 to the input of PWM driver TP33.
11. Set the voltage between 0 and 10V and observe, on the oscilloscope screen, that the
duty cycle of the square wave signal is variable although its period is constant. The
luminosity variation of the LED and the voltage read on the multimeter, which
between 0 and 12V, show that the average value of the voltage is regulated.
12. Connect the +VE TP36 and –VE TP37 of PWM Driver to the +VE and -VE of the
Motor as shown in Fig 1.1.
13. Insert a terminal of the digital voltmeter, set to dc, at the output of Setpoint 1.
14. Slowly increase the voltage on Setpoint 1 and write down the voltage value which
allows the start of the motor.
15. Slowly decrease the voltage on Setpoint 1 and write down the value which allows the
stop of the motor.
16. Repeat the procedure from step No. 14 and verify that the results are the same: it has
now been determined the dead zone of the motor.
17. Put OFF the main switch.
18. Remove all the connections.
LAB No. 8
Objective
Tuning and calibration of Rotational Sensor Interface
Characteristics of PWM driver and Motor Dead Band
Open Loop Control of the Motor
Requirements
1. IT-4406 Trainer Board
2. 2mm Patch Cords
3. CRO
Experimental Setup
Refer to the following diagram to configure setup for the present experiment.
Fig 2.1
Procedure
1. Connect the oscilloscope probe to the Test frequency output TP22. It should be
around 500 Hz
2. Now connect output of Test block TP22 and TP23 to the input of F/V converter at
TP26 and TP25 respectively as shown in Fig 2.1.
3. Connect the output VOUT3 TP27 to the voltmeter and note the reading. It should be
approximately 10V. If not so, adjust the Gain pot to obtain the required reading.
4. Remove the connections and again note the reading at VOUT3. It should be
approximately 0V. If not so, adjust the Offset pot to obtain the required reading.
5. Repeat step 3 and again check the required result. These steps must be performed
until the required result is obtained.
6. Now connect the IR Out TP20 and TP21 to the input of F/V TP26 and TP25
respectively as shown in Fig 2.2.
Fig 2.2
7. Connect the Setpoint 1 output TP51 to the input of PWM driver TP33.
8. Connect the output of PWM Driver with the Motor as shown in Fig 2.3.
Fig 2.3
15. Measure output voltage VOUT3 (TP 27) by using multimeter at different frequencies
and write down in table 2.1.
Frequency 50 100 150 200 250 300 350 400 450 500
(Hz)
Voltage
(V)
Table 2.1
LAB No. 9
Objective
Closed Loop Proportional Control of the Motor
Requirements
1. IT-4406 Trainer Board
2. 2mm Patch Cords
3. CRO
Experimental Setup
Refer to the following diagram to configure setup for the present experiment.
Fig 3.1
Procedure
1. Make all connections as shown in fig 3.1.
2. Connect the oscilloscope channel 1 probe to the Set point 1 TP51 and Channel 2
probe to the output of PID block TP49.
3. Set the voltage of about 4V at the output of Set point 1 TP51.
4. DC motor will start to rotate. If not so, turn the proportional pot to about 25%.
5. Observe the wave form of PID block on oscilloscope.
Fig 3.2
6. There will be some oscillations in the wave. Try to remove these ripples from the
wave by adjusting proportional pot.
Fig 3.3
7. When the system is balanced it will give you straight line. Try to unstable the system
by interrupting the motor with something. It will destabilize the system for some time
but the PID controller will again stabilize it as shown in Fig 3.4.
Fig 3.4
8. Note the time taken by the system to stabilize by oscilloscope.
9. Now set the voltage of about 5V at the output of Set point 1 TP51.
10. Repeat the above steps and note the readings.
LAB No. 10
Objective
Closed Loop Proportional-Integral-Derivative Control of the Motor
Requirements
1. IT-4406 Trainer Board
2. 2mm Patch Cords
3. CRO
Experimental Setup
Refer to the following diagram to configure setup for the present experiment.
Fig 4.1
Procedure
1. Make all connections as shown in fig 4.1.
2. Connect the oscilloscope channel 1 probe to the Set point 1 TP51 and Channel 2
probe to the output of PID block TP49.
3. Set the voltage of about 4V at the output of Set point 1 TP51.
4. DC motor will start to rotate. If not so, turn the proportional pot to about 25%.
5. Turn the Integral and Derivative pot to about 25%.
6. Press the RESET button given on the trainer.
7. Observe the wave form of PID block on oscilloscope.
Fig 4.2
8. There will be some oscillations in the wave. Try to remove these ripples from the
wave by adjusting proportional and derivative pot.
Fig 4.3
9. When the system is balanced it will give you straight line. Try to unstable the system
by interrupting the motor with something. It will destabilize the system for some time
but the PID controller will again stabilize it as shown in fig 4.3.
Fig 4.4
10. Note the time taken by the system to stabilize.
11. Now set the voltage of about 5V at the output of Set point 1 TP51.
12. Repeat the above steps and note the readings.
LAB No. 11
Objective
Open Loop Control of the Light
Requirements
1. IT-4406 Trainer Board
2. 2mm Patch Cords
3. CRO
Experimental Setup
Refer to the following diagram to configure setup for the present experiment
Fig 5.1
Procedure
1. Connect the Dark and Full Light Test circuit TP3 and TP4 to the input of Lx/V
converter TP5 and TP6 respectively as shown in fig 5.1.
2. Connect the voltmeter to the output of Photo Sensor Interface TP7.
3. Move Knob to fully counter clockwise direction. There should be 0V at the output. If
not so, then adjust the OFFSET pot to make it 0V.
4. Now move the knob to fully clockwise direction. At VOUT-1 TP7, it should be
around 10V. If not so, adjust the gain pot so that the output is 10V.
5. Repeat step 3 and again check the required result. These steps must be performed
until the required result is obtained.
Fig 5.2
6. Now connect the Photo Sensor output TP1 and TP2 to the input of Lx/V converter
TP5 and TP6 respectively.
7. Connect the Set point 1 output TP51 to the input of PWM driver TP33.
8. Connect the output of PWM Driver with the Lamp 1 as shown in Fig 5.3.
Fig 5.3
Objective
Closed Loop Proportional Control of the Light
Requirements
1. IT-4406 Trainer Board
2. 2mm Patch Cords
3. CRO
Experimental Setup
Refer to the following diagram to configure setup for the present experiment.
Fig 6.1
Procedure
1. Make all connections as shown in fig 6.1.
2. Connect the oscilloscope channel 1 probe to the Set point 1 TP51 and Channel 2
probe to the output of PID block TP49.
3. Set the voltage of about 5V at the output of Setpoint 1 TP51.
4. Lamp will be enlightened. If not so, turn the proportional pot to about 25%.
5. Observe the wave form of PID block on oscilloscope.
Fig 6.2
6. There will be some oscillations in the wave. Try to remove these ripples from the
wave by adjusting proportional pot.
Fig 6.3
7. When the system is balanced it will give you straight line. Try to unstable the system
by interrupting the light with the disturbance given on the trainer. It will destabilize
the system for some time but the PID controller will again stabilize it as shown in fig
6.4.
Fig 6.4
8. Note the time taken by the system to stabilize.
9. Now set the voltage of about 5.5V at the output of Setpoint 1 TP51.
10. Repeat the above steps and note the readings.
LAB No. 13
Objective
Closed Loop Proportional-Integral-Derivative Control of the Light
Requirements
1. IT-4406 Trainer Board
2. 2mm Patch Cords
3. CRO
Experimental Setup
Refer to the following diagram to configure setup for the present experiment.
Fig 7.1
Procedure
1. Make all connections as shown in fig 7.1.
2. Connect the oscilloscope channel 1 probe to the Set point 1 TP51 and Channel 2
probe to the output of PID block TP49.
3. Set the voltage of about 5V at the output of Setpoint 1 TP51.
4. Lamp will start to illuminate. If not so, turn the proportional pot to about 25%.
5. Turn the Integral and Derivative pot to about 25%.
6. Press the RESET button given on the trainer.
7. Observe the wave form of PID block on oscilloscope.
Fig 7.2
8. There will be some oscillations in the wave. Try to remove these ripples from the
wave by adjusting proportional and derivative knob.
Fig 7.3
9. Turn integral knob to fully clock wise and press reset button.
10. When the system is balanced it will give you straight line. Try to unstable the system
by interrupting the light with the disturbance given on the trainer. It will destabilize
the system for some time but the PID controller will again stabilize it as shown in Fig
7.4.
Fig 7.4
11. Note the time taken by the system to stabilize.
12. Now set the voltage of about 5.5V at the output of Setpoint 1 TP51.
13. Repeat the above steps and note the readings.
LAB No. 14
Objective
Calibration of Temperature Sensor Interface
Closed Loop Proportional-Integral-Derivative Control of the Temperature
Requirements
1. IT-4406 Trainer Board
2. 2mm Patch Cords
3. CRO
Experimental Setup
Refer to the following diagram to configure setup for the present experiment.
Fig 8.1
Procedure
1. Make connections as shown in fig 8.1.
2. Connect Voltmeter to TP18 (VOUT2). Set 0V at VOUT2 by adjusting OFFSET knob.
3. Now make connections according to fig 8.2.
Fig 8.2
4. Set 10V at VOUT2 by adjusting GAIN knob. After adjusting 10V, repeat above steps
and adjust voltages if there is any variation.
Fig 8.3