Class: SGS::Alarm

Inherits:
RedisBase show all
Defined in:
lib/sgs/alarm.rb

Overview

Deal with alarm subsystem.

Constant Summary collapse

OTTO_RESTART =
0
RUDDSRV_FAULT =
1
SAILSRV_FAULT =
2
VBATT_CRITICAL =
3
VBATT_UNDERVOLTAGE =
4
VBATT_OVERVOLTAGE =
5
IBATT_INRUSH =
6
IBATT_DRAIN =
7
VSOLAR_OVERVOLTAGE =
8
COMPASS_ERROR =
9
COMPASS_NOREAD =
10
WDI_STUCK =
11
WDI_NOREAD =
12
RUDDER_NOZERO =
13
SAIL_NOZERO =
14
MOTHER_UNRESP =
15
MISSION_COMMENCE =
16
MISSION_COMPLETE =
17
MISSION_ABORT =
18
WAYPOINT_REACHED =
19
CROSS_TRACK_ERROR =
20
INSIDE_FENCE =
21
ALARM_NAMES =
[
  "OTTO Restarted",
  "Rudder Servo Fault",
  "Sail Servo Fault",
  "Battery voltage is critically low",
  "Battery voltage is low",
  "Battery voltage is too high",
  "Battery inrush current",
  "Battery drain current",
  "Solar voltage is too high",
  "Compass module error",
  "Compass not responding",
  "WDI reading is misaligned",
  "Cannot read from the WDI",
  "Cannot zero the rudder position",
  "Cannot zero the sail position",
  "Mother is unresponsive",
  "Mission has commenced",
  "Mission is completed",
  "*** MISSION ABORT ***",
  "Waypoint has been reached",
  "Significant cross-track error",
  "Vessel is inside the fence"
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from RedisBase

#count, #count_name, #load, load, #make_redis_name, #publish, redis, redis_handle, #redis_read_var, #save, #save_and_publish, setup, subscribe, to_redis, var_init

Constructor Details

#initializeAlarm

Returns a new instance of Alarm.



90
91
92
93
94
95
# File 'lib/sgs/alarm.rb', line 90

def initialize
  @count = 0
  @last_report = nil
  @time = Array.new(32, Time.at(0))
  super
end

Instance Attribute Details

#last_reportObject

Returns the value of attribute last_report.



39
40
41
# File 'lib/sgs/alarm.rb', line 39

def last_report
  @last_report
end

#timeObject

Returns the value of attribute time.



39
40
41
# File 'lib/sgs/alarm.rb', line 39

def time
  @time
end

Instance Method Details

#name(alarmno) ⇒ Object

Convert an alarm number into a string.



99
100
101
# File 'lib/sgs/alarm.rb', line 99

def name(alarmno)
  ALARM_NAMES[alarmno]
end