summaryrefslogtreecommitdiff
path: root/Thermodynamics_Demystified_by_Merle_C_Potter/Chapter6_2.ipynb
blob: 49cfc54d23e9514bcf57b19fe5995c70f3c7bfaf (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
{

 "metadata": {

  "name": "",

  "signature": "sha256:353d9311290d1e9a150d4f5b7334fda96148ffc036b68321a43e559706361c16"

 },

 "nbformat": 3,

 "nbformat_minor": 0,

 "worksheets": [

  {

   "cells": [

    {

     "cell_type": "heading",

     "level": 1,

     "metadata": {},

     "source": [

      "Chapter 6:Power Vapor Cycles"

     ]

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex6.1:PG-146"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "# solution\n",

      "#initialization of variables\n",

      "# Please refer to the given figure in question for quantities\n",

      "P2=2*1000 #higher pressure converted in in kPa\n",

      "P1=10 # lower pressure in kPa\n",

      "rho=1000 # density of water in Kg/m^3\n",

      "h1=192 # enthalpy at state 1 in kJ/kg\n",

      "h3=3248 # enthalpy at state 3 in kJ/kg\n",

      "s3=7.1279# entropy at state 3 in kJ/kg.K\n",

      "\n",

      "#calculation of pump work\n",

      "wp=(P2-P1)/rho # pump work given by equation 4.56 in textbook\n",

      "h2=h1+wp # by enrgy balance b/w state 1 and 2\n",

      "q=h3-h2 # Heat input from 2 to 3\n",

      "\n",

      "s4=s3 # isentropic process\n",

      "sf=0.6491 # entropy of saturated liquid @10 kPa from steam table\n",

      "sg=8.151 # entropy of saturated vapour @10 kPa from steam table\n",

      "x=(s4-sf)/(sg-sf)# from property of pure substance\n",

      "hf=191.8 #enthalpy of saturated liquid @10 kPa from steam table\n",

      "hg=2584 # enthalpy of saturated vapour @10 kPa from steam table\n",

      "h4=hf+x*(hg-hf)# enthalpy @ state 4\n",

      "\n",

      "wt=h3-h4 # turbine work\n",

      "\n",

      "efficiency=(wt-wp)/q # efficiency of power cycle\n",

      "print \" The Efficiency is\",round(efficiency,4),\" or\",round(efficiency*100,1),\"%\"\n",

      "# the answer is correct within limits\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        " The Efficiency is 0.3238  or 32.4 %\n"

       ]

      }

     ],

     "prompt_number": 3

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex6.2:PG-149"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "# solution\n",

      "#initialization of variables\n",

      "# Please refer to the given figure of question 6.1 for quantities\n",

      "effi1=0.323 #old efficiency\n",

      "P2=4*1000 #higher pressure converted in in kPa\n",

      "P1=10 # lower pressure in kPa\n",

      "rho=1000 # density of water in Kg/m^3\n",

      "h1=192 # enthalpy at state 1 in kJ/kg\n",

      "h3=3214 # enthalpy at state 3 i.e @400 degree celsius and 4MPa in kJ/kg\n",

      "s3=6.769# entropy at state 3 i.e @400 degree celsius and 4MPa in kJ/kg.K\n",

      "\n",

      "s4=s3 # insentropic process\n",

      "sf=0.6491 # entropy of saturated liquid @10 kPa from steam table\n",

      "sg=8.151 # entropy of saturated vapour @10 kPa from steam table\n",

      "\n",

      "x=(s4-sf)/(sg-sf)# quality of steam\n",

      "\n",

      "hf=192 #enthalpy of saturated liquid @10 kPa from steam table\n",

      "hg=2584 # enthalpy of saturated vapour @10 kPa from steam table\n",

      "h4=hf+x*(hg-hf)# enthalpy @ state 4\n",

      "h2=h1 # isenthalpic process\n",

      "qb=h3-h2 # heat addition\n",

      "\n",

      "wt=h3-h4 # turbine work\n",

      "\n",

      "effi2=(wt)/qb # efficiency of power cycle\n",

      "\n",

      "print \" The Efficiency is\",round(effi2,3),\" or\",round(effi2*100),\"% \\n\"\n",

      "\n",

      "perincrease=((effi2-effi1)/effi1)*100 \n",

      "\n",

      "print \" The % increase in Efficiency is\",round(perincrease,2),\" \\n\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        " The Efficiency is 0.354  or 35.0 % \n",

        "\n",

        " The % increase in Efficiency is 9.69  \n",

        "\n"

       ]

      }

     ],

     "prompt_number": 8

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex6.3:PG-149"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "# solution\n",

      "#initialization of variables\n",

      "# Please refer to fig of question 6.1 for quantities\n",

      "effi1=0.323 #old efficiency\n",

      "P2=2*1000 #higher pressure converted in in kPa\n",

      "P1=10 # lower pressure in kPa\n",

      "rho=1000 # density of water in Kg/m^3\n",

      "T2=600# max temperature of cycle in degree celsius\n",

      "h1=192 # enthalpy at state 1 in kJ/kg\n",

      "h3=3690 # enthalpy at state 3 in kJ/kg, 600*C and 2MPa pressure\n",

      "s3=7.702# entropy at state 3 in kJ/kg.K, 600*C and 2MPa pressure\n",

      " \n",

      "s4=s3# isentropic process\n",

      "sf=0.6491 # entropy of saturated liquid @10 kPa from steam table\n",

      "sg=8.151 # entropy of saturated vapour @10 kPa from steam table\n",

      "\n",

      "x=(s4-sf)/(sg-sf)# quality of steam\n",

      "\n",

      "hf=192 #enthalpy of saturated liquid @10 kPa from steam table\n",

      "hg=2584 # enthalpy of saturated vapour @10 kPa from steam table\n",

      "h4=hf+x*(hg-hf)# enthalpy @ state 4\n",

      "\n",

      "h2=h1 # isenthalpic process\n",

      "qb=h3-h2 # heat addition\n",

      "\n",

      "wt=h3-h4 # turbine work\n",

      "\n",

      "effi2=(wt)/qb # efficiency of power cycle\n",

      "print \" The Efficiency is\",round(effi2,3),\" or\",round(effi2*100),\"% \\n\"\n",

      "perincrease=((effi2-effi1)/effi1)*100 \n",

      "print \" The % increase in Efficiency is\",round(perincrease,2),\" \\n\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        " The Efficiency is 0.357  or 36.0 % \n",

        "\n",

        " The % increase in Efficiency is 10.56  \n",

        "\n"

       ]

      }

     ],

     "prompt_number": 11

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex6.4:PG-150"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "# solution\n",

      "#initialization of variables\n",

      "# Please refer to fig of question 6.1 for quantities\n",

      "effi1=0.323 #old efficiency\n",

      "P2=2*1000 #higher pressure converted in in kPa\n",

      "P1=4 # condenser pressure in kPa\n",

      "rho=1000 # density of water in Kg/m^3\n",

      "h1=192 # enthalpy at state 1 in kJ/kg\n",

      "h3=3248 # enthalpy at state 3 in kJ/kg\n",

      "s3=7.1279# entropy at state 3 in kJ/kg.K\n",

      "\n",

      "s4=s3 # isentropic process \n",

      "\n",

      "sf=0.4225 # entropy of saturated liquid @10 kPa from steam table\n",

      "sg=8.4754 # entropy of saturated vapour @10 kPa from steam table\n",

      "\n",

      "x=(s4-sf)/(sg-sf)# from property of pure substance\n",

      "\n",

      "hf=121 #enthalpy of saturated liquid @4 kPa from steam table\n",

      "hg=2554 # enthalpy of saturated vapour @4 kPa from steam table\n",

      "h4=hf+x*(hg-hf)# enthalpy @ state 4h1=h2 # isenthalpic process\n",

      "h2=h1 # isenthalpic process\n",

      "qb=h3-h2 # heat addition\n",

      "\n",

      "wt=h3-h4 # turbine work\n",

      "\n",

      "effi2=(wt)/qb # efficiency of power cycle\n",

      "print \" The Efficiency is\",round(effi2,4),\" or\",round(effi2*100),\"% \\n\"\n",

      "perincrease=((effi2-effi1)/effi1)*100 \n",

      "print \" The % increase in Efficiency is\",round(perincrease,2),\" \\n\"\n",

      "\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        " The Efficiency is 0.3603  or 36.0 % \n",

        "\n",

        " The % increase in Efficiency is 11.55  \n",

        "\n"

       ]

      }

     ],

     "prompt_number": 14

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex6.5:PG-152"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "# solution\n",

      "#initialization of variables\n",

      "P2=2*1000 #higher pressure converted in in kPa\n",

      "P1=10 # lower pressure in kPa\n",

      "h1=192.0 # enthalpy at 10 kPa  in kJ/kg\n",

      "h3=3248.0 # enthalpy @ state 3 in kJ/kg from table C.3\n",

      "s3=7.128 # entropy @ state 3 in kJ/kg.K from table C.3\n",

      "s4=s3 # isentropic process\n",

      "\n",

      "h2=h1 #isenthalpic process\n",

      "h4=((s4-7.038)/(7.233-7.038))*(3056-2950)+2950 #using adjacent values for \n",

      "#interpolation from table C.3 \n",

      "h5=3267.0 # enthalpy at 800 kPa and $00 degree celsius\n",

      "s5=7.572 # entropy at 800 kPa and $00 degree celsius\n",

      "\n",

      "s6=s5 # isentropic process\n",

      "sf=0.6491#  entropy of saturated liquid @10 kPa from steam table\n",

      "sg=8.151 # entropy of saturated vapour @10 kPa from steam table\n",

      "\n",

      "x=(s6-sf)/(sg-sf)# quality of steam\n",

      "\n",

      "hf=192.0 #enthalpy of saturated liquid @10 kPa from steam table\n",

      "hg=2585.0 # enthalpy of saturated vapour @10 kPa from steam table\n",

      "\n",

      "h6=hf+x*(hg-hf)# enthalpy @ state 6\n",

      "\n",

      "# we now calculate energy input\n",

      "qb=(h5-h4)+(h3-h2)# heat interaction\n",

      "\n",

      "# we now calculate work output\n",

      "wt=(h5-h6)+(h3-h4)# turbine work\n",

      "\n",

      "eff=(wt)/qb # efficiency of power cycle\n",

      "print\" The Efficiency is\",round(eff,3),\" or\",round(eff*100,2),\"%\"\n",

      "\n",

      "# // The anwer is different in textbook as there the intermediate values are approximated while in python the calculations are precise \n",

      "\n",

      "\n",

      "\n",

      "\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        " The Efficiency is 0.336  or 33.57 %\n"

       ]

      }

     ],

     "prompt_number": 21

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex6.6:PG-155"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "\n",

      "# initialization of variables\n",

      "\n",

      "# Please refer to fig of question 6.1 for quantities\n",

      "\n",

      "effi1=0.357 #efficiency from example 6.3\n",

      "P2=2*1000.0 #higher pressure converted in in kPa\n",

      "P1=10.0 # lower pressure in kPa\n",

      "rho=1000.0 # density of water in Kg/m^3\n",

      "T2=600.0 # max temperature of cycle in degree celsius\n",

      "h1=192.0 # enthalpy at state 1 in kJ/kg\n",

      "h3=3690.0 # enthalpy at state 3 in kJ/kg, 600*C and 2MPa pressure\n",

      "h4=2442.0 # enthalpy from example 6.3\n",

      "h6=505.0 # specific enthalpy @ 200 kPa from steam table\n",

      "h7=h6 # isenthalpic process\n",

      "s3=7.702# entropy at state 3 in kJ/kg.K, 600*C and 2MPa pressure\n",

      "\n",

      "h2=h1 # isenthalpic process\n",

      "s5=s3 # isentropic process\n",

      "h5=(s3-7.509)*(2971-2870)/(7.709-7.509)+2870 # interpolationg from steam table 2 200 kPa using s5=s3= 7.702 kJ/kg.\n",

      "\n",

      "m6=1.0 # let mass of steam =1 Kg\n",

      "m5=(h6-h2)*(m6)/(h5-h2) \n",

      "m2=m6-m5 # conservation of mass\n",

      "\n",

      "wt=h3-h5+(h5-h4)*m2 # work done by turbine\n",

      "qb=h3-h7 # heat given to bolier\n",

      "effi2=(wt)/qb # efficiency of power cycle\n",

      "print \" The Efficiency is\",round(effi2,4),\" or\",round(effi2*100),\"% \\n\"\n",

      "perincrease=((effi2-effi1)/effi1)*100 \n",

      "print \" The % increase in Efficiency is\",round(perincrease,2),\" \\n\"\n",

      "\n",

      "# The anwer is different in textbook as there the intermediate values are approximated while in python the calculations are precise \n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        " The Efficiency is 0.3732  or 37.0 % \n",

        "\n",

        " The % increase in Efficiency is 4.55  \n",

        "\n"

       ]

      }

     ],

     "prompt_number": 27

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex6.7:PG-156"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "# solution\n",

      "#initialization of variables\n",

      "P2=2*1000 #higher pressure converted in  kPa\n",

      "P1=10 # lower pressure in kPa\n",

      "h1=192 # enthalpy at 10 kPa  in kJ/kg\n",

      "h3=3248 # enthalpy @ state 3 in kJ/kg from table C.3\n",

      "s3=7.128 # entropy @ state 3 in kJ/kg.K from table C.3\n",

      "\n",

      "s4=s3 # isentropic process\n",

      "\n",

      "h4=((s4-7.038)/(7.233-7.038))*(3056-2950)+2950 #using adjacent values for \n",

      "#interpolation from table C.3 \n",

      "h5=3267 # enthalpy at 800 kPa and $00 degree celsius\n",

      "s5=7.572 # entropy at 800 kPa and $00 degree celsius\n",

      "\n",

      "s6=s5 # isentropic process\n",

      "sf=0.6491#  entropy of saturated liquid @10 kPa from steam table\n",

      "sg=8.151 # entropy of saturated vapour @10 kPa from steam table\n",

      "\n",

      "x=(s6-sf)/(sg-sf)# quality of steam\n",

      "\n",

      "hf=192 #enthalpy of saturated liquid @10 kPa from steam table\n",

      "hg=2585 # enthalpy of saturated vapour @10 kPa from steam table\n",

      "\n",

      "h6=hf+x*(hg-hf)# enthalpy @ state 6\n",

      "h7=721 # enthalpy of saturated liquid @800 kPa from steam table\n",

      "h8=h7 # isenthalpic process\n",

      "h2=h1 # isenthalpic process\n",

      "\n",

      "m8=1 # let mass of steam =1 Kg\n",

      "m4=(h8-h2)*(m8)/(h4-h2)\n",

      "m2=m8-m4 # conservation of mass\n",

      "\n",

      "wt=h3-h4+(h5-h6)*m2 # work done by turbine\n",

      "qb=h3-h8+(h5-h4)*m2 # heat given to bolier\n",

      "\n",

      "effi=(wt)/qb # efficiency of power cycle\n",

      "# result\n",

      "print \" The Efficiency is\",round(effi,3),\" or\",round(effi*100,2),\"%\"\n",

      "\n",

      "\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        " The Efficiency is 0.347  or 34.7 %\n"

       ]

      }

     ],

     "prompt_number": 28

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex6.8:PG-159"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "# solution\n",

      "#initialization of variables\n",

      "\n",

      "# for rankine cycle refer to fig 6.9\n",

      "\n",

      "effiT=0.8 # turbine efficiency\n",

      "P2=2*1000 # higher pressure converted in  kPa\n",

      "P1=10 # lower pressure in kPa\n",

      "h1=192 # enthalpy at 10 kPa  in kJ/kg\n",

      "h3=3690 # enthalpy of superheated steam @ 2 MPa from steam table in kJ/kg\n",

      "s3=7.702 #entropy of superheated steam @ 2 MPa from steam table in kJ/kg.K\n",

      "# state 4' is repsresented by '41'\n",

      "h2=h1 #isenthalpic process\n",

      "s41=s3 # entropy is constant\n",

      "sf=0.6491 # entropy of saturated liquid @10 kPa from steam table\n",

      "sg=8.151 # entropy of saturated vapour @10 kPa from steam table\n",

      "x=(s41-sf)/(sg-sf)# from property of pure substance\n",

      "\n",

      "hf=191.8 #enthalpy of saturated liquid @10 kPa from steam table\n",

      "hg=2584 # enthalpy of saturated vapour @10 kPa from steam table\n",

      "h41=hf+x*(hg-hf)# enthalpy @ state 41\n",

      "\n",

      "wa=effiT*(h3-h41)# turbine efficiency =(actual work)/(isentropic work)\n",

      "\n",

      "qb=h3-h2 # heat supplied\n",

      "\n",

      "effi=(wa)/qb # efficiency of power cycle\n",

      "print\"  The Efficiency is\",round(effi,3),\" or\",round(effi*100,1),\"%\"\n",

      "\n",

      "h4=h3-wa # adiabatic process\n",

      "\n",

      "# now using interpolation for superheated steam @ 10 kPa\n",

      "T4=(h4-2688)*(150-100)/(2783-2688)+100\n",

      "\n",

      "print \"\\n The Temperature from interpolation comes out to be\",int(T4),\" degree celsius\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "  The Efficiency is 0.286  or 28.6 %\n",

        "\n",

        " The Temperature from interpolation comes out to be 101  degree celsius\n"

       ]

      }

     ],

     "prompt_number": 32

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex6.9:PG-162"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "\n",

      "#initialization of variables\n",

      "\n",

      "# refer to fig 6.10c\n",

      "\n",

      "mdot=0.6 # mass flow rate of refrigerant in kg/sec\n",

      "T1=-24 # evaporator temperature in degree celsius\n",

      "T2=39.39 # condenser temperature in degree celsius\n",

      "h1=232.8 # enthalpy of saturated R134a vapour @ -24 degree celsius from table D.1\n",

      "s1=0.9370 # entropy of saturated R134a vapour @ -24 degree celsius from table D.1\n",

      "h3=105.3 # enthalpy of saturated R134a liquid @ -24 degree celsius from table D.2\n",

      "h4=h3 # isenthalpic process\n",

      "\n",

      "# interpolating enthalpy from table D.3 @ 39.39 degree celsius\n",

      "h2=(s1-0.9066)*(280.19-268.68)/(0.9428-0.9066)+268.68\n",

      "QdotE=mdot*(h1-h4) # heat transfer rate\n",

      "WdotC=mdot*(h2-h1)# power given to compressor\n",

      "\n",

      "COP=QdotE/WdotC # coefficient of performance\n",

      "\n",

      "Hp=(WdotC/0.746)/(QdotE/3.52) #calculating Horsepower required per Ton\n",

      "\n",

      "print \"The rate of refrigeration is\",round(QdotE,2),\"kJ/s \\n \"\n",

      "print \"The coefficient of performance is\",round(COP,2),\"\\n \"\n",

      "print \"The rating in horsepower per ton is\",round(Hp,3),\" hp\\n \"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "The rate of refrigeration is 76.5 kJ/s \n",

        " \n",

        "The coefficient of performance is 2.8 \n",

        " \n",

        "The rating in horsepower per ton is 1.686  hp\n",

        " \n"

       ]

      }

     ],

     "prompt_number": 37

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex6.10:PG-163"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "\n",

      "#initialization of variables\n",

      "# refer to fig 6.10c\n",

      "effi=0.8 # compressor efficiency\n",

      "mdot=0.6 # mass flow rate of refrigerant in Kg/sec\n",

      "T4=-24 # temperature of evaporator\n",

      "T2=39.39 # temperature of condensor\n",

      "T1=-20.0 # supeheating temperature\n",

      "T3=40 # subcooling temperature\n",

      "h3=106.2 # enthalpy of liquid R-134a @ 40 degree celsius from table D.1\n",

      "h4=h3 # isenthalpic process\n",

      "h1=236.5 # enthalpy of superheated R-134a @ 0.10 MPa and -20 degree celsius from table D.3\n",

      "s1=0.960 #entropy of superheated R-134a @ 0.10 MPa and -20 degree celsius from table D.3 \n",

      "\n",

      "s2dash=s1 # isentropic process\n",

      "\n",

      "# using interpolation from table D.3 @ 1.0 MPa for s2dash=0.960 \n",

      "h2dash=(s2dash-0.9428)*(291.36-280.19)/(0.9768-0.9428)+280.19\n",

      "\n",

      "h2=(h2dash-h1)/(effi)+h1 # by definition of compressor efficiency\n",

      "\n",

      "QdotE=mdot*(h1-h4)#heat transfer rate power given to compressor\n",

      " \n",

      "wdotc=mdot*(h2-h1)# power given to compressor\n",

      "\n",

      "COP=QdotE/wdotc # coefficient of performance\n",

      "\n",

      "print \"The rate of refrigeration is\",round(QdotE,1),\"kJ/s \\n \"\n",

      "\n",

      "print \"The coefficient of performance is\",round(COP,2),\"\\n \"\n",

      "# The value of Wdotc is shown wrong in the textbook. It should be multiplied by mass flow rate\n",

      " "

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "The rate of refrigeration is 78.2 kJ/s \n",

        " \n",

        "The coefficient of performance is 2.11 \n",

        " \n"

       ]

      }

     ],

     "prompt_number": 41

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex6.11:PG-165"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "# solution\n",

      "#initialization of variables\n",

      "# refer to fig 6.10c\n",

      "\n",

      "QdotC=300 #heating Load in KWh or heat rejected by condensor\n",

      "T1=-12 # evaporator temperature in degree celsius\n",

      "P2=800 # condensor pressure in kPa \n",

      "h1=240 # specific enthalpy of saturated R-134a vapour @ -12 degree celsius from table D.1\n",

      "s1=0.927 # specific entropy of saturated R-134a vapour @ -12 degree celsius from table D.1\n",

      "s2=s1 # isentropic process\n",

      "h3=93.4 #specific enthalpy of saturated R-134a liquid @ 800 kPa from tableD.2\n",

      "\n",

      "# extrapolating enthalpy from table D.2 @ 0.8 MPa for s=0.927\n",

      "h2=273.7-(0.9374-s2)*(284.4-273.7)/(0.9711-0.9374)\n",

      "\n",

      "# QdotE=mdot*(h1-h4) is heat transfer rate\n",

      "mdot=QdotC/(h2-h3)# mass flow rate\n",

      "\n",

      "WdotC=mdot*(h2-h1)# power given to compressor\n",

      "\n",

      "#part(a)\n",

      "COP=QdotC/WdotC # coefficient of performance\n",

      "print \"The coefficient of performance is\",round(COP,2),\"\\n \"\n",

      "\n",

      "#part(b)\n",

      "Cost=WdotC*0.07 # cost of electricity\n",

      "print \"The cost of electricity is $\",round(Cost,3),\"/hr \\n\"\n",

      "\n",

      "#part(c)\n",

      "costgas=(300*3600*0.50)/100000 # cost of gas\n",

      "print \"The cost of gas is $\",round(costgas,2),\"/hr \\nThus heat pump is better \"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "The coefficient of performance is 5.82 \n",

        " \n",

        "The cost of electricity is $ 3.607 /hr \n",

        "\n",

        "The cost of gas is $ 5.4 /hr \n",

        "Thus heat pump is better \n"

       ]

      }

     ],

     "prompt_number": 66

    }

   ],

   "metadata": {}

  }

 ]

}