Sunteți pe pagina 1din 157

Scilab Textbook Companion for Thermodynamics (SI Units) Sie 6E by Cengel1

Created by Karan Arora B-Tech Civil Engineering Indian Institute of Technology Roorkee College Teacher Not Applicable Cross-Checked by TechPassion October 4, 2013

by a grant from the National Mission on Education through ICT, http://spoken-tutorial.org/NMEICT-Intro. This Textbook Companion and Scilab codes written in it can be downloaded from the Textbook Companion Project section at the website http://scilab.in

1 Funded

Book Description
Title: Thermodynamics (SI Units) Sie 6E Author: Cengel Publisher: Tata McGraw - Hill Education Edition: 6 Year: 2008 ISBN: 0070262179

Scilab numbering policy used in this document and the relation to the above book. Exa Example (Solved example) Eqn Equation (Particular equation of the above book) AP Appendix to Example(Scilab Code that is an Appednix to a particular Example of the above book) For example, Exa 3.51 means solved example 3.51 of this book. Sec 2.3 means a scilab code whose theory is explained in Section 2.3 of the book.

Contents
List of Scilab Codes 1 Introduction and Basic Concept 2 Energy Transfer and General Energy Analysis 3 Properties of Pure Substances 4 Energy Analysis of Closed Systems 5 Mass and Energy Analysis of Control Volumes 6 Mass and Energy Analysis of Control Volumes 7 Entropy 8 Exergy A Measure of Work Potential 9 Gas Power Cycle 10 Vapor and Combined Power Cycles 11 Refrigeration Cycles 12 Thermodynamic Property Relations 13 Gas Mixtures 14 Gas Vapour Mixtures and Air Conditioning 5 10 15 23 32 40 52 57 74 86 97 108 113 117 126

15 Chemical Reactions 16 Chemical and Phase Equilibrium 17 Compressible Flow

134 142 148

List of Scilab Codes


Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa 1.1 1.5 1.6 1.7 1.8 1.9 1.10 1.12 2.1 2.2 2.7 2.8 2.9 2.10 2.11 2.12 2.13 2.15 2.16 2.17 2.18 2.19 3.1 3.2 3.3 3.4 3.5 obtaining formulas for from unit considerations . . . . Absolute Pressure of a Vacuum Chamber . . . . . . . Measuring Pressure with nanometer . . . . . . . . . . Measuring pressure with multiuid manomete . . . . . Measuring Atmospheric Pressure with barometer . . . Eect of piston weight on Pressure of Cylinder . . . . Hydrostatic Pressure in a Solar Pond with Variable Density . . . . . . . . . . . . . . . . . . . . . . . . . . . . Analyzing a Multiuid Manometer with EES . . . . . General energy analysis . . . . . . . . . . . . . . . . . Analysis of wind energy . . . . . . . . . . . . . . . . . Power Transmission by the Shaft of a Car . . . . . . . Power Needs of a Car to Climb a Hill . . . . . . . . . Power needs of a car to accelerate . . . . . . . . . . . Cooling of hot uid in tank . . . . . . . . . . . . . . . Acceleration of air by fan . . . . . . . . . . . . . . . . Heating eect of a fan . . . . . . . . . . . . . . . . . . Annual lighting cost of a classroom . . . . . . . . . . . Cost of cooking with electric and gas charges . . . . . Performance of hydraulic turbine generator . . . . . . Cost Savings Associated with High Eciency motors . Reducing air pollution by geothermal heating . . . . . Heat transfer from a person . . . . . . . . . . . . . . . Pressure of Saturated Liquid in a Tank . . . . . . . . . Temperature of Saturated Vapor in a Cylinder . . . . Volume and Energy Change during Evaporation . . . Pressure and Volume of a Saturated Mixture . . . . . Properties of Saturated Liquid Vapour Mixture . . . . 5 10 10 11 11 12 12 12 13 15 16 16 17 17 18 18 19 19 19 20 21 21 22 23 23 24 24 25

Exa 3.7 Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa 3.8 3.10 3.11 3.12 3.13 3.14 4.2 4.3 4.4 4.5 4.7 4.8 4.10 4.11 4.12 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 5.10 5.11 5.12 5.13 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8

Internal Energy of Superheated Vapor using linear interpolation . . . . . . . . . . . . . . . . . . . . . . . . Approximating Compressed Liquid as Saturated Liquid Mass of Air in a Room . . . . . . . . . . . . . . . . . . The Use of Generalized Charts . . . . . . . . . . . . . Using Generalized Charts to Determine Pressure . . . Dierent Methods of Evaluating Gas Pressure . . . . . Temperature Drop of a Lake Due to Evaporation . . . Boundary Work for a Constant Pressure Process . . . Isothermal Compression of an Ideal Gas . . . . . . . . Expansion of a Gas against a spring . . . . . . . . . . Electric Heating of a Gas at Constant Pressure . . . . Evaluation of the du of an Ideal Gas . . . . . . . . . . Heating of a Gas in a Tank by Stirring . . . . . . . . . Heating of a Gas at Constant Pressure . . . . . . . . . Enthalpy of Compressed Liquid . . . . . . . . . . . . . Cooling of an Iron Block by Water . . . . . . . . . . . water ow through garden hose nozzle . . . . . . . . . Discharge of water from a tank . . . . . . . . . . . . . Energy transport by mass . . . . . . . . . . . . . . . . Deceleration of air in diuser . . . . . . . . . . . . . . Acceleration of steam in nozzle . . . . . . . . . . . . . Compressing air by compressor . . . . . . . . . . . . . Power generation by steam turbine . . . . . . . . . . . Expansion of refrigant 134a in refrigerator . . . . . . . Mixing of Hot and Cold Waters in a Shower . . . . . . Cooling of refrigant 134a by water . . . . . . . . . . . Electric heating of air in house . . . . . . . . . . . . . Charging of rigid tank by system . . . . . . . . . . . . Cooking with a pressure cooker . . . . . . . . . . . . . Net Power Production of a Heat Engine . . . . . . . . Fuel Consumption Rate of a Car . . . . . . . . . . . . Heat Rejection by a Refrigerator . . . . . . . . . . . . Heating a House by a Heat Pump . . . . . . . . . . . Analysis of a Carnot Heat Engine . . . . . . . . . . . A Questionable Claim for a Refrigerator . . . . . . . . Heating a House by a Carnot Heat Pump . . . . . . . Malfunction of a Refrigerator Light Switch . . . . . . 6

26 26 27 27 28 29 30 32 32 33 34 34 36 36 37 38 40 41 41 42 43 44 44 46 47 47 48 49 49 52 52 53 53 54 55 55 55

Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa

7.1 7.2 7.3 7.4 7.5 7.7 7.8 7.9 7.10 7.11 7.12 7.13 7.14 7.15 7.16 7.17 7.18 7.19 7.21 7.22 7.23 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.10 8.11 8.12 8.13 8.14 8.15 8.16 8.17

Entropy Change during an Isothermal Process . . . . . Entropy Generation during Heat Transfer Processes . Entropy Change of a Substance in a Tank . . . . . . . Entropy Change during a Constant Pressure Process . Isentropic Expansion of Steam in a Turbine . . . . . . Eect of Density of a Liquid on Entropy . . . . . . . . Economics of Replacing a Valve by a Turbine . . . . . Entropy Change of an Ideal Gas . . . . . . . . . . . . Isentropic Compression of Air in a Car Engine . . . . Isentropic Compression of an Ideal Gas . . . . . . . . Compressing a Substance in the Liquid versus Gas Phases Work Input for Various Compression Processes . . . . Isentropic Eciency of a Steam Turbine . . . . . . . . Eect of Eciency on Compressor Power Input . . . . Eect of Eciency on Nozzle Exit Velocity . . . . . . Entropy Generation in a Wall . . . . . . . . . . . . . . Entropy Generation during a Throttling Process . . . Entropy Generated when a Hot Block Is Dropped in a Lake . . . . . . . . . . . . . . . . . . . . . . . . . . . . Entropy Generation Associated with Heat Transfer . . Energy and Cost Savings by Fixing Air Leaks . . . . . Reducing the Pressure Setting to Reduce Cost . . . . Maximum power generation by wind turbine . . . . . Exergy transfer from a furnace . . . . . . . . . . . . . The rate of irreversibility of a heat engine . . . . . . . Irreversibility during cooling of an iron block . . . . . Heating potential of a hot iron block . . . . . . . . . . Second law eciency of resistance heaters . . . . . . . Work Potential of compressed air in tank . . . . . . . Exergy change during a compression process . . . . . . Exergy destruction during heat conduction . . . . . . Exergy destruction during expansion of steam . . . . . exergy destroyed during stirring of gas . . . . . . . . . Dropping of hot iron block in water . . . . . . . . . . Exergy destruction during heat transfer to a gas . . . second law analysis of steam turbine . . . . . . . . . . exergy destroyed during mixing of uid streams . . . . Charging of compressed air storage system . . . . . . . 7

57 57 58 59 60 61 62 62 63 64 64 65 66 67 68 69 70 70 71 72 73 74 74 75 76 76 77 77 78 78 79 80 81 82 83 84 85

Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa

The Ideal Otto Cycle . . . . . . . . . . . . . . . . . . The Ideal Diesel Cycle . . . . . . . . . . . . . . . . . . The Simple Ideal Brayton Cycle . . . . . . . . . . . . An Actual Gas Turbine Cycle . . . . . . . . . . . . . . Actual Gas Turbine Cycle with Regeneration . . . . . A Gas Turbine with Reheating and Intercooling . . . . The Ideal Jet Propulsion Cycle . . . . . . . . . . . . . Second Law Analysis of an Otto Cycle . . . . . . . . . An Actual Steam Power Cycle . . . . . . . . . . . . . Eect of Boiler Pressure and Temperature on Eciency The Ideal Reheat Rankine Cycle . . . . . . . . . . . . The Ideal Regenerative Rankine Cycle . . . . . . . . . The Ideal Reheat Regenerative Rankine Cycle . . . . . Second Law Analysis of an Ideal Rankine Cycle . . . . An Ideal Cogeneration Plant . . . . . . . . . . . . . . A Combined Gas Steam Power Cycle . . . . . . . . . . The Actual Vapor Compression Refrigeration Cycle . . A Two Stage Refrigeration Cycle with a Flash Chamber The Simple Ideal Gas Refrigeration Cycle . . . . . . . Cooling of a Canned Drink by a Thermoelectric Refrigerator . . . . . . . . . . . . . . . . . . . . . . . . . . . Exa 17.10 Estimation of the Mach Number from Mach Lines . . Exa 12.1 Approximating Dierential Quantities by Dierences . Exa 12.2 Total Dierential versus Partial Dierential . . . . . . Exa 12.5 Evaluating the hfg of a Substance from the PVT Data Exa 12.6 Extrapolating Tabular Data with the Clapeyron Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . Exa 12.11 dh and ds of oxygen at high pressure . . . . . . . . . . Exa 13.1 Mass and Mole Fractions of a Gas Mixture . . . . . . Exa 13.2 PVT Behavior of Nonideal Gas Mixtures . . . . . . . . Exa 13.3 Mixing Two Ideal Gases in a Tank . . . . . . . . . . . Exa 13.4 Exergy Destruction during Mixing of Ideal Gases . . . Exa 13.5 cooling of non ideal gas mixture . . . . . . . . . . . . Exa 13.6 obtaining fresh water from sea water . . . . . . . . . . Exa 14.1 The amonut of water vapour in room air . . . . . . . . Exa 14.2 Fogging of the windows in house . . . . . . . . . . . . Exa 14.3 The Specic and Relative Humidity of Air . . . . . . . Exa 14.4 The Use of the Psychrometric Chart . . . . . . . . . . 8

9.2 9.3 9.5 9.6 9.7 9.8 9.9 9.10 10.2 10.3 10.4 10.5 10.6 10.7 10.8 10.9 11.2 11.4 11.5 11.6

86 88 89 90 91 92 94 95 97 98 100 101 102 104 105 107 108 109 110 111 112 113 113 114 115 115 117 118 120 121 122 124 126 127 127 128

Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa Exa

14.5 14.6 14.8 14.9 15.1 15.2 15.3 15.4 15.5 15.6 15.7 15.8 15.9 15.11 16.1 16.2 16.6 16.7 16.8 16.9 16.10 16.11 17.1 17.2 17.3 17.4 17.5 17.7 17.9 17.16

Heating and Humidication of Air . . . . . . . . . . Cooling and Dehumidication of Air . . . . . . . . . Mixing of Conditioned Air with Outdoor Air . . . . Cooling of a Power Plant by a Cooling Tower . . . . Balancing the Combustion Equation . . . . . . . . . Dew Point Temperature of Combustion Products . . Combustion of a Gaseous Fuel with Moist Air . . . . Reverse Combustion Analysis . . . . . . . . . . . . . Evaluation of the Enthalpy of Combustion . . . . . . First Law Analysis of Steady Flow Combustion . . . First law anlysis of combustion in bomb . . . . . . . Adiabatic Flame Temperature in Steady Combustion Reversible work associated with combustion process Second law analysis of isothermal combustion . . . . Equilibrium Constant of a Dissociation Process . . . Dissociation Temperature of Hydrogen . . . . . . . . Enthalpy of Reaction of a Combustion Process . . . Phase Equilibrium for a Saturated Mixture . . . . . Mole Fraction of Water Vapor Just over a Lake . . . The Amount of Dissolved Air in Water . . . . . . . . Diusion of Hydrogen Gas into a Nickel Plate . . . . Composition of Dierent Phases of a Mixture . . . . Compression of High Speed Air in an Aircraft . . . . Mach Number of Air Entering a Diuser . . . . . . . Gas Flow through a Converging Diverging Duct . . . Critical Temperature and Pressure in Gas Flow . . . Eect of Back Pressure on Mass Flow Rate . . . . . Airow through a Converging Diverging Nozzle . . . Shock Wave in a Converging Diverging Nozzle . . . . Steam Flow through a Converging Diverging Nozzle

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

129 131 132 133 134 134 135 136 137 137 138 139 140 140 142 142 143 144 145 145 146 146 148 149 149 150 151 152 153 154

Chapter 1 Introduction and Basic Concept

Scilab code Exa 1.1 obtaining formulas for from unit considerations
1 2 3 4 5 6 7 8

// q u e s 1 // o b t a i n i n g f o r m u l a s f o r from u n i t c o n s i d e r a t i o n s clear clc d =850; // d e n s i t y m3/ kg V =2; // volume m3 m = d * V ; // mass Kg printf ( Mass o f t h e s a m p l e m =%. 0 f Kg ,m ) ;

Scilab code Exa 1.5 Absolute Pressure of a Vacuum Chamber


1 // q u e s 5 2 // A b s o l u t e P r e s s u r e o f a Vacuum Chamber 3 clc 4 Patm =14.5; // A t m o s p h e r i c P r e s s u r e i n p s i 5 Pvac =5.8; // vaccum P r e s s u r e i n p s i 6 Pabs = Patm - Pvac ; // A b s o l u t e P r e s s u r e i n p s i 7 printf ( A b s o l u t e P r e s s u r e=A t m o s p h e r i c P r e s s u r e

Vaccum P r e s s u r e=%0 . 1 f p s i , Pabs ) ; 10

Scilab code Exa 1.6 Measuring Pressure with nanometer


1 2 3 4 5 6 7 8 9

// q u e s 6 // M e a s u r i n g P r e s s u r e w i t h n a n o m e t e r clc Patm =96; // A t m o s p h e r i c P r e s s u r e i n kPa d =850; // d e n s i t y i n Kg/m3 g =9.81; // g r a v i t a t i o n a l a c c e l a r a t i o n h =0.55; // h i e g h t i n m e t r e P = Patm + d * g * h /1000; // P r e s s u r e i n kPa printf ( P r e s u r e=Patm+ d g h=%. 1 f kPa ,P ) ;

Scilab code Exa 1.7 Measuring pressure with multiuid manomete


1 2 3 4 5 6 7 8 9 10 11 12 13 14

// q u e s 7 // M e a s u r i n g p r e s s u r e w i t h m u l t i f l u i d manometer clear clc Patm =85.6; // i n kPa dwater =1000; // d e n s i t y o f w a t e r i n Kg/m3 dmercury =13600; // d e n s i t y o f m e r c u r y i n Kg/m3 doil =850; // d e n s i t y o f o i l i n Kg/m3 g =9.81; // a c c due t o g r a v i t y i n m/ s 2 h1 =0.1; // h e i g h t o f w a t e r i n m e t r e h2 =0.2; // h e i g h t o f o i l i n m e t r e h3 =0.35; // h i e g h t o f m e r c u r y i n m e t r e P1 = Patm + g *( dmercury * h3 - dwater * h1 - doil * h2 ) /1000; printf ( P r e s s u r e P1 = %. 0 f kPa , P1 ) ;

11

Scilab code Exa 1.8 Measuring Atmospheric Pressure with barometer


1 2 3 4 5 6 7 8 9

// q u e s 8 // M e a s u r i n g A t m o s p h e r i c P r e s s u r e w i t h b a r o m e t e r clear clc g =9.81; // a c c due t o g r a v i t y i n m/ s 2 h =0.74; // h e i g h t i n m e t r e d =13570; // d e n s i t y i n Kg/m3 Patm = d * g * h /1000; // A t m o s p h e r i c p r e s s u r e i n kPa printf ( A t m o s p h e r i c p r e s s u r e from b a r o m e t e r i s = %. 1 f kPa , Patm ) ;

Scilab code Exa 1.9 Eect of piston weight on Pressure of Cylinder // q u e s 9 // E f f e c t o f p i s t o n w e i g h t on P r e s s u r e o f C y l i n d e r clear clc Patm =0.97; // A t m o s p h e r i c p r e s s u r e i n b a r m =60; // mass i n kg g =9.81; // a c c due t o g r a v i t y i n m/ s 2 A =0.04; // a r e a i n m2 P = Patm + m * g / A /10^5; // n e t p r e s s u r e a f t e r c o n s i d e r i n g t h e e f f e c t i n Bar 10 // d i v i d e d by 1 0 5 t o c o n v e r t i t i n t o b a r s 11 printf ( P r e s s u r e = %. 2 f Bar ,P ) ;
1 2 3 4 5 6 7 8 9

Scilab code Exa 1.10 Hydrostatic Pressure in a Solar Pond with Variable Density
1

// q u e s 1 0 12

2 3 4 5 6 7 8 9 10 11

// H y d r o s t a t i c P r e s s u r e i n a S o l a r Pond w i t h V a r i a b l e Density clear clc d =1040; // d e n s i t y o f pond i n Kg/m3 g =9.81; // a c c due t o g r a v i t y i n m/ s 2 h1 =0.8; // h e i g h t o f l i q u i d i n m e t r e H =4; // h e i g h t o f l i q u i d o f v a r i a b l e d e n s i t y P1 = d * g * h1 /1000; // d i v i d e d by 1 0 0 0 t o c o n v e r t i t i n t o kPa P = P1 + integrate ( d g s q r t (1+ t a n ( %pi /4 z /H) 2 ) , z ,0 ,4) /1000; printf ( P r e s s u r e a t t h e bottom o f t h e g r a d i e n t z o n e = %. 1 f kPa ,P ) ;

Scilab code Exa 1.12 Analyzing a Multiuid Manometer with EES


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

// q u e s 1 2 // A n a l y z i n g a M u l t i f l u i d Manometer w i t h EES clc g =9.81; // a c c due t o g r a v i t y i n m/ s 2 Patm =85600; // A t m o s p h e r i c p r e s s u r e i n Pa h1 =0.1; // h e i g h t o f w a t e r i n m e t r e h2 =0.2; // h e i g h t o f o i l i n m e t r e h3 =0.35; // h e i g h t o f m e r c u r y i n m e t r e dwater =1000; // d e n s i t y o f w a t e r i n Kg/m3 doil =850; // d e n s i t y o f o i l i n Kg/m3 dmercury =13600; // d e n s i t y o f m e r c u r y i n Kg/m3 P1 = Patm -( dwater * g * h1 + doil * g * h2 - dmercury * g * h3 ) ; // i n Pa printf ( P r e s s u r e a t p o i n t 1 = %. 0 f Pa , P1 ) ; //Now t o f i n d h3 i f m e r c u r y i s r e p l a c e d by a n o t h e r oil dmercury =1030; // D e n s i t y o f new m e r c u r y i n Kg/m3 h3 =( P1 - Patm + dwater * g * h1 + doil * g * h2 ) /( g * dmercury ) ; // i n 13

metre 17 printf ( \ n New h e i g h t h3 = %. 2 f m e t r e s , h3 ) ;

14

Chapter 2 Energy Transfer and General Energy Analysis

Scilab code Exa 2.1 General energy analysis


1 // e x a m p l e 1 2 // g e n e r a l e n e r g y a n a l y s i s 3 clear 4 clc 5 d =0.75 // d e n s i t y o f g a s o l i n e i n kg / l 6 v =5 // a v e r a g e c o n s u m p t i o n o f g a s o l i n e by t h e c a r i n 7 8 9 10 11 12 13

l i t r e s / day h =44000 // h e a t i n g v a l u e o f g a s o l i n e i n kJ / kg disp ( d a i l y c o n s u m p t i o n o f f u e l = c = d v ) c = d * v // a v e r a g e c o n s u m p t i o n o f g a s o l i n e i n kg / day e = c * h // d a i l y e n e r g y r e q u i r e m e n t o f c a r i n kJ / day E =0.1*6.73*10^10 // e n e r g y r e l e a s e d by c o m p l e t e f u s s i o n o f 0 . 1 kg o f uranium i n kJ x = E / e // no . o f d a y s f o r which E amount o f e n e r g y can meet t h e e n e r g y r e q u i r e m e n t s o f c a r printf ( \ n Hence , t h e c a r w i l l r e q u i r e r e f i l l i n g a f t e r = %. 0 f y e a r s . \ n ,x /365) ;

15

Scilab code Exa 2.2 Analysis of wind energy // e x a m p l e 2 // a n a l y s i s o f wind e n e r g y clear clc v =8.5 // v e l o c i t y o f wind i n m/ s e = v ^2/2 // wind e n e r g y p e r u n i t mass o f a i r i n j / kg m =10 // mass o f wind t o be c o n s i d e r e d i n kg E = m * e // e n e r g y i n j o u l e s o f wind o f mass m mf =1154 // mass f l o w r a t e i n kg / s Ef = mf * e // wind e n e r g y i n W f o r a mass f l o w r a t e o f mf 11 printf ( \ n Hence , wind e n e r g y p e r u n i t mass i s = %. 1 f J / kg . \ n ,e ) ; 12 printf ( \ n The wind e n e r g y f o r a mass o f 10 kg i s = %. 0 f J . \ n ,E ) ; 13 printf ( \ n The wind e n e r g y f o r f l o w r a t e o f 1 1 5 4 kg / s i s = %. 1 f kW. \ n , Ef /1000) ;
1 2 3 4 5 6 7 8 9 10

Scilab code Exa 2.7 Power Transmission by the Shaft of a Car


1 2 3 4 5 6 7 8 9

// e x a m p l e 7 // Power T r a n s m i s s i o n by t h e S h a f t o f a Car clear clc t =200 // t o r q u e a p p l i e d i n N .m rpm =4000 // r e v o l u t i o n s p e r m i n u t e o f s h a f t n = rpm /60 // r e v o l u t i o n s p e r s e c o n d o f s h a f t w =2* %pi * n * t // s h a f t power i n w a t t s printf ( \ n Hence , power t r a n s m i t t e d by t h e s h a f t o f c a r i s = %. 1 f kW. \ n ,w /1000) ; 16

Scilab code Exa 2.8 Power Needs of a Car to Climb a Hill


1 2 3 4 5 6 7 8 9 10

// e x a m p l e 8 // Power Needs o f a Car t o Climb a H i l l clear clc m =1200 // mass o f c a r i n kg v1 =90 // v e l o c i t y o f c a r i n km/ h v2 =90*5/18 // v e l o c i t y o f c a r i n m/ s x =30 // s l o p e o f h i l l i n d e g r e e s g =9.8 // a c c . due t o g r a v i t y i n m/ s 2 w = m * g * v2 * sin ( %pi *30/180) // a d d i t i o n a l power t o be d e l i v e r e d by e n g i n e i n w a t t s 11 printf ( \ n Hence , a d d i t i o n a l power t o be d e l i v e r e d by e n g i n e i s = %. 0 f kW. \ n ,w /1000) ;

Scilab code Exa 2.9 Power needs of a car to accelerate // e x a m p l e 9 // power n e e d s o f a c a r t o a c c e l e r a t e clear clc m =900 // mass o f c a r i n kg v1 =0 // i n i t i a l v e l o c i t y o f c a r v2 =80*5/18 // f i n a l v e l o c i t y o f c a r i n m/ s t =20 // t i m e i n which t h e c a r h a s t o r e a c h i t s d e s i r e d speed in seconds 9 w = m *( v2 ^2 - v1 ^2) /2 // work r e q u i r e d t o a c c o m p l i s h t h i s task in j o u l e s 10 p = w / t // power r e q u i r e d i n w a t t s 11 printf ( \ n Hence , power r e q u i r e d t o a c c e l e r a t e i s = % . 1 f kW. \ n ,p /1000) ;
1 2 3 4 5 6 7 8

17

Scilab code Exa 2.10 Cooling of hot uid in tank


1 // e x a m p l e 10 2 // c o o l i n g o f h o t f l u i d i n t a n k 3 clear 4 clc 5 disp ( s u p p o s e t h a t t h e r e i s no c h a n g e i n 6 7 8 9 10 11

k i n e t i c and p o t e n t i a l energy ) u1 =800 // i n i t i a l i n t e r n a l e n e r g y i n 800 kJ win =100 // work done by p a d d l e on s y s t e m i n kJ qout =500 // l o s s o f e n e r g y from f l u i d disp ( a p p l y i n g f i r s t law o f t h e r m o d y n a m i c s ) u2 = u1 - qout + win // f i n a l i n t e r n a l e n e r g y i n kJ printf ( \ n Hence , f i n a l i n t e r n a l e n e r g y o f t h e f l u i d i s = %. 1 f kJ . \ n , u2 ) ;

Scilab code Exa 2.11 Acceleration of air by fan


1 2 3 4 5 6 7 8 9

// e x a m p l e 11 // a c c e l e r a t i o n o f a i r by f a n clear clc v =8 // d i s c h a r g e r a t e o f a i r i n m/ s m =0.25 // mass f l o w r a t e i n kg / s p = m * v ^2/2 // a c t u a l power consumed i n W P =20 // c l a i m e d power i n W disp ( s i n c e , two p o w e r s a r e n o t e q u a l , t h i s c l a i m i s not r e a s o n a b l e )

18

Scilab code Exa 2.12 Heating eect of a fan


1 2 3 4 5 6 7 8 9 10

// e x a m p l e 12 // h e a t i n g e f f e c t o f a f a n clear clc t1 =25 // i n i t i a l t e m p e r a t u r e o f room i n C p =200 // power c o n s u m p t i o n o f f a n i n w a t t s a =30 // e x p o s e d s u r f a c e a r e a i n m2 u =6 // i n w/m2 t2 = p /( u * a ) + t1 // f i n a l temp . o f room i n C printf ( \ n Hence , t h e i n d o o r a i r t e m p e r a t u r e when steady operating conditions are established i s = %. 1 f C . \ n , t2 ) ;

Scilab code Exa 2.13 Annual lighting cost of a classroom // e x a m p l e 13 // a n n u a l l i g h t i n g c o s t o f a c l a s s r o o m clear clc p =80 // power consumed by f l u o r o s c e n t lamp i n w a t t n =30 // no . o f lamps u s e d P = p * n /1000 // l i g h t i n g power i n kW t =250*12 // o p e r a t i n g h o u r s i n a y e a r E = P * t // l i g h t i n g e n e r g y / y e a r c = E *0.07 // c o s t o f l i g h t i n g a c l a s s r o o m f o r a y e a r in d o l l a r s 11 printf ( \ n Hence , a n n u a l e n e r g y c o s t o f l i g h t i n g f o r t h e c l a s s r o o m i s = %. 0 f $ / y e a r . \ n ,c ) ;
1 2 3 4 5 6 7 8 9 10

Scilab code Exa 2.15 Cost of cooking with electric and gas charges 19

1 2 3 4 5 6 7 8 9 10 11 12 13

// e x a m p l e 15 // c o s t o f c o o k i n g w i t h e l e c t r i c and g a s c h a r g e s clear clc e1 =73 // e f f i c i e n c y o f open b u r n e r f o r e l e c t r i c u n i t s e2 =38 // e f f i c i e n c y o f open b u r n e r f o r g a s u n i t s E1 =2 // E l e c t r i c a l e n e r g y i n p u t i n 2kW q1 = E1 * e1 /100 // a c t u a l l y u t i l i s e d e l e c t r i c a l e n e r g y i n kWh c =0.09/0.73 // c o s t o f u t i l i s e d e n e r g y p e r kWh q2 = q1 /( e2 /100) // e n e r g y i n p u t t o a g a s b u r n e r i n kW c =(0.55/29.3) /( e2 /100) // c o s t o f u t i l i s e d e n e r g y o f gas burner printf ( \ n Hence , r a t e o f e n e r g y c o n s u m p t i o n by t h e b u r n e r i s = %. 2 f kW. \ n , q2 ) ; printf ( \ n The c o s t o f u t i l i s e d e n e r g y i s = $ %. 3 f / kWh . \ n ,c ) ;

Scilab code Exa 2.16 Performance of hydraulic turbine generator


1 2 3 4 5 6 7 8 9 10 11 12 13 14

// e x a m p l e 16 // p e r f o r m a n c e o f h y d r a u l i c t u r b i n e g e n e r a t o r clear clc h =50 // d e p t h o f l a k e i n m e t r e s m =5000 // mass f l o w r a t e o f w a t e r i n kg / s g =9.81 // a c c . due t o g r a v i t y i n m/ s 2 disp ( c h a n g e i n m e c h a n i c a l e n e r g y= ) e = g * h /1000 // c h a n g e i n mech . e n e r g y i n kJ / kg E1 = e * m // Rate a t which m e c h a n i c a l e n e r g y i s s u p p l i e d t o t h e t u r b i n e i n kW E2 =1862 // e l e c t r i c power g e n e r a t e d i n kW n1 = E2 / E1 // o v e r a l l e f f i c i e n c y n2 =0.95 // e f f i c i e n c y o f g e n e r a t o r n3 = n1 / n2 // e f f i c i e n c y o f t u r b i n e 20

15 W = n3 * E1 // s h a f t power o u t p u t i n kW 16 printf ( \ n Hence , o v e r a l l e f f i c i e n c y

of turbine g e n e r a t o r i s = %. 2 f . \ n , n1 ) ; 17 printf ( \ n The m e c h a n i c a l e f f i c i e n c y o f t h e t u r b i n e i s = %. 2 f . \ n , n3 ) ; 18 printf ( \ n The s h a f t power s u p p l i e d by t h e t u r b i n e t o t h e g e n e r a t o r i s =%. 0 f kW. \ n ,W )

Scilab code Exa 2.17 Cost Savings Associated with High Eciency motors
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

// e x a m p l e 17 // C o s t S a v i n g s A s s o c i a t e d w i t h High E f f i c i e n c y motors clear clc n1 =89 // e f f i c i e n c y o f f i r s t motor n2 =93.2 // e f f i c i e n c y o f s e c o n d motor c =0.08 // c o s t o f e l e c t r i c i t y i n $ /kWh p =60*0.7457 // r a t e d power i n kW h =3500 // o p e r a t i n g h o u r s p e r y e a r e = p * h *(1/( n1 /100) -1/( n2 /100) ) // e n e r g y s a v i n g s s = e * c // c o s t s a v i n g s t =640/ s // s i m p l e payback p e r i o d i n y e a r printf ( \ n Hence , t h e amount o f e n e r g y s a v e d i s = %. 0 f kWh/ y e a r . \ n ,e ) ; printf ( \ n The money s a v e d i s =%. 0 f $ / y e a r . \ n ,s ) ; printf ( \ n The payback p e r i o d i s =%. 2 f y e a r s . \ n ,t ) ;

Scilab code Exa 2.18 Reducing air pollution by geothermal heating


1 2

// e x a m p l e 18 // r e d u c i n g a i r p o l l u t i o n by g e o t h e r m a l h e a t i n g 21

3 clear 4 clc 5 s =18*10^6 // q u a n t i t y o f 6 7 8 9 10 11

n a t u r a l g a s t h a t w i l l be saved per year in therms nn =0.0047 // q u a n t i t y o f NOx i n kg / therm nc =6.4 // q u a n t i t y o f CO2 i n kg / therm sn = nn * s //NOx s a v i n g s p e r y e a r i n kg / y e a r sc = nc * s //CO2 s a v i n g s p e r y e a r i n kg / y e a r printf ( \ n Hence , g e o t h e r m a l s y s t e m w i l l s a v e %. 1 f 1 0 4 kg NOx/ y e a r . \ n , sn /10^4) ; printf ( \ n and = %. 1 f 1 0 8 kg CO2/ y e a r . \ n , sc /10^8) ;

Scilab code Exa 2.19 Heat transfer from a person


1 2 3 4 5 6 7 8 9 10 11 12

// e x a m p l e 19 // h e a t t r a n s f e r from a p e r s o n clear clc T1 =20 // room t e m p e r a t u r e i n c e l s i u s T2 =29 // body t e m p e r a t u r e o f p e r s o n i n c e l s i u s a =1.6 // e x p o s e d s u r f a c e a r e a i n m2 h =6 // c o n v e c t i o n h e a t t r a n s f e r c o e f f i c i e n t i n W/m2 C Qc = h * a *( T2 - T1 ) // h e a t l o s s due c o n v e c t i o n i n W Qr =0.95*5.67*10^ -8* a *(( T2 +273) ^4 -( T1 +273) ^4) // h e a t l o s s due t o r a d i a t i o n i n W Q = Qc + Qr // n e t h e a t l o s s from t h e p e r s o n i n W printf ( \ n Hence , t h e t o t a l r a t e o f h e a t t r a n s f e r i s =%. 1 f W. \ n ,Q )

22

Chapter 3 Properties of Pure Substances

Scilab code Exa 3.1 Pressure of Saturated Liquid in a Tank


1 // e x 1 2 // P r e s s u r e o f S a t u r a t e d L i q u i d i n a Tank 3 clc 4 Psat =70.183; // s a t u r a t e d p r e s s u r e @90C u s i n g steam 5 6 7 8 9

t a b l e A4 i n kPa printf ( From steam t a b l e P s a t @ 90 C = %. 3 f kPa , Psat ) ; vsat =0.001036; // s a t u r a t e d s p e c i f i c volume @90C i n m 3/Kg m =50; // mass i n kg V = m * vsat ; // Volume o f t a n k i n m3 printf ( \ n T o t a l Volume o f Tank = %. 4 f m3 ,V ) ;

Scilab code Exa 3.2 Temperature of Saturated Vapor in a Cylinder


1 // q u e s 2 2 // T e m p e r a t u r e o f S a t u r a t e d Vapor i n a C y l i n d e r 3 clc

23

4 5 6 7 8 9

Tsat =280.99; // S a t u r a t e d t e m p e r a t u r e i n F @ 50 p s i a from t a b l e A5E printf ( S a t u r a t e d T e m p e r a t u r e = %. 2 f F \ n , Tsat ) ; v =8.5175; // vg s a t u r a t e d volume o f v a p o r i n f t 3/ lbm t a b l e A5E V =2; // T o t a l Volume i n f t 3 m = V / v ; // mass i n lbm printf ( Mass o f t h e s a m p l e i s = %. 3 f lbm ,m ) ;

Scilab code Exa 3.3 Volume and Energy Change during Evaporation
1 // q u e s 3 2 // Volume and Energy Change d u r i n g E v a p o r a t i o n 3 clc 4 vg =1.6941; // s a t u r a t e d v a p o r s p e c i f i c volume from 5 6 7 8 9 10 11 12 13 14

