Vous êtes sur la page 1sur 9

Simulink

Tutorial 1

CPE562

Week 1
Introduction to Simulink
 Familiarization with Simulink blocks

Sources: Constants

Sinks: Display

Operations: Sum, Product, Add, Divide.
 Mathematical operations involving blocks for sources, sinks and operations.


Operations

Sources

Sinks

Constant

sum

Display

1
Constant1

Divide

1
Constant2

Tutorial
1. Prepare and run simulink block for the following:
a.

1 + 2 =

b.

2/3 + 4/5 =

c.

3/5*7 4/9*2 + 9*6 =

d.

4/(9-5/6) + 3/(8/5-2) =

Homework
2. Prepare and run simulink block for the following problems.
a.

Reynold number
Dv

where,
N=

D = 2 in. , v = 10 ft/s , = 62.4 lb/ft3 , = 0.3 lb/(hrft)

Abdul Aziz Ishak, Faculty of Chemical Engineering, Universiti Teknologi MARA Malaysia (2009)

b.

Heat capacity
Cp = 6.945 + 10.01 x 10-3 T 3.794 x 10-6 T2
when T = 400 K. Cp has the unit of cal/(g molK).

c.

Prepare an innovative program to calculate the following heat capacity


problem.
The following problem is taken from Himmelblau p.533 (1982, 6th Ed.).
For air Cp is in Btu/(lbmol-F) where T is in F.
Cp = 6.9 + 0.02884 x 10-2 T + 0.02429 x 10-5 T 2 -0.08052 x 10-9 T 3
For these compounds Cp is in J/(gmol-C) and T is in C.
SO2: Cp = 38.91 + 3.904 x 10-2 T - 3.104 x 10-5 T 2 + 8.606 x 10-9 T 3
SO3: Cp = 48.50 + 9.188 x 10-2 T - 8.540 x 10-5 T 2 + 32.40 x 10-9 T 3
O2: Cp = 29.10 + 1.158 x 10-2 T - 0.6076 x 10-5 T 2 + 1.311 x 10-9 T 3
N2: Cp = 29.00 + 0.2199 x 10-2 T - 0.5723 x 10-5 T 2 - 2.871 x 10-9 T 3

Abdul Aziz Ishak, Faculty of Chemical Engineering, Universiti Teknologi MARA Malaysia (2009)

Simulink

Tutorial 2

CPE562

Week 2

Familiarization with Simulink blocks

Sources: Constants, Step, Ramp.

Sinks: Display, Scope

Operations: Sum, Product, Add, Divide, Math functions, Special functions.


Mathematical operations involving blocks for sources, sinks and operations.

Sources

Operations

Sinks

1
Constant

Ramp

0
sum

Divide
Scope
e

Step

Display

Math
Function

f(u)
Fcn

Tutorial
1. Prepare and run simulink block for the following:
a.

Ramp (slope = 1, start time = 0, initial ouput = 0) Scope

b.

Ramp (slope = 2, start time = 0, initial ouput = 0) Scope

c.

Ramp (slope = 2, start time = 0, initial ouput = 5) Scope

d.

Ramp (slope = 2, start time = 4, initial ouput = 0) Scope

e.

Step (step time = 1 , Init. = 0, Final = 1, sample time = 0) Scope

f.

Step (step time = 3 , Init. = 0, Final = 1, sample time = 0) Scope

g.

Step (step time = 3 , Init. = 2, Final = 1, sample time = 0) Scope

h.

Step (step time = 3 , Init. = 2, Final = 4, sample time = 0) Scope

Abdul Aziz Ishak, Faculty of Chemical Engineering, Universiti Teknologi MARA Malaysia (2009)

2. Calculate heat capacity using FCN block.


Cp = 6.945 + 10.01 x 10-3 T 3.794 x 10-6 T2
where, T = 400.
Doubled and tripled the temperature and observe the effect to Cp.

Homework
1. Study the effect of D , v , , and to Reynold number, N.
Reynold number is given by
Dv

Starting data:
N=

D = 2 in. , v = 10 ft/s , = 62.4 lb/ft3 , = 0.3 lb/(hrft)


2. Study the effect of [H+] to pH as given by the following relationship.
pH = - log10 [H+]
10-14 < [H+] < 10-1
3. A power-law fluid having a density of 1041 kg/m3 is flowing through 14.9 m of a tubing
having an inside diameter of 0.0524 m at an average velocity of 0.0728 m/s. Given that
the friction factor is 14.44, calculate the pressure drop as given by the following
relationship.
L V2
p = 4 f
D 2

Study the effect V to p when the value of V is doubled until V = 1.1648 m/s.

