summaryrefslogtreecommitdiff
path: root/Engineering_Thermodynamics_by_O._Singh/chapter4_3.ipynb
blob: bb4a3703ecf27134f3780c12019fec97192f2035 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 4:Second Law of Thermo Dynamics"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##example 4.1;pg no: 113"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 4.1, Page:113  \n",
      " \n",
      "\n",
      "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 1\n",
      "NOTE=>This question is fully theoritical hence cannot be solve using scilab.\n"
     ]
    }
   ],
   "source": [
    "#intiation of all variables\n",
    "# Chapter 4\n",
    "print\"Example 4.1, Page:113  \\n \\n\"\n",
    "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 1\")\n",
    "print(\"NOTE=>This question is fully theoritical hence cannot be solve using scilab.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##example 4.2;pg no: 114"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 4.2, Page:114  \n",
      " \n",
      "\n",
      "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 2\n",
      "in carnot engine from thermodynamics temperature scale\n",
      "Q1/Q2=T1/T2\n",
      "W=Q1-Q2=200 KJ\n",
      "from above equations Q1 in KJ is given by\n",
      "Q1= 349.61\n",
      "and Q2 in KJ\n",
      "Q2=Q1-200 149.61\n",
      "so heat supplied(Q1) in KJ 349.6\n"
     ]
    }
   ],
   "source": [
    "#cal of heat supplied\n",
    "#intiation of all variables\n",
    "# Chapter 4\n",
    "print\"Example 4.2, Page:114  \\n \\n\"\n",
    "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 2\")\n",
    "T1=(400.+273.);#temperature of source in K\n",
    "T2=(15.+273.);#temperature of sink in K\n",
    "W=200.;#work done in KJ\n",
    "print(\"in carnot engine from thermodynamics temperature scale\")\n",
    "print(\"Q1/Q2=T1/T2\")\n",
    "print(\"W=Q1-Q2=200 KJ\")\n",
    "print(\"from above equations Q1 in KJ is given by\")\n",
    "Q1=(200*T1)/(T1-T2)\n",
    "print(\"Q1=\"),round(Q1,2)\n",
    "print(\"and Q2 in KJ\")\n",
    "Q2=Q1-200\n",
    "print(\"Q2=Q1-200\"),round(Q2,2)\n",
    "print(\"so heat supplied(Q1) in KJ\"),round(Q1,1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##example 4.3;pg no: 115"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 4.3, Page:115  \n",
      " \n",
      "\n",
      "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 3\n",
      "from thermodynamic temperature scale\n",
      "Q1/Q2=T1/T2\n",
      "so Q1=Q2*(T1/T2)in KJ/s 2.27\n",
      "power/work input required(W)=Q1-Q2 in KJ/s \n",
      "power required for driving refrigerator=W in KW 0.274\n"
     ]
    }
   ],
   "source": [
    "#cal of power required for driving refrigerator\n",
    "#intiation of all variables\n",
    "# Chapter 4\n",
    "print\"Example 4.3, Page:115  \\n \\n\"\n",
    "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 3\")\n",
    "T1=315.;#temperature of reservoir 1 in K\n",
    "T2=277.;#temperature of reservoir 2 in K\n",
    "Q2=2.;#heat extracted in KJ/s\n",
    "print(\"from thermodynamic temperature scale\")\n",
    "print(\"Q1/Q2=T1/T2\")\n",
    "Q1=Q2*(T1/T2)\n",
    "print(\"so Q1=Q2*(T1/T2)in KJ/s\"),round(Q1,2)\n",
    "print(\"power/work input required(W)=Q1-Q2 in KJ/s \")\n",
    "W=Q1-Q2\n",
    "print(\"power required for driving refrigerator=W in KW\"),round(W,3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##example 4.4;pg no: 115"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 4.4, Page:115  \n",
      " \n",
      "\n",
      "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 4\n",
      "we can writefor heat engine,Q1/Q2=T1/T2\n",
      "so Q2=Q1*(T2/T1) in KJ 545.45\n",
      "so We=in KJ 1454.55\n",
      "for refrigerator,Q3/Q4=T3/T4 eq 1\n",
      "now We-Wr=300\n",
      "so Wr=We-300 in KJ 1154.55\n",
      "and Wr=Q4-Q3=1154.55 KJ eq 2 \n",
      "solving eq1 and eq 2 we get\n",
      "Q4=in KJ 8659.13\n",
      "and Q3=in KJ 7504.58\n",
      "total heat transferred to low teperature reservoir(Q)=in KJ 9204.58\n",
      "hence heat transferred to refrigerant=Q3 in KJ 7504.58\n",
      "and heat transferred to low temperature reservoir=Q in KJ 9204.58\n"
     ]
    }
   ],
   "source": [
    "#cal of  heat transferred to refrigerant and low temperature reservoir\n",
    "#intiation of all variables\n",
    "# Chapter 4\n",
    "print\"Example 4.4, Page:115  \\n \\n\"\n",
    "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 4\")\n",
    "T1=(827.+273.);#temperature of high temperature reservoir  in K\n",
    "T2=(27.+273.);#temperature of low temperature reservoir  in K\n",
    "T3=(-13.+273.);#temperature of reservoir 3 in K\n",
    "Q1=2000.;#heat ejected by reservoir 1 in KJ\n",
    "print(\"we can writefor heat engine,Q1/Q2=T1/T2\")\n",
    "Q2=Q1*(T2/T1)\n",
    "print(\"so Q2=Q1*(T2/T1) in KJ\"),round(Q2,2)\n",
    "We=Q1-Q2\n",
    "print(\"so We=in KJ\"),round(We,2)\n",
    "print(\"for refrigerator,Q3/Q4=T3/T4 eq 1\")\n",
    "T4=T2;#temperature of low temperature reservoir in K\n",
    "print(\"now We-Wr=300\")\n",
    "Wr=We-300.\n",
    "print(\"so Wr=We-300 in KJ\"),round(Wr,2)\n",
    "print(\"and Wr=Q4-Q3=1154.55 KJ eq 2 \")\n",
    "print(\"solving eq1 and eq 2 we get\")\n",
    "Q4=(1154.55*T4)/(T4-T3)\n",
    "print(\"Q4=in KJ\"),round(Q4,2)\n",
    "Q3=Q4-Wr\n",
    "print(\"and Q3=in KJ\"),round(Q3,2)\n",
    "Q=Q2+Q4\n",
    "print(\"total heat transferred to low teperature reservoir(Q)=in KJ\"),round(Q,2)\n",
    "print(\"hence heat transferred to refrigerant=Q3 in KJ\"),round(Q3,2)\n",
    "print(\"and heat transferred to low temperature reservoir=Q in KJ\"),round(Q,2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##example 4.5;pg no: 116"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 4.5, Page:116  \n",
      " \n",
      "\n",
      "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 5\n",
      "COP_HP=Q1/W=Q1/(Q1-Q2)=1/(1-(Q2/Q1))\n",
      "also we know K=Q1/Q2=T1/T2\n",
      "so K=T1/T2 1.1\n",
      "so COP_HP=1/(1-(Q2/Q1)=1/(1-(1/K)) 11.0\n",
      "also COP_HP=Q1/W\n",
      "W=Q1/COin MJ/Hr 3.03\n",
      "or W=1000*W/3600 in KW 3.03\n",
      "so minimum power required(W)in KW  3.03\n"
     ]
    }
   ],
   "source": [
    "#cal of minimum power required\n",
    "#intiation of all variables\n",
    "# Chapter 4\n",
    "print\"Example 4.5, Page:116  \\n \\n\"\n",
    "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 5\")\n",
    "T1=(25+273.15);#temperature of inside of house in K\n",
    "T2=(-1+273.15);#outside temperature in K\n",
    "Q1=125;#heating load in MJ/Hr\n",
    "print(\"COP_HP=Q1/W=Q1/(Q1-Q2)=1/(1-(Q2/Q1))\")\n",
    "print(\"also we know K=Q1/Q2=T1/T2\")\n",
    "K=T1/T2\n",
    "print(\"so K=T1/T2\"),round(K,2)\n",
    "COP_HP=1/(1-(1/K))\n",
    "print(\"so COP_HP=1/(1-(Q2/Q1)=1/(1-(1/K))\"),round(COP_HP)\n",
    "print(\"also COP_HP=Q1/W\")\n",
    "W=Q1/COP_HP\n",
    "W=1000*W/3600\n",
    "print(\"W=Q1/COin MJ/Hr\"),round(W,2)\n",
    "print(\"or W=1000*W/3600 in KW\"),round(W,2)\n",
    "print(\"so minimum power required(W)in KW \"),round(W,2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##example 4.6;pg no: 117"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 4.6, Page:117  \n",
      " \n",
      "\n",
      "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 6\n",
      "cold storage plant can be considered as refrigerator operating between given temperatures limits\n",
      "capacity of plant=heat to be extracted=Q2 in KW\n",
      "we know that,one ton of refrigeration as 3.52 KW \n",
      "so Q2=Q2*3.52 in KW 140.8\n",
      "carnot COP of plant(COP_carnot)= 5.18\n",
      "performance is 1/4 of its carnot COP\n",
      "COP=COP_carnot/4\n",
      "also actual COP=Q2/W\n",
      "W=Q2/COP in KW\n",
      "hence power required(W)in KW 108.76\n"
     ]
    }
   ],
   "source": [
    "#cal of power required\n",
    "#intiation of all variables\n",
    "# Chapter 4\n",
    "print\"Example 4.6, Page:117  \\n \\n\"\n",
    "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 6\")\n",
    "T1=(-15.+273.15);#inside temperature in K\n",
    "T2=(35.+273.);#atmospheric temperature in K\n",
    "Q2=40.;#refrigeration capacity of storage plant in tonnes\n",
    "print(\"cold storage plant can be considered as refrigerator operating between given temperatures limits\")\n",
    "print(\"capacity of plant=heat to be extracted=Q2 in KW\")\n",
    "print(\"we know that,one ton of refrigeration as 3.52 KW \")\n",
    "Q2=Q2*3.52\n",
    "print(\"so Q2=Q2*3.52 in KW\"),round(Q2,2)\n",
    "COP_carnot=1/((T2/T1)-1)\n",
    "print(\"carnot COP of plant(COP_carnot)=\"),round(COP_carnot,2)\n",
    "print(\"performance is 1/4 of its carnot COP\")\n",
    "COP=COP_carnot/4\n",
    "print(\"COP=COP_carnot/4\")\n",
    "print(\"also actual COP=Q2/W\")\n",
    "print(\"W=Q2/COP in KW\")\n",
    "W=Q2/COP\n",
    "print(\"hence power required(W)in KW\"),round(W,2)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##example 4.7;pg no: 117"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 4.7, Page:117  \n",
      " \n",
      "\n",
      "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 7\n",
      "highest efficiency is that of carnot engine,so let us find the carnot cycle efficiency for given temperature limits\n",
      "n= 0.79\n",
      "or n=n*100 % 78.92\n"
     ]
    }
   ],
   "source": [
    "#cal of carnot cycle efficiency for given temperature limits\n",
    "#intiation of all variables\n",
    "# Chapter 4\n",
    "print\"Example 4.7, Page:117  \\n \\n\"\n",
    "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 7\")\n",
    "T1=(1150.+273.);#temperature of source in K\n",
    "T2=(27.+273.);#temperature of sink in K\n",
    "print(\"highest efficiency is that of carnot engine,so let us find the carnot cycle efficiency for given temperature limits\")\n",
    "n=1-(T2/T1)\n",
    "print(\"n=\"),round(n,2)\n",
    "n=n*100\n",
    "print(\"or n=n*100 %\"),round(n,2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##example 4.8;pg no: 117"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 4.8, Page:117  \n",
      " \n",
      "\n",
      "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 8\n",
      "here heat to be removed continuously from refrigerated space(Q)in KJ/s 0.13\n",
      "for refrigerated,COP shall be Q/W=1/((T1/T2)-1)\n",
      "W=in KW 0.02\n",
      "so power required(W)in KW 0.02\n"
     ]
    }
   ],
   "source": [
    "#cal of power required\n",
    "#intiation of all variables\n",
    "# Chapter 4\n",
    "print\"Example 4.8, Page:117  \\n \\n\"\n",
    "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 8\")\n",
    "T1=(27.+273.);#temperature of source in K\n",
    "T2=(-8.+273.);#temperature of sink in K\n",
    "Q=7.5;#heat leakage in KJ/min\n",
    "Q=Q/60.\n",
    "print(\"here heat to be removed continuously from refrigerated space(Q)in KJ/s\"),round(Q,2)\n",
    "print(\"for refrigerated,COP shall be Q/W=1/((T1/T2)-1)\")\n",
    "W=Q*((T1/T2)-1)\n",
    "print(\"W=in KW\"),round(W,2)\n",
    "print(\"so power required(W)in KW\"),round(W,2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##example 4.9;pg no: 118"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 4.9, Page:118  \n",
      " \n",
      "\n",
      "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 9\n",
      "here W1:W2:W3=3:2:1\n",
      "efficiency of engine,HE1,\n",
      "W1/Q1=(1-(T2/1100))\n",
      "so Q1=(1100*W1)/(1100-T2)\n",
      "for HE2 engine,W2/Q2=(1-(T3/T2))\n",
      "for HE3 engine,W3/Q3=(1-(300/T3))\n",
      "from energy balance on engine,HE1\n",
      "Q1=W1+Q2=>Q2=Q1-W1\n",
      "above gives,Q1=(((1100*W1)/(1100-T2))-W1)=W1*(T2/(1100-T2))\n",
      "substituting Q2 in efficiency of HE2\n",
      "W2/(W1*(T2/(1100-T2)))=1-(T3/T2)\n",
      "W2/W1=(T2/(1100-T2))*(T2-T3)/T2=((T2-T3)/(1100-T2))\n",
      "2/3=(T2-T3)/(1100-T2)\n",
      "2200-2*T2=3*T2-3*T3\n",
      "5*T2-3*T3=2200\n",
      "now energy balance on engine HE2 gives,Q2=W2+Q3\n",
      "substituting in efficiency of HE2,\n",
      "W2/(W2+Q3)=(T2-T3)/T2\n",
      "W2*T2=(W2+Q3)*(T2-T3)\n",
      "Q3=(W2*T3)/(T2-T3)\n",
      "substituting Q3 in efficiency of HE3,\n",
      "W3/((W2*T3)/(T2-T3))=(T3-300)/T3\n",
      "W3/W2=(T3/(T2-T3))*(T3-300)/T3\n",
      "1/2=(T3-300)/(T2-T3)\n",
      "3*T3-T2=600\n",
      "solving equations of T2 and T3,\n",
      "we get,T3=in K 433.33\n",
      "and by eq 5,T2 in K 700.0\n",
      "so intermediate temperature are 700 K and 433.33 K\n"
     ]
    }
   ],
   "source": [
    "#cal of intermediate temperatures\n",
    "#intiation of all variables\n",
    "# Chapter 4\n",
    "print\"Example 4.9, Page:118  \\n \\n\"\n",
    "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 9\")\n",
    "T1=1100;#temperature of high temperature reservoir in K\n",
    "T4=300;#temperature of low temperature reservoir in K\n",
    "print(\"here W1:W2:W3=3:2:1\")\n",
    "print(\"efficiency of engine,HE1,\")\n",
    "print(\"W1/Q1=(1-(T2/1100))\")\n",
    "print(\"so Q1=(1100*W1)/(1100-T2)\")\n",
    "print(\"for HE2 engine,W2/Q2=(1-(T3/T2))\")\n",
    "print(\"for HE3 engine,W3/Q3=(1-(300/T3))\")\n",
    "print(\"from energy balance on engine,HE1\")\n",
    "print(\"Q1=W1+Q2=>Q2=Q1-W1\")\n",
    "print(\"above gives,Q1=(((1100*W1)/(1100-T2))-W1)=W1*(T2/(1100-T2))\")\n",
    "print(\"substituting Q2 in efficiency of HE2\")\n",
    "print(\"W2/(W1*(T2/(1100-T2)))=1-(T3/T2)\")\n",
    "print(\"W2/W1=(T2/(1100-T2))*(T2-T3)/T2=((T2-T3)/(1100-T2))\")\n",
    "print(\"2/3=(T2-T3)/(1100-T2)\")\n",
    "print(\"2200-2*T2=3*T2-3*T3\")\n",
    "print(\"5*T2-3*T3=2200\")\n",
    "print(\"now energy balance on engine HE2 gives,Q2=W2+Q3\")\n",
    "print(\"substituting in efficiency of HE2,\")\n",
    "print(\"W2/(W2+Q3)=(T2-T3)/T2\")\n",
    "print(\"W2*T2=(W2+Q3)*(T2-T3)\")\n",
    "print(\"Q3=(W2*T3)/(T2-T3)\")\n",
    "print(\"substituting Q3 in efficiency of HE3,\")\n",
    "print(\"W3/((W2*T3)/(T2-T3))=(T3-300)/T3\")\n",
    "print(\"W3/W2=(T3/(T2-T3))*(T3-300)/T3\")\n",
    "print(\"1/2=(T3-300)/(T2-T3)\")\n",
    "print(\"3*T3-T2=600\")\n",
    "print(\"solving equations of T2 and T3,\")\n",
    "T3=(600.+(2200./5.))/(3.-(3./5.))\n",
    "print(\"we get,T3=in K\"),round(T3,2)\n",
    "T2=(2200.+3.*T3)/5.\n",
    "print(\"and by eq 5,T2 in K\"),round(T2,2)\n",
    "print(\"so intermediate temperature are 700 K and 433.33 K\")\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##example 4.10;pg no: 119"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 4.10, Page:119  \n",
      " \n",
      "\n",
      "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 10\n",
      "efficiency of engine,W/Q1=(800-T)/800\n",
      "for refrigerator,COP=Q3/W=280/(T-280)\n",
      "it is given that Q1=Q3=Q\n",
      "so,from engine,W/Q=(800-T)/800\n",
      "from refrigerator,Q/W=280/(T-280)\n",
      "from above two(Q/W)may be equated,\n",
      "(T-280)/280=(800-T)/800\n",
      "so temperature(T)in K 414.81\n",
      "efficiency of engine(n)is given as\n",
      "n= 0.48\n",
      "COP of refrigerator is given as\n",
      "COP= 2.08\n"
     ]
    }
   ],
   "source": [
    "#cal of COP\n",
    "#intiation of all variables\n",
    "# Chapter 4\n",
    "print\"Example 4.10, Page:119  \\n \\n\"\n",
    "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 10\")\n",
    "T1=800.;#temperature of source in K\n",
    "T2=280.;#temperature of sink in K\n",
    "print(\"efficiency of engine,W/Q1=(800-T)/800\")\n",
    "print(\"for refrigerator,COP=Q3/W=280/(T-280)\")\n",
    "print(\"it is given that Q1=Q3=Q\")\n",
    "print(\"so,from engine,W/Q=(800-T)/800\")\n",
    "print(\"from refrigerator,Q/W=280/(T-280)\")\n",
    "print(\"from above two(Q/W)may be equated,\")\n",
    "print(\"(T-280)/280=(800-T)/800\")\n",
    "T=2.*280.*800./(800.+280.)\n",
    "print(\"so temperature(T)in K\"),round(T,2)\n",
    "print(\"efficiency of engine(n)is given as\")\n",
    "n=(800.-T)/800.\n",
    "print(\"n=\"),round(n,2)\n",
    "print(\"COP of refrigerator is given as\")\n",
    "COP=280./(T-280.)\n",
    "print(\"COP=\"),round(COP,2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##example 4.11;pg no: 120"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 4.11, Page:120  \n",
      " \n",
      "\n",
      "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 11\n",
      "let thermodynamic properties be denoted with respect to salient states;\n",
      "n_carnot=1-T1/T2\n",
      "so T1/T2=1-0.5\n",
      "so T1/T2=0.5\n",
      "or T2=2*T1\n",
      "corresponding to state 2,p2*v2=m*R*T2\n",
      "so temperature(T2) in K= 585.37\n",
      "heat transferred during process 2-3(isothermal expansion),Q_23=40 KJ\n",
      "Q_23=W_23=p2*v2*log(v3/v2)\n",
      "so volume(v3) in m^3= 0.1932\n",
      "temperature at state 1,T1 in K= 292.68\n",
      "during process 1-2,T2/T1=(p2/p1)^((y-1)/y)\n",
      "here expansion constant(y)=Cp/Cv\n",
      "so pressure(p1)=p2/(T2/T1)^(y/(y-1)) in pa\n",
      "p1 in bar\n",
      "thus p1*v1=m*R*T1\n",
      "so volume(v1) in m^3= 0.68\n",
      "heat transferred during process 4-1(isothermal compression)shall be equal to the heat transferred during process2-3(isothermal expansion).\n",
      "for isentropic process,dQ=0,dW=dU\n",
      "during process 1-2,isentropic process,W_12=-m*Cv*(T2-T1)in KJ\n",
      "Q_12=0,\n",
      "W_12=-105.51 KJ(-ve work)\n",
      "during process 3-4,isentropic process,W_34=-m*Cv*(T4-T3)in KJ\n",
      "Q_31=0,\n",
      "ANS:\n",
      "W_34=+105.51 KJ(+ve work)\n",
      "so for process 1-2,heat transfer=0,work interaction=-105.51 KJ\n",
      "for process 2-3,heat transfer=40 KJ,work intercation=40 KJ\n",
      "for process 3-4,heat transfer=0,work interaction=+105.51 KJ\n",
      "for process 4-1,heat transfer=-40 KJ,work interaction=-40 KJ\n",
      "maximum temperature of cycle=585.36 KJ\n",
      "minimum temperature of cycle=292.68 KJ\n",
      "volume at the end of isothermal expansion=0.1932 m^3\n"
     ]
    }
   ],
   "source": [
    "#cal of  max and min temp of cycle,volume\n",
    "#intiation of all variables\n",
    "# Chapter 4\n",
    "import math\n",
    "print\"Example 4.11, Page:120  \\n \\n\"\n",
    "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 11\")\n",
    "n_carnot=0.5;#efficiency of carnot power cycle\n",
    "m=0.5;#mass of air in kg\n",
    "p2=7.*10**5;#final pressure in pa\n",
    "v2=0.12;#volume in m^3\n",
    "R=287.;#gas constant in J/kg K\n",
    "Q_23=40.*1000.;#heat transfer to the air during isothermal expansion in J\n",
    "Cp=1.008;#specific heat at constant pressure in KJ/kg K\n",
    "Cv=0.721;#specific heat at constant volume in KJ/kg K\n",
    "print(\"let thermodynamic properties be denoted with respect to salient states;\")\n",
    "print(\"n_carnot=1-T1/T2\")\n",
    "print(\"so T1/T2=1-0.5\")\n",
    "1-0.5\n",
    "print(\"so T1/T2=0.5\")\n",
    "print(\"or T2=2*T1\")\n",
    "print(\"corresponding to state 2,p2*v2=m*R*T2\")\n",
    "T2=p2*v2/(m*R)\n",
    "print(\"so temperature(T2) in K=\"),round(T2,2)\n",
    "print(\"heat transferred during process 2-3(isothermal expansion),Q_23=40 KJ\")\n",
    "print(\"Q_23=W_23=p2*v2*log(v3/v2)\")\n",
    "v3=v2*math.exp(Q_23/(p2*v2))\n",
    "print(\"so volume(v3) in m^3=\"),round(v3,4)\n",
    "T1=T2/2\n",
    "print(\"temperature at state 1,T1 in K=\"),round(T1,2)\n",
    "print(\"during process 1-2,T2/T1=(p2/p1)^((y-1)/y)\")\n",
    "print(\"here expansion constant(y)=Cp/Cv\")\n",
    "y=Cp/Cv\n",
    "print(\"so pressure(p1)=p2/(T2/T1)^(y/(y-1)) in pa\")\n",
    "p1=p2/(T2/T1)**(y/(y-1))\n",
    "print(\"p1 in bar\")\n",
    "p1=p1/10**5\n",
    "print(\"thus p1*v1=m*R*T1\")\n",
    "v1=m*R*T1/(p1*10**5)\n",
    "print(\"so volume(v1) in m^3=\"),round(v1,2) \n",
    "print(\"heat transferred during process 4-1(isothermal compression)shall be equal to the heat transferred during process2-3(isothermal expansion).\")\n",
    "print(\"for isentropic process,dQ=0,dW=dU\")\n",
    "print(\"during process 1-2,isentropic process,W_12=-m*Cv*(T2-T1)in KJ\")\n",
    "print(\"Q_12=0,\")\n",
    "W_12=-m*Cv*(T2-T1)\n",
    "print(\"W_12=-105.51 KJ(-ve work)\")\n",
    "print(\"during process 3-4,isentropic process,W_34=-m*Cv*(T4-T3)in KJ\")\n",
    "print(\"Q_31=0,\")\n",
    "T4=T1;\n",
    "T3=T2;\n",
    "W_34=-m*Cv*(T4-T3)\n",
    "print(\"ANS:\")\n",
    "print(\"W_34=+105.51 KJ(+ve work)\")\n",
    "print(\"so for process 1-2,heat transfer=0,work interaction=-105.51 KJ\")\n",
    "print(\"for process 2-3,heat transfer=40 KJ,work intercation=40 KJ\")\n",
    "print(\"for process 3-4,heat transfer=0,work interaction=+105.51 KJ\")\n",
    "print(\"for process 4-1,heat transfer=-40 KJ,work interaction=-40 KJ\")\n",
    "print(\"maximum temperature of cycle=585.36 KJ\")\n",
    "print(\"minimum temperature of cycle=292.68 KJ\")\n",
    "print(\"volume at the end of isothermal expansion=0.1932 m^3\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##example 4.12;pg no: 122"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 4.12, Page:122  \n",
      " \n",
      "\n",
      "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 12\n",
      "let us assume that heat engine rejects Q2 and Q3 heat to reservior at 300 K and 200 K respectively.let us assume that there are two heat engines operating between 400 K and 300 K temperature reservoirs and between 400 K and 200 K temperature reservoirs.let each heat engine receive Q1_a and Q1_b from reservoir at 400 K as shown below\n",
      "thus,Q1_a+Q1_b=Q1=5*10^3 KJ...............eq1\n",
      "Also,Q1_a/Q2=400/300,or Q1_a=4*Q2/3...............eq2\n",
      "Q1_b/Q3=400/200 or Q1_b=2*Q3...............eq3\n",
      "substituting Q1_a and Q1_b in eq 1\n",
      "4*Q2/3+2*Q3=5000...............eq4\n",
      "also from total work output,Q1_a+Q1_b-Q2-Q3=W\n",
      "5000-Q2-Q3=840\n",
      "so Q2+Q3=5000-840=4160\n",
      "Q3=4160-Q2\n",
      "sunstituting Q3 in eq 4\n",
      "4*Q2/3+2*(4160-Q2)=5000\n",
      "so Q2=in KJ 4980.0\n",
      "and Q3= in KJ 820.0\n",
      "here negative sign with Q3 shows that the assumed direction of heat is not correct and actually Q3 heat will flow from reservoir to engine.actual sign of heat transfers and magnitudes are as under:\n",
      "Q2=4980 KJ,from heat engine\n",
      "Q3=820 KJ,to heat engine\n"
     ]
    }
   ],
   "source": [
    "#cal of  heat  from from heat engine and to heat engine\n",
    "#intiation of all variables\n",
    "# Chapter 4\n",
    "print\"Example 4.12, Page:122  \\n \\n\"\n",
    "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 12\")\n",
    "W=840.;#work done by reservoir in KJ\n",
    "print(\"let us assume that heat engine rejects Q2 and Q3 heat to reservior at 300 K and 200 K respectively.let us assume that there are two heat engines operating between 400 K and 300 K temperature reservoirs and between 400 K and 200 K temperature reservoirs.let each heat engine receive Q1_a and Q1_b from reservoir at 400 K as shown below\")\n",
    "print(\"thus,Q1_a+Q1_b=Q1=5*10^3 KJ...............eq1\")\n",
    "print(\"Also,Q1_a/Q2=400/300,or Q1_a=4*Q2/3...............eq2\")\n",
    "print(\"Q1_b/Q3=400/200 or Q1_b=2*Q3...............eq3\")\n",
    "print(\"substituting Q1_a and Q1_b in eq 1\")\n",
    "print(\"4*Q2/3+2*Q3=5000...............eq4\")\n",
    "print(\"also from total work output,Q1_a+Q1_b-Q2-Q3=W\")\n",
    "print(\"5000-Q2-Q3=840\")\n",
    "print(\"so Q2+Q3=5000-840=4160\")\n",
    "print(\"Q3=4160-Q2\")\n",
    "print(\"sunstituting Q3 in eq 4\")\n",
    "print(\"4*Q2/3+2*(4160-Q2)=5000\")\n",
    "Q2=(5000.-2.*4160.)/((4./3.)-2.)\n",
    "print(\"so Q2=in KJ\"),round(Q2,2)\n",
    "Q3=4160.-Q2\n",
    "print(\"and Q3= in KJ\"),round(-Q3,2)\n",
    "print(\"here negative sign with Q3 shows that the assumed direction of heat is not correct and actually Q3 heat will flow from reservoir to engine.actual sign of heat transfers and magnitudes are as under:\")\n",
    "print(\"Q2=4980 KJ,from heat engine\")\n",
    "print(\"Q3=820 KJ,to heat engine\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##example 4.13;pg no: 123"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 4.13, Page:123  \n",
      " \n",
      "\n",
      "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 13\n",
      "arrangement for heat pump and heat engine operating togrther is shown here.engine and pump both reject heat to reservoir at 77 degree celcius(350 K)\n",
      "for heat engine\n",
      "ne=W/Q1=1-T2/T1\n",
      "so (Q1-Q2)/Q1=\n",
      "and Q2/Q1=\n",
      "Q2=0.2593*Q1\n",
      "for heat pump,\n",
      "COP_HP=Q4/(Q4-Q3)=T4/(T4-T3)\n",
      "Q4/Q3=\n",
      "Q4=1.27*Q3\n",
      "work output from engine =work input to pump\n",
      "Q1-Q2=Q4-Q3=>Q1-0.2593*Q1=Q4-Q4/1.27\n",
      "so Q4/Q1=\n",
      "so Q4=3.484*Q1\n",
      "also it is given that Q2+Q4=100\n",
      "subtituting Q2 and Q4 as function of Q1 in following expression,\n",
      "Q2+Q4=100\n",
      "so 0.2539*Q1+3.484*Q1=100\n",
      "so energy taken by engine from reservoir at 1077 degree celcius(Q1)in KJ\n",
      "Q1=100/(0.2539+3.484)in KJ 26.75\n",
      "NOTE=>In this question expression for calculating Q1 is written wrong in book which is corrected above.\n"
     ]
    }
   ],
   "source": [
    "#cal of energy taken by engine from reservoir\n",
    "#intiation of all variables\n",
    "# Chapter 4\n",
    "print\"Example 4.13, Page:123  \\n \\n\"\n",
    "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 13\")\n",
    "T2=(77+273);#temperature of reservoir 2\n",
    "T1=(1077+273);#temperature of reservoir 1\n",
    "T3=(3+273);#temperature of reservoir 3\n",
    "print(\"arrangement for heat pump and heat engine operating togrther is shown here.engine and pump both reject heat to reservoir at 77 degree celcius(350 K)\")\n",
    "print(\"for heat engine\")\n",
    "print(\"ne=W/Q1=1-T2/T1\")\n",
    "print(\"so (Q1-Q2)/Q1=\")\n",
    "1-T2/T1\n",
    "print(\"and Q2/Q1=\")\n",
    "1-0.7407\n",
    "print(\"Q2=0.2593*Q1\")\n",
    "print(\"for heat pump,\")\n",
    "print(\"COP_HP=Q4/(Q4-Q3)=T4/(T4-T3)\")\n",
    "T4=T2;\n",
    "T4/(T4-T3)\n",
    "print(\"Q4/Q3=\")\n",
    "4.73/3.73\n",
    "print(\"Q4=1.27*Q3\")\n",
    "print(\"work output from engine =work input to pump\")\n",
    "print(\"Q1-Q2=Q4-Q3=>Q1-0.2593*Q1=Q4-Q4/1.27\")\n",
    "print(\"so Q4/Q1=\")\n",
    "(1-0.2593)/(1-(1/1.27))\n",
    "print(\"so Q4=3.484*Q1\")\n",
    "print(\"also it is given that Q2+Q4=100\")\n",
    "print(\"subtituting Q2 and Q4 as function of Q1 in following expression,\")\n",
    "print(\"Q2+Q4=100\")\n",
    "print(\"so 0.2539*Q1+3.484*Q1=100\")\n",
    "print(\"so energy taken by engine from reservoir at 1077 degree celcius(Q1)in KJ\")\n",
    "Q1=100/(0.2539+3.484)\n",
    "print(\"Q1=100/(0.2539+3.484)in KJ\"),round(Q1,2)\n",
    "print(\"NOTE=>In this question expression for calculating Q1 is written wrong in book which is corrected above.\")\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##example 4.14;pg no: 124"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 4.14, Page:124  \n",
      " \n",
      "\n",
      "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 14\n",
      "let temperature of sink be T_sink K\n",
      "Q_sink_HE+Q_sink_R=3000 ........eq 1\n",
      "since complete work output from engine is used to run refrigerator so,\n",
      "2000-Q_sink_HE=Q_sink_R-Q_R .........eq 2\n",
      "by eq 1 and eq 2,we get Q_R in KJ/s 1000.0\n",
      "also for heat engine,2000/1500=Q_sink_HE/T_sink\n",
      "=>Q_sink_HE=4*T_sink/3\n",
      "for refrigerator,Q_R/288=Q_sink_R/T_sink=>Q_sink_R=1000*T_sink/288\n",
      "substituting Q_sink_HE and Q_sink_R values\n",
      "4*T_sink/3+1000*T_sink/288=3000\n",
      "so temperature of sink(T_sink)in K\n",
      "so T_sink= 750.0\n",
      "T_sink in degree celcius 477.0\n"
     ]
    }
   ],
   "source": [
    "#cal of T_sink in degree celcius\n",
    "#intiation of all variables\n",
    "# Chapter 4\n",
    "print\"Example 4.14, Page:124  \\n \\n\"\n",
    "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 14\")\n",
    "Q_source=2000;#heat supplied by heat engine in KJ/s\n",
    "T_source=1500;#temperature of source in K\n",
    "T_R=(15+273);#temperature of reservoir in K\n",
    "Q_sink=3000;#heat received by sink in KJ/s\n",
    "print(\"let temperature of sink be T_sink K\")\n",
    "print(\"Q_sink_HE+Q_sink_R=3000 ........eq 1\")\n",
    "print(\"since complete work output from engine is used to run refrigerator so,\")\n",
    "print(\"2000-Q_sink_HE=Q_sink_R-Q_R .........eq 2\")\n",
    "Q_R=3000-2000\n",
    "print(\"by eq 1 and eq 2,we get Q_R in KJ/s\"),round(Q_R)\n",
    "print(\"also for heat engine,2000/1500=Q_sink_HE/T_sink\")\n",
    "print(\"=>Q_sink_HE=4*T_sink/3\")\n",
    "print(\"for refrigerator,Q_R/288=Q_sink_R/T_sink=>Q_sink_R=1000*T_sink/288\")\n",
    "print(\"substituting Q_sink_HE and Q_sink_R values\")\n",
    "print(\"4*T_sink/3+1000*T_sink/288=3000\")\n",
    "print(\"so temperature of sink(T_sink)in K\")\n",
    "T_sink=3000/((4/3)+(1000/288))\n",
    "print(\"so T_sink=\"),round(T_sink,2)\n",
    "T_sink=T_sink-273\n",
    "print(\"T_sink in degree celcius\"),round(T_sink,2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##example 4.15;pg no: 124"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 4.15, Page:124  \n",
      " \n",
      "\n",
      "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 15\n",
      "let the output of heat engine be W.so W/3 is consumed for driving auxiliary and remaining 2*W/3 is consumed for driving heat pump for heat engine,\n",
      "n=W/Q1= 0.39\n",
      "so n=W/Q1=0.3881\n",
      "COP of heat pump=T3/(T3-T2)=Q3/(2*W/3) 2.89\n",
      "so 2.892=3*Q3/2*W\n",
      "Q3/Q1= 0.7483\n",
      "so ratio of heat rejected to body at 450 degree celcius to the heat supplied by the reservoir=0.7482\n"
     ]
    }
   ],
   "source": [
    "#cal of  heat transferred to refrigerant and low temperature reservoir\n",
    "#intiation of all variables\n",
    "# Chapter 4\n",
    "print\"Example 4.15, Page:124  \\n \\n\"\n",
    "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 15\")\n",
    "T1=(500.+273.);#temperature of source in K\n",
    "T2=(200.+273.);#temperature of sink in K\n",
    "T3=(450.+273.);#temperature of body in K\n",
    "print(\"let the output of heat engine be W.so W/3 is consumed for driving auxiliary and remaining 2*W/3 is consumed for driving heat pump for heat engine,\")\n",
    "n=1-(T2/T1)\n",
    "print(\"n=W/Q1=\"),round(n,2)\n",
    "print(\"so n=W/Q1=0.3881\")\n",
    "COP=T3/(T3-T2)\n",
    "print(\"COP of heat pump=T3/(T3-T2)=Q3/(2*W/3)\"),round(COP,2)\n",
    "print(\"so 2.892=3*Q3/2*W\")\n",
    "print(\"Q3/Q1=\"),round(2*COP*n/3,4)\n",
    "print(\"so ratio of heat rejected to body at 450 degree celcius to the heat supplied by the reservoir=0.7482\")\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##example 4.16;pg no: 125"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 4.16, Page:125  \n",
      " \n",
      "\n",
      "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 16\n",
      "NOTE=>In question no. 16,condition for minimum surface area for a given work output is determine which cannot be solve using python software.\n"
     ]
    }
   ],
   "source": [
    "#intiation of all variables\n",
    "# Chapter 4\n",
    "print\"Example 4.16, Page:125  \\n \\n\"\n",
    "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 16\")\n",
    "print(\"NOTE=>In question no. 16,condition for minimum surface area for a given work output is determine which cannot be solve using python software.\")\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##example 4.17;pg no: 126"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 4.17, Page:126  \n",
      " \n",
      "\n",
      "Engineering Thermodynamics by Onkar Singh Chapter 4 Example 17\n",
      "NOTE=>In question no. 17 expression for (minimum theoretical ratio of heat supplied from source to heat absorbed from cold body) is derived which cannot be solve using python software.\n"
     ]
    }
   ],
   "source": [
    "#intiation of all variables\n",
    "# Chapter 4\n",
    "print\"Example 4.17, Page:126  \\n \\n\"\n",
    "print(\"Engineering Thermodynamics by Onkar Singh Chapter 4 Example 17\")\n",
    "print(\"NOTE=>In question no. 17 expression for (minimum theoretical ratio of heat supplied from source to heat absorbed from cold body) is derived which cannot be solve using python software.\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}