t a b l e A5 @ 100 kPa i n m3/Kg vf =0.001043; // s a t u r a t e d l i q u i d s p e c i f i c volume from t a b l e A5 @ 100 kPa i n m3/Kg vfg = vg - vf ; // i n m3/Kg m =0.2; // i n kg // ( a ) Volume c h a n g e dV = m * vfg ; // Volume i n m3 printf ( ( a ) Volume c h a n g e = %. 4 f m3 \ n , dV ) ; // ( b ) Amount o f e n e r g y T r a n s f e r t o w a t e r hfg =2257.5; // c h a n g e i n e n t h a l p y from t a b l e A5 @ 100 kPa i n kJ /Kg E = m * hfg ; // I n kJ printf ( ( b ) Energy T r a n s f e r r e d = %. 1 f kJ ,E ) ;

Scilab code Exa 3.4 Pressure and Volume of a Saturated Mixture


1 2

// q u e s 4 // P r e s s u r e and Volume o f a S a t u r a t e d M i x t u r e 24

3 4 5 6 7 8 9 10 11

clc // ( a ) P r e s s u r e i n t h e t a n k P =70.183; // P s a t @ 90 C t a b l e A4 i n kPa printf ( ( a ) P r e s s u r e i n t h e t a n k = %. 3 f kPa ,P ) ; // ( b ) volume o f t a n k disp ( ( b )V = Vf+Vg = mf v f+mg vg ) ; mf =8; // mass o f l i q u i d w a t e r i n kg mg =2 // mass o f v a p o r w a t e r i n kg vf =0.001036; // s a t u r a t e d s p e c i f i c volume o f l i q u i d w a t e r from t a b l e A4 i n m3/Kg 12 vg =2.3593; // s a t u r a t e d s p e c i f i c volume o f v a p o r w a t e r from T a b l e A5 i n m3/Kg 13 V = mf * vf + mg * vg ; // T o t a l Volume i n m3 14 printf ( Volume o f t a n k = %. 2 f m3 ,V ) ;

Scilab code Exa 3.5 Properties of Saturated Liquid Vapour Mixture


1 2 3 4 5 6 7 8 9 10 11

12 13 14 15 16

// q u e s 5 // P r o p e r t i e s o f S a t u r a t e d L i q u i d Vapour M i x t u r e clc V =0.080; // volume i n m3 g i v e n m =4; // i n kg g i v e n v = V / m ; // i n m3/ kg vf =0.0007437; // @160kPa from t a b l e A4 i n m3/ kg vg =0.12348; // @160kPa from t a b l e A4 i n m3/ kg // ( a ) T e m p e r a t u r e Tsat = -15.60; // i n C from t a b l e A4 printf ( \ n ( a ) S i n c e v f <v<vg s o s a t u r a t e d r e g i o n , s o t e m p e r a t u r e a t s a t u r a t e d s t a t e = %. 2 f C \ n , Tsat ) ; // ( b ) Q u a l i t y F a c t o r x =( v - vf ) /( vg - vf ) ; printf ( ( b ) Q u a l i t y f a c t o r =%. 3 f \ n ,x ) ; // ( c ) E n t h a l p y o f r e f r i g e r a n t hf =31.21 // from t a b l e A12 @ 160 kpa i n kJ / kg 25

17 hfg =209.90 // from t a b l e A12 @ 160 kpa i n kJ / kg 18 h = hf + x * hfg ; // n kJ / kg 19 printf ( ( c ) E n t h a l p y o f r e f r i g e r a n t = %. 1 f kJ / kg \ n

,h ) ;
20 // ( d ) Volume o c c u p i e d by p h a s e 21 mg = x * m // mass o f v a p o u r n kg 22 Vg = mg * vg ; // volume o f v a p o u r i n m3 23 printf ( ( d ) Volume o f v a p o u r =%. 4 f m3 \ n , Vg ) ;

Scilab code Exa 3.7 Internal Energy of Superheated Vapor using linear interpolation
1 2 3 4

5 6 7 8 9 10 11

// e x 6 // I n t e r n a l Energy o f S u p e r h e a t e d Vapor u s i n g l i n e a r interpolation clc disp ( h1 = 2 8 5 5 . 8 @ T1=200 C and h2 = 2 9 6 1 . 0 @ T2=250 C and h=2890 l i e s i n b e t w e e n t h e s e two s o u s i n g l i n e a r i n t e r p o l a t i o n we can g e t T e m p e r a t u r e ) ; h1 =2855.8; // E n t h a l p y a t T1 i n kJ /Kg T1 =200; // temp i n C h2 =2961.0; // E n t h a l p y a t T2 i n kJ /Kg T2 =250; //Temp T2 i n C h =2890; // E n t h a l p y i n kJ / kg a t which temp i s t o be determined T =( T2 - T1 ) /( h2 - h1 ) *( h - h1 ) + T1 ; //Temp f o r g i v e n v a l u e of enthalpy in C printf ( T e m p e r a t u r e = %. 1 f C ,T ) ;

Scilab code Exa 3.8 Approximating Compressed Liquid as Saturated Liquid


1

// q u e s 8 26

2 3 4 5 6 7 8 9

// A p p r o x i m a t i n g Compressed L i q u i d a s S a t u r a t e d Liquid clc u1 =333.82; // ( a ) i n t e r n a l e n e r g y i n KJ/Kg @ P=5MPa and T=80 C from t a b l e A7 printf ( \ n ( a ) Data a s from c o m p r e s s l i q u i d t a b l e , u= %. 2 f kJ / kg \ n , u1 ) ; u2 =334.97; // ( b ) i n t e r n a l e n e r g y i n KJ/Kg @80 C from t a b l e A4 printf ( ( b ) Data a s from s a t u r a t e d l i q u i d t a b l e , u = %. 2 f kJ / kg , u2 ) ; er =( u2 - u1 ) / u1 *100; // ( c ) %age e r r o r printf ( \ n ( c ) E r r o r i n v o l v e d = %. 2 f p e r c e n t , er ) ;

Scilab code Exa 3.10 Mass of Air in a Room // q u e s 1 0 // Mass o f A i r i n a Room clc l =4; // l e n g t h i n m e t r e s b =5; // b r e a d t h i n m e t r e s h =6; // h e i g h t i n m e t r e s V = l * b * h ; // volume i n m3 P =100; // P r e s s u r e i n kPa R =0.287; // Gas c o n s t a n t f o r a g i v e n g a s i n kPa .m3/Kg .k 10 T =298; //Temp i n K 11 m = P * V /( R * T ) ; // mass i n Kg 12 printf ( Mass =P V/ (RT)= %. 1 f kg ,m ) ;
1 2 3 4 5 6 7 8 9

Scilab code Exa 3.11 The Use of Generalized Charts


1

// q u e s 1 1 27

2 // The Use o f G e n e r a l i z e d C h a r t s 3 clear 4 clc 5 // ( a ) s p e c i f i c volume u s i n g i d e a l 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

gas equation of state R =0.0815; // g a s c o n s t a n t f o r g i v e n s u b s t a n c e i n kPa .m 3/Kg . K Pcr =4.059; // C r i t i c a l P r e s s u r e i n MPa Tcr =374.2; // C r i t i c a l Temp i n K T =323; //Temp i n K P =1000; // P r e s s u r e i n kPa v = R * T / P ; // S p e c i f i c Volume i n m3/Kg printf ( \ n ( a ) S p e c i f i c Volume = %. 6 f m3/ kg ,v ) ; er =( v -0.021796) /0.021796; // e r r o r printf ( \ n E r r o r = %. 3 f , er ) ; // ( b ) s p e c i f i c volume u s i n g c h a r t Pr = P / Pcr ; // r e d u c e d p r e s s u r e Tr = T / Tcr ; // r e d u c e d T e m p e r a t u r e Z =0.84; // from c o m p r e s s i b i l i t y c h a r t Videal = Z * v ; // I d e a l Volume i n m3/ kg printf ( \ n ( b ) I d e a l volume = %. 6 f m3/ kg , Videal ) ; er =( Videal -0.021796) /0.021796; // e r r o r printf ( \ n E r r o r = %. 3 f , er ) ;

Scilab code Exa 3.12 Using Generalized Charts to Determine Pressure


1 // q u e s 1 2 2 // U s i n g G e n e r a l i z e d C h a r t s t o D e t e r m i n e P r e s s u r e 3 clc 4 // ( a ) 5 R =0.5956; // Gas c o n s t a n t f o r a g i v e n s u b s t a n c e i n

p s i a . f t 3/ lbm . R 6 Pcr =3200; // C r i t i c a l P r e s s u r e i n p s i a 7 Tcr =1164.8; // C r i t i c a l Temp i n R 8 v =0.51431; // s p e c i f i c volume i n f t 3/ lbm 28

9 T =600; // T e m p e r a t u r e i n F 10 // s o 11 P =1000; // P r e s s u r e i n p s i a from T a b l e A6E 12 printf ( \ n ( a ) P r e s s u r e a t a s p e c i f i e d s t a t e = %. 0 f 13 14 15 16 17 18 19 20 21 22 23

p s i a ,P ) ; // ( b ) T =1060; // T e m p e r a t u r e i n F P = R * T / v ; // P r e s s u r e i n p s i a printf ( \ n ( b ) P r e s s u r e o f t h e steam u n d e r s p e c i f i e d c o n d i t i o n = %. 0 f p s i a ,P ) ; // ( c ) u s i n g g e n e r a l i s e d c o m p r e s s i b i l i t y c h a r t Vr = v * Pcr /( R * Tcr / Pcr ) ; // r e d u c e d volume Tr = T / Tcr ; // r e d u c e d t e m p e r a t u r e // s o Pr =0.33; // from c o m p r e s s i b i l i t y c h a r t P = Pr * Pcr ; // f i n a l P r e s s u r e i n p s i a printf ( \ n ( c ) P r e s s u r e ( u s i n g g e n e r a l i s e d c o m p r e s s i b i l i t y c h a r t ) = %. 0 f p s i a ,P ) ;

Scilab code Exa 3.13 Dierent Methods of Evaluating Gas Pressure // e x 1 3 // D i f f e r e n t Methods o f E v a l u a t i n g Gas P r e s s u r e clear clc T =175 // temp i n K v =0.00375 // s p e c i f i c volume i n m3/ kg // ( a ) i d e a l g a s e q u a t i o n o f s t a t e // d a t a from t a b l e A1 R =0.2968 // g a s c o n s t a n t f o r a g i v e n g a s i n kPa .m3/ kg .K 10 P = R * T / v ; // P r e s s u r e i n kPa 11 printf ( \ n ( a ) P r e s s u r e from I d e a l g a s e q u a t i o n = %. 0 f kPa \ n ,P ) ; 12 // ( b ) van d e r w a a l s e q u a t i o n
1 2 3 4 5 6 7 8 9

29

13 // a and b a r e van d e r w a a l s c o n s t a n t 14 a =0.175; //m 6 . kPa /Kg2 15 b =0.00138; //m3/Kg 16 P = R * T /( v - b ) -a / v ^2; // p r e s s u r e i n kPa 17 printf ( ( b ) P r e s s u r e from van d e r w a a l s e q u a t i o n = % 18 19 20 21 22 23 24 25 26 27 P = Ru * T / V ^2*(1 - c /( V * T ^3) ) *( V + B ) -A / V ^2; // p r e s s u r e 28

. 0 f kPa \ n ,P ) ; // ( c ) B e a t t i e Bridgeman e q u a t i o n A =102.29 // c o n s t a n t B =0.05378 // c o n s t a n t c =4.2*10^4; // c o n s t a n t Ru =8.314; // u n i v e r s a l g a s c o n s t a n t v a l u e MM =28.013 // m o l e c u l a r Mass o f s u b s t a n c e v =0.00375 // s p e c i f i c volume i n Kg/m3 V = MM * v // Volume i n m3

in

KPa printf ( ( c ) P r e s s u r e from B e a t t i e Bridgeman e q u a t i o n = %. 0 f kPa \ n ,P ) ;

Scilab code Exa 3.14 Temperature Drop of a Lake Due to Evaporation


1 2 3 4 5 6 7 8 9 10 11 12

// q u e s 1 4 // T e m p e r a t u r e Drop o f a Lake Due t o E v a p o r a t i o n clear clc Psat =3.17 // s a t u r a t e d p r e s s u r e i n kPa @ 25 C Pv1 =0.1* Psat // p r e s s u r e f o r 10% h u m i d i t y i n kPa Pv2 =0.8* Psat // p r e s s u r e f o r 80% h u m i d i t y i n kPa Pv3 =1* Psat // p r e s s u r e f o r 100% h u m i d i t y i n kPa T1 = -8.0; //Temp i n K T2 =21.2; //Temp i n K T3 =25; //Temp i n K printf ( C o r r e s p o n d i n g T e m p e r a t u r e s ( i n C) a r e ( From t a b l e A 5) \ n T1 = %. 1 f K \ n T2 = %. 1 f K \ n T3 = 30

%. 1 f K ,T1 , T2 , T3 ) ;

31

Chapter 4 Energy Analysis of Closed Systems

Scilab code Exa 4.2 Boundary Work for a Constant Pressure Process
1 2 3 4 5 6 7 8 9 10

// q u e s 2 // Boundary Work f o r a C o n s t a n t P r e s s u r e P r o c e s s clear clc m =10 // mass i n lbm P =60 // p r e s s u r e i n p s i a // from t a b l e A6 E v2 =8.3548 // s p e c i f i c volume a t s t a t e 1 i n Kg/m3 v1 =7.4863 // s p e c i f i c volume a t s t a t e 2 i n Kg/m3 w = integrate ( m P , v ,v1 , v2 ) /5.404; // d i v i d e d by 5 . 4 0 4 t o c o n v e r t i t i n t o Btu 11 printf ( Work done by steam = %. 2 f Btu ,w ) ;

Scilab code Exa 4.3 Isothermal Compression of an Ideal Gas


1

// q u e s 3 32

// I s o t h e r m a l C o m p r e s s i o n o f an I d e a l Gas clc P1 =100 // I n i t i a l P r e s s u r e i n kPa V1 =0.4; // I n i t i a l Volume i n m3 V2 =0.1; // f i n a l Volume i n m3 w = P1 * V1 * log ( V2 / V1 ) ; // work done f o r I s o t h e r m a l p r o c e s s i n kJ 8 printf ( Work done = %. 1 f kJ ,w ) ;
2 3 4 5 6 7

Scilab code Exa 4.4 Expansion of a Gas against a spring


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

// q u e s 4 // E x p a n s i o n o f a Gas a g a i n s t a s p r i n g clear clc V1 =0.05 // i n i t i a l volume i n m3 V2 =2* V1 // f i n a l volume i n m3 A =0.25 // a r e a o f c r o s s s e c t i o n i n m2 k =150 // s p r i n g c o n s t a n t i n kN/m // ( a ) x =( V2 - V1 ) / A // d i s p l a c e m e n t o f p i s t o n i n m F = k * x // S p r i n g f o r c e i n kN P1 = F / A // p r e s s u r e i n kPa due t o p i s t o n Po =200 // i n i t i a l p r e s s u r e i n kPa P = P1 + Po ; // f i n a l p r e s s u r e i n kPa printf ( \ n ( a ) F i n a l p r e s s u r e = %. 0 f kPa \ n ,P ) ; // ( b ) w =( Po + P ) /2*( V2 - V1 ) ; // i n kJ printf ( ( b ) Work done = %. 0 f kJ \ n ,w ) ; // ( c ) wspring =( P - Po ) /2* V1 ; printf ( ( c ) F r a c t i o n o f work done by s p r i n g = %. 0 f kJ \ n , wspring ) ;

33

Scilab code Exa 4.5 Electric Heating of a Gas at Constant Pressure


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

// q u e s 5 // E l e c t r i c H e a t i n g o f a Gas a t C o n s t a n t P r e s s u r e clear clc V =120 // v o l t a g e i n V I =0.2 // c u r r e n t i n Ampere t =300 // t i m e i n s e c We = V * I * t /1000 // work done i n kJ //1 i n i t i a l c o n d i t i o n P1 =400 // kPa i n i t i a l P r e s s u r e V1 =0.5 // Volume i n m3 R =0.297 // g a s c o n s t a n t f o r w a t e r T1 =300 //Temp i n K m =0.025; // mass i n kg // ( a ) From Energy e q u a t i o n WeQout=dH=m( h2h1 ) // i . e . h2=(WeQout ) / (m)+h1 // ( b ) F i n a l T e m p e r a t u r e Qout =3.7 // h e a t o u t i n kJ h1 =2724.9 // I n i t i a l E n t h a l p y i n kJ / kg h2 =( We - Qout ) /( m ) + h1 ; // f i n a l E n t h a l p y i n kJ / kg // So from steam t a b l e A6 T2 =200; //Temp i n C f o r P2=300kPa and h2 printf ( F i n a l T e m p e r a t u r e T2 = %. 0 f C , T2 ) ;

Scilab code Exa 4.7 Evaluation of the du of an Ideal Gas


1 // q u e s 7 2 // E v a l u a t i o n o f t h e du o f an I d e a l Gas 3 clear 4 clc

34

6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

// ( a ) One way o f d e t e r m i n i n g t h e c h a n g e i n i n t e r n a l e n e r g y o f a i r i s t o r e a d t h e v a l u e s a t T1 and T2 from T a b l e A 1 7 and t a k e t h e d i f f e r e n c e u1 =214.07; // i n t e r n a l e n e r g y i n kJ @ 300K u2 =434.78; // I n t e r n a l e n e r g y i n kJ @ 600K du = u2 - u1 ; // Change i n i n i n t e r n a l e n e r g y i n kJ printf ( ( a ) Change i n I n t e r n a l Energy ( from a i r d a t a t a b l e ) = %. 2 f kJ \ n , du ) ; // ( b ) t h e f u n c t i o n a l form o f t h e s p e c i f i c h e a t ( Table A 2 c ) // c o n s t a n t a =28.11; b =0.1967*10^ -2; c =0.4802*10^ -5; d = -1.966*10^ -9; Ru =8.314; // U n i v e r s a l g a s c o n s t a n t //Cp=a+b T+c T2+d T 3 ; //Cv=CpRu T1 =300; // I n i t i a l Temp i n K T2 =600; // F i n a l temp i n K U = integrate ( aRu+b T+c T2+d T3 , T ,T1 , T2 ) ; M =28.97; // m o l i c u l a r mass u = U / M ; // s p e c i f i c i n t e r n a l e n e r g y i n KJ/Kg printf ( ( b ) Change i n I n t e r n a l Energy u s i n g f u n c t i o n a l form o f t h e s p e c i f i c h e a t = %. 2 f kJ \ n ,u ) ;

26 27 // ( c ) t h e a v e r a g e s p e c i f i c h e a t v a l u e ( T a b l e A 2 b ) 28 Tavg =( T1 + T2 ) /2; // avg temp i n K 29 Cv =0.733; // h e a t c a p a c i t y a t c o n s t a n t volume i n kJ /K

@Tavg from Table 2A 30 u = Cv *( T2 - T1 ) ; // a v e r a g e c h a n g e i n i n t e r n a l e n e r g y i n kJ / kg 31 printf ( ( c ) Change i n I n t e r n a l Energy u s i n g avg s p e c i f i c h e a t v a l u e = %. 2 f kJ / kg ,u ) ;

35

Scilab code Exa 4.8 Heating of a Gas in a Tank by Stirring // q u e s 8 // H e a t i n g o f a Gas i n a Tank by S t i r r i n g clear clc // ( a ) F i n a l Temp w =0.02 // power i n hp t =0.5 // t i m e i n h o u r W = w * t *2545 // p a d d l e w h e e l work i n Btu // As W =m Cavg ( T2T1 ) i e T2= W/ (m Cavg )+T1 m =1.5 // mass i n lbm T1 =80 // t e m p e r a t u r e i n F Cavg =0.753 // a v e r a g e s p e c i f i c h e a t a t c o n s t t volume i n Btu /F 13 T2 = W /( m * Cavg ) + T1 ; //Temp i n F 14 printf ( ( a ) T e m p e r a t u r e = %. 1 f F \ n , T2 ) ;
1 2 3 4 5 6 7 8 9 10 11 12 15 16 17 18 19 20 21 22

// ( b ) The f i n a l p r e s s u r e i s d e t e r m i n e d from t h e i d e a l g a s r e l a t i o n // P1V1/T1=P2V2/T2 t e m p e r a t u r e i n r a n k i n e o r k e l v i n T1 = T1 +460 // c o n v e r t e d t o R T2 = T2 +460 // c o n v e r t e d t o R P1 =50 // p r e e s u r e a t 1 s t s t a t e i n p s i a P2 = P1 * T2 / T1 ; // f i n a l P r e s s u r e i n p s i a printf ( ( b ) F i n a l P r e s s u r e = %. 1 f p s i a , P2 ) ;

Scilab code Exa 4.10 Heating of a Gas at Constant Pressure


1 2 3

// q u e s 1 0 // H e a t i n g o f a Gas a t C o n s t a n t P r e s s u r e clear 36

4 clc 5 // ( a ) The f i n a l 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

t e m p e r a t u r e can be d e t e r m i n e d by u s i n g t h e i d e a l g a s r e l a t i o n b /w s t a t e 1 and 3 P1 =150 // p r e s s u r e a t s t a t e 1 i n kPa P3 =350 // p r e s s u r e a t s t a t e 2 i n kPa T1 =300 // t e m p e r a t u r e a t s t a t e 1 i n K //V3=2V1 //T3=P3 V3 / ( P1 V1 ) T1 ; T3 = P3 *2/ P1 * T1 ; // t e m p e r a t u r e a t s t a t e 2 i n K printf ( ( a ) F i n a l T e m p e r a t u r e = %. 0 f K \ n , T3 ) ; // ( b ) The work done i s a r e a u n d e r t h e p r o c e s s c u r v e on PV d i a g r a m V2 =0.8 // Volume a t s t a t e 2 i n m3 V1 =0.4 // volume a t s t a t e 1 i n m3 P2 =350 // p r e s s u r e a t s t a t e 2 i n kPa W13 =( V2 - V1 ) * P2 ; // workdone f o r p r o c e s s 1 3 i n kJ printf ( ( b ) Work Done = %. 0 f kJ \ n ,W13 ) ;

// ( c ) Mass o f t h e s y s t e m can be d e t e r m i n e d by i d e a l gas equation R =0.287 // g a s c o n s t a n t f o r a g i v e n s u b s t a n c e w a t e r i n kJ / mol . K m = P1 * V1 /( R * T1 ) // mass i n kg // from T a b l e A7 u1 =214.07 // i n t e r n a l e n e r g y a t s t a t e 1 i n kJ / kg @300K u2 =1113.52 // i n t e r n a l e n e r g y a t s t a t e 2 i n kJ / kg @1400K // from e n e r g y e q u a t i o n Qout =140 // h e a t o u t p u t i n kJ Qin = Qout + m *( u2 - u1 ) ; // h e a t i n p u t i n kJ printf ( ( c ) Heat i n p u t = %. 0 f kJ , Qin ) ;

Scilab code Exa 4.11 Enthalpy of Compressed Liquid

37

1 // q u e s 1 1 2 // E n t h a l p y o f Compressed L i q u i d 3 clear 4 clc 5 // t h e w a t e r e x i s t s a s a c o m p r e s s e d 6 7 8 9 10 11 12

l i q u i d at the

specified state // ( a ) u s i n g c o m p r e s s e d l i q u i d t a b l e P =15000; // p r e s s u r e i n kPa T =100; // t e m p e r a t u r e i n C h =430.39; // h e a t o f w a t e r i n kJ / kg from T a b l e A7 printf ( ( a ) Heat o f w a t e r u s i n g c o m p r e s s e d l i q u i d t a b l e = %. 2 f kJ / kg \ n ,h ) ;

// ( b ) A p p r o x i m a t i n g t h e c o m p r e s s e d l i q u i d a s a s a t u r a t e d l i q u i d a t 100 C 13 h =419.17; // h e a t o f w a t e r a t l i q u i d s t a t e i n kJ /Kg i e h f @ 100C 14 printf ( ( b ) Heat o f Water by a p p r o x i m a t i n g c o m p r e s s e d l i q u i d a s s a t u r a t e d = %. 2 f kJ / kg \ n ,h );


15 16 // ( c ) U s i n g c o r r e c t i o n method 17 vf =0.001 // s p e c i f i c volume o f w a t e r i n s a t u r a t e d

l i q u i d s t a t e @100C 18 Psat =101.42 // s a t u r a t e d p r e s s u r e i n kPa from T a b l e 19 h = h + vf *( P - Psat ) // c o r r e c t e d v a l u e o f h e a t o f w a t e r a t g i v e n s t a t e i n kJ / kg 20 printf ( ( c ) Heat o f w a t e r u s i n g c o r r e c t i o n method = %. 2 f kJ / kg ,h ) ;

Scilab code Exa 4.12 Cooling of an Iron Block by Water


1 2 3

// q u e s 1 2 // C o o l i n g o f an I r o n B l o c k by Water clear 38

4 5 6 7 8 9 10 11 12 13 14 15 16 17

clc V =0.5 // volume i n m3 v =0.001 // s p e c i f i c volume o f w a t e r i n m3/Kg m = V / v // mass i n kg // d U i r o n+dUwater=0 i e c h a n g e i n i n t e r n a l e n e r g y o f system = 0 // mi Ci ( T2T1i )+mwCw ( T2T1w ) =0 mi =50 // mass o f i c e i n Kg mw =500 // mass o f w a t e r i n Kg Ci =0.45 // s p e c i f i c h e a t o f i c e i n kJ / mol Cw =4.18 // s p e c i f i c h e a t o f w a t e r i n kJ / mol T1i =80 // i n i t i a l t e m p e r a t u r e o f i c e i n C T1w =25 // i n i t i a l t e m p e r a t u r e o f w a t e r i n C T2 =( mi * Ci * T1i + mw * Cw * T1w ) /( mi * Ci + mw * Cw ) ; // f i n a l temperature of mixture in C printf ( F i n a l t e m p e r a t u r e = %. 1 f C , T2 ) ;

39

Chapter 5 Mass and Energy Analysis of Control Volumes

Scilab code Exa 5.1 water ow through garden hose nozzle


1 2 3 4 5 6 7 8 9 10 11

// e x a m p l e 1 // w a t e r f l o w t h r o u g h g a r d e n h o s e n o z z l e clear clc t =50 // t i m e t a k e n t o f i l l t h e b u c k e t i n s e c o n d s v =10 // volume o f b u c k e t i n g a l l o n V = v *3.7854/ t // volume f l o w r a t e i n l i t r e s / s e c o n d d =1 // d e n s i t y o f w a t e r i n kg / l M = V * d // mass f l o w r a t e i n kg / s A = %pi *(0.4) ^2*10^ -4 // a r e a o f e x i t i n m2 v1 = V /( A *1000) // a v e r a g e v e l o c i t y o f w a t e r a t e x i t i n m/ s 12 printf ( \ n Hence , t h e volume f l o w r a t e o f w a t e r t h r o u g h t h e h o s e i s = %. 3 f L/ s . \ n ,V ) ; 13 printf ( \ n The mass f l o w r a t e t h r o u g h t h e h o s e i s = %. 3 f kg / s . \ n ,M ) ; 14 printf ( \ n The a v e r a g e v e l o c i t y o f w a t e r a t t h e n o z z l e e x i t i s = %. 1 f m/ s . \ n , v1 ) ;

40

Scilab code Exa 5.2 Discharge of water from a tank // e x a m p l e 2 // d i s c h a r g e o f w a t e r from a t a n k clear clc h0 =4 // h e i g h t o f c y l i n d r i c a l w a t e r t a n k i n f t h2 =2 // f i n a l w a t e r l e v e l i n t a n k i n f t g =32.2 // a c c . due t o g r a v i t y i n f t / s 2 Dt =3*12 // d i a m e t e r o f t a n k i n i n c h e s Djet =0.5 // d i a m e t e r o f w a t e r j e t i n i n c h e s t =( h0 ^0.5 - h2 ^0.5) *( Dt ) ^2/(( Djet ) ^2*( g /2) ^0.5) // t i m e taken f o r water l e v e l to f a l l to h a l f of i t s i n i t i a l value in seconds 11 printf ( \ n Hence , t h e t i m e t a k e n f o r w a t e r l e v e l t o f a l l t o h a l f o f i t s i n i t i a l v a l u e i s = %. 1 f min . \ n ,t /60) ;
1 2 3 4 5 6 7 8 9 10

Scilab code Exa 5.3 Energy transport by mass


1 // e x a m p l e 3 2 // e n e r g y t r a n s p o r t by mass 3 clear 4 clc 5 vf =0.001053 // s p e c i f i c volume o f

saturated liquid

w a t e r i n m3/ kg 6 vg =1.1594 // s p e c i f i c volume o f w a t e r v a p o u r i n m3/ kg 7 ug =2519.2 // s p e c i f i c i n t e r n a l e n e r g y o f w a t e r v a p o u r kJ / kg 8 hg =2693.1 // s p e c i f i c e n t h a l p y o f w a t e r v a p o u r kJ / kg

41

10

11 12 13 14 15 16 17 18 19 20 21 22

disp ( S a t u r a t i o n c o n d i t i o n s e x i s t i n a p r e s s u r e cooker at a l l times a f t e r the steady operating conditions are established ) disp ( T h e r e f o r e , t h e l i q u i d h a s t h e p r o p e r t i e s o f s a t u r a t e d l i q u i d and t h e e x i t i n g steam h a s t h e p r o p e r t i e s o f s a t u r a t e d vapor at the o p e r a t i n g pressure . ) m =0.6/( vf *1000) // r e d u c t i o n i n mass o f l i q u i d i n p r e s s u r e c o o k e r i n kg M = m /(40*60) // mass f l o w r a t e o f steam i n kg / s A =8*10^ -6 // e x i t a r e a i n m2 V = M * vg / A // e x i t v e l o c i t y i n m/ s e = hg - ug // f l o w e n e r g y o f steam i n kJ / kg TE = hg // t o t a l n e r g y o f steam i n kJ / kg E = M * hg // e n e r g y f l o w r a t e o f steam l e a v i n g c o o k e r i n kW printf ( \ n Hence , The mass f l o w r a t e o f t h e steam i s = %. 6 f kg / s . \ n ,M ) ; printf ( \ n The e x i t v e l o c i t y i s = %. 1 f m/ s . \ n ,V ) ; printf ( \ n The t o t a l e n e r g y o f t h e steam i s = %. 1 f kJ / k f . \ n , TE ) ; printf ( \ n The f l o w e n e r g y o f t h e steam i s = %. 1 f kJ / kg . \ n ,e ) ; printf ( \ n The r a t e a t which e n e r g y l e a v e s t h e c o o k e r by steam i s = %. 3 f kW. \ n ,E ) ;

Scilab code Exa 5.4 Deceleration of air in diuser


1 // e x a m p l e 4 2 // d e c e l e r a t i o n o f a i r i n 3 clear 4 clc 5 disp ( we assume t h a t A i r

diffuser

i s an i d e a l g a s s i n c e i t i s a t a h i g h t e m p e r a t u r e and low p r e s s u r e r e l a t i v e t o i t s c r i t i c a l p o i n t v a l u e s ) 42

6 7 8 9 10 11 12 13 14 15 16 17 18 19

T1 =283 // I n i t i a l temp . o f a i r i n k e l v i n s P1 =80 // i n i t i a l p r e s s u r e o f a i r i n kPa R =0.287 // g a s c o n s t a n t i n kPam3/ kg K A1 =0.4 // i n l e t a r e a i n m2 v1 =200 // i n i n t i a l v e l o c i t y o f a i r i n m/ s V1 = R * T1 / P1 // s p e c i f i c volume o f a i r i n m3/ kg m = v1 * A1 / V1 // mass f l o w r a t e i n kg / s h1 =283.14 // s p e c i f i c e n t h a l p y o f a i r i n kJ / kg v2 =0 // e x i t v e l o c i t y i s v e r y s m a l l compared t o initial velocity h2 = h1 -( v2 ^2 - v1 ^2) /2000 // f i n a l s p e c i f i c e n t h a l p y o f a i r i n kJ / kg disp ( from steam t a b l e , t h e t e m p e r a t u r e corresponding to t h i s value of enthalpy i s ) T2 =303 //Temp . o f a i r l e a v i n g t h e d i f f u s e r i n K printf ( \ n Hence , The mass f l o w r a t e o f t h e a i r i s = %. 1 f kg / s . \ n ,m ) ; printf ( \ n The temp . o f a i r l e a v i n g t h e d i f f u s e r i s = %. 0 f K . \ n , T2 ) ;

Scilab code Exa 5.5 Acceleration of steam in nozzle


1 // e x a m p l e 5 2 // a c c e l e r a t i o n o f steam i n n o z z l e 3 clear 4 clc 5 P1 =250 // i n i t i a l p r e s s u r e o f steam i n p s i a 6 T1 =700 // i n i t i a l t e m p e r a t u r e o f steam i n F 7 disp ( The s p e c i f i c volume and e n t h a l p y o f steam a t

the nozzle i n l e t are ) 8 v1 =2.6883 // s p e c i f i c volume o f steam a t t h e n o z z l e i n l e t i n f t 3 / lbm 9 h1 =1371.4 // s p e c i f i c e n t h a l p y o f steam a t t h e n o z z l e i n l e t i n Btu / lbm 10 A1 =0.2 // i n l e t a r e a i n f t 2 43

11 M =10 // mass f l o w

r a t e o f steam t h r o u g h n o z z l e i n

lbm / s
12 V1 = M * v1 / A1 // i n l e t v e l o c i t y i n f t / s 13 qout =1.2 // h e a t l o s s i n Btu / lbm 14 v2 =900 // e x i t v e l o c i t y i n f t / s 15 h2 = h1 - qout -( v2 ^2 - v1 ^2) /(2*25037) // e n t h a l p y 16

after

exit disp ( from steam t a b l e , t h e temp . c o r r e s p o n d i n g t o t h i s p r e s s u r e and s p e c i f i e n t h a l p y i s ) 17 T2 =662.0 // / i n F 18 printf ( \ n Hence , t h e i n l e t v e l o c i t y i s = %. 1 f f t / s . \ n , V1 ) ; 19 printf ( \ n The e x i t temp . o f t h e seam i s = %. 0 f F . \ n , T2 ) ;

Scilab code Exa 5.6 Compressing air by compressor


1 // e x a m p l e 6 2 // c o m p r e s s i n g a i r by c o m p r e s s o r 3 clear 4 clc 5 m =0.02 // mass f l o w r a t e o f t h e a i r i n kg / s 6 qout =16 // h e a t l o s s d u r i n g t h e p r o c e s s i n kJ / kg 7 h1 =280.13 // s p e c i f i c e n t h a l p y o f a i r a t 280K i n kJ /

kg
8 h2 =400.98 // s p e c i f i c

e n t h a l p y o f a i r a t 400K i n kJ /

kg
9 win = m * qout + m *( h2 - h1 ) // power i n p u t t o c o m p r e s s o r

i n kW 10 printf ( \ n Hence , t h e power i n p u t t o t h e c o m p r e s s o r i s = %. 2 f kW. \ n , win ) ;

Scilab code Exa 5.7 Power generation by steam turbine 44

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

23 24 25 26 27

