Modelling of Solar Radiation Using Pytho
Modelling of Solar Radiation Using Pytho
Volume 7 Issue 1
DOI: https://doi.org/10.5281/zenodo.10793719
*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.
NOMENCLATURE
δ Solar declination angle
ω Hour angle
θz Zenith angle
ISC Solar constant
ION Intensity of extraterrestrial radiation
φ Latitude
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
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
def s_dec(d,m,y):
arr = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ]
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
def s_int(d,m,y,i_sc):
arr = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ]
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
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.
Example 2: Plot the variation of hour angle (ω) with solar time for all sunshine hours from 6
am to 6 pm.
Python Approach
#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.
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)
ω=h_ang(z,t)*(pi/180)
δ =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))
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.
Example 4
Plot the extraterrestrial radiation intensity variation throughout the year.
Python Approach
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).