Module: AxpertConstants
- Defined in:
- lib/axpert_constants.rb
Overview
A list of constants used by the Axpert devices with a convenient parser
@author: Johan van der Vyver
Defined Under Namespace
Classes: UnknownConstant
Constant Summary collapse
- BATTERY_TYPE =
The type of batteries connected to the device Used to determine the float, bulk charging, re-charge and re-discharge voltage ranges
:agm # => Absorbent Glass Mat (AGM) :flooded # => Flooded Cell :user # => User defined
lookup_hash('battery type', {'0' => :agm, '1' => :flooded, '2' => :user})
- DEVICE_MODE =
The current device mode
:power # => Power on :standby # => Standby :line # => Line :battery # => Battery :fault # => Fault
lookup_hash('device mode', {'P' => :power, 'S' => :standby, 'L' => :line, 'B' => :battery, 'F' => :fault})
- INPUT_VOLTAGE_SENSITIVITY =
The input voltage is monitored to determine if it is within an acceptable range The sensitivity determines when the unit switches output mode to/from Utility
:appliance # => Appliance mode sensitivity (see manual for ranges) :ups # => UPS mode sensitivity (see manual for ranges)
lookup_hash('input voltage sensitivity', {'0' => :appliance, '1' => :ups})
- OUTPUT_SOURCE_PRIORITY =
Device output priority
:utility # => Prefer utility as first output power source :solar # => Prefer solar as first output power source :sbu # => Prefer solar first, then battery and utility last as output power source
lookup_hash('output source priority', {'0' => :utility, '1' => :solar, '2' => :sbu})
- CHARGER_SOURCE_PRIORITY =
Battery charger source priority
:utility_first # => Charge batteries from utility first :solar:first # => Charge batteries from solar first, :solar_and_utility # => Charge batteries from solar & utility :solar_only # => Charge batteries from solar only
lookup_hash('charger source priority', {'0' => :utility_first, '1' => :solar_first, '2' => :solar_and_utility, '3' => :solar_only})
- DEVICE_TYPE =
The type of device
:grid_tie # => Grid tie device :off_grid # => Off-Grid device :hybrid # =>Hybrid device
lookup_hash('device type', {'00' => :grid_tie, '01' => :off_grid, '10' => :hybrid})
- DEVICE_TOPOLOGY =
The internal device topology NOTE: All models make use of a transformer in Inverter mode
:transformerless # => The device output does not pass through an isolation transformer :transformer # => The device output does pass through an isolation transformer
lookup_hash('device topology', {'0' => :transformerless, '1' => :transformer})
- OUTPUT_MODE =
The current output mode of the device
:single # => The device is running in single mode, single phase output :parallel # => The device is running in parallel mode (allow multiple units in parallel), single phase output :phase1 # => The device is running in parallel mode, 3 phase output, set to phase 1 of 3 :phase2 # => The device is running in parallel mode, 3 phase output, set to phase 2 of 3 :phase3 # => The device is running in parallel mode, 3 phase output, set to phase 3 of 3
lookup_hash('output mode', {'0' => :single, '1' => :parallel, '2' => :phase1, '3' => :phase2, '4' => :phase3})
- PV_PARALLEL_OK_MODE =
Only applicable to units running in Parallel! The required mode for the PV to report OK on the inverter in parallel mode
:one # => Only one unit needs to report PV is OK :all # => All units must report that PV is OK
lookup_hash('PV parallel mode', {'0' => :one, '1' => :all})
- PV_POWER_BALANCE_MODE =
The PV power balance mode setting
:charge # => PV output is limited to battery charge current :charge_and_load # => PV output will attempt to use enough power for charging the battery and enough to supply the connected load
lookup_hash('PV power balance mode', {'0' => :charge, '1' => :charge_and_load})
- FAULT_CODE =
Possible fault codes returned by the device
lookup_hash('fault code', { '00' => 'No faults', '01' => 'Fan is locked', '02' => 'Over temperature', '03' => 'Battery voltage is too high', '04' => 'Battery voltage is too low', '05' => 'Output short circuited/Over temperature', '06' => 'Output voltage is too high', '07' => 'Overload time out', '08' => 'Bus voltage is too high', '09' => 'Bus soft start failed', '11' => 'Main relay failed', '51' => 'Inverter over current', '52' => 'Bus soft start failed', '53' => 'Inverter soft start failed', '54' => 'Self-test failed', '55' => 'Inverter over voltage on DC output', '56' => 'Battery connection is open', '57' => 'Current sensor failed', '58' => 'Output voltage is too low', '60' => 'Inverter negative power', '71' => 'Parallel version different', '71' => 'Output circuit failed', '80' => 'CAN communication failed', '81' => 'Parallel host line lost', '82' => 'Parallel synchronized signal lost', '83' => 'Parallel battery voltage is detected as different', '84' => 'Parallel line voltage or frequency is detected as different', '85' => 'Parallel line input current unbalanced', '86' => 'Parallel output setting is different' })
Class Method Summary collapse
-
.lookup_hash(type, values) ⇒ Object
:nodoc:.
Class Method Details
.lookup_hash(type, values) ⇒ Object
:nodoc:
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/axpert_constants.rb', line 6 def self.lookup_hash(type, values) # :nodoc: type = type.to_s.strip.freeze values.values.each(&:freeze) lookup = Hash.new do |_, k| if lookup.has_key?(k.to_s) lookup[k.to_s] elsif (k.is_a?(Numeric) && (k.to_i == k) && (lookup.values.count > k)) lookup.values[k] elsif lookup.values.include?(k) k else raise ::AxpertConstants::UnknownConstant.new("Unknown #{type} '#{k}'") end end lookup.instance_eval <<-RUBY_CODE def key(input) # :nodoc: parse = super(self[input]) rescue nil parse = (super(input.to_s.to_sym) rescue nil) if parse.nil? parse = (super(input) rescue nil) if parse.nil? return parse unless parse.nil? raise ::AxpertConstants::UnknownConstant.new("Could not find the #{type} constant '\#{input}' in \#{self.values}") end RUBY_CODE lookup.merge!(values).freeze end |