// e x a m p l e 7 // power g e n e r a t i o n by steam t u r b i n e clear clc P1 = 2 // i n i t i a l p r e s s u r e o f steam i n MPa T1 = 400 // i n i t i a l temp . o f steam i n C V1 = 50 // i n i t i a l v e l o c i t y o f steam i n m/ s z1 = 10 // h e i g h t o f i n l e t i n m e t r e s h1 =3248.4 // i n i t i a l s p e c i f i c e n t h a l p y o f a i r i n kJ / kg P2 = 15 // f i n a l p r e s s u r e o f a i r i n kPa V2 = 180 // f i n a l v e l o c i t y o f a i r i n m/ s z2 = 6 // e x i t h e i g h t i n m x2 =0.9 // q u a l i t y o f steam a f t e r e x i t disp ( At t u r b i n e e x i t , we o b v i o u s l y have l i q u i d v a p o u r m i x t u r e a t 15 kPa . ) hf =225.94 // i n kJ / kg hfg =2372.3 // i n kJ / kg h2 = hf + x2 * hfg // f i n a l s p e c i f i c e n t h a l p y o f m i x t u r e i n kJ / kg dh = h2 - h1 // c h a n g e i n e n t h a l p y o f steam i n kJ / kg dke =( V2 ^2 - V1 ^2) /2000 // c h a n g e i n k i n e t i c e n e r g y o f steam i n kJ / kg g =9.8 // a c c . due t o g r a v i t y i n m/ s 2 dpe = g *( z2 - z1 ) /1000 // c h a n g e i n p o t e n t i a l e n e r g y o f steam i n kJ / kg wout = -(( h2 - h1 ) +( V2 ^2 - V1 ^2) /2000+ g *( z2 - z1 ) /1000) // work done p e r u n i t mass o f t h e steam f l o w i n g t h r o u g h t h e t u r b i n e i n kJ / kg m =5000/ wout // mass f l o w r a t e o f steam i n kg / s printf ( \ n The v a l u e o f dh i s = %. 2 f kJ / kg . \ n , dh ) ; printf ( \ n The v a l u e o f dke i s = %. 2 f kJ / kg . \ n , dke ); printf ( \ n The v a l u e o f dpe i s = %. 2 f kJ / kg . \ n , dpe ); printf ( \ n The work done p e r u n i t mass o f t h e steam f l o w i n g t h r o u g h t h e t u r b i n e i s = %. 2 f kJ / kg . \ n , wout ) ; 45

28

printf ( \ n The mass f l o w r a t e o f t h e steam i s = %. 2 f kg / s . \ n ,m ) ;

Scilab code Exa 5.8 Expansion of refrigant 134a in refrigerator


1 // e x a m p l e 8 2 // e x p a n s i o n o f r e f r i g a n t 134 a i n r e f r i g e r a t o r 3 clear 4 clc 5 disp ( R e f r i g e r a n t 134 a t h a t e n t e r s a c a p i l l a r y t u b e

6 7 8 9

10 11 12 13 14 15 16 17 18 19 20 21

a s s a t u r a t e d l i q u i d . T h e r e f o r e , from t a b l e o f r e f r i g e r a n t 134 a ) P1 =0.8 // i n i t i a l p r e s s u r e i n MPa T1 =31.31 // i n i t i a l temp . i n C e l s i u s h1 =95.47 // i n i t i a l s p e c i f i c e n t h a l p y i n kJ / kg disp ( Flow t h r o u g h a c a p i l l a r y t u b e i s a t h r o t t l i n g p r o c e s s . Thus , t h e e n t h a l p y o f t h e r e f r i g e r a n t remains constant ) h2 = h1 // f i n a l s p e c i f i c e n t h a l p y P2 =0.12 // f i n a l p r e s s u r e i n MPa T2 = -22.32 // f i n a l temp . i n C e l s i u s hf =22.49 // i n kJ / kg hg =236.97 // i n kJ / kg hfg = hg - hf // i n kJ / kg disp ( O b v i o u s l y hf <h2<hg t h u s , t h e r e f r i g e r a n t e x i s t s as a saturated mixture at the e x i t s t a t e ) disp ( Thus q u a l i t y a t t h i s s t a t e i s ) x =( h2 - hf ) / hfg dT = T2 - T1 // i n C e l s i u s printf ( \ n The q u a l i t y o f t h e r e f r i g e r a n t a t t h e f i n a l s t a t e i s = %. 3 f . \ n ,x ) ; printf ( \ n The temp . d r o p d u r i n g t h i s p r o c e s s i s = % . 2 f C . \ n , dT ) ;

46

Scilab code Exa 5.9 Mixing of Hot and Cold Waters in a Shower
1 // e x a m p l e 9 2 // M i x i n g o f Hot and Cold Waters i n a Shower 3 clear 4 clc 5 disp ( We t a k e t h e chamber a s s y s t e m . Then , t h e r e a r e 6 7 8 9 10

two i n l e t s and one e x i t ) h3 =78.02 // e n t h a l p y a t 110 F i n Btu / lbm h2 =18.07 // e n t h a l p y a t 50 F i n Btu / lbm h1 =107.99 // e n t h a l p y a t 140F i n Btu / lbm y =( h3 - h2 ) /( h1 - h3 ) // mass r a t i o o f h o t t o c o l d w a t e r printf ( \ n The mass r a t i o o f h o t t o c o l d w a t e r i s = %. 1 f . \ n ,y ) ;

Scilab code Exa 5.10 Cooling of refrigant 134a by water


1 // e x a m p l e 10 2 // c o o l i n g o f r e f r i g a n t 134 a by w a t e r 3 clear 4 clc 5 disp ( We t a k e t h e e n t i r e h e a t e x c h a n g e r a s t h e

6 7 8 9 10 11

s y s t e m . T h i s i s a c o n t r o l volume s i n c e mass c r o s s e s t h e s y s t e m boundary d u r i n g t h e p r o c e s s . ) disp ( For e a c h f l u i d s t r e a m s i n c e t h e r e i s no m i x i n g . Thus , m1=m2=mh and m3=m4=mr ) mr =6 // mass f l o w r a t e o f R 134 a i n kg / min h1 =62.982 // s p e c i f i c e n t h a l p y o f w a t e r i n kJ / kg h2 =104.83 // s p e c i f i c e n t h a l p y o f w a t e r i n kJ / kg P3 =1 // p r e s s u r e o f R 134 a a t i n l e t i n MPa T3 =70 // t e m p e r a t u r e o f R 134 a a t i n l e t i n C e l s i u s

47

12 h3 =303.85 // s p e c i f i c 13 14 15 16

e n t h a l p y c o r r e s p o n d i n g t o P3 , T3

i n kJ / kg P4 =1 // p r e s s u r e o f R 134 a a t e x i t i n MPa T4 =35 // temp . o f R 134 a a t e x i t i n C e l s i u s h4 =100.87 // c o r r e s p o n d i n g t o P4 , T4 i n kJ / kg mw = mr *( h4 - h3 ) /( h1 - h2 ) // mass f l o w r a t e o f t h e c o o l i n g w a t e r i n kg / min 17 qin = mw *( h2 - h1 ) // t h e h e a t t r a n s f e r r a t e from t h e r e f r i g e r a n t t o w a t e r i n kJ / min 18 printf ( \ n Hence , mass f l o w r a t e o f t h e c o o l i n g w a t e r r e q u i r e d i s = %. 1 f kg / min . \ n , mw ) ; 19 printf ( \ n Heat t r a n s f e r r a t e from r e f r i g e r a n t t o w a t e r i s = %. 0 f kJ / min . \ n , qin ) ;

Scilab code Exa 5.11 Electric heating of air in house


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

// e x a m p l e 11 // e l e c t r i c h e a t i n g o f a i r i n h o u s e clear clc T1 =290 // I n i t i a l temp . o f a i r i n K P1 =100 // I n i t i a l p r e s s u r e o f a i r i n kPa R =0.287 // Gas c o n s t a n t i n KPa m3/ kg K V1 = R * T1 / P1 // I n i t i a l s p e c i f i c volume o f a i r i n m3/ kg v1 =150 // volume f l o w r a t e i n m3/ min m = v1 /( V1 *60) // mass f l o w r a t e i n kg / s win =15 // Power o f E l e c t r i c h e a t i n g s y s t e m i n kJ / s qout =0.2 // h e a t l o s t from a i r t o s u r r o u n d i n g s i n kJ / s cp =1.005 // h e a t c a p a c i t y i n kJ / kg C T2 =( win - qout ) /( m * cp ) +( T1 -273) // E x i t temp . o f a i r i n C printf ( \ n Hence , t h e e x i t temp . o f a i r i s = %. 1 f C . \ n , T2 ) ; 48

Scilab code Exa 5.12 Charging of rigid tank by system


1 // e x a m p l e 12 2 // c h a r g i n g o f r i g i d t a n k by s y s t e m 3 clear 4 clc 5 disp ( T h i s p r o c e s s can be a n a l y z e d a s a u n i f o r m f l o w

7 8 9 10 11 12 13 14 15 16

p r o c e s s s i n c e t h e p r o p e r t i e s o f t h e steam e n t e r i n g t h e c o n t r o l volume r e m a i n c o n s t a n t during the e n t i r e process . ) disp ( We t a k e t h e t a n k a s t h e s y s t e m . T h i s i s a c o n t r o l volume s i n c e mass c r o s s e s t h e s y s t e m boundary d u r i n g t h e p r o c e s s . We o b s e r v e t h a t t h i s i s an u n s t e a d y f l o w p r o c e s s s i n c e c h a n g e s o c c u r w i t h i n t h e c o n t r o l volume ) m1 =0 // s i n c e s y s t e m i s i n i t i a l l y e v a c u a t e d disp ( The p r o p e r t i e s o f t h e steam a t t h e i n l e t s t a t e are ) P1 =1 // p r e s s u r e i n MPa T1 =300 // temp . i n C e l s i u s h1 =3051.6 // e s p e c i f i c e n t h a l p y i n kJ / kg P2 =1 // p r e s s u r e a t f i n a l s t a t e i n MPa u2 = h1 // f i n a l i n t e r n a l e n e r g y o f t h e steam i n kJ / kg disp ( From steam t a b l e , t h e temp . c o r r e s p o n d i n g t o f i n a l properties are ) T2 =456.1 // f i n a l temp . i n C e l s i u s printf ( \ n The f i n a l temp . o f t h e steam i n t h e t a n k i s = %. 1 f C . \ n , T2 ) ;

Scilab code Exa 5.13 Cooking with a pressure cooker

49

1 // e x a m p l e 13 2 // c o o k i n g w i t h a p r e s s u r e c o o k e r 3 clear 4 clc 5 disp ( T h i s p r o c e s s can be a n a l y z e d a s a u n i f o r m f l o w

7 8 9 10

11 12 13 14 15 16 17 18 19 20 21 22

p r o c e s s s i n c e t h e p r o p e r t i e s o f t h e steam l e a v i n g t h e c o n t r o l volume r e m a i n c o n s t a n t d u r i n g the e n t i r e cooking process ) disp ( We t a k e t h e p r e s s u r e c o o k e r a s t h e s y s t e m . T h i s i s a c o n t r o l volume s i n c e mass c r o s s e s t h e s y s t e m boundary d u r i n g t h e p r o c e s s . We o b s e r v e t h a t t h i s i s an u n s t e a d y f l o w p r o c e s s s i n c e c h a n g e s o c c u r w i t h i n t h e c o n t r o l volume . Also , t h e r e i s one e x i t and no i n l e t s f o r mass f l o w . ) Pgage =75 // g a g e p r e s s u r e i n s i d e c o o k e r i n kPa Patm =100 // a t m o s p h e r i c p r e s s u r e i n kPa Pabs = Pgage + Patm // a b s o l u t e p r e s s u r e i n s i d e p r e s s u r e c o o k e r i n kPa disp ( S i n c e s a t u r a t i o n c o n d i t i o n s e x i s t i n t h e cooker at a l l times , the cooking temperature must be t h e s a t u r a t i o n t e m p e r a t u r e c o r r e s p o n d i n g t o t h i s p r e s s u r e . From steam t a b l e , i t i s ) Tsat =116.04 // S a t u r a t i o n Temp . a t 175 kPa i n Celsius T = Tsat //Temp . a t which c o o k i n g t a k e s p l a c e Qin =0.5 // Heat s u p p l i e d t o t h e p r e s s u r e c o o k e r i n kJ /s t =30*60 // t i m e f o r which h e t i s s u p p l i e d t o p r e s s u r e cooker in seconds qin = Qin * t // t o t a l h e a t s u p p l i e d t o p r e s s u r e c o o k e r i n kJ m1 =1 // i n i t i a l mass o f w a t e r i n kg V =0.006 // volume o f p r e s s u r e c o o k e r i n m3 V1 = V / m1 // i n i t i a l s p e c i f i c volume i n kg /m3 Vf =0.001 // i n kg /m3 Vfg =1.004 -0.001 // i n kg /m3 x1 =( V1 - Vf ) / Vfg // q u a l i t y uf =486.82 // i n kJ / kg 50

23 ufg =2037.7 // i n kJ / kg 24 u1 = uf + x1 * ufg // s p e c i f i c i n t e r n a l e n e r g y i n kJ / kg 25 U1 = m1 * u1 // t o t a l i n t e r n a l e n e r g y 26 disp ( V2=Vf+x2 Vfg and u2=u f+x2 u f g . upon 27 28 29 30 31

s u b s t i t u t i n g v a r i o u s v a l u e s , we g e t ) x2 =0.009 // q u a l i t y o f steam i n f i n a l s t a t e V2 = Vf + x2 * Vfg // f i n a l s p e c i f i c volume i n m3/ kg m2 = V / V2 // amount o f w a t e r l e f t i n t h e p r e s s u r e c o o k e r i n kg printf ( \ n Hence , t h e t e m p e r a t u r e a t whih c o o k i n g t a k e s p l a c e i s = %. 2 f C . \ n ,T ) ; printf ( \ n The amount o f w a t e r l e f t i n t h e p r e s s u r e c o o k e r a t t h e end o f t h e p r o c e s s = %. 1 f kg . \ n , m2 ) ;

51

Chapter 6 Mass and Energy Analysis of Control Volumes

Scilab code Exa 6.1 Net Power Production of a Heat Engine // q u e s 1 // Net Power P r o d u c t i o n o f a Heat E n g i n e clear clc Qh =80; // h e a t o f s o u r c e i n M W Ql =50; // h e a t o f s i n k i n M W W = Qh - Ql ; // Output power i n M W printf ( The n e t power o u t p u t o f t h i s h e a t e n g i n e i s = %. 0 f M W \ n ,W ) ; 9 n = W / Qh ; // t h e r m a l e f f i c i e n c y =n e t work / h e a t o f s o u r c e 10 printf ( Thermal E f f i c i e n c y = %. 3 f \ n ,n ) ;
1 2 3 4 5 6 7 8

Scilab code Exa 6.2 Fuel Consumption Rate of a Car


1 2

// q u e s 2 // F u e l Consumption Rate o f a Car 52

clear clc W =65; // power o f c a r e n g i n e i n hp n =0.24; // e f f i c i e n c y o f c a r e n g i n e Qh = W / n *2545; // h e a t o f r e s e r v o i r i n Btu /h r =19000; // o u t p u t power r e q u i r e d i n Btu / lbm m = Qh / r ; // r a t e o f b u r n i n g o f f u e l r e q u i r e d , i n lbm / hour 10 printf ( To s u p p l y e n e r g y a t t h i s r a t e , t h e e n g i n e must burn f u e l a t a r a t e o f = %. 1 f lbm /h ,m ) ;

3 4 5 6 7 8 9

Scilab code Exa 6.3 Heat Rejection by a Refrigerator


1 // q u e s 3 2 // Heat R e j e c t i o n by a R e f r i g e r a t o r 3 clear 4 clc 5 // ( a ) 6 Ql =6; // h e a t o f s i n k i n kJ / s 7 W =2; // work done on r e f r i g e r a t o r i n kW 8 COPr = Ql / W ; // c o e f f i c i e n t o f p e r f o r m a n c e o f

refrigerator 9 printf ( ( a ) The c o e f f i c i e n t o f p e r f o r m a n c e o f t h e r e f r i g e r a t o r i s = %. 0 f \ n , COPr ) ;


10 11 // ( b ) 12 Qh = Ql + W ; // h e a t o f r e s e r v o i r i n kJ / s 13 printf ( ( b ) The r a t e a t which h e a t

i s r e j e c t e d to t h e room t h a t h o u s e s t h e r e f r i g e r a t o r = %. 0 f kJ / s \ n , Qh ) ;

Scilab code Exa 6.4 Heating a House by a Heat Pump 53

1 // q u e s 4 2 // H e a t i n g a House by a Heat Pump 3 clear 4 clc 5 // ( a ) 6 Qh =80000; // h e a t o f r e s e r v o i r i n kJ / h 7 COPh =2.5; // c o e f f i c i e n t o f p e r f o r m a n c e o f h e a t e n g i n e 8 W = Qh / COPh ; // work done by h e a t pump i n kJ / h 9 printf ( ( a ) The power consumed by t h i s h e a t pump =

%. 0 f kJ / h \ n ,W ) ; 10 // ( b ) 11 Ql = Qh - W ; // h e a t o f s i n k / o u t d o o r i n kJ / h o u r 12 printf ( ( b ) The r a t e o f h e a t t r a n s f e r from t h e o u t d o o r = %. 0 f kJ / h \ n , Ql ) ;

Scilab code Exa 6.5 Analysis of a Carnot Heat Engine


1 // q u e s 5 2 // A n a l y s i s o f a C a r n o t Heat E n g i n e 3 clear 4 clc 5 // ( a ) The C a r n o t h e a t e n g i n e i s a r e v e r s i b l e

6 7 8 9 10 11 // ( b ) 12 13 Qh =500; // h e a t o f r e s e r v o i r i n kJ 14 Ql = Tl / Th * Qh ; // h e a t o f s i n k i n kJ 15 printf ( ( b ) The amount o f h e a t r e j e c t e d , Ql by t h i s

e n g i n e , and s o i t s as Tl =303; //K temp o f s i n k Th =650+273; //K temp o f s o u r c e n =1 - Tl / Th ; // e f f i c i e n c y o f h e a t e n g i n e printf ( ( a ) E f f i c i e n c y = %. 3 f \ n ,n ) ;

heat e f f i c i e n c y can be d e t e r m i n e d

r e v e r s i b l e h e a t e n g i n e = %. 0 f kJ \ n , Ql ) ; 54

Scilab code Exa 6.6 A Questionable Claim for a Refrigerator


1 // q u e s 6 2 //A Q u e s t i o n a b l e Claim f o r a R e f r i g e r a t o r 3 clear 4 clc 5 Th =75+460; // t e m p e r a t u r e o f r e s e r v i o r i n R 6 Tl =35+460; // t e m p e r a t u r e o f s i n k i n R 7 COPr =1/(( Th / Tl -1) ) ; // c o e f f i c i e n t o f p e r f o r m a n c e o f 8

refrigerator printf ( C o e f f i c i e n t o f p e r f o r m a n c e o f r e f r i g e r a t o r = %. 1 f , COPr ) ;

Scilab code Exa 6.7 Heating a House by a Carnot Heat Pump


1 // q u e s 7 2 // H e a t i n g a House by a C a r n o t Heat Pump 3 clear 4 clc 5 Tl = -5+273; // temp o f s i n k K 6 Th =21+273; // t e m p e r a t u r e o f r e s e r v i o r i n K 7 COPh =1/(1 - Tl / Th ) ; // c o e f f i c i e n t o f p e r f o r m a n c e o f

heat engine 8 Qh =37.5; // h e a t o f r e s e r v o i r i n kW 9 W = Qh / COPh ; // work o u t p u t o f h e a t e n g i n e i n kW 10 printf ( The r e q u i r e d power i n p u t i s = %. 2 f kW ,W ) ;

Scilab code Exa 6.8 Malfunction of a Refrigerator Light Switch

55

1 // q u e s 8 2 // M a l f u n c t i o n o f a R e f r i g e r a t o r L i g h t S w i t c h 3 clear 4 clc 5 COPr =1.3; // c o e f f i c i e n t o f p e r f o r m a n c e o f 6 7 8 9 10 11 12 13 14 15 16 17 18

refrigerator Qref =40; // h e a t l o a d o f r e f r i g e r a t o r i n W Wref = Qref / COPr ; // power consumed i n W Wlight = Qref ; // power consumed by l i g h t i n W Wtotal = Wlight + Wref ; // t o t a l a d d i t i o n a l power consumed in W nh =20*30*365/3600; // n o r m a l o p e r a t i n g h o u r p e r y r ( h / yr ) // Then t h e a d d i t i o n a l h o u r s t h e l i g h t r e m a i n s on a s a r e s u l t o f t h e m a l f u n c t i o n becomes annualh =8760; // t o t a l number o f a n n u a l h o u r i n a year h/ yr at = annualh - nh ; // a d d i t i o n a l h r i n h / y r aP = Wtotal * at /1000; // a d d i t i o n a l power c o n s u m p t i o n i n kWh/ y r printf ( A d d i t i o n a l power c o n s u m p t i o n = %. 0 f kWh/ y r \ n , aP ) ; uc =0.08; // u n i t c o s t 0 . 0 8 $ /kWh APC = aP * uc ; // a d d i t i o n a l power c o s t i n $ / y r printf ( A d d i t i o n a l power c o s t = $ %. 1 f / y r , APC ) ;

56

Chapter 7 Entropy

Scilab code Exa 7.1 Entropy Change during an Isothermal Process


1 // q u e s 1 2 // Entropy Change d u r i n g an I s o t h e r m a l P r o c e s s 3 clear 4 clc 5 // The s y s t e m u n d e r g o e s an i n t e r n a l l y r e v e r s i b l e ,

6 7 8 9

i s o t h e r m a l p r o c e s s , and t h u s i t s e n t r o p y c h a n g e can be d e t e r m i n e d d i r e c t l y from Eqns Q =750 // h e a t i n kJ Tsys =300 // t e m p e r a t u r e o f s y s t e m i n K dS = Q / Tsys ; // e n t r o p y c h a n g e o f p r o c e s s i n kJ /K printf ( Change i n e n t r o p y = %. 2 f kJ /K , dS ) ;

Scilab code Exa 7.2 Entropy Generation during Heat Transfer Processes
1 // q u e s 2 2 // Entropy G e n e r a t i o n d u r i n g Heat T r a n s f e r 3 clear 4 clc

Processes

57

5 6 7 8 9 10 11 12

// ( a ) S i n k a t 500K Qsource = -2000 // h e a t o f s o u r c e i n kJ Qsink =2000 // h e a t o f s i n k i n kJ Tsource =800 // t e m p e r a t u r e o f s o u r c e i n K Tsink =500 // t e m p e r a t u r e o f s i n k i n K Ssource = Qsource / Tsource // e n t r o p y o f s o u r c e i n kJ /K Ssink = Qsink / Tsink // e n t r o p y o f s u r c e i n kJ /K Sgen = Ssource + Ssink ; // e n t r o p y o f g e n e r a t i o n o f t h e p r o c e s s i n kJ /K 13 printf ( ( a ) E n t h a l p y o f g e n e r a t i o n = %. 1 f kJ /K \ n , Sgen ) ;
14 15 16 17 18 19 20 21 22

// ( b ) f o r s i n k o f T=750 K Qsource = -2000 // h e a t o f s o u r c e i n kJ Qsink =2000 // h e a t o f s i n k i n kJ Tsource =800 // t e m p e r a t u r e o f s o u r c e i n K Tsink =750 // t e m p e r a t u r e o f s i n k i n K Ssource = Qsource / Tsource // e n t r o p y o f s o u r c e i n kJ /K Ssink = Qsink / Tsink // t e m p e r a t u r e o f s i n k i n kJ /K Sgen = Ssource + Ssink ; // e n t r o p y o f g e n e r a t i o n o f s y s t e m i n kJ /K 23 printf ( ( b ) E n t h a l p y o f g e n e r a t i o n = %. 1 f kJ /K , Sgen ) ;

Scilab code Exa 7.3 Entropy Change of a Substance in a Tank


1 // q u e s 3 2 // Entropy Change o f a S u b s t a n c e i n a Tank 3 clear 4 clc 5 // s p e c i f i c volume r e m a i n s c o n s t a n t d u r i n g t h i s

process
6 7 // s t a t e 1 8 P1 =140 // i n i t i a l

p r e s s u r e i n kPa 58

9 10 11 12 13 14 15 16 17 18

T1 =20 // i n i t i a l t e m p e r a t u r e i n C s1 =1.0624 // e n t r o p y i n kJ /Kg . K from t a b l e v1 =0.16544 // s p e c i f i c volume i n m3/Kg // s t a t e 2 P2 =100 // p r e s s u r e i n kPa v2 =0.16544 // s p e c i f i c volume r e m a i n s same i e v2=v1

// from t a b l e vf =0.0007259 // s p e c i f i c volume o f s a t u r a t e d w a t e r i n m3/ kg 19 vg =0.19254 // s p e c i f i c volume o f s a t u r a t e d v a p o r i n m 3/ kg // F i n a l s t a t e s a t u r a t e d l i q u i d v a p o r m i x t u r e x2 =( v2 - vf ) /( vg - vf ) ; // x f a c t o r sf =0.07188 // e n t r o p y o f s a t u r a t e d w a t e r i n kJ /Kg . K sfg =0.87995 // e n t r o p y c h a n g e i n kJ / kg . K s2 = sf + x2 * sfg ; // e n t r o p y a t s t a t e 2 i n kJ / kg . K m =5 // mass i n Kg S = m *( s2 - s1 ) ; // e n t r o p y c h a n g e i n p r o c e s s i n kJ printf ( Entropy c h a n g e = %. 3 f kJ ,S ) ;

20 21 22 23 24 25 26 27 28

Scilab code Exa 7.4 Entropy Change during a Constant Pressure Process
1 // q u e s 4 2 // Entropy Change d u r i n g a C o n s t a n t P r e s s u r e P r o c e s s 3 clear 4 clc 5 // a p p r o x i m a t i n g t h e c o m p r e s s e d l i q u i d a s a s a t u r a t e d

liquid
6 7 // s t a t e 1 8 P1 =20 // p r e s s u r e i n p s i a 9 T1 =70 // t e m p e r a t u r e i n F

59

10 11 12 13 14 15 16 17 18 19 20 21 22

s1 =0.07459 // e n t r o p y i e s f @ 70F i n Btu / lbm . R h1 =38.08 // h e a t o f s y s t e m i n Btu / lbm hf@ 70 F // s t a t e 2 P2 =20 // p r e s s u r e i n p s i a // u s i n g Qin=m ( h2h1 ) Qin =3450 // i n p u t h e a t i n Btu m =3 // mass i n lbm h2 = Qin / m + h1 // h e a t o f s y s t e m i n Btu / lbm s2 =1.7761 // e n t r o p y i n Btu / lbm /R from t a b l e A6E S = m *( s2 - s1 ) ; // c h a n g e i n e n t r o p y o f s y s t e m printf ( Entropy c h a n g e o f w a t e r d u r i n g t h e p r o c e s s = %. 3 f Btu /R ,S ) ;

Scilab code Exa 7.5 Isentropic Expansion of Steam in a Turbine


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

// q u e s 5 // I s e n t r o p i c E x p a n s i o n o f Steam i n a T u r b i n e clear clc // s t a t e 1 P1 =5 // p r e s s u r e i n MPa T1 =450 // t e m p e r a t u r e i n C h1 =3317.2 // h e a t o f s y s t e m i n kJ / kg from t a b l e s1 =6.8210 // e n t r o p y o f s y s t e m i n kJ / kg . K from t a b l e // s t a t e 2 P2 =1.4 // p r e s s u r e i n MPa s2 =6.8210 // e n t r o p y o f s y s t e m r e m a i n s same i e s 2=s 1 h2 =2967.4 // h e a t o f s y s t e m i n kJ /Kg from t a b l e w = h1 - h2 ; // work o u t p u t o f t u r b i n e i n kJ / kg printf ( The work o u t p u t o f t h e t u r b i n e p e r u n i t mass 60

i s = %. 1 f kJ / kg ,w ) ;

Scilab code Exa 7.7 Eect of Density of a Liquid on Entropy


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

// q u e s 7 // E f f e c t o f D e n s i t y o f a L i q u i d on Entropy clear clc // s t a t e 1 P1 =1 // p r e s s u r e i n MPa T1 =110 // t e m p e r a t u r e i n K s1 =4.875 // e n t r o p y i n kJ /Kg . K from t a b l e Cp1 =3.471 // s p e c i f i c h e a t a t c o n s t a n t p r e s s u r e i n kJ / Kg . K from t a b l e // s t a t e 2 P2 =5 // p r e s s u r e i n MPa T2 =120 // t e m p e r a t u r e i n K s2 =5.145 // e n t r o p y i n kJ /Kg . K Cp2 =3.486 // s p e c i f i c h e a t a t c o n s t a n t p r e s s u r e i n kJ / Kg . K

17 18 s = s2 - s1 ; // e n t r o p y c h a n g e i n kJ / kg . K 19 printf ( ( a ) Change i n e n t r o p y p e r u n i t mass = %. 3 f

kJ / kg . K \ n ,s ) ; // ( b ) A p p r o x i m a t i n g l i q u i d methane a s an incompressible substance 22 c =( Cp1 + Cp2 ) /2; // a v e r a g e s p e c i f i c h e a t 23 s = c * log ( T2 / T1 ) ; // e n t r o p y c h a n g e i n kJ /Kg 24 printf ( ( b ) Entropy c h a n g e p e r u n i t mass = %. 3 f kJ / kg . K ,s ) ;
20 21

61

Scilab code Exa 7.8 Economics of Replacing a Valve by a Turbine


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

// q u e s 8 // E c o n o m i c s o f R e p l a c i n g a V a l v e by a T u r b i n e clear clc // s t a t e 1 P1 =5 // p r e s s u r e i n MPa T1 =115 // t e m p e r a t u r e i n K // from t a b l e h1 =232.3 // h e a t i n kJ / kg s1 =4.9945 // e n t r o p y i n kJ / kg . K d1 =422.15 // d e n s i t y

// s t a t e 2 P2 =1 // p r e s s u r e i n MPa s2 =4.9945 // e n t r o p y s 2=s 1 h2 =222.8 // h e a t i n kJ / kg from t a b l e Vs =0.280 // volume f l o w r a t e i n m3 ms = d1 * Vs // mass p e r s e c o n d i n Kg/ s e c // Ein=Eout s o Wsout=ms ( h1h2 ) Ws = ms *( h1 - h2 ) ; // power o u t p u t o f t u r b i n e i n kJ / s e c printf ( The power o u t p u t o f t h e t u r b i n e = %. 0 f kW \ n , Ws ) ; 23 APP = Ws *8760 //kWh/ y r a n n u a l power p r o d u c t i o n 24 APS = APP *0.075 // $ /kWh Annual power s a v i n g s 25 printf ( Annual power s a v i n g s = $ %. 0 f / y r , APS ) ;

Scilab code Exa 7.9 Entropy Change of an Ideal Gas


1

// q u e s 9 62

2 // Entropy Change o f an I d e a l Gas 3 clear 4 clc 5 // ( a ) From t a b l e ( T a b l e A 1 7 ) 6 s2 =1.79783; // e n t r o p y o f s u b s t a n c e a s t a t e 2 i n kJ /Kg 7 8 9 10 11 12 13 14 15 16 17 18 19

.K s1 =1.66802; // e n t r o p y o f s t a t e 2 i n kJ / kg . k R =0.287; // g a s c o n s t a n t f o r w a t e r P2 =600 // f i n a l p r e s s u r e i n kPa P1 =100 // i n i t i a l p r e s s u r e i n kPa dS = s2 - s1 - R * log ( P2 / P1 ) ; // c h a n g e i n e n t r o p y i n kJ / kg . k printf ( ( a ) s2 s 1 = %. 4 f kJ /Kg . K \ n , dS ) ; // ( b ) by u s i n g a c v a l u e a t t h e a v e r a g e t e m p e r a t u r e 37 C Cpavg =1.006 // avg s p e c i f i c h e a t a t c o n s t p r e s s u r e i n kJ / kg . K T2 =330 // f i n a l temp i n K T1 =290 // i n i a l temp i n K dS = Cpavg * log ( T2 / T1 ) -R * log ( P2 / P1 ) ; // kJ / kg . k printf ( ( b ) Entropy c h a n g e = %. 4 f kJ / kg . K , dS ) ;

Scilab code Exa 7.10 Isentropic Compression of Air in a Car Engine


1 2 3 4 5 6 7 8 9 10 11

// q u e s 1 0 // I s e n t r o p i c C o m p r e s s i o n o f A i r i n a Car E n g i n e clear clc // U s i n g e q u a t i o n ( T2/T1 ) =( v1 / v2 ) ( k 1) T1 =295 // i n i t i a l temp i n K t =8 // v1 / v2 r a t i o k =1.391 // i s e n t r o p i c r a t i o T2 = T1 *( t ) ^( k -1) ; // f i n a l temp i n K printf ( F i n a l t e m p e r a t u r e = %. 1 f K \ n , T2 ) ; 63

12

printf ( I n c r e a s e i n t e m p e r a t u r e = %. 1 f K ,T2 - T1 ) ;

Scilab code Exa 7.11 Isentropic Compression of an Ideal Gas


1 2 3 4 5 6 7 8 9 10 11

// q u e s 1 1 // I s e n t r o p i c C o m p r e s s i o n o f an I d e a l Gas clear clc // u s i n g t h e e q u a t i o n P2=P1 ( T2/T1 ) ( k / ( k 1) ) P1 =14; // i n i t i a l p r e s s u r e i n p s i a T2 =780; // f i n a l temp i n R T1 =510; // i n i t i a l temp i n R k =1.667; // i s e n t r o p i c r a t i o P2 = P1 *( T2 / T1 ) ^( k /( k -1) ) ; printf ( F i n a l p r e s s u r e = %. 1 f p s i a , P2 ) ;

Scilab code Exa 7.12 Compressing a Substance in the Liquid versus Gas Phases
1 2 3 4 5 6 7 8 9 10 11 12

// q u e s 1 2 // C o m p r e s s i n g a S u b s t a n c e i n t h e L i q u i d v e r s u s Gas Phases clear clc // ( a ) steam a s a s a t u r a t e d l i q u i d v1 =0.001043; //=v f ( s p e c i f i c volume o f f l u i d s ) @ 100 kPa i n m3/ kg P2 =1000; // f i n a l p r e s s u r e i n kPa P1 =100; // i n i t i a l p r e s s u r e i n kPa w = integrate ( v1 P0 , P ,P1 , P2 ) ; // work done i n kJ / kg printf ( ( a ) Work done i s = %. 2 f kJ / kg \ n ,w ) ; // ( b ) s a t u r a t e d v a p o r a t t h e i n l e t s t a t e 64

13 14 15 16 17 18 19 20 21 22 23 24

// s t a t e 1 P1 =100; // p r e s s u r e a t s t a t e 1 i n kPa // t a b l e A6 h1 =2675.0; // e n t h a l p y o f h e a t i n kJ / kg s1 =7.3589; // e n t r o p y a t i n kJ / kg . k // s t a t e 2 P2 =1; // p r e s s u r e i n MPa s2 =7.3589; // s 2=s 1 e n t r o p y r e m a i n s same h2 =3194.5; // t a b l e A6 e n t h a l p y o f h e a t i n kJ / kg w = h2 - h1 ; // work done i n kJ / kg printf ( ( b ) Work done = %. 2 f kJ / kg ,w ) ;

Scilab code Exa 7.13 Work Input for Various Compression Processes
1 2 3 4 5 6 7 8 9 10 11

// q u e s 1 3 // Work I n p u t f o r V a r i o u s C o m p r e s s i o n P r o c e s s e s clear clc // ( a ) I s e n t r o p i c c o m p r e s s i o n w i t h k =1.4 k =1.4; // i s e n t r o p i c r a t i o R =0.287; // g a s c o n s t a n t f o r w a t e r i n kJ /K/ mol / kg T1 =300; // i n i t i a l temp i n K P2 =900; // f i n a l p r e s s u r e i n kPa P1 =100; // i n i t i a l p r e s s u r e i n kPa w = k * R * T1 /( k -1) *(( P2 / P1 ) ^(( k -1) / k ) -1) ; // work done i n c o m p r e s s i o n i n kJ / kg 12 printf ( ( a ) Work done i n c o m p r e s s i o n = %. 1 f kJ / kg \ n ,w ) ;
13 14 // ( b ) P o l y t r o p i c c o m p r e s s i o n w i t h k =1.3 15 w = k * R * T1 /( k -1) *(( P2 / P1 ) ^(( k -1) / k ) -1) ; 16 printf ( ( b ) Work done i n c o m p r e s s i o n = %. 1 f kJ / kg \

