[go: up one dir, main page]

0% found this document useful (0 votes)
38 views9 pages

Modelling of Solar Radiation Using Pytho

Uploaded by

Enrique Ramos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views9 pages

Modelling of Solar Radiation Using Pytho

Uploaded by

Enrique Ramos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Research and Applications of Thermal Engineering

Volume 7 Issue 1
DOI: https://doi.org/10.5281/zenodo.10793719

Modelling of Solar Radiation using Python


1AdarshDeo, 2Arnav Raj Joshi, 3*Pankaj Dumka, 4Dhananjay R. Mishra
Department of Mechanical Engineering, Jaypee University of Engineering and Technology,
Guna, Madhya Pradesh, India

*Corresponding Author
E-Mail Id: p.dumka.ipec@gmail.com

ABSTRACT
This short communication describes how a Python module has been developed to understand
solar radiation. Through the use of the python module, functions have been developed for
zenith angle, hour angle, angle, solar declination angle and solar intensity of extraterrestrial
radiation. To ensure that the developed modules were accurate, four problems were selected.
The developed codes were tested on these four problems. Correspondingly, the result has
shown that the functions generated have helped in a better interpretation and understanding
of solar geometry and sun-earth angles.

Keywords: Solar radiation, python programming, Sun earth angles

NOMENCLATURE
δ Solar declination angle
ω Hour angle
θz Zenith angle
ISC Solar constant
ION Intensity of extraterrestrial radiation
φ Latitude

INTRODUCTION bodies' efficiently absorb thermal


Solar radiation, also known as sunlight, electromagnetic energy, as the color black
emanates from the sun. Numerous absorbs all wavelengths visible to the
technologies exist to harness this radiation, human eye [3–6].
transforming it into practical forms of
energy like heat and electricity. Solar radiation varies at different locations
Nevertheless, the viability and economic on Earth's surface due to several factors:
viability of such technologies depend • Geographic location
significantly on the solar energy resources • Local landscape
accessible at a particular location [1]. • Local weather conditions
• Time of day
Solar technologies transform sunlight into
electrical energy through either a The level of solar radiation absorbed hinges
photovoltaic panel or by means of mirrors on the angle of incidence between the sun
to concentrate solar radiation [2]. The sun and the Earth's surface, which varies from
emits electromagnetic radiation across 0° (near the horizon) to 90° (directly
various wavelengths, including infrared. above). At a perpendicular stance, solar
This spectrum allows effective transfer of rays directly target the Earth's surface,
thermal energy to bodies capable of maximizing energy absorption. However,
absorbing it. Materials known as 'black as the angle deviates, rays traverse a longer

HBRP Publication Page 11-19 2024. All Rights Reserved Page 11


Research and Applications of Thermal Engineering
Volume 7 Issue 1
DOI: https://doi.org/10.5281/zenodo.10793719

atmospheric path, causing heightened Since the radiation beam hitting the Earth's
scattering and dispersion of radiation. surface can be oriented in any direction,
different angles between the sun and Earth
Modelling solar radiation and at the same are necessary to interpret the solar energy
time graphing it is difficult using pen and received.
paper. Here comes the role of Python
programming as a programming language Solar Declination Angle (δ)
that can perform numerical computations The declination angle delineates the angle
and graphing very easily [7–13]. Python's between the sun's rays and the equatorial
true power resides in its modules such as plane. This variation primarily arises from
Numpy [14–17], SymPy [18–21], the Earth's rotation around its axis. Its peak
Matplotlib [22,23], etc. In this article the reaches 23.45° on December 21st, while its
strength of Python programming has been nadir is -23.45° on June 21st, a calculation
used to model solar radiation. derived from the following relation. It is
represented in Eqn. (1)
SUN-EARTH ANGLES

δ = 23.45 ×sin (284 + n) × 360 (1)

where, ’n’ is the nth of the year

Azimuth Angle Hour Angle (ω)


