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 Constant sum Display 0 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 D v ρ N = µ where, D = 2 in., v = 10 ft/s, ρ = 62.4 lb/ft3, µ = 0.3 lb/(hr ft)
b. Heat capacity C p = 6.945 + 10.01 x 10-3 T 3.794 x 10-6 T 2 when T = 400 K. C p 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, 6 th Ed.). For air C p is in Btu/(lb mol- F) where T is in F. C p = 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 C p is in J/(g mol- C) and T is in C. SO 2 : C p = 38.91 + 3.904 x 10-2 T - 3.104 x 10-5 T 2 + 8.606 x 10-9 T 3 SO 3 : C p = 48.50 + 9.188 x 10-2 T - 8.540 x 10-5 T 2 + 32.40 x 10-9 T 3 O 2 : C p = 29.10 + 1.158 x 10-2 T - 0.6076 x 10-5 T 2 + 1.311 x 10-9 T 3 N 2 : C p = 29.00 + 0.2199 x 10-2 T - 0.5723 x 10-5 T 2-2.871 x 10-9 T 3
Simulink Tutorial 2 CPE562 Week 2 Familiarization with Simulink blocks Sources: Constants, Step, Ramp. Sinks: Display, Operations: Sum, Product, Add, Divide, Math functions, Special functions. Mathematical operations involving blocks for sources, sinks and operations. Sources Operations Sinks 1 Constant sum Display 0 Ramp Step Divide e u 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) b. Ramp (slope = 2, start time = 0, initial ouput = 0) c. Ramp (slope = 2, start time = 0, initial ouput = 5) d. Ramp (slope = 2, start time = 4, initial ouput = 0) e. Step (step time = 1, Init. = 0, Final = 1, sample time = 0) f. Step (step time = 3, Init. = 0, Final = 1, sample time = 0) g. Step (step time = 3, Init. = 2, Final = 1, sample time = 0) h. Step (step time = 3, Init. = 2, Final = 4, sample time = 0)
2. Calculate heat capacity using FCN block. C p = 6.945 + 10.01 x 10-3 T 3.794 x 10-6 T 2 where, T = 400. Doubled and tripled the temperature and observe the effect to C p. Homework 1. Study the effect of D, v, ρ, and µ to Reynold number, N. Reynold number is given by D v ρ 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 = - log 10 [H + ] 10-14 < [H + ] < 10-1 3. A power-law fluid having a density of 1041 kg/m 3 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. p = 4 f ρ L D 2 V 2 Study the effect V to p when the value of V is doubled until V = 1.1648 m/s.
Simulink Tutorial 2 CPE562 Week 3 Familiarization with Simulink blocks Sources: Constants, Step, Ramp. Sinks: Display, 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 Ramp f(u) Fcn Mux Demux Tutorial 1. Prepare and run simulink block for the following: slope = 1 Ramp1 slope = -1 Ramp2 Mux
Result 2. Prepare and run simulink block for the following: slope = 1 Ramp1 1 slope = -1 Mux Demux Ramp2 2 After running, observe 1 and 2. What can you conclude? Homework 1. Prepare an innovative simulink program to calculate the following heat capacity problem. Observe the effect of C p 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, 6 th Ed.). For air C p is in Btu/(lb mol- F) where T is in F. C p = 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 C p is in J/(g mol- C) and T is in C. SO 2 : C p = 38.91 + 3.904 x 10-2 T - 3.104 x 10-5 T 2 + 8.606 x 10-9 T 3 SO 3 : C p = 48.50 + 9.188 x 10-2 T - 8.540 x 10-5 T 2 + 32.40 x 10-9 T 3 O 2 : C p = 29.10 + 1.158 x 10-2 T - 0.6076 x 10-5 T 2 + 1.311 x 10-9 T 3 N 2 : C p = 29.00 + 0.2199 x 10-2 T - 0.5723 x 10-5 T 2-2.871 x 10-9 T
2. Observe the effect of changing power index from 0.5 to 1.5 for every 0.5 increment of the following relationship: y = x 0.5... (1) y = x 1.0... (2) y = x 1.5... (3) Sample of solution. u(1)^0.5 Ramp Fcn u(1)^1 Fcn1 u(1)^1.5 Fcn2
Simulink Tutorial 4 CPE562 Week 6 Familiarization with Simulink blocks Sources: Constants, Step, Ramp, Digital clock. Sinks: Display, 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 = x 2 and y = x 3 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 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.
11. 1000 900 800 700 Y 600 500 400 y = x 3 300 200 y = x 2 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.