summaryrefslogtreecommitdiff
path: root/Applied_Thermodynamics_by_Onkar_Singh/Chapter18.ipynb
blob: a243ce8db1ffc251554d139908d62f2b6b6ca6ef (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:59b1fc8c8d34f6daf41da52caf7a93f8b68598a246de207d874cbeb5751e9b6d"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 18: Introduction to Refrigeration and Airconditioning"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1, page no. 838"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "#Variable Declaration: \n",
      "Q1 = 500 #Heat extracted by carnot cycle(in kJ/min):\n",
      "T1 = -16+273 #Temperature of refrigerated space(in K):\n",
      "T2 = 27+273 #Atmospheric temperature(in K):\n",
      "\n",
      "#Calculations:\n",
      "Q2 = Q1*(T2/T1) #Heat rejected(in kJ/min):\n",
      "W = Q2-Q1 #Work input required(in kJ/min):\n",
      "\n",
      "#Results: \n",
      "print \"Work input: \",round(W,2),\"kJ/min\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Work input:  83.66 kJ/min\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2, page no. 838"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "#Variable Declaration: \n",
      "T1 = -5+273 #Operating temperature(in K):\n",
      "T2 = 27+273\n",
      "Cpw = 4.18 #Specific heats(in kJ/kg.K):\n",
      "L = 335 #Latent heat(in kJ/kg):\n",
      "C = 800 #Capacity(in tons):\n",
      "\n",
      "#Calculations:\n",
      "q = C*3.5 #Heat extraction rate(in kJ/s):\n",
      "q1 = Cpw*(27-0)+L #Heat to be removed per kg of water(in kJ/kg):\n",
      "m = q/q1 #Ice formation rate(in kg/s):\n",
      "COP = (T1/(T2-T1)) #COP:\n",
      "W = q/COP/0.7457 #Work done(in hp):\n",
      "\n",
      "\n",
      "print \"Mass rate of ice formation: \",round(m,2),\"kg/s\"\n",
      "print \"HP required: \",round(W,2),\"hp\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mass rate of ice formation:  6.25 kg/s\n",
        "HP required:  448.34 hp\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3, page no. 839"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "  \n",
      "#Variable Declaration: \n",
      "W = 3 #Work done(in hp):\n",
      "T1 = -27+273 #Temperature to be maintained(in K):\n",
      "\n",
      "#Calculations:\n",
      "COP = 1*3.5/(W*0.7457)#COP:\n",
      "T2 = T1+T1/COP #Temperature of surroundings(in K):\n",
      "\n",
      "#Results: \n",
      "print \"COP: \",round(COP,2)\n",
      "print \"Temperature of surroundings: \",round(T2,2),\"K\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "COP:  1.56\n",
        "Temperature of surroundings:  403.24 K\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4, page no. 839"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "#Variable Declaration: \n",
      "r1 = 8 #Pressure ratio:\n",
      "T1 = -33+273 #Operating temperatures(in K)\n",
      "T3 = 27+273\n",
      "nic = 0.85 #Isentropic efficiency of compression:\n",
      "nie = 0.90 #Isentropic efficiency of expansion:\n",
      "Cp = 1.005 #Specific heat(in kJ/kg):\n",
      "r = 1.4 #Adiabatic index of compression:\n",
      "m = 1  #Air flow rate(in kg/s):\n",
      "\n",
      "#Calculations:\n",
      "T2a = T1*(r1)**((r-1)/r) #Temperature at state 2'(in K):\n",
      "T2 = (T2a-T1)/nic+T1 #Temperature at state 2(in K):\n",
      "T4a = T3*(1/r1)**((r-1)/r) #Temperature at state 4'(in K):\n",
      "T4 = T3-(T3-T4a)*nie #Temperature at state 2'(in K):\n",
      "Wc = Cp*(T2-T1) #Work during compression(in kJ/s):\n",
      "Wt = Cp*(T3-T4) #Work during expansion(in kJ/s):\n",
      "Qref = Cp*(T1-T4) #Refrigeration effect(in kJ/s):\n",
      "W = Wc-Wt #Net work required(in kJ/s):\n",
      "COP = Qref/W #COP:\n",
      "\n",
      "#Results: \n",
      "print \"Refrigeration capacity: \",round(Qref,2),\"kJ/s\"\n",
      "print \"COP: \",round(COP,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Refrigeration capacity:  61.25 kJ/s\n",
        "COP:  0.56\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5, page no. 840"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "   \n",
      "\n",
      "#Variable Declaration: \n",
      "T1 = 7+273 #Operating temperatures(in K)\n",
      "T3 = 27+273\n",
      "p1 = 1 #Pressures(in bar):\n",
      "p2 = 5\n",
      "r = 1.4 #Adiabatic index of compression:\n",
      "Cp = 1.005 #Specific heat(in kJ/kg):\n",
      "T2 = T1*(p2/p1)**((r-1)/r) #Temperature at state 2(in K):\n",
      "T4 = T3/((p2/p1)**((r-1)/r)) #Temperature at state 4(in K):\n",
      "Q23 = Cp*(T2-T3) #Heat rejected in process 2-3(in kJ/kg):\n",
      "Q41 = Cp*(T1-T4) #Heat picked during process 4-1(in kJ/kg):\n",
      "W = Q23-Q41 #Net work(in kJ/kg):\n",
      "COP = Q41/W #COP:\n",
      "\n",
      "#Results: \n",
      "print \"COP: \",round(COP,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "COP:  1.71\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6, page no. 841"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "   \n",
      "\n",
      "#Variable Declaration: \n",
      "p1 = 1 #Pressure(in bar):\n",
      "p2 = 5.5\n",
      "T1 = -10+273 #Operating temperatures(in K):\n",
      "T3 = 27+273\n",
      "m = 0.8 #Air flow rate(in kg/s):\n",
      "Cp = 1.005 #Specific heat(in kJ/kg):\n",
      "r = 1.4 #Adiabatic index of compression:\n",
      "R = 0.287 #Gas constant(in kJ/kg.K):\n",
      "\n",
      "#Calculations:\n",
      "T2 = T1*(p2/p1)**((r-1)/r) #Temperature at state 2(in K):\n",
      "T4 = T3/((p2/p1)**((r-1)/r)) #Temperature at state 4(in K):\n",
      "C = m*Cp*(T1-T4) #Refrigeration capacity(in kJ/s):\n",
      "Wc = m*r/(r-1)*R*(T2-T1) #Work required to run the comoressor(in kJ/s):\n",
      "W = m*Cp*((T2-T3)-(T1-T4)) #Net work input(in kJ/s):\n",
      "COP = C/W #COP:\n",
      "\n",
      "#Results: \n",
      "print \"Refrigeration capacity: \",round(C,2),\"kJ/s\"\n",
      "print \"HP required to run compressor: \",round(Wc/0.7457,2),\"hp\"\n",
      "print \"COP: \",round(COP,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Refrigeration capacity:  63.25 kJ/s\n",
        "HP required to run compressor:  177.86 hp\n",
        "COP:  1.59\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7, page no. 843"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      " \n",
      "\n",
      "#Variable Declaration: \n",
      "p1 = 1.2 #Pressure(in bar):\n",
      "p6 = p1\n",
      "p3 = 4\n",
      "p2 = p3\n",
      "p4 = 1\n",
      "p7 = 0.9\n",
      "T1 = 288 #Temperatures(in K):\n",
      "T6 = T1\n",
      "T5 = 25+273\n",
      "T3 = 323\n",
      "T8 = 30+273\n",
      "n = 1.45\n",
      "n1 = 1.3\n",
      "T2 = T1*(p2/p1)**((n-1)/n) #Temperature at state 2(in K):\n",
      "T2 = 418.47\n",
      "Cp = 1.005\n",
      "\n",
      "#Calculations:    \n",
      "T4 = T3*(p4/p3)**((n1-1)/n1) #Temperature at state 4(in K):\n",
      "T4 = 234.57\n",
      "m = 10*3.5/(Cp*(T5-T4)) #Refrigeration effect(in kg/s):\n",
      "T7 = T6*(p7/p6)**((n1-1)/n1) #Temperature at state 7(in K):\n",
      "rm = m*(T2-T3)/(T8-T7)+m #Ram air mass flow rate(in kg/s):\n",
      "W = m*Cp*(T2-T1) #Work input to the compressor(in kJ/s):\n",
      "COP = 10*3.5/W #COP:\n",
      "\n",
      "#Results: \n",
      "print \"Air mass flow rate in cabin: \",round(m,2),\"kg/s\"\n",
      "print \"Ram air mass flow rate: \",round(rm,2),\"kg/s\"\n",
      "print \"COP: \",round(COP,3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Air mass flow rate in cabin:  0.55 kg/s\n",
        "Ram air mass flow rate:  2.11 kg/s\n",
        "COP:  0.486\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8, page no. 844"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "#Variable Declaration: \n",
      "p0 = 0.9 #Pressures(in bar):\n",
      "p1 = 1\n",
      "p2 = 4\n",
      "p3 = p2\n",
      "p4 = p3\n",
      "p5 = 1.03\n",
      "T6 = 298 #Temperatures(in K):\n",
      "T0 = 276\n",
      "Cp = 1.005 #Specific heat(in kJ/kg):\n",
      "r = 1.4 #Adiabatic index of compression:\n",
      "C = 15  #Refrigeration capacity:\n",
      "nic = 0.9 #Isentropic efficiency for compressor:\n",
      "nit = 0.8 #Isentropic efficiency for turbine:\n",
      "\n",
      "#Calculations:\n",
      "T1 = T0*(p1/p0)**((r-1)/r) #Temperature at state 1(in K):\n",
      "T2a = T1*(p2/p1)**((r-1)/r) #Temperature at state 2'(in K):\n",
      "T2 = T1+(T2a-T1)/nic #Temperature at state 2(in K):\n",
      "T3 = 0.34*T2 #Temperature at state 3(in K):\n",
      "T4 = T3-10 #Temperature at state 4(in K):\n",
      "T5a = T4*(p5/p4)**((r-1)/r) #Temperature at state 5'(in K):\n",
      "T5 = T4-(T4-T5a)*nit #Temperature at state 5(in K):\n",
      "m = C*3.5/(Cp*(T6-T5)) #Mass flow rate(in kg/s):\n",
      "W = m*Cp*(T2-T1) #Work input(in kJ/s):\n",
      "COP = C*3.5/W #COP:\n",
      "\n",
      "#Results: \n",
      "print \"COP: \",round(COP,2)\n",
      "print \"HP required: \",round(W/0.7457,2),\"hp\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "COP:  1.27\n",
        "HP required:  55.51 hp\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9, page no. 846"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "\n",
      "#Variable Declaration: \n",
      "T1 = -15+273\t\t #Operating temperatures(in K):\n",
      "T2 = 25+273\n",
      "h2 = 1317.95            #kJ/kg  \n",
      "s2 = 4.4809             #kJ/kg.K\n",
      "h3 = 99.94              #kJ/kg\n",
      "s3 = 0.3386             #kJ/kg.K\n",
      "h9 = -54.51             #kJ/kg\n",
      "s9 = -0.2132            #kJ/kg.K\n",
      "s4 = 0.3855             #kJ/kg.K\n",
      "\n",
      "#Calculations:\n",
      "h4 = h3\n",
      "s8 = s3\n",
      "s1 = s2\n",
      "C = T1*(s1-s4)\t\t\t\t      #Refrigeration effect(in kJ/kg):\n",
      "W = h3-h9-T1*(s3-s9)+(T2-T1)*(s1-s8)\t#Work done(in kJ/kg):\n",
      "COP = C/W\t\t\t\t           #COP:\n",
      "\n",
      "#Results: \n",
      "print \"COP: \",round(COP,2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "COP:  5.94\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10, page no. 848"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from math import e\n",
      "\n",
      "#Variable Declaration: \n",
      "T1 = -20+273\t\t\t#Operating temperature(in K):\n",
      "T3 = 40+273\n",
      "p2 = 9.61\t\t\t\t#Pressures(in bar):\n",
      "p1 = 1.51\n",
      "n = 1.13\n",
      "N = 1200\t\t\t\t#Speed(in rpm):\n",
      "h1 = 178.61                 #kJ/kg\n",
      "h3 = 73.53                  #kJ/kg\n",
      "h4 = h3\n",
      "s1 = 0.7082                 #kJ/kg.K\n",
      "s2 = s1\n",
      "sg = 0.682                  #kJ/kg.K\n",
      "Cpg = 0.747                 #kJ/kg.K\n",
      "hg = 203.05                 #kJ/kg\n",
      "vg = 0.1088                 #m**3/kg\n",
      "m1 = 2.86                   #ton\n",
      "C = 0.02\t\t\t     #Clearance volume:\n",
      "\n",
      "#Calculations:\n",
      "T2 = T3*(e)**((s1-sg)/Cpg)\t#Temperature of state 2(in K):\n",
      "h2 = hg+Cpg*(T2-T3)\t\t#Enthalpy after compression(in kJ/kg):\n",
      "Wc = h2-h1\t\t\t\t#Compression work(in kJ/kg):\n",
      "r = h1-h4\t\t\t\t#Refrigeration effect(in kJ/kg):\n",
      "m = m1*3.5/r\t\t\t#Mass flow rate(in kg/s):\n",
      "COP = r/Wc\t\t\t\t#COP:\n",
      "nv = 1+C-C*(p2/p1)**(1/n)\t\t\t\t#Volumetric efficiency:\n",
      "V = m*60*vg/(nv*N)\t\t\t\t#Piston printlacement(in m**3):\n",
      "\n",
      "#Results: \n",
      "print \"COP: \",round(COP,3)\n",
      "print \"Piston printlacement: \",round(V*10**6,2),\"cm**3\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "COP:  3.205\n",
        "Piston printlacement:  565.05 cm**3\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11, page no. 850"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      " \n",
      "\n",
      "#Variable Declaration: \n",
      "#From steam tables:\n",
      "h1 = 322.28                 #kJ/kg\t\t\t\t\n",
      "h2 = 342.32                 #kJ/kg\n",
      "s2 = 1.1937                 #kJ/kg.K\n",
      "x1 = 0.961\n",
      "h1 = 312.08                 #kJ/kg\n",
      "h3 = 144.11                 #kJ/kg\n",
      "h4 = 115.22                 #kJ/kg\n",
      "m1 = 2\t\t\t\t#Refrigeration effect(in kW):\n",
      "\n",
      "#Calculations:\n",
      "s1 = s2\n",
      "h5 = h4\n",
      "r = h1-h5\t\t\t\t#Refrigeration effect(in kJ/kg):\n",
      "m = m1/r\t\t\t\t#Refrigerant flow rate(in kg/s):\n",
      "Wc = h2-h1\t\t\t\t#Compressor work(in kJ/kg):\n",
      "COP = r/Wc\t\t\t\t#COP:\n",
      "\n",
      "#Results: \n",
      "print \"COP: \",round(COP,2)\n",
      "print \"Mass flow rate: \",round(m,4),\"kg/s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "COP:  6.51\n",
        "Mass flow rate:  0.0102 kg/s\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12, page no. 851"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "\n",
      "#Variable Declaration: \n",
      "w = 0.016\t\t\t\t#Specific humidity(in gm/kg):\n",
      "pvsat = 0.03098\t\t\t#Saturated partial pressure of vapour(in bar):\n",
      "pv = w/0.622*1.013/(1+w/0.622)#Partial pressure of vapour(in bar):\n",
      "r = pv/pvsat*100\t\t\t#Relative humidity:\n",
      "\n",
      "#Calculations:\n",
      "print \"Partial pressure of vapour: \",round(pv,4)\n",
      "print \"Relative humidity: \",round(r,2),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Partial pressure of vapour:  0.0254\n",
        "Relative humidity:  82.0 %\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13, page no. 852"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "\n",
      "\n",
      "#Variable Declaration: \n",
      "r = 0.6\t\t\t\t#Relavite humidity\n",
      "pvsat = 0.0425\t\t\t#Saturation pressure(in bar):\n",
      "R = 0.287\t\t\t\t#Gas constant(in kJ/kg.K):\n",
      "Ta = 303\t\t\t\t#Surrounding temperature(in K):\n",
      "hg = 2504.1                 #kJ/kg\n",
      "Cp = 1.005\t\t\t\t#Specific heat(in kJ/kg.K):\n",
      "T = 21.4 \t\t\t\t#Dew point temperature(in C) from steam table:\n",
      "pv = 0.0255                #partial pressure of vapour(bar)  from steam table:\n",
      "#Calculations:\n",
      "pa = 1.013-r*pvsat\t\t#Partial pressure of air(in bar):\n",
      "w = 0.622*(pv/(1.013-pv))\t#Humidity ratio:\n",
      "d = 1.013*10**2*(1+w)/(R*Ta)\t#Density of mixture(in kg/m**3):\n",
      "h = Cp*30+w*(hg+1.860*(30-T))#Enthalpy of mixture(in kJ/kg of dry air):\n",
      "\n",
      "#Results: \n",
      "print \"Partial pressure of air: \",round(pa,4),\"bar\"\n",
      "print \"Humidity ratio: \",round(w,5),\"jg/kg of dry air\"\n",
      "print \"Dew point temperature: \",round(T,1),\"\u00b0C\"\n",
      "print \"Density: \",round(d,4),\"kg/m**3\"\n",
      "print \"Enthalpy of mixture: \",round(h,1),\"kJ/kg of air\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Partial pressure of air:  0.9875 bar\n",
        "Humidity ratio:  0.01606 jg/kg of dry air\n",
        "Dew point temperature:  21.4 \u00b0C\n",
        "Density:  1.1836 kg/m**3\n",
        "Enthalpy of mixture:  70.6 kJ/kg of air\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14, page no. 852"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "\n",
      "\n",
      "#Variable Declaration: \n",
      "r = 0.80\t\t\t\t#Relavite humidity\n",
      "#From pyschometric chart:\n",
      "w1 = 0.0086                 #kg/kg of air\t\t\t\t\n",
      "w2 = 0.01                   #kg/kg of air\n",
      "h1 = 37                     #kJ/kg\n",
      "h2 = 50                     #kJ/kg\n",
      "v2 = 0.854                  #m**3/kg\n",
      "\n",
      "#Calculations:\n",
      "m = w2-w1\t\t\t\t#Mass of water added between states 1 and 2:\n",
      "ma = r/v2\t\t\t\t#Mass flow rate:\n",
      "m1 = m*ma\t\t\t\t#Total mass of water added(in kg/s):\n",
      "q = ma*(h2-h1)\t\t\t\t#Heat transferred(in kJ/s):\n",
      "\n",
      "#Results: \n",
      "print \"Mass of water added: \",round(m1,6),\"kg/s\"\n",
      "print \"Heat transferred: \",round(q,2),\"kJ/s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mass of water added:  0.001311 kg/s\n",
        "Heat transferred:  12.18 kJ/s\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15, page no. 853"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "\n",
      "\n",
      "#Variable Declaration: \n",
      "m1 = 3\t\t\t\t#Mass flow rate(in kg/s):\n",
      "m2 = 2\n",
      "Cp = 1.005\t\t\t\t#Specific heat(in kJ/kg.K):\n",
      "Cps = 1.86\t\t\t\t#Specofoc heat of stream(in kJ/kg.K):\n",
      "r1 = 0.30\t\t\t\t#Relative humidity:\n",
      "r2 = 0.85\n",
      "#From psychometric chart:\n",
      "pvsat1 = 0.04246             #bar\t\t\t\t\n",
      "pvsat2 = 0.005628\n",
      "hg1 = 2520.7                 #kJ/kg\n",
      "hg2 = 2559.9                 #kJ/kg\n",
      "T1 = 30                      #\u00b0C\n",
      "Tdp1 = 10.5\n",
      "T2 = 35 \n",
      "Tdp2 = 32\n",
      "\n",
      "#Calculations:\n",
      "pv1 = pvsat1*r1\t\t\t\t#Partial pressure of vapour at 1(in bar):\n",
      "w1 = 0.622*pv1/(1.013-pv1)\t\t#Specific humidity:\n",
      "h1 = Cp*T1+w1*(hg1-Cps*(T1-Tdp1))\t#Enthalpy at state 1(in kJ/kg):\n",
      "pv2 = pvsat2*r2\t\t\t\t#Partial pressure at state 2(in bar):\n",
      "w2 = 0.622*pv2/(1.013-pv2)\t\t#Specific humidity:\n",
      "h1 = Cp*T2+w2*(hg2-Cps*(T2-Tdp2))\t#Enthalpy at state 1(in kJ/kg):\n",
      "mmix = 1/(m1+m2)*(w1*m1/(1+w1)+w2*m2/(1+w2))\t#Mass of vapour:\n",
      "wmix = mmix/(1-mmix)\t\t\t#Specific humidity of mixture:\n",
      "pv = 1.013*wmix/0.622/(1+w1/0.622)\t#Partial pressure of water vapour(in bar):\n",
      "\n",
      "#Results: \n",
      "print \"Specific humidity of mixture: \",round(wmix,5),\"kg/kg of dry air\"\n",
      "print \"Partial pressure of water vapour in mixture: \",round(pv,5),\"bar\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Specific humidity of mixture:  0.00593 kg/kg of dry air\n",
        "Partial pressure of water vapour in mixture:  0.00953 bar\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16, page no. 855"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from __future__ import division\n",
      "\n",
      "\n",
      "#Variable Declaration: \n",
      "r = 3\t\t\t\t#Rate at which air enters(in m**3/s):\n",
      "h1 = 36.4 #kJ/kg\t\t\t\t#From steam tables:\n",
      "h2 = 52 #kJ/kg\n",
      "v1 = 0.825 #m**3/kg\n",
      "\n",
      "#Calculations:\n",
      "m = 3/v1\t\t\t\t#Mass of air(in kg/s):\n",
      "q = m*(h2-h1)\t\t\t\t#Amount of heat added(in kJ/s):\n",
      "\n",
      "#Results: \n",
      "print \"Heat added: \",round(q,2),\"kJ/s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat added:  56.73 kJ/s\n"
       ]
      }
     ],
     "prompt_number": 35
    }
   ],
   "metadata": {}
  }
 ]
}