n ,w ) ;
17

65

18 // ( c ) I s o t h e r m a l c o m p r e s s i o n 19 w = R * T1 * log ( P2 / P1 ) ; 20 printf ( ( c ) Work done = %. 1 f kJ / kg \ n ,w ) ; 21 22 // ( d ) I d e a l two s t a g e c o m p r e s s i o n w i t h i n t e r c o o l i n g 23 24 25 26

with a p o l y t r o p i c exponent o f 1 . 3 Px =( P1 * P2 ) ^(1/2) ; // p r e s s u r e i n kPa // t h e t o t a l c o m p r e s s o r work i s t w i c e t h e c o m p r e s s i o n work f o r a s i n g l e s t a g e w =2* k * R * T1 /( k -1) *(( Px / P1 ) ^(( k -1) / k ) -1) ; printf ( ( d ) Work done = %. 2 f kJ / kg \ n ,w ) ;

Scilab code Exa 7.14 Isentropic Eciency of a Steam Turbine


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

// q u e s 1 4 // I s e n t r o p i c E f f i c i e n c y o f a Steam T u r b i n e clear clc // s t a t e 1 P1 =3; // p r e s s u r e i n MPa T1 =400; // t e m p e r a t u r e i n C // from t a b l e h1 =3231.7; // e n t h a l p y o f h e a t i n kJ / kg s1 =6.9235; // e n r o p y i n kJ / kg . k // s t a t e 2 a P2a =50; // p r e s s u r e i n kPa T2a =100; // temp i n C h2a =2682.4; // e n t h a l p y o f h e a t i n kJ / kg // s t a t e 2 s P2s =50; // p r e s s u r e i n kPa s2s =6.9235; // s 2 s=s 1 e n t r o p y r e m a i n s same // from t a b l e sf =1.0912; // e n t r o p y o f f l u i d s t a t e i n kJ / kg . k 66

22 sg =7.5931; // e n t r o p y o f v a p o r i n kJ . kg . k 23 // a t end , steam e x i s t s a s a s a t u r a t e d m i x t u r e s i n c e 24 25 26 27 28 29 30

s f <s 2 s <s g hf =340.54; // e n t h a l p y o f h e a t o f f l u i d s t a t e i n kJ / kg hfg =2304.7; // e n t h a l p y d i f f e r e n c e o f v a p o r and l i q u i d s t a t e i n kJ / kg x2s =( s2s - sf ) /( sg - sf ) ; // x f a c t o r h2s = hf + x2s *( hfg ) ; // e n t h a l p y o f h e a t i n kJ / kg // u s i n g t h e e q u a t i o n 7 61 i n book we g e t n =( h1 - h2a ) /( h1 - h2s ) ; printf ( ( a ) I s e n t r o p i c e f f i c i e n c y = %. 1 f p e r c e n t \ n ,n *100) ;

31 32 Wout =2000 // o u t p u t power i n kJ / s 33 ms = Wout /( h1 - h2a ) ; // mass f l o w r a t e i n kg / s 34 printf ( ( b ) The mass f l o w r a t e o f steam = %. 2 f kg / s

, ms ) ; // t h r o u g h t h i s t u r b i n e from t h e e n e r g y b a l a n c e f o r s t e a d y f l o w s y s t e m s

Scilab code Exa 7.15 Eect of Eciency on Compressor Power Input


1 // q u e s 1 5 2 // E f f e c t o f E f f i c i e n c y on C o m p r e s s o r Power I n p u t 3 clear 4 clc 5 T1 =285; // i n i t i a l t e m p e r a t u r e i n K 6 h1 =285.14; // t a b l e A17 i n i t i a l h e a t o f e n t h a l p y i n 7 8 9 10 11 12 13

kJ / kg Pr1 =1.1584; // r e d u c e d p r e s s u r e P2 =800; // f i n a l p r e s s u r e i n kPa P1 =100; // i n i t i a l p r e s s u r e i n kPa Pr2 = Pr1 *( P2 / P1 ) ; // from t a b l e c o r r e s p o n d i n g t o Pr2 h2s =517.05; // e n t h a l p y o f h e a t i n kJ / kg n =0.80; // e f f i c i e n c y 67

14 15 16 17 18 19 20

// u s i n g t h e f o r m u l a f o r e f f i c i e n c y ) h2a =( h2s - h1 ) / n + h1 ; // e n t h a l p y o f h e a t i n kJ / kg T2a =569.5; // f i n a l temp i n K from t a b l e printf ( ( a ) T e m p e r a t u r e T2a = %. 1 f K \ n , T2a ) ; ms =0.2; // mass f l o w r a t e i n kg / s w = ms *( h2a - h1 ) ; // work done i n kJ / kg printf ( ( b ) R e q u i r e d power i n p u t t o c o m p r e s s o r a s d e t e r m i n e d from t h e e n e r g y b a l a n c e e q u a t i o n i s = %. 2 f kJ / kg \ n ,w ) ;

Scilab code Exa 7.16 Eect of Eciency on Nozzle Exit Velocity


1 // q u e s 1 6 2 // E f f e c t o f E f f i c i e n c y on N o z z l e E x i t V e l o c i t y 3 clear 4 clc 5 // The e x i t v e l o c i t y o f t h e a i r w i l l be a maximum

6 7 8 9 10 11 12 13 14 15 16

when t h e p r o c e s s i n t h e n o z z l e i n v o l v e s no irreversibilities T1 =950; // i n i t i a l temp i n K P2s =80; // p r e s s u r e i n kPa P1 =200; // i n i t i a l p r e s s u r e i n kPa k =1.354; // i s e n t r o p i c r a t i o T2s = T1 *( P2s / P1 ) ^(1 -1/ k ) ; // temp i n K // u s i n g Ein = Eout we can g e t V2s Cpavg =1.099; // avg s p e c i f i c h e a t a t c o n s t a n t p r e s s u r e i n kJ / kg . k V2s = sqrt (2000* Cpavg *( T1 - T2s ) ) ; // v e l o c i t y i n m/ s printf ( ( a ) The maximum p o s s i b l e e x i t v e l o c i t y = %. 2 f m/ s \ n , V2s ) ;

// ( b ) The a c t u a l e x i t t e m p e r a t u r e o f t h e a i r i s h i g h e r than the i s e n t r o p i c e x i t temperature e v a l u a t e d above 17 n =0.92; // e f f i c i e n c y 68

18 T2a = T1 - n *( T1 - T2s ) ; // temp i n K 19 printf ( ( b ) The e x i t t e m p e r a t u r e = %. 0 f K \ n , T2a ) ; 20 21 // ( c ) The a c t u a l e x i t v e l o c i t y o f a i r can be

d e t e r m i n e d from t h e d e f i n i t i o n o f i s e n t r o p i c e f f i c i e n c y of a nozzle 22 V2a = sqrt ( n * V2s ^2) ; // v e l o c i t y i n m/ s 23 printf ( ( c ) E x i t v e l o c i t y o f a i r = %. 0 f m/ s , V2a ) ;

Scilab code Exa 7.17 Entropy Generation in a Wall


1 // q u e s 1 7 2 // Entropy G e n e r a t i o n i n a Wall 3 clear 4 clc 5 // Entropy c h a n g e o f w a l l i s 0 d u r i n g p r o c e s s

6 7 8 9 10 11 12

13 14 15 16

since t h e s t a t e and t h u s t h e e n t r o p y o f t h e w a l l do n o t c h a n g e anywhere Qout =1035; //W Qin =1035; //W Tout =278; //K Tin =293; //K Sgen = Qout / Tout - Qin / Tin ; // i n W/K printf ( Entropy o f g e n e r a t i o n = %. 3 f W/K , Sgen ) ; //To d e t e r m i n e r a t e o f t o t a l e n t r o p y g e n e r a t i o n , we e x t e n d t h e s y s t e m t o i n c l u d e t h e r e g i o n s on b o t h s i d e s of the wall that experience a temperature c h a n g e . Then one s i d e o f t h e s y s t e m boundary becomes room t e m p e r a t u r e w h i l e t h e o t h e r s i d e becomes t h e t e m p e r a t u r e o f t h e o u t d o o r s Tout =273; //K Tin =300; //K Sgen = Qout / Tout - Qin / Tin ; // i n W/K printf ( \ n Entro py o f g e n e r a t i o n = %. 3 f W/K , Sgen ) ;

69

Scilab code Exa 7.18 Entropy Generation during a Throttling Process


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

// q u e s 1 8 // Entropy G e n e r a t i o n d u r i n g a T h r o t t l i n g P r o c e s s clear clc // s t a t e 1 P1 =7; //MPa T1 =450; //C // from t a b l e h1 =3288.3; // kJ / kg s1 =6.6353; // kJ / kg . K // s t a t e 2 P2 =3; //MPa h2 =3288.3; // h2=h1 s2 =7.0046; // kJ / kg . K sgen =( s2 - s1 ) ; printf ( Entropy o f g e n e r a t i o n p e r u n i t mass = %. 4 f kJ / kg . K , sgen ) ;

Scilab code Exa 7.19 Entropy Generated when a Hot Block Is Dropped in a Lake
1 2 3 4 5 6 7

// q u e s 1 9 // Entropy G e n e r a t e d when a Hot B l o c k I s Dropped i n a Lake clear clc // ( a ) The e n t r o p y c h a n g e o f t h e i r o n b l o c k m =50; // mass i n kg Cavg =0.45; // a v e r a g e s p e c i f i c h e a t i n kJ / kg 70

8 T2 =285; // f i n a l temp i n K 9 T1 =500; // i n i t i a l temp i n K 10 Siron = m * Cavg * log ( T2 / T1 ) ; 11 printf ( ( a ) Entropy c h a n g e o f

i r o n b l o c k = %. 2 f kJ /K

\ n , Siron ) ; // ( b ) // The t e m p e r a t u r e o f t h e l a k e w a t e r r e m a i n s c o n s t a n t d u r i n g t h i s p r o c e s s a t 285 K 15 Qout = m * Cavg *( T1 - T2 ) ; // h e a t t r a n s f e r from i r o n t o l a k e i n kJ 16 S = Qout / T2 ; // Entropy c h a n g e o f l a k e i n kJ /K 17 printf ( ( b ) Entropy c h a n g e o f t h e l a k e = %. 2 f kJ /K \ n ,S ) ;
18 19 20 12 13 14

// ( c ) // The e n t r o p y g e n e r a t e d d u r i n g t h i s p r o c e s s i s d e t e r m i n e d by a p p l y i n g an e n t r o p y b a l a n c e on t h e system 21 Tb =285; // temp o f b l o c k i n K 22 Sgen = Qout / Tb + Siron ; // Entropy g e n e r a t i o n i n kJ /K 23 printf ( ( c ) Entropy g e n e r a t e d = %. 2 f kJ /K \ n , Sgen ) ;

Scilab code Exa 7.21 Entropy Generation Associated with Heat Transfer
1 // q u e s 2 1 2 // Entropy G e n e r a t i o n A s s o c i a t e d w i t h Heat T r a n s f e r 3 clear 4 clc 5 // ( a ) Water u n d e r g o e s an i n t e r n a l l y r e v e r s i b l e

isothermal process 6 Q = -600; // kJ 7 Tsys =100+273; //K 8 Ssys = Q / Tsys ; // kJ /K 71

9 10 11

printf ( ( a ) Entropy o f s y s t e m = %. 2 f kJ /K \ n , Ssys ) ; // ( b ) The e n t r o p y g e n e r a t i o n i s e n t i r e l y due t o i r r e v e r s i b l e heat t r a n s f e r through a f i n i t e temperature d i f f e r e n c e Qout =600; // h e a t o u t p u t i n kJ Tb =25+273 // T e m p e r a t u r e i n K Sgen = Ssys + Qout / Tb ; // Entropy g e n e r a t i o n i n kJ /K printf ( ( b ) Entropy o f g e n e r a t i o n = %. 2 f kJ /K , Sgen );

12 13 14 15

Scilab code Exa 7.22 Energy and Cost Savings by Fixing Air Leaks
1 // q u e s 2 2 2 // Energy and C o s t S a v i n g s by F i x i n g A i r L e a k s 3 clear 4 clc 5 // The work n e e d e d t o c o m p r e s s a u n i t mass o f a i r

6 7 8 9 10 11 12 13 14 15

16 17

at 20 C from t h e a t m o s p h e r i c p r e s s u r e o f 101 kPa t o 700+101=801 kPa i s R =0.287; // g a s c o n s t a n t f o r w a t e r P2 =801; // f i n a l p r e s s u r e i n kPa P1 =101; // i n i t i a l p r e s s u r e i n kPa n =1.4; nc =0.8; T1 =293; // i n i t i a l t e m p e r a t u r e i n K w = n * R * T1 /( nc *( n -1) ) *(( P2 / P1 ) ^(1 -1/ n ) -1) ; // work done i n kJ / kg D =3*10^ -3; // d i a m e t e r i n m e t r e A = %pi * D ^2/4; // a r e a i n m2 // L i n e c o n d i t i o n s a r e 297 K and 801 kPa , t h e mass flow r a t e of the a i r l e a k i n g through the hole i s determined as Cdis =0.65; k =1.4; // k=n 72

18 R =0.287; // g a s c o n s t a n t f o r w a t e r 19 Tline = 297; // t e m p e r a t u r e o f l i n e i n K 20 Pline =801; // p r e s s u r e o f l i n e =P2 21 ms = Cdis *(2/( k +1) ) ^(1/( k -1) ) * Pline /( R * Tline ) * A * sqrt 22 23 24 25 26

(1000* k * R * Tline *2/( k +1) ) ; // mass f l o w i n kg / s pw = ms * w // power w a s t e d i n kW Esaving = pw *4200/0.92 // i n kWh/ y r Energy s a v i n g=Power s a v e d o p e r a t i n g h r / e f f i c i e n c y o f motor printf ( Energy s a v i n g = %. 0 f kWh/ y r \ n , Esaving ) ; Csaving = Esaving *0.078; // C o s t s a v i n g i n $ / y r = Energy s a v i n g u n i t c o s t printf ( C o s t s a v i n g = $ %. 0 f / y r \ n , Csaving ) ;

Scilab code Exa 7.23 Reducing the Pressure Setting to Reduce Cost // q u e s 2 3 // R e d u c i n g t h e P r e s s u r e S e t t i n g t o Reduce C o s t clear clc Preduced =885.6; // r e d u c e d p r e s s u r e P1 =85.6; // i n i t i a l p r e s s u r e i n kPa P2 =985.6; // f i n a l p r e s s u r e i n kPa n =1.4; f =1 -(( Preduced / P1 ) ^(( n -1) / n ) -1) /(( P2 / P1 ) ^(1 -1/ n ) -1) ; // The f r a c t i o n o f e n e r g y s a v e d a s a r e s u l t o f reducing the p r e s s u r e s e t t i n g 10 Cc =12000; // c u r r e n t c o s t i n $ / y r 11 Csaving = Cc * f ; 12 printf ( C o s t s a v i n g = $% . 0 f / y r \ n , Csaving ) ;
1 2 3 4 5 6 7 8 9

73

Chapter 8 Exergy A Measure of Work Potential

Scilab code Exa 8.1 Maximum power generation by wind turbine // e x a m p l e 1 //maximum power g e n e r a t i o n by wind t u r b i n e clear clc V =10 // A v e r a g e v e l o c i t y o f wind i n m/ s ke =( V ^2/2) /1000 // e x e g y o f t h e b l o w i n g a i r i n kJ / kg D =12 // d i a m e t e r o f wind t u r b i n e i n m d =1.18 // d e n s i t y o f a i r i n kg /m3 M = d * %pi * D ^2* V /4 // mass f l o w r a t e i n kg / s p = M * ke //maximum power g e n e r a t e d by wind t u r b i n e i n kW 11 printf ( \ n Hence , t h e maximum power g e n e r a t e d by wind t u r b i n e i s = %. 1 f kW. \ n ,p ) ;
1 2 3 4 5 6 7 8 9 10

Scilab code Exa 8.2 Exergy transfer from a furnace

74

1 // e x a m p l e 2 2 // e x e r g y t r a n s f e r from a f u r n a c e 3 clear 4 clc 5 T0 =537 // e n v i r o n m e n t a l t e m p e r a t u r e i n R 6 Th =2000 // f u r n a c e t e m p e r a t u r e i n R 7 nthrev =1 - T0 / Th // t h e r m a l e f f i c i e n c y o f r e v e r s i b l e

heat engine 8 Qin =3000 // h e a t t r a n s f e r r a t e from f u r n a c e i n Btu / s 9 Wrev = nthrev * Qin // e x e r g y o f t h e f u r n a c e i n Btu / s 10 printf ( \ n Hence , t h e r a t e o f e x e r g y f l o w a s s o c i a t e d w i t h t h i s h e a t t r a n s f e r i s = %. 0 f Btu / s . \ n , Wrev ) ;

Scilab code Exa 8.3 The rate of irreversibility of a heat engine


1 // e x a m p l e 3 2 // t h e r a t e o f i r r e v e r s i b i l i t y o f a h e a t e n g i n e 3 clear 4 clc 5 Tsink =300 //Temp . o f s i n k i n K 6 Tsource =1200 //Temp . o f s o u r c e i n K 7 nthrev =1 - Tsink / Tsource // e f f i c i e n c y o f c a r n o t e n g i n e 8 Qin =500 // r a t e a t which h e a t i s r e c e i v e d from t h e 9 10 11 12 13

s o u r c e i n kW Wrev = nthrev * Qin //maximum power p r o d u c e d by a h e a t e n g i n e i n kW Wout =180 // a c t u a l power o u t p u t i n kW I = Wrev - Wout // i r r e v e r s i b i l i t y r a t e o f t h e p r o c e s s i n kW printf ( \ n Hence , t h e r e v e r s i b l e power f o r t h i s p r o c e s s i s = %. 0 f kW. \ n , Wrev ) ; printf ( \ n The i r r e v e r s i b i l i t y r a t e i s = %. 0 f kW. \ n ,I ) ;

75

Scilab code Exa 8.4 Irreversibility during cooling of an iron block


1 2 3 4 5 6 7 8 9 10 11 12 13

// e x a m p l e 4 // i r r e v e r s i b i l i t y d u r i n g c o o l i n g o f an i r o n b l o c k clear clc m =500 // mass o f i r o n b l o c k i n kg cavg =0.45 // kJ / kg K T1 =473 // I n i t i a l Temp . i n K T2 =300 // F i n a l Temp . i n K Wrev = m * cavg *(( T1 - T2 ) - T2 * log ( T1 / T2 ) ) // r e v e r s i b l e work i n kJ Wu =0 I = Wrev - Wu // i r r e v e r s i b i l i t y o f t h e p r o c e s s i n kJ printf ( \ n Hence , t h e r e v e r s i b l e owrk f o r t h e p r e s s u r e o i s = %. 0 f kJ . \ n , Wrev ) ; printf ( \ n and i r r e v e r s i b i l i t y o f t h e p r o c e s s i s = % . 0 f kJ . \ n ,I ) ;

Scilab code Exa 8.5 Heating potential of a hot iron block


1 // e x a m p l e 5 2 // h e a t i n g p o t e n t i a l o f a h o t i r o n b l o c k 3 clear 4 clc 5 Tl =278 // Outdoor temp . i n K 6 Th =300 //Room temp . i n K 7 COPhp =1/(1 - Tl / Th ) // c o e f f i c i e n t o f p e r f o r m a n c e o f

heat engine i f

8 E =38925 -8191+13.6*8191 // p o t e n t i a l

i t s assumed t o be r e v e r s i b l e energy o f hot i r o n b l o c k i n kJ

76

printf ( \ n Hence , t h e maxuimum amount o f h e a t t h a t can be s u p p l i e d t o t h e h o u s e i s = %. 0 f MJ . \ n ,E /1000) ;

Scilab code Exa 8.6 Second law eciency of resistance heaters


1 // e x a m p l e 6 2 // s e c o n d law e f f i c i e n c y o f r e s i s t a n c e h e a t e r s 3 clear 4 clc 5 Tl =283 // Outdoor Temp . i n K 6 Th =294 // I n d o o r Temp . i n K 7 COPhp =1/(1 - Tl / Th ) // c o e f f i c i e n t o f p e r f o r m a n c e o f

r e v e r s i b l e heat engine 8 COP =1 // f i r s t law e f f i c i e n c y 9 n = COP / COPhp // s e c o n d law e f f i c i e n c y o f r e s i s t a n c e heater 10 printf ( \ n Hence , t h e s e c o n d law e f f i c i e n c y o f t h e h e a t e r i s = %. 1 f p e r c e n t . \ n ,n *100) ;

Scilab code Exa 8.7 Work Potential of compressed air in tank


1 2 3 4 5 6 7 8 9 10 11

// e x a m p l e 7 // work p o t e n t i a l o f c o m p r e s s e d a i r i n t a n k clear clc To =300 // i n K T1 = To R =0.287 // kPam3/ kg K V =200 // i n m3 P1 =1000 // kPa m1 = P1 * V /( R * T1 ) // i n kg Po =100 // i n kPa 77

12 o1 = R * To *( log ( P1 / Po ) + Po / P1 -1) // kJ / kg 13 X1 = m1 * o1 // e x e r g y c o n t e n t o f c o m p r e s s e d a i r i n kJ 14 printf ( \ n Hence , t h e e x e r g y c o n t e n t o f c o m p r e s s e d

a i r i s = %. 0 f MJ . \ n , X1 /1000) ;

Scilab code Exa 8.8 Exergy change during a compression process // e x a m p l e 8 // e x e r g y c h a n g e d u r i n g a c o m p r e s s i o n p r o c e s s clear clc P1 =0.14 //MPa T1 = -10 // i n c e l s i u s h1 =246.36 // kJ / kg s1 =0.9724 // kJ / kg K P2 =0.8 //MPa T2 =50 // C h2 =286.69 // kJ / kg s2 =0.9802 // kJ / kg K To =293 // i n K dw = h2 - h1 - To *( s2 - s1 ) // e x e r g y c h a n g e o f t h e r e f r i g e r a n t i n kJ / kg 15 winmin = dw // t h e minimum work i n p u t t h a t n e e d s t o be s u p p l i e d t o t h e c o m p r e s s o r p e r u n i t mass o f t h e r e f r i g e r a n t i n kJ / kg 16 printf ( \ n Hence , t h e minimum work i n p u t t h a t n e e d s t o be s u p p l i e d t o t h e c o m p r e s s o r p e r u n i t mass o f t h e r e f r i g e r a n t i s = %. 1 f kJ / kg . \ n , winmin ) ;
1 2 3 4 5 6 7 8 9 10 11 12 13 14

Scilab code Exa 8.10 Exergy destruction during heat conduction


1 2

// e x a m p l e 10 // e x e r g y d e s t r u c t i o n d u r i n g h e a t c o n d u c t i o n 78

3 clear 4 clc 5 To =273 // t e m p e r a t u r e o f o u t d o o r i n K 6 Tin =293 // t e m p e r a t u r e o f i n n e r s u r f a c e 7 8 9 10 11

12 13

of brick wall in K Tout =278 // t e m p e r a t u r e o f o u t e r s u r f a c e o f b r i c k wall in K Q =1035 // r a t e o f h e a t t r a n s f e r t h r o u g h w a l l i n W Xdestroyed = Q *(1 - To / Tin ) -Q *(1 - To / Tout ) // e x e r g y destruction in wall in W Th =300 // t e m p e r a t u r e o f h o u s e i n K Xdestroyedtotal = Q *(1 - To / Th ) -Q *(1 - To / To ) // t h e r a t e of t o t a l exergy d e s t r u c t i o n during t h i s heat transfer process printf ( \ n Hence , t h e r a t e o f e x e r g y d e s t r u c t i o n i n t h e w a l l i s = %. 1 f W. \ n , Xdestroyed ) ; printf ( \ n Hence , r a t e o f t o t a l e x e r g y d e s t r u c t i o n a s s o c i a t e d w i t h t h i s h e a t t r a n s f e r p r o c e s s i s =%. 1 f W. \ n , Xdestroyedtotal ) ;

Scilab code Exa 8.11 Exergy destruction during expansion of steam


1 2 3 4 5 6 7 8 9 10 11 12 13

// e x a m p l e 11 // e x e r g y d e s t r u c t i o n d u r i n g e x p a n s i o n o f steam clear clc P1 =1 // i n MPa T1 =300 // i n c e l s i u s u1 =2793.7 // kJ / kg v1 =0.25799 //m3/ kg s1 =7.1246 // kJ / kg K P2 =200 // i n kPa T2 =150 // i n C u2 =2577.1 // i n kJ / kg v2 =0.95986 // i n m3/ kg 79

14 15 16 17 18 19 20 21 22 23 24 25

26 27 28 29 30 31 32 33

s2 =7.2810 // i n kJ / kg K P0 =100 // i n kPa T0 =298 // i n K u0 =104.83 // i n kJ / kg v0 =0.00103 // i n m3/ kg s0 =0.3672 // i n kJ / kg K m =0.05 // i n kg X1 = m *(( u1 - u0 ) - T0 *( s1 - s0 ) + P0 *( v1 - v0 ) ) // i n i t i a l e x e r g y o f t h e s y s t e m i n kJ X2 = m *(( u2 - u0 ) - T0 *( s2 - s0 ) + P0 *( v2 - v0 ) ) // f i n a l e x e r g y o f t h e s y s t e m i n kJ dX = X2 - X1 // e x e r g y c h a n g e f o r t h e p r o c e s s i n kJ Qout =2 // Heat l o s s e s from t h e s y s t e m t o t h e s u r r o u n d i n g s i n kJ Wbout = - Qout - m *( u2 - u1 ) // t o t a l boundary work done by t h e system , i n c l u d i n g t h e work done a g a i n s t t h e a t m o s p h e r e t o push t h e a t m o s p h e r i c a i r o u t o f t h e way d u r i n g t h e e x p a n s i o n p r o c e s s i n kJ Wu = Wbout - P0 * m *( v2 - v1 ) // u s e f u l work i n kJ Xdestroyed = X1 - X2 - Wu // e x e r g y d e s t r o y e d i n kJ n = Wu /( X1 - X2 ) // s e c o n d law e f f i c i e n c y f o r t h i s process printf ( \ n Hence , t h e e x e r g y o f t h e steam a t t h e i n i t i a l s t a t e i s = %. 1 f kJ . \ n , X1 ) ; printf ( \ n Hence , t h e e x e r g y o f t h e steam a t t h e f i n a l s t a t e i s = %. 1 f kJ . \ n , X2 ) ; printf ( \ n Hence , t h e e x e r g y c h a n g e o f t h e steam i s = %. 1 f kJ . \ n , dX ) ; printf ( \ n Hence , t h e e x e r g y d e s t r o y e d i s = %. 1 f kJ . \ n , Xdestroyed ) ; printf ( \ n Hence , t h e e x e r g y d e s t r o y e d i s = %. 1 f p e r c e n t . \ n ,n *100) ;

Scilab code Exa 8.12 exergy destroyed during stirring of gas

80

// e x a m p l e 12 // e x e r g y d e s t r o y e d d u r i n g s t i r r i n g o f g a s clear clc T0 =530 // t e m p e r a t u r e o f s u r r o u n d i n g a i r i n R m =2 // mass o f a i r i n i n s u l a t e d r i g i d t a n k i n lbm cv =0.172 // i n Btu / lbmR T2 =590 // i n i t i a l t e m p e r a t u r e o f a i r i n R T1 =530 // f i n a l t e m p e r a t u r e o f a i r i n R Xdestroyed = T0 * m * cv * log ( T2 / T1 ) // e x e r g y d e s t r o y e d i n Btu 11 Wrevin = m * cv *( T2 - T1 ) - Xdestroyed // minimum work i n p u t i n Btu 12 printf ( \ n Hence , t h e e x e r g y d e s t r o y e d i s = %. 1 f Btu . \ n , Xdestroyed ) ; 13 printf ( \ n Hence , t h e r e v e r s i b l e work f o r t h i s process i s = %. 1 f Btu . \ n , Wrevin ) ;
1 2 3 4 5 6 7 8 9 10

Scilab code Exa 8.13 Dropping of hot iron block in water


1 // e x a m p l e 13 2 // d r o p p i n g o f h o t i r o n b l o c k i n w a t e r 3 clear 4 clc 5 miron =5 // mass o f i r o n b l o c k i n kg 6 mwater =100 // mass o f w a t e r i n kg 7 ciron =0.45 // s p e c i f i c h e a t c a p a c i t y o f 8 9 10 11

i r o n i n kJ / kg

C cwater =4.18 // s p e c i f i c h e a t c a p a c i t y o f w a t e r i n kJ / kg C Tiiron =350 // i n i t i a l t e m p e r a t u r e o f i r o n i n C e l s i u s Tiwater =30 // i n i t i a l t e m p e r a t u r e o f w a t e r i n C e l s i u s Tf =( miron * ciron * Tiiron + mwater * cwater * Tiwater ) /( miron * ciron + mwater * cwater ) // f i n a l e q u i l b r i u m temperature in Celsius 81

12 T0 =293 // t e m p e r a t u r e o f s u r r o u n d i n g s i n K 13 X1iron = miron * ciron *(( Tiiron +273) -T0 - T0 * log (( Tiiron 14 15 16 17 18 19 20 21 22 23

+273) / T0 ) ) // i n i t i a l e x e r g y o f i r o n X1water = mwater * cwater *(( Tiwater +273) -T0 - T0 * log (( Tiwater +273) / T0 ) ) // i n i t i a l e x e r g y o f w a t e r X1total = X1iron + X1water // t o t a l i n i t i a l e x e r g y X2iron = miron * ciron *(( Tf +273) -T0 - T0 * log (( Tf +273) / T0 ) ) // f i n a l l e x e r g y o f i r o n X2water = mwater * cwater *(( Tf +273) -T0 - T0 * log (( Tf +273) / T0 ) ) // f i n a l e x e r g y o f w a t e r X2total = X2iron + X2water // t o t a l e x e r g y i n kJ Xdestroyed = X1total - X2total // e x e r g y d e s t r o y e d i n kJ printf ( \ n Hence , t h e f i n a l e q u i l b r i u m t e m p e r a t u r e i s = %. 1 f c e l s i u s . \ n , Tf ) ; printf ( \ n The e x e r g y o f t h e combined s y s t e m a t t h e i n i t i a l s t a t e i s = %. 0 f kJ . \ n , X1total ) ; printf ( \ n The e x e r g y o f t h e combined s y s t e m a t t h e f i n a l s t a t e i s = %. 1 f kJ . \ n , X2total ) ; printf ( \ n The w a s t e d work p o t e n t i a l d u r i n g t h i s p r o c e s s i s = %. 1 f kJ . \ n , Xdestroyed ) ;

Scilab code Exa 8.14 Exergy destruction during heat transfer to a gas // e x a m p l e 14 // e x e r g y d e s t r u c t i o n d u r i n g h e a t t r a n s f e r t o a g a s clear clc P1 =350 // i n kPa V1 =0.01 // i n m3 V2 =0.02 // i n m3 Wb = P1 * V1 * log ( V2 / V1 ) // q u a s i e q u i l b r i u m boundary work i n kJ 9 P0 =100 // a t m o s p h e r i c p r e s s u r e i n kPa 10 Wsurr = P0 *( V2 - V1 ) // work done a g a i n s t t h e a t m o s p h e r i c p r e s s u r e i n kJ
1 2 3 4 5 6 7 8

82

11 Wu = Wb - Wsurr // u s e f u l work i n kJ 12 Tsys =400 // t e m p e r a t u r e o f s y s t e m i n K 13 Tr =1200 // t e m p e r a t u r e t e m p e r a t u r e o f t h e boundary i n

K
14 Q = Wb // h e a t t r a n s f e r from f u r n a c e t o s y s t e m 15 Sgen = Q / Tsys - Q / Tr // i n kJ /K 16 T0 =300 // t e m p e r a t u r e o f a t m o s p h e r i c a i r i n K 17 Xdestroyed = T0 * Sgen // e x e r g y d e s t r o y e d i n kJ 18 Wrevout = T0 * Q / Tsys - Wsurr +(1 - T0 / Tr ) * Q // r e v e r s i b l e

work i n kJ 19 printf ( \ n The u s e f u l work o u t p u t i s = %. 2 f kJ . \ n , Wu ) ; 20 printf ( \ n The e x e r g y d e s t r o y e d i s = %. 2 f kJ /K . \ n , Xdestroyed ) ; 21 printf ( \ n The r e v e r s i b l e work f o r t h i s p r o c e s s i s = %. 2 f kJ . \ n , Wrevout ) ;

Scilab code Exa 8.15 second law analysis of steam turbine


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

// e x a m p l e 15 // s e c o n d law a n a l y s i s o f steam t u r b i n e clear clc P1 =3 // i n MPa T1 =450 // i n C h1 =3344.9 // i n kJ / kg s1 =7.0856 // i n kJ / kg K P2 =0.2 // i n MPa T2 =150 // i n C h2 =2769.1 // i n kJ / kg s2 =7.2810 // i n kJ / kg K P0 =100 // i n kPa T0 =25 // i n C h0 =104.83 // i n kJ / kg s0 =0.3672 // i n kJ / kg K 83

17 m =8 // mass f l o w r a t e o f t u r b i n e i n kg / s 18 Qout =300 // h e a t l o s s t o s u r r o u n d i n g a i r i n kW 19 Wout = m *( h1 - h2 ) - Qout // a c t u a l power o u t p u t o f t u r b i n e 20 21 22 23 24 25 26 27 28

i n kW Wrevout = m *(( h1 - h2 ) -( T0 +273) *( s1 - s2 ) ) // r e v e r s i b l e power i n kW n = Wout / Wrevout // s e c o n d law e f f i c i e n c y Xdestroyed = Wrevout - Wout // e x e r g y d e s t r o y e d i n kW w1 = h1 - h0 -( T0 +273) *( s1 - s0 ) //maximum work p o t e n t i a l i n kJ / kg printf ( \ n Hence , The a c t u a l power o u t p u t i s = %. 0 f kW. \ n , Wout ) ; printf ( \ n The maximum p o s s i b l e power o u t p u t i s = % . 0 f kW. \ n , Wrevout ) ; printf ( \ n The s e c o n d law e f f i c i e n c y i s = %. 1 f p e r c e n t . \ n ,n *100) ; printf ( \ n The e x e r g y d e s t r o y e d i s = %. 0 f kW. \ n , Xdestroyed ) ; printf ( \ n The e x e r g y o f t h e steam a t t h e i n l e t c o n d i t i o n s i s =%. 0 f kJ / kg . \ n , w1 ) ;

Scilab code Exa 8.16 exergy destroyed during mixing of uid streams
1 2 3 4 5 6 7 8 9 10 11 12

// e x a m p l e 16 // e x e r g y d e s t r o y e d d u r i n g m i x i n g o f f l u i d s t r e a m s clear clc m1 =300 // i n lbm / min h1 =18.07 // i n Btu / lbm T0 =530 // t e m p e r a t u r e o f a t m o s p h e r i c a i r i n R s1 =0.03609 // Btu / lbmR m2 =22.7 // i n lbm / min h2 =1162.3 // i n Btu / lbm s2 =1.7406 // i n Btu / lbmR m3 =322.7 // i n lbm / min 84

13 h3 =97.99 // i n Btu / lbm 14 s3 =0.18174 // i n Btu / lbmR 15 Wrevout = m1 *( h1 - T0 * s1 ) + m2 *( h2 - T0 * s2 ) - m3 *( h3 - T0 * s3 ) //

r e v e r s i b l e power i n Btu / min Xdestroyed = Wrevout // i n Btu / min printf ( \ n The r e v e r s i b l e work f o r t h e p r o c e s s i s = %. 0 f Btu / min . \ n , Wrevout ) ; 18 printf ( \ n The r a t e o f e x e r g y d e s t r u c t i o n i s = %. 0 f Btu / min . \ n , Xdestroyed ) ;
16 17

