summaryrefslogtreecommitdiff
path: root/Internal_Combustion_Engines_by_H._B._Keswani/ch5.ipynb
blob: 0d0c8f35470d17c99c17048071060915aef348cf (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:ffa252e0f1b2a360d9cd4d249675a66968869a58480fb1a0e3c0c3fd2fa6c2ba"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 5 : Variable Specific Heat"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.2  Page no :  105"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\t\t\n",
      "#Input data\n",
      "r = 8.\t\t\t\t\t#Compression ratio\n",
      "n = 1.41\t\t\t\t\t#Adiabatic index of the medium\n",
      "cv = 0.17\t\t\t\t\t#Mean Specific heat at consmath.tant volume in kcal/kg/degree C\n",
      "x = 2.\t\t\t\t\t#Percentage with which spcific heat at consmath.tant volume increases\n",
      "R = 29.3\t\t\t\t\t#Characteristic gas consmath.tant in mkg/kg/degree C\n",
      "J = 427.\t\t\t\t\t#Mechanical equivalent of heat in kg.m/kcal\n",
      "\n",
      "\t\t\t\t\t\n",
      "#Calculations\n",
      "e = (1-(1/r**(n-1)))\t\t\t\t\t#Air standard efficiency neglecting the variation in specific heat\n",
      "debye = ((x/100)*((1-e)/e)*(R/(J*cv))*math.log(r))*100\t\t\t\t\t#Ratio of de and e in percent\n",
      "\n",
      "\t\t\t\t\t\n",
      "#Output\n",
      "print 'The change in air standard efficiency of the cycle is %3.3f percent'%(debye)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The change in air standard efficiency of the cycle is 1.247 percent\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.3  Page no :  106"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from scipy.integrate import quad\n",
      "\n",
      "\t\t\t\t\t\n",
      "#Input data\n",
      "\t\t\t\t\t#Cv = 0.125+0.000005T where Cv is Specific heat at consmath.tant volume and T is the temperature in K\n",
      "R = 28.9\t\t\t\t\t#Characteristic gas consmath.tant in mkg/kg/degree C\n",
      "T = [100+273,50+273]\t\t\t\t\t#Temperature in K\n",
      "J = 427\t\t\t\t\t#Mechanical equivalent of heat in kg.m/kcal\n",
      "\n",
      "\t\t\t\t\t\n",
      "#Calculations\n",
      "def f(x):\n",
      "\treturn  0.125+(0.00005*x)\n",
      "\t\n",
      "I = J*quad(f,303,373)[0]\n",
      "\n",
      "\t\t\t\t\t\n",
      "#Output\n",
      "print 'The work done is %i m.kg/kg of gas'%(I)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The work done is 4241 m.kg/kg of gas\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.4  Page no :  109"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\t\t\n",
      "#Input data\n",
      "af = 25.\t\t\t\t\t#Air fuel ratio\n",
      "cv = [0.17,0.00004]\t\t\t\t\t#Cv = 0.17+0.00004T where Cv is Specific heat at constant volume and T is the temperature in K\n",
      "r = 14.\t\t\t\t\t#Compression ratio\n",
      "p1 = 1.\t\t\t\t\t#Pressure at the beginning of compression in kg/cm**2\n",
      "T1 = 153.+273\t\t\t\t\t#Temperature at the beginning of compression in K\n",
      "CV = 10000.\t\t\t\t\t#Heating value of fuel in kcal/kg\n",
      "n = 1.35\t\t\t\t\t#Adiabatic constant\n",
      "R = 29.\t\t\t\t\t#Characteristic gas constant in mkg/kg.K\n",
      "J = 427.\t\t\t\t\t#Mechanical equivalent of heat in kg.m/kcal\n",
      "\n",
      "\t\t\t\t\t\n",
      "#Calculations\n",
      "T2 = (T1*r**(n-1))\t\t\t\t\t#Temperature at the end of compression in K\n",
      "a = (cv[1]/2)\t\t\t\t\t#For solving T3\n",
      "b = cv[0]+(R/J)\t\t\t\t\t#For solving T3\n",
      "c = (-T2*cv[0])-((cv[1]/2)*T2**2)-((R/J)*T2)-(CV/(af+1))\t\t\t\t\t#Foe solving T3\n",
      "T3 = (-b+math.sqrt(b**2-(4*a*c)))/(2*a)\t\t\t\t\t#Soving for T3 in K\n",
      "pc = (((T3/T2)-1)/(r-1))*100\t\t\t\t\t#Percentage cut off\n",
      "\n",
      "\t\t\t\t\t\n",
      "#Output\n",
      "print 'The percentage of stroke at which the constant pressure combustion stops is %i percent'%(pc)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The percentage of stroke at which the constant pressure combustion stops is 9 percent\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.5  Page no :  113"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\t\t\n",
      "#Input data\n",
      "af = 25.\t\t\t\t\t#Air fuel ratio\n",
      "CV = 10000.\t\t\t\t\t#Calorific value in kcal/kg\n",
      "cv = [0.17,0.00004]\t\t\t\t\t#Cv = 0.17+0.00004T where Cv is Specific heat at constant volume and T is the temperature in K\n",
      "r = 14.\t\t\t\t\t#Compression ratio\n",
      "T2 = 800.+273\t\t\t\t\t#Temperature at the end of compression in K\n",
      "R = 29.\t\t\t\t\t#Characteristic gas constant in mkg/kg/degree C\n",
      "J = 427.\t\t\t\t\t#Mechanical equivalent of heat in kg.m/kcal\n",
      "\n",
      "\t\t\t\t\t\n",
      "#Calculations\n",
      "CVm = (CV/(af+1))\t\t\t\t\t#Calorific value of mixture in kcal/kg\n",
      "cpv = (R/J)\t\t\t\t\t#Difference in mean specific heats in kcal/kg mol.K\n",
      "a = (cv[1]/2)\t\t\t\t\t#For solving T3\n",
      "b = cpv+cv[0]\t\t\t\t\t#For solving T3\n",
      "c = (-T2*(cpv+cv[0]))-((cv[1]/2)*T2**2)-CVm\t\t\t\t\t#Foe solving T3\n",
      "T3 = (-b+math.sqrt(b**2-(4*a*c)))/(2*a)\t\t\t\t\t#Soving for T3 in K\n",
      "s = ((T3/T2)/(r-1))*100\t\t\t\t\t#Percentage of the stroke\n",
      "\n",
      "\t\t\t\t\t\n",
      "#Output\n",
      "print 'The percentage of the stroke at which the combustion will be complete is %3.2f percent'%(s)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The percentage of the stroke at which the combustion will be complete is 16.70 percent\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.6  Page no :  115"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from scipy.integrate import quad\n",
      "\t\t\t\t\t\n",
      "#Input data\n",
      "T = [500,2000]\t\t\t\t\t#Change in temperature in K\n",
      "x = [11.515,-172,1530]\t\t\t\t\t#Cp = 11.515-172/math.sqrt(T)+1530/T in kcal/kg mole.K\n",
      "mO2 = 32\t\t\t\t\t#Molecular weight of oxygen\n",
      "\n",
      "\t\t\t\t\t\n",
      "#Calculations\n",
      "\n",
      "def f(T):\n",
      "\treturn (x[0]+(x[1]/math.sqrt(T))+(x[2]/T))\n",
      "\t\n",
      "I = -quad(f,T[1],T[0])[0]\t\t\t\t\t#Integration\n",
      "dh = (I/mO2)\t\t\t\t\t#Change in enthalpy in kcal/kg\n",
      "\n",
      "\t\t\t\t\t\n",
      "#Output\n",
      "print 'The change in enthalpy is %3.1f kcal/kg'%(dh)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The change in enthalpy is 365.7 kcal/kg\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.7  Page no :  117"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\t\t\n",
      "#Input data\n",
      "r = 14.\t\t\t\t\t#Compression ratio\n",
      "s = 5.\t\t\t\t\t#Fuel injection stops at 5% stroke after inner head centre\n",
      "pm = 50.\t\t\t\t\t#Maximum pressure in kg/cm**2\n",
      "p4 = 1.\t\t\t\t\t#Pressure at the end of suction stroke in kg/cm**2\n",
      "T4 = 90.+273\t\t\t\t\t#Temperature at the end of suction stroke in K\n",
      "R = 29.3\t\t\t\t\t#Characteristic gas constant in mkg/kg/degree C\n",
      "cv = [0.171,0.00003]\t\t\t\t\t#Cv = 0.171+0.00003T where Cv is Specific heat at constant volume and T is the temperature in K\n",
      "J = 427.\t\t\t\t\t#Mechanical equivalent of heat in kg.m/kcal\n",
      "\n",
      "\t\t\t\t\t\n",
      "#Calculations\n",
      "a = (R/J)+cv[0]\t\t\t\t\t#a value in kcal/kg.mole.K\n",
      "g = (a+cv[1]*T4)/(cv[0]+cv[1]*T4)\t\t\t\t\t#Adiabatic index of compression\n",
      "z = 1.3\t\t\t\t\t#Rounding off 'z' value to one decimal.\n",
      "T5 = (T4*r**(z-1))\t\t\t\t\t#Temperature in K\n",
      "p5 = (p4*r**g)\t\t\t\t\t#Pressure in kg/cm**2\n",
      "T1 = T5*(pm/p5)\t\t\t\t\t#Tmperature in K\n",
      "T2 = (T1*(1+(s/100)*(r-1)))\t\t\t\t\t#Temperature in K\n",
      "T3 = (T2*((1+(s/100)*(r-1))/r)**(g-1))\t\t\t\t\t#Temperature in K\n",
      "p3 = (p4*(T3/T4))\t\t\t\t\t#Pressure in kg/cm**2\n",
      "def f1(T):\n",
      "\treturn  cv[0]+(cv[1]*T)\n",
      "I1 = quad(f1,T5,T1)[0]\n",
      "\n",
      "def f2(T):\n",
      "\treturn (a+(cv[1]*T))\n",
      "\t\n",
      "I2 = quad(f2,T1,T2)[0]\t\t\t\t\t#I2 answer is given wrong in the textbook\n",
      "qs = (I1+I2)\t\t\t\t\t#Heat supplied per kg of air in kcal/kg\n",
      "\n",
      "def f3(T):\n",
      "\treturn  a+(cv[1]*T)\n",
      "\t\n",
      "qre = quad(f3,T4,T3)[0]\t\t\t\t\t#Heat required per kg of air in kcal/kg\n",
      "\n",
      "nth = ((qs-qre)/qs)*100\t\t\t\t\t#Thermal efficiency in percent\n",
      "\n",
      "\t\t\t\t\t\n",
      "#Output\n",
      "print 'The tempertautes and pressures at salient points of the cycle are :  T1  =  %3.0f K  \\\n",
      "\\np1  =  %3.1f kg/cm**2  \\\n",
      "\\nT2  =  %3.0f K  \\\n",
      "\\np2  =  %3.1f kg/cm**2  \\\n",
      "\\nT3  =  %3.0f K  \\\n",
      "\\np3  =  %3.1f kg/cm**2  \\\n",
      "\\nT4  =  %3.0f K  \\\n",
      "\\np4  =  %3.1f kg/cm**2  \\\n",
      "\\nT5  =  %3.0f K  \\\n",
      "\\np5  =  %3.1f kg/cm**2  \\\n",
      "\\nHeat supplied per kg of air is %3.1f kcal/kg  \\\n",
      "\\nThe thermal efficiency of the cycle is %3.1f percent'%(T1,pm,T2,pm,T3,p3,T4,p4,T5,p5,qs,nth)\n",
      "\n",
      "#Textbook answers are given wrong\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The tempertautes and pressures at salient points of the cycle are :  T1  =  1057 K  \n",
        "p1  =  50.0 kg/cm**2  \n",
        "T2  =  1745 K  \n",
        "p2  =  50.0 kg/cm**2  \n",
        "T3  =  779 K  \n",
        "p3  =  2.1 kg/cm**2  \n",
        "T4  =  363 K  \n",
        "p4  =  1.0 kg/cm**2  \n",
        "T5  =  801 K  \n",
        "p5  =  37.9 kg/cm**2  \n",
        "Heat supplied per kg of air is 244.5 kcal/kg  \n",
        "The thermal efficiency of the cycle is 56.4 percent\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.8  Page no :  119"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "from scipy.integrate import quad\n",
      "\t\t\t\t\t\n",
      "#Input data\n",
      "r = 14.\t\t\t\t\t#Compression ratio\n",
      "c = 5.\t\t\t\t\t#Cut off takes place at 5% of the stroke\n",
      "p1 = 1.\t\t\t\t\t#Pressure at the beginning of compression in kg/cm**2. In texbook, it is given wrong as 10\n",
      "T1 = 90.+273\t\t\t\t\t#Temperature at the beginning of compression in K\n",
      "p3 = 50.\t\t\t\t\t#Maximum pressure in kg/cm**2\n",
      "R = 29.3\t\t\t\t\t#Characteristic gas constant in mkg/kg/degree C\n",
      "cv = [0.171,0.00003]\t\t\t\t\t#Cv = 0.171+0.00003T where Cv is Specific heat at constant volume and T is the temperature in K\n",
      "g1 = 1.4\t\t\t\t\t#Ratio of specific heats\n",
      "J = 427.\t\t\t\t\t#Mechanical equivalent of heat in kg.m/kcal\n",
      "\n",
      "\t\t\t\t\t\n",
      "#Calculations\n",
      "T2x = (T1*r**(g1-1))\t\t\t\t\t#Temperature in K\n",
      "def  f1(T):\n",
      "\treturn  cv[0]+(cv[1]*T)\n",
      "\n",
      "I1 = quad(f1,T1,T2x)[0]\n",
      "\n",
      "Cv = (1/(T2x-T1))*I1\t\t\t\t\t#Mean value of Cv in kJ/kg.K\n",
      "Cp = (Cv+(R/J))\t\t\t\t\t#Mean value of Cp in kJ/kg.K\n",
      "g = 1.35\t\t\t\t\t#(Cp/Cv) value and rounded off to 2 decimal places for calculation purpose. Ratio of specific heats\n",
      "T2 = (T1*r**(g-1))\t\t\t\t\t#Temperature in K\n",
      "I2 = quad(f1,T1,T2)[0]\n",
      "CV = (1/(T2-T1))*I2\t\t\t\t\t#Maen value of Cv in kJ/kg.K\n",
      "CP = (Cv+(R/J))\t\t\t\t\t#Mean value of Cp in kJ/kg.K\n",
      "g2 = 1.36\t\t\t\t\t#(Cp/Cv) value and rounded off to 2 decimal places for calculation purpose.Ratio of specific heats\n",
      "T2a = (T1*r**(g2-1))\t\t\t\t\t#Temperature in K\n",
      "p2 = (p1*r*(T2a/T1))\t\t\t\t\t#Pressure in kg/cm**2\n",
      "T3 = (T2a*(p3/p2))\t\t\t\t\t#Temperature in K\n",
      "T4 = (((r-1)*(c/100))+1)*T3\t\t\t\t\t#Temperature in K\n",
      "g3 = 1.3\t\t\t\t\t#Assuming gamma as 1.3 for process 4-5\n",
      "T5 = (T4/(r/(((r-1)*(c/100))+1))**(g3-1))\t\t\t\t\t#Temperature in K\n",
      "cV = cv[0]+(cv[1]/2)*(T5+T4)\t\t\t\t\t#Mean value of Cv in kJ/kg.K\n",
      "cP = cV+(R/J)\t\t\t\t\t#Mean value of Cp in kJ/kg.K\n",
      "g4 = (cP/cV)\t\t\t\t\t#Ratio of specific heats\n",
      "T5a = (T4/(r/(((r-1)*(c/100))+1))**(g4-1))\n",
      "I3 = quad(f1,T2a,T3)[0]\n",
      "\n",
      "def f2(T):\n",
      "\treturn cv[0]+(R/J)+(cv[1]*T)\n",
      "I4 = quad(f2,T3,T4)[0]\t\t\t\t\t#Textbook answer is wrong\n",
      "q = I3+I4\t\t\t\t\t#Heat supplied per kg of working substance in kcal/kg\n",
      "\n",
      "\t\t\t\t\t\n",
      "#Output\n",
      "print 'a) Temperatures at all the points of the cycle are:  \\\n",
      "\\nT1  =  %i K  T2  =  %3.0f K  T3  =  %3.0f K  T4  =  %3.0f K  T5  =  %i K  \\\n",
      "\\nb) heat supplied per kg of the working substance is %3.1f kcal/kg'%(T1,T2a,T3,T4,T5a,q)\n",
      "\t\t\t\t\t#Textbook answer is wrong\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "a) Temperatures at all the points of the cycle are:  \n",
        "T1  =  363 K  T2  =  939 K  T3  =  1296 K  T4  =  2139 K  T5  =  1097 K  \n",
        "b) heat supplied per kg of the working substance is 318.5 kcal/kg\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.10  Page no :  119"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\t\t\t\t\t\n",
      "#Input data\n",
      "r = 20.\t\t\t\t\t#Compression ratio\n",
      "c = 5.\t\t\t\t\t#Cut off at 5%\n",
      "dc = 1.\t\t\t\t\t#Specific heat at constant volume increases by 1%\n",
      "Cv = 0.171\t\t\t\t\t#pecific heat at constant volume in kJ/kg.K\n",
      "R = 29.3\t\t\t\t\t#Characteristic gas constant in mkg/kg/degree C\n",
      "k = 1.95\t\t\t\t\t#k can be obtained from relation de/e = -dcv/cv*(1-e/e)*(g-1)*((1/g)+ln(r)-(k**g*lnk)/(k**g-1))\n",
      "J = 427.\t\t\t\t\t#Mechanical equivalent of heat in kg.m/kcal\n",
      "\n",
      "\t\t\t\t\t\n",
      "#Calculations\n",
      "g = (R/(J*Cv))+1\t\t\t\t\t#Ratio of specific heats\n",
      "e = (1-((1/g)*(1/r**(g-1))*((k**g-1)/(k-1))))\t\t\t\t\t#Air standard efficiency of the cycle\n",
      "dee = ((-(dc/100)*((1-e)/e)*(g-1)*((1/g)+math.log(r)-((k**g*math.log(k))/(k**g-1))))*100)\t\t\t\t\t#Change in efficiency due to 1% change in cv\n",
      "\n",
      "\t\t\t\t\t\n",
      "#Output\n",
      "print 'Percentage change in air standard efficiency is %3.3f percent This indicates that there is a decrease in efficiency'%(dee)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Percentage change in air standard efficiency is -0.564 percent This indicates that there is a decrease in efficiency\n"
       ]
      }
     ],
     "prompt_number": 8
    }
   ],
   "metadata": {}
  }
 ]
}