Anda di halaman 1dari 12

A Matlab GUI for

Calculating the Solar


Radiation and Shading of
Surfaces on the Earth
BASTIAN KELLER, ALEXANDRE M. S. COSTA
Universidade Estadual de Maringa, Av. Colombo 5790, Bloco 104, Maringa, PR, CEP 87020-900, Brazil
Received 18 December 2007; accepted 29 October 2008
ABSTRACT: Predicting the amount of solar radiation that strikes a surface is of the
highest importance in several engineering applications. Just to name a few, solar radiation
estimates is fundamental during the design of technologies such as: at plates and
concentrating collectors, solar energy storage devices, solar heaters, and photovoltaic
systems. Furthermore, solar radiation estimates are important in energy studies for buildings,
as during the cooling load calculation for air conditioning systems. The calculation of the solar
radiation and shading involves many equations and a lot of inuencing factors must be
considered. Therefore, a Matlab GUI was developed that execute the equations and considers
all the inuencing factors. The program calculates the solar radiation and shadows caused by a
rectangle as well as shadows on a rectangle surface caused by ns beside it. The user only has
to set few values (like the location, time, etc.) and he can choose between the calculations
either for a selectable time of the day or for a completely day. Then the results are plotted
either in simple editor frames or in 2D- and 3D-graphics. The program also shows the results of
some inuencing angles subject to the location of the sun in the sky that can be helpful for
many applications. Finally, on the educational side, the Matlab program can be useful for the
engineering student performing some what if studies involving solar radiation. 2009 Wiley
Periodicals, Inc. Comput Appl Eng Educ; Published online in Wiley InterScience (www.interscience.wiley.com);
DOI 10.1002/cae.20301
Keywords: solar radiation; shading; sun movement; solar angles
INTRODUCTION
A star in the universe, the sun is a giant nuclear fusion
reactor. Combining hydrogen to form helium, the sun
generates a great amount of energy. This energy
(called solar radiation) strikes the earth, heats the air,
Correspondence to A. M. S. Costa (amscosta@uem.br).
2009 Wiley Periodicals Inc.
1
water, soil, etc and supplies a lot of the energy systems
on earth.
In making energy studies and in the design of
solar passive homes and solar collectors as well as in
dimensioning air conditioning systems the total
radiation striking a surface over a specied period
of time is required.
The quantity of solar radiation that strikes a
surface (absorber) depends on different inuencing
factors, for example, on the location of the sun in
the sky and the clearness of the atmosphere as well
as on the nature and the orientation of the striking
surface.
Shadows, caused by roofs, ns, buildings, trees or
other things next to the surface, reduces the solar
radiation and therefore the shadows must be consid-
ered during the calculation of the energy that strikes
the surface.
At the beginning of this work the fundamentals of
the solar radiation will be discussed. Then the
required equations will be described, and at the end
the usage of the developed GUI will be explained.
SOLAR RADIATION
Solar radiation is radiant energy emitted by the sun
from a nuclear fusion reaction that creates electro-
magnetic energy. The spectrum of solar radiation is
close to that of a black body with a temperature of
about 5,800 K. About half of the radiation is in the
visible part of the electromagnetic spectrum. The
other half is mostly in the near infrared part, with
some in the ultraviolet part of the spectrum (Fig. 1).
The radiant energy that strikes on a surface is
called the solar irradiation. Beyond the earth atmos-
phere the solar irradiation is almost constant:
Equation (1) shows the value for the solar irradiation
outside the atmosphere:
G
sc
1; 367
W
m
2
1
As will be discussed in the next section, on the earth
surface the solar irradiation depend on further
mechanisms.
INFLUENCING FACTORS OF THE SOLAR
IRRADIATION
The solar radiation striking a surface on the Earths
surface is affected by a number of mechanisms.
As can be seen from Figure 2, a part of the
incident energy is scattered and absorbed by air
molecules, clouds and other particles in the atmos-
phere. The radiation that is not reected or scattered
and reaches the surface directly is called direct
irradiation G
D
. The scattered radiation which reaches
the ground is called diffuse irradiation G
d
. Some of
the radiation is reflected from the ground onto the
receiver; this is called reflected (or albedo) irradiation
G
r
. The total (or global) irradiation G
t
that strikes the
absorber is the summation of these three components.
The amount of radiation is also strongly depend-
ent on the lengths of the path of the rays through the
atmosphere (air mass). The air mass the sunrays have
to pass until they strike the surface is in the morning or
evening much more and thereto the irradiation is
much less than at noontime. So the inuence of the air
mass is also in coherency with location of the sun in
the sky.
Figure 1 Solar radiation spectrum [1]. Figure 2 Parts of solar radiation.
2 KELLER AND COSTA
If the absorber surface is not a horizontal surface
the absorber can produce shadows when the sun is
behind the absorber. Similarly, objects around the
absorber can cause shadows on the absorber.
Summarizing the inuencing factors of total
radiation are:
1. The effects of the Atmosphere and the Earth.
2. The location of the sun in the sky.
3. The nature and the orientation of the absorber.
These inuencing factors are complex and
some of them (e.g., the effect of clouds) are only
approximately to determinate.
EFFECTS OF THE ATMOSPHERE AND
THE EARTH
The processes affecting the intensity of solar radiation
are scattering, absorption, and reection. Reection
occurs in the atmosphere and on the Earths surface.
The depletion of the suns rays by the earth
atmosphere depends on the composition of the
atmosphere (cloudiness, dust and pollutants present,
atmospheric pressure, and humidity).
The scattering of solar radiation is mainly by
molecules of air and water vapor, by water droplets,
and by dust particles. This process returns about 6% of
the incident radiation to space, and about 20% of the
incident radiation reaches the Earths surface as
diffuse solar radiation.
The absorption of solar radiation is mainly by
molecules of ozone and water vapor. Absorption by
ozone takes place in the upper atmosphere at
heights above 40 km. It occurs mainly in the ultra-
violet region of the spectrum, where it is so intense
that very little solar radiation of wavelength less
than 0.3 mm reaches the Earths surface. About 3%
of the solar radiation is absorbed in this way. At
low levels in the atmosphere about 14% of the solar
radiation is absorbed by water vapor, mainly in the
near infra-red region of the spectrum. Clouds
absorb very little solar radiation, which explains
why they do not evaporate in sunlight. The effect
of clouds on solar radiation is mainly scattering and
reection.
The reection of solar radiation depends on the
nature of the reecting surface. The fraction of the
solar irradiation that is reected from the surface of
the Earth is called the albedo of the surface. The total
albedo, which includes all wavelengths, is closely
related to the visible albedo, which includes only light
in the visible region of the spectrum.
If there is cloud between the sun and the point of
observation, then the direct solar irradiation is
weakened or eliminated. Diffuse solar radiation, on
the other hand, may be greater or less in the presence of
cloud than under a clear sky, depending on the type and
amount of the cloud. Thin layers of clouds and
scattered clouds reecting sunlight, increase the diffuse
solar irradiation. Thick layers of cloud reduce diffuse
solar irradiation. Total solar irradiation is usually
reduced by cloud, but if the sun is shining in a clear
part of the sky and there are brightly illuminated clouds
nearby, then global solar irradiance may be greater than
it would be under a completely clear sky [2].
The consideration of all these effects is complex,
because there are often many different reectors
around the absorber and the effects of clouds and other
particles on the solar radiation received at the Earths
surface. But there are many recommendations and
publications that are concerned with that Refs. [35].
A common method that deals with the prediction of
these effects is the ASHRAE Clear sky model (see
ASHRAE Clear Sky Model Section).
LOCATION OF THE SUN IN THE SKY
The earth revolves around the sun every 365.25 days
in an elliptical orbit and rotates about its own polar
axis, inclined to the ecliptic plane by 23.458, in
approximately 24-h cycles. The direction in which the
polar axis points is xed in space and is aligned with
the North Star (Polaris) to within about 45 min of arc
(13 mrad).
As can be seen from Figure 3 the tilt of the earth
axis relative to the ecliptic plane produces our seasons
as the earth revolves about the sun.
The location of the sun in the sky above a surface
depends on the day of the year (date) and the time of
the day as well as the location of the surface on the
earth (longitude and latitude). The used angles that
describe the location of the sun are shown in Figure 4.
Figure 3 Circulation of the earth around the sun.
SOLAR RADIATION AND SHADING OF SURFACES 3
The declination angle d is the angle between a
line connecting the center of the sun and earth and the
projection of that line on the equatorial plane. This
angle varies from 23.458 till 23.458 throughout
a year. The following equation (developed from work
by Spencer [6]) describes this angle depending of
the day of the year
d 0:3963723 22:9132845 cosN 4:0254304
sinN 0:387205 cosN 0:05196728 sin2N
0:1545267 cos3N 0:08479777 sin3N 2
where
N n 1
360
365

