summaryrefslogtreecommitdiff
path: root/Applied_Thermodynamics_by_Onkar_Singh/Chapter16.ipynb
blob: d678e85b12b459d4ed32ca08198f0de6e4c52e65 (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:989996224965b46a7f7acf7a19fb2013a5188045b934aa862e6400be6d28d97c"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 16: Reciprocating and Rotary Compressor"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2, page no. 742"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "from math import log,pi\n",
      "\n",
      "#Variable Declaration: \n",
      "p1 = 1*10**2 #Pressure of air entering(in kPa):\n",
      "n = 1.2 #Index of compression:\n",
      "p2 = 12*10**2 #Delivery pressure(in kPa):\n",
      "N = 240 #Speed(in rpm):\n",
      "T1 = 20+273 #Initial temperature(in K):\n",
      "r1 = 1.8 #L/D ratio:\n",
      "nm = 0.88 #Mechanical efficiency:\n",
      "V1 = 1                      #m**3\n",
      "R = 0.287#Gas constant(in kJ/kg.K):\n",
      "\n",
      "#Calculations:\n",
      "m = p1*V1/(R*T1) Mass of air delivered per minute:\n",
      "T2 = T1*(p2/p1)**((n-1)/n)#Temperature at the end of compression(in K)\n",
      "W = (n/(n-1))*m*R*(T2-T1)#Work required during compression process(in kJ/min):\n",
      "Whp = W/60/0.7457           #Work required during compression process(hp):    \n",
      "C = Whp/nm#Capacity of drive required to run compressor(in hp):\n",
      "Wiso = m*R*T1*log(p2/p1)    #Isothermal work required for same compression(in kJ/min):\n",
      "niso = Wiso/W*100#Isothermal efficiency:\n",
      "v = 1/N#Volume of aur entering per cycle:\n",
      "D = (v*4/(pi*r1))**(1/3)*100#Bore diameter(in cm):\n",
      "L = r1*D#Stroke length(in cm):\n",
      "\n",
      "#Results: \n",
      "print \"Isothermal efficiency: \",round(niso,2),\"%\"\n",
      "print \"Cylinder dimension, D: \",round(D,2),\"cm\"\n",
      "print  \"                   L: \",round(L,3),\"cm\"\n",
      "print \"Rating of drive: \",round(C,2),\"hp\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Isothermal efficiency:  80.72 %\n",
        "Cylinder dimension, D:  14.34 cm\n",
        "                   L:  25.808 cm\n",
        "Rating of drive:  7.82 hp\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3, page no. 745"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "from math import pi,log\n",
      "\n",
      "#Variable Declaration: \n",
      "r = 7 #Compression ratio:\n",
      "r1 = 1.2 #L/D ratio:\n",
      "N = 240 #Speed(in rpm):\n",
      "p1 = 0.97 #Pressure(in bar):\n",
      "T1 = 35+273 #Temperature(in K):\n",
      "V = 20 #Volume(in m**3):\n",
      "V3 = 0.05\n",
      "V1 = 1.05\n",
      "R = 0.287 #Gas constant(in kJ/kg.K):\n",
      "n = 1.25 #Index of compression:\n",
      "\n",
      "#Calculations:\n",
      "p2 = r*p1\n",
      "m = 10**2*V/(R*300) #Mass of air delivered(in kg/min):\n",
      "T2 = T1*r**((n-1)/n) #Temperature at state 2(in K):\n",
      "V4 = V3*r**(1/n) #Volume at state 4(in m**3):\n",
      "nv = p1*300/T1*(V1-V4)*100 #Volumetric efficiency:\n",
      "Vs = V/(4*N) #Swept volume(in m**3/cycle):\n",
      "D = (Vs*4/(pi*r1))**(1/3)   #Bore(in m):\n",
      "L = r1*D #Stroke(in m):\n",
      "W = n/(n-1)*m*R*(T2-T1)/(60*0.7457) #Work required in reciprocating compressor(in hp):\n",
      "Wiso = m*R*T1*log(r)/(60*0.7457) #Work done in isothermal process(in hp):\n",
      "ni = Wiso/W*100 #Isothermal efficiency:\n",
      "\n",
      "#Results: \n",
      "print \"Volumetric efficiency: \",round(nv,2),\"%\"\n",
      "print \"Bore: \",round(D*100,2),\"cm\"\n",
      "print \"Stroke: \",round(L*100,2),\"cm\"\n",
      "print \"Isothermal efficiency: \",round(ni,2),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Volumetric efficiency:  76.8 %\n",
        "Bore:  28.06 cm\n",
        "Stroke:  33.68 cm\n",
        "Isothermal efficiency:  81.8 %\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5, page no. 749"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      " \n",
      "from math import sqrt\n",
      "\n",
      "#Variable Declaration: \n",
      "p = 10**2 #Atmospheric pressure(in kPa):\n",
      "p1 = 1\n",
      "p3 = 8\n",
      "Ta = 300 #Temperature(in K):\n",
      "Va = 4\n",
      "R = 0.287 #Gas constant(in kJ/kg.K):\n",
      "n = 1.2 #Index of compression:\n",
      "\n",
      "#Calculations:\n",
      "T1 = Ta\n",
      "T2a = 273+30\n",
      "V1 = Va\n",
      "m = p*Va/(R*Ta) #Mass of air compressed(in kg/min):\n",
      "Wi = n/(n-1)*p1*10**2*Va*((p3/p1)**((n-1)/n)-1)/(60*0.7457)#Work input(in hp):\n",
      "p2 = sqrt(p1*p3) #Optimum intercooling pressure(in bar):\n",
      "Wii = 2*n/(n-1)*p1*10**2*Va*((p3/p1)**((n-1)/(2*n))-1)/(60*0.7457)#Work input for 2nd stage compression(in hp):\n",
      "Wii = 20.29\n",
      "V2a = p1*V1/T1*T2a/p2 #Volume of air inlet of HP cylinder(in  m**3/min):\n",
      "W2 = n/(n-1)*p1*10**2*V1*((p2/p1)**((n-1)/n)-1)/(60*0.7457)+n/(n-1)*p2*10**2*V2a*((p3/p2)**((n-1)/n)-1)/(60*0.7457)\t\t\t\t#Work required(in hp):\n",
      "W2 = 20.42\n",
      "ps = (Wi-Wii)/Wi*100 #Percentage saving in work:\n",
      "pe = (W2-Wii)/W2*100 #% excess work to be done:\n",
      "\n",
      "#Results: \n",
      "print \"Percentage saving in work: \",round(ps,2),\"%\"\n",
      "print \"Percentage excess work to be done: \",round(pe,3),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Percentage saving in work:  8.68 %\n",
        "Percentage excess work to be done:  0.637 %\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6, page no. 750"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "#Variable Declaration: \n",
      "m = 2 #Rate at which air is delivered(in m**3/min):\n",
      "p1 = 1 #Initial pressure(in bar):\n",
      "T1 = 300               #K\n",
      "p = 150                #bar\n",
      "n = 1.25 #Polytropic index of compression:\n",
      "p2 = 3.5\n",
      "p3 = 12.25\n",
      "p4 = 42.87\n",
      "R = 0.287 #Gas constant(in kJ/kg.K):\n",
      "\n",
      "#Calculations:\n",
      "T = T1*(p2/p1)**((n-1)/n) #Temperature at the end of fourth stage(in K):\n",
      "m = p*10**2*2/(R*T) #Mass of air(in kg):\n",
      "W = n/(n-1)*m*R*T1*((p2/p1)**((n-1)/n)-1)*4/(60*0.7457) #Work required(in kW):\n",
      "\n",
      "print \"Intermediate pressure: \",round(p2,2),\"bar\",round(p3,2),\"bar\",round(p4,2),\"bar respectively\"\n",
      "print \"Work input: \",round(W,2),\"hp\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Intermediate pressure:  3.5 bar 12.25 bar 42.87 bar respectively\n",
        "Work input:  2972.1 hp\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7, page no. 751"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "#Variable Declaration: \n",
      "p1 = 1 #Pressures(in bar):\n",
      "p2 = 4\n",
      "p3 = 16\n",
      "n = 1.3 #Index of compression:\n",
      "R = 0.287 #Gas constant(in kJ/kg.K):\n",
      "T1 = 17+273 #Temperature(in K):\n",
      "nv = 0.90 #Volumetric efficiency:\n",
      "Dhp = 0.06 #Bore diameters(in m):\n",
      "Dlp = 0.12\n",
      "\n",
      "#Calculations:\n",
      "W = n/(n-1)*R*T1*((p2/p1)**((n-1)/n)+(p3/p2)**((n-1)/n)-2) #Work required(in kJ/kg):\n",
      "\n",
      "#Results: \n",
      "print \"Work: \",round(W,2),\"kJ/kg\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Work:  271.95 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8, page no. 752"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "from math import sqrt,log\n",
      "\n",
      "#Variable Declaration: \n",
      "N = 200 #Speed(in rpm):\n",
      "m = 4      #Mass flow rate(in kg/min):\n",
      "p1 = 1 #Pressure(in bar):\n",
      "p6 = 25\n",
      "T1 = 17+273 #Temperatures(in K):\n",
      "Clp = 0.04 #Clearance volumes:\n",
      "Chp = 0.05\n",
      "n = 1.25 #Index of compression:\n",
      "R = 0.287 #Gas constant(in kJ/kg.K):\n",
      "Cp = 1.0032 #Specific heat(in kJ/kg.K):\n",
      "\n",
      "#Calculations:\n",
      "T5 = T1\n",
      "r = sqrt(p6/p1) #Pressure ratio:\n",
      "T2 = T1*r**((n-1)/n) #Temperature at state 2(in K):\n",
      "T6 = T5*r**((n-1)/n) #Temperature at state 6(in K):\n",
      "W = 2*n/(n-1)*m*R*T1*(r**((n-1)/n)-1) #Actual compression work requirement(in kJ/min):\n",
      "Wi = m*R*T1*log(p6/p1) #Work required if process is isothermal(in kJ/min):\n",
      "ni = Wi/W #Isothermal efficiency:\n",
      "Vf = m*R*T1/(p1*10**2)#Free air delivered(in m**3/min):\n",
      "Q = W/2-m*Cp*(T2-T1) #Heat transferred in HP & LP cylinder(in kJ/min):\n",
      "nvhp = 1+Chp-Chp*r**(1/n) #Volumetric efficiency of HP cylinder:\n",
      "nvlp = 1+Clp-Clp*r**(1/n) #Volumetric efficiency of LP cylinder:\n",
      "Vshp = Vf/(r*N*nvhp) #Stroke volume of HP cylinder(in m**3):\n",
      "Vchp = Chp*Vshp #Clearance volume Of HP cylinder(in m**3):\n",
      "Vthp = Vshp+Vchp #Total HP cylinder volume(in m**3):\n",
      "Vslp = Vf/(N*nvlp) #Stroke volume of LP cylinder(in m**3):\n",
      "Vclp = Clp*Vslp #Clearance volume of LP cylinder(in m**3):\n",
      "Vtlp = Vslp+Vclp #Total LP cylinder volume(in m**3):\n",
      "\n",
      "#Results: \n",
      "print \"Power required: \",round(W/(60*0.7457),2),\"hp\"\n",
      "print \"Isothermal efficiency: \",round(ni*100,2),\"%\"\n",
      "print \"Free air delivered: \",round(Vf,2),\"m^3/min\"\n",
      "print \"Heat transferred in HP & LP cylinder: \",round(Q,2),\"kJ/min\"\n",
      "print \"HP cylinder volume: \",round(Vthp*10**3,3),\" x 10^-3 m^3\"\n",
      "print \"LP cylinder volume: \",round(Vtlp,6),\"m**3\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Power required:  28.26 hp\n",
        "Isothermal efficiency:  84.77 %\n",
        "Free air delivered:  3.33 m^3/min\n",
        "Heat transferred in HP & LP cylinder:  190.2 kJ/min\n",
        "HP cylinder volume:  4.024  x 10^-3 m^3\n",
        "LP cylinder volume:  0.019342 m**3\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9, page no. 755"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      " \n",
      "from math import sqrt,pi\n",
      "\n",
      "#Variable Declaration: \n",
      "N = 200 #Speed(in rpm):\n",
      "n = 1.2 #Index of compression:\n",
      "R = 0.287 #Gas constant(in kJ/kg.K):\n",
      "Cp = 1.0032 #Specific heat(in kJ/kg.K):\n",
      "D = 0.30 #Bore(in m):\n",
      "L = 0.40 #Stroke(in m):\n",
      "C = 0.05 #Clearance volume:\n",
      "p1 = 1 #Pressure(in bar):\n",
      "p5 = 2.9\n",
      "p6 = 9\n",
      "T1 = 25+273 #Temperatures(in K):\n",
      "\n",
      "#Calculations:\n",
      "T5 = T1\n",
      "p2 = sqrt(p6/p1) #Optimum intercooling pressure(in bar):\n",
      "Vlp = pi*D**2/4*L*N*2   #Volume of LP cylinder(in m**3/min):\n",
      "nvlp = 1+C-C*(p2/p1)**(1/n) #Volumetric efficiency:\n",
      "V1 = Vlp*nvlp #Volume of air inhaled in LP stage(in m**3/min):\n",
      "m = p1*10**2*V1/(R*T1) #Mass of air per minute(in kg/min):\n",
      "T2 = T1*(p2/p1)**((n-1)/n) #Temperature after compression(in K):\n",
      "V5 = m*R*T5/(p5*10**2) #Volume of air going into HP cylinder(in m**3/min):\n",
      "nvhp = nvlp\n",
      "Vhp = V5/nvhp #Volume of HP cylinder(in m**3/min):\n",
      "Dhp = sqrt(Vhp*4/(pi*L*2*N))   #Diameter of bore(in m):\n",
      "Q = m*Cp*(T2-T5) #Heat rejected in intercooler(in kJ/min):\n",
      "T6 = T5*(p6/p5)**((n-1)/n) #Temperature at state 6(in K):\n",
      "Whp = n/(n-1)*m*R*(T6-T5)/(60*0.7457)#Work input required for HP stage(in kJ/min):\n",
      "\n",
      "#Results: \n",
      "print \"Heat rejected in intercooler: \",round(Q,2),\"kJ/min\"\n",
      "print \"Bore of HP cylinder: \",round(Dhp*100,2),\"cm\"\n",
      "print \"Horse power required to drive HP stage: \",round(Whp,2),\"hp\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat rejected in intercooler:  734.86 kJ/min\n",
        "Bore of HP cylinder:  17.62 cm\n",
        "Horse power required to drive HP stage:  29.15 hp\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10, page no. 757"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "from math import pi, sqrt\n",
      "\n",
      "#Variable Declaration: \n",
      "h = 75.6 #Barometer reading(in cm):\n",
      "d = 0.013591 #Density of mercury(in kg/cm**3):\n",
      "d1 = 15*10**(-3) #Diameter of orifice(in m):\n",
      "r1 = 0.65 #Coefficient of discharge:\n",
      "g = 9.81 #Acceleration due to gravity(in m/s**2):\n",
      "T = 25+273 #Atmospheric temperature(in K):\n",
      "h1 = 13 #Manometer reading(in cm):\n",
      "R = 0.287\n",
      "\n",
      "#Calculations:\n",
      "A = pi*d1**2/4   #Cross-sectional area of orifice(in m**2):\n",
      "p = h*d*g*10 #Atmospheric pressure(in kPa):\n",
      "v = (R*T)/p #Specific volume at atmospheric conditions(in m**3/kg):\n",
      "da = 1/v #Density of air(in kg/m**3):\n",
      "pd = h1*d*g*10 #Pressure difference across orifice(in kPa):\n",
      "ha = pd*10**3/(da*g) #Height of air column(in m):\n",
      "f = r1*A*sqrt(2*g*ha)*60 #Free air delivery(in m**3/min):\n",
      "\n",
      "#Results: \n",
      "print \"Free air delivery: \",round(f,3),\"m**3/min\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Free air delivery:  1.182 m**3/min\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11, page no. 757"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "  \n",
      "from math import pi\n",
      "#Variable Declaration: \n",
      "D = 0.10 #Bore(in m):\n",
      "L = 0.08 #Stroke(in m):\n",
      "N = 500 #Speed(in rpm):\n",
      "g = 9.81 #Acceleration due to gravity(in m/s**2):\n",
      "T = 27+273 #Atmospheric temperature(in K):\n",
      "r = 0.30 #Radius of arm of spring balance(in m):\n",
      "nm = 0.90 #Mechanical efficiency:\n",
      "f = 15/60 #Free air delivery(in m**3/min):\n",
      "\n",
      "#Calculations:\n",
      "V = pi*D**2*L/4 #Volume of cylinder(in m**3):\n",
      "nv = f/(V*N)*100 #Volumetric efficiency:\n",
      "W = 2*pi*N*100*g*r*10**(-3)/(60*0.7457) #Shaft output(in hp):\n",
      "W1 = W/f #Shaft output per m**3 of free air per min:\n",
      "\n",
      "#Results: \n",
      "print \"Volumetric efficiency: \",round(nv,2),\"%\"\n",
      "print \"Shaft output per m**3 of free air: \",round(W1,2),\"hp per m**3 of free air per minute\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Volumetric efficiency:  79.58 %\n",
        "Shaft output per m**3 of free air:  82.66 hp per m**3 of free air per minute\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12, page no. 758"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "from math import log\n",
      "\n",
      "#Variable Declaration: \n",
      "p2 = 180 #Pressures(in bar):\n",
      "p1 = 1\n",
      "T1 = 300 #Temperatures(in K):\n",
      "T2 = 273+150\n",
      "n = 1.25 #Index of polytropic compression:\n",
      "\n",
      "#Calculations:\n",
      "i = (n-1)/n*log(p2/p1)/log(T2/T1) #Number of stages:\n",
      "\n",
      "#Results: \n",
      "print \"Number of stages: \",round(i) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Number of stages:  3.0\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13, page no. 759"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "from math import pi\n",
      "\n",
      "#Variable Declaration: \n",
      "p1 = 1 #Pressures(in bar):\n",
      "p10 = 20\n",
      "T1 = 300 #Temperatures(in K):\n",
      "C = 0.04 #Clearance:\n",
      "D = 0.30 #Bore(in m):\n",
      "L = 0.20 #Stroke(in m):\n",
      "n = 1.25 #Index of compression:\n",
      "R = 0.287 #Gas constant(in kJ/kg.K):\n",
      "\n",
      "#Calculations:\n",
      "T5 = T1\n",
      "T9 = T1\n",
      "p2 = p1*(20)**(1/3) #Pressure at stage 2(in bar):\n",
      "p6 = p10/(20**(1/3))\n",
      "nvlp = 1+C-C*(p2/p1)**(1/n) #Volumetric efficiency of LP stage:\n",
      "Vs = pi*D**2/4*L   #LP swept volume(in m**3):\n",
      "Vsa = nvlp*Vs #Effective swept volume(in m**3):\n",
      "T10 = T9*(p10/p6)**((n-1)/n) #Temperature of air delivered(in K):\n",
      "Vd = p1/p10*Vsa*T10/T1 #Volume of air delivered(in m**3):\n",
      "W = 3*(n/(n-1))*R*T1*((p2/p1)**((n-1)/n)-1) #Total work done(in kJ/kg of air):\n",
      "\n",
      "#Results:\n",
      "print \"Intermediate pressure: \",round(p2,3),\"bar\",round(p6,3),\"bar\"\n",
      "print \"Effective swept volume of LP cylinder: \",round(Vsa,5),\"m**3\"\n",
      "print \"Temperature of air delivered: \",round(T10,2),\"K\"\n",
      "print \"Volume of air delivered: \",round(Vd*10**4,4),\" x 10^-4 m**3\"\n",
      "print \"Work done: \",round(W,2),\"kJ/kg of air\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Intermediate pressure:  2.714 bar 7.368 bar\n",
        "Effective swept volume of LP cylinder:  0.01345 m**3\n",
        "Temperature of air delivered:  366.32 K\n",
        "Volume of air delivered:  8.2089  x 10^-4 m**3\n",
        "Work done:  285.49 kJ/kg of air\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14, page no. 760"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "from math import log\n",
      "\n",
      "#Variable Declaration: \n",
      "p1 = 1 #Pressures(in bar):\n",
      "p2 = 6\n",
      "p6 = 30\n",
      "T6 = 273+150 #Temperatures(in K):\n",
      "T5 = 273+35\n",
      "T1 = 300\n",
      "Clp = 0.05 #Clearance volumes:\n",
      "Chp = 0.07\n",
      "m = 2     #Mass flow rate(in kg/s):\n",
      "R = 0.287 #Gas constant(in kJ/kg.K):\n",
      "Cp = 1.0032 #Specific heat(in kJ/kg.K):\n",
      "Cv = 0.72\n",
      "r = 1.4 #Adiabatic index of compression:\n",
      "\n",
      "#Calculations:\n",
      "p5 = p2\n",
      "n = 1/(1-log(T6/T5)/log(p6/p5)) #Index of compression:\n",
      "nvlp = 1+Clp-Clp*(p2/p1)**(1/n) #Volumetric efficiency of LP cylinder:\n",
      "nvhp = 1+Chp-Chp*(p6/p5)**(1/n) #Volumetric efficiency of HP cylinder:\n",
      "Vslp = m*R*T1*60/(p1*10**2*nvlp) #Swept volume of LP cylinder(in m**3/min):\n",
      "Vshp = m*R*T5*60/(p2*10**2*nvhp) #Swept volume of HP cylinder(in m**3/min):\n",
      "T2 = T1*(p2/p1)**((n-1)/n) #Temperature at state 2(in K):\n",
      "Q = m*Cp*(T2-T5)#Cooling required in intercooler(in kW):\n",
      "W = n/(n-1)*m*R*((T1*((p2/p1)**((n-1)/n)-1))+(T5*((p6/p5)**((n-1)/n)-1)))#Work input required(in kW):\n",
      "Qlp = m*(r-n)/(n-1)*Cv*(T2-T1)#Heat transferred in LP cylinder(in kW):\n",
      "Qhp = m*(r-n)/(n-1)*Cv*(T6-T5) #Heat transferred in HP cylinder(in kW):\n",
      "\n",
      "#Results: \n",
      "print \"Swept volume of LP cylinder: \",round(Vslp,2),\"m**3/min\"\n",
      "print \"Swept volume of HP cylinder: \",round(Vshp,2),\"m**3/min\"\n",
      "print \"Heat picked up in the intercooler: \",round(Q,2),\"kW\"\n",
      "print \"Total work required: \",round(W,2),\"kW\"\n",
      "print \"Amount of cooling required in LP cylinder: \",round(Qlp,2),\"kW\"\n",
      "print \"Amount of cooling required in HP cylinder: \",round(Qhp,2),\"kW\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Swept volume of LP cylinder:  123.11 m**3/min\n",
        "Swept volume of HP cylinder:  21.69 m**3/min\n",
        "Heat picked up in the intercooler:  238.94 kW\n",
        "Total work required:  704.91 kW\n",
        "Amount of cooling required in LP cylinder:  115.13 kW\n",
        "Amount of cooling required in HP cylinder:  104.18 kW\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15, page no. 763"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "   \n",
      "#Variable Declaration: \n",
      "p2 = 2 #Pressures(in bar):\n",
      "p1 = 1\n",
      "V1 = 0.5 #Volume(in m**3):\n",
      "r = 1.4 #Adiabatic index of compression:\n",
      "\n",
      "#Calculations:\n",
      "Wr = (p2-p1)*10**2*V1 #IP required(in kW):\n",
      "Wi = r/(r-1)*p1*10**2*V1*((p2/p1)**((r-1)/r)-1)#IP when isentropic compression occurs(in kW):\n",
      "ni = Wi/Wr*100 #Isentropic efficiency:\n",
      "\n",
      "#Results: \n",
      "print \"Indicated power of roots blower: \",round(Wr/0.7457,2),\"hp\"\n",
      "print \"Isentropic efficiency: \",round(ni,2),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Indicated power of roots blower:  67.05 hp\n",
        "Isentropic efficiency:  76.65 %\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16, page no. 764"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "#Variable Declaration: \n",
      "V1 = 0.6 #Volume flow rate(in m**3/kg):\n",
      "p1 = 1 #Pressures(in bar):\n",
      "p2a = 2.3\n",
      "r = 1.4\n",
      "r1 = 0.7#Ratio of V1/V2:\n",
      "\n",
      "#Calculations:    \n",
      "p2 = p1*(1/r1)**r #Pressure at state 2(in bar):\n",
      "Wv = (r/(r-1)*p1*10**2*V1*((p2/p1)**((r-1)/r)-1)+(p2a-p2)*10**2*V1*r1)/0.7457#IP required for vaned compressor(in hp):\n",
      "Wi = (r/(r-1)*p1*10**2*V1*((p2a/p1)**((r-1)/r)-1))/0.7457 #Power requirement when compression occurs isentropically(in hp):\n",
      "ni = Wi/Wv*100 #Isentropic efficiency:\n",
      "\n",
      "#Results: \n",
      "print \"Indicated power required: \",round(Wv,3),\"hp\"\n",
      "print \"Isentropic efficiency: \",round(ni,2),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Indicated power required:  79.928 hp\n",
        "Isentropic efficiency:  94.66 %\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 17, page no. 765"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "#Variable Declaration: \n",
      "T0 = 300 #Temperature(in K):\n",
      "V1 = 50 #Velocity(in m/s):\n",
      "m = 18 #Mass flow rate(in kg/min):\n",
      "Cp = 1.0032 #Specifc heat(in kJ/kg.K):\n",
      "nm = 0.90 #Mechanical efficiency:\n",
      "ni = 0.75 #Isentropic efficiency:\n",
      "r1 = 4 #Pressure ratio:\n",
      "r = 1.4 #Adiabatic index of compression:\n",
      "\n",
      "#Calculations:\n",
      "T1 = T0+V1**2/(2*Cp*10**3) #Stagnation temperature(in K):\n",
      "T2a = T1*r1**((r-1)/r)\n",
      "T2 = (T2a-T1)/ni+T1\n",
      "BP = m*Cp*(T2-T1)/(60*nm*0.7457) #Brake power required(in hp):\n",
      "    \n",
      "#Results: \n",
      "print \"Total head temperature at exit: \",round(T2,2),\"K\"\n",
      "print \"Brake power required: \",round(BP,2),\"hp\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total head temperature at exit:  496.45 K\n",
        "Brake power required:  87.54 hp\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 18, page no. 766"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "#Variable Declaration: \n",
      "V = 0.015 #Piston printlacement per revolution(in m**3/rev):\n",
      "N = 500 #Speed(in rpm):\n",
      "C = 0.05 #Clearance:\n",
      "p2 = 6 #Pressures(in bar):\n",
      "n = 1.3 #Index of compression:\n",
      "R = 0.287 #Gas constant(in kJ/kg.K):\n",
      "T1 = 20+273 #Temperature(in K):\n",
      "r = 1.4 #Adiabatic index of compression:\n",
      "Cv = 0.718 #Value of Cv(in kJ/kg.K):\n",
      "\n",
      "#Calculations:\n",
      "p1 = 1\n",
      "nv = 1+C-C*(p2/p1)**(1/n) #Volumetric efficiency:\n",
      "Vs = V*2*N #Swept volume(in m**3/min):\n",
      "V1 = Vs*0.85 #Actual air inhaled(in m**3/min):\n",
      "m = p1*10**2*V1/(R*T1) #Mass of air entering(in kg/min):\n",
      "P = n/(n-1)*p1*10**2*V1*((p2/p1)**((n-1)/n)-1)#Power required(in kJ/min):\n",
      "T2 = 298*(p2/p1)**((n-1)/n) #Temperature at state 2(in K):\n",
      "Q = m*Cv*(r-n)/(n-1)*(T2-T1) #Heat transferred during compression(in kJ/min):\n",
      "\n",
      "#Results: \n",
      "print \"Volumetric efficiency: \",round(nv*100,2),\"%\"\n",
      "print \"Power required: \",round(P,2),\"kJ/min\"\n",
      "print \"Heat rejected during compression: \",round(Q,2),\"kJ/min\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Volumetric efficiency:  85.16 %\n",
        "Power required:  2829.21 kJ/min\n",
        "Heat rejected during compression:  571.89 kJ/min\n"
       ]
      }
     ],
     "prompt_number": 39
    }
   ],
   "metadata": {}
  }
 ]
}