You are on page 1of 17

Lab Tutorial problems

There are five problems in the word document. I request you to read them
and practice in the Simulink. Some of the ideas will be covered during the
course work.

1. Piston Crank mechanism

2. Finding the position of the car

3. Solving differential Equations in Simulink

4. Simple Diode problem

5. Armature controlled DC Motor.

1
1. Piston- Crank mechanism

Radius of the crank (r) -120 mm; Connecting rod Length(c)= 250 mm. The task
is to simulate the piston movement (x) inside the cylinder. The model is

Where x represents the movement of the piston in mm in the cylinder.

Simulation steps
1. To find x , We need to know the θ and r and c are already given.
2. Let us assume speed- N (say 2500 RPM)
3. Speed and angular velocity are related by ω = 2*pi* N/ 60 and we can
write a MATLAB function or Simulink blocks to compute ω.
4. Angular velocity ω = dθ/dt
5. To find θ we will have to integrate ω = dθ/dt

2
6. If we continually integrate θ will keep increase for ever.
7. We know that after one full rotation of crank(θ = 360° or 2*pi), again we
need to make it to zero
8. Hence, we will set the wrapped state of integrator upper value to 2*pi;

9. Once we get θ from the above use that signal and write a function to
compute x

And plot the result of x vs t


You may get the plot distorted, change go to model settings

and change the parameter Max step size to 0.001;

3
Simulink model

2. Finding the position of car.


The table represents data of velocity of car reported by sensor vs Time.

- To find the position we have to integrate the velocity of the car.

4
- Create a 1-D lookup table and input the table data
- Input clock block to 1-D lookup table
- Connect the output of lookup table to integrator.
- connect the output of integrator to a scope.
(Note: Lookup table by design will interpolate values for example 2.4 seconds
etc and feed the integrator)

Now experiment with discrete integrator (block KTs/Z-1 ) which takes discrete
values and integrates the velocity

5
Change the sample
time to what you need
if you leave -1, system
will consider default.

If you change it to say


2 , it will sample once
in 2 seconds and do
the computation.

Now change it to 1
and see the output.

See the difference of continuous and discrete integrators from scope outputs.
Alternatively you can output the data to matlab workspace and see the data

6
The output should look like this.

3. Solving differential Equations in Simulink


Problem: We are given a spherical tank with radius r and fluid filled to height
h. Our task is to find out how the height of the tank varies with respect to
time(t) if there is a drain through a hole at bottom of tank.

One can show that the differential equation is as follows

7
where Cd=0.6 r=2 m, Diameter of the hole is 2.5 cm (Area A can be computed
from this) and g is 9.81 m/sec2
and the initial height of water is 3 meter.
Construct the following circuit after studying the differential equation.

Alternatively, you can build the equations using MATLAB functions( Like how
we did it in SI engine Control).

Initial height of the tank needs to be


inputted into Integrator block parameter
(See initial condition).
Limit the output of lower saturation limit
to Zero ( Meaning we do not want the
integrator to output negative height values
which is physically impossible). Fully
drained means the height is Zero after
sometime.

8
4) Simple Diode problem
An ideal diode blocks the flow of current in the direction opposite that of the
diode’s arrow symbol. It can be used to make a half-wave rectifier as shown in
Figure. For the ideal diode, the voltage L across the load RL is given by

9
Write a Simulink program to plot the graphs of the input voltage vs diode
voltage.

Solution:

-The voltage VL across the Load resistance is equal to the supplied voltage Vs if
the Vs is >0 (As the diode is forward biased) and is equal to Zero if the Vs is <0
(As the diode is reverse biased).
- We need to generate the supply voltage Vs(t) by using a clock and writing the
equation.
- Vs voltage needs to be passed through an If block which tests the condition
whether Vs is Greater than zero. If so, it passes through If action sub
system(input is Vs and output is merge block.
If Vs is less than Zero, the condition fails and signal passes through the if action
sub system (input is Zero and output is merge block.

10
Input voltage

Output voltage

11
(Please feel free to explore options such as switch etc) to do the same
functionality)

Using switch block.

Now can you try to implement a more accurate model

The above considers 0.6 Voltage drop across the diode.

5) An armature controlled DC Motor is shown below.

12
By applying Kirchoff’s equations and Torque equations(Euler’s) we can arrive at
following systems of differential equations ( We shall derive this in our theory
class).

The voltage applied is

We need to study the current (i) and speed (ω) of the model for the applied
voltages. Can use following parameters.
R 0.6 Ω
L 0.002H
Kt 0.04N.m/A
Ke 0.04 V.s/rad
C 0
I 6 * 10^-5 kg./m2

13
Solution:
- We will introduce state space model concept to solve the problem.
- States such as current , speed of system defines it and if we solve the
equations, we can study the behaviour of the system.
- Run a matlab script and type all the parameters into it and run and save
it.

- We need to build the voltage signal as mentioned in the question – You


can do by using the if – else statements also (Multiples of them). But you
can use the signal builder option.

Click open and click signal >> new >> custom

14
and type as under (which should approximate the voltage applied equation) -
Verify!

and OK and then close it.

- You should get the following type of signal (Ignore the nomenclature
signal 4 in this example).
-

15
-
- Open a state space block and type the following in the parameter.

The above is a representation of equations given below.

A B

C is nothing but the state vector (i and ω) identity matrix


1 0
0 1

16
and D is the feedback which is zero for the problem.
Now connect as under.

and you should see that red line is the speed(ω) , yellow is the applied voltage
(V) and blue is the current(i). Now you can change the different R,L
parameters and see how the motor responds.

*************

17

You might also like