Scilab code Exa 8.17 Charging of compressed air storage system


1 2 3 4 5 6 7 8 9 10 11 12

// e x a m p l e 17 // c h a r g i n g o f c o m p r e s s e d a i r s t o r a g e s y s t e m clear clc P2 =1000 // i n kPa V =200 // volume o f r i g i d t a n k i n m3 R =0.287 // kPam3/ kg K T2 =300 // i n K m2 = P2 * V /( R * T2 ) // f i n a l mass o f t h e a i r i n kg P0 =100 // a t m o s p h e r i c p r e s s s u r e i n kPa T0 =300 // a t m o s p h e r i c t e m p e r a t u r e i n K o2 = R * T0 *( log ( P2 / P0 ) + P0 / P2 -1) // e x e r g y o f t h e p r e s s u r i s e d a i r i n t h e t a n k i n kJ / kg 13 Wrev = m2 * o2 // r e v e r s i b l e work i n kJ 14 printf ( \ n The minimum work r e q u i r e m e n t f o r t h e p r o c e s s i s = %. 0 f MJ . \ n , Wrev /1000) ;

85

Chapter 9 Gas Power Cycle

Scilab code Exa 9.2 The Ideal Otto Cycle


1 // q u e s 2 2 // The I d e a l Otto C y c l e 3 clear 4 clc 5 // t h e t e m p e r a t u r e and p r e s s u r e

6 7 8 9 10 11 12 13 14 15 16 17 18

o f a i r a t t h e end o f the i s e n t r o p i c compression proc ess ( s t a t e 2) , u s i n g d a t a from T a b l e A 1 7 T1 =290; // i n i t i a l temp i n K u1 =206.9; // i n i t i a l i n t e r n a l e n e r g y i n kJ / kg vr1 =676.1; // i n i t i a l r e d u c e d volume // P r o c e s s 1 2 ( i s e n t r o p i c c o m p r e s s i o n o f an i d e a l gas ) // v r 2 / v r 1=v2 / v1 =1/ r r =8; // r a t i o vr2 = vr1 / r ; // r e d u c e d volume a t s t a t e 2 // u s i n g t a b l e c o r r e s p o n d i n g t o v r 2 T2 =652.4; // f i n a l temp i n K u2 =475.11; // f i n a l i n t e r n a l e n e r g y i n kJ / kg P1 =100; // i n i t i a l p r e s s u r e i n kPa P2 = P1 * T2 / T1 * r ; // f i n a l p r e s s u r e i n kPa // P r o c e s s 2 3 ( c o n s t a n t volume h e a t a d d i t i o n ) 86

19 20 21 22 23 24 25

Qin =800; // h e a t i n p u t i n kJ / kg u2 =1275.11; // i n t e n a l e n e r g y a t s t a t e 2 i n kJ / kg u3 = Qin + u2 ; // i n t e r n a l e n e r g y a t s t a t e 3 i n kJ / kg // u s i n g t a b l e s c o r r e s p o n d i n g t o u3 T3 =1575.1; // t e m p e r a t u r e a t s t a t e 3 i n K vr3 =6.108; // r e d u c e d volume a t s t a t e 3 printf ( ( a ) T3 , T e m p e r a t u r e a t s t a t e 3 = %. 1 f K \ n , T3 ) ; 26 vr3 =6.108; // r e d u c e d volume a t s t a t e 3 27 P3 = P2 *( T3 / T2 ) *1; // 1 f o r v2 / v3 28 printf ( P r e s s u r e P3 = %. 3 f MPa \ n , P3 /1000) ;
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44

// ( b ) vr3 = r * vr3 ; // now from t a b l e T4 =795.6; // temp a t s t a t e 4 i n K u4 =588.74; // i n t e r n a l e n e r g y a t s t a t e 4 i n kJ / kg // P r o c e s s 4 1 ( c o n s t a n t volume h e a t r e j e c t i o n ) Qout = u4 - u1 ; // h e a t o u t p u t i n kJ / kg w = Qin - Qout ; // work done i n kJ / kg printf ( ( b ) Net work done = %. 2 f kJ / kg \ n ,w ) ;

// ( c ) nth = w / Qin ; // e f f i c i e n c y o f h e a t e n g i n e k =1.4; // c o n s t a n t no =1 - r ^(1 - k ) ; // t h e r m a l e f f i c i e n c y printf ( ( c ) The t h e r m a l e f f i c i e n c y o f t h e c y c l e i s d e t e r m i n e d from i t s d e f i n i t i o n = %. 3 f \ n , nth ) ; 45 printf ( Under t h e c o l d a i r s t a n d a r d a s s u m p t i o n s t h e r m a l e f f i c i e n c y would be = %. 3 f \ n , no ) ;
46 47 48

49 50 51 52

// ( d ) // The mean e f f e c t i v e p r e s s u r e i s d e t e r m i n e d from i t s definition R =0.287 // g a s c o n s t a n t f o r w a t e r v1 = R * T1 / P1 // s p e c i f i c volume a t s t a t e 1 MEP = w /( v1 *(1 -1/ r ) ) ; // mean e f f e c t i v e p r e s s u r e i n kPa printf ( ( d ) Mean e f f e c t i v e p r e s s u r e = %. 0 f kPa \ n , 87

MEP ) ;

Scilab code Exa 9.3 The Ideal Diesel Cycle


1 // q u e s 3 2 // The I d e a l D i e s e l C y c l e 3 clear 4 clc 5 disp ( ( a ) ) ; 6 // ( a ) t h e t e m p e r a t u r e and p r e s s u r e 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

o f a i r a t t h e end

o f each p r o c e s s v1 =117; // volume a t s t a t e 1 i n i n 3 r =18; // volume r a t i o f o r 1 2 p r o c e s s v2 = v1 / r ; // volume a t s t a t e 2 i n i n 3 rc =2; // volume r a t i o f o r 2 3 p r o c e s s v3 = rc * v2 ; // volume a t s t a t e 3 i n i n 3 v4 = v1 ; // volume s t a t e 4 i n i n 3 // P r o c e s s 1 2 ( i s e n t r o p i c c o m p r e s s i o n o f an i d e a l gas , c o n s t a n t s p e c i f i c h e a t s ) T1 =540; // t e m p e r a t u r e a t s t a t e 1 i n R k =1.4; // c o n s t a n t T2 = T1 *( v1 / v2 ) ^( k -1) // t e m p e r a t u r e i n s t a t e 2 i n R r= v1 / v2 P1 =14.7; // p r e s s u r e a t s t a t e 1 i n p s i a P2 = P1 *( v1 / v2 ) ^ k // p r e s s u r e a t s t a t e 2 i n p s i a // P r o c e s s 2 3 ( c o n s t a n t p r e s s u r e h e a t a d d i t i o n t o an i d e a l gas ) P3 = P2 // p r e s s u r e a t s t a t e 3 i n p s i a T3 = T2 *( v3 / v2 ) // temp a t s t a t e 3 i n R r c=v3 / v2 // P r o c e s s 3 4 ( i s e n t r o p i c e x p a n s i o n o f an i d e a l gas , constant s p e c i f i c heats ) T4 = T3 *( v3 / v4 ) ^( k -1) // temp a t s t a t e 4 i n R P4 = P3 *( v3 / v4 ) ^ k // p r e s s u r e a t s t a t e 4 i n p s i a // ( b ) 88

27 R =0.3704 // g a s c o n s t a n t

f o r g i v e n s u b s t a n c e i n btu /R .

lbm
28 m = P1 * v1 /( R * T1 ) /1728; // mass i n lbm 29 // P r o c e s s 2 3 i s a c o n s t a n t p r e s s u r e h e a t a d d i t i o n

p r o c e s s , f o r which t h e boundary work and du t e r m s can be combined t o dh 30 Cp =0.240 // s p e c i f i c h e a t a t c o n s t a n t p r e s s u r e i n Btu / lbm . R


31 32 Qin = m * Cp *( T3 - T2 ) ; // h e a t i n p u t i n Btu 33 34 // P r o c e s s 4 1 i s a c o n s t a n t volume h e a t r e j e c t i o n

process 35 Cv =0.171; // s p e c i f i c h e a t c a p a c i t y a t c o n s t a n t volume i n Btu / lbm . R 36 Qout = m * Cv *( T4 - T1 ) ; // h e a t o u t p u t i n Btu


37 38 w = Qin - Qout ; // work done i n Btu 39 printf ( ( b ) Net work done = %. 3 f Btu \ n ,w ) ; 40 nth = w / Qin ; // e f f i c i e n c y o f h e a t e n g i n e 41 printf ( The t h e r m a l e f f i c i e n c y = %. 3 f \ n , nth ) ; 42 43 // ( c ) The mean e f f e c t i v e p r e s s u r e 44 MEP = w /( v1 - v2 ) *778*12; // mean e f f e c t i v e p r e s s u r e (

m u l t i p l i e d by c o n s t a n t s f o r u n i t c o n v e r s i o n t o psia ) 45 printf ( ( c ) Mean e f f e c t v e p r e s s u r e = %. 0 f p s i a \ n , MEP ) ;

Scilab code Exa 9.5 The Simple Ideal Brayton Cycle


1 // q u e s 5 2 // The S i m p l e I d e a l B r a y t o n C y c l e 3 clear 4 clc

89

5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33

// P r o c e s s 1 2 ( i s e n t r o p i c c o m p r e s s i o n o f an i d e a l gas ) T1 =300; // i n i t i a l temp i n K // from t a b l e h1 =300.19; // e n t h a l p y o f h e a t a t s t a t e 1 i n kJ / kg Pr1 =1.386; // r e d u c e d p r e s s u r e a t s t a t e 1 r =8; // c o n s t a n t r a t i o Pr2 = r * Pr1 ; // r e d u c e d p r e s s u r e a t s t a t e 2 , r=P2/P1 // u s i n g t a b l e c o r r e s p o n d i n g t o Pr2 T2 =540; // t e m p e r a t u r e a t s t a t e 2 i n K printf ( ( a ) T e m p e r a t u r e a t c o m p r e s s o r e x i t T2 = %. 0 f K \ n , T2 ) ; h2 =544.35; // e n t h a l p y o f h e a t a t s t a t e 2 // P r o c e s s 3 4 ( i s e n t r o p i c e x p a n s i o n o f an i d e a l g a s ) T3 =1300; // t e m p e r a t u r e a t s t a t e 3 i n K h3 =1395.97; // e n t h a l p y o f h e a t a t s t a t e 3 i n kJ / kg Pr3 =330.9; // r e d u c e d p r e s s u r e a t s t a t e 3 Pr4 = Pr3 / r ; // r e d u c e d p r e s s u r e a t s t a t e 4 , 1/ r=P4/P3 // from t a b l e T4 =770; // t e m p e r a t u r e a t s t a t e 4 i n K printf ( T e m p e r a t u r e a t t u r b i n e = %. 0 f K \ n , T4 ) ; h4 =789.37; // e n t h a l p y o f h e a t a t s t a t e 4 i n kJ / kg //To f i n d t h e back work r a t i o Win = h2 - h1 // work i n p u t i n kJ / kg Wout = h3 - h4 // work o u t p u t i n kJ / kg Rbw = Win / Wout ; // back work r a t i o printf ( ( b ) Back work r a t i o = %. 3 f \ n , Rbw ) ; Qin = h3 - h2 ; // h e a t i n p u t i n kJ / kg Wnet = Wout - Win ; // n e t work nth = Wnet / Qin ; // t h e r m a l e f f i c i e n c y printf ( ( c ) Thermal e f f i c i e n c y = %. 3 f , nth ) ;

Scilab code Exa 9.6 An Actual Gas Turbine Cycle


1

// q u e s 6 90

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

//An A c t u a l Gas T u r b i n e C y c l e clear clc ws =244.16; // kJ / kg nc =0.80; // c o m p r e s s o r e f f i c i e n c y Win = ws / nc ; // work i n p u t i n kJ / kg nt =0.85; // T u r b i n e e f f i c i e n c y ws2 =606.60; Wout = nt * ws2 ; // work o u t p u t i n kJ / kg Rbw = Win / Wout ; // back work r a t i o printf ( ( a ) Back work r a t i o = %. 3 f \ n , Rbw ) ; // ( b ) now a i r l e a v e s t h e c o m p r e s s o r a t a h i g h e r t e m p e r a t u r e and e n t h a l p y h1 =300.19; // e n t h a l p y o f h e a t s t a t e 1 i n kJ / kg h2a = h1 + Win ; // e n t h a l p y o f h e a t ( a ) i n kJ / kg h3 =1395.97; // e n t h a l p y o f h e a t a t s t a t e 3 i n kJ / kg Qin = h3 - h2a ; // h e a t i n p u t i n kJ / kg Wnet = Wout - Win ; // n e t work done i n kJ / kg nth = Wnet / Qin ; // t h e r m a l e f f i c i e n c y printf ( ( b ) Thermal E f f i c i e n c y = %. 3 f \ n , nth ) ; // The a i r t e m p e r a t u r e a t t h e t u r b i n e e x i t i s d e t e r m i n e d from an e n e r g y b a l a n c e on t h e t u r b i n e h4a = h3 - Wout ; // e n t h a l p y o f h e a t ( a ) a t s t a t e 4 i n kJ / kg //Now from t a b l e 17 T4a =853; // t e m p e r a t u r e ( a ) a t s t a t e 4 i n K printf ( ( c ) T e m p e r a t u r e T4a = %. 0 f K , T4a ) ;

Scilab code Exa 9.7 Actual Gas Turbine Cycle with Regeneration
1 // q u e s 7 2 // A c t u a l Gas T u r b i n e C y c l e w i t h R e g e n e r a t i o n 3 clear 4 clc 5 // The T s d i a g r a m o f t h e c y c l e i s shown i n F i g . 9 4 1

91

6 7 8 9 10 11 12

13 14 15

i n book h2a =605.39; // e n t h a l p y o f h e a t ( a ) a t s t a t e 2 i n kJ / kg h4a =880.36; // e n t h a l p y o f h e a t ( a ) a t s t a t e 4 i n kJ / kg e =0.80; // e f f e c t i v e n e s s h5 = e *( h4a - h2a ) + h2a ; // e n t h a l p y o f h e a t a t s t a t e 5 i n kJ / kg h3 =1395.6; // e n t h a l p y o f h e a t a t s t a t e 3 i n kJ / kg Qin = h3 - h5 ; // h e a t i n p u t i n kJ / kg // T h i s r e p r e s e n t s a s a v i n g s o f 2 2 0 . 0 kJ / kg from t h e h e a t i n p u t r e q u i r e m e n t s . The a d d i t i o n o f a r e g e n e r a t o r ( assumed t o be f r i c t i o n l e s s ) d o e s n o t a f f e c t t h e n e t work o u t p u t w =210.41; // work dodne i n kJ / kg nth = w / Qin ; // e f f i c i e n c y printf ( Thermal e f f i c i e n c y = %. 3 f , nth ) ;

Scilab code Exa 9.8 A Gas Turbine with Reheating and Intercooling
1 // q u e s 8 2 //A Gas T u r b i n e w i t h R e h e a t i n g and I n t e r c o o l i n g 3 clear 4 clc 5 // For two s t a g e c o m p r e s s i o n and e x p a n s i o n , t h e work

i n p u t i s m i n i m i z e d and t h e work o u t p u t i s maximized when b o t h s t a g e s o f t h e c o m p r e s s o r and t h e t u r b i n e have t h e same p r e s s u r e r a t i o


6 7 8 9 10 11

// P2/P1=P4/P3=P6/P7=P8/P9=s q r t ( 8 )=r // At i n l e t s : T1=T3 h1=h3 T6=T8 h6=h8 // At o u t l e t T2=T4 h2=h4 T7=T9 h7=h9 // I n t h e a b s e n c e o f any r e g e n e r a t i o n , t h e back work r a t i o and t h e t h e r m a l e f f i c i e n c y a r e d e t e r m i n e d by u s i n g d a t a from T a b l e A 1 7 92

12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36

T1 =300; // t e m p e r a t u r e a t s t a t e 1 i n K h1 =300.19; // e n t h a l p y a t s t a t e 1 i n kJ / kg T3 = T1 ; // t e m p e r a t u r e a t s t a t e 3 i n K h3 = h1 ; // e n t h a l p y a t s t a t e 3 Pr1 =1.386; // r e d u c e d p r e s s u r e a t s t a t e 1 r = sqrt (8) ; // c o n s t a n t r a t i o Pr2 = Pr1 * r ; // h e r e r i s f o r P2/P1 // from t a b l e T2 =403.3; // temp a t s t a t e 2 i n K T4 = T2 ; // temp a t s t a t e 4 i n K h2 =404.31; // e n t h a l p y a t s t a t e 2 i n kJ / kg h4 = h2 ; // e n t h a l p y a t s t a t e 4 T6 =1300; // t e m p e r a t u r e a t s t a t e 6 i n K T8 = T6 ; // temp a t s t a t e 8 h6 =1395.97; // e n t h a l p y a t s t a t e 6 h8 = h6 ; // e n t h a l p y a t s t a t e 8 Pr6 =330.9; // r e d u c e d p r e s s u r e a t s t a t e 6 Pr7 =1/ r * Pr6 ; // r e d u c e d p r e s s u r e a t s t a t e 7 T7 =1006.4; // t e m p e r a t u r e a t s t a t e 7 i n K T9 = T7 ; // t e m p e r a t u r e a t s t a t e 9 i n K h7 =1053.33; // e n t h a l p y a t s t a t e 7 i n kJ / kg h5 = h7 ; // e n t h a l p y a t s t a t e 5 h9 = h7 ; // e n t h a l p y a t s t a t e 9 Wcompin =2*( h2 - h1 ) ; // i n p u t work i n c o m p r e s s i o n i n kJ / kg Wturbout =2*( h6 - h7 ) ; // o u t p u t t u r b i n e work i n kJ / kg Wnet = Wturbout - Wcompin ; // n e t work done i n kJ / kg Qin =( h6 - h4 ) +( h8 - h7 ) ; // i n p u t h e a t i n kJ / kg Rbw = Wcompin / Wturbout ; // back work r a t i o printf ( ( a ) Back work r a t i o = %. 3 f \ n , Rbw ) ; nth = Wnet / Qin ; // t h e r m a l e f f i c i e n c y printf ( ( b ) Thermal E f f i c i e n c y = %. 3 f \ n , nth ) ;

37 38 39 40 41 42 43 44 45 // ( b ) 46 qin =( h6 - h5 ) +( h8 - h7 ) ; // i n p u t s p e c i f i c h e a t i n kJ / kg 47 nth = Wnet / qin ; // t h e r m a l e f f i c i e n c y 48 printf ( ( c ) Thermal e f f i c i e n c y i n t h i s c a s e = %. 3 f

93

\ n , nth ) ;

Scilab code Exa 9.9 The Ideal Jet Propulsion Cycle


1 // e x 9 2 // The I d e a l J e t P r o p u l s i o n C y c l e 3 clear 4 clc 5 // P r o c e s s 1 2 ( i s e n t r o p i c c o m p r e s s i o n o f an i d e a l 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

gas in a d i f f u s e r ) T1 =420; // temp a t s t a t e 1 i n R v1 =850; // v e l o c i t y a t s t a t e 1 i n f t / s Cp =0.240; // Btu / lbm . R T2 = T1 + v1 ^2/(2* Cp ) /25037; // temp a t s t a t e 2 ( d i v i d e d by 2 5 0 3 7 t o c o n v e r t i t i n t o R) P1 =5; // p r e s s u r e a t s t a t e 1 i n p s i a k =1.4; // c o n s t a n t r a t i o P2 = P1 *( T2 / T1 ) ^( k /( k -1) ) ; // p r e s s u r e a t s t a t e 2 i n psia // P r o c e s s 2 3 ( i s e n t r o p i c c o m p r e s s i o n o f an i d e a l gas in a compressor ) rp =10; // c o n s t a n t r a t i o P3 = rp * P2 ; // p r e s s u r e a t s t a t e 3 i n p s i a P4 = P3 ; // p r e s s u r e a t s t a t e 4 T3 = T2 *( P3 / P2 ) ^(1 -1/ k ) ; // temp a t s t a t e 3 i n R // P r o c e s s 4 5 ( i s e n t r o p i c e x p a n s i o n o f an i d e a l g a s in a turbine ) // Wcompin=Wturbout from t h i s we g e t T5=T4T3+T2 T4 =2460; // temp a t s t a t e 4 i n R T5 = T4 - T3 + T2 ; // temp a t s t a t e 5 i n R P5 = P4 *( T5 / T4 ) ^( k /( k -1) ) ; // p r e s s u r e a t s t a t e 5 i n psia printf ( ( a ) T5 = %. 0 f R \ n , T5 ) ; printf ( P5 = %. 1 f p s i a \ n , P5 ) ; // P r o c e s s 5 6 ( i s e n t r o p i c e x p a n s i o n o f an i d e a l g a s 94

26 27 28 29 30

31 32 33 34 35 36 Wp = ms *( Vexit - Vinlet ) * Vaircraft /25037; // power i n Btu /

in a nozzle ) P6 =5; // p r e s s u r e a t s t a t e 6 i n p s i a T6 = T5 *( P6 / P5 ) ^(1 -1/ k ) ; // temp a t s t a t e 6 i n R v6 = sqrt ( -1*2* Cp *( T6 - T5 ) *25037) ; // v e l o c i t y a t s t a t e 6 in f t /s printf ( ( b ) V e l o c i t y v6 = %. 0 f f t / s \ n , v6 ) ; // The p r o p u l s i v e e f f i c i e n c y o f a t u r b o j e t e n g i n e i s t h e r a t i o o f t h e p r o p u l s i v e power d e v e l o p e d Wp t o the t o t a l heat t r a n s f e r r a t e to the working fluid ms =100; // mass f l o w r a t e i n lbm / s Vexit =3288; // e x i t volume i n f t 3 Vinlet =850; // i n l e t volume i n f t 3 Vaircraft =850; // a i r c r a f t volume i n f t 3

s
37 Qin = ms * Cp *( T4 - T3 ) ; // i n p u t h e a t i n kJ / kg 38 np = Wp / Qin ; // e f f i c i e n c y 39 printf ( ( c ) E f f i c i e n c y = %. 3 f \ n , np ) ;

Scilab code Exa 9.10 Second Law Analysis of an Otto Cycle


1 // e x 1 0 2 // Second Law A n a l y s i s o f an Otto C y c l e 3 clear 4 clc 5 // I n Example 9 2 , v a r i o u s q u a n t i t i e s o f 6 7 8 9 10 11

interest

were g i v e n r =8; // c o n s t a n t r a t i o T0 =290; // temp i n K T1 =290; // temp a t s t a t e 1 i n K T2 =652.4; // temp a t s t a t e 2 i n K T3 =1575.1; // temp a t s t a t e 3 i n K P2 =179.97; // p r e s s u r e a t s t a t e 2 i n kPa 95

12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39

P3 =434.5; // p r e s s u r e a t s t a t e 3 i n kPa Qin =800; // h e a t i n p u t i n kJ / kg Qout =381.83; // h e a t o u t p u t i n kJ / kg Wnet =418.17; // n e t work done i n kJ / kg s3o =3.5045; // e n t r o p y a t s t a t e 3 s2o =2.4975; // e n t r o p y a t s t a t e 2 R =0.287; // g a s c o n s t a n t a t kJ / kg / mol /K s23 = s3o - s2o - R * log ( P3 / P2 ) ; // e n t r o p y c h a n g e f o r s t a t e 2 3 kJ / kg . K Qin =800; // h e a t i n p u t i n kJ / kg Tsource =1700; // s o u r c e t e m p e r a t u r e i n K xdest23 = T0 *( s23 - Qin / Tsource ) ; // i r r e v e r s i b i l t y f o r state 2 3 // For p r o c e s s 4 1 , s14 = - s23 ; // e n t r o p y c h a n g e a t s t a t e 1 4 Qout =381.83; // h e a t o u t p u t i n kJ / kg Tsink =290; // temp o f s i n k i n K xdest41 = T0 *( s14 + Qout / Tsink ) ; // i r r e v e r s i b i l i t y f o r state 4 1 xdest12 =0; // i r r e v e r s i b i l t y f o r s t a t e 1 2 xdest34 =0; // i r r e v e r s i b i l i t y a t s t a t e 3 4 xdestcycle = xdest12 + xdest23 + xdest34 + xdest41 ; // n e t irreversibility printf ( I r r e v e r s i b i l i t y o f c y c l e = %. 1 f kJ / kg \ n , xdestcycle ) ; s40 = - s14 ; // e n t r o p y c h a n g e f o r s t a t e 4 0 i n kJ / k / kg u40 = Qout ; // i n t e r n a l e n e r g y a t s t a t e 4 0 i n kJ / kg v40 =0; // s p e c i f i c volume a t s t a t e 40 i n m3/ kg v41 =0; // s p e c i f i c volume a t s t a t e 41 i n m3/ kg P0 =10; // i n i t i a l p r e s s u r e i n kPa ( j u n k v a l u e a s P0 i s m u l t i p l i e d by z e r o i n n e x t s t a t e m e n t ) Q = u40 - T0 * s40 + P0 * v40 ; // h e a t i n kJ / kg printf ( Exergy d i s t r u c t i o n = %. 1 f kJ / kg \ n ,Q ) ;

96

Chapter 10 Vapor and Combined Power Cycles

Scilab code Exa 10.2 An Actual Steam Power Cycle // e x a m p l e 2 //An A c t u a l Steam Power C y c l e clear clc V1 =0.001009 // s p e c i f i c volume o f steam i n m3/ kg P1 =9 // p r e s s u r e i n s t a t e 1 i n kPa P2 =16000 // p r e s s u r e i n s t a t e 2 f i n a l p r e s s u r e i n kPa np =0.85 // i s e n t r o p i c e f f i c i e n c y o f pump nt =0.87 // i s e n t r o p i c e f f i c i e n c y o f t u r b i n e wpumpin = V1 *( P2 - P1 ) / np //pump work i n p u t i n kJ / kg h4 =3647.6 // s p e c i f i c e n t h a l p y i n s t a t e 4 i n kJ / kg h3 =160.12 // s p e c i f i c e n t h a l p y i n s t a t e 3 i n kJ / kg qin = h4 - h3 // b o i l e r h e a t i n p u t i n kJ / kg h5 =3583.1 // s p e c i f i c e n t h a l p y i n s t a t e 3 i n kJ / kg h6 =2115.32 // s p e c i f i c e n t h a l p y i n s t a t e 3 i n kJ / kg wturbout = nt *( h5 - h6 ) // work o u t p u t o f t u r b i n e i n kJ / kg 17 wnet = wturbout - wpumpin // n e t work done i n kJ / kg 18 n = wnet / qin // t h e m a l e f f i c i e n c y o f t h e c y c l e
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

97

19 m =15 // mass f l o w r a t e i n kg / s 20 Wnet = m * wnet // power p r o d u c e d by t h e power p l a n t i n

kW 21 printf ( \ n Hence , t h e t h e r m a l e f f i c i e n c y o f t h e c y c l e i s = %. 3 f . \ n ,n ) ; 22 printf ( \ n Hence , n e t power o u t p u t o f t h e p l a n t i s = %. 1 f M W. \ n , Wnet /1000) ;

Scilab code Exa 10.3 Eect of Boiler Pressure and Temperature on Eciency
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

// e x a m p l e 3 // E f f e c t o f B o i l e r P r e s s u r e and T e m p e r a t u r e on Efficiency clear clc P1 =10 // p r e s s u r e o f steam i n s t a t e 1 i n kPa P2 =3000 // p r e s s u r e o f steam i n s t a t e 2 i n kPa P3 =3000 // p r e s s u r e o f steam i n s t a t e 3 i n kPa P4 =10 // p r e s s u r e o f steam i n s t a t e 4 i n kPa T3 =350 // temp . o f s t a t e i n s t a t e 3 i n c e l s i u s h3 =3116.1 // s p e c i f i c h e a t e n t h a l p y i n s t a t e 3 i n kJ / kg s3 =6.7450 // s p e c i f i c e n t r o p y i n s t a t e 3 i n kJ / kg K h1 =191.81 // s p e c i f i c h e a t e n t h a l p y i n s t a t e 1 i n kJ > kg v1 =0.00101 // s p e c i f i c volume i n s t a t e 1 i n m3>kg wpumpin =3.02 // work done by t h e pump i n kJ / kg h2 = h1 + wpumpin // s p e c i f i c h e a t e n t h a l p y i n s t a t e 2 i n kJ / kg s3 =6.7450 // s p e c i f i c e n t r o p y i n s t a t e 3 i n kJ / kg K s4 = s3 // s p e c i f i c e n t r o p y i n s t a t e 4 sf =0.6492 // i n kJ / kg K sfg =7.4996 // i n kJ / kg K x4 =( s4 - sf ) / sfg // q u a l i t y o f steam i n s t a t e 4 98

21 hf =191.81 // kJ / kg 22 hfg =2392.1 // kJ / kg 23 h4 = hf + x4 * hfg // s p e c i f i c

heat enthalpy in s t a t e 4 in

kJ / kg
24 qin = h3 - h2 // h e a t coming i n i n kJ / kg 25 qout = h4 - h1 // h e a t g o i n g o u t i n kJ / kg 26 n1 =1 - qout / qin // t h e r m a l e f f i c i e n c y o f power p l a n t 27 disp ( t h e t h e r m a l e f f i c i e n c y i f steam i s s u p e r h e a t e d

t o 600 C i n s t e a d o f 350 C )
28 h32 =3682.8 // S p e c i f i c e n t h a l p y i n s t a t e 3 i n kJ / kg 29 h42 =2380.3 // S p e c i f i c e n t h a l p y i n s t a t e 3 i n kJ / kg 30 qin2 = h32 - h2 // h e a t coming i n i n kJ / kg 31 qout2 = h42 - h1 // h e a t g o i n g o u t i n kJ / kg 32 n2 =1 - qout2 / qin2 // t h e r m a l e f f i c i e n c y u n d e r g i v e n 33

34 35 36 37 38 39 40

41

42

conditions disp ( t h e t h e r m a l e f f i c i e n c y i f t h e b o i l e r p r e s s u r e i s r a i s e d t o 15 MPa w h i l e t h e t u r b i n e i n l e t t e m p e r a t u r e i s m a i n t a i n e d a t 600 C ) h23 =206.95 // S p e c i f i c e n t h a l p y i n s t a t e 2 i n kJ / kg h43 =2115.3 // S p e c i f i c e n t h a l p y i n s t a t e 4 i n kJ / kg h33 =3583.1 // S p e c i f i c e n t h a l p y i n s t a t e 3 i n kJ / kg qin3 = h33 - h23 // h e a t coming i n i n kJ / kg qout3 = h43 - h1 // h e a t g o i n g o u t i n kJ / kg n3 =1 -( qout3 / qin3 ) // t h e r m a l e f f i c i e n c y u n d e r g i v e n conditions printf ( \ n Hence , t h e t h e r m a l e f f i c i e n c y o f t h i s power p l a n t i f t h e steam i s u p e r h e a t e d t o 600 C i s = %. 3 f . \ n , n1 ) ; printf ( \ n Hence , t h e t h e r m a l e f f i c i e n c y o f t h i s power p l a n t i f t h e steam i s u p e r h e a t e d t o 350 C i s = %. 3 f . \ n , n2 ) ; printf ( \ n Hence , t h e t h e r m a l e f f i c i e n c y i f t h e b o i l e r p r e s s u r e i s r a i s e d t o 15 MPa w h i l e t h e t u r b i n e i n l e t t e m p e r a t u r e i s m a i n t a i n e d a t 600 C . i s = %. 3 f . \ n , n3 ) ;

99

Scilab code Exa 10.4 The Ideal Reheat Rankine Cycle


1 // e x a m p l e 4 2 // The I d e a l Reheat Ranki ne C y c l e 3 clear 4 clc 5 disp ( t h e pump and t h e t u r b i n e s a r e

6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

isentropic , there a r e no p r e s s u r e d r o p s i n t h e b o i l e r and c o n d e n s e r , and steam l e a v e s t h e c o n d e n s e r and e n t e r s t h e pump a s s a t u r a t e d l i q u i d a t t h e condenser pressure . ) P6 =10 // p r e s s u r e a t s t a t e 6 i n kPa x6 =0.896 // q u a l i t y o f steam i n s t a t e 6 sf =0.6492 // i n kJ / kg K sfg =7.4996 // i n kJ / kg K hf =191.81 // i n kJ / kg hfg =2392.1 // i n kJ / kg h6 = hf + x6 * hfg // s p e c i f i c h e a t e n t h a l p y i n s t a t e 6 i n kJ / kg s6 = sf + x6 * sfg // s p e c i f i c e n t r o p y a t s t a t e 6 i n kJ / kg K T5 =600 // t e m p e r a t u r e i n s t a t e 5 i n C e l s i u s s5 = s6 // s p e c i f i c e n t r o p y i n s t a t e 5 disp ( At s t a t e 5 , T5=600C , s 5=s 6 . Hence , ) P5 =4.0 // p r e s s u r e a t s t a t e 5 i n MPa h5 =3674.9 // s p a c i f i c h e a t e n t h a l p y a t s t a t e 5 i n kJ / kg P1 =10 // p r e s s u r e a t s t a t e 1 i n kPa h1 =191.81 // s p e c i f i c h e a t e n t h a l p y a t s t a t e 1 i n kJ / kg v1 =0.00101 // s p e c i f i c volume a t s t a t e 1 i n m3/ kg P2 =15000 // p r e s s u r e a t s t a t e 2 i n kPa wpumpin = v1 *( P2 - P1 ) // work done by pump i n kJ / kg h2 = h1 + wpumpin // e n t h a l p y i n s t a t e 2 i n kJ / kg 100

25 P3 =15000 // p r e s s u r e i n s t a t e 3 i n kPa 26 T3 =600 // t e m p e r a t u r e i n s t a t e 3 i n C 27 h3 =3583.1 // s p e c i f i c h e a t e n t h a l p y i n s t a t e 3 i n kJ / 28 29 30 31 32 33 34 35 36 37

kg s3 =6.6796 // s p e c i f i c e n t r o p y i n s t a t e 3 i n kJ / kg K P4 =4000 // p r e s s u r e i n s t a t e 4 i n kPa s4 = s3 // s p e c i f i c e n t r o p y i n s t a t e 4 h4 =3155.0 // s p e c i f i c h e a t e n t h a l p y i n s t a t e 4 i n kJ / kg T4 =375.5 // t e m p e r a t u r e i n s t a t e 4 i n C qin =( h3 - h2 ) +( h5 - h4 ) // h e a t coming i n i n kJ / kg qout = h6 - h1 // h e a t g o i n g o u t i n kJ / kg n =1 - qout / qin // t h e r m a l e f f i c i e n c y o f t h e c y c l e printf ( \ n Hence , t h e p r e s s u r e a t which t h e steam s h o u l d be r e h e a t e d i s = %. 1 f MPa . \ n , P5 ) ; printf ( \ n Hence , t h e t h e t h e r m a l e f f i c i e n c y o f t h e c y c l e i s = %. 1 f . \ n ,n *100) ;

Scilab code Exa 10.5 The Ideal Regenerative Rankine Cycle


1 2 3 4 5 6 7 8 9 10 11 12 13

// e x a m p l e 5 // The I d e a l R e g e n e r a t i v e Rankine C y c l e clear clc P1 =10 // P r e s s u r e i n s t a t e 1 i n kPa h1 =191.81 // S p e c i f i c e n t h e l p y i n s t a t e 1 i n kJ / kg v1 =0.00101 // S p e c i f i c volume i n s t a t e 1 i n m3/ kg P2 =1200 // P r e s s u r e i n s t a t e 2 i n kPa wpumpin = v1 *( P2 - P1 ) // work done by t h e pump 1 i n kJ / kg h2 = h1 + wpumpin // S p e c i f i c E n t h a l p y i n s t a t e 2 i n kJ / kg v3 =0.001138 // S p e c i f i c volume i n s t a t e 3 i n m3/ kg h3 =798.33 // S p e c i f i c e n t h a l p y i n kJ / kg P3 =1200 // P r e s s u r e i n s t a t e 3 i n kPa 101

