P. K. Nag. Engineering Thermodynamics (776119), страница 3
Текст из файла (страница 3)
f . a s a f u n c t i o noft e m p e r a t u r e i n mV3 e0 = horner (e , 0) ; // e .m. f . a t t = 0 d e g r e e4 e100 = horner (e , 100) ; // e .m. f . a t t = 100 d e g r e e5 e50 = horner (e , 50) ; // e .m. f . a t t = 50 d e g r e e r6 r = (100/ e100 ) * e50 ; // R e a d i n g o f t h e r m o c o u p l e a t t= 50 d e g r e e147disp ( ” d e g r e e ” ,r , ” R e a d i n g o f t h e r m o c o u p l e a t t = 50degree i s ”)Scilab code Exa 2.3 Calculting temperature for given resistance123456R0 = 2.8; // R e s i s t e n c e a t t =0 d e g r e e i n ohmR100 = 3.8; // R e s i s t e n c e a t t = 100 d e g r e e i n ohma = ( R100 / R0 - 1) *0.01; // a l p h aR = 5.8; // I n d i c a t e d r e s s i s t a c e i n ohmt = ( R / R0 - 1) / a ; // T e m p e r a t u r e i n d e g r e edisp ( ” d e g r e e ” ,t , ” The t e m p e r a t u r e when i n d i c a t e dr e s i s t a n c e i s 5 .
8 ohm i s ” )15Chapter 3Work and heat transferScilab code Exa 3.1 Calculation of magnitude of velocity12345V1 = 100; // I n i t i a l v e l o c i t y i n m/ sg = 9.81; // A c c e l e r a t i o n due t o g r a v i t y i n m/ s 2z1 = 100; // I n i t i a l e l e v a t i o n i n mV = sqrt ((2* g * z1 ) +( V1 ) ^2) ; // F i n a l v e l o c i t y i n m/ s 2disp ( ”m/ s ” ,V , ” The v e l o c i t y o f t h e o b j e c t j u s t b e f o r ei r h i t s the ground i s ”)Scilab code Exa 3.2 Calculation of work done on atmosphere by balloon1 dV = 0.5; // Change i n volume i n m32 P = 101.325 e03 ; // A t m o s p h e r i c p r e s s u r e i n N/m23 Wd = P * dV ; // Work done i n J4 disp ( ”KJ” , Wd /1000 , ” The amount o f work done upon t h ea t m o s p h e r e by t h e b a l l o n i s ” )Scilab code Exa 3.3 Calculation of work done by atmosphere161 dV = 0.6; // Change i n volume i n m32 P = 101.325 e03 ; // A t m o s p h e r i c p r e s s u r e i n N/m23 Wd = P * dV ; // Work done i n J4 disp ( ”KJ” , Wd /1000 , ” The d i s p l a c e m e n t work done by t h ea i r i s ”)Scilab code Exa 3.4 Calculation of net work transfer for the system1 T = 1.275 e -03; // Torque a c t i n g2345678910against the f l u i d inNN = 10000; // Number o f r e v o l u t i o n sW1 = 2* %pi * T * N ; // Work done by s t i r r i n g d e v i c e uponthe systemP = 101.325 e03 ; // A t m o s p h e r i c p r e s s u r e i n N/m2d = 0.6; // P i s t o n d i a m e t e r i n mA = ( %pi /4) *( d ) ^2; // P i s t o n a r e a i n mL = 0.80; // D i s p l a c e m e n t o f d i a m e t e r i n mW2 = ( P * A * L ) /1000; // Work done by t h e s y s t e m on t h es u r r o u n d i n g s i KJW = - W1 + W2 ; // Net work t r a n f e r f o r t h e s y s t e mdisp ( ”KJ” ,W , ” The Net work t r a n f e r f o r t h e s y s t e m i s ”)Scilab code Exa 3.5 Calculation of net rate of work transfer from the gasto piston1234567ad = 5.5 e -04; // Area o f i n d i c a t o r d i a g r a mld = 0.06; // Length o f d i a g r a mk = 147 e06 ; // S p r i n g c o n s t a n t i n MPa/mw = 150; // Speed o f e n g i n eL = 1.2 ; // S t r o k e o f p i s t o nd = 0.8; // D i a m e t e r o f t h e c y l i n d e r i n mA = ( %pi /4) *(0.8^2) ; // Area o f c y l i n d e r178 Pm = ( ad / ld ) * k ; // E f f e c t i v e p r e s s u r e9 W1 = Pm * L * A * w ; // Work done i n 1 m i n u t e10 W = (12* W1 ) /60; // The r a t e o f work t r a n s f e r11gas tot h e p i s t o n i n MJ/ sdisp ( ”kW” ,W /1000 , ” The r a t e o f work t r a n s f e r g a s t othe p i s t o n i s ”)Scilab code Exa 3.6 Calculation of dimension of cylindrical furnace1234567891011121314151617Tm = 1535; // M e l t i n g p o i n t o f i r o n on d e g r e eTi = 15; // I n i t i a l t e m p e r a t u r eTf = 1650; // F i n a l t e m p e r a t u r eLh = 270 e03 ; // L a t e n t h e a t o f i r o n i n J /Kgml = 29.93; // Atomic w e i g h t o f i r o n i n l i q u i d s t a t em = 56; // Atomoc w e i g h t o f i r o nsh = 0.502 e03 ; // S p e c i f i c h e a t o f i r o n i n J /Kgd = 6900; // D e n s i t y o f m o l t e n m e t a l i n kg /m3H = ( Tm - Ti ) * sh + Lh + ( ml / m ) *( Tf - Tm ) *1000; // HeatrequiredMr = 5 e03 ; // M e l t i n g r a t e i n Kg/ hHr = H * Mr ; // Rate o f h e a t suppyHrA = Hr /(0.7*3600) // A c t u a l r a t e o f h e a t s u p p l ydisp ( ”W” ,HrA , ” R a t i n g o f f u r n a c e would be ” )V = (3* Mr ) / d ; // Volume r e q u i r e d i n m3d = (( V /2) *(4/ %pi ) ) *(1/3) ; // D i a m e t e r o f c y l i n d e rof furnace in ml = 2* d ; // Length o f c y l i n d e r o f f u r n a c e i n mdisp ( ”m” ,l , ” Length o f c y l i n d e r o f f u r n a c e i s ” )Scilab code Exa 3.7 Calculations on alluminium furnace1 SH = 0.9; // S p e c i f i cheat of alluminium in s o l i dstate18234567891011121314L = 390; // L a t e n t h e a taw = 27; // Atomic w e i g h tD = 2400; // D e n s i t y i n m o l t e n s t a t eTf = 700+273; // F i n a l t e m p e r a t u r eTm = 660+273; // M e l t i n g p o i n t o f aluminiumTi = 15+273; // I n t i a l t e m p e r a t u r eHR = SH *( Tm - Ti ) + L +(29.93/27) *( Tf - Tm ) ; // HeatrequiresHS = HR /0.7 ; // Heat s u p p l i e dRM = 217*1000*3600/ HS ; // From t h e d a t a o f p r o b l e m3.7V = 2.18; // VolumeM = V*D;disp ( ” t o n n e s ” ,M *0.001 , ” Mass o f a l l u m i n i u m t h a t canbe m e l t e d i s ” )disp ( ” kg /h ” ,RM , ” Rate a t which a l l u m i n i u m can bemelted i s ”)Scilab code Exa 3.8 Calculation on work required for automization12345678910dd = 60 e -06;mw = 1;st = 0.07;dw = 1000;dp = 15 e -03;N = ( mw *6) /( %pi * dd ^3* dw ) ;Af = %pi * dd ^2* N ;S_L = 4/( dp * dw ) ;W = st *(100 - S_L ) ;disp ( ” J ” ,W , ”Work done d u r i n g a u t o m i z a t i o n i s ” )Scilab code Exa 3.9 Calcultion on electric motor19123456789101112dc = 40 e -02;L = 30 e -02;P = 1 e05 ; // P r e s s u r e i n P a s c a lI = 0.5;V = 24;t = 15*60; // i n s e c o n d sWm = V * I * t ;Ws = 0.9* Wm ;W = P *( %pi /4) * dc ^2* L ;disp ( ” J ” ,Wm , ”Work i n p u t t o t h e motor i s ” )disp ( ” J ” ,Ws , ”Work i n p u t t o t h e s t i r r e r i s ” )disp ( ” J ” ,W , ”Work done by t h e f l u i d on t h e a t m o s p h e r ei s ”)Scilab code Exa 3.10 Calculation of work done by piston cylinder system1234567P1 = 100; P2 = 37.9; P3 = 14.4;V1 = 0.1; V2 = 0.2; V3 = 0.4;n1 = ( log ( P1 / P2 ) ) /( log ( V2 / V1 ) ) ;n2 = ( log ( P2 / P3 ) ) /( log ( V3 / V2 ) ) ;// n1 = n2W = (( P1 * V1 ) -( P3 * V3 ) ) /( n1 -1) ;disp ( ” kJ ” ,W , ”Work done by t h e s y s t e m i s ” )Scilab code Exa 3.11 Calculation of work done in PV cycle1234567P1 = 20*1.01325 e05 ;V1 = 0.04; V2 = 2* V1 ;n = 1.45;P2 = ( V1 / V2 ) ^ n * P1 ;W12 = (( P1 * V1 ) -( P2 * V2 ) ) /( n -1) ;W23 = P2 *( V2 - V1 ) ;Wc = W12 - W23 ;208disp ( ” J ” ,Wc , ”Work done i n t h e c y c l e i s ” )21Chapter 4First law of thermodynamicsScilab code Exa 4.1 Calculation of change in internal energy of gas1234567V1 = 0.3; // I n i t i a l volume i n m3V2 = 0.15; // F i n a l volume i n m3P = 0.105 e06 ; // P r e s s u r e i n PaQ = -37.6 e03 ; // Heat t r a n f e r r e d i n JW = P *( V2 - V1 ) ; // Work doneU = Q - W ; // I n t e r n a l e n e r g y c h a n g edisp ( ” J o u l e ” ,U , ” Change i n t h e i n t e r n a l e n e r g y o f t h esystem i s ”)Scilab code Exa 4.2 Calculations on PV cycle1 Qacb = 84 e03 ;2 Wacb = 32 e03 ;3 Uba = Qacb - Wacb ; // Ub−Ua4 // P a r t ( a )5 Wadb = 10.5 e03 ;6 Qadb = Uba + Wadb ;7 disp ( ” J ” , Qadb , ” The h e a t f l o wt h e p a t h adb ” ) ;22i n t o the system along8 // P a r t ( b )9 Wb_a = -21 e03 ;10 Uab = - Uba ;11 Qb_a = Uab + Wb_a ;12 disp ( ” J ” , Qb_a , ” The h e a t131415161718192021l i b e r a t e d a l o n g t h e p a t h b−ai s ”)// P a r t ( c )Wdb = 0; // C o n s t a n t volumeWad = 10.4 e03 ;Wadb = Wdb - Wad ;Ud = 42 e03 ;Ua = 0;Qad = Ud - Ua + Wad ;Qdb = Qadb - Qad ;disp ( ” J ” ,Qdb , ” and ” ,Qad , ” The h e a t a b s o r b e d i n t h ep a t h ad and db a r e ” )Scilab code Exa 4.3 Calculation of net rate of work output in a pistonand cylinder machine123456789101112131415// P r o c e s s a−bQab = 0;Wab = 2170; // i n KJ/ minEab = Qab - Wab ;// P r o c e s s b−cQbc = 21000;Wbc = 0;Ebc = Qbc - Wbc ;// P r o c e s s c−dQcd = -2100;Ecd = -36600;Wcd = Qcd - Ecd ;// P r o c e s s d−aQ = -17000; // T o t a l h e a t t r a n s f e rQda = Q - Qab - Qbc - Qcd ;2316 Eda = -Eab - Ebc - Ecd ;17 Wda = Qda - Eda ;18 M = [ Qab Wab Eab ; Qbc Wbc Ebc ; Qcd Wcd Ecd ; Qda Wda19Eda ];disp (M , ” The c o m p l e t e d t a b l e i s ” )Scilab code Exa 4.4 Thermodynamics calculations of a substance with giveninternal energy function1234567891011121314151617// P a r t ( a )m = 3;V1 = 0.22;P1 = 500 e03 ;P2 = 100 e03 ;V2 = V1 *( P1 / P2 ) ^(1/1.2) ;dU = 3.56*( P2 * V2 - P1 * V1 ) ;gama = 1.2;W = ( P2 * V2 - P1 * V1 ) /(1 - gama ) ;Q = dU + W ;disp ( ” J r e s p e c t i v e l y ” ,dU ,W ,Q , ”Q,W and dU o f t h equasi s t a t i c p r o c e s s are ”)// P a r t ( b )Qb = 30 e03 ;Wb = Qb - dU ;disp ( ” J o u l e ” ,Wb , ”Work t r a n s f e r f o r t h e p r o c e s s i s ” )// P a r t ( c )disp ( ”Wb i s n o t e q u a l t o i n t e g r a l ( p∗ dv ) s i n c e t h ep r o c e s s i s not q u a s i s t a t i c ”)Scilab code Exa 4.5 Thermodynamics calculations of a cylinder with giveninternal energy function1 V1 = 0.03;242345678910111213141516P1 = 170 e03 ;P2 = 400 e03 ;V2 = 0.06;U = 3.15*( P2 * V2 - P1 * V1 ) ;B = [ P1 P2 ] ’;A = [1 V1 ; 1 V2 ];x = inv ( A ) * B ;a = x (1) ; b = x (2) ;function P = pressure ( V )P = a+b*V;endfunction ;W = intg ( V1 , V2 , pressure ) ;Q = U+W;disp ( ” J ” ,W , ” The work done by t h e s y s t e m i s ” )disp ( ” J ” ,U , ” The i n t e r n a l e n e r g y c h a n g e o f t h e s y s t e mi s ”)17 disp ( ” J ” ,Q , ” The h e a t f l o w i n t o t h e s y s t e m i s ” )Scilab code Exa 4.6 Calculation on PV cycle of a stationary fluid system123456789101112131415// P r o c e s s 1−2Q12 = 235; // i n KJ/KgW12 = 0 ;U12 = Q12 - W12 ;// P r o c e s s 2−3Q23 = 0;U23 = -70 ;W23 = Q23 - U23 ;// P r o c e s s 3−1Q31 = - 200;U31 = -U12 - U23 ;W31 = Q31 - U31 ;//W = W12 + W23 + W31 ;Q = Q12 + Q23 + Q31 ;251617disp ( ”KJ/Kg” ,Q , ” Heat t r a s f e r i n t h e c y c l e i s ” )disp ( ”KJ/Kg” ,W , ”Work done d u r i n g t h e t h e c y c l e i s ” )26Chapter 5First law applied to flowprocessesScilab code Exa 5.1 Calculation on an air compressor12345678910111213141516// P a r t ( a )V1 = 0.95;P1 = 100 e03 ;v1 = 7;V2 = 0.19;P2 = 700 e03 ;v2 = 5;w = 0.5;u21 = 90 e03 ; // u21 = u2−u1Q = -58 e03 ; // As h e a t i s added Q = dQ/ d tW = - w *( u21 + ( P2 * V2 - P1 * V1 ) + (( v2 ^2 - v1 ^2) /2) ) +Q ; // W = dW/ d tdisp ( ” Watt ” ,W , ” The r a t e o f work i n p u t i s ” )// P a r t ( b )A = ( v2 / v1 ) *( V1 / V2 ) ; // A = A1/A2d = sqrt ( A ) ; // d = d1 / d2disp (d , ” The r a t i o o f t h e i n l e t p i p e d i a m e t e r andouter pipe diameter i s ”)27Scilab code Exa 5.2 Calculations across a control volume123456789101112V1 = 0.37;P1 = 600 e03 ;v1 = 16;V2 = 0.62;P2 = 100 e03 ;v2 = 270;Z1 = 32;Z2 = 0;g = 9.81;Q = -9 e03 ; // h e a t l o s s Q = dQ/ d tW = 135 e03 ; // Work done W = dW/ d tU12 = ( P2 * V2 - P1 * V1 ) + (( v2 ^2 - v1 ^2) /2) + ( Z2 - Z1 ) * g +W - Q ; // U12 = U1−U213 disp ( ” J o u l e ” ,U12 , ” The i n t e r n a l e n e r g y d e c r e a s e s by ” )Scilab code Exa 5.3 Calculation of steam flow rate between a boiler andturbine123456789101112P1 = 4 e06 ;t1 = 400;h1 = 3213 e03 ;V1 = 0.073;P2 = 3.5 e06 ;t2 = 392;h2 = 3202 e03 ;V2 = 0.084;Q = -8.5 e03 ;v1 = sqrt ((2*( h1 - h2 + Q ) ) /(1.15^2 -1) ) ;A1 = ( %pi /4) *0.2^2;w = ( A1 * v1 ) / V1 ;2813disp ( ”Kg/ s ” ,w , ” The s t e a n f l o w r a t e i s ” )Scilab code Exa 5.4 Calculation of quantity of steam supplied to a heater12345678910111213141516171819202122232425262728293031h1 = 313.93;h2 = 2676;h3 = 419;w1 = 4.2;w = poly (0 , ’w ’ ) // w = w2P = w1 * h1 + w * h2 - h3 *(4.2+ w )function [ x ] = stress (a ,b , f )N = 100;eps = 1e -5;if (( f ( a ) * f ( b ) ) >0) thenerror ( ’ no r o o t p o s s i b l e f ( a ) ∗ f ( b ) >0 ’ ) ;abort ;end ;if ( abs ( f ( a ) ) < eps ) thenerror ( ’ s o l u t i o n a t a ’ ) ;abort ;endif ( abs ( f ( b ) ) < eps ) thenerror ( ’ s o l u t i o n a t b ’ ) ;abort ;endwhile (N >0)c = ( a + b ) /2if ( abs ( f ( c ) ) < eps ) thenx = c ;x;return ;end ;if (( f ( a ) * f ( c ) ) <0 ) thenb = c ;else2932a = c ;33end34N = N -1;35end36error ( ’ no c o n v e r g e n c e ’ ) ;37abort ;38 endfunction3940 deff ( ’ [ y ]= p (w) ’ ,[ ’ y = − 4 4 1 .














