ekm-omnimeter 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +66 -35
- data/lib/ekm-omnimeter/meter.rb +12 -11
- data/lib/ekm-omnimeter/version.rb +1 -1
- 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: 956b201ecc8c116268db81bb760d33d6f8a1fc64
|
4
|
+
data.tar.gz: b7ad7042d5e54af49457484ac419a9036727136f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9746afa0fcbad02f08d06f82c316ee90793396afe7c8a8088d6042ed33780711e1d31d6a6469bbb9ac1c53ff6178cefc4455bddd64dbf6358e1b0ec72e2e61fa
|
7
|
+
data.tar.gz: c5cbd6cbd05c2fe74caed67c2a64a2e69c4c098d5fa490d671821dca18db0a7623b1f76504b7d9566ab9a1e3d7a93ff207ebf36facf506594f77f15a887f65a7
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -49,44 +49,75 @@ m = EkmOmnimeter::Meter.new(
|
|
49
49
|
:remote_address=>'192.168.1.125', # The IP address of your iSerial device
|
50
50
|
:remote_port => 50000) # The port on which your iSerial device is listening
|
51
51
|
|
52
|
-
#
|
52
|
+
# These values change based on the value of :power_configuration in the constructor
|
53
|
+
m.volts # 248.7
|
54
|
+
m.amps # 21.6
|
55
|
+
m.watts # 2664
|
56
|
+
|
57
|
+
# Warning: Dates seem off
|
58
|
+
# My computer clock said 2014-04-03 3:32PM when these outputs came out
|
59
|
+
m.meter_timestamp # 2014-04-03 05:15:32
|
60
|
+
m.computer_timestamp # Time.now() = 2014-04-03 15:32:10 -0400
|
61
|
+
|
62
|
+
# Read meter values
|
53
63
|
m.remote_address # 192.168.1.125
|
54
64
|
m.remote_port # 50000
|
55
65
|
m.meter_number # 000300000001
|
56
|
-
m.address
|
57
|
-
m.
|
58
|
-
m.
|
59
|
-
m.
|
60
|
-
m.
|
61
|
-
m.
|
62
|
-
m.
|
63
|
-
m.
|
64
|
-
m.
|
65
|
-
m.
|
66
|
-
m.
|
67
|
-
m.
|
68
|
-
m.
|
69
|
-
m.
|
70
|
-
m.
|
71
|
-
m.
|
72
|
-
m.
|
73
|
-
m.
|
74
|
-
m.
|
75
|
-
m.
|
76
|
-
m.
|
77
|
-
m.
|
78
|
-
m.
|
79
|
-
m.
|
80
|
-
m.
|
81
|
-
m.
|
82
|
-
m.
|
83
|
-
m.
|
84
|
-
m.
|
85
|
-
m.
|
86
|
-
m.
|
87
|
-
m.
|
88
|
-
m.
|
89
|
-
m.
|
66
|
+
m.address # 000300000001
|
67
|
+
m.total_kwh # 4583.51
|
68
|
+
m.total_forward_kwh # 4507.610000000001
|
69
|
+
m.total_reverse_kwh # 75.9
|
70
|
+
m.net_kwh # 4431.710000000001
|
71
|
+
m.total_kwh_t1 # 2826.64
|
72
|
+
m.total_kwh_t2 # 1756.87
|
73
|
+
m.total_kwh_t3 # 0.0
|
74
|
+
m.total_kwh_t4 # 0.0
|
75
|
+
m.reverse_kwh_t1 # 47.93
|
76
|
+
m.reverse_kwh_t2 # 27.97
|
77
|
+
m.reverse_kwh_t3 # 0.0
|
78
|
+
m.reverse_kwh_t4 # 0.0
|
79
|
+
m.volts_l1 # 123.9
|
80
|
+
m.volts_l2 # 124.8
|
81
|
+
m.volts_l3 # 0.0
|
82
|
+
m.amps_l1 # 18.4
|
83
|
+
m.amps_l2 # 3.2
|
84
|
+
m.amps_l3 # 0.0
|
85
|
+
m.watts_l1 # 2276
|
86
|
+
m.watts_l2 # 384
|
87
|
+
m.watts_l3 # 0
|
88
|
+
m.watts_total # 2664
|
89
|
+
m.power_factor_1 # 1.0
|
90
|
+
m.power_factor_2 # 0.0
|
91
|
+
m.power_factor_3 # 0.0
|
92
|
+
m.maximum_demand # 226400
|
93
|
+
m.maximum_demand_period # 1
|
94
|
+
m.ct_ratio # 400
|
95
|
+
m.pulse_1_count # 3
|
96
|
+
m.pulse_1_ratio # 1000
|
97
|
+
m.pulse_2_count # 6
|
98
|
+
m.pulse_2_ratio # 3
|
99
|
+
m.pulse_3_count # 0
|
100
|
+
m.pulse_3_ratio # 1000
|
101
|
+
m.reactive_kwh_kvarh # 812.63
|
102
|
+
m.total_kwh_l1 # 2165.46
|
103
|
+
m.total_kwh_l2 # 2417.42
|
104
|
+
m.total_kwh_l3 # 0.0
|
105
|
+
m.reverse_kwh_l1 # 0.0
|
106
|
+
m.reverse_kwh_l2 # 75.9
|
107
|
+
m.reverse_kwh_l3 # 0.0
|
108
|
+
m.resettable_total_kwh # 4583.51
|
109
|
+
m.resettable_reverse_kwh # 75.9
|
110
|
+
m.reactive_power_1 # 24
|
111
|
+
m.reactive_power_2 # 60
|
112
|
+
m.reactive_power_3 # 0
|
113
|
+
m.total_reactive_power # 84
|
114
|
+
m.frequency # 60.04
|
115
|
+
m.pulse_input_hilo # 0
|
116
|
+
m.direction_of_current # 1
|
117
|
+
m.outputs_onoff # 1
|
118
|
+
m.kwh_data_decimal_places # 2
|
119
|
+
m.auto_reset_max_demand # 0
|
120
|
+
m.settable_pulse_per_kwh_ratio # 800
|
90
121
|
|
91
122
|
|
92
123
|
```
|
data/lib/ekm-omnimeter/meter.rb
CHANGED
@@ -41,7 +41,7 @@ module EkmOmnimeter
|
|
41
41
|
|
42
42
|
# Collect the power configurations
|
43
43
|
if VALID_POWER_CONFIGURATIONS.index(options[:power_configuration])
|
44
|
-
power_configuration = options[:power_configuration]
|
44
|
+
@power_configuration = options[:power_configuration]
|
45
45
|
else
|
46
46
|
raise EkmOmnimeterError, "Invalid power configuration #{options[:power_configuration]}. Valid values are #{VALID_POWER_CONFIGURATIONS.join(', ')}"
|
47
47
|
end
|
@@ -160,14 +160,15 @@ module EkmOmnimeter
|
|
160
160
|
|
161
161
|
# Returns the correct measurement for voltage, current, and power based on the corresponding power_configuration
|
162
162
|
def calculate_measurement(m1, m2, m3)
|
163
|
+
puts "****** #{power_configuration.inspect} #{m1}, #{m2}, #{m3}"
|
163
164
|
if power_configuration == :single_phase_2wire
|
164
|
-
|
165
|
+
m1
|
165
166
|
elsif power_configuration == :single_phase_3wire
|
166
|
-
(
|
167
|
+
(m1 + m2)
|
167
168
|
elsif power_configuration == :three_phase_3wire
|
168
|
-
(
|
169
|
+
(m1 + m3)
|
169
170
|
elsif power_configuration == :three_phase_4wire
|
170
|
-
(
|
171
|
+
(m1 + m2 + m3)
|
171
172
|
end
|
172
173
|
end
|
173
174
|
|
@@ -346,9 +347,9 @@ module EkmOmnimeter
|
|
346
347
|
|
347
348
|
# Calculate totals based on wiring configuration
|
348
349
|
@values[:meter_timestamp] = meter_timestamp
|
349
|
-
@values[:volts] = calculate_measurement(
|
350
|
-
@values[:amps] = calculate_measurement(
|
351
|
-
@values[:watts] = calculate_measurement(
|
350
|
+
@values[:volts] = calculate_measurement(volts_l1, volts_l2, volts_l3)
|
351
|
+
@values[:amps] = calculate_measurement(amps_l1, amps_l2, amps_l3)
|
352
|
+
@values[:watts] = calculate_measurement(watts_l1, watts_l2, watts_l3)
|
352
353
|
@values[:total_forward_kwh] = total_kwh - total_reverse_kwh
|
353
354
|
@values[:net_kwh] = total_forward_kwh - total_reverse_kwh
|
354
355
|
|
@@ -437,9 +438,9 @@ module EkmOmnimeter
|
|
437
438
|
|
438
439
|
# Calculate totals based on wiring configuration
|
439
440
|
@values[:meter_timestamp] = meter_timestamp
|
440
|
-
@values[:volts] = calculate_measurement(
|
441
|
-
@values[:amps] = calculate_measurement(
|
442
|
-
@values[:watts] = calculate_measurement(
|
441
|
+
@values[:volts] = calculate_measurement(volts_l1, volts_l2, volts_l3)
|
442
|
+
@values[:amps] = calculate_measurement(amps_l1, amps_l2, amps_l3)
|
443
|
+
@values[:watts] = calculate_measurement(watts_l1, watts_l2, watts_l3)
|
443
444
|
|
444
445
|
# Return the hash as an open struct
|
445
446
|
return d
|