Class: AirMass

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

Overview

The default model for relative air mass is ‘kastenyoung1989’. Different model is realized by subclass. ‘kastenyoung1989’ model is based on: Fritz Kasten and Andrew Young. “Revised optical air mass tables and approximation formula”. Applied Optics 28:4735–4738

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(sun_zenith, pressure) ⇒ AirMass

Returns a new instance of AirMass.



9
10
11
12
# File 'lib/PVLIB_Ruby/air_mass.rb', line 9

def initialize(sun_zenith, pressure)
  @sun_zenith = sun_zenith
  @pressure = pressure
end

Instance Method Details

#absolute_air_massObject

Airmass for locations not at sea level (i.e. not at standard pressure)



22
23
24
# File 'lib/PVLIB_Ruby/air_mass.rb', line 22

def absolute_air_mass
  relative_air_mass * @pressure / BigDecimal('101325')
end

#relative_air_massObject

Relative air mass at sea level



15
16
17
18
19
# File 'lib/PVLIB_Ruby/air_mass.rb', line 15

def relative_air_mass
  relative_air_mass = BigDecimal('1') / (Math.cos(degree_to_radian(@sun_zenith).to_f) + BigDecimal('0.50572') * ((BigDecimal('6.07995') + (BigDecimal('90') - @sun_zenith)).power(-1.6364)))
  relative_air_mass = BigDecimal('0') if relative_air_mass.nan?
  relative_air_mass
end