3
given in degrees, and n is the day of the year,
1 n 365.
To describe the earths rotation about its polar axis,
the hour angle h is used. The hour angle is the angular
distance between the meridian of the absorber and the
meridian whose plane is parallel to the sun rays. This
angle increases by 0.258 every minute (158 every hour).
It depends on the longitude and the time of the day.
Time is generally measured about standard time
zone meridians (Fig. 5). These meridians are located
every 158 from the Greenwich meridian so that
local time changes in 1-h increments from one
standard time zone meridian to the next. The
standard time zone meridians east of Greenwich
have times later than Greenwich time, and the
meridians to the west have earlier times.
To describe the hour angle the Local Solar Time
(LST) is used, because the hour angle is zero at solar
noon (LST: 12:00 h), when the sun reaches its highest
point in the sky. From Equation (4) the LST can be
calculated from the Local Civil Time (LCT) with the
help of a quantity called Equation of Time (EOT):
LST LCT EOT 4
The EOT is given by [6]:
EOT 229:2 0:000075 0:001868 cosN
0:032077 sinN 0:014615 cos2N
0:04089 sin2N 5
in minutes, with N from Equation (3).The LCTwill be
calculated by:
LCT Local Standard Time Lo SM
4 min=deg W;
whereas Lo is the longitude angle and SM is the
corresponding standard meridian; both given in
degrees. In a few countries the Local Standard Time
is raised while the summer period about one hour
(Daylight Saving Time DST). During this period the
Local Standard Time is:
LocalStandardTime LocalDST 1 h 7
Now the hour angle can be calculated by:
h
720 min LST
4 deg W=min
; 8
where h is given in degree.
Figure 4 Location of the sun in the sky.
4 KELLER AND COSTA
It is of the greatest importance in solar energy
systems design, to be able to calculate the solar
altitude b and azimuth angles F at any time for any
location on the earth using the fundamental angles (l,
h, and d).
The solar altitude is the angle between the suns
rays and the projection of that ray on a horizontal
surface. It is given by:
sinb cosl cosh cosd sinl sind 9
As can be seen from Figure 4, b is the angle of the sun
above the horizon. When b is positive is day,
otherwise it is night.
The solar azimuth angle F is the angle in the
horizontal plane measured in the clockwise direc-
tion between the north and the projection of the
suns rays on that plane. It is related by the other
angles by:
tanF
sinh cosd
sinl cosh cosd cosl sind
10
When taking the inverse of tan(F), F is only in the 1st
and 4th quadrant (90 <F<908) of the horizontal
surface. Therefore it is necessary to check which
quadrant F is in. If s
z
0 < 0 we have to add 1808
(FF1808).
ORIENTATION OF THE STRIKING
SURFACE
The angles denoted above, describe the orientation of
the sun in relation to a at horizontal surface. Often a
surface is tilted and/or has ns that cause shadows and
inuences the irradiation. The inuence of the
shadows will be described in Shadowing Section.
The auxiliary angles of a tilted surface are depicted in
Figure 6.
a is the tilt angle between the normal of the
horizontal surface and the normal of the tilted surface.
Figure 5 Time zones.
Figure 6 Angles of the striking surface.
SOLAR RADIATION AND SHADING OF SURFACES 5
It is 908 for a vertical wall and zero for a horizontal
plane.
The surface azimuth c is the angle measured to
the projection of the tilted normal on the horizontal
plane clockwise from the north.
For a vertical or tilted surface the angle measured
in the horizontal plane between the projection of the
suns rays on that plane and a normal to the surface is
called the surface solar azimuth g
g f c 11
The angle of incidence y is the angle between the
suns ray and the normal to the tilted surface. By
analytic geometry it can be shown:
cosy cosa sinb sina cosb cosg 12
If cos(y) is less than zero, the sun is behind the
absorber and there is no direct radiation.
ASHRAE CLEAR SKY MODEL
The value of the solar irradiation at the surface of the
earth on a clear day is given by the ASHRAE Clear
Sky Model [3]. This Model is complex and the
explanations and derivations of the factors and
equations are substantial. Therefore in this section
only the equations and factors of this model, used in
the GUI, will be depicted shortly. They are taken from
Ref. [4].
The model gives an approximation of the
maximum values of the solar irradiation for a given
location and day, by dealing with the following
factors:
A, apparent solar irradiation at air mass
equal to zero;
B, atmospheric extinction coefficient;
C, ratio of diffuse radiation on a horizontal
surface to direct normal irradiation;
C
N
, clearness number;
g
, reflectance factor.
The values of A, B, and C are given in Table 1
from Machler and Iqbal [5] for the 21st day of
each year in the USA.
The data in Table 1 are representative conditions
on average cloudless days. To account for regional
variations of humidity and clearness, ASHRAE
published maps for a parameter called clearness
number C
N
, for both summer and winter, for different
regions in the USA. This parameter is used to modify
the radiation values obtained from the model. It
considers the depletion of the suns rays by the
atmosphere and varies from 0.9 till 1.1. As the exact
values of these factors for other regions of the world
are not known, the previous range of values can be
used as a first approximation.
The reectance factor considers the reflection of
ground and horizontal surfaces around the absorber.
This factor is seen as an average value of all surfaces
around the absorber. Table 2 shows some typical
values for the sun overhead.
NORMAL DIRECT IRRADIATION
The irradiation that strikes on the absorber directly in
the same direction as the suns rays is called normal
direct irradiation G
ND
:
G
ND

