summaryrefslogtreecommitdiff
path: root/Fundamental_of_internal_combustion_engines/chap4.ipynb
blob: c8818341ccc67210339c78f232f79a47640cda46 (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
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 4:Fuel Air Cycles and their analysis"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.1 Page No 117"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "r=8.5                                #The compression ratio \n",
      "sv=1.4                               #The specific heat at constant volume in percent\n",
      "\n",
      "#Calculations\n",
      "import math\n",
      "n=1-(1/r)**(sv-1) \n",
      "ef=(((1-n)/n)*(sv-1)*(math.log(r))*(sv/100.0))*100\n",
      "\n",
      "#Output\n",
      "print\"The efficiency decreases by \",round(ef,3),\"percent\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The efficiency decreases by  0.885 percent\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.2 Page No 118"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "r=18.0                                      #The compression ratio \n",
      "l=6.0                                       #The cut off taking place corresponding of the stroke in percent\n",
      "sc=2.0                                      #The specific heat at constant volume increases in percent\n",
      "cv=0.717                                  #The specific heat at constant volume in kJ/kgK\n",
      "R=0.287                                   #Gas constant in kJ/kgK\n",
      "\n",
      "#Calculations\n",
      "import math\n",
      "Vs=(r-1)\n",
      "B=((l/100.0)*Vs)+1\n",
      "cp=cv+R\n",
      "R1=cp/cv\n",
      "n=1-(((((1/r)**(R1-1))*(B**R1-1))/(R1*(B-1)))) \n",
      "dn=(((1-n)/n)*((R1-1)*((math.log(r))-(((B**R1)*math.log(B))/(B**R1-1))+(1/B)))*(sc/100.0))*100\n",
      "\n",
      "#Output\n",
      "print\"The efficiency decreases by \",round(dn,1),\"percent\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The efficiency decreases by  1.1 percent\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.3 Page No 120"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "r=8                                    #The compression ratio\n",
      "af=15                                  #Air/fuel ratio\n",
      "p1=1                                   #The pressure at the beginning of a compression stroke in bar\n",
      "t=60                                   #The temperature at the beginning of a compression stroke in degree centigrade\n",
      "cv=44000                               #The calorific value of the fuel in kJ/kg\n",
      "n=1.32                                 #The index of the compression \n",
      "Cv=0.717                               #specific heat at constant volume in kJ/kgK\n",
      "\n",
      "#Calculations\n",
      "T1=t+273\n",
      "p2=p1*(r)**n\n",
      "T2=T1*r**(n-1)\n",
      "f=(1/(af+1))\n",
      "a=(af/(af+1))\n",
      "q23=cv/(af+1)\n",
      "T3=((-10430+((10430)**2+(4*494.8*10**5))**(1/2.0))/2.0)\n",
      "p3=(T3/T1)*(r)*p1\n",
      "T31=(q23/Cv)+T2\n",
      "p31=(T31/T1)*r*p1\n",
      "\n",
      "#Output\n",
      "print\"(a) The Maximum temperature in the cylinder  = \",round(T3,0),\"K\" \n",
      "print\"The Maximum pressure in the cylinder P3 = \",round(p3,0),\"bar\" \n",
      "print\"(b)With constant value of Cv \"\n",
      "print\"The Maximum temperature in the cylinder  = \",round(T31,0),\"K\" \n",
      "print\"The Maximum pressure in the cylinder P3 = \",round(p31,1),\"bar\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) The Maximum temperature in the cylinder  =  3541.0 K\n",
        "The Maximum pressure in the cylinder P3 =  85.0 bar\n",
        "(b)With constant value of Cv \n",
        "The Maximum temperature in the cylinder  =  4483.0 K\n",
        "The Maximum pressure in the cylinder P3 =  107.7 bar\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.4 Page No 121"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "r=21                                     #The compression ratio \n",
      "af=29                                    #Air/fuel ratio\n",
      "T=1000                                   #The temperature at the end of compression in K\n",
      "cv=42000                                 #The calorific value of the in kJ/kg\n",
      "R=0.287                                  #Gas constant in kJ/kgK\n",
      "\n",
      "#Calculations \n",
      "q23=cv/(af+1)\n",
      "T3=(-0.997+(((0.997)**2)+(4*2411*14*10**-6))**(1/2.0))/(28.0*10.0**-6)\n",
      "V3=(T3/T)\n",
      "Vs=(r-1)\n",
      "V=V3-1\n",
      "pc=(V/Vs)*100\n",
      "\n",
      "#Output\n",
      "print\"The percentage of stroke at which combustion is complete = \",round(pc,3),\"percent\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The percentage of stroke at which combustion is complete =  6.706 percent\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5 Page No 122"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "r=16.0                                         #The compression ratio \n",
      "l=6.0                                          #The cut-off of the stroke in percent\n",
      "p3=70.0                                        #The maximum pressure obtained in bar\n",
      "p1=1.0                                         #The pressure at the beginning of compression in bar\n",
      "T1=(100.0+273.0)                                 #The temperature at the beginning of compression in K\n",
      "R=0.287                                      #Gas constant in kJ/kgK\n",
      "g=1.4                                        #Assume the isentropic index \n",
      "\n",
      "#Calculations\n",
      "T2=T1*(r)**(g-1)\n",
      "Cv=(1/(T2-T1))*(0.716+125*10**-6*(T2**2-T1**2))\n",
      "Cp=Cv+R\n",
      "g1=Cp/Cv\n",
      "T21=T1*(r)**(g1-1)\n",
      "Cv1=(1/(T21-T1))*((0.716+125*10**-6*(T21**2-T1**2)))\n",
      "Cp1=Cv1+R\n",
      "g2=Cp1/Cv1\n",
      "gm=1.358                       #mean value\n",
      "T22=T1*(r)**(gm-1)\n",
      "p2=(T22/T1)*r*p1\n",
      "T3=(p3/p2)*T22\n",
      "V=((l/100.0)*(r-1))+1\n",
      "T4=(V)*T3\n",
      "p4=p3\n",
      "g3=1.3\n",
      "V5=r/V\n",
      "T5=T4*(1/V5)**(g3-1)\n",
      "Cv2=((0.716*(T5-T4))+(62.5*10**-6*(T5**2-T4**2)))/(T5-T4)\n",
      "Cp2=Cv2+R\n",
      "g4=Cp2/Cv2\n",
      "T51=T4*(1/V5)**(g4-1)\n",
      "Cv3=((0.716*(T51-T4))+(62.5*10**-6*(T51**2-T4**2)))/(T51-T4)\n",
      "Cp3=Cv3+R\n",
      "g5=Cp3/Cv3\n",
      "T52=T4*(1/V5)**(g5-1)\n",
      "p5=(T52/T1)*p1\n",
      "\n",
      "#Output\n",
      "print\"The pressure and temperature at all points of the cycle \\nat point 2: Temperature T2 = \",round(T22,0),\"K and Pressure P2 = \",round(p2,2),\" bar\"  \n",
      "print\"at point 3 :Temperature T3 = \",round(T3,1),\" K  and Pressure P3 = \",p3,\" bar\" \n",
      "print\"at point 4 : Temperature T4 = \",T4,\" K    and Pressure P4 = \",p4,\"bar\" \n",
      "print\"at point 5 :Temperature T5 = \",round(T52,0),\" K  and Pressure P5 = \",round(p5,2),\"bar\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The pressure and temperature at all points of the cycle \n",
        "at point 2: Temperature T2 =  1006.0 K and Pressure P2 =  43.17  bar\n",
        "at point 3 :Temperature T3 =  1631.9  K  and Pressure P3 =  70.0  bar\n",
        "at point 4 : Temperature T4 =  3100.5625  K    and Pressure P4 =  70.0 bar\n",
        "at point 5 :Temperature T5 =  1698.0  K  and Pressure P5 =  4.55 bar\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.6 Page No 125"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "r=8                                                #Compression ratio\n",
      "lcv=44000                                          #The lower heating value of the fuel in kJ/kg\n",
      "af=15                                              #The air/fuel ratio\n",
      "Cv=0.71                                            #The specific heat at constant volume in kJ/kgK\n",
      "p=1                                                #The pressure at the beginning of the compression in bar\n",
      "t=60                                               #The temperature at the beginning of the compression in degree centigrade\n",
      "Mo=32                                              #Molecular weight of oxygen\n",
      "Mn=28.161                                          #Molecular weight of nitrogen\n",
      "Mh=18                                              #Molecular weight of water \n",
      "n=1.3                                              #Polytrpic index\n",
      "\n",
      "#Calculations\n",
      "T1=(t+273)\n",
      "sa=(12.5*(Mo+(3.76*Mn)))/((12*8)+(1*Mh))\n",
      "Y=af*(((12*8)+(1*Mh))/(Mo+(3.76*Mn)))\n",
      "x=(12.5-Y)*2\n",
      "nb=1+Y+(Y*3.76)\n",
      "na=x+7.8+9+46.624 \n",
      "Me=((na-nb)/nb)*100\n",
      "T2=T1*(r)**(n-1)\n",
      "T3=(lcv/(af+1))*(1/Cv)+(T2)\n",
      "p3=r*(T3/T1)*p\n",
      "p31=p3*(na/nb)\n",
      "\n",
      "#Output\n",
      "print\"The percentage molecular expansion is \",round(Me,0),\"percent\"\n",
      "print\"(a) Without considering the molecular expansion \"\n",
      "print\" The maximum temperature is \",round(T3,0),\"K\" \n",
      "print\"The maximum pressure is \",round(p3,0),\"bar\"\n",
      "print\"(b) With molecular expansion \" \n",
      "print\"The maximum temperature is \",round(T3,0),\"K\" \n",
      "print\"The maximum pressure is \",round(p31,1),\"bar\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The percentage molecular expansion is  6.0 percent\n",
        "(a) Without considering the molecular expansion \n",
        " The maximum temperature is  4495.0 K\n",
        "The maximum pressure is  108.0 bar\n",
        "(b) With molecular expansion \n",
        "The maximum temperature is  4495.0 K\n",
        "The maximum pressure is  114.4 bar\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.7 Page No 128"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "f=0.03                          #The residual fraction of an engine\n",
      "e=1.2                           #The equivalence ratio\n",
      "F=0.0795                        #Fuel/air ratio for corresponding equivalence ratio \n",
      "\n",
      "#Calculations\n",
      "\n",
      "T=1+F\n",
      "fa=1-f\n",
      "ff=F*(fa)\n",
      "ra=f\n",
      "rf=ra*F\n",
      "\n",
      "#Output\n",
      "print\"Fresh air = \",fa,\"kg\" \n",
      "print\"Fresh fuel = \",ff,\"kg\" \n",
      "print\"Air in residual = \",ra,\"kg\" \n",
      "print\"Fuel in residual = \",rf,\"kg\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Fresh air =  0.97 kg\n",
        "Fresh fuel =  0.077115 kg\n",
        "Air in residual =  0.03 kg\n",
        "Fuel in residual =  0.002385 kg\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.8 Page No 128"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "T=800                          #The given temperature in K\n",
      "e=1                            #The equivalence ratio \n",
      "hi=154.723                     #Sensible Enthalpy for isooctane at 800 K in MJ/kmol \n",
      "ho=15.841                      #Sensible Enthalpy for oxygen at 800 K in MJ/kmol \n",
      "hn=15.046                      #Sensible Enthalpy for nitrogen at 800 K in MJ/kmol\n",
      "nc=0.00058                     #Number of kmoles of C8H18 for equivalence ratio for 1 kg of air \n",
      "no=0.00725                     #Number of kmoles of oxygen for equivalence ratio for 1 kg of air \n",
      "nn=0.0273                      #Number of kmoles of nitrogen for equivalence ratio for 1 kg of air \n",
      "R=8.314                        #Gas constant in kJ/kgK\n",
      "\n",
      "#Calculations\n",
      "\n",
      "Hs=(nc*hi)+(no*ho)+(nn*hn)\n",
      "Hs1=Hs*1000\n",
      "n=nc+no+nn\n",
      "Us=Hs-(n*R*10**-3*(T-298))\n",
      "Us1=Us*1000\n",
      "\n",
      "#Output\n",
      "print\"Total sensible enthalpy of reactants = \",round(Hs1,3),\"kJ/kg air\" \n",
      "print\"Sensible internal energy of reactants = \",round(Us1,3),\"kJ/kg air\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total sensible enthalpy of reactants =  615.342 kJ/kg air\n",
        "Sensible internal energy of reactants =  468.723 kJ/kg air\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.9 Page No 131"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "T=500.0                                 #The given temperature in K\n",
      "e=1.0                                   #Equivalence ratio \n",
      "Ai=0.0662                             #The amount of isooctane for 1 kg of air in kg\n",
      "Ta=298.0                                #Consider the ambient temperature in K \n",
      "R=8.314                               #Gas constant in kJ/kgK\n",
      "\n",
      "#Calculations\n",
      "import math\n",
      "E=((0.0662*((0.44*math.log(T/Ta))+(3.67*10**-3*(T-Ta))))+((0.921*math.log(T/Ta))+(2.31*10**-4*(T-Ta))))*1000\n",
      "Ri=Ri/114.0\n",
      "W=(0.5874-(0.662*Ri*math.log(T/Ta))-(0.287*math.log(T/Ta)))*1000\n",
      "\n",
      "#Output\n",
      "print\"The isentropic compression functions at 500 K for the unburned\" \n",
      "print\"isooctsne-air mixture are \",round(E,1),\"J/kg air and\",round(W,1),\"J/kg air\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The isentropic compression functions at 500 K for the unburned\n",
        "isooctsne-air mixture are  587.4 J/kg air and 438.9 J/kg air\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.10 Page No 133"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "r=7.8                               #Compression ratio \n",
      "p=1.0                               #The pressure at the start of compression in atm\n",
      "T1=335.0                              #The temperature at the start of compression in K\n",
      "W1=100                              #Isentropic compression function for T1 in J/kg air K \n",
      "T2=645                              #The temperature corresponding to isentropic compression function in J/kg air K \n",
      "U1=35                               #Internal energy corresponding to temp T1 in kJ/kg air \n",
      "U2=310                              #Internal energy corresponding to temp T2 in kJ/kg air \n",
      "E1=120                              #Isentropic compression function at T1 \n",
      "E2=910                              #Isentropic compression function at T2 \n",
      "\n",
      "#Calculations\n",
      "import math\n",
      "W2=W1-(292*math.log(1/r))\n",
      "V1=(292*T1)/(p*10.0**5)\n",
      "p2=p*(T2/T1)*r\n",
      "V2=V1/r\n",
      "W=U2-U1\n",
      "p21=(math.exp((E2-E1)/292.0)) \n",
      "\n",
      "#Output\n",
      "print\"(a)At the end of the compression stroke\"\n",
      "print\"The temperature is \",T2,\"K\" \n",
      "print\"The pressure is \",round(p2,0),\"atm\" \n",
      "print\"The volume per unit mass of air is \",round(V2,3),\"m**3/kg air\"\n",
      "print\"The pressure is \",round(p21,0),\"atm\" \n",
      "print\"(b)The work input during compression is \",W,\"kJ/kg air\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)At the end of the compression stroke\n",
        "The temperature is  645 K\n",
        "The pressure is  15.0 atm\n",
        "The volume per unit mass of air is  0.125 m**3/kg air\n",
        "The pressure is  15.0 atm\n",
        "(b)The work input during compression is  275 kJ/kg air\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.11 Page No 134"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "p=65                      #The pressure in the cylinder in bar\n",
      "r=10                      #The compression ratio \n",
      "V3=0.1                    #The volume per unit mass of air at the start of expansion in m**3/kg air \n",
      "p3=p*100                  #The pressure in the cylinder after the completion of combustion in kN/m**2\n",
      "T3=2240                   #The temperature from the chart corresponding to p3,V3 in K\n",
      "u3=-1040                  #The energy from the chart in kJ/kg air \n",
      "s3=8.87                   #The entropy from the chart in kJ/kg air K\n",
      "T4=1280                   #The temperature from the chart corresponding to p4,V4 in K \n",
      "u4=-2220                  #The energy from the chart in kJ/kg air \n",
      "p4=4.25                   #The pressure from the chart in bar \n",
      "\n",
      "#Calculations \n",
      "s4=s3\n",
      "V4=r*V3\n",
      "W=-(u4-u3)\n",
      "\n",
      "#Output\n",
      "print\"(a)At the end of expansion stroke\"\n",
      "print\"The pressure is \",p4,\"bar\" \n",
      "print\"The temperature is \",T4,\"K\" \n",
      "print\"The volume is \",V4,\"m**3/kg air\" \n",
      "print\"(b)The work during the expansion stroke is \",W,\"kJ/kg air\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)At the end of expansion stroke\n",
        "The pressure is  4.25 bar\n",
        "The temperature is  1280 K\n",
        "The volume is  1.0 m**3/kg air\n",
        "(b)The work during the expansion stroke is  1180 kJ/kg air\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.12 Page no 137"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Given\n",
      "#From Table 4.4\n",
      "H1=-224.1*1000     #MJ/mol, Enthalpy of C8H18\n",
      "H2=-393.52*1000    #Enthalpy of CO2\n",
      "H3=-241.82*1000    #Enthalpy of H2O\n",
      "U1=-204.1*1000     #MJ/mol, Internal energyof C8H18\n",
      "U2=-393.52*1000    #Internal energy of CO2\n",
      "U3=-240.6*1000    #Internal energy of H2O\n",
      "\n",
      "\n",
      "M1=114.0       #g, molecular wt of C8H18\n",
      "M2=32.0       #g, molecular wt of O2\n",
      "M3=28.0       #g, molecular wt of N2\n",
      "M4=44.0       #g, molecular wt of CO2\n",
      "M5=18.0       #g, molecular wt of H2O\n",
      "#For 1 kg air, from the eq.,  the fraction of wt are\n",
      "x1=0.0661    \n",
      "x2=0.232\n",
      "x3=0.768\n",
      "x4=0.204\n",
      "x5=0.094\n",
      "\n",
      "#Calculation\n",
      "import sympy\n",
      "f=sympy.Symbol(\"f\")\n",
      "n1=(x1/M1)*(1-f)        #No. of kmoles of C8H18\n",
      "n2=x2/M2*(1-f)\n",
      "n3=x3/M3\n",
      "n4=x4/M4*f\n",
      "n5=x5/M5*f\n",
      "N1=(n1*H1+n4*H2+n5*H3)\n",
      "N2=n1*U1+n4*U2+n5*U3\n",
      "\n",
      "#Result\n",
      "print \"Standard Enthalpy of formation is\",N1\n",
      "print \"Internal energy of formation is\",N2\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Standard Enthalpy of formation is -2957.40091174907*f - 129.938684210526\n",
        "Internal energy of formation is -2962.62629186603*f - 118.342192982456\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.13 Page No 138"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "Tu=645.0                                #The temperature at the end of compression process in K\n",
      "usu=310.0                               #The internal energy at the end of compression process in kJ/kg air \n",
      "pu=(15.4*1.013)                       #The pressure at the end of the compression process in bar \n",
      "Vu=0.124                              #The volume at the end of the compression process in m**3/kg air \n",
      "e=1.0                                   #Equivalence ratio \n",
      "f=0.065                               #Burned gas fraction \n",
      "Tb=2820.0                               #The temperature for constant volume \n",
      "pb=6500.0                               #The pressure for constant volume \n",
      "hsu=440.0                               #The enthalpy from chart corresponding to temp Tu in kJ/kg air \n",
      "pb1=1560.0                              #The pressure for constant pressure adiabatic combustion in kN/m**2 \n",
      "ub1=-700.0                              #Trail and error along the pb internal energy in kJ/kg air\n",
      "Tb1=2420.0                              #The temperature for constant pressure \n",
      "\n",
      "#Calculations \n",
      "ufu=-118.5-(2963*f)\n",
      "ub=usu-ufu\n",
      "Vb=Vu\n",
      "hfu=-129.9-(2958*f)\n",
      "hb=hsu+hfu\n",
      "vb1=(118-ub1)/pb\n",
      "\n",
      "#Output\n",
      "print\"(a)For constant volume adiabatic combustion\"\n",
      "print\"The temperature is \",Tb,\"K\" \n",
      "print\"The pressure is \",pb,\"kN/m**2\"\n",
      "print\"(b)For constant pressure adiabatic combustion\"\n",
      "print\"The temperature is \",Tb1,\"K\" \n",
      "print\"The pressure is \",pb1,\"kN/m**2\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)For constant volume adiabatic combustion\n",
        "The temperature is  2820.0 K\n",
        "The pressure is  6500.0 kN/m**2\n",
        "(b)For constant pressure adiabatic combustion\n",
        "The temperature is  2420.0 K\n",
        "The pressure is  1560.0 kN/m**2\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.14 Page No 139"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "r=8.0                               #The compression ratio \n",
      "T1=350.0                            #The given temperature at the start of compression in K\n",
      "p=1.0                               #The given pressure at the start of compression in bar\n",
      "f=0.08                              #The exhaust residual fraction \n",
      "cv=44000                            #The calorific value in kJ/kg\n",
      "W1=150                              #Isentropic compression functions for corresponding temp T1 in J/kg air K\n",
      "T2=682                              #The temperature corresponding to isentropic compression function in K \n",
      "us2=350                             #The internal energy corresponding to temp T2 in K\n",
      "us1=40                              #The internal energy corresponding to temp T1 in K \n",
      "T3=2825                             #The temperature at point 3 corresponding to u3,V3 on the burned gas chart in K\n",
      "p3=7100                             #The pressure at point 3 in kN/m**2 \n",
      "s3=9.33                             #Entropy at point 3 in kJ/kg air K \n",
      "u4=-1540                            #The internal energy at point 4 corresponding to V4,s4 in kJ/kg air \n",
      "p4=570                              #The pressure at point 4 in kN/m**2 \n",
      "T4=1840                             #The temperature at point 4 in K \n",
      "\n",
      "#Calculations\n",
      "import math\n",
      "W2=W1-(292*math.log(1/r))\n",
      "V1=(292*T1)/(p*10.0**5)\n",
      "p2=p*(T2/T1)*r\n",
      "V2=V1/r\n",
      "Wc=us2-us1\n",
      "ufu=-118.5-(2963*f)\n",
      "u3=us2+ufu\n",
      "V3=V2\n",
      "s4=s3\n",
      "V4=V1\n",
      "We=u3-u4 \n",
      "Wn=We-Wc\n",
      "nth=((Wn)/((1-f)*0.0662*cv))*100\n",
      "imep=((Wn*1000)/(V1-V2))/10.0**5\n",
      "nv=(((1-f)*287*298)/(1.013*10**5*(1-0.125)))*100\n",
      "\n",
      "#Output\n",
      "print\"(a)At point 2, \\nThe temperature is \",T2,\" K \\nThe pressure is \",round(p2,1),\"atm\"\n",
      "print\"At point 3, \\nThe temperature is \",T3,\" K \\nThe pressure is \",p3,\"kN/m**2\" \n",
      "print\"At point 4, \\nThe temperature is \",T4,\" K \\nThe pressure is \",p4,\"kN/m**2\" \n",
      "print\"(b)The indicated thermal efficiency is \",round(nth,1),\"percent\" \n",
      "print\"(c)The indicated mean effective pressure is \",round(imep,0),\" bar\" \n",
      "print\"(d)The volumetric efficiency is \",round(nv,2), \"percent\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)At point 2, \n",
        "The temperature is  682  K \n",
        "The pressure is  15.6 atm\n",
        "At point 3, \n",
        "The temperature is  2825  K \n",
        "The pressure is  7100 kN/m**2\n",
        "At point 4, \n",
        "The temperature is  1840  K \n",
        "The pressure is  570 kN/m**2\n",
        "(b)The indicated thermal efficiency is  45.7 percent\n",
        "(c)The indicated mean effective pressure is  14.0  bar\n",
        "(d)The volumetric efficiency is  88.77 percent\n"
       ]
      }
     ],
     "prompt_number": 4
    }
   ],
   "metadata": {}
  }
 ]
}