summaryrefslogtreecommitdiff
path: root/Fundamental_of_internal_combustion_engines/chap3.ipynb
blob: a0a9064e30e488ef7ee3fb24d5f1dcbd5cafba30 (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
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 3:Reactive Sysyem"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.1 Page no 66"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "E=20.0                           #Methanol burned with excess air in percentage \n",
      "p=1.0                            #Pressure of air in bar\n",
      "t=27.0                           #Temperature of air in degree centigrade\n",
      "O=32.0                           #The molecular weight of oxygen\n",
      "N=28.0                           #The molecular weight of nitrogen\n",
      "R=8314.0                         #Universal gas constant in Nm/kmolK\n",
      "C=32.0                           #Molecular weight of methanol\n",
      "CO=44.0                          #Molecular weight of the carbondioxide \n",
      "H=18.0                           #Molecular weight of the water\n",
      "\n",
      "#Calculations\n",
      "S=((1.8*O)+(6.768*N))/C\n",
      "A=((1.8*O)+(6.768*N))/C\n",
      "M=1.8+6.768\n",
      "V=(M*R*(t+273))/(p*10**5)\n",
      "T=(1+1.8+6.768)\n",
      "Cm=(1/T)\n",
      "Om=(1.8/T)\n",
      "Nm=(6.768/T)\n",
      "Mr=(Cm*C)+(Om*O)+(Nm*N)\n",
      "Tp=(1+2+6.768+0.3)\n",
      "COm=(1/Tp)\n",
      "Hp=(2/Tp)\n",
      "Np=(6.768/Tp)\n",
      "Op=(0.3/Tp)\n",
      "Mp=(COm*CO)+(Hp*H)+(Np*N)+(Op*O)\n",
      "Pp=(Hp*p)\n",
      "D=60\n",
      "\n",
      "#Output\n",
      "print\"(a) The volume of air supplied per kmole of fuel = \",round(V,3),\"m**3/kmole fuel\"\n",
      "print\"(b) The molecular weight of the reactants = \",round(Mr,3)\n",
      "print\"The molecular weight of the products =\",round(Mp,3)\n",
      "print\"(c) The dew point of the products = \",D,\"degree centigrade\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) The volume of air supplied per kmole of fuel =  213.703 m**3/kmole fuel\n",
        "(b) The molecular weight of the reactants =  29.171\n",
        "The molecular weight of the products = 27.722\n",
        "(c) The dew point of the products =  60 degree centigrade\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.2 Page no 67"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "C1=40.0                               #The content of C7H16 in the fuel in percentage\n",
      "C2=60.0                               #The content of C8H18 in the fuel in percentage\n",
      "d=0.12                              #The diameter of the bore in m\n",
      "l=0.145                             #The length of the bore in m\n",
      "r=8.5                               #Compression ratio \n",
      "p=1.1                               #Pressure at exhaust stroke in bar\n",
      "T=720.0                               #The temperature at the exhaust stroke in K\n",
      "O=32.0                                #The molecular weight of oxygen\n",
      "N=28.0                                #The molecular weight of nitrogen\n",
      "C3=100.0                              #Molecular weight of C7H16\n",
      "C4=114.0                              #The molecular weight of C8H18\n",
      "R=8314.0                              #Universal gas constant in Nm/kmolK\n",
      "CO2=44.0                              #Molecular weight of the carbondioxide \n",
      "C5=28.0                               #Molecular weight of the carbonmonoxide\n",
      "H=18.0                                #Molecular weight of the water\n",
      "\n",
      "#Calculations\n",
      "import math\n",
      "N2=100-(12+1.5+2.5)\n",
      "Y=84/3.76\n",
      "X=13.5/7.6\n",
      "Z=(22.34-15.25)*2\n",
      "Hl=(6.4+10.8)/2.0\n",
      "Hr=7.98\n",
      "Hd=Hl-Hr\n",
      "A=((12.58*(O+(3.76*N)))/(((C1/100.0)*C3)+((C2/100.0)*C4)))\n",
      "Vs=(math.pi/4.0)*d**2*l\n",
      "Vc=Vs/(r-1)\n",
      "M=((6.757*CO2)+(0.8446*C5)+(1.408*O)+(47.3*N)+(8.6*H))/(6.757+0.8446+1.408+47.3+8.6)\n",
      "R1=R/M\n",
      "m=((p*10**5)*Vc)/(R1*T)\n",
      "\n",
      "#Output \n",
      "print\"(a)The air/fuel ratio = \",round(A,2)\n",
      "print\"(b)The mass of the exhaust gases in the clearance space = \",round(m*1000,3),\"*10**-3kg\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The air/fuel ratio =  15.93\n",
        "(b)The mass of the exhaust gases in the clearance space =  0.114 *10**-3kg\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.3 Page no 69"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "C=0.86                        #The amount of carbon content in the 1kg of fuel by weight in kg\n",
      "H=0.05                        #The amount of hydrogen content in the 1kg of fuel by weight in kg\n",
      "O=0.02                        #The amount of oxygen content in the 1kg of fuel by weight in kg\n",
      "S=0.005                       #The amount of sulphur content in the 1kg of fuel by weight in kg\n",
      "N=0.065                       #The amount of nitrogen content in the 1kg of fuel by weight in kg\n",
      "E=25.0                          #The amount of excess air supplied in percentage\n",
      "o=32.0                          #Molecular weight of the oxygen\n",
      "co=44.0                         #Molecular weight of the carbondioxide \n",
      "c=12.0                        #Molecular weight of the carbon\n",
      "s=32.0                        #Molecular weight of the sulphur\n",
      "so=64.0                         #Molecular weight of sulphur dioxide\n",
      "n=28.0                          #Molecular weight of the nitrogen\n",
      "\n",
      "#Calculations\n",
      "o1=(o/c)*C\n",
      "coa=(co/c)*C\n",
      "o2=(o/4.0)*H\n",
      "h2=(36/4.0)*H\n",
      "o3=(o/s)*S\n",
      "s1=(so/s)*S\n",
      "To=o1+o2+o3\n",
      "Tt=To-O\n",
      "As=(Tt*100)/23.0\n",
      "as_=As*(1+(E/100.0))\n",
      "o2a=0.23*(E/100)*As\n",
      "n2a=0.77*(1+(E/100))*As\n",
      "n2e=n2a+N\n",
      "Tw=coa+n2e+o2a\n",
      "pco=(coa/Tw)*100\n",
      "pn=(n2e/Tw)*100\n",
      "po=(o2a/Tw)*100\n",
      "mco=(coa/co)\n",
      "mn=(n2e/n)\n",
      "mo=(o2a/o)\n",
      "Tm=mco+mn+mo\n",
      "vco=(mco/Tm)*100\n",
      "vn=(mn/Tm)*100\n",
      "vo=(mo/Tm)*100\n",
      "\n",
      "#Output\n",
      "print\"(a)Stoichiometric air/fuel ratio = \",round(As,2) \n",
      "print\"(b)The percentage of dry products of combustion by weight :\"\n",
      "print\" CO2 = \",round(pco,2),\"percent\"\n",
      "print\"N2 = \",round(pn,2),\"percent\"\n",
      "print\"O2 = \",round(po,2),\"percent\"\n",
      "print\"(c)The percentage of dry products of combustion by volume : \"\n",
      "print\"CO2 = \",round(vco,2),\"percent\"\n",
      "print\"N2 = \",round(vn,2),\"percent\"\n",
      "print\"O2= \",round(vo,2),\"percent\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)Stoichiometric air/fuel ratio =  11.64\n",
        "(b)The percentage of dry products of combustion by weight :\n",
        " CO2 =  20.89 percent\n",
        "N2 =  74.68 percent\n",
        "O2 =  4.44 percent\n",
        "(c)The percentage of dry products of combustion by volume : \n",
        "CO2 =  14.47 percent\n",
        "N2 =  81.3 percent\n",
        "O2=  4.23 percent\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.4 Page no 71"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "CO=12.0                    #The composition of carbondioxide of combustion by volume in percentage \n",
      "C=0.5                    #The composition of carbonmoxide of combustion by volume in percentage \n",
      "O=4.0                      #The composition of oxygen of combustion by volume in percentage \n",
      "N=83.5                   #The composition of nitrogen of combustion by volume in percentage \n",
      "o=32.0                     #Molecular weight of the oxygen\n",
      "co=44.0                    #Molecular weight of the carbondioxide \n",
      "c=12.0                     #Molecular weight of the carbon\n",
      "s=32.0                     #Molecular weight of the sulphur\n",
      "so=64.0                    #Molecular weight of sulphur dioxide\n",
      "n1=28.0                    #Molecular weight of the nitrogen\n",
      "h=2.0                      #Molecular weight of the hydrogen\n",
      "\n",
      "#Calculations\n",
      "m=12+0.5\n",
      "x=N/3.76\n",
      "z=(x-(CO+(C/2)+O))*2\n",
      "n=z*h\n",
      "Af=((x*o)+(N*n1))/((m*c)+(n))\n",
      "As=((18.46*o)+(69.41*n1))/173.84\n",
      "Ta=(Af/As)*100\n",
      "mc=((m*c)/173.84)*100\n",
      "mh=(n/173.84)*100\n",
      "\n",
      "#Output\n",
      "print\"(a)The air/fuel ratio = \",round(Af,1)\n",
      "print\"(b)The percent theoretical air = \",round(Ta,1),\"%\"\n",
      "print\"(c)The percentage composition of fuel on a mass basis : \" \n",
      "print\"C = \",round(mc,1),\"%\"\n",
      "print\"H = \",round(mh,1),\"percent\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The air/fuel ratio =  17.5\n",
        "(b)The percent theoretical air =  120.3 %\n",
        "(c)The percentage composition of fuel on a mass basis : \n",
        "C =  86.3 %\n",
        "H =  13.7 percent\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.5 Page no 72"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "C=86.0                                    #The composition of carbon in the fuel by weight in percentage\n",
      "H=14.0                                    #The composition of hydrogen in the fuel by weight in percentage\n",
      "e=1.25                                  #Equivalent ratio\n",
      "o=32.0                                    #Molecular weight of the oxygen\n",
      "co=44.0                                   #Molecular weight of the carbondioxide \n",
      "c=12.0                                    #Molecular weight of the carbon\n",
      "s=32.0                                    #Molecular weight of the sulphur\n",
      "so=64.0                                   #Molecular weight of sulphur dioxide\n",
      "n=28.0                                    #Molecular weight of the nitrogen\n",
      "h2=2.0                                    #Molecular weight of the hydrogen\n",
      "Fc=0.86                                 #Fraction of C\n",
      "\n",
      "#Calculations\n",
      "Ra=1/Fc\n",
      "x=2*(1+(0.9765/2.0)-(1.488*0.8))\n",
      "Tm=0.5957+0.4043+4.476\n",
      "vc=(0.5957/Tm)*100\n",
      "vco=(0.4043/Tm)*100\n",
      "vn=(4.476/Tm)*100\n",
      "\n",
      "#Calculations\n",
      "print\"The percentage analysis of dry exhaust gas by volume : \"\n",
      "print\"CO = \",round(vc,2),\"percent\" \n",
      "print\"CO2 = \",round(vco,2),\"percent\" \n",
      "print\"N2 = \",round(vn,2),\"percent\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The percentage analysis of dry exhaust gas by volume : \n",
        "CO =  10.88 percent\n",
        "CO2 =  7.38 percent\n",
        "N2 =  81.74 percent\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.6 Page no 77"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "t=25.0                                #The temperature of both reactants and products in degree centigrade\n",
      "p=1.0                                 #The pressure of both reactants and products in bar\n",
      "\n",
      "#Calculations \n",
      "h=0\n",
      "hf1=-103.85\n",
      "hf2=-393.52\n",
      "hf3=-285.8\n",
      "hf4=(3*hf2)+(4*hf3)\n",
      "Q=hf4-hf1\n",
      "\n",
      "#Output\n",
      "print\" The heat transfer per mole of fuel = \",Q,\"kJ/mol fuel\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The heat transfer per mole of fuel =  -2219.91 kJ/mol fuel\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.7 Page no 77"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "t=25.0                                 #The temperature of the air entering the diesel engine in degree centigrade \n",
      "T=600.0                                #The temperature at which the products are released in K\n",
      "Ta=200.0                               #Theoretical air used in percentage \n",
      "Q=-93.0                                #Heat loss from the engine in MJ/kmol fuel\n",
      "f=1.0                                  #The fuel rate in kmol/h\n",
      "\n",
      "#Calculations \n",
      "hfr=-290.97\n",
      "h1=-393.52\n",
      "h11=12.916\n",
      "hfc=h1+h11\n",
      "h2=-241.82\n",
      "h22=10.498\n",
      "hfh=h2+h22\n",
      "h3=0 \n",
      "h33=9.247\n",
      "hfo=h3+h33\n",
      "h4=0\n",
      "h44=8.891\n",
      "hfn=h4+h44\n",
      "hfp=(12*hfc)+(13*hfh)+(18.5*hfo)+(139.12*hfn)\n",
      "W=Q+hfr-hfp\n",
      "W1=(f*W*10**3)/3600.0\n",
      "\n",
      "#Output\n",
      "print\"The work for a fuel rate of 1 kmol/h is \",round(W1,0),\"kW\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The work for a fuel rate of 1 kmol/h is  1606.0 kW\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.8 Page no 78"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "P=600                               #Power of an engine in kW\n",
      "t=25                                #Temperature at which fuel is used in degree centigrade\n",
      "Ta=150                              #Theoretical air used in percentage\n",
      "T1=400                              #The temperature at which air enters in K\n",
      "T2=700                              #The temperature at which the products of combustion leave in K\n",
      "Q=-150                              #The heat loss from the engine in kW\n",
      "C=12                                #Molecular weight of carbon\n",
      "h=1                                 #Molecular weight of hydrogen\n",
      "\n",
      "#Calculations\n",
      "hfc=-259.28\n",
      "hfo1=3.029\n",
      "hfn1=2.971\n",
      "HR=(hfc)+(1.5*12.5*hfo1)+(1.5*12.5*3.76*hfn1)\n",
      "hfco=-393.52\n",
      "hfco1=17.761\n",
      "hfh=-241.82\n",
      "hfh1=14.184\n",
      "hfo2=12.502\n",
      "hfn2=11.937\n",
      "HP=(8*(hfco+hfco1))+(9*(hfh+hfh1))+(6.25*hfo2)+(70.5*hfn2)\n",
      "H=HP-HR\n",
      "nf=((Q-P)*3600)/(H*10.0**3)\n",
      "M=(8*C)+(18*h)\n",
      "mf=nf*M\n",
      "\n",
      "#Output\n",
      "print\" The fuel consumption for complete combustion is \",round(mf,1),\"kg/h\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The fuel consumption for complete combustion is  74.3 kg/h\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.9 Page no 79"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "t=25                          #Temperature at which fuel is used for combustion in degree centigrade \n",
      "p=1                           #The pressure at which fuel is used in bar\n",
      "T=400                         #The temperature of the products of combustion in K\n",
      "R=8.314*10**-3                #Universal gas constant\n",
      "hfco=-393.52                  #The enthalpy of the carbondioxide in MJ/kmol fuel\n",
      "hfco1=4.008                   #The change in enthalpy of the carbondioxide for the given conditions in MJ/kmol fuel\n",
      "hfh=-241.82                   #The enthalpy of the water in MJ/kmol fuel\n",
      "hfh1=3.452                    #The change in enthalpy of the water for the given conditions in MJ/kmol fuel\n",
      "\n",
      "#Calculations\n",
      "hfc=-103.85 \n",
      "HR=(1*(hfc-(R*(t+273))))+(5*(-R*(t+273)))\n",
      "HP=(3*(hfco+hfco1-(R*T)))+(4*(hfh+hfh1-(R*T)))\n",
      "Q=HP-HR\n",
      "Q1=-Q\n",
      "\n",
      "#Output\n",
      "print\"The heat transfer per mole of propane = \",round(Q1,1),\"kJ/mol propane\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The heat transfer per mole of propane =  2026.6 kJ/mol propane\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.10 Page no 82"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "T=1500                            #The given temperature in K\n",
      "hfco=-393.52                      #The enthalpy of formation for carbondioxide in MJ/kmol\n",
      "hf1=61.714                        #The change in enthalpy for actual state and reference state in MJ/kmol\n",
      "hfc=-110.52                       #The enthalpy of formation for carbonmonoxide in MJ/kmol\n",
      "hf2=38.848                        #The change in enthalpy of CO for actual and reference state in MJ/kmol\n",
      "hfo=0                             #The enthalpy of formation for oxygen gas\n",
      "hf3=40.61                         #The change in enthalpy of oxygen for different states in MJ/kmol\n",
      "\n",
      "#Calculations\n",
      "HP=hfco+hf1\n",
      "HR=(hfc+hf2)+(0.5*(hfo+hf3))\n",
      "H=HP-HR\n",
      "\n",
      "#Output\n",
      "print\" The enthalpy of combustion is  \",round(H,1),\"MJ/kmol CO\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The enthalpy of combustion is   -280.4 MJ/kmol CO\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.11 Page no 83"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "E=30                        #The amount of excess air in percentage\n",
      "tp=400                      #The temperature at which propane enters in K\n",
      "ta=300                      #The temperature at which air enters in K\n",
      "T=900                       #The temperature at which products leave in K\n",
      "m=83.7                      #The average molar specific heat of propane at consmath.tant pressure in kJ/kmolK\n",
      "Mp=44                       #The molecular weight of propane\n",
      "hfc=-393.52                 #The enthalpy of formation for carbondioxide in MJ/kmol\n",
      "hf1=28.041                  #The change in enthalpy of CO2 for actual and reference state in MJ/kmol\n",
      "hfh=-241.82                 #The enthalpy of formation for water in MJ/kmol\n",
      "hf2=21.924                  #The change in enthalpy of water for actual and reference state in MJ/kmol\n",
      "hfn=0                       #The enthalpy of nitrogen gas \n",
      "hf3=18.221                  #The change in enthalpy of nitrgen for actual and reference state in MJ/kmol\n",
      "hfo=0                       #The enthalpy of oxygen gas \n",
      "hf4=19.246                  #The change in enthalpy of oxygen for actual and reference state in MJ/kmol\n",
      "hfp=-103.85                 #The enthalpy of formation for propane in MJ/kmol\n",
      "R=0.0837                    #Universal gas constant \n",
      "hfo1=0                      #The enthalpy of oxygen gas \n",
      "hf11=0.054                  #The change in enthalpy of oxygen gas for actual and reference state in MJ/kmol\n",
      "hfn1=0                      #The enthalpy of nitrogen gas\n",
      "hfn22=0.054                 #The change in enthalpy of nitrogen for actual and reference state in MJ/kmol\n",
      "\n",
      "#Calculations\n",
      "\n",
      "HP=(3*(hfc+hf1))+(4*(hfh+hf2))+(24.44*(hfn+hf3))+(1.5*(hfo+hf4))\n",
      "HR=(1*(hfp+(R*(tp-ta))))+(6.5*(hfo1+hf11))+(24.44*(hfn1+hfn22))\n",
      "Q=HP-HR\n",
      "Q1=(-Q/Mp)\n",
      "\n",
      "#Output\n",
      "print\" The amount of heat transfer per kg of fuel is  \",round(Q1,3),\"MJ/kg\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The amount of heat transfer per kg of fuel is   32.0 MJ/kg\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.12 Page no 84"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "Ta=150                            #The presence of Theoretical air\n",
      "hfc=-393.52                       #The enthalpy of formation for carbondioxide in MJ/kmol\n",
      "hfh=-285.8                        #The enthalpy of formation for water in MJ/kmol\n",
      "hfon=0                            #The enthalpy of formation for oxygen and nitrogen gas \n",
      "hfch=-74.87                       #The enthalpy of formation for methane in MJ/kmol\n",
      "np=2                              #Number of moles of product\n",
      "nr=4                              #Number of moles of reactant\n",
      "R=8.314*10**-3                    #Universal gas constant \n",
      "t=298                             #The temperature in K\n",
      "hfh1=-241.82                      #The enthalpy of formation for water in MJ/kmol\n",
      "np1=4                             #Number of moles of product\n",
      "nr1=4                             #Number of moles of reactant\n",
      "\n",
      "#Calculations\n",
      "HP=(hfc)+(2*hfh)\n",
      "HR=1*hfch\n",
      "H=HP-HR\n",
      "n=np-nr\n",
      "U1=H-(n*R*t)\n",
      "HP1=(1*hfc)+(2*hfh1)\n",
      "H1=HP1-HR\n",
      "n1=np1-nr1\n",
      "U2=H1-(n1*R*t)\n",
      "\n",
      "#Output\n",
      "print\"(a)The water as liquid\" \n",
      "print\"The standard enthalpy of combustion is \",H, \"MJ/kmol\"\n",
      "print\"The standard internal energy of combustion is \",round(U1,3),\"MJ/kmol\"\n",
      "print\"(b)The water as a gas \"\n",
      "print\"The standard enthalpy of combustion is  \",H1,\"MJ/kmol\"\n",
      "print\"The standard internal energy of combustion is \",U2,\"MJ/kmol\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a)The water as liquid\n",
        "The standard enthalpy of combustion is  -890.25 MJ/kmol\n",
        "The standard internal energy of combustion is  -885.295 MJ/kmol\n",
        "(b)The water as a gas \n",
        "The standard enthalpy of combustion is   -802.29 MJ/kmol\n",
        "The standard internal energy of combustion is  -802.29 MJ/kmol\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.13 Page no 85"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "cv=44000                       #The lower calorific value of liquid fuel in kJ/kg\n",
      "C=84                           #The carbon content present in the fuel in percentage\n",
      "H=16                           #The hydrogen content present in the fuel in percentage\n",
      "t=25                           #The temperature in degree centigrade\n",
      "hfg=2442                       #The enthalpy of vaporization for water in kJ/kg\n",
      "c=12.0                         #Molecular weight of carbon \n",
      "h=2                            #Molecular weight of hydrogen\n",
      "co2=44.0                       #Molecular weight of carbondioxide\n",
      "h2o=18                         #Molecular weight of water \n",
      "o2=32.0                        #Molecular weight of oxygen\n",
      "R=8.314                        #Universal gas constant in J/molK\n",
      "\n",
      "#Calculations\n",
      "CO2=(0.84*(co2/c))\n",
      "H2O=(0.16*(h2o/h))\n",
      "cvd=H2O*hfg\n",
      "HHV=cv+cvd\n",
      "np=3.08/co2\n",
      "nr=3.52/o2\n",
      "n=np-nr\n",
      "HHVv=HHV+(n*R*(t+273))\n",
      "LHVv=cv+(n*R*(t+273))\n",
      "\n",
      "#Output\n",
      "print\" The higher calorific value at constant pressure = \",HHV,\"kJ/kg fuel\" \n",
      "print\"The higher calorific value at constant volume = \",round(HHVv,0),\"kJ/kg fuel\"\n",
      "print\"The lower calorific value at constant volume = \",round(LHVv,0),\"kJ/kg fuel\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The higher calorific value at constant pressure =  47516.48 kJ/kg fuel\n",
        "The higher calorific value at constant volume =  47417.0 kJ/kg fuel\n",
        "The lower calorific value at constant volume =  43901.0 kJ/kg fuel\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.14 Page no 87"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "E=100                          #The amount of excess air in percent\n",
      "T=298                          #The temperature of reactants in K\n",
      "nc=1                           #Number of moles of propane\n",
      "hfch=-103.85                   #Enthalpy of formation for propane in MJ/kmol fuel\n",
      "hfc=-393.52                    #Enthalpy of formation for carbondioxide in MJ/kmol fuel\n",
      "hfh=-241.82                    #Enthalpy of formation for water in MJ/kmol fuel\n",
      "hfon=0                         #Enthalpy of formation for both oxygen and nitrogen gas\n",
      "T1=1500                        #Assuming the products temperature for fist trail in K\n",
      "hfc1=61.714                    #The change in enthalpy for corbondioxide for trail temp in MJ/kmol fuel\n",
      "hfh1=48.095                    #The change in enthalpy for water for trail temp in MJ/kmol fuel\n",
      "hfo1=40.61                     #The change in enthalpy for oxygen for trail temp in MJ/kmol fuel\n",
      "hfn1=38.405                    #The change in enthalpy for nitrogen for trail temp in MJ/kmol fuel\n",
      "T2=1600                        #Assuming the products temperature for second trail in K\n",
      "hfc2=67.58                     #The change in enthalpy for corbondioxide for trail temp in MJ/kmol fuel\n",
      "hfh2=52.844                    #The change in enthalpy for water for trail temp in MJ/kmol fuel\n",
      "hfo2=44.279                    #The change in enthalpy for oxygen for trail temp in MJ/kmol fuel\n",
      "hfn2=41.903                    #The change in enthalpy for nitrogen for trail temp in MJ/kmol fuel\n",
      "\n",
      "#Calculations\n",
      "HR=nc*hfch\n",
      "x=HR-((3*hfc)+(4*hfh)+(5*hfon)+(37.6*hfon))\n",
      "hfn=x/37.6\n",
      "HP1=(HR-x)+(3*hfc1)+(4*hfh1)+(5*hfo1)+(37.6*hfn1)\n",
      "HP2=(HR-x)+(3*hfc2)+(4*hfh2)+(5*hfo2)+(37.6*hfn2)\n",
      "Te=(((HR-HP1)/(HP2-HP1))*(T2-T1))+T1\n",
      "\n",
      "#Output\n",
      "print\" The adiabatic flame temperature for steady-flow process is  \",round(Te,0),\"K\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The adiabatic flame temperature for steady-flow process is   1510.0 K\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.15 Page no 89"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "T=600                            #The initial temperature of air in K\n",
      "p=1                              #The initial pressure of air in atm\n",
      "R=8.314                          #Universal gas constant in J/molK\n",
      "Tr=298                           #The temperature of reactants in K\n",
      "a=4.503                          #Given Constants \n",
      "b=-8.965*10**-3\n",
      "c=37.38*10**-6\n",
      "d=-36.49*10**-9\n",
      "e=12.22*10**-12\n",
      "hfc=-393.52                      #Enthalpy of formation for carbondioxide in MJ/kmol fuel\n",
      "hfh=-241.82                      #Enthalpy of formation for water in MJ/kmol fuel\n",
      "hfn=0                            #Enthalpy of formation for nitrogen gas\n",
      "hfc1=-74.87                      #The enthalpy of formation for methane in MJ/kmol fuel \n",
      "hfh1=9.247                       #The change in enthalpy of the water in MJ/kmol\n",
      "hfn1=8.891                       #The change in enthalpy of nitrogen in MJ/kmol\n",
      "Tc=3700                          #The corresponding temperature for the enthalpy of guess nitrogen in K\n",
      "T1=2800                          #The temperature assumed for the first trail in K\n",
      "hco1=140.444                     #The change in enthalpy for the assume temp for carbondioxide in MJ/kmol\n",
      "hh1=115.294                      #The change in enthalpy for the assume temp for water in MJ/kmol\n",
      "hn1=85.345                       #The change in enthalpy for the assume temp for nitrogen in MJ/kmol\n",
      "T2=2500                          #The temperature assumed for the second trail in K\n",
      "hco2=121.926                     #The change in enthalpy for the assume temp for carbondioxide in MJ/kmol\n",
      "hh2=98.964                       #The change in enthalpy for the assume temp for water in MJ/kmol\n",
      "hn2=74.312                       #The change in enthalpy for the assume temp for nitrogen in MJ/kmol\n",
      "T3=2600                          #The temperature fo the third trail in K\n",
      "hco3=128.085                     #The change in enthalpy for the assume temp for carbondioxide in MJ/kmol\n",
      "hh3=104.37                       #The change in enthalpy for the assume temp for water in MJ/kmol\n",
      "hn3=77.973                       #The change in enthalpy for the assume temp for nitrogen in MJ/kmol\n",
      "Tc1=3000                         #Assume temperature for first trail in K\n",
      "hcoa1=146.645                    #The change in enthalpy for the assume temp for carbondioxide in MJ/kmol\n",
      "hha1=120.813                     #The change in enthalpy for the assume temp for carbondioxide in MJ/kmol\n",
      "hna1=89.036                      #The change in enthalpy for the assume temp for nitrogen in MJ/kmol\n",
      "Tc2=3200                         #Assume temperature for the second trail in K\n",
      "hcoa2=165.331                    #The change in enthalpy for the assume temp for carbondioxide in MJ/kmol\n",
      "hha2=137.553                     #The change in enthalpy for the assume temp for water in MJ/kmol\n",
      "hna2=100.161                     #The change in enthalpy for the assume temp for nitrogen in MJ/kmol\n",
      "\n",
      "#Calculations\n",
      "HP=(1*hfc)+(2*hfh)+(7.52*hfn)\n",
      "hch=(R*((a*(T-Tr))+((b/2.0)*(T**2-Tr**2))+((c/3.0)*(T**3-Tr**3))+((d/4.0)*(T**4-Tr**4))+((e/5.0)*(T**5-Tr**5))))/1000.0\n",
      "HR=((hfc1+hch)+(2*hfh1)+(7.52*hfn1))\n",
      "x=HR-HP\n",
      "hfn2=x/7.52\n",
      "HP1=hco1+(2*hh1)+(7.52*hn1)+(HR-x)\n",
      "HP2=hco2+(2*hh2)+(7.52*hn2)+(HR-x)\n",
      "HP3=hco3+(2*hh3)+(7.52*hn3)+(HR-x)\n",
      "Ta1=(((HR-HP2)/(HP3-HP2))*(T3-T2))+T2\n",
      "UR1=HR-(10.52*R*10**-3*T)\n",
      "UP1=hcoa1+(2*hha1)+(7.52*hna1)+(HR-x)-(0.08746*Tc1)\n",
      "UP2=hcoa2+(2*hha2)+(7.52*hna2)+(HR-x)-(0.08746*Tc2)\n",
      "Tu=(((UR1-UP1)/(UP2-UP1))*(Tc2-Tc1))+Tc1\n",
      "\n",
      "#Output\n",
      "print\"The adiabatic flame temperature at  \"\n",
      "print\"(a)Constant pressure process is \",round(Ta1,0),\"K\" \n",
      "print\"(b)Constant volume process is \",round(Tu,3),\"K\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The adiabatic flame temperature at  \n",
        "(a)Constant pressure process is  2550.0 K\n",
        "(b)Constant volume process is  3089.34 K\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.16 Page no 91"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "T=600.0                          #Temperature at constant pressure process in K\n",
      "p=1.0                            #The pressure in atm\n",
      "E=50.0                           #The amount of excess air in percent\n",
      "L=20.0                           #The amount of less air in percent\n",
      "cp=52.234                        #Specific constant for methane in kJ/kmolK\n",
      "t=298.0                        #Assume the normal temperature in K\n",
      "hfch=-74.87                    #The enthalpy of formation for carbondioxide in MJ\n",
      "ho=9.247                       #The change in enthalpy of oxygen in MJ\n",
      "hn=8.891                       #The change in enthalpy of nitrogen in MJ\n",
      "hfc1=-393.52                   #The enthalpy of formation of carbondioxide in MJ\n",
      "hfh1=-241.82                   #The enthalpy of formation of water in MJ\n",
      "Tc=2800.0                        #The corresponding temperature in K\n",
      "T1=2000                        #The temperature for first trail in K\n",
      "hfc11=91.45                    #The enthalpy for the assume temp for carbondioxide in MJ\n",
      "hfh11=72.689                   #The change in enthalpy for the assume temp for water in MJ\n",
      "hfn11=56.141                   #The change in enthalpy for the assume temp for nitrogen in MJ\n",
      "hfo11=59.199                   #The change in enthalpy for the assume temp for oxygen in MJ\n",
      "T2=2100                        #The temperature for second trail in K\n",
      "hfc22=97.5                     #The enthalpy for the assume temp for carbondioxide in MJ\n",
      "hfh22=77.831                   #The change in enthalpy for the assume temp for water in MJ\n",
      "hfn22=59.748                   #The change in enthalpy for the assume temp for nitrogen in MJ\n",
      "hfo22=62.986                   #The change in enthalpy for the assume temp for oxygen in MJ\n",
      "hfchr=-74.87                   #The enthalpy of formation for methane in MJ\n",
      "hor=9.247                      #The change in enthalpy for oxygen in MJ\n",
      "hnr=8.891                      #The change in enthalpy for nitrogen in MJ\n",
      "hfcop=-110.52                  #The formation of enthalpy for carbonmoxide in MJ\n",
      "hfcp=-393.52                   #The formation of enthalpy for carbondioxide in MJ\n",
      "hfhp=-241.82                   #The formation of enthalpy for water in MJ\n",
      "Tp1=2000.0                       #The temperature for first trail in K\n",
      "hco11=56.739                   #The change in enthalpy for CO in MJ\n",
      "hco211=91.45                   #The change in enthalpy for CO2 in MJ\n",
      "hh11=72.689                    #The change in enthalpy for water in MJ\n",
      "hn11=56.141                    #The change in enthalpy for nitrogen in MJ\n",
      "Tp2=2400                       #The temperature for second trail in K\n",
      "hco22=71.34                    #The change in enthalpy for CO in MJ\n",
      "hco222=115.788                 #The change in enthalpy for CO2 in MJ\n",
      "hh22=93.604                    #The change in enthalpy for water in MJ\n",
      "hn22=70.651                    #The change in enthalpy for nitrogen in MJ\n",
      "Tp3=2300.0                       #The temperature for first trail in K\n",
      "hco33=67.676                   #The change in enthalpy for CO in MJ\n",
      "hco233=109.671                 #The change in enthalpy for CO2 in MJ\n",
      "hh33=88.295                    #The change in enthalpy for water in MJ\n",
      "hn33=67.007                    #The change in enthalpy for nitrogen in MJ\n",
      "hccc=-283.022                  #The only combustible substance is CO in MJ/kmol\n",
      "\n",
      "#Calculations\n",
      "hch=cp*(T-t)*10**-3\n",
      "HR=hfch+hch+(3*ho)+(11.28*hn)\n",
      "HP=hfc1+(2*hfh1)\n",
      "x=HR-HP\n",
      "hn2=x/11.28\n",
      "HP1=hfc11+(2*hfh11)+(11.28*hfn11)+(hfo11)+(HR-x)\n",
      "HP2=hfc22+(2*hfh22)+(11.28*hfn22)+(hfo22)+(HR-x)\n",
      "Ta1=(((HR-HP1)/(HP2-HP1))*(T2-T1))+T1\n",
      "X=2*(2-1.6)\n",
      "HRr=hfchr+hch+(1.6*hor)+(6.01*hnr)\n",
      "HPp=(0.8*hfcop)+(0.2*hfcp)+(2*hfhp)\n",
      "HPp1=(0.8*hco11)+(0.2*hco211)+(2*hh11)+(6.016*hn11)-HPp\n",
      "HPp2=(0.8*hco22)+(0.2*hco222)+(2*hh22)+(6.016*hn22)+HPp\n",
      "HPp3=(0.8*hco33)+(0.2*hco233)+(2*hh33)+(6.016*hn33)+HPp\n",
      "Ta2=(((HRr-HPp3)/(HPp2-HPp3))*(Tp2-Tp3))+Tp3\n",
      "Q=-0.8*hccc                                                    #The thermal energy loss in MJ/kmol fuel\n",
      "\n",
      "#Output\n",
      "print\" The adiabatic flame temperature having \"\n",
      "print\"(a)50 percent excess air is \",round(Ta1,1),\"K\"\n",
      "print\"(b)20 percent less air is \",round(Ta2,2),\"K\"\n",
      "print\"The loss of thermal energy due to incomplete combustion is \",round(Q,2),\"MJ/kmol fuel\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The adiabatic flame temperature having \n",
        "(a)50 percent excess air is  2027.6 K\n",
        "(b)20 percent less air is  2311.22 K\n",
        "The loss of thermal energy due to incomplete combustion is  226.42 MJ/kmol fuel\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.18 Page no 98"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "T1=3000                               #Given temperature in K\n",
      "T2=4000                               #Given temperature in K\n",
      "p=1                                   #The pressure in atm\n",
      "KP1=1.117                             #Natural logarithm of equilibrium constant at 3000 K \n",
      "KP2=-1.593                            #Natural logarithm of equilibrium constant at 4000 K\n",
      "a1=0.4                                #The dissociation of 1 mole of CO2 for the first trail\n",
      "a2=0.5                                #The dissociation of 1 mole of CO2 for the second trail \n",
      "K1=3.674                              #The value of equilibrium constant for the first trail \n",
      "K2=2.236                              #The value of equilibrium constant for the second trail\n",
      "a3=0.9                                #The dissociation of 1 mole of CO2 for the first trail\n",
      "a4=0.89                               #The dissociation of 1 mole of CO2 for the second trail\n",
      "K3=0.1995                             #The value of equilibrium constant for the first trail \n",
      "K4=0.2227                             #The value of equilibrium constant for the second trail \n",
      "\n",
      "#Calculations\n",
      "import math\n",
      "Kp1=math.exp(KP1)\n",
      "Kp2=math.exp(KP2)\n",
      "a12=(((K1-Kp1)/(K1-K2))*(a2-a1))+a1\n",
      "A12=a12*100\n",
      "a23=(((Kp2-K4)/(K3-K4))*(a3-a4))+a4\n",
      "A23=a23*100\n",
      "\n",
      "#output\n",
      "print\"The percent dissociation of carbondioxide into carbonmonoxide and oxygen at \"\n",
      "print\"(a) at 3000 K and 1 atm pressure = \",round(A12,3),\"percent\" \n",
      "print\"(b) at 4000 K and 1 atm pressure = \",round(A23,1),\"percent\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The percent dissociation of carbondioxide into carbonmonoxide and oxygen at \n",
        "(a) at 3000 K and 1 atm pressure =  44.3 percent\n",
        "(b) at 4000 K and 1 atm pressure =  89.8 percent\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.19 Page no 99"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "p=1                               #Initial pressure in atm\n",
      "T=300                             #Initial temperature in K\n",
      "Tc=2400                           #To calculate the molefraction of the products at this temperature in K\n",
      "KP1=3.866                         #Natural logarithm of equilibrium constant at 2400 K for the equation\n",
      "a=0.098                           #The dissociation of 1 mole of CO2\n",
      "\n",
      "#Calculations\n",
      "import math\n",
      "K1=math.exp(KP1)\n",
      "nr=1+0.5\n",
      "Pp=(p*Tc)/(nr*T)\n",
      "np=(a+2)/2.0\n",
      "xco=(2*(1-a))/(2+a)\n",
      "xc=(2*a)/(2+a)\n",
      "xo=a/(2.0+a)\n",
      "PP=5.333*np\n",
      "\n",
      "#output\n",
      "print\"Mole fraction of the carbondioxide is \",round(xco,3)\n",
      "print\"Mole fraction of the carbonmonoxide is \",round(xc,3)\n",
      "print\"Mole fraction of oxygen is \",round(xo,3)\n",
      "print\"Pressure of the product is \",round(PP,3),\"bar\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mole fraction of the carbondioxide is  0.86\n",
        "Mole fraction of the carbonmonoxide is  0.093\n",
        "Mole fraction of oxygen is  0.047\n",
        "Pressure of the product is  5.594 bar\n"
       ]
      }
     ],
     "prompt_number": 45
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.20 Page no 100"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#given\n",
      "t=25.0                              #The temperature of air in degree centigrade\n",
      "p=1.0                               #The pressure of air in atm\n",
      "T1=2200.0                           #Given first temperature in K\n",
      "T2=2400.0                           #Given second temperature in K\n",
      "h1=59.86                          #The change in enthalpy of hydrogen at 2200 K in MJ/kmol\n",
      "h2=66.915                         #The change in enthalpy of hydrogen at 2400 K in MJ/kmol\n",
      "T=298.0                             #The temperature of air in K\n",
      "HR=0                              #The total enthalpy on the reactants side since all the reactants are elements\n",
      "Kp1=-6.774                        #Natural logarithm of equilibrium constant at 2200 K for the equation \n",
      "a1=0.02                           #By trail and error method the degree of dissociation of H2O\n",
      "hfh=-241.82                       #The enthalpy of formation of water at both 2200 and 2400 K in MJ/kmol\n",
      "hfh1=83.036                       #The change in enthalpy of water at 2200 K in MJ/kmol\n",
      "hfd1=59.86                        #The change in enthalpy of hydrogen at 2200 K in MJ/kmol\n",
      "hfo1=66.802                       #The change in enthalpy of oxygen at 2200 K in MJ/kmol\n",
      "hfn1=63.371                       #The change in enthalpy of nitrogen at 2200 K in MJ/kmol\n",
      "a2=0.04                           #By trail and error method the degree of dissociation of H2O at 2400 K\n",
      "hfh2=93.604                       #The change in enthalpy of water at 2400 K in MJ/kmol\n",
      "hfd2=66.915                       #The change in enthalpy of hydrogen at 2400 K in MJ/kmol\n",
      "hfo2=74.492                       #The change in enthalpy of oxygen at 2400 K in MJ/kmol\n",
      "hfn2=70.651                       #The change in enthalpy of nitrogen at 2400 K in MJ/kmol\n",
      "\n",
      "#Calculations\n",
      "import math\n",
      "K1=math.exp(Kp1)\n",
      "HP1=(0.98*(hfh+hfh1))+(0.02*hfd1)+(0.01*hfo1)+(1.88*hfn1) \n",
      "HP2=(0.96*(hfh+hfh2))+(0.04*hfd2)+(0.02*hfo2)+(1.88*hfn2) \n",
      "H1=HP1-HR\n",
      "H2=HP2-HR\n",
      "Tl=(((T2-T1)/(HP2-HP1))*(HR-HP1))+T1\n",
      "\n",
      "#Output\n",
      "print\"The adiabatic flame temperature taking dissociation into account is \",T1+236,\"K\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The adiabatic flame temperature taking dissociation into account is  2436.0 K\n"
       ]
      }
     ],
     "prompt_number": 28
    }
   ],
   "metadata": {}
  }
 ]
}