A
e
B=sin b
C
N
13
This is the basic irradiation and the starting point for
the clear sky model.
DIRECT IRRADIATION
The direct irradiation is the part of the normal direct
irradiation that strikes the surface in the same
Table 1 A, B, and C Coefficients for 21st Day of
Each Month
Month A (W/m
2
) B C
January 1,202 0.141 0.103
February 1,187 0.142 0.104
March 1,164 0.149 0.109
April 1,130 0.164 0.12
May 1,106 0.177 0.13
June 1,092 0.185 0.137
July 1,093 0.186 0.138
August 1,107 0.182 0.134
September 1,136 0.165 0.121
October 1,166 0.152 0.111
November 1,190 0.142 0.106
December 1,204 0.141 0.103
Table 2 Reflectance Factor
g
[2]
Surface
Vegetation 0.2
Pale soil 0.3
Dark soil 0.1
Water 0.1
6 KELLER AND COSTA
direction as the normal of the surface. It is calculated
by:
G
D
G
ND
cosy 14
Because there is no direct irradiation, if cos(y) <0 is
more convenient to express this equation in computer
programs as:
G
D
G
ND
maxcosy; 0 15
DIFFUSE IRRADIATION
The diffuse irradiation is different for horizontal,
vertical and non-vertical surfaces.
1. For horizontal surfaces it is:
G
d
C G
ND
16
2. For non-vertical surfaces it is:
G
d
CG
ND
F
ws
17
with
F
ws