14 P4 =15000 // P r e s s u r e i n s t a t e 4 i n kPa 15 wpumpin2 = v3 *( P4 - P3 ) // work done by pump 2 i n kJ / kg 16 h4 = h3 + wpumpin2 // S p e c i f i c e h n t h a l p y i n s t a t e 4 i n kJ 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38

/ kg P5 =15 // P r e s s u r e i n s t a t e 5 i n MPa T5 =600 //Temp . i n s t a t e 5 i n C P6 =1200 // P r e s s u r e i n s t a t e 6 i n kPa h5 =3583.1 // S p e c i f i c e n t h a l p y i n s t a t e 5 i n kJ / kg s5 =6.6796 // S p e c i f i c e n t r o p y i n s t a t e 5 i n kJ / kg K h6 =2860.2 // S p e c i f i c e n t h a l p y i n s t a t e 6 i n kJ / kg T6 =218.4 //Temp . i n s t a t e 6 i n C sf =0.6492 // i n kJ / kg K sfg =7.4996 // i n kJ / kg K s5 =6.6796 // S p e c i f i c e n t r o p y i n s t a t e 5 i n kJ / kg K s6 = s5 // S p e c i f i c e n t r o p y i n s t a t e 6 s7 = s5 // S p e c i f i c e n t r o p y i n s t a t e 7 x7 =( s7 - sf ) / sfg // q u a l i t y o f steam i n s t a t e 7 hf =191.81 // i n kJ / kg hfg =2392.1 // i n kJ / kg h7 = hf + x7 * hfg // S p e c i f i c e n t h a l p y i n s t a t e 7 i n kJ / kg y =( h3 - h2 ) /( h6 - h2 ) // f r a c t i o n o f steam e x t r a c t e d from the turbine qin = h5 - h4 // h e a t coming i n i n kJ / kg qout =( h7 - h1 ) *(1 - y ) // h e a t g o i n g o u t i n kJ / kg n =1 - qout / qin // Thermal e f f i c i e n c y o f t h e c y c l e printf ( \ n Hence , t h e f r a c t i o n o f steam e x t r a c t e d from t h e t u r b i n e i s = %. 4 f . \ n ,y ) ; printf ( \ n and t h e r m a l e f f i c i e n c y o f t h e c y c l e i s = %. 3 f . \ n ,n ) ;

Scilab code Exa 10.6 The Ideal Reheat Regenerative Rankine Cycle
1 2 3

// e x a m p l e 6 // The I d e a l R e h e a t R e g e n e r a t i v e Rankine C y c l e clear 102

4 clc 5 h1 =191.81 // s p e c i f i c 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

h e a t e n t h a l p y f o r s t a t e 1 i n kJ / kg h2 =192.30 // s p e c i f i c h e a t e n t h a l p y f o r s t a t e 2 i n kJ / kg h3 =640.09 // s p e c i f i c h e a t e n t h a l p y f o r s t a t e 3 i n kJ / kg h4 =643.92 // s p e c i f i c h e a t e n t h a l p y f o r s t a t e 4 i n kJ / kg h5 =1087.4 // s p e c i f i c h e a t e n t h a l p y f o r s t a t e 5 i n kJ / kg h6 =1087.4 // s p e c i f i c h e a t e n t h a l p y f o r s t a t e 6 i n kJ / kg h7 =1101.2 // s p e c i f i c h e a t e n t h a l p y f o r s t a t e 7 i n kJ / kg h8 =1089.8 // s p e c i f i c h e a t e n t h a l p y f o r s t a t e 8 i n kJ / kg h9 =3583.1 // s p e c i f i c h e a t e n t h a l p y f o r s t a t e 9 i n kJ / kg h10 =3155.0 // s p e c i f i c h e a t e n t h a l p y f o r s t a t e 10 i n kJ / kg h11 =3674.9 // s p e c i f i c h e a t e n t h a l p y f o r s t a t e 11 i n kJ / kg h12 =3014.8 // s p e c i f i c h e a t e n t h a l p y f o r s t a t e 12 i n kJ / kg h13 =2335.7 // s p e c i f i c h e a t e n t h a l p y f o r s t a t e 13 i n kJ / kg wpumpin1 =0.49 // work done by pump 1 i n kJ / kg wpumpin2 =3.83 // work done by pump 2 i n kJ / kg wpumpin3 =13.77 // work done by pump 3 i n kJ / kg y =( h5 - h4 ) /( h5 - h4 + h10 - h6 ) // f r a c t i o n o f steam extracted z =(1 - y ) *( h3 - h2 ) /( h12 - h2 ) h8 =(1 - y ) * h5 + y * h7 // s p e c i f i c h e a t e n t h a l p y f o r s t a t e 8 i n kJ / kg qin =( h9 - h8 ) +(1 - y ) *( h11 - h10 ) // h e a t coming i n i n kJ / kg qout =(1 - y - z ) *( h13 - h1 ) // h e a t g o i n g o u t i n kJ / kg 103

26 n =1 - qout / qin // t h e r m a l e f f i c i e n c y o f c y c l e 27 printf ( \ n Hence , t h e f r a c t i o n o f steam e x t r a c t e d

from t h e t u r b i n e i s = %. 4 f . \ n ,y ) ; 28 printf ( \ n and t h e r m a l e f f i c i e n c y o f t h e c y c l e i s = %. 3 f . \ n ,n ) ;

Scilab code Exa 10.7 Second Law Analysis of an Ideal Rankine Cycle
1 // e x a m p l e 7 2 // Second Law A n a l y s i s o f an I d e a l Rankine C y c l e 3 clear 4 clc 5 xdest12 =0 // i r r e v e r s i b i l i t y d u r i n g t h e p r o c e s s 1 t o 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

2 i n kJ / kg xdest34 =0 // i r r e v e r s i b i l i t y d u r i n g t h e p r o c e s s 3 t o 4 i n kJ / kg s2 =1.2132 // s p e c i f i c e n t r o p y f o r s t a t e 2 i n kJ / kg K s4 =6.7450 // s p e c i f i c e n t r o p y f o r s t a t e 4 i n kJ / kg K s1 = s2 // s p e c i f i c e n t r o p y f o r s t a t e 1 i n kJ / kg K s3 = s4 // s p e c i f i c e n t r o p y f o r s t a t e 3 i n kJ / kg K qin23 =2728.6 // h e a t i n p u t f o r t h e p r o c e s s 2 t o 3 i n kJ / kg Tsource =1600 // t e m p e r a t u r e o f f u r n a a c e i n K To =290 // temp . o f c o o l i n g medium i n K xdest23 = To *( s3 - s2 - qin23 / Tsource ) // i r r e v e r s i b i l i t y d u r i n g t h e p r o c e s s 2 t o 3 i n kJ / kg Tsink = To // t e m p e r a t u r e o f s i n k qout41 =2018.6 // i n kJ / kg xdest41 = To *( s1 - s4 + qout41 / Tsink ) // i r r e v e r s i b i l i t y d u r i n g t h e p r o c e s s 4 t o 1 i n kJ / kg xdestcycle = xdest12 + xdest23 + xdest34 + xdest41 // i r r e v e r s i b i l i t y of cycle ho =71.355 // i n kJ / kg so =0.2533 // i n kJ / kg K h4 =2403.0 // i n kJ / kg 104

22 e4 =( h4 - ho ) - To *( s4 - so ) // e x e r g y o f steam l e a v i n g t h e

t u r b i n e i n kJ / kg printf ( \ n Hence , t h e e x e r g y d e s t r u c t i o n a s s o c i a t e d w i t h t h e r a n k i n e c y c l e i s = %. 0 f kJ / kg . \ n , xdestcycle ) ; 24 printf ( \ n and e x e r g y o f steam l e a v i n g t h e t u r b i n e i s = %. 0 f . \ n , e4 ) ;


23

Scilab code Exa 10.8 An Ideal Cogeneration Plant // e x a m p l e 8 //An I d e a l C o g e n e r a t i o n P l a n t clear clc v8 =0.001005 // s p e c i f i c volume f o r s t a t e 3 i n m3/ kg P9 =7000 // p r e s s u r e a t s t a t e 9 i n kPa P8 =5 // p r e s s u r e a t s t a t e 8 i n kPa wpumpin1 = v8 *( P9 - P8 ) // work done by pump 1 i n kJ / kg v7 =0.001093 // s p e c i f i c volume f o r s t a t e 7 i n m3>kg P10 =7000 // p r e s s u r e f o r s t a t e 10 i n kPa P7 =500 // p r e s s u r e f o r s t a t e 7 i n kPa wpumpin2 = v7 *( P10 - P7 ) // work done by pump 2 i n kJ / kg h4 =3411.4 // s p e c i f i c e n t h a l p y f o r s t a t e 4 i n kJ / kg h3 = h4 // s p e c i f i c e n t h a l p y f o r s t a t e 3 h2 = h4 // s p e c i f i c e n t h a l p y f o r s t a t e 2 h1 = h4 // s p e c i f i c e n t h a l p y f o r s t a t e 1 h5 =2739.3 // s p e c i f i c e n t h a l p y f o r s t a t e 5 i n kJ / kg h6 =2073.0 // s p e c i f i c e n t h a l p y f o r s t a t e 6 i n kJ / kg h7 =640.09 // s p e c i f i c e n t h a l p y f o r s t a t e 7 i n kJ / kg h8 =137.75 // s p e c i f i c e n t h a l p y f o r s t a t e 8 i n kJ / kg h9 = h8 + wpumpin1 // s p e c i f i c e n t h a l p y f o r s t a t e 9 i n kJ / kg 22 h10 = h7 + wpumpin2 // s p e c i f i c e n t h a l p y f o r s t a t e 10 i n kJ / kg 23 disp ( S i n c e a l l t h e steam t h e b o i l e r i s t h r o t t l e d
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

105

24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39

40 41 42 43 44 45 46 47

and s e n t t o t h e p r o c e s s h e a t e r and none i s s e n t to the turbine , t h e r e f o r e ) M1 =15 // mass f l o w r a t e f o r steam i n kg / s M4 =15 // i n kg / s M7 =15 // i n kg / s M = M1 M3 =0 M5 =0 M6 =0 Qpmax = M1 *( h4 - h7 ) //Maximum r a t e a t which p r o c e s s h e a t can be s u p p l i e d i n kW Wturbout = M *( h3 - h6 ) // Work done by t u r b i n e i n kW Wpumpin = M * wpumpin2 // Work done by pump i n kW Wnetout = Wturbout - Wpumpin // power p r o d u c e d i n kW h11 =144.78 // S p e c i f i c e n t h a l p y f o r s t a t e 11 when no heat i s supplied Qin = M1 *( h1 - h11 ) Qp =0 // r a t e o f s u p p l y o f p r o c e s s h e a t i n kW e =( Qp + Wnetout ) / Qin // u t i l i z a t i o n f a c t o r disp ( Now , c a l c u l a t i n g t h e r a t e o f p r o c e s s h e a t s u p p l y when 10 p e r c e n t o f t h e steam i s e x t r a c t e d b e f o r e i t e n t e r s t h e t u r b i n e and 70 p e r c e n t o f t h e steam i s e x t r a c t e d from t h e t u r b i n e a t 500 kPa f o r p r o c e s s h e a t i n g ) M4 =0.1*15 // i n kg / s M5 =0.7*15 // i n kg / s M7 = M4 + M5 // i n kg / s Qpout = M4 * h4 + M5 * h5 - M7 * h7 // r a t e o f p r o c e s s h e a t s u p p l y i n kW printf ( \ n Hence , t h e maximum r a t e a t which p r o c e s s h e a t can be s u p p l i e d i s = %. 0 f kW. \ n , Qpmax ) ; printf ( \ n The power p r o d u c e d when no h e a t i s s u p p l i e d i s = %. 1 f M W. \ n , Wnetout /1000) ; printf ( \ n and u t i l i z a t i o n f a c t o r i s = %. 3 f . \ n ,e ) ; printf ( \ n t h e r a t e o f p r o c e s s h e a t s u p p l y when 10 p e r c e n t o f t h e steam i s e x t r a c t e d b e f o r e i t e n t e r s t h e t u r b i n e and 70 p e r c e n t o f t h e steam i s 106

e x t r a c t e d from t h e t u r b i n e a t 500 kPa f o r p r o c e s s h e a t i n g = %. 1 f M W. \ n , Qpout /1000) ;

Scilab code Exa 10.9 A Combined Gas Steam Power Cycle


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

18

// e x a m p l e 9 //A Combined G a s S t e a m Power C y c l e clear clc h4 =880.36 // s p e c i f i c e n t h a l p y f o r s t a t e 4 i n kJ / kg T4 =853 // t e m p e r a t u r e f o r s t a t e 4 i n K qin =790.58 // i n kJ / kg wnet =210.41 // i n kJ / kg h5 =451.80 // s p e c i f i c e n t h a l p y f o r s t a t e 5 i n kJ / kg h2 =144.78 // s p e c i f i c e n t h a l p y f o r s t a t e 2 i n kJ / kg h3 =3411.4 // s p e c i f i c e n t h a l p y f o r s t a t e 3 i n kJ / kg wnetgas =210.41 // i n kJ / kg wnetsteam =1331.4 // i n kJ / kg y =( h4 - h5 ) /( h3 - h2 ) // r a t i o o f mass f o l w r a t e s o f t h e steam and c o m b u s t i o n g a s e s wnet = wnetgas + y * wnetsteam // n e t work o u t p u t o f t h e c y c l e i n kJ / kg n = wnet / qin // t h e r m a l e f f i c i e n c y o f t h e combined cycle printf ( \ n Hence , t h e r a t i o o f mass f o l w r a t e s o f t h e steam and c o m b u s t i o n g a s e s i s = %. 3 f . \ n ,y ); printf ( \ n Hence , t h e t h e r m a l e f f i c i e n c y o f t h e c o b i n e d c y c l e i s = %. 3 f . \ n ,n ) ;

107

Chapter 11 Refrigeration Cycles

Scilab code Exa 11.2 The Actual Vapor Compression Refrigeration Cycle
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

// q u e s 2 // The A c t u a l Vapor C o m p r e s s i o n R e f r i g e r a t i o n C y c l e clear clc // s t a t e 1 P1 =0.14; // P r e s s u r e i n MPa T1 = -10; // T e m p e r a t u r e i n C h1 =246.36; // e n t h a l p y o f h e a t i n kJ / kg // s t a t e 2 P2 =0.8; // P r e s s u r e i n MPa T2 =50; // T e m p e r a t u r e i n C h2 =286.69; // E n t h a l p y o f h e a t i n kJ / kg // s t a t e 3 P3 =0.72; // P r e s s u r e i n MPa T3 =26; // T e m p e r a t u r e i n C h3 =87.83; // E n t h a l p y i n kJ / kg h4 = h3 ; // t h r o t t l i n g ms =0.05; // mass f l o w r a t e i n kg / s Qls = ms *( h1 - h4 ) ; // h e a t r e m o v a l i n kW Wins = ms *( h2 - h1 ) ; // Power i n kW 108

22 23 24 25 26 27 28 29 30

printf ( ( a ) Rate o f h e a t r e m o v a l = %. 2 f kW \ n , Qls ) ; printf ( Power = %. 2 f kW \ n , Wins ) ; // ( b ) The i s e n t r o p i c e f f i c i e n c y o f t h e c o m p r e s s o r i s determined as h2s =284.21; nc =( h2s - h1 ) /( h2 - h1 ) ; printf ( ( b ) I s e n t r o p i c e f f i c i e n c y = %. 3 f \ n , nc ) ; COPr = Qls / Wins ; printf ( ( c ) C o e f f i c i e n t o f p e r f o r m a n c e o f t h e r e f r i g e r a t o r = %. 1 f \ n , COPr ) ;

Scilab code Exa 11.4 A Two Stage Refrigeration Cycle with a Flash Chamber
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

// q u e s 4 //A Two S t a g e R e f r i g e r a t i o n C y c l e w i t h a F l a s h Chamber clear clc h6 =95.47; // E n t h a l p y a t s t a t e 6 i n kJ / kg hf =55.16; // E n t h a l p y o f l q u i d w a t e r i n kJ / kg hfg =196.71; // d i f f e r e n c e i n e n t h a l p y o f w a t e r and v a p o r i n kJ / kg x6 =( h6 - hf ) / hfg ; printf ( ( a ) F r a c t i o n o f t h e r e f r i g e r a n t t h a t e v a p o r a t e s = %. 4 f \ n , x6 ) ; h1 =239.16; // e n t h a l p y a t s t a t e 1 i n kJ / kg h8 =55.16; // E n t h a l p y a t s t a t e 8 i n kJ / kg Ql =(1 - x6 ) *( h1 - h8 ) ; // h e a t r e m o v a l i n kJ / kg printf ( ( b ) Amount o f h e a t removed from r e f r i g e r a n t = %. 1 f kJ / kg \ n , Ql ) ; // The e n t h a l p y a t s t a t e 9 i s d e t e r m i n e d from an e n e r g y b a l a n c e on m i x i n g chamber // Ein=Eout i e h9=x6 h3+(1 x6 ) h2 109

16 17 18 19 20 21 22 23

h3 =251.88; // E n t h a l p y a t s t a t e 3 n kJ / kg h2 =255.93; // E n t h a l p y a t s t a t e 2 n kJ / kg h9 = x6 * h3 +(1 - x6 ) * h2 ; // E n t h a l p y a t s t a t e 9 n kJ / kg h4 =274.48; // e n t h a l p y a t s t a t e 4 i n kJ / kg Win =(1 - x6 ) *( h2 - h1 ) +1*( h4 - h9 ) ; // work i n p u t i n kJ / kg printf ( Work i n p u t = %. 2 f kJ / kg \ n , Win ) ; COPr = Ql / Win ; printf ( ( c ) C o e f f i c i e n t o f p e r f o r m a n c e = %. 2 f , COPr ) ;

Scilab code Exa 11.5 The Simple Ideal Gas Refrigeration Cycle
1 // q u e s 5 2 // The S i m p l e I d e a l Gas R e f r i g e r a t i o n C y c l e 3 clear 4 clc 5 // ( a ) The maximum and minimum t e m p e r a t u r e s i n t h e

6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

c y c l e a r e d e t e r m i n e d from t h e i s e n t r o p i c r e l a t i o n s o f i d e a l g a s e s f o r t h e c o m p r e s s i o n and e x p a n s i o n p r o c e s s e s . From T a b l e A 1 7 E // s t a t e 1 T1 =460; //R h1 =109.90; // Btu / lbm Pr1 =0.7913; // r e d u c e d p r e s s u r e r =4; // s t a t e 2 Pr2 = r * Pr1 ; // r=P2/P1=4 // from t a b l e h2 =163.5; // Btu / lbm T2 =683; //R printf ( ( a ) T e m p e r a t u r e T2 = %. 0 f R \ n , T2 ) ; // s t a t e 3 T3 =540; //R h3 =129.06; // Btu / lbm from t a b l e Pr3 =1.3860; // r e d u c e d p r e s s u r e 110

21 22 23 24 25 26 27 28 29 30 31 32

// s t a t e 4 Pr4 =1/ r * Pr3 ; // 1/ r = P4/P3 // from t a b l e h4 =86.7; // Btu / lbm T4 =363; //R printf ( T e m p e r a t u r e T4 = %. 0 f R \ n , T4 ) ; Ql = h1 - h4 ; // Btu / lbm Wturbout = h3 - h4 ; // work o u t p u t by t u r b i n e i n kJ / kg Wcompin = h2 - h1 ; // work i n p u t by c o m p r e s s o r i n kJ / kg Wnetin = Wcompin - Wturbout ; // n e t work i n kJ / kg COPr = Ql / Wnetin ; printf ( ( b ) C o e f f i c i e n t o f P e r f o r m a n c e = %. 2 f \ n , COPr ) ; 33 ms =0.1; // mass f l o w i n lbm / s 34 Qrefs = ms * Ql ; 35 printf ( ( c ) Rate o f r e f r i g e r a t i o n = %. 2 f Bu/ s e c \ n , Qrefs ) ;

Scilab code Exa 11.6 Cooling of a Canned Drink by a Thermoelectric Refrigerator


1 2

3 4 5 6 7 8 9 10 11 12 13 t =30*60; // s e c

// e x 6 // C o o l i n g o f a Canned D r i n k by a T h e r m o e l e c t r i c Refrigerator clear clc d =1; // d e n s i t y i n kg /L V =0.350; // volume i n L m = d * V ; // mass i n Kg c =4.18; // s p e c i f i c h e a t i n kJ / kg . C T2 =20; // T e m p e r a t u r e i n C T1 =4; // T e m p e r a t u r e i n C Qcooling = m * c *( T2 - T1 ) ; // h e a t o f c o o l i n g i n kJ

111

14 15 16 17

Qcoolings = Qcooling / t ; // r a t e o f c o o l i n g i n kW COPr =0.10; Wins = Qcoolings / COPr ; printf ( Power = %. 0 f W , Wins *1000) ;

Scilab code Exa 17.10 Estimation of the Mach Number from Mach Lines
1 // q u e s 1 0 2 // E s t i m a t i o n o f t h e Mach Number from Mach L i n e s 3 clear 4 clc 5 u =19; // a n g l e o f mach l i n e s i n d e g r e e 6 Ma1 =1/ sin ( u /180* %pi ) ; 7 printf ( Mach number = %. 2 f , Ma1 ) ;

112

Chapter 12 Thermodynamic Property Relations

Scilab code Exa 12.1 Approximating Dierential Quantities by Dierences


1 2 3 4 5 6 7 8 9 10

// e x a m p l e 1 // A p p r o x i m a t i n g D i f f e r e n t i a l Q u a n t i t i e s by Differences clear clc h305 =305.22 // S p e c i f i c E n t h a l p y a t 305 K i n kJ / kg h295 =295.17 // S p e c i f i c E n t h a l p y a t 205 K i n kJ / kg dh = h305 - h295 // Chnage i n S p e c i f i c E n t h a l p y dT =305 -295 // Change i n Temp . i n k e l v i n s cp = dh / dT // S p e c i f i c h e a t o f a i r a t 300K i n kJ / kg K printf ( \ n Hence , t h e s p e c i f i c h e a t o f a i r a t 300 K i s = %. 3 f kJ / kg K . \ n , cp ) ;

Scilab code Exa 12.2 Total Dierential versus Partial Dierential


1

// e x a m p l e 2 113

2 3 4 5 6 7 8 9 10 11

// T o t a l D i f f e r e n t i a l v e r s u s P a r t i a l D i f f e r e n t i a l clear clc R =0.287 // U n i v e r s a l g a s c o n s t a n t kPam3/ kg K v =(0.86+0.87) /2 // a v e r a g e v a l u e m3/ kg T =(300+302) /2 // a v e r a g e temp . i n k e l v i n s dT =302 -300 // c h a n g e i n t e p . i n K dv =0.87 -0.86 // c h a n g e i n volume i n m3/ kg dP = R * dT /v - R * T * dv / v ^2 // Change i n t h e p r e s s u r e i n kPa printf ( \ n Hence , t h e c h a n g e i n t h e p r e s s u r e o f a i r i s = %. 3 f kPa . \ n , dP ) ;

Scilab code Exa 12.5 Evaluating the hfg of a Substance from the PVT Data
1 2 3 4 5 6 7 8 9 10 11 12 13 14

// e x a m p l e 5 // E v a l u a t i n g t h e h f g o f a S u b s t a n c e from t h e PvT Data clear clc vg =0.035969 // i n m3/ kg vf =0.0008161 // i n m3/ kg vfg = vg - vf // i n m3/ kg a t 20 C dT =24 -16 // c h a n g e i n Temp . i n C Psat1 =646.18 // s a t u r a t i o n p r e s s s u r e a t 24 C i n kPa Psat2 =504.58 // s a t u r a t i o n p r e s s u r e a t 16C i n kPa dP = Psat1 - Psat2 // D i f f e r e n c e b e t w e e n s a t u r a t i o n p r e s s u r e s i n kPa T =293.15 // D i f f e r e n c e b e t w e e n temp . i n K hfg = T * vfg * dP / dT // E n t h a l p y o f v a p o r i z a t i o n i n kJ / kg printf ( \ n Hence , t h e e n t h a l p y o f v a p o r i z a t i o n o f r e f r i g e r a n t 134 a i s = %. 2 f kJ / kg . \ n , hfg ) ;

114

Scilab code Exa 12.6 Extrapolating Tabular Data with the Clapeyron Equation
1 2 3 4 5 6 7 8 9 10 11

// e x a m p l e 6 // E x t r a p o l a t i n g T a b u l a r Data w i t h t h e C l a p e y r o n Equation clear clc hfg =97.100 // i n Btu / lbm R =0.01946 // u n i v e r s a l Gas c o n s t a n t i n Btu / lbmR T1 =420 // i n R T2 =410 // i n R P1 =7.432 // i n p s i a P2 = %e ^(( hfg / R ) *(1/ T1 -1/ T2 ) + log ( P1 ) ) // S a t u r a t i o n p r e s s u r e a t 50R i n p s i a printf ( \ n Hence , t h e S a t u r a t i o n P r e s s u r e o f R e f r i g e r a n t 134 a a t 50 R i s = %. 2 f p s i a . \ n , P2 ) ;

Scilab code Exa 12.11 dh and ds of oxygen at high pressure


1 2 3 4 5 6 7 8 9 10 11 12 13 14

// e x a m p l e 11 // dh and d s o f Oxygen a t High P r e s s u r e s clear clc T1 =220 // I n i t i a l Temp . i n K P1 =5 // I n i t i a l P r e s s u r e i n MPa T2 =300 // F i n a l Temp . i n K P2 =10 // F i n a l P r e s s u r e i n MPa h2ideal =8736 // i n kJ / mol h1ideal =6404 // i n kJ / mol Ru =8.314 // U n i v e r s a l Gas c o n s t a n t i n kJ / kmol K s2o =205.213 // i n kJ / kmol K s1o =196.1712 // i n kJ / kmol K Tcr =154.8 // C r i t i c a l Temp . i n K 115

15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

31

Pcr =5.08 // C r i t i c a l P r e s s u r e i n MPa Tr1 = T1 / Tcr // Reduced i n i t i a l temp . Pr1 = P1 / Pcr // Reduced i n i t i a l p r e s s u r e Tr2 = T2 / Tcr // Reduced f i n a l Temp . Pr2 = P2 / Pcr // Reduced F i n a l P r e s s u r e Zh1 =0.53 Zs1 =0.25 Zh2 =0.48 Zs2 =0.20 dhi = h2ideal - h1ideal // E n t h a l p y c h a n g e by a s s u m i n g i d e a l gas behaviour dhn = dhi - Ru * Tcr *( Zh2 - Zh1 ) // E n t h a l p y c h a n g e by a c c o u n t i n g f o r d e v i a t i o n from i d e a l g a s b e h a v i o u r dsi = s2o - s1o - Ru * log ( P2 / P1 ) // Entropy c h a n g e by assuming i d e a l gas behaviour dsn = dsi - Ru *( Zs2 - Zs1 ) // Entropy c h a n g e by a c c o u n t i n g f o r d e v i a t i o n from i d e a l g a s b e h a v i o u r printf ( Hence , by a s s u m i n g i d e a l g a s b e h a v i o u r , e n t h a l p y c h a n g e i s = %. 0 f kJ / kmol , dhi ) ; printf ( and e n t r o p y c h a n g e i s = %. 2 f kJ / kmol K . , dsi ) ; printf ( \ n By a c c o u n t i n g f o r d e v i a t i o n from i d e a l g a s b e h a v i o u r , e n t h a l p y c h a n g e i s =%. 0 f kJ / kmol , dhn ) ; printf ( and e n t r o p y c h a n g e i s = %. 2 f kJ / kmol K . \ n , dsn ) ;

116

Chapter 13 Gas Mixtures

Scilab code Exa 13.1 Mass and Mole Fractions of a Gas Mixture // e x a m p l e 1 // Mass and Mole F r a c t i o n s o f a Gas M i x t u r e clear clc m =20 // t o t a l mass o f t h e m i x t u r e i n kg mfO2 =3/ m // mass f r a c t i o n o f o x y g e n mfN2 =5/ m // mass f r a c t i o n o f n i t r o g e n mfCH4 =12/ m // mass f r a c t i o n o f methane NO2 =3/32 // no . o f k i l o m o l e s o f o x y g e n NN2 =5/28 // no . o f k i l o m o l e s o f n i t r o g e n NCH4 =12/16 // no . o f k i l o m o l e s o f methane N = NO2 + NN2 + NCH4 // t o t a l no . o f m o l e s yO2 = NO2 / N // mole f r a c t i o n o f O2 yN2 = NN2 / N // mole f r a c t i o n o f N2 yCH4 = NCH4 / N // mole f r a c t i o n o f CH4 Mm = m / N // a v e r a g e m o l a r mass o f g a s i n kg / kmol printf ( \ n Mass f r a c t i o n o f o x y g e n i s = %. 2 f . \ n , mfO2 ) ; 18 printf ( \ n Mass f r a c t i o n o f N i t r o g e n i s = %. 2 f . \ n , mfN2 ) ; 19 printf ( \ n Mass f r a c t i o n o f Methane i s = %. 2 f . \ n ,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

117

20 21 22 23

mfCH4 ) ; printf ( \ n Mole f r a c t i o n yN2 ) ; printf ( \ n Mole f r a c t i o n yO2 ) ; printf ( \ n Mole f r a c t i o n yCH4 ) ; printf ( \ n A v e r a g e Molar mol . \ n , Mm ) ;

o f N i t r o g e n i s = %. 3 f . \ n , o f Oxygen i s = %. 3 f . \ n , o f Methane i s = %. 3 f . \ n , mass o f g a s i s = %. 1 f kg /

Scilab code Exa 13.2 PVT Behavior of Nonideal Gas Mixtures


1 2 3 4 5 6 7 8 9 10 11 12

13 14 15 16 17 18

// e x a m p l e 2 //PvT B e h a v i o r o f N o n i d e a l Gas M i x t u r e s clear clc NN2 =2 //No . o f kmol o f N2 NCO2 =6 //No . o f kmol o f CO2 Nm =8 // t o t a l no . o f kmol o f m i x t u r e Ru =8.314 // U n i v e r s a l g a s c o n s t a n t i n kPam3/ kmol K Tm =300 //Temp . o f m i x t u r e i n K Pm =15000 // P r e s s u r e o f m i x t u r e i n kPa Vm = Nm * Ru * Tm / Pm // volume o f t a n k on t h e b a s i s o f i d e a l g a s e q u a t i o n i n m3 printf ( \ n Hence , t h e volume o f t h e m i x t u r e on t h e b a s i s o f i d e a l g a s e q u a t i o n o f s t a t e i s = %. 3 f m 3 . \ n , Vm ) ; disp ( Now , e s t i m a t i n g volume o f t a n k on t h e b a s i s o f Kays r u l e ) yN2 = NN2 / Nm // mole f r a c t i o n o f n i t r o g e n yCO2 = NCO2 / Nm // mole f r a c t i o n o f CO2 TcrN2 =126.2 // c r i t i c a l temop . o f N2 i n K e l v i n s TcrCO2 =304.2 // c r i t i c a l temp . o f CO2 i n k e l v i n s Tcrm = yN2 * TcrN2 + yCO2 * TcrCO2 // p s e u d o c r i t i c a l temp . of mixture in Kelvins 118

19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38

39 40 41 42 43 44 45 46

PcrN2 =3.39 // c r i t i c a l p r e s s u r e o f N2 i n MPa PcrCO2 =7.39 // c r i t i c a l p r e s s u r e i n MPa Pcrm = yN2 * PcrN2 + yCO2 * PcrCO2 // p s e o d o c r i t i c a l p r e s s u r e o f m i x t u r e i n MPa Tm =300 // a c t u a l c r i t i c a l temp . o f m i x t u r e i n k e l v i n s Pm =15 // a c t u a l c r i t i c a l p r e s s u r e o f m i x t u r e i n MPa Tr = Tm / Tcrm // Reduced Temp . o f m i x t u r e Pr = Pm / Pcrm // Reduced p r e s s u r e o f m i x t u r e Zm1 = Tr / Pr // c o m p r e s s i b i l i t y o f t h e m i x t u r e Vm1 = Zm1 * Vm // volume o f t a n k on t h e b a s i s o f Kays r u l e i n m3 printf ( \ n Hence , t h e volume o f t h e m i x t u r e on t h e b a s i s o f Kays r u l e i s = %. 3 f m 3 . \ n , Vm1 ) ; disp ( Now , e s t i m a t i n g volume o f t a n k on t h e b a s i s o f c o m p r e s s i b i l i t y f a c t o r s and Amagats law ) TrN2 = Tm / TcrN2 // Reduced Temp . o f N2 PrN2 = Pm / PcrN2 // Reduced P r e s s u r e o f N2 ZN2 =1.02 // c o m p r e s s i b i l i t y f a c t o r o f N2 TrCO2 = Tm / TcrCO2 // Reduced T e m p e r a t u r e o f CO2 PrCO2 = Pm / PcrCO2 // Reduced p r e s s u r e o f CO2 ZCO2 =0.30 // c o m p r e s s i b i l i t y f a c t o r o f CO2 Zm2 = ZN2 * yN2 + ZCO2 * yCO2 // c o m p r e s s i b i l i t y f a c t o r o f the mixture Vm2 = Zm2 * Vm // volume o f t h e m i x t u r e i n m3 printf ( \ n Hence , t h e volume o f t h e m i x t u r e on t h e b a s i s o f c o m p r e s s i b i l i t y f a c t o r s and Amagats law i s = %. 3 f m 3 . \ n , Vm2 ) ; disp ( Now , e s t i m a t i n g volume o f t a n k on t h e b a s i s o f c o m p r e s s i b i l i t y f a c t o r s and d a l t o n s law ) VrN2 =( Vm / NN2 ) /( Ru * TcrN2 /( PcrN2 *1000) ) VrCO2 =( Vm / NCO2 ) /( Ru * TcrCO2 /( PcrCO2 *1000) ) ZN2 =0.99 // c o m p r e s s i b i l i t y f a c t o r o f N2 ZCO2 =0.56 // c o m p r e s s i b i l i t y f a c t o r o f CO2 Zm3 = yN2 * ZN2 + yCO2 * ZCO2 // c o m p r e s s i b i l i t y f a c t o r o f the mixture Vm3 = Zm3 * Vm // volume o f t h e m i x t u r e i n m3 disp ( T h i s i s 33 p e r c e n t l o w e r t h a n t h e assumed v a l u e . T h e r e f o r e , we s h o u l d r e p e a t t h e 119

c a l c u l a t i o n s , u s i n g t h e new v a l u e o f Vm. When t h e c a l c u l a t i o n s a r e r e p e a t e d we o b t a i n 0 . 7 3 8 m3 a f t e r t h e s e c o n d i t e r a t i o n , 0 . 6 7 8 m3 a f t e r t h e t h i r d i t e r a t i o n , and 0 . 6 4 8 m3 a f t e r t h e f o u r t h i t e r a t i o n . T h i s v a l u e d o e s n o t c h a n g e w i t h more i t e r a t i o n s . Therefore ) 47 Vm =0.648 // volume o f t h e m i x t u r e i n m3 48 printf ( \ n Hence , t h e volume o f t h e m i x t u r e on t h e b a s i s o f c o m p r e s s i b i l i t y f a c t o r s and D a l t o n s law i s = %. 3 f m 3 . \ n , Vm ) ;

Scilab code Exa 13.3 Mixing Two Ideal Gases in a Tank


1 // e x a m p l e 3 2 // M i x i n g Two I d e a l G a s e s i n a Tank 3 clear 4 clc 5 disp ( We assume b o t h g a s e s t o be i d e a l

