axpert_rs232 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/axpert_commands.rb +16 -16
- data/lib/voltronic_device_operation.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60d70ae8b654af6e6c01075786760ae0bdeaa415
|
4
|
+
data.tar.gz: 1dc9b6d89cd66fccbdbc1aeb8803043df60486a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6378823b19402f22e0a0677fd96c3e000f88aca25102f60ab2dc46f1f7a57818b86b0ba85d6fc7fac348950ecb89dba30043bb6cf71eb423ae1db8164876d271
|
7
|
+
data.tar.gz: bf1209ae0f494ace81ea289287f680631220c3b53329bfa7ea642b8ce1278d42307879c8e7fc9f67fd43d9c0972b827ff36ecfc6538d3172e8eeee54a87bf8e1
|
data/lib/axpert_commands.rb
CHANGED
@@ -56,20 +56,20 @@ module AxpertCommands
|
|
56
56
|
# { grid_voltage: 230.5, grid_current: 11.2, .. }
|
57
57
|
DEVICE_RATING = OP.new(command: 'QPIRI', parser: lambda do |r|
|
58
58
|
r = r.data[1..-1].split(' ')
|
59
|
-
{
|
60
|
-
|
59
|
+
{ utility_voltage: Float(r[0]),
|
60
|
+
utility_current: Float(r[1]),
|
61
61
|
output_voltage: Float(r[2]),
|
62
62
|
output_frequency: Float(r[3]),
|
63
63
|
output_current: Float(r[4]),
|
64
64
|
output_va: Integer(r[5], 10),
|
65
65
|
output_watts: Integer(r[6], 10),
|
66
66
|
battery_voltage: Float(r[7]),
|
67
|
-
|
68
|
-
|
67
|
+
battery_bulk_charge_voltage: Float(r[8]),
|
68
|
+
battery_cutoff_voltage: Float(r[9]),
|
69
69
|
battery_bulk_charge_voltage: Float(r[10]),
|
70
70
|
battery_float_charge_voltage: Float(r[11]),
|
71
71
|
battery_type: ::AxpertConstants::BATTERY_TYPE[r[12]],
|
72
|
-
|
72
|
+
maximum_utility_charge_current: Integer(r[13], 10),
|
73
73
|
maximum_charge_current: Integer(r[14], 10),
|
74
74
|
input_voltage_sensitivity: CONS::INPUT_VOLTAGE_SENSITIVITY[r[15]],
|
75
75
|
output_source_priority: CONS::OUTPUT_SOURCE_PRIORITY[r[16]],
|
@@ -78,7 +78,7 @@ module AxpertCommands
|
|
78
78
|
device_type: CONS::DEVICE_TYPE[r[19]],
|
79
79
|
device_topology: CONS::DEVICE_TOPOLOGY[r[20]],
|
80
80
|
output_mode: CONS::OUTPUT_MODE[r[21]],
|
81
|
-
|
81
|
+
battery_float_charge_voltage: Float(r[22]),
|
82
82
|
pv_parallel_ok_mode: CONS::PV_PARALLEL_OK_MODE[r[23]],
|
83
83
|
pv_power_balance_mode: CONS::PV_POWER_BALANCE_MODE[r[24]] }
|
84
84
|
end)
|
@@ -115,8 +115,8 @@ module AxpertCommands
|
|
115
115
|
DEVICE_STATUS = OP.new(command: 'QPIGS', parser: lambda do |r|
|
116
116
|
r = r.data[1..-1].split(' ')
|
117
117
|
status = r[16].chars.map { |c| Boolean(c) }
|
118
|
-
{
|
119
|
-
|
118
|
+
{ utility_voltage: Float(r[0]),
|
119
|
+
utility_frequency: Float(r[1]),
|
120
120
|
output_voltage: Float(r[2]),
|
121
121
|
output_frequency: Float(r[3]),
|
122
122
|
output_va: Integer(r[4], 10),
|
@@ -126,7 +126,7 @@ module AxpertCommands
|
|
126
126
|
battery_voltage: Float(r[8]),
|
127
127
|
battery_charge_current: Float(r[9]),
|
128
128
|
battery_capacity_remaining: Integer(r[10], 10),
|
129
|
-
|
129
|
+
inverter_temperature_celsius: Integer(r[11], 10),
|
130
130
|
pv_battery_input_current: Integer(r[12], 10),
|
131
131
|
pv_input_voltage: Float(r[13]),
|
132
132
|
solar_charge_controller_battery_voltage: Float(r[14]),
|
@@ -166,7 +166,7 @@ module AxpertCommands
|
|
166
166
|
errors << parse.yield('Bus voltage is too high', :fault) if r[2]
|
167
167
|
errors << parse.yield('Bus voltage is too low', :fault) if r[3]
|
168
168
|
errors << parse.yield('Bus soft start failed ', :fault) if r[4]
|
169
|
-
errors << parse.yield('
|
169
|
+
errors << parse.yield('Utility input failure', :warning) if r[5]
|
170
170
|
errors << parse.yield('Output short circuited', :warning) if r[6]
|
171
171
|
errors << parse.yield('Inverter voltage too low', :fault) if r[7]
|
172
172
|
errors << parse.yield('Output voltage is too high', :fault) if r[8]
|
@@ -207,10 +207,10 @@ module AxpertCommands
|
|
207
207
|
{ output_voltage: Float(r[0]),
|
208
208
|
output_frequency: Float(r[1]),
|
209
209
|
maximum_ac_charge_current: Integer(r[2], 10),
|
210
|
-
|
210
|
+
battery_cutoff_voltage: Float(r[3]),
|
211
211
|
battery_float_charge_voltage: Float(r[4]),
|
212
212
|
battery_bulk_charge_voltage: Float(r[5]),
|
213
|
-
|
213
|
+
battery_bulk_charge_voltage: Float(r[6]),
|
214
214
|
maximum_charge_current: Integer(r[7], 10),
|
215
215
|
input_voltage_sensitivity: CONS::INPUT_VOLTAGE_SENSITIVITY[r[8]],
|
216
216
|
output_source_priority: CONS::OUTPUT_SOURCE_PRIORITY[r[9]],
|
@@ -226,7 +226,7 @@ module AxpertCommands
|
|
226
226
|
enable_bypass_to_utility_on_overload: Boolean(r[19]),
|
227
227
|
enable_lcd_timeout_escape_to_default_page: Boolean(r[20]),
|
228
228
|
output_mode: CONS::OUTPUT_MODE[r[21]],
|
229
|
-
|
229
|
+
battery_float_charge_voltage: Float(r[22]),
|
230
230
|
pv_parallel_ok_mode: CONS::PV_PARALLEL_OK_MODE[r[23]],
|
231
231
|
pv_power_balance_mode: CONS::PV_POWER_BALANCE_MODE[r[24]] }
|
232
232
|
end)
|
@@ -282,8 +282,8 @@ module AxpertCommands
|
|
282
282
|
serial_number: r[1],
|
283
283
|
device_mode: CONS::DEVICE_MODE[r[2]],
|
284
284
|
fault_code: CONS::FAULT_CODE[r[3]],
|
285
|
-
|
286
|
-
|
285
|
+
utility_voltage: Float(r[4]),
|
286
|
+
utility_frequency: Float(r[5]),
|
287
287
|
output_voltage: Float(r[6]),
|
288
288
|
output_frequency: Float(r[7]),
|
289
289
|
output_va: Integer(r[8], 10),
|
@@ -309,7 +309,7 @@ module AxpertCommands
|
|
309
309
|
maximum_charge_current: Integer(r[22], 10),
|
310
310
|
device_maximum_charge_current: Integer(r[23], 10),
|
311
311
|
pv_input_current: Integer(r[24], 10),
|
312
|
-
|
312
|
+
battery_redischarge_voltage: Integer(r[25], 10) }
|
313
313
|
end)
|
314
314
|
|
315
315
|
##
|
@@ -28,7 +28,7 @@ class VoltronicDeviceOperation
|
|
28
28
|
end
|
29
29
|
|
30
30
|
@read_timeout = Integer(input.fetch(:serial_read_timeout_seconds, 2))
|
31
|
-
@
|
31
|
+
@retry_timeout = Integer(input.fetch(:serial_retry_timeout_milliseconds, 50))
|
32
32
|
|
33
33
|
@termination_character = begin
|
34
34
|
parse = input.fetch(:serial_termination_character, "\r").to_s
|
@@ -51,8 +51,8 @@ class VoltronicDeviceOperation
|
|
51
51
|
while(true)
|
52
52
|
ch = serial.getc # Retrieve a single character from Serial port
|
53
53
|
if ch.nil?
|
54
|
-
raise ::IOError.new("
|
55
|
-
sleep 0
|
54
|
+
raise ::IOError.new("Read timeout reached on serial port, giving up") if (Time.now.to_i > read_timeout)
|
55
|
+
sleep (@retry_timeout/1000.0) # Pause before polling again
|
56
56
|
next
|
57
57
|
end
|
58
58
|
parse += ch
|