1 cosa
2
18
Equation (17) can be used for non-vertical and
horizontal surfaces, because F
ws
1 when
a908.
3. For vertical surfaces it is calculated by:
G
d
CG
ND
G
dV
G
dH
19
and G
dV
/G
dH
is approximated by:
G
dV
G
dH
0:55 0:437 cosy 0:313 cos
2
y
20
when cos(y) >0.2;
otherwise,
G
dV
G
dH
0:45 21
REFLECTED IRRADIATION
The reected part of the solar radiation is given by:
G
R

g
F
wg
sinb CG
ND
22
whereas F
ws
is given by:
F
wg

1 cosa
2
23
TOTAL IRRADIATION
The total irradiation is the summation of the direct,
diffuse and reected irradiation:
G
t
G
d
G
D
G
r
24
Because of the difference of the diffuse irradiation it is
for non-vertical surfaces:
G
t
maxcosy; 0 CF
ws

g
F
wg
sinb
CG
ND
25
And for vertical surfaces:
G
t
maxcosy; 0C
G
dV
G
dH

g
F
wg
sinbC

G
ND
SHADOWING
Whenever the direct radiation does not strike a surface
there would be shadows. Shadows are caused by
objects like trees, buildings, walls, ns, etc. In the
program there are two cases of shadows implemented.
One is the shadow on the absorber, caused by ns
beside it (see Fig. 7a) and the other is the shadow on
the horizontal surface, caused by a rectangle surface
(see Fig. 7b).
Again by analytic geometry the angles e and h
can be calculated by:
sinh sina sinb cosa cosg cosb 27
sine
sing cosb
cosh
28
Thereto the values of the shadow dimension in case
(a) are given by:
y shad
sine
cose
b taneb 29
and
x shad
sinh
cosh cose
b
tanm
cose
b 30
The shaded area in case (a) can be calculated by:
A shad y shady a x shad c y shady x shad
31
In case (b) we use the shadow point caused by the
upper left corner of the surface for the calculation of
the shadow coordinates. These coordinates are given
SOLAR RADIATION AND SHADING OF SURFACES 7
by:
y
0
shad c sinc cosa
a
2
cosc

