summaryrefslogtreecommitdiff
path: root/Non_Conventional_Energy_Resources_by_B.H.Khan/Chapter4.ipynb
blob: aafcc4f400a074e0decbc1b52fd9a149e20b5d73 (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
{

 "metadata": {

  "name": "",

  "signature": "sha256:574ebb4d4acd5d9e1ca65b924a04ae0a79a40c26934e573f22784629ff1f575c"

 },

 "nbformat": 3,

 "nbformat_minor": 0,

 "worksheets": [

  {

   "cells": [

    {

     "cell_type": "heading",

     "level": 1,

     "metadata": {},

     "source": [

      "Chapter04:Solar Energy-Basics"

     ]

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex4.1:pg-98"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "# given data\n",

      "import math\n",

      "n=319 # 15th November\n",

      "gamma=math.radians(30) # angle in radian\n",

      "beta=math.radians(45) # angle in radian\n",

      "phi=math.radians(18.9)  # latitude in radian\n",

      "solartime=13.5-4*(81.733-72.816)/60 +14.74/60 # in hours\n",

      "delta=23.45*(math.sin(math.radians(360.0*(284.0+n)/365.0))) # in radian\n",

      "B=45#(360.0*(n-81)/364)\n",

      "E=9.87*math.sin(2*B)-7.53*math.cos(B)-15*math.sin(B)\n",

      "w=math.radians((solartime-12)*15) # hour angle\n",

      "thetai=math.acos((math.cos(phi)*math.cos(beta)+math.sin(phi)*math.sin(beta)*math.cos(gamma))*math.cos(delta)*math.cos(w) + math.cos(delta)*math.sin(w)*math.sin(beta)*math.sin(gamma) + math.sin(delta)*(math.sin(phi)*math.cos(beta)-math.cos(phi)*math.sin(beta)*math.cos(gamma)))\n",

      "print round(math.degrees(thetai),2),\"degree\"\n",

      "# The answer in the textbook is wrong due to wrong expression of Cos(Thetai)"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "5.77 degree\n"

       ]

      }

     ],

     "prompt_number": 3

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex4.2:pg-98"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "# given data\n",

      "import math\n",

      "n1=1 # 1st january\n",

      "n2=182 # july 1\n",

      "\n",

      "phi=34.083  #  latitude in degree\n",

      "\n",

      "delta1=23.45*math.sin(math.radians(360.0*(284.0+n1)/365.0)) # in degree\n",

      "delta2=23.45*math.sin(math.radians(360.0*(284.0+n2)/365.0)) # in degree\n",

      "\n",

      "td1=(2.0/15)*math.degrees(math.acos(math.tan(phi)/math.tan(delta1))) # daylight hours for january 1\n",

      "td2=(2.0/15)*math.degrees(math.acos(math.tan(phi)/math.tan(delta2))) # daylight hours for july 1\n",

      "\n",

      "print \"daylight hours for january 1 are\",round(td1,2),\"hours\"\n",

      "print \"daylight hours for july 1 are\",round(td2,2),\"hours\"\n",

      "\n",

      "# the answers are slightly different in textbook due to approximation while here ansers are precise"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "daylight hours for january 1 are 9.55 hours\n",

        "daylight hours for july 1 are 13.87 hours\n"

       ]

      }

     ],

     "prompt_number": 4

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex4.3:pg-101"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "# given data\n",

      "import math\n",

      "a=0.25 # constant for delhi from table 4.1 \n",

      "b=0.57 # constant for delhi from table 4.1 \n",

      "phi=27.166 # latitute in degrees\n",

      "n=17 # day\n",

      "nbar=7 # sunshine hours\n",

      "\n",

      "delta=23.45*(math.sin(math.radians(360.0*(284.0+n)/365.0))) # in radian\n",

      "\n",

      "wt=math.acos(math.radians(-math.tan(phi)*(math.tan(delta)))) # hour angle at sunrise\n",

      "Nbar=(2*math.degrees(wt)/15.0)# day length\n",

      "\n",

      "Ho=3600*(24.0/math.pi)*1.367*(1+0.033*math.cos((360.0*n/365)))*(math.cos(phi)*cos(delta)*sin(wt)+1.3728*sin(delta)*sin(phi)) # in kj/m^2 per day\n",

      "\n",

      "Hg=Ho*(a+b*(nbar/Nbar))  # in kj/m^2 per day\n",

      "print \"The monthly average is \",round(-Hg,2),\" in kj/m^2 per day\"\n",

      "\n",

      "# the answer in the book is wrong due to wrong calculations"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "The monthly average is  19160.94  in kj/m^2 per day\n"

       ]

      }

     ],

     "prompt_number": 7

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex4.4:pg-103"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "# given data\n",

      "import math\n",

      "Hg=19160.94 # in kj/m^2 per day from previous example\n",

      "Ho=32107.62 # in kj/m^2 per day from previous example\n",

      "KT=Hg/Ho # unitless\n",

      "Hd=Hg*(1.354-1.570*KT) # in kj/m^2 per day\n",

      "Hb= Hg-Hd # in kj/m^2 per day\n",

      "\n",

      "print \"Monthly average of daily diffused is \",round(Hd,2),\"in kj/m^2 per day\"\n",

      "print \"beam radiation is \",round(Hb,2),\"in kj/m^2 per day\"\n",

      "\n",

      "# the solution inthe textbook is wrong as the values from previous examples are used which too are incorrect"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Monthly average of daily diffused is  7991.4 in kj/m^2 per day\n",

        "beam radiation is  11169.54 in kj/m^2 per day\n"

       ]

      }

     ],

     "prompt_number": 44

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex4.5:pg-104"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "# given data\n",

      "import math\n",

      "# most of the data is used is from previous example:\n",

      "phi=27.166 # in degree\n",

      "n=17 # day\n",

      "ws=78.66 # degrees\n",

      "delta=-20.96 # in degrees\n",

      "Ho=22863.3 # kj/m^2 per day\n",

      "Hg=14413.82 # kj/m^2 per day\n",

      "Hd=5259.6 # kj/m^2 per day\n",

      "\n",

      "w=(11.5-12)*15 # in degrees\n",

      "\n",

      "Io=3600*1.367*(1+0.033*math.cos(360*17/365.0))*(math.cos(math.radians(phi))*math.cos(math.radians(delta))*math.cos(math.radians(w)))+math.sin(math.radians(delta))*math.sin(math.radians(phi))\n",

      "\n",

      "a=0.409+0.5016*math.sin(ws-60)\n",

      "b=0.6609-0.4767*math.sin(ws-60)\n",

      "\n",

      "Ig=Hg*(a+b*math.cos(w))*Io/Ho # in kJ/m^2-h\n",

      "\n",

      "print \"The monthly average of hourly global radiation is \",round(Ig,2),\"kJ/m^2-h\"\n",

      "\n",

      "adash=0.4922+(0.27/(Hd/Hg))\n",

      "bdash=2*(1-adash)*(math.sin(math.radians(ws)))-1.7328*math.cos(math.radians(78.66))/(1.7328-0.5*math.sin(math.radians(2*78.66))) \n",

      "\n",

      "\n",

      "Id=5259.6*(1.2321-0.3983*math.cos(math.radians(w)))*Io/Ho # kJ/m^2-h\n",

      "\n",

      "\n",

      "\n",

      "print \"The hourly diffuse radiations are\",round(Id,2),\"kJ/m^2-h\"\n",

      "\n",

      "# the solution inthe textbook is wrong as the values from previous examples are used which too are incorrect\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "The monthly average of hourly global radiation is  1444.92 kJ/m^2-h\n",

        "The hourly diffuse radiations are 768.07 kJ/m^2-h\n"

       ]

      }

     ],

     "prompt_number": 26

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex4.6:pg-108"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "# given data\n",

      "import math\n",

      "phi=28.58 # in degree\n",

      "n=135 # may 15\n",

      "delta=23.45*math.sin(math.radians(360*(284+n)/365.0))\n",

      "\n",

      "w=(13.5-12)*15 # in degrees\n",

      "A=3981.6 # in W/m^2 from table 4.2\n",

      "B=0.177# from table 4.2\n",

      "C=0.130 # from table 4.2\n",

      "\n",

      "costhetaz=math.cos(phi)*math.cos(delta)*math.cos(w)+math.sin(delta)*math.sin(phi)\n",

      "\n",

      "Ibn=A*math.exp(-B/0.922)# kJ/m^2-h\n",

      "\n",

      "\n",

      "Id=C*Ibn # kJ/m^2-h\n",

      "\n",

      "print \"The diffused radiation is \",round(Id,2),\"kJ/m^2-h\"\n",

      "Ib=Ibn*0.922 # in kJ/m^2-h\n",

      "\n",

      "print \"The beam radiation is \",round(Ib,2),\"kJ/m^2-h\"\n",

      "Ig=Ib+Id # in kJ/m^2-h\n",

      "\n",

      "print \"The global radiation is \",round(Ig,2),\"kJ/m^2-h\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "The diffused radiation is  427.2 kJ/m^2-h\n",

        "The beam radiation is  3029.81 kJ/m^2-h\n",

        "The global radiation is  3457.01 kJ/m^2-h\n"

       ]

      }

     ],

     "prompt_number": 44

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex-4.7:pg-111"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "# given data\n",

      "import math\n",

      "phi=28.58 # in degree\n",

      "B=30 # in degree\n",

      "n=318 # november 14\n",

      "Hg=16282.8 # in kJ/m^2-day from Table C1 appendix C\n",

      "Hd=4107.6 # in kJ/m^2-day from Table C2 appendix C\n",

      "\n",

      "delta=23.45*(math.sin(math.radians(360.0*(284.0+n)/365.0))) # in radians\n",

      "\n",

      "ws=math.acos(math.radians(-math.tan(phi)*(math.tan(delta)))) # hour angle at sunrise\n",

      "\n",

      "Rb=(ws*sin(math.radians(delta))*math.sin(phi-B)+math.cos((delta))*math.sin(ws)*math.cos(phi-B))/(ws*sin((delta))*math.sin(math.radians(phi))+math.cos(math.radians(delta))*math.sin(ws)*math.cos(math.radians(phi)))\n",

      "\n",

      "Rd=(1+math.cos(math.radians(B)))/2 \n",

      "\n",

      "Rr=0.2*(1-math.cos(math.radians(B)))/2 \n",

      "\n",

      "Ht=((1-(Hd/Hg))*1.56+(Hd/Hg)*Rd + Rr)*Hg\n",

      "print \"Monthly average total radiation is\",round(Ht,2),\"kJ/m^2-h\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Monthly average total radiation is 23043.9 kJ/m^2-h\n"

       ]

      }

     ],

     "prompt_number": 8

    }

   ],

   "metadata": {}

  }

 ]

}