summaryrefslogtreecommitdiff
path: root/Engineering_Thermodynamics_by_O_Singh/4-Second_Law_Of_Thermodynamics.ipynb
blob: dfe1c0ed20360a4c8291cb94d29d120dbd7bd84a (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
{
"cells": [
 {
		   "cell_type": "markdown",
	   "metadata": {},
	   "source": [
       "# Chapter 4: Second Law Of Thermodynamics"
	   ]
	},
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 4.10: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_4_Example_10.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"// Display mode\n",
"mode(0);\n",
"// Display warning for floating point exception\n",
"ieee(1);\n",
"clear;\n",
"clc;\n",
"disp('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",
"disp('efficiency of engine,W/Q1=(800-T)/800')\n",
"disp('for refrigerator,COP=Q3/W=280/(T-280)')\n",
"disp('it is given that Q1=Q3=Q')\n",
"disp('so,from engine,W/Q=(800-T)/800')\n",
"disp('from refrigerator,Q/W=280/(T-280)')\n",
"disp('from above two(Q/W)may be equated,')\n",
"disp('(T-280)/280=(800-T)/800')\n",
"T=2*280*800/(800+280)\n",
"disp('so temperature(T)in K')\n",
"T\n",
"disp('efficiency of engine(n)is given as')\n",
"disp('n=(800-T)/800')\n",
"n=(800-T)/800\n",
"disp('COP of refrigerator is given as')\n",
"disp('COP=280/(T-280)')\n",
"COP=280/(T-280)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 4.11: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_4_Example_11.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"// Display mode\n",
"mode(0);\n",
"// Display warning for floating point exception\n",
"ieee(1);\n",
"clear;\n",
"clc;\n",
"disp('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",
"disp('let thermodynamic properties be denoted with respect to salient states;')\n",
"disp('n_carnot=1-T1/T2')\n",
"disp('so T1/T2=1-0.5')\n",
"1-0.5\n",
"disp('so T1/T2=0.5')\n",
"disp('or T2=2*T1')\n",
"disp('corresponding to state 2,p2*v2=m*R*T2')\n",
"disp('so temperature(T2)=p2*v2/(m*R) in K')\n",
"T2=p2*v2/(m*R)\n",
"disp('heat transferred during process 2-3(isothermal expansion),Q_23=40 KJ')\n",
"disp('Q_23=W_23=p2*v2*log(v3/v2)')\n",
"disp('so volume(v3)=v2*exp(Q_23/(p2*v2)) in m^3')\n",
"v3=v2*exp(Q_23/(p2*v2))\n",
"disp('temperature at state 1,T1=T2/2 in K')\n",
"T1=T2/2\n",
"disp('during process 1-2,T2/T1=(p2/p1)^((y-1)/y)')\n",
"disp('here expansion constant(y)=Cp/Cv')\n",
"y=Cp/Cv\n",
"disp('so pressure(p1)=p2/(T2/T1)^(y/(y-1)) in pa')\n",
"p1=p2/(T2/T1)^(y/(y-1))\n",
"disp('p1 in bar')\n",
"p1=p1/10^5\n",
"disp('thus p1*v1=m*R*T1')\n",
"disp('so volume(v1)=m*R*T1/(p1*10^5) in m^3')\n",
"v1=m*R*T1/(p1*10^5) \n",
"disp('heat transferred during process 4-1(isothermal compression)shall be equal to the heat transferred during process2-3(isothermal expansion).')\n",
"disp('for isentropic process,dQ=0,dW=dU')\n",
"disp('during process 1-2,isentropic process,W_12=-m*Cv*(T2-T1)in KJ')\n",
"disp('Q_12=0,')\n",
"W_12=-m*Cv*(T2-T1)\n",
"disp('W_12=-105.51 KJ(-ve work)')\n",
"disp('during process 3-4,isentropic process,W_34=-m*Cv*(T4-T3)in KJ')\n",
"disp('Q_31=0,')\n",
"T4=T1;\n",
"T3=T2;\n",
"W_34=-m*Cv*(T4-T3)\n",
"disp('ANS:')\n",
"disp('W_34=+105.51 KJ(+ve work)')\n",
"disp('so for process 1-2,heat transfer=0,work interaction=-105.51 KJ')\n",
"disp('for process 2-3,heat transfer=40 KJ,work intercation=40 KJ')\n",
"disp('for process 3-4,heat transfer=0,work interaction=+105.51 KJ')\n",
"disp('for process 4-1,heat transfer=-40 KJ,work interaction=-40 KJ')\n",
"disp('maximum temperature of cycle=585.36 KJ')\n",
"disp('minimum temperature of cycle=292.68 KJ')\n",
"disp('volume at the end of isothermal expansion=0.1932 m^3')\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
""
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 4.12: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_4_Example_12.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"// Display mode\n",
"mode(0);\n",
"// Display warning for floating point exception\n",
"ieee(1);\n",
"clear;\n",
"clc;\n",
"disp('Engineering Thermodynamics by Onkar Singh Chapter 4 Example 12')\n",
"W=840;//work done by reservoir in KJ\n",
"disp('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",
"disp('thus,Q1_a+Q1_b=Q1=5*10^3 KJ...............eq1')\n",
"disp('Also,Q1_a/Q2=400/300,or Q1_a=4*Q2/3...............eq2')\n",
"disp('Q1_b/Q3=400/200 or Q1_b=2*Q3...............eq3')\n",
"disp('substituting Q1_a and Q1_b in eq 1')\n",
"disp('4*Q2/3+2*Q3=5000...............eq4')\n",
"disp('also from total work output,Q1_a+Q1_b-Q2-Q3=W')\n",
"disp('5000-Q2-Q3=840')\n",
"disp('so Q2+Q3=5000-840=4160')\n",
"disp('Q3=4160-Q2')\n",
"disp('sunstituting Q3 in eq 4')\n",
"disp('4*Q2/3+2*(4160-Q2)=5000')\n",
"disp('so Q2=(5000-2*4160)/((4/3)-2) in KJ')\n",
"Q2=(5000-2*4160)/((4/3)-2)\n",
"disp('and Q3=4160-Q2 in KJ')\n",
"Q3=4160-Q2\n",
"disp('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",
"disp('Q2=4980 KJ,from heat engine')\n",
"disp('Q3=820 KJ,to heat engine')"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 4.13: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_4_Example_13.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"// Display mode\n",
"mode(0);\n",
"// Display warning for floating point exception\n",
"ieee(1);1\n",
"clear;\n",
"clc;\n",
"disp('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",
"disp('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",
"disp('for heat engine')\n",
"disp('ne=W/Q1=1-T2/T1')\n",
"disp('so (Q1-Q2)/Q1=')\n",
"1-T2/T1\n",
"disp('and Q2/Q1=')\n",
"1-0.7407\n",
"disp('Q2=0.2593*Q1')\n",
"disp('for heat pump,')\n",
"disp('COP_HP=Q4/(Q4-Q3)=T4/(T4-T3)')\n",
"T4=T2;\n",
"T4/(T4-T3)\n",
"disp('Q4/Q3=')\n",
"4.73/3.73\n",
"disp('Q4=1.27*Q3')\n",
"disp('work output from engine =work input to pump')\n",
"disp('Q1-Q2=Q4-Q3=>Q1-0.2593*Q1=Q4-Q4/1.27')\n",
"disp('so Q4/Q1=')\n",
"(1-0.2593)/(1-(1/1.27))\n",
"disp('so Q4=3.484*Q1')\n",
"disp('also it is given that Q2+Q4=100')\n",
"disp('subtituting Q2 and Q4 as function of Q1 in following expression,')\n",
"disp('Q2+Q4=100')\n",
"disp('so 0.2539*Q1+3.484*Q1=100')\n",
"disp('so energy taken by engine from reservoir at 1077 degree celcius(Q1)in KJ')\n",
"disp('Q1=100/(0.2539+3.484)in KJ')\n",
"Q1=100/(0.2539+3.484)\n",
"disp('NOTE=>In this question expression for calculating Q1 is written wrong in book which is corrected above.')"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 4.14: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_4_Example_14.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"// Display mode\n",
"mode(0);\n",
"// Display warning for floating point exception\n",
"ieee(1);\n",
"clear;\n",
"clc;\n",
"disp('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",
"disp('let temperature of sink be T_sink K')\n",
"disp('Q_sink_HE+Q_sink_R=3000 ........eq 1')\n",
"disp('since complete work output from engine is used to run refrigerator so,')\n",
"disp('2000-Q_sink_HE=Q_sink_R-Q_R .........eq 2')\n",
"disp('by eq 1 and eq 2,we get Q_R in KJ/s')\n",
"Q_R=3000-2000\n",
"disp('also for heat engine,2000/1500=Q_sink_HE/T_sink')\n",
"disp('=>Q_sink_HE=4*T_sink/3')\n",
"disp('for refrigerator,Q_R/288=Q_sink_R/T_sink=>Q_sink_R=1000*T_sink/288')\n",
"disp('substituting Q_sink_HE and Q_sink_R values')\n",
"disp('4*T_sink/3+1000*T_sink/288=3000')\n",
"disp('so temperature of sink(T_sink)in K')\n",
"disp('so T_sink=3000/((4/3)+(1000/288))')\n",
"T_sink=3000/((4/3)+(1000/288))\n",
"disp('T_sink in degree celcius')\n",
"T_sink=T_sink-273"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 4.15: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_4_Example_15.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"// Display mode\n",
"mode(0);\n",
"// Display warning for floating point exception\n",
"ieee(1);\n",
"clear;\n",
"clc;\n",
"disp('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",
"disp('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",
"disp('n=W/Q1=1-(T2/T1)')\n",
"n=1-(T2/T1)\n",
"disp('so n=W/Q1=0.3881')\n",
"disp('COP of heat pump=T3/(T3-T2)=Q3/(2*W/3)')\n",
"COP=T3/(T3-T2)\n",
"disp('so 2.892=3*Q3/2*W')\n",
"disp('Q3/Q1=')\n",
"2*COP*n/3\n",
"disp('so ratio of heat rejected to body at 450 degree celcius to the heat supplied by the reservoir=0.7482')"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 4.16: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_4_Example_16.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"// Display mode\n",
"mode(0);\n",
"// Display warning for floating point exception\n",
"ieee(1);\n",
"clear;\n",
"clc;\n",
"disp('Engineering Thermodynamics by Onkar Singh Chapter 4 Example 16')\n",
"disp('NOTE=>In question no. 16,condition for minimum surface area for a given work output is determine which cannot be solve using scilab software.')"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 4.17: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_4_Example_17.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"// Display mode\n",
"mode(0);\n",
"// Display warning for floating point exception\n",
"ieee(1);\n",
"clear;\n",
"clc;\n",
"disp('Engineering Thermodynamics by Onkar Singh Chapter 4 Example 17')\n",
"disp('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 scilab software.')"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 4.1: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_4_Example_1.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"// Display mode\n",
"mode(0);\n",
"// Display warning for floating point exception\n",
"ieee(1);\n",
"clear;\n",
"clc;\n",
"disp('Engineering Thermodynamics by Onkar Singh Chapter 4 Example 1')\n",
"disp('NOTE=>This question is fully theoritical hence cannot be solve using scilab.')"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 4.2: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_4_Example_2.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"// Display mode\n",
"mode(0);\n",
"// Display warning for floating point exception\n",
"ieee(1);\n",
"clear;\n",
"clc;\n",
"disp('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",
"disp('in carnot engine from thermodynamics temperature scale')\n",
"disp('Q1/Q2=T1/T2')\n",
"disp('W=Q1-Q2=200 KJ')\n",
"disp('from above equations Q1 in KJ is given by')\n",
"disp('Q1=(200*T1)/(T1-T2)')\n",
"Q1=(200*T1)/(T1-T2)\n",
"disp('and Q2 in KJ')\n",
"disp('Q2=Q1-200')\n",
"Q2=Q1-200\n",
"disp('so heat supplied(Q1) in KJ')\n",
"Q1"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 4.3: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_4_Example_3.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"// Display mode\n",
"mode(0);\n",
"// Display warning for floating point exception\n",
"ieee(1);\n",
"clear;\n",
"clc;\n",
"disp('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",
"disp('from thermodynamic temperature scale')\n",
"disp('Q1/Q2=T1/T2')\n",
"disp('so Q1=Q2*(T1/T2)in KJ/s')\n",
"Q1=Q2*(T1/T2)\n",
"disp('power/work input required(W)=Q1-Q2 in KJ/s ')\n",
"W=Q1-Q2\n",
"disp('power required for driving refrigerator=W in KW')\n",
"W"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 4.4: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_4_Example_4.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"// Display mode\n",
"mode(0);\n",
"// Display warning for floating point exception\n",
"ieee(1);\n",
"clear;\n",
"clc;\n",
"disp('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",
"disp('we can writefor heat engine,Q1/Q2=T1/T2')\n",
"disp('so Q2=Q1*(T2/T1) in KJ')\n",
"Q2=Q1*(T2/T1)\n",
"disp('so We=Q1-Q2 in KJ')\n",
"We=Q1-Q2\n",
"disp('for refrigerator,Q3/Q4=T3/T4 eq 1')\n",
"T4=T2;//temperature of low temperature reservoir in K\n",
"disp('now We-Wr=300')\n",
"disp('so Wr=We-300 in KJ')\n",
"Wr=We-300\n",
"disp('and Wr=Q4-Q3=1154.55 KJ eq 2 ')\n",
"disp('solving eq1 and eq 2 we get')\n",
"disp('Q4=(1154.55*T4)/(T4-T3)in KJ')\n",
"Q4=(1154.55*T4)/(T4-T3)\n",
"disp('and Q3=Q4-Wr in KJ')\n",
"Q3=Q4-Wr\n",
"disp('total heat transferred to low teperature reservoir(Q) =Q2+Q4 in KJ')\n",
"Q=Q2+Q4\n",
"disp('hence heat transferred to refrigerant=Q3 in KJ')\n",
"Q3\n",
"disp('and heat transferred to low temperature reservoir=Q in KJ')\n",
"Q"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 4.5: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_4_Example_5.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"// Display mode\n",
"mode(0);\n",
"// Display warning for floating point exception\n",
"ieee(1);\n",
"clear;\n",
"clc;\n",
"disp('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",
"disp('COP_HP=Q1/W=Q1/(Q1-Q2)=1/(1-(Q2/Q1))')\n",
"disp('also we know K=Q1/Q2=T1/T2')\n",
"disp('so K=T1/T2')\n",
"K=T1/T2\n",
"disp('so COP_HP=1/(1-(Q2/Q1)=1/(1-(1/K))')\n",
"COP_HP=1/(1-(1/K))\n",
"disp('also COP_HP=Q1/W')\n",
"disp('W=Q1/COP_HP in MJ/Hr')\n",
"W=Q1/COP_HP\n",
"disp('or W=1000*W/3600 in KW')\n",
"W=1000*W/3600\n",
"disp('so minimum power required(W)in KW ')\n",
"W"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 4.6: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_4_Example_6.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"// Display mode\n",
"mode(0);\n",
"// Display warning for floating point exception\n",
"ieee(1);\n",
"clear;\n",
"clc;\n",
"disp('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",
"disp('cold storage plant can be considered as refrigerator operating between given temperatures limits')\n",
"disp('capacity of plant=heat to be extracted=Q2 in KW')\n",
"disp('we know that,one ton of refrigeration as 3.52 KW ')\n",
"disp('so Q2=Q2*3.52 in KW')\n",
"Q2=Q2*3.52\n",
"disp('carnot COP of plant(COP_carnot)=1/((T2/T1)-1)')\n",
"COP_carnot=1/((T2/T1)-1)\n",
"disp('performance is 1/4 of its carnot COP')\n",
"disp('COP=COP_carnot/4')\n",
"COP=COP_carnot/4\n",
"disp('also actual COP=Q2/W')\n",
"disp('W=Q2/COP in KW')\n",
"W=Q2/COP\n",
"disp('hence power required(W)in KW')\n",
"W\n",
"\n",
"\n",
"\n",
"\n",
"\n",
""
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 4.7: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_4_Example_7.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"// Display mode\n",
"mode(0);\n",
"// Display warning for floating point exception\n",
"ieee(1);\n",
"clear;\n",
"clc;\n",
"disp('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",
"disp('highest efficiency is that of carnot engine,so let us find the carnot cycle efficiency for given temperature limits')\n",
"disp('n=1-(T2/T1)')\n",
"n=1-(T2/T1)\n",
"disp('or n=n*100 %')\n",
"n=n*100"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 4.8: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_4_Example_8.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"// Display mode\n",
"mode(0);\n",
"// Display warning for floating point exception\n",
"ieee(1);\n",
"clear;\n",
"clc;\n",
"disp('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",
"disp('here heat to be removed continuously from refrigerated space(Q)in KJ/s')\n",
"Q=Q/60\n",
"disp('for refrigerated,COP shall be Q/W=1/((T1/T2)-1)')\n",
"disp('W=Q*((T1/T2)-1) in KW')\n",
"W=Q*((T1/T2)-1)\n",
"disp('so power required(W)in KW')\n",
"W"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 4.9: Engineering_Thermodynamics_by_Onkar_Singh_Chapter_4_Example_9.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"// Display mode\n",
"mode(0);\n",
"// Display warning for floating point exception\n",
"ieee(1);\n",
"clear;\n",
"clc;\n",
"disp('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",
"disp('here W1:W2:W3=3:2:1')\n",
"disp('efficiency of engine,HE1,')\n",
"disp('W1/Q1=(1-(T2/1100))')\n",
"disp('so Q1=(1100*W1)/(1100-T2)')\n",
"disp('for HE2 engine,W2/Q2=(1-(T3/T2))')\n",
"disp('for HE3 engine,W3/Q3=(1-(300/T3))')\n",
"disp('from energy balance on engine,HE1')\n",
"disp('Q1=W1+Q2=>Q2=Q1-W1')\n",
"disp('above gives,Q1=(((1100*W1)/(1100-T2))-W1)=W1*(T2/(1100-T2))')\n",
"disp('substituting Q2 in efficiency of HE2')\n",
"disp('W2/(W1*(T2/(1100-T2)))=1-(T3/T2)')\n",
"disp('W2/W1=(T2/(1100-T2))*(T2-T3)/T2=((T2-T3)/(1100-T2))')\n",
"disp('2/3=(T2-T3)/(1100-T2)')\n",
"disp('2200-2*T2=3*T2-3*T3')\n",
"disp('5*T2-3*T3=2200')\n",
"disp('now energy balance on engine HE2 gives,Q2=W2+Q3')\n",
"disp('substituting in efficiency of HE2,')\n",
"disp('W2/(W2+Q3)=(T2-T3)/T2')\n",
"disp('W2*T2=(W2+Q3)*(T2-T3)')\n",
"disp('Q3=(W2*T3)/(T2-T3)')\n",
"disp('substituting Q3 in efficiency of HE3,')\n",
"disp('W3/((W2*T3)/(T2-T3))=(T3-300)/T3')\n",
"disp('W3/W2=(T3/(T2-T3))*(T3-300)/T3')\n",
"disp('1/2=(T3-300)/(T2-T3)')\n",
"disp('3*T3-T2=600')\n",
"disp('solving equations of T2 and T3,')\n",
"disp('we get,T3=(600+(2200/5))/(3-(3/5))in K')\n",
"T3=(600+(2200/5))/(3-(3/5))\n",
"disp('and by eq 5,T2 in K')\n",
"T2=(2200+3*T3)/5\n",
"disp('so intermediate temperature are 700 K and 433.33 K')"
   ]
   }
],
"metadata": {
		  "kernelspec": {
		   "display_name": "Scilab",
		   "language": "scilab",
		   "name": "scilab"
		  },
		  "language_info": {
		   "file_extension": ".sce",
		   "help_links": [
			{
			 "text": "MetaKernel Magics",
			 "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
			}
		   ],
		   "mimetype": "text/x-octave",
		   "name": "scilab",
		   "version": "0.7.1"
		  }
		 },
		 "nbformat": 4,
		 "nbformat_minor": 0
}