Class: PlainOfArrayIrradiance

Inherits:
Object
  • Object
show all
Includes:
CalculationHelper
Defined in:
lib/PVLIB_Ruby/plain_of_array_irradiance.rb

Overview

For Sky Diffuse Irradiance, “Reindl’s 1990 model” is used. Other models are realized by subclasses.

References

[1] Loutzenhiser P.G. et. al. "Empirical validation of models to compute
solar irradiance on inclined surfaces for building energy simulation"
2007, Solar Energy vol. 81. pp. 254-267
[2] Reindl, D.T., Beckmann, W.A., Duffie, J.A., 1990a. Diffuse fraction
correlations. Solar Energy 45 (1), 1–7.
[3] Reindl, D.T., Beckmann, W.A., Duffie, J.A., 1990b. Evaluation of hourly
tilted surface radiation models. Solar Energy 45 (1), 9–17.
[4] Solar radiation basics http://solardat.uoregon.edu/SolarRadiationBasics.html

TODO: Consider to pass necessary parameters to the respective methods instead of passing all of them to the constructor.

Haven't decided which way would be better.

Constant Summary collapse

AVEARGE_EXTRATERRESTRIAL_IRRADIANCE =
W/m^2
BigDecimal('1367')
SMALL_VALUE_FOR_SKY_DIFFUSE_IRRADIANCE =

In order to make the calculated value consistent with the one by PVLIB_MatLab

BigDecimal('0.000001')

Instance Method Summary collapse

Methods included from CalculationHelper

#bigdecimal_acos, #bigdecimal_asin, #bigdecimal_atan2, #bigdecimal_cos, #bigdecimal_exp, #bigdecimal_sin, #bigdecimal_sqrt, #bigdecimal_tan, #degree_to_radian, #radian_to_degree

Constructor Details

#initialize(direct_normal_irradiance, global_horizontal_irradiance, diffuse_horizontal_irradiance, day_of_year, albedo, surface_tilt, surface_azimuth, sun_zenith, sun_azimuth) ⇒ PlainOfArrayIrradiance

Returns a new instance of PlainOfArrayIrradiance.



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/PVLIB_Ruby/plain_of_array_irradiance.rb', line 24

def initialize(direct_normal_irradiance, global_horizontal_irradiance, diffuse_horizontal_irradiance, day_of_year, albedo, surface_tilt, surface_azimuth, sun_zenith, sun_azimuth)
  @direct_normal_irradiance = direct_normal_irradiance           # DNI [W/m^2]
  @global_horizontal_irradiance = global_horizontal_irradiance   # GHI [W/m^2]
  @diffuse_horizontal_irradiance = diffuse_horizontal_irradiance # DHI [W/m^2]
  @day_of_year = day_of_year
  @albedo = albedo
  @surface_tilt = surface_tilt
  @surface_azimuth = surface_azimuth
  @sun_zenith = sun_zenith
  @sun_azimuth = sun_azimuth
end

Instance Method Details

#angle_of_incidenceObject



62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/PVLIB_Ruby/plain_of_array_irradiance.rb', line 62

def angle_of_incidence
  cosine_of_angle_of_incidence = bigdecimal_cos(degree_to_radian(@sun_zenith)) * bigdecimal_cos(degree_to_radian(@surface_tilt)) + 
                                 bigdecimal_sin(degree_to_radian(@surface_tilt)) * bigdecimal_sin(degree_to_radian(@sun_zenith)) * bigdecimal_cos(degree_to_radian(@sun_azimuth - @surface_azimuth))

  if cosine_of_angle_of_incidence > BigDecimal('1')
    cosine_of_angle_of_incidence = BigDecimal('1')
  elsif cosine_of_angle_of_incidence < BigDecimal('-1')
    cosine_of_angle_of_incidence = BigDecimal('-1')
  end

  radian_to_degree(bigdecimal_acos(cosine_of_angle_of_incidence))
end

#beam_irradianceObject



36
37
38
# File 'lib/PVLIB_Ruby/plain_of_array_irradiance.rb', line 36

def beam_irradiance
  @direct_normal_irradiance * bigdecimal_cos(degree_to_radian(angle_of_incidence))
end

#extraterrestrial_irradianceObject

This is used only for calculating Sky Diffuse Irradiance. But it’s made public method just in case some other code needs it. Reference: [4]



55
56
57
58
59
60
# File 'lib/PVLIB_Ruby/plain_of_array_irradiance.rb', line 55

def extraterrestrial_irradiance
  earth_orbit_angle_in_radian = BigDecimal('2') * BigDecimal(Math::PI.to_s) * @day_of_year / BigDecimal('365')
  sun_earth_distance_factor_square = BigDecimal('1.00011') + BigDecimal('0.034221') * bigdecimal_cos(earth_orbit_angle_in_radian) + BigDecimal('0.001280') * bigdecimal_sin(earth_orbit_angle_in_radian) +
                                     BigDecimal('0.000719') * bigdecimal_cos(BigDecimal('2') * earth_orbit_angle_in_radian) + BigDecimal('0.000077') * bigdecimal_sin(BigDecimal('2') * earth_orbit_angle_in_radian)
  AVEARGE_EXTRATERRESTRIAL_IRRADIANCE * sun_earth_distance_factor_square
end

#ground_diffuse_irradianceObject



40
41
42
# File 'lib/PVLIB_Ruby/plain_of_array_irradiance.rb', line 40

def ground_diffuse_irradiance
  @global_horizontal_irradiance * @albedo * (1 - bigdecimal_cos(degree_to_radian(@surface_tilt))) * BigDecimal('0.5')
end

#sky_diffuse_irradianceObject

Based on the equation (5) of [3] The comment in PVLIB_MatLab says it’s based on the modified version of the equation (8) of [1]. But I observe that the code is exactly same as the equation (5) of [3].



47
48
49
50
# File 'lib/PVLIB_Ruby/plain_of_array_irradiance.rb', line 47

def sky_diffuse_irradiance
  @diffuse_horizontal_irradiance * (anisotropy_index * geometric_factor + 
                                    (1 - anisotropy_index) * ((BigDecimal('1') + bigdecimal_cos(degree_to_radian(@surface_tilt))) / BigDecimal('2')) * anisotropic_correction_factor)
end