6 7 8

9 10 11 12

g a s e s , and t h e i r m i x t u r e t o be an i d e a l g a s m i x t u r e . T h i s assumption i s r e a s o n a b l e s i n c e both the oxygen and n i t r o g e n a r e w e l l a b o v e t h e i r c r i t i c a l t e m p e r a t u r e s and w e l l b e l o w t h e i r c r i t i c a l pressures . ) CvN2 =0.743 // C o n s t a n t Volume S p e c i f i c h e a t o f N2 i n kJ / kg K CvO2 =0.658 // C o n s t a n t Volume S p e c i f i c h e a t o f O2 i n kJ / kg K disp ( T h i s i s a c l o s e d s y s t e m s i n c e no mass c r o s s e s t h e boundary d u r i n g t h e p r o c e s s . We n o t e t h a t t h e volume o f a r i g i d t a n k i s c o n s t a n t and t h u s , t h e r e i s no boundary work done . ) T1N2 =20 // T e m p e r a t u r e o f N2 i n c e l s i u s T1O2 =40 // T e m p e r a t u r e o f O2 i n c e l s i u s mN2 =4 // mass o f N2 i n kg mO2 =7 // mass o f O2 i n kg 120

13 Tm =( mN2 * CvN2 * T1N2 + mO2 * CvO2 * T1O2 ) /( mN2 * CvN2 + mO2 * CvO2 ) 14 15 16 17 18 19 20 21 22 23 24 25

//Temp . o f m i x t u r e i n C e l s i u s printf ( \ n Hence , t h e temp . o f t h e m i x t u r e i s = %. 1 f C . \ n , Tm ) NO2 = mO2 /32 //No . o f kmol o f O2 NN2 = mN2 /28 //No . o f kmol o f N2 Nm = NO2 + NN2 // T o t a l No . o f kmol o f m i x t u r e Ru =8.314 // U n i v e r s a l Gas C o n s t a n t i n kPam3/ kmol K P1O2 =100 // I n i t i a l P r e s s u r e o f O2 i n kPa P1N2 =150 // I n i t i a l P r e s s u r e o f N2 i n kPa VO2 = NO2 * Ru *( T1O2 +273) / P1O2 // I n i t i a l volume o f O2 i n m3 VN2 = NN2 * Ru *(273+ T1N2 ) / P1N2 // I n i t i a l volume o f N2 i n m3 Vm = VO2 + VN2 // t o t a l volume o f m i x t u r e i n m3 Pm = Nm * Ru *( Tm +273) / Vm // M i x t u r e P r e s s u r e a f t e r e q u i l b r i u m i n kPa printf ( \ n Hence , t h e m i x t u r e p r e s s u r e a f t e r e q u i l b r i u m i s = %. 1 f kPa . \ n , Pm )

Scilab code Exa 13.4 Exergy Destruction during Mixing of Ideal Gases
1 // e x a m p l e 4 2 // Exergy D e s t r u c t i o n d u r i n g M i x i n g o f I d e a l G a s e s 3 clear 4 clc 5 disp ( We t a k e t h e e n t i r e c o n t e n t s o f t h e t a n k a s t h e

6 7 8 9

s y s t e m . T h i s i s a c l o s e d s y s t e m s i n c e no mass c r o s s e s t h e boundary d u r i n g t h e p r o c e s s . We n o t e t h a t t h e volume o f a r i g i d t a n k i s c o n s t a n t , and t h e r e i s no e n e r g y t r a n s f e r a s h e a t o r work . ) NO2 =3 //No . o f kmol o f O2 NCO2 =5 //No . o f kmol o f CO2 Nm = NO2 + NCO2 // t o t a l m o l e s o f t h e m i x t u r e yO2 = NO2 / Nm // mole f r a c t i o n o f O2 121

10 yCO2 = NCO2 / Nm // mole f r a c t i o n o f CO2 11 Ru =8.314 // U n i v e r s a l Gas C o n s t a n t i n kJ / kmol K 12 dSm = - Ru *( NO2 * log ( yO2 ) + NCO2 * log ( yCO2 ) ) // Entropy

c h a n g e i n kJ /K
13 To =298 //Temp . o f s u r r o u n d i n g s i n k e l v i n s 14 X = To * dSm // e n e r g y d e s t u c t i o n i n t h e p r o c e s s i n kJ 15 printf ( \ n Hence , t h e e x e r g y d e s t r u c t i o n i n t h e

p r o c e s s i s = %. 1 f MJ . \ n ,X /10^3) ;

Scilab code Exa 13.5 cooling of non ideal gas mixture


1 // e x a m p l e 5 2 // c o o l i n g o f non i d e a l g a s m i x t u r e 3 clear 4 clc 5 disp ( We t a k e t h e c o o l i n g s e c t i o n a s t h e s y s t e m .

6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

T h i s i s a c o n t r o l volume s i n c e mass c r o s s e s t h e s y s t e m boundary d u r i n g t h e p r o c e s s . The c r i t i c a l properties ) TcrN2 = 126.2 // C r i t i c a l P r e s s u r e o f N2in K PcrN2 =3.39 // C r i t i c a l P r e s s u r e o f N2 i n MPa TcrO2 =154.8 // C r i t i c a l Temp . o f O2 i n K PcrO2 =5.08 // C r i t i c a l P r e s s u r e o f O2 i n MPa yN2 =0.79 // mole f r a c t i o n o f n i t r o g e n yO2 =0.21 // mole f r a c t i o n o f O2 T1 =220 // I n i t i a l Temp . o f a i r i n k e l v i n s T2 =160 // F i n a l Temp . o f a i r i n k e l v i n s Pm =10 // P R e s s u r e i n MPa Ru =8.314 // U n i v e r s a l Gas c o n s t a n t i n kJ / kmol K disp ( c a l c u l a t i n g h e a t t r a n s f e r p e r kmol o f a i r using i d e a l gas approximation ) h1N2 =6391 // E n t h a l p y o f N2 a t T1 i n kJ / kmol h1O2 =6404 // E n t h a l p y o f O2 a t T1 i n kJ / kmol h2O2 =4657 // E n t h a l p y o f O2 a t T2 i n kJ / kmol h2N2 =4648 // E n t h a l p y o f N2 a t T2 i n kJ / kmol 122

21 22

23 24 25 26 27 28 29 30 31 32 33 34

35 36 37 38 39 40 41 42 43

qout = yN2 *( h1N2 - h2N2 ) + yO2 *( h1O2 - h2O2 ) // Heat T r a n s f e r i n kJ / kmol printf ( \ n Hence , t h e h e a t t r a n s f e r d u r i n g t h e p r o c e s s using the i d e a l gas approximation i s = % . 0 f kJ / kmol . \ n , qout ) ; disp ( c a l c u l a t i n g h e a t t r a n s f e r p e r kmol o f a i r u s i n g Kays law ) Tcrm2 = yN2 * TcrN2 + yO2 * TcrO2 // c r i t i c a l temp . o f pseudopure substance Pcrm2 = yN2 * PcrN2 + yO2 * PcrO2 // c r i t i c a l p r e s s u r e o f pseudopure substance Tr1 = T1 / Tcrm2 // Reduced Temp . a t T1 Tr2 = T2 / Tcrm2 // Reduced Temp . a t T2 Zh1m =1.0 // C o m p r e s i b i l i t y f a c t o r a t T1 Zh2m =2.6 // C o m p r e s s i b i l i t y F a c t o r a t T2 Pr = Pm / Pcrm2 // Reduced P r e s s u r e h1m = yN2 * h1N2 + yO2 * h1O2 // E n t h a l p y o f t h e m i x t u r e a t T1 i n kJ / kmol h2m = yN2 * h2N2 + yO2 * h2O2 // E n t h a l p y o f t h e m i x t u r e a t T2 i n kJ / kmol qout =( h1m - h2m ) - Ru * Tcrm2 *( Zh1m - Zh2m ) // Heat t r a n s f e r d u r i n g t h e p r o c e s s i n kJ / kmol printf ( \ n Hence , t h e h e a t t r a n s f e r d u r i n g t h e p r o c e s s u s i n g Kays law i s = %. 0 f kJ / kmol . \ n , qout ) ; disp ( c a l c u l a t i n g h e a t t r a n s f e r p e r kmol o f a i r u s i n g Amagats law ) Zh1N2 =0.9 // C o m p r e s s i b i l i t y f a c t o r o f N2 a t T1 Zh2N2 =2.4 // C o m p r e s s i b i l i t y f a c t o r o f N2 a t T2 Zh1O2 =1.3 // C o m p r e s s i b i l i t y f a c t o r o f O2 a t T1 Zh2O2 =4.0 // C o m p r e s s i b i l i t y f a c t o r o f O2 a t T2 dhN2 =( h1N2 - h2N2 ) - Ru * TcrN2 *( Zh1N2 - Zh2N2 ) // E n t h a l p y c h a n g e f o r N2 i n kJ / kmol dhO2 =( h1O2 - h2O2 ) - Ru * TcrO2 *( Zh1O2 - Zh2O2 ) // E n t h a l o y c h a n g e f o r O2 i n kJ / kmol qout = yN2 * dhN2 + yO2 * dhO2 // kJ / mol // h e a t t r a n s f e r d u r i n g t h e p r o c e s s i n kJ / kmol printf ( \ n Hence , t h e h e a t t r a n s f e r d u r i n g t h e 123

p r o c e s s u s i n g Amagats law i s = %. 0 f kJ / kmol . \ n , qout ) ;

Scilab code Exa 13.6 obtaining fresh water from sea water
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

17 18

19

20

// e x a m p l e 6 // o b t a i n i n g f r e s h w a t e r from s e a w a t e r clear clc Mw =18.0 // m o l a r mass o f w a t e r kg / kmol Ms =58.44 // m o l a r mass o f s a l t kg / kmol Rw =0.4615 // g a s c o n s t a n t o f p u r e w a t e r kJ / kg K mfs =0.0348 // mass f r a c t i o n o f s a l t mfw =1 - mfs // mass f r a c t i o n o f w a t e r Mm =1/(( mfs / Ms ) +( mfw / Mw ) ) // m o l a r mass o f m i x t u r e kg / kmol yw = mfw * Mm / Mw // mole f r a c t i o n o f w a t e r ys =1 - yw // mole f r a c t i o n o f s a l t To =288.15 //Temp . o f S e a w a t e r i n k e l v i n s Ru =8.314 // U n i v e r s a l Gas c o n s t a n t i n kJ / kmol K dm =1028 // d e n s i t y o f s e a w a t e r i n kg /m3 wminin = - Ru * To *( yw * log ( yw ) + ys * log ( ys ) ) // minimum work i n p u t r e q u i r e d t o s e p a r a t e 1 kg o f s e a w a t e r c o m p l e t e l y i n t o p u r e w a t e r and p u r e s a l t s kJ / kmol Wminin = wminin / Mm // minimum work i n p u t i n kJ / kg seawater wminin2 = Rw * To * log (1/ yw ) // minimum work i n p u t r e q u i r e d t o p r o d u c e 1 kg o f f r e s h w a t e r from s e a w a t e r i n kJ / kg f r e s h w a t e r Pm = dm * Rw * To * log (1/ yw ) // t h e minimum g a u g e p r e s s u r e t h a t t h e s e a w a t e r must be r a i s e d i f f r e s h w a t e r i s t o be o b t a i n e d by r e v e r s e o s m o s i s u s i n g s e m i p e r m e a b l e membranes i n kPa printf ( \ n Hence , t h e mole f r a c t i o n o f w a t e r i n t h e s e a w a t e r i s = %. 4 f . \ n , yw ) ; 124

21

printf ( \ n Hence , t h e mole f r a c t i o n o f s a l t i n t h e s e a w a t e r i s = %. 2 f p e r c e n t a g e . \ n , ys *100) ; 22 printf ( \ n Hence , t h e minimum work i n p u t r e q u i r e d t o s e p a r a t e 1 kg o f s e a w a t e r c o m p l e t e l y i n t o p u r e w a t e r and p u r e s a l t s i s = %. 2 f kJ / kg s e a w a t e r . \ n , Wminin ) ; 23 printf ( \ n Hence , t h e minimum work i n p u t r e q u i r e d t o p r o d u c e 1 kg o f f r e s h w a t e r from s e a w a t e r kJ / kg f r e s h w a t e r i s = %. 2 f kJ / kg f r e s h w a t e r . \ n , wminin2 ) ; 24 printf ( \ n Hence , t h e t h e minimum g a u g e p r e s s u r e t h a t t h e s e a w a t e r must be r a i s e d i f f r e s h w a t e r i s t o be o b t a i n e d by r e v e r s e o s m o s i s u s i n g s e m i p e r m e a b l e membranes i s = %. 0 f kPa . \ n , Pm ) ;

125

Chapter 14 Gas Vapour Mixtures and Air Conditioning

Scilab code Exa 14.1 The amonut of water vapour in room air
1 // e x a m p l e 1 2 // t h e amonut o f w a t e r v a p o u r i n room a i r 3 clear 4 clc 5 disp ( The c o n s t a n t p r e s s u r e s p e c i f i c h e a t o f

a i r at

room t e m p e r a t u r e i s )
6 cp =1.005 // C o n s t a n t P r e s s u r e 7 8 9 10 11 12 13 14 15 16 17

S p e c i f i c Heat o f a i r a t room t e m p e r a t u r e i n kJ / kg K T =25 // room temp . i n C e l s i u s disp ( For w a t e r a t 25 C , we have ) Pg =3.1698 // S a t u r a t i o n p r e s s u r e i n kPa hg =2546.5 // S p e c i f i c e n t h a l p y i n kJ / kg x =0.75 // h u m i d i t y Pv = x * Pg // Vapour p r e s s u r e i n kPa P =100 // P r e s s u r e o f a i r i n room i n kPa Pa =P - Pv // p a r t i a l p r e s s u r e o f d r y a i r w =(0.622* Pv ) /( P - Pv ) // s p e c i f i c h u m i d i t y o f a i r h = cp * T + w * hg // e n t h a l p y o f d r y a i r p e r u n i t mass Ra =0.287 // g a s c o n s t a n t f o r d r y a i r i n kPam3/ kg K 126

18 Rv =0.4615 // g a s c o n s t a n t

f o r w a t e r v a p o u r i n kPam

3/ kg K
19 V =5*5*3 // volume o f room i n m3 20 ma =( Pa * V ) /( Ra *( T +273) ) // mass o f d r y a i r 21 mv =( Pv * V ) /( Rv *( T +273) ) // mass o f w a t e r v a p o u r 22 printf ( \ n Hence , t h e p a r t i a l p r e s s u r e o f d r y a i r

is

= %. 2 f kPa . printf ( \ n The printf ( \ n The = %. 1 f kJ / kg 25 printf ( \ n The ; 26 printf ( \ n The , mv ) ;


23 24

\ n , Pa ) ; s p e c i f i c h u m i d i t y i s = %. 4 f . \ n ,w ) ; e n t h a l p y p e r u n i t mass o f d r y a i r i s d r y a i r . \ n ,h ) ; mass o f d r y a i r i s = %. 2 f kg . \ n , ma ) mass o f w a t e r v a p o u r i s = %. 2 f kg . \ n

Scilab code Exa 14.2 Fogging of the windows in house


1 // e x a m p l e 2 2 // f o g g i n g o f t h e windows i n h o u s e 3 clear 4 clc 5 x =0.75 // r e l a t i v e h u m i d i t y 6 P =2.3392 // s a t u r a t i o n p r e s s u r e o f w a t e r a t 20 C 7 8 9 10

in

kPa Pv = x * P // Vapour p r e s s u r e i n kPa disp ( S a t u r a t i o n temp . o f w a t e r a t Pv =15.4 C . Therefore , ) Tdp =15.4 // window t e m p e r a t u r e i n C e l s i u s printf ( \ n Hence , window t e m p e r a t u r e a t which m o i s t u r e i n t h e a i r s t a r t c o n d e n s i n g on t h e i n n e r s u r f a c e s o f t h e windows i s = %. 1 f C . \ n , Tdp ) ;

Scilab code Exa 14.3 The Specic and Relative Humidity of Air 127

1 // e x a m p l e 3 2 // The S p e c i f i c and R e l a t i v e Humidity o f A i r 3 clear 4 clc 5 disp ( The s a t u r a t i o n p r e s s u r e o f w a t e r i s 1 . 7 0 5 7 kPa 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

a t 15C , and 3 . 1 6 9 8 kPa a t 25 C ) T1 =25 // d r y b u l b t e m p e r a t u r e i n C e l s i u s T2 =15 // wet b u l b t e m p e r a t u r e i n C e l s i u s hg1 =2546.5 // i n kJ / kg hf2 =62.9822 // i n kJ / kg cp =1.005 // C o n s t a n t p r e s s u r e s p e c i f i c h e a t o f a i r a t room temp . i n kJ / kg K hfg2 =2465.4 // i n kJ / kg P2 =101.325 // A t m o s p h e r i c p r e s s u r e i n kPa Pg2 =1.7057 // S a t u r a t i o n p r e s s u r e o f w a t e r a t 15C i n kPa w2 =0.622* Pg2 /( P2 - Pg2 ) // kg w a t e r / kg d r y a i r w1 =( cp *( T2 - T1 ) + w2 * hfg2 ) /( hg1 - hf2 ) // s p e c i f i c humidity Pg1 =3.1698 // S a t u r a t i o n p r e s s u r e o f w a t e r a t 25C i n kPa o1 = w1 * P2 /((0.622+ w1 ) * Pg1 ) // r e l a t i v e h u u m i d i t y h1 = cp * T1 + w1 * hg1 // e n t h a l p y o f a i r p e r u n i t mass o f dry a i r printf ( \ n Hence , t h e s p e c i f i c h u m i d i t y i s = %. 5 f kg H2o/ kg d r y a i r . \ n , w1 ) ; printf ( \ n The r e l a t i v e h u m i d i t y = %. 3 f . \ n , o1 ) ; printf ( \ n The E n t h a l p y o f a i r p e r u n i t mass o f d r y a i r i s = %. 1 f kJ / kg d r y a i r . \ n , h1 ) ;

Scilab code Exa 14.4 The Use of the Psychrometric Chart


1 2 3

// e x a m p l e 4 // The Use o f t h e P s y c h r o m e t r i c Chart clear 128

4 clc 5 disp ( At a g i v e n

7 8

9 10

11 12

13 14

15

t o t a l pressure , the s t a t e of a t m o s p h e r i c a i r i s c o m p l e t e l y s p e c i f i e d b y two i n d e p e n d e n t p r o p e r t i e s s u c h a s t h e dry b u l b t e m p e r a t u r e and t h e r e l a t i v e h u m i d i t y . Other p r o p e r t i e s a r e d e t e r m i n e d by d i r e c t l y r e a d i n g t h e i r values at the s p e c i f i e d s t a t e . ) disp ( The s p e c i f i c h u m i d i t y i s d e t e r m i n e d by d r a w i n g a h o r i z o n t a l l i n e from t h e s p e c i f i e d s t a t e t o the r i g h t u n t i l i t i n t e r s e c t s with the v a x i s ) v =0.0142 // i n kg w a t e r / kg d r y a i r disp ( The e n t h a l p y o f a i r p e r u n i t mass o f d r y a i r i s d e t e r m i n e d by d r a w i n g a l i n e p a r a l l e l t o t h e h =c o n s t a n t l i n e s from t h e s p e c i f i c s t a t e u n t i l i t i n t e r s e c t s the enthalpy scale , g i v i n g ) h =71.5 // i n kJ / kg d r y a i r disp ( The wet b u l b t e m p e r a t u r e i s d e t e r m i n e d by d r a w i n g a l i n e p a r a l l e l t o t h e Twb=c o n s t a n t l i n e s from t h e s p e c i f i e d s t a t e u n t i l i t i n t e r s e c t s t h e saturation line , giving ) Twb =24 // i n C e l s i u s disp ( The dew p o i n t t e m p e r a t u r e i s d e t e r m i n e d by d r a w i n g a h o r i z o n t a l l i n e from t h e s p e c i f i e d s t a t e to the l e f t u n t i l i t i n t e r s e c t s the saturation line , giving ) Tdp =19.4 // i n C e l s i u s disp ( The s p e c i f i c volume p e r u n i t mass o f d r y a i r i s d e t e r m i n e d by n o t i n g t h e d i s t a n c e s b e t w e e n t h e s p e c i f i e d s t a t e and t h e v=c o n s t a n t l i n e s on b o t h s i d e s o f t h e p o i n t . The s p e c i f i c volume i s d e t e r m i n e d by v i s u a l i n t e r p o l a t i o n t o be ) v =0.893 // i n m3/ kg d r y a i r

Scilab code Exa 14.5 Heating and Humidication of Air

129

1 // e x a m p l e 5 2 // H e a t i n g and H u m i d i f i c a t i o n o f A i r 3 clear 4 clc 5 disp ( T h i s i s a s t e a d y f l o w p r o c e s s and t h u s t h e

6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

mass f l o w r a t e o f d r y a i r r e m a i n s c o n s t a n t d u r i n g t h e e n t i r e p r o c e s s . We t a k e t h e s y s t e m t o be t h e heating or the humidifying section , as appropriate . ) o1 =0.3 // r e l a t i v e h u m i d i t y Psat =1.2281 // S a t u r a t i o n p r e s s u r e o f w a t e r i n kPa a t 10C P1 =100 // P r e s s u r e a t which e n t i r e p r o c e s s t a k e s i n kPa Pv1 =0.3682 // Vapour p r e s s u r e o f w a t e r i n kPa Ra =0.287 // Gas c o n s t a n t f o r a i r i n kPam3/ kg K T1 =10 // Temp . o f o u t d o o r a i r i n K Pa = P1 - Pv1 // P r e s s u r e o f d r y a i r i n kPa V1 = Ra *( T1 +273) / Pa // s p e c i f i c volume o f d r y a i r i n m 3/ kg v1 =45 // s t e a d y i n t a k e o f o u t d o o r a i r i n m3/ min ma = v1 / V1 // mass f l o w r a t e o f d r y a i r i n kg / min w1 =0.622* Pv1 /( P1 - Pv1 ) // kg w a t e r / kg d r y a i r cp =1.005 // c o n s t a n t p r e s s u r e s p e c i f i c h e a t i n kJ / kg C hg1 =2519.2 // i n kJ / kg T2 =22 // temp . i n c e l s i u s ( g i v e n ) w2 = w1 hg2 =2541 // s p e c i f i c e n t h a l p y o f s a t u r a t e d w a t e r v a p o r i n a t 22 C i n kJ / kg h1 = cp * T1 + w1 * hg1 // kJ / kg d r y a i r h2 = cp * T2 + w2 * hg2 // kJ / kg d r y a i r qin = ma *( h2 - h1 ) // r a t e o f h e a t t r a n s f e r t o a i r i n t h e heating section x3 =0.60 // r e l a t i v e h u m i d i t y Pg3 =3.1698 // s a t u r a t i o n p r e s s u r e o f w a t e r a t 25C i n kPa P3 =100 // p r e s s u r e o f e n t i r e p r o c e s s i n kPa 130

28 w3 =0.622* x3 * Pg3 /( P3 - x3 * Pg3 ) // kg w a t e r / kg d r y a i r 29 mw = ma *( w3 - w2 ) // r e q u i r e d mass f l o w r a t e o f t h e steam

i n t h e h u m i d i f y i n g s e c t i o n i n kg / min 30 printf ( \ n Hence , t h e r a t e o f h e a t s u p p l y i n t h e h e a t i n g s e c t i o n i s =%. 0 f kJ / min . \ n , qin ) ; 31 printf ( \ n The mass f l o w r a t e o f t h e steam r e q u i r e d i n t h e h u m i d i f y i n g s e c t i o n i s =%. 3 f kg / min \ n , mw ) ;

Scilab code Exa 14.6 Cooling and Dehumidication of Air


1 // e x a m p l e 6 2 // C o o l i n g and D e h u m i d i f i c a t i o n o f A i r 3 clear 4 clc 5 disp ( T h i s i s a s t e a d y f l o w p r o c e s s and t h u s t h e

6 7 8 9 10 11 12 13 14 15 16 17

mass f l o w r a t e o f d r y a i r r e m a i n s c o n s t a n t d u r i n g the e n t i r e process ) h1 =85.4 // S p e c i f i c e n t h a l p y f o r s t a t e 1 i n kJ / kg d r y air w1 =0.0216 // kg w a t e r / kg d r y a i r v1 =0.889 // S p e c i f i c volume f o r s t a t e 1 i n m3/ kg d r y air h2 =39.3 // S p e c i f i c e n t h a l p y f o r s t a t e 2 i n kJ / kg dry a i r w2 =0.0100 // kg w a t e r / kg d r y a i r V1 =10 // volume f l o w r a t e o f a i r i n m3/ min hw =58.8 // e n t h a l p y o f s a t u r a t e d l i q u i d w a t e r a t 14 C i n kJ / kg ma = V1 / v1 // mass f l o w r a t e o f d r y a i r i n kg / min mw = ma *( w1 - w2 ) // r a t e o f m o i s t u r e r e m o v a l i n m3/ min qout = ma *( h1 - h2 ) - mw * hw // r a t e o f h e a t r e m o v a l from a i r i n kJ / min printf ( \ n Hence , t h e r a t e o f m o i s t u r e r e m o v a l from d r y a i r i s = %. 3 f kg / min . \ n , mw ) ; printf ( \ n and r a t e o f h e a t r e m o v a l i s = %. 0 f kJ / min 131

. \ n , qout ) ;

Scilab code Exa 14.8 Mixing of Conditioned Air with Outdoor Air
1 // e x a m p l e 8 2 // M i x i n g o f C o n d i t i o n e d A i r w i t h Outdoor A i r 3 clear 4 clc 5 disp ( The p r o p e r t i e s o f e a c h i n l e t s t r e a m a r e 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

21 22

d e t e r m i n e d from t h e p s y c h r o m e t r i c c h a r t t o be ) v2 =0.889 // S p e c i f i c volume o f o u t s i d e a i r i n m3/ kg dry a i r w2 =0.0182 // p r o p e r t i e s o f s t r e a m 2 i n kg w a t e r / kg dry a i r h2 =79.0 // S p e c i f i c e n t h a l p y o f o u t s i d e a i r i n kJ / kg dry a i r v1 =0.826 // S p e c i f i c volume o f s a t u r a t e d a i r i n m3/ kg dry a i r w1 =0.010 // i n kg w a t e r / kg d r y a i r h1 =39.4 // S p e c i f i c e n t h a l p y f o r s t r e a m 1 i n i n kJ / kg dry a i r V1 =50 // f l o w r a t e o f s a t u r a t e d a i r i n m3/ min V2 =20 // f l o w r a t e f o r s t r e a m 2 i n m3/ min ma1 = V1 / v1 // mass f l o w r a t e f o r s t r e a m 1 i n kg / min ma2 = V2 / v2 // mass f l o w r a t e f o r s t r e a m 2 i n kg / min ma3 = ma1 + ma2 // mass b a l a n c e o f a i r i n kg / min disp ( u s i n g t h e e x p r e s s i o n ma1/ma2=(w2w3 ) / ( w3w1 ) =( h2h3 ) / ( h3h1 ) ) w3 =0.0122 // kg w a t e r / kg d r y a i r h3 =50.1 // kJ / kg d r y a i r disp ( These two p r o p e r t i e s f i x t h e s t a t e o f t h e m i x t u r e . Other p r o p e r t i e s o f t h e m i x t u r e a r e d e t e r m i n e d from t h e p s y c h r o m e t r i c c h a r t : ) T3 =19.0 // d r y b u l b temp . i n C x3 =0.89 // r e l a t i v e h u m i d i t y o f m i x t u r e 132

23 v3 =0.844 // S p e c i f i c volume o f m i x t u r e i n m3/ kg 24 V3 = ma3 * v3 // volume f l o w r a t e o f t h e m i x t u r e i n m3/

min 25 printf ( \ n mixture 26 printf ( \ n 27 printf ( \ n %. 1 f kg

Hence , t h e s p e c i f i c h u m i d i t y o f t h e i s = %. 4 f kg H2o/ kg d r y a i r . \ n , w3 ) ; The d r y b u l b temp . i s = %. 1 f C . \ n , T3 ) ; The volume f l o w r a t e o f t h e m i x t u r e i s = H2o/ kg d r y a i r . \ n , V3 ) ;

Scilab code Exa 14.9 Cooling of a Power Plant by a Cooling Tower // e x a m p l e 9 // C o o l i n g o f a Power P l a n t by a C o o l i n g Tower clear clc h1 =42.2 // S p e c i f i c e n t h a l p y o f d r y a i r i n kJ / kg w1 =0.0087 // kg w a t e r / kg d r y a i r v1 =0.842 // s p e c i f i c volume o f d r y a i r i n m3/ kg h2 =100.0 // S p e c i f i c e n t h a l p y o f l e a v i n g a i r i n kJ / kg w2 =0.0273 // kg w a t e r / kg d r y a i r h3 =146.64 // S p e c i f i c e n t h a l p y o f warm w a t e r i n kJ / kg h4 =92.28 // S p e c i f i c e n t h a l p y o f c o o l w a t e r i n kJ / kg M3 =100 // mass f l o w r a t e o f warm w a t e r i n kg / s Ma = M3 *( h3 - h4 ) /(( h2 - h1 ) -( w2 - w1 ) * h4 ) // i n m3/ s V1 = Ma * v1 // volume f l o w r a t e o f a i r i n t o t h e c o o l i n g t o w e r i n m3/ s 15 Mmakeup = Ma *( w2 - w1 ) // mass f l o w r a t e o f r e q u i r e d makeup w a t e r i n kg / s 16 printf ( \ n Hence , t h e mass f l o w r a t e o f r e q u i r e d makeup w a t e r= %. 2 f kg / s . \ n , V1 ) ; 17 printf ( \ n t h e volume f l o w r a t e o f a i r i n t o t h e c o o l i n g t o w e r = %. 2 f m3/ s . \ n , Mmakeup ) ;
1 2 3 4 5 6 7 8 9 10 11 12 13 14

133

Chapter 15 Chemical Reactions

Scilab code Exa 15.1 Balancing the Combustion Equation


1 2 3 4 5 6 7 8 9 10 11 12 13

// e x a m p l e 1 // B a l a n c i n g t h e Combustion E q u a t i o n clear clc Mair =28.97 // Molar mass o f a i r i n kg / kmol x =8 // no . o f m o l e s o f CO2 i n p r o d u c t s y =9 // no . o f m o l e s o f H2O i n p r o d u c t s z =7.5 // no . o f m o l e s o f O2 i n p r o d u c t s w =75.2 // no . o f m o l e s o f N2 i n p r o d u c t s NMair =20*4.76*29 // mass o f a i r i n kg NMc =8*12 // mass o f c a r b o n i n f u e l i n kg NMh2 =2*9 // mass o f h y d r o g e n i n f u e l i n kg AF = NMair /( NMc + NMh2 ) // a i r f u e l r a t i o i n kg a i r / kg fuel 14 printf ( \ n Hence , t h e a i r f u e l r a t i o f o r t h i s c o m b u s t i o n p r o c e s s i s = %. 1 f kg a i r / kg f u e l . \ n , AF ) ;

Scilab code Exa 15.2 Dew Point Temperature of Combustion Products 134

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

// e x a m p l e 2 //Dew P o i n t T e m p e r a t u r e o f Combustion P r o d u c t s clear clc mair =4.2*4.76*29 // mass o f a i r i n kg mfuel =2*12+3*2 // mass o f f u e l i n kg AF = mair / mfuel // a i r f u e l r a t i o Nv =3 // no . o f kmol o f w a t e r v a p o u r Nprod =21.49 //No . o f kmol o f p r o d u c t s Pprod =100 //No . o f kmol o f p r o d u c t s i n kPa Pv = Nv * Pprod / Nprod // P a r t i a l p r e s s u r e o f w a t e r v a p o u r i n kPa disp ( t h e r e f o r e , Dew p o i n t temp . o f p r o d u c t s = S a t u r a t i o n temp . a t Pv ) Tdp =52.3 //Dew p o i n t temp . o f p r o d u c t s i n C printf ( \ n Hence , t h e A i r f u e l r a t i o i s = %. 1 f kg a i r / kg f u e l . \ n , AF ) ; printf ( \ n and dew p o i n t temp . o f p r o d u c t s i s = %. 1 f C . \ n , Tdp ) ;

Scilab code Exa 15.3 Combustion of a Gaseous Fuel with Moist Air // e x a m p l e 3 // Combustion o f a G a s e o u s F u e l w i t h M o i s t A i r clear clc x =0.75 // no . o f m o l e s o f CO2 i n t h e p r o d u c t y =1.53 // no . o f m o l e s o f H2O i n t h e p r o d u c t z =5.648 // no . o f m o l e s o f N2 i n t h e p r o d u c t o =0.8 // r e l a t i v e h u m i d i t y Psat =2.3392 // S a t u r a t i o n p r e s s u r e o f w a t e r a t 20C i n kPa 10 Pvair = o * Psat // p a r t i a l p r e s s u r e o f m o i s t u r e i n a i r 11 Ptotal =101.325 // T o t a l p r e s s u r e i n kPa 12 Ndryair =6.97 // no . o f kmol o f d r y a i r
1 2 3 4 5 6 7 8 9

135

13 14 15 16 17 18 19

20 21

Nvair = Pvair * Ndryair /( Ptotal *(1 - Pvair / Ptotal ) ) // no . o f moles of moisture in a i r Ntotal = Nvair + Ndryair // t o t a l no . o f kmol Pprod =101.325 // P r e s s u r e o f p r o d u c t s i n kPa Nvprod = y +0.131 // no . o f kmol o f H2O i n p r o d u c t s Nprod = x + z + Nvprod // no . o f kmol o f p r o d u c t s Pvprod = Nvprod * Pprod / Nprod // p a r t i a l p r e s s u r e o f water vapour i n the combustion g a s e s disp ( The dew p o i n t t e m p e r a t u r e o f t h e p r o d u c t s i s e q u a l t h e s a t u r a t i o n temp . o f w a t e r a t P=Pvprod . Therefore , ) Tdp =60.9 // i n C printf ( \ n Hence , t h e dew p o i n t temp . o f p r o d u c t s i s = %. 1 f C . \ n , Tdp ) ;

Scilab code Exa 15.4 Reverse Combustion Analysis // / e x a m p l e 4 // R e v e r s e Combustion A n a l y s i s clear clc a =22.20 //No . o f kmol o f d r y a i r x =1.36 //No . o f kmol o f o c t a n e b =12.24 //No . o f kmol o f H2O mair =16.32*4.76*29 // mass o f a i r i n kg mfuel =8*12+9*2 // mass o f f u e l i n kg AF = mair / mfuel // a i r f u e l r a t i o kg a i r / kg f u e l mairact =4.76*16.32 // a c t u a l amount o f a i r i n kmol mairth =12.50*4.76 // T h e o r e t i c a l amount o f a i r mol p = mairact / mairth // p e r c e n t a g e o f t h e o r e t i c a l a i r Pv =3.198 // P a r t i a l p r e s s u r e o f w a t e r v a p o u r i n kPa Pprod =100 // P r e s s u r e o f p r o d u c t s i n kPa Nw =(900 -82.53* Pv ) /( Pprod - Pv ) // no . o f kmol o f w a t e r vapour 17 printf ( \ n Hence , t h e A i r f u e l r a t i o i s = %. 2 f kg
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

136

a i r / kg f u e l . \ n , AF ) ; 18 printf ( \ n The p r e c e n t a g e o f t h e o r e t i c a l a i r u s e d i s = %. 0 f . \ n ,p *100) ; 19 printf ( \ n The amount o f H2O t h a t i s c o n d e n s e d a s p r o d u c t s a r e c o o l e d i s =%. 2 f kmol . \ n , Nw ) ;

Scilab code Exa 15.5 Evaluation of the Enthalpy of Combustion


