class SGS::Logger
Waypoint
, Attractor, and Repellor definitions
Constants
- AFTERNOON_WATCH
- ALARM_REPORT
- DOG_WATCH
- FIRST_WATCH
Watch names and definitions. The first watch is from 8PM until midnight (local time), the middle watch is from midnight until 4AM. The morning watch is from 4AM until 8AM. The forenoon watch runs from 8AM until noon and the afternoon watch runs from noon until 4PM. The dog watches run from 4PM until 8PM and around we go again.
Logs are sent back to base every four hours (6 per day) starting at midnight UTC. However, some of the reporting is based on the watch system rather than UTC. For example, reporting battery voltage is most useful at the start of the forenoon watch, because this represents the lowest voltage point after driving the boat all night. As a result, the watch ID is computed based on the longitude, which is a rough approximation of the timezone.
- FORENOON_WATCH
- MIDDLE_WATCH
- MORNING_WATCH
- WATCH_NAMES
Attributes
Public Class Methods
# File lib/sgs/logger.rb, line 68 def initialize() @watch = FIRST_WATCH end
Public Instance Methods
Determine the watch report. This takes account our actual latitude and the current time. It does a rudimentary timezone conversion and calculates the watch. Note that what we're calculating here is what was the previous watch. So any time after 23:45 (local), we'll report from the First Watch. Right up until 03:45 (local) when we'll start reporting from the Middle Watch.
# File lib/sgs/logger.rb, line 85 def determine_watch(longitude) utc = Time.now local_hour = utc.hour + longitude * 12.0 / Math::PI p utc p local_hour local_hour += 24.0 if local_hour < 0.0 local_hour -= 24.0 if local_hour >= 24.0 @watch = ((local_hour / 4.0) + 0.25).to_i @watch = FIRST_WATCH if @watch == 6 end
Convert the watch ID to a name
# File lib/sgs/logger.rb, line 74 def watch_name WATCH_NAMES[@watch] end