The azimuth angle shows the compass The position of a meridian on Earth is
direction from which sunlight emanates. It's established by the angle needed for the
essential to note that in the northern Earth to rotate and align it with its current
hemisphere, the sun constantly look as if location. When the angle becomes positive,
directly south at solar noon, while in the it will increase, as it continues to decrease
southern hemisphere, it look as if straight from sunrise to noon. At noon, it will
north. Furthermore, sunrise and sunset are become zero and then begin to increase
associated with azimuth angles of 90° and after that time. Eqn. (2) shows the formula
270°, correspondingly, which align with the to evaluate it.
equinoxes.

ω = (ST − 12) × 15 (2)

where, ST is the standard time.

Zenith Angle (θz) known as the elevation angle. It serves as a


An angle formed by the sun’s rays angled complement to the solar altitude or solar
at its vertical direction is termed the solar elevation. The expression used for
zenith angle. The altitude angle is also obtaining (θz) is shown in Eqn. (3)

𝐶𝑜𝑠(𝜃𝑧 ) = 𝑠𝑖𝑛𝜑 × 𝑠𝑖𝑛𝛿 + 𝑐𝑜𝑠𝜑 × 𝑐𝑜𝑠𝛿 × 𝑐𝑜𝑠𝜔 (3)

SOLAR INTENSITY OF energy per second when positioned


EXTRATERRESTRIAL RADIATION perpendicular to the sun's rays at an average
A unit area on an extraterrestrial surface can Earth-Sun distance. Due to Earth's orbit
accept a consistent quantity of radiant being elliptical with the sun at one focus,

HBRP Publication Page 11-19 2024. All Rights Reserved Page 12


Research and Applications of Thermal Engineering
Volume 7 Issue 1
DOI: https://doi.org/10.5281/zenodo.10793719

rather than circular, the extraterrestrial radiation on the nth day of the year,
radiation experiences fluctuations. These measured on a plane perpendicular to the
variations in the intensity of extraterrestrial radiation, are depicted by Eqn. (4).
360 n
ION = ISC (1 + 0.033 ×cos ( )) (4)
365

IMPLEMENTATIONS OF SOLAR RADIATION IN PYTHON [Table 1]

Table 1: Functions developed in python for evaluating sun-earth angles.


EXPLAINATION CODE
Libraries imported from math import*
from numpy import*
from pylab import*
Function for Solar declination angle # Function- s_dec
# Input- day (d), month (m), year (y)
# Output- Solar declination angle

def s_dec(d,m,y):
arr = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ]

if(((y%400==0) or ((y%100!=0) and (y%4==0)))) :


arr[1] = 29
else :
arr[1] = 28; n_days=int(sum(arr[:m-1]) + d)

x=array(list(range(1,367)))
δ=zeros(n_days)
for i in range (0,n_days):
δ[i]= 23.45*sin((284+x[i])*(360/365)*(pi/180))
print(x[:n_days])
plot(x[:n_days],δ,'r-')
xlabel('NUMBERS OF DAY')
ylabel('SOLAR DECLINATION ANGLE')
show()
return δ
Function for Hour angle # Function- h_ang
# Input- Sunshine hours (6am to 6pm)
# Output- Hour angle

def h_ang(z,t):
hour=array(range(z,t+1))
h=zeros(len(hour))
for i in range(0,len(hour)):
h[i]=(hour[i]-12)*15
ylim(-110,110)
plot(hour,h,'g-o')
xlabel('SOLAR TIME')
ylabel('HOUR ANGLE')
show()
return h

HBRP Publication Page 11-19 2024. All Rights Reserved Page 13


Research and Applications of Thermal Engineering
Volume 7 Issue 1
DOI: https://doi.org/10.5281/zenodo.10793719

Function for Solar intensity of # Function- s_int


extraterrestrial radiation # Input- day (d), month (m), year (y), Solar constant (1367
W/m^2)
# Output- Intensity of extraterrestrial radiation