1 // e x a m p l e 5 2 // E v a l u a t i o n o f t h e E n t h a l p y o f Combustion 3 clear 4 clc 5 hfCO2 = -393520 // e n t h a l p y o f f o r m a t i o n o f CO2 i n kJ / 6 7 8 9 10 11 12 13

kmol hfH2O = -285830 // e n t h a l p y o f f o r m a t i o n o f H2O i n kJ / kmol hfC8H18 = -249950 // e n t h a l p y o f f o r m a t i o n o f o c t a n e i n kJ / kmol NCO2 =8 //No . o f kmol o f CO2 NH2O =9 //No . o f kmol o f H2O NC8H18 =1 //No . o f kmol o f C8H18 hc = NCO2 * hfCO2 + NH2O * hfH2O - NC8H18 * hfC8H18 // E n t h a l p y o f c o m b u s t i o n o f o c t a n e i n kJ / kmol hc = hc /114 // e n t h a l p y o f c o m b u s t i o n i n kJ / kg printf ( \ n Hence , t h e e n t h a l p y o f c o m b u s t i o n o f l i q u i d o c t a n e i s = %. 0 f kg a i r / kg C8H18 . \ n , hc ) ;

Scilab code Exa 15.6 First Law Analysis of Steady Flow Combustion
1 // e x a m p l e 6 2 // F i r s t Law A n a l y s i s 3 clear 4 clc

o f Steady Flow Combustion

137

5 mair =7.5*4.76*29 // mass o f a i r i n kg 6 mfuel =3*12+4*2 // mass o f f u e l i n kg 7 AF = mair / mfuel // a i r f u e l r a t i o 8 Mfuel =0.05 // Mass f l o w r a t e o f f u e l i n kg / min 9 Mair = AF * Mfuel // mass f l o w r a t e o f a i r i n kg / min 10 qout =1*( -118910) +7.5*(8150 -8682) +28.2*(0+8141 -8669)

11

12 13 14 15 16 17

-2.7*( -393520+71078 -9364) -0.3*( -110530+47517 -8669) -4*( -241820+57999 -9904) -2.65*(0+49292 -8682) -28.2*(0+47073 -8669) // i n kJ / kmol C3H8 disp ( T h i s h e a t i s t r a n s f e r r e d from t h e c o m b u s t i o n chamber f o r e a c h kmol ( 4 4 kg ) o f p r o p a n e . t h e r e f o r e q o u t = q o u t /44 kJ / kg ) qout = qout /44 // i n kJ / kg p r o p a n e M =0.05 // mass f l o w r a t e o f l i q u i d p r o p a n e i n kg / min Qout = M * qout // r a t e o f h e a t t r a n s f e r i n kJ / min Qout = Qout /60 // r a t e o f h e a t r e a n s f e r i n kW printf ( \ n Hence , t h e mass f l o w r a t e o f a i r i s = %. 2 f kg / min . \ n , Mair ) ; printf ( \ n and t h e r a t e o f h e a t t r a n s f e r from c o m b u s t i o n chamber i s = %. 2 f kW. \ n , Qout ) ;

Scilab code Exa 15.7 First law anlysis of combustion in bomb


1 // e x a m p l e 7 2 // f i r s t law a n l y s i s o f c o m b u s t i o n i n bomb 3 clear 4 clc 5 Preact =1 // i n i t i a l p r e s s u r e i n atm 6 Nreact =4 //Mo . o f l b m o l o f r e a c t a n t s 7 Treact =537 //Temp . o f r e a c t a n t s i n R 8 Nprod =4 //No . o f l b m o l o f p r o d u c t s 9 Tprod =1800 //Temp . o f p r o d u c t s i n R 10 Pprod = Preact * Nprod * Tprod /( Nreact * Treact ) // f i n a l

p r e s s u r e o f p r o d u c t s i n atm 138

Qout =1*( -32210 -(1.986*537) ) +3*(0 -1.986*537) -1*( -169300+18391.5 -4027.5 -(1.986*1800) ) -2*( -104040+15433.0 -4258.0 -(1.986*1800) ) -1*(0+13485.8 -3725.1 -(1.986*1800) ) // Heat t r a n s f e r d u r i n g t h e p r o c e s s i n Btu / l b m o l CH4 12 printf ( \ n Hence , t h e f i n a l p r e s s u r e i n t h e t a n k i s = %. 2 f atm . \ n , Pprod ) ; 13 printf ( \ n The h e a t t r a n s f e r d u r i n g t h e p r o c e s s i s = %. 0 f Btu / l b m o l CH4 . \ n , Qout ) ;

11

Scilab code Exa 15.8 Adiabatic Flame Temperature in Steady Combustion


1 // e x a m p l e 8 2 // A d i a b a t i c Flame T e m p e r a t u r e i n S t e a d y Combustion 3 clear 4 clc 5 hfC8H18 = -249950 // i n kJ / kmol 6 hfO2 =0 // i n kJ / kmol 7 hO2 =8682 // i n kJ / kmol 8 hfN2 =0 // i n kJ / kmol 9 hN2 =8669 // i n kJ / kmol 10 hfH2O = -241820 // i n kJ / kmol 11 hH2O =9904 // i n kJ / kmol 12 hfCO2 = -393520 // i n kJ / kmol 13 hCO2 =9364 // i n kJ / kmol 14 Hprod =8* hfCO2 +9* hfH2O +47* hfN2 // i n kJ 15 Hmol = Hprod /(8+9+47) // e n t h a l p y p e r mole 16 disp ( T h i s e n t h a l p y v a l u e c o r r e s p o n d s t o a b o u t 2 6 5 0

K f o r N2 , 2 1 0 0 K f o r H2O , and 1 8 0 0 K f o r CO2 . But s i n c e , t h e m a j o r i t y o f t h e m o l e s a r e N2 , we s e e t h a t Tprod s h o u l d be c l o s e t o 2 6 5 0 K, but somewhat u n d e r i t . ) 17 disp ( For 2 4 0 0 K, t h e v a l u e i s h i g h e r t h a n a c t u a l Hprod and f o r 2 3 5 0 K, i t i s l o w e r t h a n t h a t v a l u e 139

. By i n t e r p o l a t i o n , i t comes o u t t o be Tprod =2395 K) 18 Tprod =2395 // i n K 19 printf ( \ n Hence , The a d i a b a t i c f l a m e t e m p e r a t u r e f o r c o m p l e t e c o m b u s t i o n w i t h 100 p e r c e n t t h e o r e t i c a l a i r i s =%. 0 f K . \ n , Tprod ) ; 20 disp ( S i m i l a r i l y , t h e a d i a b a t i c f l a m e t e m p e r a t u r e f o r c o m p l e t e c o m b u s t i o n w i t h 400 p e r c e n t t h e o r e t i c a l a i r i s 962 K and w i t h 90% t h e o r e t i c a l a i r i s 2236 K. )

Scilab code Exa 15.9 Reversible work associated with combustion process
1 // e x a m p l e 9 2 // r e v e r s i b l e work a s s o c i a t e d w i t h c o m b u s t i o n p r o c e s s 3 clear 4 clc 5 NCO2 =1 // mass o f CO2 i n l b m o l 6 gfCO2 = -169680 // E n t h a l p y o f f o r m a t i o n f o r CO2 i n Btu

/ lbmol Wrev = - NCO2 * gfCO2 // R e v e r s i b l e work f o r t h e g i v e n p r c e s s i n Btu 8 printf ( \ n Hence , t h e r e v e r s i b l e work f o r t h i s p r o c e s s i s = %. 0 f Btu . \ n , Wrev ) ;
7

Scilab code Exa 15.11 Second law analysis of isothermal combustion


1 // e x a m p l e 11 2 // s e c o n d law a n a l y s i s o f i s o t h e r m a l c o m b u s t i o n 3 clear 4 clc 5 Pv =3.1698 // P a r t i a l p r e s s u r e o f w a t e r v a p o u r i n kPa 6 Ptotal =101.325 // T o t a l p r e s s u r e o f p r o d u c t s i n kPa

140

7 x = Pv / Ptotal 8 Nv = x *13.28/(1 - x ) // amount o f w a t e r v a p o u r i n kmol 9 Qout =1*( -74850) -1*( -393520) -0.43*( -241820) 10 11 12 13 14 15 16 17 18 19 20

-1.57*( -285830) // Heat t r a n s f e r p e r kmol o f CH4 Sprod =2845.35 // T o t a l e n t r o p y o f p r o d u c t s i n kJ / kmol K Sreact =3023.69 // T o t a l e n t r o p y o f r e a c t a n t s i n kJ / kmol K Tsurr =298 // T e m p e r a t u r e o f s u r r o u n d i n g s i n K Sgen = Sprod - Sreact + Qout / Tsurr // Entropy g e n e r a t i o n d u r i n g t h e p r o c e s s i n kJ / kmol K CH4 To =298 //K Xdestroyed = To * Sgen // e x e r g y d e s t r u c t i o n i n kJ / kmol CH4 Wrev = Xdestroyed // r e v e r s i b l e work a s s o c i a t e d w i t h the process printf ( \ n The h e a t t r a n s f e r p e r kmol o f CH4 i s = % . 0 f kJ / kmol CH4 . \ n , Qout ) ; printf ( \ n The Entropy g e n e r a t i o n i s = %. 0 f kJ / kmol K CH4 . \ n , Sgen ) ; printf ( \ n The Exergy d e s t r u c t i o n i s = %. 0 f MJ/ kmol CH4 . \ n , Xdestroyed /1000) ; printf ( \ n The r e v e r s i b l e work i s = %. 0 f MJ/ kmol CH4 . \ n , Wrev /1000) ;

141

Chapter 16 Chemical and Phase Equilibrium

Scilab code Exa 16.1 Equilibrium Constant of a Dissociation Process // e x a m p l e 1 // E q u i l i b r i u m C o n s t a n t o f a D i s s o c i a t i o n P r o c e s s clear clc T =298.15 //Temp . i n K vn =2 //No . o f m o l e s o f N i n p r o d u c t s vn2 =1 //No . o f m o l e s o f N2 i n r e a c t a n t s gN2 =0 // Molar g i b b s f u n c t i o n f o r N2 gN =455510 // Molar g i b b s f u n c t i o n f o r N i n kJ / kmol dG = vn * gN - vn2 * gN2 // Change i n Gibbs f u n c t i o n o f t h e mixture 11 Ru =8.314 // U n i v e r s a l Gas C o n s t a n t i n kJ / kmol K 12 Kp = %e ^( - dG / Ru * T ) // E q u i l b r i u m C o n s t a n t 13 printf ( \ n Hence , E q u i l b r i u m C o n s t a n t i s = %. 0 f . \ n , Kp ) ;
1 2 3 4 5 6 7 8 9 10

142

Scilab code Exa 16.2 Dissociation Temperature of Hydrogen


1 // e x a m p l e 2 2 // D i s s o c i a t i o n T e m p e r a t u r e o f Hydrogen 3 clear 4 clc 5 P =10 // g i v e n p r e s s u r e i n atm 6 Nh =0.2 //No . o f kmol o f a t o m i c h y d r o g e n p r o d u c e d i n 7 Nh2 =0.9 //No . 8 9 10 11 12 13

the r e a c t i o n o f kmol o f m o l e c u l a r h y d r o g e n l e f t a s reactant Ntotal = Nh + Nh2 // T o t a l no . o f kmol o f r e a c t a n t and products vh =2 // From t h e s t o i c h o m e t r y o f t h e r e a c t i o n vh2 =1 // From t h e s t o i c h o m e t r y o f t h e r e a c t i o n Kp =( Nh ^ vh / Nh2 ^ vh2 ) *( P / Ntotal ) ^( vh - vh2 ) // E q u i l b r i u m constant T =3535 //Temp . c o r r e s p o n d i n g t o e v a l u a t e d v a l u e o f Kp printf ( \ n Hence , t e m p e r a t u r e a t which 10 p e r c e n t o f d i a t o m i c h y d r o g e n ( H2 ) d i s s o c i a t e s i n t o monatomic h y d r o g e n (H) i s = %. 0 f K . \ n ,T ) ;

Scilab code Exa 16.6 Enthalpy of Reaction of a Combustion Process


1 // e x a m p l e 6 2 // E n t h a l p y o f R e a c t i o n o f a Combustion P r o c e s s 3 clear 4 clc 5 NH2O =1 //No . o f kmol o f w a t e r 6 NH2 =1 //No . o f kmol o f Hydrogen 7 NO2 =0.5 //No . o f kmol o f Oxygen 8 hfH2O = -241820 // s t a n d a r d h e a t o f f o r m a t i o n o f l i q u i d 9

w a t e r from e l e m e n t a l r e a c t a n t s i n hH2O =82593 // i n kJ / kmol 143

kJ / kkmol

10 hoH2O =9904 // i n kJ / kmol 11 hfH2 =0 // s t a n d a r d h e a t o f f o r m a t i o n o f H2 12 hH2 =61400 // i n kJ / kmol 13 hoH2 =8468 // i n kJ / kmol 14 hfO2 =0 // s t a n d a r d h e a t o f f o r m a t i o n o f O2 15 hO2 =67881 // i n kJ / kmol 16 hoO2 =8682 // i n kJ / kmol 17 hr1 = NH2O *( hfH2O + hH2O - hoH2O ) - NH2 *( hfH2 + hH2 - hoH2 ) - NO2

18 19 20 21 22 23 24 25

*( hfO2 + hO2 - hoO2 ) // E n t h a l p y o f r e a c t i o n i n kJ / kmol u s i n g e n t h a l p y d a t a Ru =8.314 // U n i v e r s a l Gas C o n s t a n t i n kJ / kmol K T1 =1800 // s u i t a b l e temp . l o w e r t h a n and c l o s e s t t o 2 0 0 0K i n K T2 =2200 // s u i t a b l e temp . h i g h e r t h a n and c l o s e s t t o 2 0 0 0K i n K Kp1 =18509 // E q u i l b r i u m c o n s t a n t a t T1 Kp2 =869.6 // E q u i l b r i u m c o n s t a n t a t T2 hr2 = Ru * log ( Kp2 / Kp1 ) /((1/ T1 ) -(1/ T2 ) ) // E n t h a l p y o f r e a c t i o n i n kJ / kmol u s i n g Kp d a t a printf ( \ n Hence , E q u i l b r i u m C o n s t a n t u s i n g E n t h a l p y d a t a i s = %. 0 f kJ / kmol . \ n , hr1 ) ; printf ( \ n Hence , E q u i l b r i u m C o n s t a n t u s i n g Kp d a t a i s = %. 0 f kJ / kmol . \ n , hr2 ) ;

Scilab code Exa 16.7 Phase Equilibrium for a Saturated Mixture


1 2 3 4 5 6 7 8 9

// e x a m p l e 7 // Phase E q u i l i b r i u m f o r a S a t u r a t e d M i x t u r e clear clc hf =503.81 // i n kJ / kg , sf =1.5279 // i n kJ / kg K hg =2706.0 // i n kJ / kg sg =7.1292 // i n kJ / kg K T =393.15 // Given temp . i n K 144

10 gf = hf - T * sf // i n kJ / kg 11 gg = hg - T * sg // i n kJ / kg 12 disp ( S i n c e , two r e s u l t s

a r e i n c l o s e agreement , T h e r e f o r e m i x t u r e o f s a t u r a t e d l i q u i d w a t e r and s a t u r a t e d w a t e r v a p o r a t 120 C s a t i s f i e s t h e c r i t e r i o n f o r phase e q u i l i b r i u m )

Scilab code Exa 16.8 Mole Fraction of Water Vapor Just over a Lake
1 // e x a m p l e 8 2 // Mole F r a c t i o n o f Water Vapor J u s t o v e r a Lake 3 clear 4 clc 5 Pv =1.7057 // t h e p a r t i a l p r e s s u r e o f w a t e r v a p o r i n

t h e a i r a t t h e l a k e s u r f a c e i n kPa
6 P =92 // a t m o s p h e r i c p r e s s u r e a t l a k e l e v e l i n kPa 7 yv = Pv / P // The mole f r a c t i o n o f w a t e r v a p o r i n t h e

a i r at the s u r f a c e of the lake 8 printf ( \ n Hence , The mole f r a c t i o n o f w a t e r v a p o r i n t h e a i r a t t h e s u r f a c e o f t h e l a k e i s = %. 2 f p e r c e n t . \ n , yv *100) ; 9 disp ( Water c o n t a i n s some d i s s o l v e d a i r , but t h e amount i s n e g l i g i b l e . T h e r e f o r e , we can assume t h e e n t i r e l a k e t o be l i q u i d w a t e r . So , mole f r a c t i o n of water in l a k e i s almost 1 )

Scilab code Exa 16.9 The Amount of Dissolved Air in Water


1 // e x a m p l e 9 2 // The Amount o f 3 clear 4 clc 5 Pv =1.96 // kPa

D i s s o l v e d A i r i n Water

145

6 P =92 // a t m o s p h e r i c p r e s s u r e a t l a k e l e v e l 7 Pdryair =( P - Pv ) /100 // p r e s s u r e o f d r y a i r i n b a r 8 H =62000 // H e n r y s c o n s t a n t f o r a i r d i s s o l v e d i n

waterin bar ydryair = Pdryair / H // mole f r a c t i o n o f a i r i n t h e water 10 printf ( \ n Hence , t h e mole f r a c t i o n o f a i r a t t h e s u r f a c e o f l a k e i s = %. 7 f . \ n , ydryair ) ;
9

Scilab code Exa 16.10 Diusion of Hydrogen Gas into a Nickel Plate
1 // e x a m p l e 10 2 // D i f f u s i o n o f Hydrogen Gas i n t o a N i c k e l P l a t e 3 clear 4 clc 5 s =0.00901 // s o l u b i l i t y o f h y d r o g e n i n n i c k e l i n kmol 6 7 8 9 10

11

/m3b a r PH2gas =3 // P r e s s u r e o f h y d r o g e n i n t a n k i n b a r PH2solid = s * PH2gas // m o l a r d e n s i t y o f h y d r o g e n i n n i c k e l p l a t e i n kmol /m3 MH2 =2 // m o l a r mass o f h y d r o g e n kg / kmol dH2solid = PH2solid * MH2 // mass d e n s i t y o f h y d r o g e n printf ( \ n Hence , t h e m o l a r d e n s i t y o f h y d r o g e n i n N i c k e l p l a t e when p h a s e e q u i l b r i u m i s e s t a b l i s h e d i s = %. 3 f kmol /m 3 . \ n , PH2solid ) ; printf ( \ n and mass d e n s i t y i s = %. 3 f kg /m 3 . \ n , dH2solid ) ;

Scilab code Exa 16.11 Composition of Dierent Phases of a Mixture


1 2 3

// e x a m p l e 11 // C o m p o s i t i o n o f D i f f e r e n t P h a s e s o f a M i x t u r e clear 146

4 clc 5 yH2Ol =0.3 6 yNH3l =0.7 7 PH2Osat =7.3851 // kPa 8 PNH3sat =1554.33 // kPa 9 PH2Og = yH2Ol * PH2Osat // v a p o u r p r e s s u r e o f h2o 10 PNH3g = yNH3l * PNH3sat // v a p o u r p r e s s u r e o f nh3 11 Ptotal = PH2Og + PNH3g 12 yH2Og = PH2Og / Ptotal // mole f r a c t i o n o f h2o i n g a s

phase 13 yNH3 = PNH3g / Ptotal // mole f r a c t i o n o f nh3 i n g a s phase 14 printf ( \ n The mole f r a c t i o n o f H2O i n t h e m i x t u r e i s = %. 4 f . \ n , yH2Og ) ; 15 printf ( \ n The mole f r a c t i o n o f NH3 i n t h e m i x t u r e i s = %. 4 f . \ n , yNH3 ) ;

147

Chapter 17 Compressible Flow

Scilab code Exa 17.1 Compression of High Speed Air in an Aircraft


1 // q u e s 1 2 // C o m p r e s s i o n o f High Speed A i r i n an A i r c r a f t 3 clear 4 clc 5 // ( a ) t h e s t a g n a t i o n p r e s s u r e a t t h e c o m p r e s s o r

6 7 8 9 10

11 12 13 14 k =1.4; 15 P01 = P1 *( T01 / T1 ) ^( k /( k -1) ) ; 16 printf ( ( a ) P r e s s u r e P01 = %. 2 f kPa \ n , P01 ) ; 17 18 // ( b ) To d e t e r m i n e t h e c o m p r e s s o r work

i n l e t ( d i f f u s e r e x i t ) can be d e t e r m i n e d from Eq . 17 5 i n book // s t a t e 1 T1 =255.7; // T e m p e r a t u r e i n K V1 =250; // v e l o c i t y i n m/ s Cp =1.005; // s p e c i f c h e a t a t c o n s t p r e s s u r e i n kJ / kg /K T01 = T1 + V1 ^2/(2* Cp ) /1000; // d i v i d e 1 0 0 0 t o c o n v e r t i t into K // now from eqn 17 5 P1 =54.05; // p r e s s u r e i n kPa

148

19 r =8 // P02 / P01 20 T02 = T01 * r ^(1 -1/ k ) ; // T e m p e r a t u r e i n K 21 // D i s r e g a r d i n g p o t e n t i a l e n e r g y c h a n g e s and h e a t

t r a n s f e r , t h e c o m p r e s s o r work p e r u n i t mass o f a i r i s d e t e r m i n e d from Eq . 17 8 22 Win = Cp *( T02 - T01 ) ; // Work i n p u t i n kJ / kg 23 printf ( ( b ) Work i n p u t = %. 1 f kJ / kg \ n , Win ) ;

Scilab code Exa 17.2 Mach Number of Air Entering a Diuser


1 // q u e s 2 2 // Mach Number o f A i r E n t e r i n g a D i f f u s e r 3 clear 4 clc 5 // ( a ) The s p e e d o f sound i n a i r a t 30 C i s 6 7 8 9 10 11 12 13 14

determined as k =1.4; R =0.287; // g a s c o n s t a n t T =303; // a i r t e m p e r a t u r e i n K c = sqrt ( k * R * T *1000) ; // s p e e d o f l i g h t i n m/ s printf ( ( a ) s p e e d = %. 0 f m/ s \ n ,c ) ; // ( b ) Mach Mumber V =200; // s p e e d i n m/ s Ma = V / c ; printf ( ( b ) Mach number = %. 3 f , Ma ) ;

Scilab code Exa 17.3 Gas Flow through a Converging Diverging Duct
1 // q u e s 3 2 // Gas Flow t h r o u g h a C o n v e r g i n g D i v e r g i n g Duct 3 clear 4 clc

149

5 Cp =0.846; // s p e c i f i c 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

h e a t a t c o n s t a n t p r e s s u r e i n kJ /

kg /K R =0.1889; // g a s c o n s t a n t f o r s u b s t a n c e T0 =473; // temp a t s t a t e 0 i n K T1 = T0 ; // temp a t s t a t e 1 i n K P0 =1400; // p r e s s u r e a t s t a t e 0 i n kPa P1 = P0 ; // p r e s s u r e a t s t a t e 1 i n kPa // from Eqn 17 5 P =1200; // p r e s s u r e i n kPa k =1.289; T = T0 *( P / P0 ) ^(1 -1/ k ) ; //Temp i n K // from Eqn 17 4 T =457; //K V = sqrt (2* Cp *( T0 - T ) *1000) ; // v e l o c i t y i n m/ s printf ( V e l o c i t y = %. 1 f m/ s \ n ,V ) ; // From t h e i d e a l g a s r e l a t i o n , d = P /( R * T ) ; printf ( D e n s i t y = %. 1 f kg /m3 \ n ,d ) ; // From t h e mass f l o w r a t e r e l a t i o n , ms =3; // mass f l o w i n kg / s A = ms /( d * V ) ; // a r e a i n m2 printf ( Area = %. 1 f cm2 \ n ,A *10000) ; // s p e e d k =1.289; c = sqrt ( k * R * T *1000) ; // s p e e d i n m/ s Ma = V / c ; printf ( Mach number = %. 3 f , Ma ) ;

Scilab code Exa 17.4 Critical Temperature and Pressure in Gas Flow
1 // q u e s 4 2 // C r i t i c a l 3 clear 4 clc 5 k =1.289;

T e m p e r a t u r e and P r e s s u r e i n Gas Flow

150

6 7 8 9 10 11

T0 =473; //Temp a t i n K Tx = T0 *2/( k +1) ; //Temp i n K P0 =1400 // p r e s s u r e i n kPa Px = P0 *(2/( k +1) ) ^( k /( k -1) ) ; // P r e s s u r e i n kPa printf ( T = %. 0 f K \ n , Tx ) ; printf ( P = %. 0 f kPa \ n , Px ) ;

Scilab code Exa 17.5 Eect of Back Pressure on Mass Flow Rate
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

16 17 18 19 20 21

// q u e s 5 // E f f e c t o f Back P r e s s u r e on Mass Flow Rate clear clc T =873; // T e m p e r a t u r e i n K V =150; // v e l o c i t y i n m/ s Cp =1.005; // s p e c i f i c h e a t a t c o n s t a n t p r e s s u r e i n kJ / kg . K T0 = T + V ^2/(2* Cp ) /1000; // Temperaure i n K P =1; // p r e s s u r e i n MPa k =1.4; P0 = P *( T0 / T ) ^( k /( k -1) ) ; // p r e s s u r e i n MPa // The c r i t i c a l p r e s s u r e r a t i o i s d e t e r m i n e d from T a b l e 17 2 ( o r Eq . 17 2 2 ) t o be P /P= 0 . 5 2 8 3 Pb =0.7; // back p r e s s u r e i n MPa Rbw = Pb / P0 ; // back p r e s s u r e r a t i o // which i s g r e a t e r t h a n t h e c r i t i c a l p r e s s u r e r a t i o , 0 . 5 2 8 3 . Thus t h e e x i t p l a n e p r e s s u r e ( o r t h r o a t p r e s s u r e P) i s e q u a l t o t h e back p r e s s u r e i n t h i s case // From T a b l e A 3 2 Pt /P0 = 0 . 6 7 0 and Tt /T0 = 0 . 8 9 2 T0 =884; // T e m p e r a t u r e i n K Tt =0.892* T0 ; //Temp i n K Pt =700; // kPa R =0.287; dt = Pt /( R * Tt ) ; // d e n s i t y i n kg /m3 151

22 23 24 25 26 27 28 29 30 31 32

Ma =0.778; // Mach no k =1.4; Vt = Ma * sqrt ( k * R * Tt *1000) ; // V e l o c i t y i n m/ s At =50*10^ -4;; // a r e a i n m2 ms = dt * At * Vt ; printf ( ( a ) Mass f l o w r a t e = %. 2 f kg / s \ n , ms ) ; // ( b ) Pb =400; // kPa P0 =1045; // kPa Rbp = Pb / P0 ; // The back p r e s s u r e r a t i o ms = At * P0 * sqrt ( k /( R * T0 ) *1000) *((2/( k +1) ) ^(( k +1) /(2*( k -1) ) ) ) ; // m u l t i p l y by 1 0 0 0 t o c o n v e r t i t i n t o kg / s 33 printf ( ( b ) Mass f l o w r a t e = %. 2 f kg / s \ n , ms ) ;

Scilab code Exa 17.7 Airow through a Converging Diverging Nozzle


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

// q u e s 7 // A i r f l o w t h r o u g h a C o n v e r g i n g D i v e r g i n g N o z z l e clc P0 =1000; // p r e s s u r e i n kPa R =0.287; T0 =800; // T e m p e r a t u r e i n K d0 = P0 /( R * T0 ) ; // d e n s i t y i n kg /m3 // ( a ) At t h e t h r o a t o f t h e n o z z l e Ma = 1 , and from Table A 3 2 // t h r o a t c o n d i t i o n s Px = P0 *0.5283; // p r e s s u r e i n kPa Tx = T0 *0.8333; // t e m p e r a t u r e i n K dx = d0 *0.6339; // d e n s i t y i n kg /m3 printf ( ( a ) P = %. 4 f kPa \ n , Px ) ; printf ( T = %. 1 f K \ n , Tx ) ; printf ( d = %. 3 f kg /m3 \ n , dx ) ; k =1.4; Vx = sqrt ( k * R * Tx *1000) ; printf ( V = %. 1 f m/ s \ n , Vx ) ; 152

19

20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 // ( c ) 35 ms = dx * Ax * Vx *10^ -4; 36 printf ( ( c ) Mass f l o w

// S i n c e t h e f l o w i s i s e n t r o p i c , t h e p r o p e r t i e s a t t h e e x i t p l a n e can a l s o be c a l c u l a t e d by u s i n g d a t a from T a b l e A 3 2 . For Ma = 2 Pe =0.1278* P0 ; //MPa Te =0.5556* T0 ; //K de =0.23* d0 ; // d e n s i t y i n kg /m3 Ax =20; //cm2 Ae =1.6875* Ax ; //cm2 Mae =2; Maex =1.633; Ve = Maex * Vx ; //m/ s printf ( ( b ) Pe = %. 4 f kPa \ n , Pe ) ; printf ( Te = %. 1 f K \ n , Te ) ; printf ( de = %. 3 f kg /m3 \ n , de ) ; printf ( Ae = %. 2 f cm2 \ n , Ae ) ; printf ( Ve = %. 1 f m/ s \ n , Ve ) ;

r a t e = %. 2 f kg / s \ n , ms ) ;

Scilab code Exa 17.9 Shock Wave in a Converging Diverging Nozzle


1 2 3 4 5 6 7 8 9 10

// e x 9 // Shock Wave i n a C o n v e r g i n g D i v e r g i n g N o z z l e clear clc // f l u i d p r o p e r t y a t e x i n o z z l e P01 =1; // p r e s s u r e i n MPa P1 =0.1278; // p r e s s u r e i n MPa T1 =444.5; // t e m p e r a t u r e i n K d1 =1.002; // d e n s i t y i n Kg/m3 // The f l u i d p r o p e r t i e s a f t e r t h e s h o c k ( d e n o t e d by s u b s c r i p t 2) are r e l a t e d to those b e f o r e the shock through the f u n c t i o n s l i s t e d i n Table A 3 3 153

11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32

Ma1 =2; Ma2 =0.5774; P02 =0.7209* P01 ; // s t a g n a t i o n p r e s s u r e i n MPa P2 =4.5* P1 ; // S t a t i c P r e s s u r e i n MPa T2 =1.6875* T1 ; // S t a t i c P r e s s u r e i n K d2 =2.6667* d1 ; // S t a t i c P r e s s u r e n kg /m3 printf ( ( a ) S t a g n a t i o n p r e s s u r e = %. 0 f MPa \ n , P02 ) ; printf ( S t a t i c P R e s s u r e = %. 4 f MPa \ n , P2 ) ; printf ( S t a t i c T e m p e r a t u r e = %. 1 f K \ n , T2 ) ; printf ( s t a t i c d e n s i t y = %. 2 f kg /m3 \ n , d2 ) ; // ( b ) R =0.287; Cp =1.005; // s p e c i f i c h e a t a t c o n s t a n t p r e s s u r e i n kJ / kg . K S = Cp * log ( T2 / T1 ) -R * log ( P2 / P1 ) ; // e n t r o p y c h a n g e i n kJ / kg . K printf ( ( b ) The e n t r o p y c h a n g e a c r o s s t h e s h o c k = % . 4 f kJ / kg . K \ n ,S ) ; // ( c ) k =1.4; V2 = Ma2 * sqrt ( k * R * T2 *1000) ; printf ( ( c ) A i r v e l o c i t y , V2 = %. 0 f m/ s \ n , V2 ) ; ms =2.86; // same a s p r e v i o u s e x a m p l e printf ( ( d ) Mass Flow r a t e = %. 2 f kg / s e c \ n , ms ) ;

Scilab code Exa 17.16 Steam Flow through a Converging Diverging Nozzle
1 // q u e s 1 6 2 // Steam Flow t h r o u g h a C o n v e r g i n g D i v e r g i n g N o z z l e 3 clear 4 clc 5 P01 =2; // i n l e t s t a g n a t i o n p r e s s u r e i n MPa 6 Pt =0.546* P01 ; // t h r o a t p r e s s u r e i n MPa

154

7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41

// a t i n l e t P1 =2; // i n l e t p r e s s u r e i n MPa T1 =400; // I n l e t Temp i n C T01 = T1 ; // s t a g n a t i o n temp i n K // from t a b l e s h1 =3248.4; // e n t h a l p y i n kJ / kg h01 = h1 ; // s t a g n a t i o n e n t h a l p y i n kJ / kg s1 =7.1292; // e n t r o p y i n kJ / kg . K st = s1 ; // s t a g n a t i o n i n kJ / kg . K s2s = s1 ; // e n t r o p y a t s t a t e 2 s n kJ / kg . K // Also , a t t h e t h r o a t Pt =1.09; // p r e s s u r e i n MPa st =7.1292; // e n t r o p y i n kJ / kg . K // from t a b l e s ht =3076.8; // e n t h a l p y i n kJ / kg vt =0.24196; //m3/ kg // now t h r o a t v e l o c i t y i s d e t e r m i n e d a s Vt = sqrt (2*( h01 - ht ) *1000) ; // t h r o a t v e l o c i t y // The f l o w a r e a a t t h e t h r o a t i s d e t e r m i n e d from t h e mass f l o w r a t e r e l a t i o n ms =2.5; // mass f l o w r a t e i n kg / s At = ms * vt / Vt ; // a r e a i n m2 printf ( ( a ) Flow a r e a a t t h r o a t = %. 2 f cm2 \ n , At *10000) ; // At s t a t e 2 s , P2s =300; // p r e s u r e i n kPa P2 = P2s ; // kPa // from t a b l e h2s =2783.6; // e n t h a l p y a t s t a t e 2 s i n kJ / kg // from t h e e n t h a l p y o f t h e steam a t t h e a c t u a l e x i t s t a t e i s ( s e e Chap . 7 ) f o r m u l a e n =0.93; h2 = h01 - n *( h01 - h2s ) ; // e n t h a l p y a t s t a t e 2 i n kJ / kg // now from t a b l e v2 =0.67723; //m3/ kg s2 =7.2019; // e n t r o p y i n kJ / kg . K // t h e e x i t v e l o c i t y and t h e e x i t a r e a V2 = sqrt (2*( h01 - h2 ) *1000) ; // E x i t v e l o c i t y i n m2 155

42 A2 =( ms * v2 ) / V2 ; 43 printf ( E x i t a r e a = %. 2 f cm2 \ n , A2 *10000) ; 44 // ( b ) 45 // c =(dP/ d ( 1 / v ) ) ( 1 / 2 ) 46 // The v e l o c i t y o f sound a t t h e t h r o a t i s d e t e r m i n e d

47 48 49 50 51 52 53 54 55

56 57 58 59 60 61 62 63

by e v a l u a t i n g t h e s p e c i f i c volume a t S t = 7 . 1 2 9 2 kJ / kg K and a t p r e s s u r e s o f 1 . 1 1 5 and 1 . 0 6 5 MPa Pa =1115; // kPa Pb =1065; // kPa va =0.23776; //m3/ kg vb =0.24633; //m3/ kg c = sqrt (( Pa - Pb ) /(1/ va -1/ vb ) *1000) ; // v e l o c i t y o f sound at throat V =585.8; // v e l o c i t y i n m/ s Ma = V / c ; printf ( ( b ) Mach number a t t h e t h r o a t = %. 3 f \ n , Ma ); // The v e l o c i t y o f sound and t h e Mach number a t t h e n o z z l e e x i t a r e d e t e r m i n e d by e v a l u a t i n g t h e s p e c i f i c volume a t S t= 7 . 2 0 1 9 kJ / kg K and a t p r e s s u r e s o f 325 and 275 kPa Pa =325; // kPa Pb =275; // kPa va =0.63596; //m3/ kg vb =0.72245; //m3/ kg c = sqrt (( Pa - Pb ) /(1/ va -1/ vb ) *1000) ; V =929.8; // V e l o c i t y Ma = V / c ; printf ( Mach number a t n o z e l e x i t = %. 3 f , Ma ) ;

156

S-ar putea să vă placă și