Abdul Aziz Ishak, Faculty of Chemical Engineering, Universiti Teknologi MARA Malaysia (2009)

Simulink

Tutorial 2

CPE562

Week 3

Familiarization with Simulink blocks

Sources: Constants, Step, Ramp.

Sinks: Display, Scope

Operations: Sum, Product, Add, Divide, Math functions, Special functions.

Signal processing blocks: Mux and Demux.

Data saving blocks: To Workspace.

Data saving at Matlab command window.


Mathematical operations involving blocks for sources, sinks, operations and signal splitting.
Source

Operation

Sink

f(u)
Ramp

Fcn

Mux

Scope

Demux

Tutorial
1. Prepare and run simulink block for the following:

slope = 1

Ramp1
slope = -1

Scope
Mux

Ramp2

Abdul Aziz Ishak, Faculty of Chemical Engineering, Universiti Teknologi MARA Malaysia (2009)

Result

2. Prepare and run simulink block for the following:


slope = 1

Ramp1

Scope1

slope = -1
Mux
Ramp2

Demux
Scope2

After running, observe Scope1 and Scope2. What can you conclude?
Homework
1. Prepare an innovative simulink program to calculate the following heat capacity problem.
Observe the effect of Cp when T is doubled and tripled. You may need other blocks that
you had learned last week in order to solve this problem.
The following problem is taken from Himmelblau p.533 (1982, 6th Ed.).
For air Cp is in Btu/(lbmol-F) where T is in F.
Cp = 6.9 + 0.02884 x 10-2 T + 0.02429 x 10-5 T 2 -0.08052 x 10-9 T 3
For these compounds Cp is in J/(gmol-C) and T is in C.
SO2: Cp = 38.91 + 3.904 x 10-2 T - 3.104 x 10-5 T 2 + 8.606 x 10-9 T 3
SO3: Cp = 48.50 + 9.188 x 10-2 T - 8.540 x 10-5 T 2 + 32.40 x 10-9 T 3
O2: Cp = 29.10 + 1.158 x 10-2 T - 0.6076 x 10-5 T 2 + 1.311 x 10-9 T 3
N2: Cp = 29.00 + 0.2199 x 10-2 T - 0.5723 x 10-5 T 2 - 2.871 x 10-9 T

Abdul Aziz Ishak, Faculty of Chemical Engineering, Universiti Teknologi MARA Malaysia (2009)

2. Observe the effect of changing power index from 0.5 to 1.5 for every 0.5 increment of the
following relationship:
y = x0.5

.......... (1)

y = x1.0

.......... (2)

y = x1.5

.......... (3)

Sample of solution.

u(1)^0.5
Ramp

Fcn
Scope

u(1)^1
Fcn1

u(1)^1.5
Fcn2

Abdul Aziz Ishak, Faculty of Chemical Engineering, Universiti Teknologi MARA Malaysia (2009)

Simulink

Tutorial 4

CPE562

Week 6

Familiarization with Simulink blocks

Sources: Constants, Step, Ramp, Digital clock.

Sinks: Display, Scope

Operations: Sum, Product, Add, Divide, Math functions, Special functions.

Signal processing blocks: Mux and Demux.

Data saving blocks: To Workspace.

Data saving & plot at Matlab command window.


Mathematical operations involving blocks for sources, sinks, operations and signal splitting.

Tutorial
1. Compare y = x2 and y = x3 graphically. Copy the plot to MSWORD.
2. Prepare and run simulink block for the following:
Source

Operation

Sink

x
To Workspace1

u[1]^3
Clock

Fcn

Scope

y
To Workspace

3. Set To Workspace, To Workspace1 data saving format to Array and variable name to y
and x respectively.
4. Run the program for Fcn u[1]^2 first.
5. At Matlab command window type >> plot(x,y)
6. Run the program for Fcn u[1]^3
7. At Matlab command window type >> figure(2), plot(x,y)
8. Copy line plot from Figure 2 to Figure.
9. At Figure, click Edit Copy Figure
10. Open MSWORD and paste.

Abdul Aziz Ishak, Faculty of Chemical Engineering, Universiti Teknologi MARA Malaysia (2009)

11.
1000
900
800
700
600
Y

y = x3
500
400
300
y = x2

200
100
0

5
X

10

12. Get your self acquainted with all command in Figure (File, Edit, View, etc.) esp. Property
Editor to label x, y axes and Text Arrow to label line plots.

Abdul Aziz Ishak, Faculty of Chemical Engineering, Universiti Teknologi MARA Malaysia (2009)

Vous aimerez peut-être aussi