c sina sinh cosd


cosl cosh cosd sinl sind
32
z
0
shad c cosc cosa
a
2
sinc

c sinasinl cosh cosd cosl sind


cosl cosh cosd sinl sind
(33)
And the shaded area can be calculated by:
At dawn and dusk the shadowed area normally
appears and disappears continuously. This effect is not
considered in the Matlab program and therefore the
shaded area changes suddenly when b changes
between positives and negatives values (see Fig. 11).
THE MATLAB GUI
For the calculation of the solar radiation and shadows
on the earth the equations described previously must
be solved. This is a very extensive calculation and
therefore the equations are implemented in a Matlab
program. Before the equation can be solved some
initial values must be set. Hence a GUI was built, in
that the user can set the desired values. For a better
understanding some graphics that depict the input
values are implemented. In Figures 8 and 9 the layout
of the Matlab GUI is shown. With this GUI, the
amount of solar radiation that strikes a given surface
in given time in any place on earth can be calculated.
Also, the program allows the calculation of the
shadows on a rectangular absorber caused by ns or
shadows on the horizontal plane caused by a
rectangular surface. Additionally the program shows
the results of the most important angles of the location
of the sun in the sky.
The user has to set the date, what from the
program calculates the day of the year. When the
checkbox Calculate 24 hours is not activated the
user can set the time (local standard time) of the day
and the calculation will be executed only for this time.
Then the results will be plotted inside the GUI. By
activating Calculate 24 hours the selection of
the time is disabled and the results will be calculated
Figure 7 Shadows (a) on the striking surface and (b) on the horizontal plane.
A shad a sina c cosc cosa
a
2
sinc
c sinasinl cosh cosd
cosl sind
cosl cosh cosd
sinl sind