def s_int(d,m,y,i_sc):
arr = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ]

if(((y%400==0) or ((y%100!=0) and (y%4==0)))) :


arr[1] = 29
else :
arr[1] = 28;[]
n_days=int(sum(arr[:m-1]) + d)

x=array(list(range(1,367)))
i_on=zeros(n_days)
for i in range (0,n_days):
i_on[i]= i_sc*(1 + 0.0033*cos((x[i]*360)/365))
print('n=',n_days)
plot(x[:n_days],i_on,'g-')
xlabel('NUMBERS OF DAY')
ylabel('INTENSITY OF EXTRATERRESTRIAL
RADIATION')
show()
return i_on

Example 1: Plot the variation of solar declination angle (δ ) with nth day of the year.

Python Approach
PYTHON CODE PROGRAM OUTPUT
#INPUT DATA Solar declination angles till ‘nth’ day of the year at an interval
of 12 days:
d=31
m=12 array([-23.01163673, -21.43630132,
y=2022 -18.79191752, -15.21036321,
-10.87025385, -5.98803477,
#CALLING THE -0.80718679, 4.41391635,
FUNCTION 9.41489335, 13.94634081,
17.78227121, 20.73138311,
s_dec(d,m,y) 22.64660154, 23.43241276,
23.04962764, 21.51733603,
18.91195474, 15.36341658,
11.04869045, 6.1829558 ,
1.00887136, -4.21552644,
-9.22969199, -13.78356417,
-17.65003711, -20.63628618,
-22.59338436, -23.42372933,
-23.085911])

Graph

HBRP Publication Page 11-19 2024. All Rights Reserved Page 14


Research and Applications of Thermal Engineering
Volume 7 Issue 1
DOI: https://doi.org/10.5281/zenodo.10793719

The graph below (Fig. 1) illustrates the minimum value of -23.449 degrees on
fluctuation of the solar declination angle December 21st and its maximum value of
over the course of 365 days. It reaches its 23.449 degrees on June 21st.

Fig. 1: Variation of solar declination angle with days.

Example 2: Plot the variation of hour angle (ω) with solar time for all sunshine hours from 6
am to 6 pm.

Python Approach

PYTHON CODE PROGRAM OUTPUT


#INPUT DATA
z=6 [-90., -75., -60., -45., -30., -15., 0. 15., 30., 45., 60.,
t=18 #24HR FORMAT 75., 90.]

#CALLING FUNCTION
h_ang(z,t)

Graph
The presented figure (Fig. 2) illustrates the fluctuation of the hour angle with solar time (ST),
ranging from -90 to 90 degrees, covering the period from 6 am to 6 pm.

Fig. 2: Variation of Hour angle with solar time.

HBRP Publication Page 11-19 2024. All Rights Reserved Page 15


Research and Applications of Thermal Engineering
Volume 7 Issue 1
DOI: https://doi.org/10.5281/zenodo.10793719

Example 3: Plot the zenith angle (𝜃𝑧 ) variation against the hour angle for New Delhi (𝜙 =
28.45°) on October 25, 2022.

Python Approach
PYTHON CODE PROFRAM OUTPUT
#INPUT DATA
θ_z= [94.40060347 81.51156007 69.1047287
d=25 57.57622602 47.62929677 40.49024901
m=10 37.80969199 40.49024901 47.62929677
y=2022 57.57622602 69.1047287
81.51156007
z=6 94.40060347]
t=18

φ =28.58*(pi/180)

#CALLING HOUR ANGLE FUNCTION

ω=h_ang(z,t)*(pi/180)

#CALLING SOLAR DECLINATION ANGLE FUNCTION

δ =s_de(d,m,y)*(pi/180)

#ZENITH ANGLE

θ_z=zeros(len( ))
for i in range(0,len( )):
θ_z[i]= acos(cos(φ)*cos(δ)*cos(ω[i])+sin(φ)*sin(δ))
print(' θ_z=', θ_z*(180/pi))

#PLOTTING GRAPH OF VARIATION OF ZENITH ANGLE


WITH HOUR ANGLE

plot( ω*(180/pi), θ_z*(180/pi),'b-o')


xlabel('HOUR ANGLE')
ylabel('ZENITH ANGLE')
show()

Below is the obtained plot (Fig. 3) which minimum value of 37.09 degrees at an hour
illustrates the variation of the zenith angle angle of 0 degrees, while it attains its
with the hour angle for October 25, 2022. maximum values of 94.40 degrees at hour
Notably, the zenith angle reaches its angles of -90 and 90 degrees.

HBRP Publication Page 11-19 2024. All Rights Reserved Page 16


Research and Applications of Thermal Engineering
Volume 7 Issue 1
DOI: https://doi.org/10.5281/zenodo.10793719

Fig. 3: Variation of zenith angle with hour angle.

Example 4
Plot the extraterrestrial radiation intensity variation throughout the year.

Python Approach

PYTHON CODE PROGRAM OUTPUT


#INPUT DATA
Intensity of extraterrestrial radiation till n=365 days of the year at an
d=31 interval of 12 days:
m=12
y=2022 array([1369.48912687, 1368.45729907,
i_sc=1367 1367.33082006, 1366.18285437,
1365.08796209, 1364.11725619,
#CALLING THE 1363.33378379, 1362.78843123,
FUNCTION 1362.51661902, 1362.53600129,
1362.84531918, 1363.42448255,
s_int(d,m,y,i_sc) 1364.2358749 , 1365.22679649,
1366.33288721, 1367.48230674,
1368.60040057, 1369.61454878,
1370.45888269, 1371.07856302,
1371.4333417 , 1371.50017593,
1371.27472484, 1370.77163144,
1370.0235715 , 1369.07913135,
1367.99965212, 1366.85524574,
1365.72024112])

The graph (Fig. 4) below shows the variation of intensity of extraterrestrial radiation with the
nth day of the year (‘n’ varies from 1 to 365).

HBRP Publication Page 11-19 2024. All Rights Reserved Page 17


Research and Applications of Thermal Engineering
Volume 7 Issue 1
DOI: https://doi.org/10.5281/zenodo.10793719

Fig. 4: Variation of intensity of extraterrestrial radiation with days.

CONCLUSION 5. Chauhan, R., Dumka, P., & Mishra, D.


In this research article, the graphical R. (2022). Modelling conventional and
evaluation of solar-earth angles was solar earth still by using the LM
successfully performed using Python algorithm-based artificial neural
programming. For this study, four problems network. International Journal of
were taken, and functions were developed Ambient Energy, 43(1), 1389-1396.
accordingly with the help of different 6. Ahmad, M.J., Tiwari, G.N. (2010).
modules. The results obtained were Solar radiation models-review. Int. J.
accurate and can help beginners to increase ENERGY Environ, 1, 2076–2909.
their basic understanding and interpretation 7. Pawar, P. S., Mishra, D. R., & Dumka,
of solar geometry. P. (2022). Solving first order ordinary
differential equations using least
REFERENCES square method: a comparative
1. Mahian, O., Kianifar, A., Jumpholkul, study. Int J Innov Sci Res
C., Thiangtham, P., Wongwises, S., & Technol, 7(3), 857-864.
Srisomba, R. (2015). Solar distillation 8. Deo, A., Joshi, A. R., Parashar, A.,
practice for water desalination Mishra, D. R., & Dumka, P. (2022).
systems. Journal of Thermal Analysing one dimensional tapered
Engineering, 1(4), 287-288. pin-fin using finite difference. Res
2. Katekar, V. P., & Deshmukh, S. S. Appl Therm Eng, 5(1), 1-6.
(2020). A review on research trends in 9. Rocklin, M. (2012). Uncertainty
solar still designs for domestic and modeling with SymPy stats. In Proc
industrial applications. Journal of 11th Python Sci Conf (pp. 51-5).
cleaner production, 257, 120544. 10. Pawar, P. S., Mishra, D. R., Dumka, P.,
3. Dumka, P., & Mishra, D. R. (2020). & Pradesh, M. (2022). Obtaining exact
Performance evaluation of single slope solutions of viscoincompressible
solar still augmented with the parallel flows using python. Int J Eng
ultrasonic fogger. Energy, 190, Appl Sci Technol, 6(11), 213-217.
116398. 11. Huei, Y. C. (2014, December).
4. Dumka, P., Jain, A., & Mishra, D. R. Benefits and introduction to python
(2020). Energy, exergy, and economic programming for freshmore students
analysis of single slope conventional using inexpensive robots. In 2014
solar still augmented with an ultrasonic IEEE International Conference on
fogger and a cotton cloth. Journal of Teaching, Assessment and Learning
Energy Storage, 30, 101541.

HBRP Publication Page 11-19 2024. All Rights Reserved Page 18


Research and Applications of Thermal Engineering
Volume 7 Issue 1
DOI: https://doi.org/10.5281/zenodo.10793719

for Engineering (TALE) (pp. 12-17). symbolic computing in Python. PeerJ


IEEE. Computer Science, 3, e103.
12. Joshi, A. R., Deo, A., Parashar, A., 22. Kanagachidambaresan, G. R., &
Mishra, D. R., & Dumka, P. (2023). Manohar Vinoothna, G. (2021).
Modelling Steam Power Cycle using Visualizations. Programming with
Python. TensorFlow: Solution for Edge
13. Varsha, M., Yashashree, S., Ramdas, Computing Applications, 15-21.
D. K., & Alex, S. A. (2019). A Review 23. Bisong, E. (2019). Building machine
of Existing Approaches to Increase the learning and deep learning models on
Computational Speed of the Google cloud platform (pp. 59-64).
Python. International Journal of Berkeley, CA: Apress.
Research in Engineering, Science and Cite as:
Management, 2(4). Adarsh Deo, Arnav Raj Joshi, Pankaj
14. Hoyer, S., & Hamman, J. (2017). Dumka, & Dhananjay R. Mishra. (2024).
xarray: ND labeled arrays and datasets Modelling of Solar Radiation using Python.
in Python. Journal of Open Research Research and Applications of Thermal
Software, 5(1). Engineering, 7(1), 11–19.
15. Johansson, R., Johansson, R., & John, https://doi.org/10.5281/zenodo.10793719
S. (2019). Numerical python (Vol. 1).
New York: Apress.
16. Dumka, P., Dumka, R., & Mishra, D.
R. (2022). Numerical Methods using
Python (For scientists and Engineers).
Blue Rose Publishers.
17. Dumka, P., Rana, K., Tomar, S. P. S.,
Pawar, P. S., & Mishra, D. R. (2022).
Modelling air standard thermodynamic
cycles using python. Advances in
Engineering Software, 172, 103186.
18. Dumka, P., Chauhan, R., Singh, A.,
Singh, G., & Mishra, D. (2022).
Implementation of Buckingham's Pi
theorem using Python. Advances in
Engineering Software, 173, 103232.
19. Rocklin, M., & Terrel, A. R. (2012).
Symbolic statistics with
SymPy. Computing in Science &
Engineering, 14(3), 88-93.
20. Cywiak, M., & Cywiak, D. (2021).
Two-Dimensional Fourier Transform.
In Multi-Platform Graphics
Programming with Kivy: Basic
Analytical Programming for 2D, 3D,
and Stereoscopic Design (pp. 313-
346). Berkeley, CA: Apress.
21. Meurer, A., Smith, C. P., Paprocki, M.,
Čertík, O., Kirpichev, S. B., Rocklin,
M., ... & Scopatz, A. (2017). SymPy:

HBRP Publication Page 11-19 2024. All Rights Reserved Page 19

You might also like