summaryrefslogtreecommitdiff
path: root/Basic_Engineering_Thermodynamics_by_Rayner_Joel/Chapter1_1.ipynb
blob: 53149a6fe6795a27b10bc6b59e44da1250a7c49a (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
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 1 - General Introduction"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1: pg 11"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 1.1\n",
      "The Work done is (MJ) =  0.98\n"
     ]
    }
   ],
   "source": [
    "#pg 11\n",
    "#calculate the work done\n",
    "print 'Example 1.1'\n",
    "\n",
    "# Given values\n",
    "P = 700.;   #pressure,[kN/m**2]\n",
    "V1 = .28;   #initial volume,[m**3]\n",
    "V2 = 1.68;   #final volume,[m**3]\n",
    "\n",
    "#solution\n",
    "\n",
    "W = P*(V2-V1);# # Formula for work done at constant pressure is, [kJ]\n",
    "\n",
    "#results\n",
    "print 'The Work done is (MJ) = ',W*10**-3\n",
    "\n",
    "#End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2: pg 13"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 1.2\n",
      "The new volume of the gas is (m^3) =  0.0355\n"
     ]
    }
   ],
   "source": [
    "#pg 13\n",
    "#calculate the new volume\n",
    "print 'Example 1.2'\n",
    "\n",
    "#Given values\n",
    "P1 = 138.;  # initial pressure,[kN/m**2]\n",
    "V1 = .112;  #initial volume,[m**3]\n",
    "P2 = 690; #  final pressure,[kN/m**2]\n",
    "Gama=1.4; #  heat capacity ratio\n",
    "\n",
    "#  solution\n",
    "\n",
    "#  since gas is following, PV**1.4=constant,hence\n",
    "\n",
    "V2 =V1*(P1/P2)**(1/Gama); #   final volume, [m**3] \n",
    "\n",
    "#results\n",
    "print 'The new volume of the gas is (m^3) = ',round(V2,4)\n",
    "\n",
    "#End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3: pg 15"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 1.3\n",
      "Final Volume (m^3) =  0.077\n",
      "The Work done by gas during expansion is (kJ) =  37.2\n"
     ]
    }
   ],
   "source": [
    "#pg 15\n",
    "#calculate the work done by gas\n",
    "print 'Example 1.3'\n",
    "\n",
    "# Given values\n",
    "P1 = 2070;  #  initial pressure,  [kN/m^2]\n",
    "V1 = .014;  #  initial volume,  [m^3]\n",
    "P2 = 207.;  #  final pressure, [kN/m^2]\n",
    "n=1.35;  #  polytropic index\n",
    "\n",
    "#  solution\n",
    "\n",
    "#  since gas is following PV^n=constant\n",
    "#  hence \n",
    "\n",
    "V2 = V1*(P1/P2)**(1/n);  # final volume,  [m^3]\n",
    "\n",
    "#  calculation of workdone\n",
    "\n",
    "W=(P1*V1-P2*V2)/(1.35-1);  # using work done formula for polytropic process, [kJ]\n",
    "\n",
    "#results\n",
    "print 'Final Volume (m^3) = ',round(V2,3)\n",
    "print 'The Work done by gas during expansion is (kJ) = ',round(W,1)\n",
    "\n",
    "#End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4: pg 17"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 1.4\n",
      " The final pressure (kN/m^2) =  800.0\n",
      " Work done on the gas (kJ) =  -11.64\n"
     ]
    }
   ],
   "source": [
    "#pg 17\n",
    "#calculate the final pressure and work done\n",
    "print 'Example 1.4'\n",
    "import math\n",
    "\n",
    "#  Given values\n",
    "P1 = 100;  #  initial pressure, [kN/m^2]\n",
    "V1 = .056;  #  initial volume,  [m^3]\n",
    "V2 = .007;  #  final volume,  [m^3]\n",
    "\n",
    "#  To know  P2\n",
    "#  since process is hyperbolic so, PV=constant\n",
    "#  hence\n",
    "\n",
    "P2 = P1*V1/V2;  #  final pressure, [kN/m^2]\n",
    "\n",
    "# calculation of workdone\n",
    "W = P1*V1*math.log(V2/V1); #  formula for work done in this process, [kJ]\n",
    "\n",
    "#results\n",
    "print ' The final pressure (kN/m^2) = ',P2\n",
    "print ' Work done on the gas (kJ) = ',round(W,2)\n",
    "\n",
    "#End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5: pg 21"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 1.5\n",
      "The heat required (kJ) =  191.25\n"
     ]
    }
   ],
   "source": [
    "#pg 21\n",
    "#calculate the heat required\n",
    "print 'Example 1.5'\n",
    "\n",
    "#  Given values\n",
    "m = 5.; #  mass,  [kg]\n",
    "t1 = 15.; #  inital temperature, [C]\n",
    "t2 = 100.; #  final temperature, [C]\n",
    "c = 450.; #  specific heat capacity, [J/kg K]\n",
    "\n",
    "#  solution\n",
    "\n",
    "#  using heat transfer equation,[1]\n",
    "Q = m*c*(t2-t1); #  [J]\n",
    "#results\n",
    "print 'The heat required (kJ) = ',round(Q*10**-3,2)\n",
    "\n",
    "#End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6: pg 22"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 1.6\n",
      "Required heat transfer to accomplish the change (kJ) =  1814.4\n"
     ]
    }
   ],
   "source": [
    "#pg 22\n",
    "print 'Example 1.6'\n",
    "\n",
    "#Calculate the required heat transfer \n",
    "#  Given values\n",
    "m_cop = 2.; #  mass of copper vessel, [kg]\n",
    "m_wat = 6.; #  mass of water, [kg]\n",
    "c_wat = 4.19; #  specific heat capacity of water,  [kJ/kg K]\n",
    "\n",
    "t1 = 20.; #  initial temperature, [C]\n",
    "t2 = 90.; #  final temperature, [C]\n",
    "\n",
    "# From the table of average specific heat capacities\n",
    "c_cop = .390;  # specific heat capacity of copper,[kJ/kg k]\n",
    "\n",
    "# solution\n",
    "Q_cop = m_cop*c_cop*(t2-t1); #  heat required by copper vessel, [kJ]\n",
    "\n",
    "Q_wat = m_wat*c_wat*(t2-t1); #  heat required by water, [kJ]\n",
    "\n",
    "# since there is no heat loss,so total heat transfer is sum of both\n",
    "Q_total = Q_cop+Q_wat ; #  [kJ]\n",
    "\n",
    "#results\n",
    "print 'Required heat transfer to accomplish the change (kJ) = ',Q_total\n",
    "\n",
    "#End"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7: pg 22"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 1.7\n",
      "The final temperature is  (C) =  56.9\n"
     ]
    }
   ],
   "source": [
    "#pg 22\n",
    "print('Example 1.7');\n",
    "#calculate the final temperature\n",
    "\n",
    "#  Given values\n",
    "m = 10.; #  mass of iron casting, [kg]\n",
    "t1 = 200.; #  initial temperature, [C]\n",
    "Q = -715.5; #  [kJ], since heat is lost in this process\n",
    "\n",
    "# From the table of average specific heat capacities\n",
    "c = .50; #  specific heat capacity of casting iron, [kJ/kg K]\n",
    "\n",
    "#  solution\n",
    "#  using heat equation\n",
    "#  Q = m*c*(t2-t1)\n",
    "\n",
    "t2 = t1+Q/(m*c); # [C]\n",
    "\n",
    "#results\n",
    "print 'The final temperature is  (C) = ',t2\n",
    "\n",
    "# End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8: pg 23"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 1.8\n",
      "The specific heat capacity of the liquid is  (kJ/kg K) =  2.1\n"
     ]
    }
   ],
   "source": [
    "#pg 23\n",
    "#calculate the specific heat capacity\n",
    "print('Example 1.8');\n",
    "# Given values\n",
    "m = 4.; #  mass of the liquid, [kg]\n",
    "t1 = 15.; #  initial temperature, [C]\n",
    "t2 = 100.; #  final temperature, [C]\n",
    "Q = 714.; #  [kJ],required heat to accomplish this change\n",
    "\n",
    "#  solution\n",
    "#  using heat equation\n",
    "#  Q=m*c*(t2-t1)\n",
    "\n",
    "#  calculation of c\n",
    "c=Q/(m*(t2-t1)); #  heat capacity, [kJ/kg K] \n",
    "\n",
    "#results\n",
    "print 'The specific heat capacity of the liquid is  (kJ/kg K) = ',c\n",
    "\n",
    "#End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9: pg 27"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 1.9\n",
      "The power output of the engine is  (kJ) =  48.7\n",
      "The energy rejected by the engine is (MJ/min) =  11.7\n"
     ]
    }
   ],
   "source": [
    "#pg 27\n",
    "#calculate the energy rejected by the engine\n",
    "print('Example 1.9');\n",
    "\n",
    "\n",
    "#  Given values\n",
    "m_dot = 20.4; #  mass flowrate of petrol, [kg/h]\n",
    "c = 43.; #  calorific  value of petrol, [MJ/kg]\n",
    "n = .2; #  Thermal efficiency of engine\n",
    "\n",
    "#  solution\n",
    "m_dot = 20.4/3600; # [kg/s]\n",
    "c = 43*10**6; #  [J/kg]\n",
    "\n",
    "#  power output\n",
    "P_out = n*m_dot*c; #  [W]\n",
    "\n",
    " \n",
    "#  power rejected\n",
    "\n",
    "P_rej = m_dot*c*(1-n); #  [W]\n",
    "P_rej = P_rej*60*10**-6; #  [MJ/min]\n",
    "\n",
    "#results\n",
    "print 'The power output of the engine is  (kJ) = ',round(P_out*10**-3,1)\n",
    "print 'The energy rejected by the engine is (MJ/min) = ',round(P_rej,1)\n",
    "\n",
    "#End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 10: pg 28"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 1.10\n",
      "Thermal efficiency of the plant =  0.173\n"
     ]
    }
   ],
   "source": [
    "#pg 28\n",
    "print('Example 1.10');\n",
    "#calculate the thermal efficiency\n",
    "\n",
    "\n",
    "#  Given values\n",
    "m_dot = 3.045; #  use of coal, [tonne/h]\n",
    "c = 28; # calorific value of the coal, [MJ/kg]\n",
    "P_out = 4.1; #  output of turbine, [MW]\n",
    "\n",
    "#  solution\n",
    "m_dot = m_dot*10**3/3600; # [kg/s]\n",
    "\n",
    "P_in = m_dot*c; #  power input by coal, [MW]\n",
    "\n",
    "n = P_out/P_in; #  thermal efficiency formula\n",
    "\n",
    "#results\n",
    "print 'Thermal efficiency of the plant = ',round(n,3)\n",
    "\n",
    "#End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 11: pg 29"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 1.11\n",
      "The power output of the engine (kW) =  12.5\n"
     ]
    }
   ],
   "source": [
    "#pg 29\n",
    "#calculate the power output of the engine\n",
    "print('Example 1.11');\n",
    "\n",
    "\n",
    "#  Given values\n",
    "v = 50.; #  speed, [km/h]\n",
    "F = 900.; #  Resistance to the motion of a car\n",
    "\n",
    "#  solution\n",
    "v = v*10**3/3600; #  [m/s]\n",
    "Power = F*v; #  Power formula, [W]\n",
    "\n",
    "print 'The power output of the engine (kW) = ',Power*10**-3\n",
    " \n",
    "#  End"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 12: pg 31"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 1.12\n",
      "The power output from the engine (kW) =  15.79\n"
     ]
    }
   ],
   "source": [
    "#pg 31\n",
    "#calculate the power output from the engine\n",
    "\n",
    "print('Example 1.12');\n",
    "\n",
    "#  Given values\n",
    "V = 230.; #  volatage, [volts]\n",
    "I = 60.; #  current, [amps]\n",
    "n_gen = .95; #  efficiency of generator\n",
    "n_eng = .92; #  efficiency of engine\n",
    "\n",
    "#  solution\n",
    "\n",
    "P_gen = V*I; #  Power delivered by generator, [W]\n",
    "P_gen=P_gen*10**-3; #  [kW]\n",
    "\n",
    "P_in_eng=P_gen/n_gen;#Power input from engine,[kW]\n",
    "\n",
    "P_out_eng=P_in_eng/n_eng;#Power output from engine,[kW]\n",
    "\n",
    "#results\n",
    "print 'The power output from the engine (kW) = ',round(P_out_eng,2)\n",
    "\n",
    "#  End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 13: pg 32"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 1.13\n",
      "The current taken by heater (amps) =  17.4\n"
     ]
    }
   ],
   "source": [
    "#pg 32\n",
    "#calculate the current taken by heater\n",
    "print('Example 1.13');\n",
    "\n",
    "\n",
    "\n",
    "#  Given values\n",
    "V = 230.; # Voltage, [volts]\n",
    "W = 4.; #  Power of heater, [kW]\n",
    "\n",
    "#  solution\n",
    "\n",
    "#  using equation P=VI\n",
    "I = W/V; #  current, [K amps]\n",
    "#results\n",
    "print 'The current taken by heater (amps) = ',round(I*10**3,1)\n",
    "\n",
    "#  End\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 14: pg 32"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example 1.14\n",
      "Mass of coal burnt by the power station in 1 hour (tonne) =  218.0\n"
     ]
    }
   ],
   "source": [
    "#pg 32\n",
    "#calculate the mass of coal burnt\n",
    "print('Example 1.14');\n",
    "\n",
    "#  Given values\n",
    "P_out = 500.; #  output of power station, [MW]\n",
    "c = 29.5; #  calorific value of coal, [MJ/kg]\n",
    "r=.28; \n",
    "\n",
    "#  solution\n",
    "\n",
    "#  since P represents only 28 percent of energy available from coal\n",
    "P_coal = P_out/r; #  [MW]\n",
    " \n",
    "m_coal = P_coal/c; #  Mass of coal used, [kg/s]\n",
    "m_coal = m_coal*3600; #  [kg/h]\n",
    "\n",
    "#After one hour\n",
    "m_coal = m_coal*1*10**-3; #  [tonne]\n",
    "#results\n",
    "print 'Mass of coal burnt by the power station in 1 hour (tonne) = ',round(m_coal,0)\n",
    "\n",
    "#  End\n"
   ]
  }
 ],
 "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.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}