34
8 KELLER AND COSTA
for every minute of the day, thus for the whole day. In
case of the daylight saving time is ofcial for the
selected date and location, it is important not to forget
to activate the checkbox Daylight savings.
Further the user has to set the location of the
surface on the earth (Longitude and Latitude)
inclusive the corresponding Standard-Meridian.
For the choice of the orientation of the surface,
one of the three radio buttons (horizontal, vertical, or
tilted surface) must be selected. The Selection of c, a,
and is disabled when a horizontal surface is chosen,
because the orientation of the horizontal surface
(c08, a908) is set automatically and there is no
reflection on horizontal surfaces. Furthermore it is not
possible to select a, when the surface is as vertical
surface is selected. It is set automatically, too (a 08).
For the calculation of the solar irradiation
the factors of the reection of the ground and
the clearness factor C
N
must be chosen. Finally the
user can choose between the units for the irradiation;
Btu/h ft
2
or W/m
2
.
When starting the program the shadow calcula-
tion will not be shown. Not until the checkbox
Shadow calculation gets activated the shadow
calculation part of the program appears.
By clicking the Calculation button the calcu-
lation will be started and the results will be plotted. If
there are incorrect or missing settings, the calculation
Figure 8 The Matlab GUI without shadow calculation.
SOLAR RADIATION AND SHADING OF SURFACES 9
will be stopped and an error message will be shown.
Then the user has to correct this value and to restart
the calculation.
The results inside the GUI and the plots in
Figures 10b and 11a, shows the angles (y, b, and F)
and the solar irradiation (G
tot
, G
dir
, G
dif
, and G
ref
).
Figure 10a shows the movement of the sun during the
chosen day above the selected location. By activating
the checkbox Additional results the results of G
ND
,
G
dH
, G
dV
/G
dH
or F
ws
, d, EOTand LSTwill be plotted.
Figure 9 The Matlab GUI with shadow calculation.
Figure 10 Result figures: (a) sun movement and (b) angles.
10 KELLER AND COSTA
Because d and EOTare constant during a day, they are
only shown in the inside the GUI.
When the shadow calculation is activated the
user can choose between different shadow results,
whereby he can choose the size of a rectangular
surface by setting the width a and the length c.
If there is no n activated the shadows on the
horizontal plane (C
0
), caused of the surface with the
selected orientation, will be calculated (see Fig. 7b).
Then the shadow coordinates of the upper left corner
of surface (y
0
and z
0
) will be shown.
Not until one n is selected (Top Fin, Bottom
Fin, Left Fin, Right Fin) the program calcu-
lates the shadows on the surface caused by the
selected ns (see Fig. 7a). In this case only positive
values of the shadow coordinates (jxj, jyj) are shown.
Further the results of the shaded area Ashad
and the ratio of the shaded area to the surface area
Asurf (Ashad/Asurf) are calculated.
CONCLUSION
The solar irradiation that strikes a surface depends on
the effects of the atmosphere and the earth, the
location of the sun in the sky and the orientation of the
absorber surface. The ASHRAE clear sky model deals
with these inuence factors and allows the prediction
of the solar irradiation approximately. Objects beside
the absorber cause shadows that reduce the total
irradiation. Therefore the nature around and of the
absorber should be considered in making solar energy
studies, too.
The consideration of all inuence factors causes
more than 20 equations and a lot of distinction cases
that are implemented in a Matlab .m-le in con-
junction with a GUI. The program calculates the solar
angles by a given date, time and Location and allows
the prediction of the solar radiation approximately by
selecting few values (time, date, location, surface
orientation, , C
N
, surface nature). Additionally the
calculation of shadows caused by a rectangle as well
as shadows on a rectangle surface caused by fins
beside it is implemented. Therefore the program can
be an advantage support in making solar energy
studies and related applications.
REFERENCES
[1] Wikipedia, http://en.wikipedia.org/wiki/Special:Search?
searchsolarRadiation&goGo, state 07.12.2007.
[2] R. H. B. Exell, The Intensity of Solar Radiation,
King Mongkuts University of Technology Thonburi,
2000. http://www.jgsee.kmutt.ac.th/exell/Solar/Intensity.
html.
[3] ASHRAE Handbook, Fundamentals Volume, Chapter
30 Fenestration, American Society of Heating,
Refrigerating and Air-Conditioning Engineers, Inc.,
Atlanta, GA, 2001.
[4] F. C. Mcquiston, J. D. Parker, and J. Spitler, Heating,
ventilating, and air conditioning: analysis and design,
John Wiley & Sons, USA, 2000, pp. 181197.
[5] M. A. Machler and M. Iqbal, A modification of the
ASHRAE clear sky model, ASHRAE Trans 1985.
[6] J. W. Spencer, Fourier series representation of the
position of the Sun, John Wiley & Sons, USA, 1971,
p. 172.
Figure 11 Result figures: (a) solar radiation and (b) shadows.
SOLAR RADIATION AND SHADING OF SURFACES 11
BIOGRAPHIES
Bastian Keller is a visiting student from
University of Stuttgart. Soon, he will receive
his degree in Electrical Engineering. His
research interests include numerical simula-
tion, and scientific and educational software.
Alexandre Marconi de Souza da Costa is
an adjunct professor in the Mechanical
Engineering Department at the State Uni-
versity of Maringa (UEM), Brazil. He
received his MSc and PhD in Mechanical
Engineering from Campinas State University
(UNICAMP), Brazil. One year of his PhD
work was spent at University of California at
San Diego (UCSD). His research interests
includes numerical simulation, HVAC, and scientific and educa-
tional software.
12 KELLER AND COSTA