summaryrefslogtreecommitdiff
path: root/Fundamental_Of_Engineering_Thermodynamics_by_M_J_Moran/7-Exergy_analysis.ipynb
blob: 44f9d128253ea6b49da99f1bbba476993a4a27dd (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
{
"cells": [
 {
		   "cell_type": "markdown",
	   "metadata": {},
	   "source": [
       "# Chapter 7: Exergy analysis"
	   ]
	},
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 7.10: Example_10.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"//(7.10)  A cogeneration system consists of a natural gas-fueled boiler and a steam turbine that develops power and provides steam for an industrial process. At steady state, fuel enters the boiler with an exergy rate of 100 MW. Steam exits the boiler at 50 bar, 466C with an exergy rate of 35 MW. Steam exits the turbine at 5 bar, 205C and a mass flow rate of 26.15 kg/s. The unit cost of the fuel is 1.44 cents per kw.h  of exergy. The costs of owning and operating the boiler and turbine are, respectively, dollar 1080/h and dollar 92/h. The feedwater and combustion air enter with negligible exergy and cost. The combustion products are discharged directly to the surroundings with negligible cost. Heat transfer with the surroundings and kinetic and potential energy effects are negligible. Let T0 = 298 K. (a) For the turbine, determine the power and the rate exergy exits with the steam, each in MW. (b) Determine the unit costs of the steam exiting the boiler, the steam exiting the turbine, and the power, each in cents per kw.h of exergy. (c) Determine the cost rates of the steam exiting the turbine and the power, each in $/h.\n",
"\n",
"\n",
"//solution\n",
"\n",
"//variable initialization\n",
"EfFdot = 100                                                     //exergy rate of fuel entering the boiler in MW\n",
"cF = 1.44                                                        //unit cost of fuel in cents per kw.h\n",
"Zbdot = 1080                                                     //the cost of owning and operating boiler in dollars per hour\n",
"Ef1dot = 35                                                      //exergy rate of exiting steam from the boiler in MW\n",
"p1 = 50                                                          //pressure of exiting steam from the boiler in bar\n",
"T1 = 466                                                         //temperature of exiting steam from the boiler in degree celcius\n",
"Ztdot = 92                                                       //the cost of owning and operating turbine in dollars per hour\n",
"p2 = 5                                                           //pressure of exiting steam from the turbine in bars\n",
"T2 = 205                                                         //temperature of exiting steam from the turbine in degree celcius\n",
"m2dot = 26.15                                                    //mass flow rate of exiting steam from the turbine in kg/s\n",
"T0 = 298                                                         //in kelvin \n",
"\n",
"\n",
"//part(a)\n",
"//from table A-4,\n",
"h1 = 3353.54                                                     //in kj/kg\n",
"h2 = 2865.96                                                     //in kj/kg\n",
"//from assumption,For each control volume,Qcvdot = 0 and kinetic and potential energy effects are negligible,the mass and energy rate balances for a control volume enclosing the turbine reduce at steady state to give\n",
"Wedot = m2dot *(h1-h2)/1000                                      //power in MW\n",
"\n",
"//from table A-4\n",
"s1 = 6.8773                                                      //in kj/kg.k\n",
"s2 = 7.0806                                                      //in kj/kg.k\n",
"\n",
"Ef2dot = Ef1dot+m2dot*(h2-h1-T0*(s2-s1))/1000                    //the rate exergy exits with the steam in MW\n",
"printf('for the turbine,the power in MW is:\t%f',Wedot)\n",
"printf('\nfor the turbine,the rate exergy exits with the steam in MW is:\t%f',Ef2dot)\n",
"\n",
"//part(b)\n",
"c1 = cF*(EfFdot/Ef1dot) + ((Zbdot/Ef1dot)/10^3)*100              //unit cost of exiting steam from boiler in cents/Kw.h\n",
"c2 = c1                                                          //Assigning the same unit cost to the steam entering and exiting the turbine\n",
"ce = c1*((Ef1dot-Ef2dot)/Wedot) + ((Ztdot/Wedot)/10^3)*100       //unit cost of power in cents/kw.h\n",
"\n",
"printf('\n\nthe unit costs of the steam exiting the boiler in cents per kw.h of exergy is:\t%f',c1)\n",
"printf('\nthe unit costs of the steam exiting the turbine in cents per kw.h of exergy is:\t%f',c2)\n",
"printf('\nunit cost of power in cents per kw.h is:\t%f',ce)\n",
"\n",
"//part(c)\n",
"C2dot = (c2*Ef2dot*10^3)/100                                      //cost rate for low-pressure steam in dollars per hour\n",
"Cedot = (ce*Wedot*10^3)/100                                       //cost rate for power in dollars per hour\n",
"\n",
"printf('\n\nthe cost rate of the steam exiting the turbine in dollars per hour is:  %f',C2dot)\n",
"printf('\nthe cost rate of the power in dollars per hour is:  %f',Cedot)\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
""
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 7.1: Example_1.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"// (7.1)  A cylinder of an internal combustion engine contains 2450 cm3 of gaseous combustion products at a pressure of 7 bar and a temperature of 867C just before the exhaust valve opens. Determine the specific exergy of the gas, in kJ/kg. Ignore the effects of motion and gravity, and model the combustion products as air as an ideal gas. Take T0 = 300 K (27C) and p0=  1.013 bar.\n",
"\n",
"\n",
"//solution\n",
"\n",
"\n",
"//variable initialization\n",
"v = 2450                                                    //volume of gaseous products in cm^3\n",
"P = 7                                                       //pressure of gaseous product in bar\n",
"T = 867                                                     //temperature of gaseous product in degree celcius\n",
"T0 = 300                                                    //in kelvin\n",
"P0 = 1.013                                                  //in bar\n",
"\n",
"//from table A-22\n",
"u = 880.35                                                  //in kj/kg\n",
"u0 = 214.07                                                 //in kj/kg\n",
"s0(T) = 3.11883                                             //in kj/kg.k\n",
"s0(T0) = 1.70203                                            //in kj/kg.k\n",
"\n",
"e = (u-u0) + (P0*(8.314/28.97)*[((T+273)/P)-(T0/P0)]) - T0*[s0(T)-s0(T0)-(8.314/28.97)*log(P/P0)]           //in kj/kg\n",
"printf('the specific exergy of the gas, in kJ/kg is \n\t e = %f',e)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 7.2: Example_2.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"//(7.2)   Refrigerant 134a, initially a saturated vapor at -28C, is contained in a rigid, insulated vessel. The vessel is fitted with a paddle wheel connected to a pulley from which a mass is suspended. As the mass descends a certain distance, the refrigerant is stirred until it attains a state where the pressure is 1.4 bar. The only significant changes of state are experienced by the suspended mass and the refrigerant. The mass of refrigerant is 1.11 kg. Determine (a) the initial exergy, final exergy, and change in exergy of the refrigerant, each in kJ. (b) the change in exergy of the suspended mass, in kJ. (c) the change in exergy of an isolated system of the vessel and pulley–mass assembly, in kJ. Discuss the results obtained, and compare with the respective energy changes. Let T0 = 293 K (20C), p0 = 1 bar.\n",
"\n",
"//solution \n",
"\n",
"//variable initialization\n",
"mR = 1.11                                       //mass of the refrigerant in kg\n",
"T1 = -28                                        //initial temperature of the saturated vapor in degree celcius\n",
"P2 = 1.4                                        //final pressure of the refrigerant in bar\n",
"T0 = 293                                        //in kelvin\n",
"P0 = 1                                          //in bar\n",
"\n",
"//part (a)\n",
"//from table A-10\n",
"u1 = 211.29                                    //in kj/kg\n",
"v1 = .2052                                     //in m^3/kg\n",
"s1 = .9411                                     //in kj/kg.k\n",
"//from table A-12\n",
"u0 = 246.67                                    //in kj/kg\n",
"v0 = .23349                                    //in m^3/kg\n",
"s0 = 1.0829                                    //in kj/kg.k\n",
"\n",
"E1 = mR*[(u1-u0) + P0*10^5*(v1-v0)*10^(-3)-T0*(s1-s0)]\n",
"\n",
"//from table A-12\n",
"u2 = 300.16                                    //in kj/kg\n",
"s2 = 1.2369                                    //in kj/kg.k\n",
"v2 = v1\n",
"\n",
"E2 = mR*[(u2-u0) + P0*10^5*(v2-v0)*10^(-3)-T0*(s2-s0)]\n",
"\n",
"printf('part(a)the initial exergy in kj is :\n\t E1 = %f',E1)\n",
"printf('\nthe final exergy in kj is :\n\t E2 = %f',E2)\n",
"printf('\nthe change in exergy of the refrigerant in kj is \n\tdeltaE = %f',E2-E1)\n",
"\n",
"\n",
"//part (b)\n",
"deltaU = mR*(u2-u1)\n",
"//from energy balance\n",
"deltaPE = -deltaU\n",
"//with the assumption::The only significant changes of state are experienced by the refrigerant and the suspended mass. For the refrigerant, there is no change in kinetic or potential energy. For the suspended mass, there is no change in kinetic or internal energy. Elevation is the only intensive property of the suspended mass that changes\n",
"deltaE = deltaPE\n",
"printf('\n\n\npart(b)the change in exergy of the suspended mass, in kJ is :\n\t deltaE = %f',deltaE)\n",
"\n",
"\n",
"//part(c)\n",
"deltaEiso = (E2-E1) + deltaE\n",
"printf('\n\n\npart(c)the change in exergy of an isolated system of the vessel and pulley–mass assembly, in kJ is :\n\t deltaEiso = %f',deltaEiso)\n",
"\n",
"\n",
"\n",
""
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 7.3: Example_3.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"//(7.3)    Water initially a saturated liquid at 100C is contained in a piston–cylinder assembly. The water undergoes a process to the corresponding saturated vapor state, during which the piston moves freely in the cylinder. For each of the two processes described below, determine on a unit of mass basis the change in exergy, the exergy transfer accompanying work, the exergy transfer accompanying heat, and the exergy destruction, each in kJ/kg. Let T0 = 20C, p0 = 1.014 bar. (a) The change in state is brought about by heating the water as it undergoes an internally reversible process at constant temperature and pressure. (b) The change in state is brought about adiabatically by the stirring action of a paddle wheel.\n",
"\n",
"\n",
"//solution\n",
"\n",
"//variable initialization\n",
"T = 373.15                                               //initial temperature of saturated liquid in kelvin\n",
"T0 = 293.15                                              //in kelvin\n",
"P0 = 1.014                                               //in bar\n",
"\n",
"\n",
"//part(a)\n",
"//from table A-2\n",
"ug = 2506.5                                              //in kj/kg\n",
"uf = 418.94                                              //in kj/kg\n",
"vg = 1.673                                               //in m^3/kg\n",
"vf = 1.0435*10^(-3)                                              //in m^3/kg\n",
"sg = 7.3549                                              //in kj/kg.k\n",
"sf = 1.3069                                              //in kj/kg.k\n",
"\n",
"deltae = ug-uf + P0*10^5*(vg-vf)/(10^3)-T0*(sg-sf)\n",
"\n",
"//exergy transfer accompanying work\n",
"etaw = 0                                                 //since p = p0\n",
"\n",
"//exergy transfer accompanying heat\n",
"Q = 2257                                                 //in kj/kg,obtained from example 6.1\n",
"etah = (1-(T0/T))*Q\n",
"\n",
"//exergy destruction\n",
"ed = 0                                                   //since the process is accomplished without any irreversibilities\n",
"\n",
"printf('part(a)the change in exergy in kj/kg is:\n\t deltae = %f ',deltae)\n",
"printf('\nthe exergy transfer accompanying work in kj/kg is:\n\t etaw = %f',etaw)\n",
"printf('\nthe exergy transfer accompanying heat in kj/kg is:\n\t etah = %f',etah)\n",
"printf('\nthe exergy destruction in kj/kg is:\n\t ed = %f',ed)\n",
"\n",
"\n",
"//part(b)\n",
"Deltae = deltae                                          //since the end states are same \n",
"Etah = 0                                                 //since process is adiabatic\n",
"//exergy transfer along work\n",
"W = -2087.56                                             //in kj/kg from example 6.2\n",
"Etaw = W- P0*10^5*(vg-vf)/(10^3)\n",
"//exergy destruction\n",
"Ed = -Deltae-Etaw\n",
"\n",
"printf('\n\n\npart(b)the change in exergy in kj/kg is:\n\t Deltae = %f ',Deltae)\n",
"printf('\nthe exergy transfer accompanying work in kj/kg is:\n\t Etaw = %f',Etaw)\n",
"printf('\nthe exergy transfer accompanying heat in kj/kg is:\n\t Etah = %f',Etah)\n",
"printf('\nthe exergy destruction in kj/kg is:\n\t Ed = %f',Ed)\n",
"\n",
"\n",
"\n",
"\n",
"\n",
""
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 7.4: Example_4.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"//(7.4)    For the gearbox of Examples 2.4 and 6.4(a), develop a full exergy accounting of the power input. Let T0 = 293 K.\n",
"\n",
"\n",
"//solution\n",
"\n",
"//Since the gearbox volume is constant, the rate of exergy transfer accompanying power reduces to the power itself. Accordingly, exergy is transferred into the gearbox via the high-speed shaft at a rate equal to the power input, 60 kW, and exergy is transferred out via the low-speed shaft at a rate equal to the power output, 58.8 kW. Additionally, exergy is transferred out accompanying heat transfer and destroyed by irreversibilities within the gearbox.\n",
"\n",
"T0 = 293                                         //in kelvin\n",
"Qdot = -1.2                                      //in KW, from example 6.4a\n",
"Tb = 300                                         //temperature at the outer surface of the gearbox in kelvin from example 6.4a\n",
"sigmadot = 4e-3                                  //rate of entropy production in KW/k from example 6.4a\n",
"\n",
"R = (1-T0/Tb)*Qdot                              //time rate of exergy transfer accompanying heat\n",
"Eddot = T0*sigmadot                             //rate of exergy destruction\n",
"\n",
"printf('balance sheet')\n",
"printf('\nrate of exergy in:\n high speed shaft\t\t 60Kw')  \n",
"printf('\nDisposition of the exergy:\n• Rate of exergy out\nlow-speed shaft\t\t 58.8Kw') \n",
"printf('\nheat transfer in kw\t\t%f',norm(R))\n",
"printf('\n• Rate of exergy destruction in kw\t\t%f',Eddot)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 7.5: Example_5.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"//Superheated water vapor enters a valve at 3.0 MPa, 320C and exits at a pressure of 0.5 MPa. The expansion is a throttling process. Determine the specific flow exergy at the inlet and exit and the exergy destruction per unit of mass flowing, each in kJ/kg. Let T0 = 25C, p0=  1 atm.\n",
"\n",
"//solution\n",
"\n",
"//variable initialization\n",
"p1 = 3                                              //entry pressure in Mpa\n",
"p2 = .5                                             //exit pressure in Mpa\n",
"T1 = 320                                            //entry temperature in degree celcius\n",
"T0 = 25                                             //in degree celcius\n",
"p0 = 1                                              //in atm\n",
"\n",
"\n",
"//from table A-4\n",
"h1 = 3043.4                                         //in kj/kg\n",
"s1 = 6.6245                                         //in kj/kg.k\n",
"\n",
"h2 = h1                                             //from reduction of the steady-state mass and energy rate balances\n",
"\n",
"s2 = 7.4223                                         //Interpolating at a pressure of 0.5 MPa with h2 = h1, units in kj/kg.k\n",
"\n",
"//from table A-2\n",
"h0 = 104.89                                        //in kj/kg\n",
"s0 = 0.3674                                        //in kj/kg.k\n",
"\n",
"ef1 = h1-h0-(T0+273)*(s1-s0)                             //flow exergy at the inlet\n",
"ef2 = h2-h0-(T0+273)*(s2-s0)                             //flow exergy at the exit\n",
"\n",
"//from the steady-state form of the exergy rate balance\n",
"Ed = ef1-ef2                                       //the exergy destruction per unit of mass flowing is\n",
"\n",
"printf(' the specific flow exergy at the inlet in kj/kg is :\n\t ef1 =%f',ef1)\n",
"printf('\nthe specific flow exergy at the exit in kj/kg is:\n\t ef2 = %f',    ef2)\n",
"printf('\nthe exergy destruction per unit of mass flowing in kj/kg is:\n\t = %f',Ed)\n",
"\n",
"\n",
"\n",
"\n",
""
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 7.6: Example_6.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"//Compressed air enters a counterflow heat exchanger operating at steady state at 610 K, 10 bar and exits at 860 K, 9.7 bar. Hot combustion gas enters as a separate stream at 1020 K, 1.1 bar and exits at 1 bar. Each stream has a mass flow rate of 90 kg/s. Heat transfer between the outer surface of the heat exchanger and the surroundings can be ignored. Kinetic and potential energy effects are negligible. Assuming the combustion gas stream has the properties of air, and using the ideal gas model for both streams, determine for the heat exchanger(a) the exit temperature of the combustion gas, in K. (b) the net change in the flow exergy rate from inlet to exit of each stream, in MW. (c) the rate exergy is destroyed, in MW. Let T0 = 300 K, p0 = 1 bar.\n",
"\n",
"\n",
"//solution\n",
"\n",
"//variable initialization\n",
"T1 = 610                                                   //temperature of the air entering heat exchanger in kelvin\n",
"p1 = 10                                                    //pressure of the air entering heat exchanger in bar\n",
"T2 = 860                                                   //temperature of the air exiting the heat exchanger in kelvin\n",
"p2 = 9.7                                                   //pressure of the air exiting the heat exchanger in bar\n",
"T3 = 1020                                                  //temperature of entering hot combustion gas in kelvin\n",
"p3 = 1.1                                                  //pressure of entering hot  combustion gas in bar\n",
"p4 = 1                                                     //pressure of exiting hot combustion gas in bar\n",
"mdot = 90                                               //mass flow rate in kg/s\n",
"T0 = 300                                                   //in kelvin\n",
"p0 = 1                                                     //in bar\n",
"\n",
"//part (a)\n",
"//from table A-22\n",
"h1 = 617.53                                               //in kj/kg\n",
"h2 = 888.27                                               //in kj/kg\n",
"h3 = 1068.89                                              //in kj/kg\n",
"\n",
"//from reduction of mass and energy rate balances for the control volume at steady state \n",
"h4 = h3+h1-h2\n",
"\n",
"//using interpolation in table A-22 gives\n",
"T4 = 778                                                 //in kelvin\n",
"printf('the exit temperature of the combustion gas in kelvin is:\n\tT4 = %f',T4)\n",
"\n",
"\n",
"//part(b)\n",
"//from table A-22\n",
"s2 = 2.79783                                           //in kj/kg.k\n",
"s1 = 2.42644                                           //in kj/kg.k\n",
"\n",
"deltaR = (mdot*((h2-h1)-T0*(s2-s1-(8.314/28.97)*log(p2/p1))))/1000\n",
"\n",
"//from table A-22\n",
"s4 = 2.68769                                          //in kj/kg.k\n",
"s3 = 2.99034                                          //in kj/kg.k\n",
"\n",
"deltRc = mdot*((h4-h3)-T0*(s4-s3-(8.314/28.97)*log(p4/p3)))/1000\n",
"\n",
"printf('\nthe net change in the flow exergy rate from inlet to exit of compressed gas in MW is:\n\t  deltaR = %f',deltaR)\n",
"printf('\nthe net change in the flow exergy rate from inlet to exit of hot combustion gas in MW is:\n\tdeltRc =%f ',deltRc)\n",
"\n",
"//part(c)\n",
"//from an exergy rate balance\n",
"Eddot = -deltaR-deltRc\n",
"\n",
"printf('\nthe rate exergy  destroyed, in MW is:Eddot = %f',Eddot)\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
""
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 7.7: Example_7.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"//Steam enters a turbine with a pressure of 30 bar, a temperature of 400C, a velocity of 160 m/s. Steam exits as saturated vapor at 100C with a velocity of 100 m/s. At steady state, the turbine develops work at a rate of 540 kJ per kg of steam flowing through the turbine. Heat transfer between the turbine and its surroundings occurs at an average outer surface temperature of 350 K. Develop a full accounting of the net exergy carried in by the steam, per unit mass of steam flowing. Neglect the change in potential energy between inlet and exit. Let T0 = 25C, p0=  1 atm.\n",
"\n",
"//solution\n",
"\n",
"//variable initialization\n",
"p1 = 30                                                 //pressure of entering steam in bar\n",
"t1 = 400                                                //temperature of entering steam in degree celcius\n",
"v1 = 160                                                //velocity of entering steam in m/s\n",
"t2 = 100                                                //temperature of exiting saturated vapor in degree celcius\n",
"v2 = 100                                                //velocity of exiting saturated vapor in m/s\n",
"W = 540                                                 //rate of work developed in kj per kg of steam\n",
"Tb = 350                                                //the temperature on the boundary where heat transfer occurs in kelvin\n",
"T0 = 25                                                 //in degree celcius\n",
"p0 = 1                                                  //in atm\n",
"\n",
"//from table A-4\n",
"h1 = 3230.9                                             //in kj/kg\n",
"s1 = 6.9212                                             //in kj/kg.k\n",
"//from table A-2 \n",
"h2 = 2676.1                                             //in kj/kg\n",
"s2 = 7.3549                                             //in kj/kg.k\n",
"\n",
"DELTAef = (h1-h2)-(T0+273)*(s1-s2)+(v1^2-v2^2)/(2*1000)              //The net exergy carried in per unit mass of steam flowing in kj/kg\n",
"\n",
"//from example 6.6\n",
"Q = -22.6                                               //in kj/kg\n",
"Eq = (1-(T0+273)/Tb)*(Q)                                      //exergy transfer accompanying heat in kj/kg\n",
"\n",
"Ed = (1-(T0+273)/Tb)*(Q)-W+(DELTAef)                          //The exergy destruction determined by rearranging the steady-state form of the exergy rate balanceff\n",
"\n",
"printf('balance sheet')\n",
"printf('\nNet rate of exergy in:\t%f',DELTAef)\n",
"printf('\nDisposition of the exergy:')\n",
"printf('\n• Rate of exergy out')\n",
"printf('\nwork\t%f',W)\n",
"printf('\nheat transfer\t%f',-Eq)\n",
"printf('\n• Rate of exergy destruction\t%f',Ed)\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
""
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 7.8: Example_8.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"//(7.8) Suppose the system of Example 4.10 is one option under consideration for utilizing the combustion products discharged from an industrial process. (a) Develop a full accounting of the net exergy carried in by the combustion products. (b) Discuss the design implications of the results.\n",
"\n",
"\n",
"//solution\n",
"\n",
"//variable initialization\n",
"m1dot = 69.78                                                     //in kg/s\n",
"p1 = 1                                                            //in bar\n",
"T1 = 478                                                          //in kelvin\n",
"T2 = 400                                                          //in kelvin\n",
"p2 = 1                                                            //in bar\n",
"p3 = .275                                                         //in Mpa\n",
"T3 = 38.9                                                         //in degree celcius\n",
"m3dot = 2.08                                                      //in kg/s\n",
"T4 = 180                                                          //in degree celcius\n",
"p4 = .275                                                         //in Mpa\n",
"p5 = .07                                                          //in bar\n",
"x5 = .93\n",
"Wcvdot = 876.8                                                      //in kW\n",
"T0 = 298                                                          //in kelvin\n",
"\n",
"\n",
"//part(a)\n",
"//from table A-22\n",
"h1 = 480.35                                                        //in kj/kg\n",
"h2 = 400.97                                                        //in kj/kg\n",
"s1 = 2.173                                                         //in kj/kg\n",
"s2 = 1.992                                                         //in kj/kg\n",
"\n",
"netRE = m1dot*(h1-h2-T0*(s1-s2-(8.314/28.97)*log(p1/p2)))          //the net rate exergy  carried into the control volume\n",
"\n",
"\n",
"//from table A-2E\n",
"h3 = 162.82                                                        //in kj/kg\n",
"s3 = .5598                                                         //in kj/kg.k\n",
"//Using saturation data at 0.07 bars from Table A-3\n",
"h5 = 2403.27                                                       //in kj/kg\n",
"s5 = 7.739                                                         //in kj/kg.k\n",
"\n",
"netREout = m3dot*(h5-h3-T0*(s5-s3))                                //the net rate exergy carried out by the water stream\n",
"\n",
"//from table A-4\n",
"h4 = 2825                                                          //in kj/kg\n",
"s4 = 7.2196                                                        //in kj/kg.k\n",
"\n",
"//from an exergy rate balance applied to a control volume enclosing the steam generator\n",
"Eddot = netRE + m3dot*(h3-h4-T0*(s3-s4))                           //the rate exergy is destroyed in the heat-recovery steam generator\n",
"\n",
"//from an exergy rate balance applied to a control volume enclosing the turbine\n",
"EdDot = -Wcvdot + m3dot*(h4-h5-T0*(s4-s5))                         //the rate exergy is destroyed in the tpurbine\n",
"\n",
"\n",
"printf('balance sheet')\n",
"printf('\nNet rate of exergy in:\t%f',netRE)\n",
"printf('\nDisposition of the exergy:')\n",
"printf('\n• Rate of exergy out')\n",
"printf('\npower developed\t%f',1772.8-netREout-Eddot-EdDot)\n",
"printf('\nwater stream\t%f',netREout)\n",
"printf('\n• Rate of exergy destruction')\n",
"printf('\nheat-recovery steam generator\t%f',Eddot)\n",
"printf('\nturbine\t%f',EdDot)\n",
"\n",
"\n",
"\n",
"\n",
"\n",
""
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 7.9: Example_9.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"//(7.9)    For the heat pump of Examples 6.8 and 6.14, determine the exergy destruction rates, each in kW, for the compressor, condenser, and throttling valve. If exergy is valued at $0.08 per kw.h, determine the daily cost of electricity to operate the compressor and the daily cost of exergy destruction in each component. Let T0 = 273 K (0C), which corresponds to the temperature of the outside ai.         \n",
"\n",
"\n",
"//solution\n",
"\n",
"T0 = 273                                                       //in kelvin\n",
"pricerate = .08                                                //exergy value at $0.08 per kw.h\n",
"\n",
"//from example 6.8\n",
"sigmadotComp = 17.5e-4                                         //in kw/k\n",
"sigmadotValve = 9.94e-4                                        //in kw/k\n",
"sigmadotcond = 7.95e-4                                         //in kw/k\n",
"\n",
"//The rates of exergy destruction\n",
"EddotComp = T0*sigmadotComp                                    //in kw\n",
"EddotValve = T0*sigmadotValve                                  //in kw\n",
"Eddotcond = T0*sigmadotcond                                    //in kw\n",
"\n",
"mCP = 3.11                                                     //From the solution to Example 6.14, the magnitude of the compressor power in kW\n",
"\n",
"printf('Daily cost in dollars of exergy destruction due to compressor irreversibilities =\t %f',EddotComp*pricerate*24)\n",
"printf('\naDaily cost in dollars of exergy destruction due to irreversibilities in the throttling valve =\t %f',EddotValve*pricerate*24)\n",
"printf('\naDaily cost in dollars of exergy destruction due to irreversibilities in the condenser =\t %f',Eddotcond*pricerate*24)\n",
"printf('\naDaily cost in dollars  of electricity to operate compressor =\t %f',mCP*pricerate*24)"
   ]
   }
],
"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
}