summaryrefslogtreecommitdiff
path: root/Thermodynamics_for_Engineers/Chapter_8_1.ipynb
blob: 8dd5540fba49bff286ce602467b9e324bb813fe5 (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:86e00f67d619987b1a4198153e70d431ddb0592847bf75b0bc55b544e7c1f8d2"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 8 - Availability of Energy"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1 - Pg 120"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the available energy loss\n",
      "#Initialization of variables\n",
      "q=1000. #Btu\n",
      "th=1140. #F\n",
      "tl=40. #F\n",
      "ts=940. #F\n",
      "#calculations\n",
      "Q1=q*(th-tl)/(th+460)\n",
      "Q2=q*(ts-tl)/(ts+460)\n",
      "dif=Q1-Q2\n",
      "#results\n",
      "print '%s %d %s' %(\"Available energy loss =\",dif,\"Btu\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Available energy loss = 44 Btu\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2 - Pg 124"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the untransferred, transferred, available, unavailable energy for both gas and water\n",
      "#Initialization of variables\n",
      "import math\n",
      "ma=200000. #lb\n",
      "cpa=0.26\n",
      "T2g=1200. #F\n",
      "T1g=300. #F\n",
      "T1w=200. #F\n",
      "mw=250000. #lb\n",
      "cpw=1.02\n",
      "Tl=560.  #R\n",
      "cx=1.01\n",
      "#calculations\n",
      "T2w=T1w+ ma*cpa*(T2g-T1g)/(mw*cpw)\n",
      "Qun=Tl*ma*cpa*math.log((T2g+460)/(T1g+460))\n",
      "Qtr=ma*cpa*(T2g-T1g)\n",
      "Qav=Qtr-Qun\n",
      "Qun2=Tl*mw*cx*math.log((T2w+460)/(T1w+460))\n",
      "Qav2=Qtr-Qun2\n",
      "ht1=Qav-Qav2\n",
      "#results\n",
      "print '%s %d %s' %(\"For gas, Untransferred energy =\",Qun,\"Btu/hr\")\n",
      "print '%s %d %s' %(\"\\n For gas, transferred energy =\",Qtr,\"Btu/hr\")\n",
      "print '%s %d %s' %(\"\\n For gas, available energy =\",Qav,\"Btu/hr\")\n",
      "print '%s %d %s' %(\"\\n For water, Untransferred energy =\",Qun2,\"Btu/hr\")\n",
      "print '%s %d %s' %(\"\\n For water, available energy =\",Qav2,\" Btu/hr\")\n",
      "print '%s %d %s' %(\"\\n Loss of available energy =\",ht1,\"Btu/hr\")\n",
      "print '%s' %('The answers are a bit different due to rounding off error in textbook')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "For gas, Untransferred energy = 22750129 Btu/hr\n",
        "\n",
        " For gas, transferred energy = 46800000 Btu/hr\n",
        "\n",
        " For gas, available energy = 24049870 Btu/hr\n",
        "\n",
        " For water, Untransferred energy = 34693187 Btu/hr\n",
        "\n",
        " For water, available energy = 12106812  Btu/hr\n",
        "\n",
        " Loss of available energy = 11943058 Btu/hr\n",
        "The answers are a bit different due to rounding off error in textbook\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}