summaryrefslogtreecommitdiff
path: root/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter14_1.ipynb
blob: 93b514ee82b81da8cca794f68664b846149111b4 (plain)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 14 - Air and gas compressors"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1: pg 400"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " Example 14.1\n",
      " (a) The free air delivered is (m^3/min) =  3.814\n",
      " (b) The volumetric efficiency is (percent) =  80.9\n",
      " (c) The air delivery temperature is (C) =  164.3\n",
      " (d) The cycle power is (kW) =  14.0\n",
      " (e) The isothermal efficiency neglecting clearence  is (percent) =  81.3\n"
     ]
    }
   ],
   "source": [
    "#pg 400\n",
    "print(' Example 14.1');\n",
    "\n",
    "# aim : To determine \n",
    "# (a) the free air delivered\n",
    "# (b) the volumetric efficiency\n",
    "# (c) the air delivery temperature\n",
    "# (d) the cycle power\n",
    "# (e) the isothermal efficiency\n",
    "from math import pi,log\n",
    "# given values\n",
    "d = 200.*10**-3;# bore, [m]\n",
    "L = 300.*10**-3;# stroke, [m]\n",
    "N = 500.;# speed, [rev/min]\n",
    "n = 1.3;# polytropic index\n",
    "P1 = 97.;# intake pressure, [kN/m**2]\n",
    "T1 = 273.+20;# intake temperature, [K]\n",
    "P3 = 550.;# compression pressure, [kN/m**2]\n",
    "\n",
    "# solution\n",
    "# (a)\n",
    "P4 = P1;\n",
    "P2 = P3;\n",
    "Pf = 101.325;# free air pressure, [kN/m**2]\n",
    "Tf = 273+15;# free air temperature, [K]\n",
    "SV = pi/4*d**2*L;# swept volume, [m**3]\n",
    "V3 = .05*SV;# [m**3]\n",
    "V1 = SV+V3;# [m**3]\n",
    "V4 = V3*(P3/P4)**(1/n);# [m**3]\n",
    "ESV = (V1-V4)*N;# effective swept volume/min, [m**3]\n",
    "# using PV/T=constant\n",
    "Vf = P1*ESV*Tf/(Pf*T1);# free air delivered, [m**3/min]\n",
    "print ' (a) The free air delivered is (m^3/min) = ',round(Vf,3)\n",
    "\n",
    "# (b)\n",
    "VE = Vf/(N*(V1-V3));# volumetric efficiency\n",
    "print ' (b) The volumetric efficiency is (percent) = ',round(VE*100,1)\n",
    "\n",
    "# (c)\n",
    "T2 = T1*(P2/P1)**((n-1)/n);#  free air temperature, [K]\n",
    "print ' (c) The air delivery temperature is (C) = ',round(T2-273,1)\n",
    "\n",
    "#  (d)\n",
    "CP = n/(n-1)*P1*(V1-V4)*((P2/P1)**((n-1)/n)-1)*N/60;# cycle power, [kW]\n",
    "print ' (d) The cycle power is (kW) = ',round(CP)\n",
    "\n",
    "# (e)\n",
    "# neglecting clearence\n",
    "W = n/(n-1)*P1*V1*((P2/P1)**((n-1)/n)-1)\n",
    "Wi = P1*V1*log(P2/P1);# isothermal efficiency\n",
    "IE = Wi/W;# isothermal efficiency\n",
    "print ' (e) The isothermal efficiency neglecting clearence  is (percent) = ',round(IE*100,1)\n",
    "\n",
    "# End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2: pg 408"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " Example 14.2\n",
      " (a) The intermediate pressure is (MN/m^2) =  0.265\n",
      " (b) The total volume of the HP cylinder is (litres) =  7.6\n",
      " (c) The cycle power is (MW) =  43.0\n",
      " there is rounding mistake in the book so answer is not matching\n"
     ]
    }
   ],
   "source": [
    "#pg 408\n",
    "print(' Example 14.2');\n",
    "\n",
    "# aim : To determine \n",
    "# (a) the intermediate pressure\n",
    "# (b) the total volume of each cylinder\n",
    "# (c) the cycle power\n",
    "from math import sqrt\n",
    "# given values\n",
    "v1 = .2;# air intake, [m^3/s]\n",
    "P1 = .1;# intake pressure, [MN/m^2]\n",
    "T1 = 273.+16;# intake temperature, [K]\n",
    "P3 = .7;# final pressure, [MN/m^2]\n",
    "n = 1.25;# compression index\n",
    "N = 10;# speed, [rev/s]\n",
    "\n",
    "# solution\n",
    "# (a)\n",
    "P2 = sqrt(P1*P3);# intermediate pressure, [MN/m^2]\n",
    "print ' (a) The intermediate pressure is (MN/m^2) = ',round(P2,3)\n",
    "\n",
    "# (b)\n",
    "V1  = v1/N;# total volume,[m^3]\n",
    "# since intercooling is perfect so 2 lie on the isothermal through1, P1*V1=P2*V2\n",
    "V2 = P1*V1/P2;# volume, [m^3]\n",
    "print ' (b) The total volume of the HP cylinder is (litres) = ',round(V2*10**3,1)\n",
    "\n",
    "# (c)\n",
    "CP = 2*n/(n-1)*P1*v1*((P2/P1)**((n-1)/n)-1);# cycle power, [MW]\n",
    "print ' (c) The cycle power is (MW) = ',round(CP*10**3)\n",
    "\n",
    "print ' there is rounding mistake in the book so answer is not matching'\n",
    "\n",
    "#  End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3: pg 409"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " Example 14.3\n",
      " (a) The intermediate pressure is P2 (bar) =  2.466\n",
      "     The intermediate pressure is  P3 (bar) =  6.082\n",
      " (b) The effective swept volume of the LP cylinder is (litres) =  45.32\n",
      " (c) The delivery temperature is (C) =  85.4\n",
      "      The delivery volume is (litres) =  3.72\n",
      " (d) The work done per kilogram of air is (kJ) =  254.1\n",
      "The answer is a bit different due to rounding off error in textbook\n"
     ]
    }
   ],
   "source": [
    "#pg 409\n",
    "print(' Example 14.3');\n",
    "\n",
    "# aim : To determine \n",
    "# (a) the intermediate pressures\n",
    "# (b) the effective swept volume of the LP cylinder\n",
    "# (c) the temperature and the volume of air delivered per stroke at 15 bar\n",
    "# (d) the work done per kilogram of air\n",
    "import math\n",
    "# given values\n",
    "d = 450.*10**-3;#  bore , [m]\n",
    "L = 300.*10**-3;#  stroke, [m]\n",
    "cl = .05;#  clearence\n",
    "P1 = 1.; # intake pressure, [bar]\n",
    "T1 = 273.+18;# intake temperature, [K]\n",
    "P4 = 15.;# final delivery pressure, [bar]\n",
    "n = 1.3;#  compression and expansion index\n",
    "R = .29;# gas constant, [kJ/kg K]\n",
    "\n",
    "# solution\n",
    "# (a)\n",
    "k=(P4/P1)**(1./3); \n",
    "# hence\n",
    "P2 = k*P1;#  intermediare pressure, [bar]\n",
    "P3 = k*P2;#  intermediate pressure, [bar]\n",
    "\n",
    "print ' (a) The intermediate pressure is P2 (bar) = ',round(P2,3)\n",
    "print '     The intermediate pressure is  P3 (bar) = ',round(P3,3)\n",
    "\n",
    "# (b)\n",
    "SV = math.pi*d**2/4*L;#  swept volume of LP cylinder, [m**3]\n",
    "# hence\n",
    "V7 = cl*SV;# volume, [m**3]\n",
    "V1 = SV+V7;# volume, [m**3]\n",
    "# also\n",
    "P7 = P2;\n",
    "P8 = P1;\n",
    "V8 = V7*(P7/P8)**(1/n);#  volume, [m**3]\n",
    "ESV = V1-V8;# effective swept volume of LP cylinder, [m**3]\n",
    "\n",
    "print ' (b) The effective swept volume of the LP cylinder is (litres) = ',round(ESV*10**3,2)\n",
    "\n",
    "# (c)\n",
    "T9 = T1;\n",
    "P9 = P3;\n",
    "T4 = T9*(P4/P9)**((n-1)/n);# delivery temperature, [K]\n",
    "# now using P4*(V4-V5)/T4=P1*(V1-V8)/T1\n",
    "V4_minus_V5 = P1*T4*(V1-V8)/(P4*T1);# delivery volume, [m**3]\n",
    " \n",
    "print ' (c) The delivery temperature is (C) = ',round(T4-273,1)\n",
    "print '      The delivery volume is (litres) = ',round(V4_minus_V5*10**3,2)\n",
    "\n",
    "#  (d)\n",
    "\n",
    "W = 3*n*R*T1*((P2/P1)**((n-1)/n)-1)/(n-1);#  work done/kg ,[kJ]\n",
    "print ' (d) The work done per kilogram of air is (kJ) = ',round(W,1)\n",
    " \n",
    "print 'The answer is a bit different due to rounding off error in textbook'\n",
    "# End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4: pg 416"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " Example 14.4\n",
      " (a) The final temperature is (C) =  221.0\n",
      " (b) The final pressure is (kN/m^2) =  500.0\n",
      " (b) The energy required to drive the compressor is (kW) =  -2023.0\n",
      "The negative sign indicates energy input\n",
      "The answer is a bit different due to rounding off error in textbook\n"
     ]
    }
   ],
   "source": [
    "#pg 416\n",
    "print(' Example 14.4');\n",
    "\n",
    "# aim : To determine \n",
    "# (a) the final pressure and temperature\n",
    "# (b) the energy required to drive the compressor\n",
    "\n",
    "# given values\n",
    "rv = 5.;# pressure compression ratio\n",
    "m_dot = 10.;# air flow rate, [kg/s]\n",
    "P1 = 100.;# initial pressure, [kN/m**2]\n",
    "T1 = 273.+20;# initial temperature, [K]\n",
    "n_com = .85;# isentropic efficiency of compressor\n",
    "Gama = 1.4;# heat capacity ratio\n",
    "cp = 1.005;# specific heat capacity, [kJ/kg K]\n",
    "\n",
    "# solution\n",
    "# (a)\n",
    "T2_prim = T1*(rv)**((Gama-1)/Gama);# temperature after compression, [K]\n",
    "# using isentropic efficiency=(T2_prim-T1)/(T2-T1)\n",
    "T2 = T1+(T2_prim-T1)/n_com;#  final temperature, [K]\n",
    "P2 = rv*P1;# final pressure, [kN/m**2]\n",
    "print ' (a) The final temperature is (C) = ',round(T2-273)\n",
    "print ' (b) The final pressure is (kN/m^2) = ',P2\n",
    "\n",
    "# (b)\n",
    "E = m_dot*cp*(T1-T2);# energy required, [kW]\n",
    "print ' (b) The energy required to drive the compressor is (kW) = ',round(E)\n",
    "if(E<0):\n",
    "    print('The negative sign indicates energy input');\n",
    "else:\n",
    "    print('The positive sign indicates energy output');\n",
    "\n",
    "print 'The answer is a bit different due to rounding off error in textbook'\n",
    " #  End\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5: pg 417"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " Example 14.5\n",
      " The power absorbed by compressor is (kW) =  12.64\n"
     ]
    }
   ],
   "source": [
    "#pg 417\n",
    "print(' Example 14.5');\n",
    "\n",
    "# aim : To determine \n",
    "#  the power absorbed in driving the compressor\n",
    "\n",
    "# given values\n",
    "FC = .68;# fuel consumption rate, [kg/min]\n",
    "P1 = 93.;# initial pressure, [kN/m^2]\n",
    "P2 = 200.;# final pressure, [kN/m^2]\n",
    "T1 = 273.+15;# initial temperature, [K]\n",
    "d = 1.3;# density of mixture, [kg/m^3]\n",
    "n_com = .82;# isentropic efficiency of compressor\n",
    "Gama = 1.38;# heat capacity ratio\n",
    "\n",
    "# solution\n",
    "R = P1/(d*T1);# gas constant, [kJ/kg K]\n",
    "# for mixture\n",
    "cp = Gama*R/(Gama-1);# heat capacity, [kJ/kg K]\n",
    "T2_prim = T1*(P2/P1)**((Gama-1)/Gama);# temperature after compression, [K]\n",
    "# using isentropic efficiency=(T2_prim-T1)/(T2-T1)\n",
    "T2 = T1+(T2_prim-T1)/n_com;#  final temperature, [K]\n",
    "m_dot = FC*15/60.;# given condition, [kg/s]\n",
    "P = m_dot*cp*(T2-T1);# power absorbed by compressor, [kW]\n",
    "#results\n",
    "print ' The power absorbed by compressor is (kW) = ',round(P,2)\n",
    "\n",
    "# End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6: pg 418"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " Example 14.6\n",
      " The power required to drive the blower is (kW) =  99.5\n"
     ]
    }
   ],
   "source": [
    "#pg 418\n",
    "print(' Example 14.6');\n",
    "\n",
    "# aim : To determine \n",
    "#  the power required to drive the blower\n",
    "\n",
    "# given values\n",
    "m_dot = 1;# air capacity, [kg/s]\n",
    "rp = 2;# pressure ratio\n",
    "P1 = 1*10**5;# intake pressure, [N/m^2]\n",
    "T1 = 273+70.;# intake temperature, [K]\n",
    "R = .29;# gas constant, [kJ/kg k]\n",
    "\n",
    "# solution\n",
    "V1_dot = m_dot*R*T1/P1*10**3;# [m^3/s]\n",
    "P2 = rp*P1;# final pressure, [n/m^2]\n",
    "P = V1_dot*(P2-P1);# power required, [W]\n",
    "#results\n",
    "print ' The power required to drive the blower is (kW) = ',round(P*10**-3,1)\n",
    "\n",
    "# End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7:  pg 418"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " Example 14.7\n",
      " The power required to drive the vane pump is (kW) =  78.0\n"
     ]
    }
   ],
   "source": [
    "#pg 418\n",
    "print(' Example 14.7');\n",
    "\n",
    "# aim : To determine \n",
    "#  the power required to drive the vane pump\n",
    "\n",
    "# given values\n",
    "m_dot = 1;# air capacity, [kg/s]\n",
    "rp = 2;# pressure ratio\n",
    "P1 = 1*10**5;# intake pressure, [N/m^2]\n",
    "T1 = 273.+70;# intake temperature, [K]\n",
    "Gama = 1.4;# heat capacity ratio\n",
    "rv = .7;# volume ratio\n",
    "\n",
    "# solution\n",
    "V1 = .995;# intake pressure(as given previous question),[m^3/s] \n",
    "# using P1*V1^Gama=P2*V2^Gama, so\n",
    "P2 = P1*(1/rv)**Gama;# pressure, [N/m^2]\n",
    "V2 = rv*V1;# volume,[m^3/s]\n",
    "P3 = rp*P1;# final pressure, [N/m^2]\n",
    "P = Gama/(Gama-1)*P1*V1*((P2/P1)**((Gama-1)/Gama)-1)+V2*(P3-P2);# power required,[W]\n",
    "#results\n",
    "print ' The power required to drive the vane pump is (kW) = ',round(P*10**-3)\n",
    "\n",
    "#  End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8: pg 420"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " Example 14.8\n",
      " The power required to drive compressor is (kW) =  54.6\n",
      " The temperature in the engine is (C) =  109.19\n",
      " The pressure in the engine cylinder is (kN/m^2) =  160.5\n"
     ]
    }
   ],
   "source": [
    "#pg 420\n",
    "print(' Example 14.8');\n",
    "\n",
    "# aim : To determine \n",
    "#  the total temperature and pressure of the mixture\n",
    "\n",
    "# given values\n",
    "rp = 2.5;# static pressure ratio\n",
    "FC = .04;# fuel consumption rate, [kg/min]\n",
    "P1 = 60.;# inilet pressure, [kN/m^2]\n",
    "T1 = 273.+5;# inilet temperature, [K]\n",
    "n_com = .84;# isentropic efficiency of compressor\n",
    "Gama = 1.39;# heat capacity ratio\n",
    "C2 = 120.;#exit velocity from compressor, [m/s]\n",
    "rm = 13.;# air-fuel ratio\n",
    "cp = 1.005;# heat capacity ratio\n",
    "\n",
    "# solution\n",
    "P2 = rp*P1;# given condition, [kN/m^2]\n",
    "T2_prim = T1*(P2/P1)**((Gama-1)/Gama);# temperature after compression, [K]\n",
    "# using isentropic efficiency=(T2_prim-T1)/(T2-T1)\n",
    "T2 = T1+(T2_prim-T1)/n_com;#  final temperature, [K]\n",
    "m_dot = FC*(rm+1);# mass of air-fuel mixture, [kg/s]\n",
    "P = m_dot*cp*(T2-T1);# power to drive compressor, [kW]\n",
    "print ' The power required to drive compressor is (kW) = ',round(P,1)\n",
    "\n",
    "Tt2 = T2+C2**2/(2*cp*10**3);# total temperature,[K]\n",
    "Pt2 = P2*(Tt2/T2)**(Gama/(Gama-1));# total pressure, [kN/m^2]\n",
    "print ' The temperature in the engine is (C) = ',round(Tt2-273,2)\n",
    "print ' The pressure in the engine cylinder is (kN/m^2) = ',round(Pt2,1)\n",
    "\n",
    "print ' There is rounding mistake in the book'\n",
    "\n",
    "\n",
    "#  End\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}