You are on page 1of 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.

Sources Operations Sinks

1 0
Constant
sum Display

Constant1
Divide

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ρ
N=
µ
where,

D = 2 in. , v = 10 ft/s , ρ = 62.4 lb/ft3 , µ = 0.3 lb/(hr⋅ft)

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 mol⋅K).

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/(lb⋅mol-°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/(g⋅mol-°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 0
Constant
sum Display

Divide
Ramp
Scope

u
e

Math
Step 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ρ
N=
µ
Starting data:

D = 2 in. , v = 10 ft/s , ρ = 62.4 lb/ft3 , µ = 0.3 lb/(hr⋅ft)

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 Scope

Mux 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 Demux

Ramp2 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/(lb⋅mol-°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/(g⋅mol-°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

To Workspace1

u[1]^3
Clock
Fcn Scope

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 = x3
500
Y

400

300

y = x2
200

100

0
0 1 2 3 4 5 6 7 8 9 10
X

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)

You might also like