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
|
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter 21 - Gas Compression"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 1 - Pg 387"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#calculate the work done and the net heat transferred\n",
"#initialization of varaibles\n",
"import math\n",
"R=53.34\n",
"T1=540 #R\n",
"n=1.4\n",
"g=n\n",
"n2=1.3\n",
"P2=90. #psia\n",
"P1=15. #psia\n",
"cv=0.171\n",
"cp=0.24\n",
"#calculations\n",
"pv=R*T1\n",
"Wk=n*R*T1*(math.pow((P2/P1),((g-1)/g)) -1) /(n-1)\n",
"Wn=n2*R*T1*(math.pow((P2/P1),((n2-1)/n2)) -1) /(n2-1)\n",
"Wt=R*T1*math.log(P2/P1)\n",
"Q=cv*(n-n2)*778*T1*(math.pow((P2/P1),((n2-1)/n2)) -1) /(1-n2)*0.001305\n",
"#0.001305 is the conversion factor\n",
"#results\n",
"print '%s %d %s' %(\"\\n Work in case 1 =\",Wk,\"ft lb/lb\")\n",
"print '%s %d %s' %(\"\\n Work in case 2 =\",Wn,\"ft lb/lb\")\n",
"print '%s %d %s' %(\"\\n Work in case 3 =\",Wt,\"ft lb/lb\")\n",
"print '%s %.1f %s' %(\"\\n Heat transferred =\",Q,\"B/lb\")\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
" Work in case 1 = 67394 ft lb/lb\n",
"\n",
" Work in case 2 = 63914 ft lb/lb\n",
"\n",
" Work in case 3 = 51609 ft lb/lb\n",
"\n",
" Heat transferred = -16.0 B/lb\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2 - Pg 389"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Calculate the adiabatic and isothermal efficiencies\n",
"#initialization of varaibles\n",
"import math\n",
"R=53.34\n",
"T1=540 #R\n",
"n=1.4 #gamma\n",
"g=n\n",
"n2=1.3 #gamma\n",
"P2=90. #psia\n",
"P1=15. #psia\n",
"cv=0.171\n",
"#calculations\n",
"pv=R*T1\n",
"Wk=n*R*T1*(math.pow((P2/P1),((g-1)/g)) -1) /(n-1)\n",
"Wn=n2*R*T1*(math.pow((P2/P1),((n2-1)/n2)) -1) /(n2-1)\n",
"Wt=R*T1*math.log(P2/P1)\n",
"eta1=Wt/Wn\n",
"eta2=Wk/Wn\n",
"#results\n",
"print '%s %.2f' %(\"Adiabatic efficiency = \",eta2)\n",
"print '%s %.2f' %(\"\\n Isothermal efficiency = \",eta1)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Adiabatic efficiency = 1.05\n",
"\n",
" Isothermal efficiency = 0.81\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 3 - Pg 389"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#calculate the heat transferred\n",
"#initialization of varaibles\n",
"import math\n",
"R=53.34\n",
"T1=540 #R\n",
"n=1.4 #gamma\n",
"g=n\n",
"n2=1.3 #gamma\n",
"P2=90 #psia\n",
"P1=15 #psia\n",
"cv=0.171\n",
"eta=0.95\n",
"cp=0.24\n",
"#calculations\n",
"pv=R*T1\n",
"Wk=n*R*T1*(math.pow((P2/P1),((g-1)/g)) -1) /(n-1)\n",
"Wn=n2*R*T1*(math.pow((P2/P1),((n2-1)/n2)) -1) /(n2-1)\n",
"Wt=R*T1*math.log(P2/P1)\n",
"Wx=-Wk/eta\n",
"dh=cp*T1*(1.52 - 1)\n",
"Q=dh+Wx/778.\n",
"#results\n",
"print '%s %.1f %s' %(\"Heat transferred =\",Q,\"B/lb\")\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Heat transferred = -23.8 B/lb\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 4 - Pg 395"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#calculate the volumetric efficiency\n",
"#initialization of varaibles\n",
"import math\n",
"n=1.3\n",
"P1=15. #psia\n",
"P2=75. #psia\n",
"eta=0.5\n",
"eta2=0\n",
"#calculations\n",
"Pr=math.pow((P2/P1),(1/n))\n",
"Cl=(1-eta)/(Pr-1)\n",
"Cl2=(1-eta2)/(Pr-1)\n",
"#results\n",
"print '%s %.3f' %(\"For volumetric efficiency to be 0.5, Clearance = \",Cl)\n",
"print '%s %.3f' %(\"\\n For volumetric efficiency to be 0, Clearance = \",Cl2)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"For volumetric efficiency to be 0.5, Clearance = 0.204\n",
"\n",
" For volumetric efficiency to be 0, Clearance = 0.408\n"
]
}
],
"prompt_number": 5
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 5 - Pg 398"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Calculate the single stage and two stage efficiencies\n",
"#initialization of varaibles\n",
"import math\n",
"P1=5 #psia\n",
"P2=83.5 #psia\n",
"n=1.25\n",
"per=0.03\n",
"#calculations\n",
"nv1=1- per*(math.pow((P2/P1),(1/n)) -1)\n",
"nv2=1-per*(math.pow((math.sqrt(P2/P1)),(1/n)) -1)\n",
"#results\n",
"print '%s %.3f' %(\"For single stage machine = \",nv1)\n",
"print '%s %.3f' %(\"\\n For Two stage machine = \",nv2)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"For single stage machine = 0.745\n",
"\n",
" For Two stage machine = 0.937\n"
]
}
],
"prompt_number": 6
}
],
"metadata": {}
}
]
}
|