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
|
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter 7: Entropy"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 7-1 ,Page No.335"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#given data\n",
"Q=750;#heat transfered in kJ\n",
"Tsys=300.0;#temperature of liquid-water mixture in K\n",
"\n",
"#calculations\n",
"dSsys=Q/Tsys;\n",
"print'Entropy change in the process %f kJ/K'%round(dSsys,1)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Entropy change in the process 2.500000 kJ/K\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 7-2 ,Page No.338"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#given data\n",
"Qsink=2000.0;#heat lost in kJ\n",
"Qsource=-Qsink;\n",
"Tsource=800.0;#temp of heat loss in K\n",
"\n",
"#calculations\n",
"#part - a\n",
"Tsink=500.0;\n",
"dSsource=Qsource/Tsource;\n",
"dSsink=Qsink/Tsink;\n",
"Sgena=dSsource+dSsink;\n",
"print'entropy generated in part a %f kJ/K'%round(Sgena,1);\n",
"#part - b\n",
"Tsink=750;\n",
"dSsource=Qsource/Tsource;\n",
"dSsink=Qsink/Tsink;\n",
"Sgenb=dSsource+dSsink;\n",
"print'entropy generated in part b %f kJ/K'%round(Sgenb,1);\n",
"if Sgena>Sgenb :\n",
" print('part a is more irreversible');\n",
"elif(Sgena == Sgenb) :\n",
" print('heat transfer is equally irreversible');\n",
"else:\n",
" print('part b is more irreversible');\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"entropy generated in part a 1.500000 kJ/K\n",
"entropy generated in part b 0.200000 kJ/K\n",
"part a is more irreversible\n"
]
}
],
"prompt_number": 4
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 7-3 ,Page No.341"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#given data\n",
"m=5.0;#mass of refrigerant 134-a in kg\n",
"P1=140.0;#intial pressure in kPa\n",
"T1=20.0;#temperature in C\n",
"P2=100.0;#final pressure in kPa\n",
"\n",
"#from refrigerant-134a data\n",
"#at P1 and T1\n",
"s1=1.0624;\n",
"v1=0.16544;\n",
"#at P2\n",
"v2=v1;\n",
"vf=0.0007529;\n",
"vg=0.19254;\n",
"sf=0.07188;\n",
"sfg=0.87995;\n",
"\n",
"#calculations\n",
"# vf < v2 <vg\n",
"x2=(v2-vf)/(vg-vf);\n",
"s2=sf+x2*sfg;\n",
"dS=m*(s2-s1);\n",
"print'entropy change in the process %f kJ/k'%round(dS,3)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"entropy change in the process -1.175000 kJ/k\n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 7-4 ,Page No.342"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#given data\n",
"m=3;#mass of water in lbm\n",
"P1=20;#pressure in psia\n",
"T1=70+460;#temperature in R\n",
"Qin=3450;#heat added in Btu\n",
"\n",
"#from Table A-6E\n",
"#at P1 and T1\n",
"s1=0.07459;\n",
"h1=38.08;\n",
"\n",
"#calculations\n",
"#Ein - Eout = dEsystem\n",
"#Qin = m*(h2 - h1)\n",
"h2=Qin/m+h1;\n",
"#from Table A-6E\n",
"#At P2 and h2\n",
"s2=1.7761;\n",
"dS=m*(s2-s1);\n",
"print'entropy change %f Btu/R'%round(dS,3);\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"entropy change 5.105000 Btu/R\n"
]
}
],
"prompt_number": 7
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 7-5 ,Page No.343"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#given data\n",
"P1=5.0;#entry pressure in MPa\n",
"T1=450.0;#entry temperature in C\n",
"P2=1.4;#pressure at exit MPa\n",
"\n",
"#calculations\n",
"#Ein - Eout = dEsystem/dt\n",
"#Ein = Eout\n",
"#Wout = m*(h1-h2)\n",
"#At P1 and T1\n",
"h1=3317.2;\n",
"s1=6.8210;\n",
"s2=s1;\n",
"#At P2 and s2\n",
"h2=2967.4;\n",
"Wout=h1-h2;\n",
"print'work output per unit mass %f kJ/kg'%round(Wout,1)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"work output per unit mass 349.800000 kJ/kg\n"
]
}
],
"prompt_number": 11
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 7-7 ,Page No.352"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from math import log\n",
"#given values\n",
"P1=1;#pressure at state 1 in kPa\n",
"T1=110.0;#temperature at state 1 in K\n",
"P2=5;#pressure at state 2 in kPa\n",
"T2=120.0;#temperature at state 2 in K\n",
"\n",
"#from Table \n",
"#At P1 and T1\n",
"s1=4.875;\n",
"cp1=3.471;\n",
"#at P2 and T2\n",
"s2=5.145;\n",
"cp2=3.486;\n",
"\n",
"#calculations\n",
"#part - a\n",
"dSa=s2-s1;\n",
"print'change in entropy %f kJ/kg K using tabulated properties'%round(dSa,3);\n",
"#part - b\n",
"cavg=(cp1+cp2)/2.0;\n",
"dSb=cavg*log(T2/T1);\n",
"print'change in entropy %f kJ/kg K approximating liquid methane as an incompressible substance'%round(dSb,3);\n",
"E=(dSb-dSa)/dSa;\n",
"print'Error is %f'%round(E,4)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"change in entropy 0.270000 kJ/kg K using tabulated properties\n",
"change in entropy 0.303000 kJ/kg K approximating liquid methane as an incompressible substance\n",
"Error is 0.121000\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 7-8 ,Page No.353"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Annual power savings has a 0.005% error due to approximation in textbook\n",
"\n",
"#given data\n",
"P1=5;#pressure at state 1 in MPa\n",
"V1=0.280;#volimetric flow rate in m^3/s\n",
"T1=115;#temperature at state 1 in K\n",
"P2=1;#pressure at state 2 in MPa\n",
"dt=8760;#time in h/yr\n",
"UC=0.075;#unit cost in $\n",
"\n",
"#from Table\n",
"#at P1 and T1\n",
"h1=232.3;\n",
"s1=4.9945;\n",
"p1=422.15;\n",
"s2=s1;\n",
"#at P2 and s2\n",
"h2=222.8;\n",
"\n",
"#calculations\n",
"m=p1*V1;\n",
"#Ein - Eout = dEsystem/dt\n",
"#Ein = Eout\n",
"#Wout = m*(h1-h2)\n",
"Wout = m*(h1-h2);\n",
"print'maximum amount of power that can be produced %i kW'%round(Wout)\n",
"APP=Wout*dt;#annual power production\n",
"APS=APP*UC;#annual power savings\n",
"print'Annual power savings $%i/yr'%round(APS)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"maximum amount of power that can be produced 1123 kW\n",
"Annual power savings $737758/yr\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 7-9 ,Page No.357"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from math import log\n",
"\n",
"#given data\n",
"P1=100.0;#inlet pressure in kPa\n",
"T1=290.0;#inlet temperature in K\n",
"P2=600.0;#outlet temperature in kPa\n",
"T2=330.0;#outlet temperature in K\n",
"\n",
"#from Table A-17\n",
"s02=1.79783;\n",
"s01=1.66802;\n",
"#Table A-2b\n",
"cpavg=1.006;\n",
"\n",
"#constants used\n",
"R=0.287;#in kJ/kg -K\n",
"\n",
"#calculations\n",
"#part-a\n",
"s21=s02-s01-R*log(P2/P1);#stands for s2 - s1\n",
"print'entropy change using property values from air table %f kJ/kg-K'%round(s21,4);\n",
"s21=cpavg*log(T2/T1)-R*log(P2/P1);#stands for s2 - s1\n",
"print'entropy change using average specific heat %f kJ/kg-K'%round(s21,4)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"entropy change using property values from air table -0.384400 kJ/kg-K\n",
"entropy change using average specific heat -0.384200 kJ/kg-K\n"
]
}
],
"prompt_number": 7
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 7-10 ,Page No.360"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#given data\n",
"P1=95;#intial pressure in kPa\n",
"T1=295;#intial temperature in K\n",
"r=8;#ratio of V1/V2\n",
"\n",
"#calculations\n",
"#for closed systems V2/V1 = v2/v1\n",
"#At T1\n",
"vr1=647.9;\n",
"vr2=vr1/r;\n",
"#at vr2\n",
"T2=662.7;\n",
"print'the final temperature %f K'%T2"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"the final temperature 662.700000 K\n"
]
}
],
"prompt_number": 25
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 7-11 ,Page No.361"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#given data\n",
"P1=14.0;#intial pressure in psia\n",
"T1=50+460.0;#intial temperature in R\n",
"T2=320+460.0;#final temperature in R\n",
"\n",
"#constants used\n",
"k=1.667;\n",
"\n",
"#calculations\n",
"P2=P1*(T2/T1)**(k/(k-1));\n",
"print'exit pressure %f psia'%round(P2,1)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"exit pressure 40.500000 psia\n"
]
}
],
"prompt_number": 28
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 7-12 ,Page No.364"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#given data\n",
"P2=1000;#final pressure in MPa\n",
"P1=100;#intial pressure in MPa\n",
"\n",
"#from Table A-5\n",
"#At P2\n",
"v1=0.001043;\n",
"\n",
"#calculations\n",
"Wrev=v1*(P2-P1);\n",
"print'compressor work as saturated liquid at inlet %f kJ/kg'%round(Wrev,2)\n",
"#from Table A-5\n",
"#at P1 as sat. vapour\n",
"h1=2675.0;\n",
"s1=7.3589;\n",
"s2=s1\n",
"#from Table A-6\n",
"#at P2 and s2\n",
"h2=3194.5;\n",
"Wrev=h2-h1;\n",
"print'compressor work as saturated vapor at inlet %f kJ/kg'%round(Wrev,1)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"compressor work as saturated liquid at inlet 0.940000 kJ/kg\n",
"compressor work as saturated vapor at inlet 519.500000 kJ/kg\n"
]
}
],
"prompt_number": 29
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 7-13 ,Page No.368"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from math import sqrt\n",
"#given data\n",
"P1=100;#intial pressure in kPa\n",
"T1=300;#intial temperature in K\n",
"P2=900;#final pressure in kPa\n",
"\n",
"#constants used\n",
"R=0.287;#in kJ/kg -K\n",
"\n",
"#calculations\n",
"#part - a\n",
"k=1.4;\n",
"Wcomp=k*R*T1/(k-1)*((P2/P1)**((k-1)/k)-1);\n",
"print'compression work in case of isentropic compression %f kJ/kg'%round(Wcomp,1);\n",
"#part - b\n",
"n=1.3;\n",
"Wcomp=n*R*T1/(n-1)*((P2/P1)**((n-1)/n)-1);\n",
"print'compression work in case of polytropic compression %f kJ/kg'%round(Wcomp,1);\n",
"#part - c\n",
"Wcomp=R*T1*log(P2/P1);\n",
"print'compression work in case of isothermal compression %f kJ/kg'%round(Wcomp,1);\n",
"#part - d\n",
"Ps=sqrt(P1*P2);\n",
"Wcomp=2*n*R*T1/(n-1)*((Ps/P1)**((n-1)/n)-1);\n",
"print'compression work in case of two-stage compression with intercooling %f kJ/kg'%round(Wcomp,1);\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"compression work in case of isentropic compression 263.200000 kJ/kg\n",
"compression work in case of polytropic compression 246.400000 kJ/kg\n",
"compression work in case of isothermal compression 189.200000 kJ/kg\n",
"compression work in case of two-stage compression with intercooling 215.300000 kJ/kg\n"
]
}
],
"prompt_number": 34
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 7-14 ,Page No.371"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#given data\n",
"P1=3000;#intial pressure in kPa\n",
"T1=400;#intial temperature in C\n",
"P2=50;#final pressure in kPa\n",
"T2=100;#final temperature in C\n",
"Wout=2000;#power output in kW\n",
"\n",
"#from Table A-6\n",
"#at P1\n",
"h1=3231.7;\n",
"s1=6.9235;\n",
"#at 2a\n",
"h2a=2682.4;\n",
"#from Table A-6\n",
"#at 2s\n",
"s2s=s1;\n",
"sf=1.0912;\n",
"sg=7.5937;\n",
"hf=340.54;\n",
"hfg=2304.7\n",
"x2s=(s2s-sf)/(sg-sf);\n",
"h2s=hf+x2s*hfg;\n",
"nT=(h1-h2a)/(h1-h2s);\n",
"print'isentropic efficiency is %f'%round(nT,3)\n",
"#Ein = Eout\n",
"m=Wout/(h1-h2a);\n",
"print'mass flow rate %f kg/s'%round(m,2)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"isentropic efficiency is 0.667000\n",
"mass flow rate 3.640000 kg/s\n"
]
}
],
"prompt_number": 35
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 7-15 ,Page No.374"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#given data\n",
"P1=100;#intial pressure in kPa\n",
"T1=285;#intial temperature in K\n",
"P2=800;#final pressure in kPa\n",
"m=0.2;#mass flow rate in kg/s\n",
"nc=0.8;#isentropic efficiency\n",
"\n",
"#from Table A-17\n",
"#at T1\n",
"h1=285.14;\n",
"Pr1=1.1584;\n",
"\n",
"#calcualtions\n",
"Pr2=Pr1*(P2/P1);\n",
"#at Pr2\n",
"h2s=517.05;\n",
"h2a=(h2s-h1)/nc+h1;\n",
"#at h2a\n",
"T2a=569.5;\n",
"print'exit temperature of air %f K'%T2a;\n",
"#Ein = Eout\n",
"Wa=m*(h2a-h1);\n",
"print'required power input %i kW'%round(Wa)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"exit temperature of air 569.500000 K\n",
"required power input 58 kW\n"
]
}
],
"prompt_number": 37
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 7-16 ,Page No.375"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from math import sqrt\n",
"\n",
"#given data\n",
"P1=200.0;#intial pressure in kPa\n",
"T1=950.0;#intial temperature in K\n",
"P2=80.0;#final pressure in kPa\n",
"nN=0.92;#isentropic efficiency\n",
"\n",
"#from Table A-2b\n",
"cp=1.099;\n",
"k=1.354;\n",
"\n",
"#calculations\n",
"T2s=T1*(P2/P1)**((k-1)/k);\n",
"#ein = eout\n",
"V2s=sqrt(2*cp*(T1-T2s)*1000);#factor of 1000 for conversion to m^2/s^2\n",
"print'maximum possible exit velocity %i m/s'%(V2s);\n",
"T2a=T1-nN*(T1-T2s);\n",
"print'exit temperature %i K'%round(T2a);\n",
"V2a=sqrt(nN*V2s**2);\n",
"print'actual exit velocity %i m/s'%(V2a)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"maximum possible exit velocity 666 m/s\n",
"exit temperature 764 K\n",
"actual exit velocity 639 m/s\n"
]
}
],
"prompt_number": 42
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
" Example 7-17 ,Page No.382"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#given data\n",
"Qin=1035.0;#rate of heat transfer in W\n",
"Tin=20+273.0;#inner temperature in K\n",
"Qout=Qin;\n",
"Tout=5+273.0;#outer temperature in K\n",
"\n",
"#calculations\n",
"# Sin - Sout + Sgen = dSsystem/dt\n",
"Sgen=(Qout/Tout)-(Qin/Tin);\n",
"print'entropy generation in the wall %f W/K'%round(Sgen,3);\n",
"Ts1=300.0;Ts2=273.0;#Boundary temperatures\n",
"Sgen=(Qout/Ts2)-(Qin/Ts1);\n",
"print'total entropy generation %f W/K'%round(Sgen,3);"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"entropy generation in the wall 0.191000 W/K\n",
"total entropy generation 0.341000 W/K\n"
]
}
],
"prompt_number": 44
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 7-18 ,Page No.383"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#given data\n",
"P1=7;#intial pressure in MPa\n",
"T1=450;#intial temperature in K\n",
"P2=3;#final pressure in MPa\n",
"\n",
"#from steam tables\n",
"#at P1 and T1\n",
"h1=3288.3;\n",
"s1=6.6353;\n",
"#at P2\n",
"h2=h1;\n",
"s2=7.0046;\n",
"\n",
"#calculations\n",
"# Sin - Sout + Sgen = dSsystem/dt\n",
"Sgen=s2-s1;\n",
"print'the entropy generated %f kJ/kg-K'%round(Sgen,4)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"the entropy generated 0.369300 kJ/kg-K\n"
]
}
],
"prompt_number": 10
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 7-19 ,Page No.385"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from math import log\n",
"\n",
"#given data\n",
"m=50;#mass of iron block in kg\n",
"T1=500.0;#temperature of iron block in K\n",
"T2=285.0;#temperature of lake in K\n",
"\n",
"#from Table A-3\n",
"Cavg=0.45;\n",
"\n",
"#calculations\n",
"dSiron=m*Cavg*log(T2/T1);\n",
"print'entropy change of the iron block %f kJ/K'%round(dSiron,2);\n",
"# Ein - Eout = dEsystem\n",
"Qout=m*Cavg*(T1-T2);\n",
"dSlake=Qout/T2;\n",
"print'entropy change of the lake %f kJ/K'%round(dSlake,2);\n",
"# Sin - Sout + Sgen = dSsystem/dt\n",
"Sgen=(Qout/T2)+dSiron;\n",
"print'entropy change in the process %f kJ/K'%round(Sgen,2)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"entropy change of the iron block -12.650000 kJ/K\n",
"entropy change of the lake 16.970000 kJ/K\n",
"entropy change in the process 4.330000 kJ/K\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 7-20 ,Page No.386"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#given data\n",
"P=20;#pressure of water in psia\n",
"T1=50+460.0;#temperature of water in R\n",
"T2=240.0;#steam temperature in F\n",
"T3=130.0;#leaving temperauture in F\n",
"m1=300.0;#mass flow rate in lbm/min\n",
"Qout=180.0;#heat losses in Btu/min\n",
"\n",
"#from steam tables\n",
"#at P and T1\n",
"h1=18.07;\n",
"s1=0.03609;\n",
"#at P and T2\n",
"h2=1162.3;\n",
"s2=1.7406;\n",
"#at P and T3\n",
"h3=97.99;\n",
"s3=0.18174;\n",
"\n",
"#calculations\n",
"# Qout = m1*h1 + m2*h2 - (m1+m2)*h3\n",
"m2= (Qout-m1*h1+m1*h3)/(h2-h3);\n",
"m3=m1+m2;\n",
"# Sin - sout + Sgen = dSsystem/dt\n",
"Sgen=m3*s3-m1*s1-m2*s2+Qout/T1;\n",
"print'the rate of entropy generation %f Btu/min R'%round(Sgen,2)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"the rate of entropy generation 8.670000 Btu/min R\n"
]
}
],
"prompt_number": 12
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 7-21 ,Page No.388"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#given data\n",
"T=100+273.0;#temperature of water in K\n",
"Q=-600.0;#heat transferred in kJ\n",
"Tb=25+273.0;#temperature of surroundings in K\n",
"\n",
"#calculation\n",
"dSsys=Q/T;\n",
"print'entropy change of water %f kJ/K'%round(dSsys,2);\n",
"# Sin - sout + Sgen = dSsystem\n",
"Sgen= -Q/Tb + dSsys;\n",
"print'total entropy generation %f kJ/K'%round(Sgen,2)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"entropy change of water -1.610000 kJ/K\n",
"total entropy generation 0.400000 kJ/K\n"
]
}
],
"prompt_number": 13
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 7-22 ,Page No.394"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from math import pi,sqrt\n",
"\n",
"#given data\n",
"T1=20+273.0;#average temperature of inlet in C\n",
"T2=24+273.0;#average temperature of compressed air in C\n",
"P1=101.0;#pressure of air inlet in kPa\n",
"P2=801.0;#pressure of compressed air in kPa\n",
"D=3.0/1000.0;#ihole diameter n m\n",
"Cdischarge=0.65;#discharge coefficient\n",
"ncomp=0.8;#compressor efficiency\n",
"nmotor=0.92;#motor efficiency\n",
"UC=0.078;#unit cost in $/kWh\n",
"\n",
"#constants used\n",
"R=0.287;#in kJ/kg K\n",
"k=1.4;\n",
"n=1.4;\n",
"\n",
"#calculations\n",
"Win=n*R*T1/(ncomp*(n-1))*((P2/P1)**((n-1)/n)-1);\n",
"A=pi*D**2/4;\n",
"mair=Cdischarge*(2/(k+1))**(1/(k-1))*P2*A/(R*T2)*sqrt(k*R*1000*2/(k+1)*T2);#factor of 1000 to m^2/s^2\n",
"PW=mair*Win;#Power wasted\n",
"ES=PW*4200/nmotor;#4200 is operating hours ES stands for Energy savings\n",
"print'Energy savings %i kWh/yr'%round(ES);\n",
"CS=ES*UC;\n",
"print'cost savings %i S/yr'%round(CS)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Energy savings 11698 kWh/yr\n",
"cost savings 912 S/yr\n"
]
}
],
"prompt_number": 14
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 7-23 ,Page No.398"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#given data\n",
"P1=85.6;#pressure of air inlet in kPa\n",
"P2=985.6;#pressure of actual compressed air in kPa\n",
"P2r=885.6;#pressure of required compressed air in kPa\n",
"CC=12000;#current cost in $/yr\n",
"\n",
"#constants used\n",
"n=1.4;\n",
"\n",
"#calulation\n",
"freduction=1-(((P2r/P1)**((n-1)/n)-1)/((P2/P1)**((n-1)/n)-1));\n",
"CS=CC*freduction;\n",
"print'cost savings %i Dollar/yr'%(round(CS))\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"cost savings 719 Dollar/yr\n"
]
}
],
"prompt_number": 15
}
],
"metadata": {}
}
]
}
|