Class: Daylight::HourAngleForObserver

Inherits:
Object
  • Object
show all
Defined in:
lib/trigger_switch_d/daylight.rb

Overview

Hour Angle for observer in degrees

Constant Summary collapse

Solar_Disk_Diameter_and_Refraction_for_Earth_as_rad =

:nodoc:all

-0.83 * Math::PI/180.0

Instance Method Summary collapse

Constructor Details

#initialize(north_as_rad, transit) ⇒ HourAngleForObserver

Returns a new instance of HourAngleForObserver.



87
88
89
90
91
92
# File 'lib/trigger_switch_d/daylight.rb', line 87

def initialize(north_as_rad, transit)
  declination = DeclinationOfEarth.new(transit.lamda.to_rad)
  hour_angle_numerator = Math.sin(Solar_Disk_Diameter_and_Refraction_for_Earth_as_rad) - Math.sin(north_as_rad)*Math.sin(declination)
  hour_angle_denominator = Math.cos(north_as_rad) * Math.cos(declination)
  @hour_angle = Math.acos(hour_angle_numerator/hour_angle_denominator).to_degrees
end

Instance Method Details

#to_fObject



93
94
95
# File 'lib/trigger_switch_d/daylight.rb', line 93

def to_f
  @hour_angle
end