green-button-data 0.1.1 → 0.1.2
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 +8 -8
- data/green-button-data.gemspec +2 -1
- data/lib/green-button-data.rb +19 -0
- data/lib/green-button-data/enumerations.rb +0 -519
- data/lib/green-button-data/enumerations/accumulation.rb +17 -0
- data/lib/green-button-data/enumerations/authorization_status.rb +9 -0
- data/lib/green-button-data/enumerations/commodity.rb +32 -0
- data/lib/green-button-data/enumerations/currency.rb +20 -0
- data/lib/green-button-data/enumerations/data_custodian_application_status.rb +10 -0
- data/lib/green-button-data/enumerations/data_qualifier.rb +21 -0
- data/lib/green-button-data/enumerations/espi_service_status.rb +8 -0
- data/lib/green-button-data/enumerations/flow_direction.rb +27 -0
- data/lib/green-button-data/enumerations/measurement.rb +130 -0
- data/lib/green-button-data/enumerations/phase_code.rb +32 -0
- data/lib/green-button-data/enumerations/quality_of_reading.rb +20 -0
- data/lib/green-button-data/enumerations/service.rb +16 -0
- data/lib/green-button-data/enumerations/third_party_application_status.rb +10 -0
- data/lib/green-button-data/enumerations/third_party_application_type.rb +10 -0
- data/lib/green-button-data/enumerations/third_party_application_use.rb +11 -0
- data/lib/green-button-data/enumerations/time_attribute.rb +47 -0
- data/lib/green-button-data/enumerations/time_period_of_interest.rb +13 -0
- data/lib/green-button-data/enumerations/unit_multiplier.rb +18 -0
- data/lib/green-button-data/enumerations/unit_symbol.rb +126 -0
- data/lib/green-button-data/parser/entry.rb +2 -2
- data/lib/green-button-data/version.rb +1 -1
- data/spec/green-button-data/parser/entry_spec.rb +57 -0
- metadata +23 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ODczNTdmMmExNjNlZjYxZjA0NzI4ZGNiN2U5N2Q2ZjU2OGFmNmI3Zg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MWI1MWQ5Yzk2NmNlNGNhMDhhZDk4N2NlZjNkYjcyODAyMmQ5NWFkYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzgyZjNiOGE2M2UwZmRiNjk5ZWFjZmI4ZWRmNTE2YmQ2MTBjOWM4NzJmMWJh
|
10
|
+
MmZjMjJiMjg3OGYzYjhkZDAyMjM3MjA1NWE4NGE0ZjkyNjA4NDU5MDU0MTkz
|
11
|
+
NzlkNDIxYWQwNTU2YTVmMmVlOWMwYjViMjkwNmMyY2ViYjVkMTc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YzM3OGEwNGM4NTNlMDE3YzFkZGY1YWZhMjQ1N2U5ODVjYjEzNzgwYzc0N2U5
|
14
|
+
YTY1MGY4NzMzYjdmN2ViYzNmNTA2ZjNiYTc2ZGQ5Yzc1OGNlMzc1OTQzNTI5
|
15
|
+
Mzg0ZTE0OGZiZmQ4ZjlkMDgyNDVjNThiNmZiNzg2MDI5ZDFjNTA=
|
data/green-button-data.gemspec
CHANGED
@@ -15,7 +15,8 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.files = `git ls-files`.split("\n")
|
16
16
|
s.require_paths = ['lib']
|
17
17
|
|
18
|
-
s.platform
|
18
|
+
s.platform = Gem::Platform::RUBY
|
19
|
+
s.required_ruby_version = '>= 1.9.3'
|
19
20
|
|
20
21
|
s.add_dependency 'nokogiri', '~> 1.6'
|
21
22
|
s.add_dependency 'sax-machine', '~> 1.3'
|
data/lib/green-button-data.rb
CHANGED
@@ -3,6 +3,25 @@ require 'sax-machine'
|
|
3
3
|
require 'green-button-data/core_ext'
|
4
4
|
require 'green-button-data/dst'
|
5
5
|
require 'green-button-data/enumerations'
|
6
|
+
require 'green-button-data/enumerations/accumulation'
|
7
|
+
require 'green-button-data/enumerations/authorization_status'
|
8
|
+
require 'green-button-data/enumerations/commodity'
|
9
|
+
require 'green-button-data/enumerations/currency'
|
10
|
+
require 'green-button-data/enumerations/data_custodian_application_status'
|
11
|
+
require 'green-button-data/enumerations/data_qualifier'
|
12
|
+
require 'green-button-data/enumerations/espi_service_status'
|
13
|
+
require 'green-button-data/enumerations/flow_direction'
|
14
|
+
require 'green-button-data/enumerations/measurement'
|
15
|
+
require 'green-button-data/enumerations/phase_code'
|
16
|
+
require 'green-button-data/enumerations/quality_of_reading'
|
17
|
+
require 'green-button-data/enumerations/service'
|
18
|
+
require 'green-button-data/enumerations/third_party_application_status'
|
19
|
+
require 'green-button-data/enumerations/third_party_application_type'
|
20
|
+
require 'green-button-data/enumerations/third_party_application_use'
|
21
|
+
require 'green-button-data/enumerations/time_attribute'
|
22
|
+
require 'green-button-data/enumerations/time_period_of_interest'
|
23
|
+
require 'green-button-data/enumerations/unit_multiplier'
|
24
|
+
require 'green-button-data/enumerations/unit_symbol'
|
6
25
|
require 'green-button-data/utilities'
|
7
26
|
require 'green-button-data/parser'
|
8
27
|
require 'green-button-data/parser/rational_number'
|
@@ -1,523 +1,4 @@
|
|
1
1
|
module GreenButtonData
|
2
2
|
module Enumerations
|
3
|
-
ACCUMULATION = {
|
4
|
-
0 => :none,
|
5
|
-
1 => :bulk_quantity,
|
6
|
-
2 => :continuous_cumulative,
|
7
|
-
3 => :cumulative,
|
8
|
-
4 => :delta_data,
|
9
|
-
6 => :indicating,
|
10
|
-
9 => :summation,
|
11
|
-
10 => :time_delay,
|
12
|
-
12 => :instantaneous,
|
13
|
-
13 => :latching_quantity,
|
14
|
-
14 => :bounded_quantity
|
15
|
-
}
|
16
|
-
|
17
|
-
AUTHORIZATION_STATUS = {
|
18
|
-
0 => :revoked,
|
19
|
-
1 => :active,
|
20
|
-
2 => :denied
|
21
|
-
}
|
22
|
-
|
23
|
-
COMMODITY = {
|
24
|
-
0 => :none, # NA
|
25
|
-
1 => :electricity_secondary_metered, # Secondary electricity meter
|
26
|
-
2 => :electricity_primary_metered, # Primary electricity meter
|
27
|
-
3 => :communication, # A measurement of the communication infrastructure itself
|
28
|
-
4 => :air, # Air
|
29
|
-
5 => :insulative_gas, # SF6 is found below (ID: 22)
|
30
|
-
6 => :insulative_oil, # Oil for insulation
|
31
|
-
7 => :natural_gas, # Natural gas (LNG)
|
32
|
-
8 => :propane, # Propane gas (LPG)
|
33
|
-
9 => :potable_water, # Drinkable water (drinking fountains)
|
34
|
-
10 => :steam, # Water in steam form; usually for heating
|
35
|
-
11 => :waste_water, # Sewerage
|
36
|
-
12 => :heating_fluid, # Fluid for heating in liquid form
|
37
|
-
13 => :cooling_fluid, # Cooling fluid; returns warmer than sent
|
38
|
-
14 => :nonpotable_water, # Reclaimed water
|
39
|
-
15 => :nox, # Nitrous Oxides
|
40
|
-
16 => :so2, # Sulfur Dioxide SO₂
|
41
|
-
17 => :ch4, # Methane CH₄
|
42
|
-
18 => :co2, # Carbon Dioxide CO₂
|
43
|
-
19 => :carbon, # Carbon
|
44
|
-
20 => :hch, # Hexachlorocyclohexane HCH
|
45
|
-
21 => :pfc, # Perfluorocarbons PFC
|
46
|
-
22 => :sf6, # Sulfurhexafluoride SF₆
|
47
|
-
23 => :tv_license, # Television
|
48
|
-
24 => :internet, # Internet service
|
49
|
-
25 => :refuse # Trash
|
50
|
-
}
|
51
|
-
|
52
|
-
CURRENCY = {
|
53
|
-
0 => :other,
|
54
|
-
36 => :aud,
|
55
|
-
124 => :cad,
|
56
|
-
156 => :cny,
|
57
|
-
208 => :dkk,
|
58
|
-
356 => :inr,
|
59
|
-
392 => :jpy,
|
60
|
-
578 => :nok,
|
61
|
-
643 => :rub,
|
62
|
-
752 => :sek,
|
63
|
-
756 => :chf,
|
64
|
-
826 => :gbp,
|
65
|
-
840 => :usd,
|
66
|
-
978 => :eur
|
67
|
-
}
|
68
|
-
|
69
|
-
DATA_CUSTODIAN_APPLICATION_STATUS = {
|
70
|
-
1 => :review,
|
71
|
-
2 => :production,
|
72
|
-
3 => :on_hold,
|
73
|
-
4 => :revoked
|
74
|
-
}
|
75
|
-
|
76
|
-
DATA_QUALIFIER = {
|
77
|
-
0 => :none,
|
78
|
-
2 => :average,
|
79
|
-
4 => :excess,
|
80
|
-
5 => :high_threshold,
|
81
|
-
7 => :low_threshold,
|
82
|
-
8 => :maximum,
|
83
|
-
9 => :minimum,
|
84
|
-
11 => :nominal,
|
85
|
-
12 => :normal,
|
86
|
-
16 => :second_maximum,
|
87
|
-
17 => :second_minimum,
|
88
|
-
23 => :third_maximum,
|
89
|
-
24 => :fourth_maximum,
|
90
|
-
25 => :fifth_maximum,
|
91
|
-
26 => :sum
|
92
|
-
}
|
93
|
-
|
94
|
-
ESPI_SERVICE_STATUS = {
|
95
|
-
0 => :unavailable,
|
96
|
-
1 => :normal
|
97
|
-
}
|
98
|
-
|
99
|
-
FLOW_DIRECTION = {
|
100
|
-
0 => :none,
|
101
|
-
1 => :forward,
|
102
|
-
2 => :lagging,
|
103
|
-
3 => :leading,
|
104
|
-
4 => :net,
|
105
|
-
5 => :q1plus_q2,
|
106
|
-
7 => :q1plus_q3,
|
107
|
-
8 => :q1plus_q4,
|
108
|
-
9 => :q1minus_q4,
|
109
|
-
10 => :q2plus_q3,
|
110
|
-
11 => :q2plus_q4,
|
111
|
-
12 => :q2minus_q3,
|
112
|
-
13 => :q3plus_q4,
|
113
|
-
14 => :q3minus_q2,
|
114
|
-
15 => :quadrant1,
|
115
|
-
16 => :quadrant2,
|
116
|
-
17 => :quadrant3,
|
117
|
-
18 => :quadrant4,
|
118
|
-
19 => :reverse,
|
119
|
-
20 => :total,
|
120
|
-
21 => :total_by_phase
|
121
|
-
}
|
122
|
-
|
123
|
-
MEASUREMENT = {
|
124
|
-
0 => :none,
|
125
|
-
2 => :apparent_power_factor,
|
126
|
-
3 => :currency,
|
127
|
-
4 => :current,
|
128
|
-
5 => :current_angle,
|
129
|
-
6 => :current_imbalance,
|
130
|
-
7 => :date,
|
131
|
-
8 => :demand,
|
132
|
-
9 => :distance,
|
133
|
-
10 => :distortion_volt_amperes,
|
134
|
-
11 => :energization,
|
135
|
-
12 => :energy,
|
136
|
-
13 => :energization_load_side,
|
137
|
-
14 => :fan,
|
138
|
-
15 => :frequency,
|
139
|
-
16 => :funds,
|
140
|
-
17 => :ieee1366asai,
|
141
|
-
18 => :ieee1366asidi,
|
142
|
-
19 => :ieee1366asifi,
|
143
|
-
20 => :ieee1366caidi,
|
144
|
-
21 => :ieee1366caifi,
|
145
|
-
22 => :ieee1366cemin,
|
146
|
-
23 => :ieee1366cemsmin,
|
147
|
-
24 => :ieee1366ctaidi,
|
148
|
-
25 => :ieee1366maifi,
|
149
|
-
26 => :ieee1366maifie,
|
150
|
-
27 => :ieee1366saidi,
|
151
|
-
28 => :ieee1366saifi,
|
152
|
-
31 => :line_losses,
|
153
|
-
32 => :losses,
|
154
|
-
33 => :negative_sequence,
|
155
|
-
34 => :phasor_power_factor,
|
156
|
-
35 => :phasor_reactive_power,
|
157
|
-
36 => :positive_sequence,
|
158
|
-
37 => :power,
|
159
|
-
38 => :power_factor,
|
160
|
-
40 => :quantity_power,
|
161
|
-
41 => :sag,
|
162
|
-
42 => :swell,
|
163
|
-
43 => :switch_position,
|
164
|
-
44 => :tap_position,
|
165
|
-
45 => :tariff_rate,
|
166
|
-
46 => :temperature,
|
167
|
-
47 => :total_harmonic_distortion,
|
168
|
-
48 => :transformer_losses,
|
169
|
-
49 => :unipede_voltage_dip_10_to_15,
|
170
|
-
50 => :unipede_voltage_dip_15_to_30,
|
171
|
-
51 => :unipede_voltage_dip_30_to_60,
|
172
|
-
52 => :unipede_voltage_dip_60_to_90,
|
173
|
-
53 => :unipede_voltage_dip_90_to_100,
|
174
|
-
54 => :voltage,
|
175
|
-
55 => :voltage_angle,
|
176
|
-
56 => :voltage_excursion,
|
177
|
-
57 => :voltage_imbalance,
|
178
|
-
58 => :volume,
|
179
|
-
59 => :zero_flow_duration,
|
180
|
-
60 => :zero_sequence,
|
181
|
-
64 => :distortion_power_factor,
|
182
|
-
81 => :frequency_excursion,
|
183
|
-
90 => :application_context,
|
184
|
-
91 => :ap_title,
|
185
|
-
92 => :asset_number,
|
186
|
-
93 => :bandwidth,
|
187
|
-
94 => :battery_voltage,
|
188
|
-
95 => :broadcast_address,
|
189
|
-
96 => :device_address_type_1,
|
190
|
-
97 => :device_address_type_2,
|
191
|
-
98 => :device_address_type_3,
|
192
|
-
99 => :device_address_type_4,
|
193
|
-
100 => :device_class,
|
194
|
-
101 => :electronic_serial_number,
|
195
|
-
102 => :end_device_id,
|
196
|
-
103 => :group_address_type_1,
|
197
|
-
104 => :group_address_type_2,
|
198
|
-
105 => :group_address_type_3,
|
199
|
-
106 => :group_address_type_4,
|
200
|
-
107 => :ip_address,
|
201
|
-
108 => :mac_address,
|
202
|
-
109 => :mfg_assigned_configuration_id,
|
203
|
-
110 => :mfg_assigned_physical_serial_number,
|
204
|
-
111 => :mfg_assigned_product_number,
|
205
|
-
112 => :mfg_assigned_unique_communication_address,
|
206
|
-
113 => :multi_cast_address,
|
207
|
-
114 => :one_way_address,
|
208
|
-
115 => :signal_strength,
|
209
|
-
116 => :two_way_address,
|
210
|
-
117 => :signal_to_noise_ratio,
|
211
|
-
118 => :alarm,
|
212
|
-
119 => :battery_carry_over,
|
213
|
-
120 => :data_overflow_alarm,
|
214
|
-
121 => :demand_limit,
|
215
|
-
122 => :demand_reset,
|
216
|
-
123 => :diagnostic,
|
217
|
-
124 => :emergency_limit,
|
218
|
-
125 => :encoder_tamper,
|
219
|
-
126 => :ieee1366_momentary_interruption,
|
220
|
-
127 => :ieee1366_momentary_interruption_event,
|
221
|
-
128 => :ieee1366_sustained_interruption,
|
222
|
-
129 => :interruption_behaviour,
|
223
|
-
130 => :inversion_tamper,
|
224
|
-
131 => :load_interrupt,
|
225
|
-
132 => :load_shed,
|
226
|
-
133 => :maintenance,
|
227
|
-
134 => :physical_tamper,
|
228
|
-
135 => :power_loss_tamper,
|
229
|
-
136 => :power_outage,
|
230
|
-
137 => :power_quality,
|
231
|
-
138 => :power_restoration,
|
232
|
-
139 => :programmed,
|
233
|
-
140 => :push_button,
|
234
|
-
141 => :relay_activation,
|
235
|
-
142 => :relay_cycle,
|
236
|
-
143 => :removal_tamper,
|
237
|
-
144 => :reprogramming_tamper,
|
238
|
-
145 => :reverse_rotation_tamper,
|
239
|
-
146 => :switch_armed,
|
240
|
-
147 => :switch_disabled,
|
241
|
-
148 => :tamper,
|
242
|
-
150 => :bill_last_period,
|
243
|
-
151 => :bill_to_date,
|
244
|
-
152 => :bill_carryover,
|
245
|
-
153 => :connection_fee,
|
246
|
-
154 => :audible_volume,
|
247
|
-
155 => :volumetric_flow
|
248
|
-
}
|
249
|
-
|
250
|
-
QUALITY_OF_READING = {
|
251
|
-
0 => :valid,
|
252
|
-
7 => :manually_edited,
|
253
|
-
8 => :estimated_using_reference_day,
|
254
|
-
9 => :estimated_using_linear_interpolation,
|
255
|
-
10 => :questionable,
|
256
|
-
11 => :derived,
|
257
|
-
12 => :projected_forecast,
|
258
|
-
13 => :mixed,
|
259
|
-
14 => :raw,
|
260
|
-
15 => :normalized_for_weather,
|
261
|
-
16 => :other,
|
262
|
-
17 => :validated,
|
263
|
-
18 => :verified,
|
264
|
-
19 => :revenue_quality
|
265
|
-
}
|
266
|
-
|
267
|
-
PHASE_CODE = {
|
268
|
-
0 => :none,
|
269
|
-
16 => :n,
|
270
|
-
17 => :n_g,
|
271
|
-
32 => :c,
|
272
|
-
33 => :c_n,
|
273
|
-
40 => :c_av,
|
274
|
-
41 => :ca_n,
|
275
|
-
64 => :b,
|
276
|
-
65 => :b_n,
|
277
|
-
66 => :b_c,
|
278
|
-
72 => :b_av,
|
279
|
-
97 => :b_c_n, # TODO: Check with GB XML schema maintainers? https://github.com/energyos/OpenESPI-Common-java/blob/master/etc/espiDerived.xsd
|
280
|
-
97 => :a_c_n,
|
281
|
-
128 => :a,
|
282
|
-
129 => :a_n,
|
283
|
-
132 => :a_b,
|
284
|
-
136 => :a_to_av,
|
285
|
-
193 => :a_b_n,
|
286
|
-
224 => :a_b_c,
|
287
|
-
225 => :a_b_c_n,
|
288
|
-
272 => :s2_n,
|
289
|
-
512 => :s1,
|
290
|
-
528 => :s1_n,
|
291
|
-
768 => :s1_2,
|
292
|
-
769 => :s12_n,
|
293
|
-
784 => :s1_2_n
|
294
|
-
}
|
295
|
-
|
296
|
-
SERVICE = {
|
297
|
-
0 => :electricity,
|
298
|
-
1 => :gas,
|
299
|
-
2 => :water,
|
300
|
-
3 => :time,
|
301
|
-
4 => :heat,
|
302
|
-
5 => :refuse,
|
303
|
-
6 => :sewerage,
|
304
|
-
7 => :rates,
|
305
|
-
8 => :tv_license,
|
306
|
-
9 => :internet
|
307
|
-
}
|
308
|
-
|
309
|
-
THIRD_PARTY_APPLICATION_STATUS = {
|
310
|
-
1 => :development,
|
311
|
-
2 => :review_test,
|
312
|
-
3 => :production,
|
313
|
-
4 => :retired
|
314
|
-
}
|
315
|
-
|
316
|
-
THIRD_PARTY_APPLICATION_TYPE = {
|
317
|
-
1 => :web,
|
318
|
-
2 => :desktop,
|
319
|
-
3 => :mobile,
|
320
|
-
4 => :device
|
321
|
-
}
|
322
|
-
|
323
|
-
THIRD_PARTY_APPLICATION_USE = {
|
324
|
-
1 => :energy_management,
|
325
|
-
2 => :comparisons,
|
326
|
-
3 => :government,
|
327
|
-
4 => :academic,
|
328
|
-
5 => :law_enforcement
|
329
|
-
}
|
330
|
-
|
331
|
-
TIME_ATTRIBUTE = {
|
332
|
-
0 => :none,
|
333
|
-
1 => :ten_minute,
|
334
|
-
2 => :fifteen_minute,
|
335
|
-
3 => :one_minute,
|
336
|
-
4 => :twenty_four_hour,
|
337
|
-
5 => :thirty_minute,
|
338
|
-
6 => :five_minute,
|
339
|
-
7 => :sixty_minute,
|
340
|
-
10 => :two_minute,
|
341
|
-
14 => :three_minute,
|
342
|
-
15 => :present,
|
343
|
-
16 => :previous,
|
344
|
-
31 => :twenty_minute,
|
345
|
-
50 => :fixed_block_60_min,
|
346
|
-
51 => :fixed_block_30_min,
|
347
|
-
52 => :fixed_block_20_min,
|
348
|
-
53 => :fixed_block_15_min,
|
349
|
-
54 => :fixed_block_10_min,
|
350
|
-
55 => :fixed_block_5_min,
|
351
|
-
56 => :fixed_block_1_min,
|
352
|
-
57 => :rolling_block_60_min_interval_30_min_sub_interval,
|
353
|
-
58 => :rolling_block_60_min_interval_20_min_sub_interval,
|
354
|
-
59 => :rolling_block_60_min_interval_15_min_sub_interval,
|
355
|
-
60 => :rolling_block_60_min_interval_12_min_sub_interval,
|
356
|
-
61 => :rolling_block_60_min_interval_10_min_sub_interval,
|
357
|
-
62 => :rolling_block_60_min_interval_6_min_sub_interval,
|
358
|
-
63 => :rolling_block_60_min_interval_5_min_sub_interval,
|
359
|
-
64 => :rolling_block_60_min_interval_4_min_sub_interval,
|
360
|
-
65 => :rolling_block_30_min_interval_15_min_sub_interval,
|
361
|
-
66 => :rolling_block_30_min_interval_10_min_sub_interval,
|
362
|
-
67 => :rolling_block_30_min_interval_6_min_sub_interval,
|
363
|
-
68 => :rolling_block_30_min_interval_5_min_sub_interval,
|
364
|
-
69 => :rolling_block_30_min_interval_3_min_sub_interval,
|
365
|
-
70 => :rolling_block_30_min_interval_2_min_sub_interval,
|
366
|
-
71 => :rolling_block_15_min_interval_5_min_sub_interval,
|
367
|
-
72 => :rolling_block_15_min_interval_3_min_sub_interval,
|
368
|
-
73 => :rolling_block_15_min_interval_1_min_sub_interval,
|
369
|
-
74 => :rolling_block_10_min_interval_5_min_sub_interval,
|
370
|
-
75 => :rolling_block_10_min_interval_2_min_sub_interval,
|
371
|
-
76 => :rolling_block_10_min_interval_1_min_sub_interval,
|
372
|
-
77 => :rolling_block_5_min_interval_1_min_sub_interval
|
373
|
-
}
|
374
|
-
|
375
|
-
TIME_PERIOD_OF_INTEREST = {
|
376
|
-
0 => :none,
|
377
|
-
8 => :billing_period,
|
378
|
-
11 => :daily,
|
379
|
-
13 => :monthly,
|
380
|
-
22 => :seasonal,
|
381
|
-
24 => :weekly,
|
382
|
-
32 => :specified_period
|
383
|
-
}
|
384
|
-
|
385
|
-
UNIT_MULTIPLIER = {
|
386
|
-
-12 => :p, # Pico: 10^-12
|
387
|
-
-9 => :n, # Nano: 10^-9
|
388
|
-
-6 => :micro, # Micro: 10^-6
|
389
|
-
-3 => :m, # Milli: 10^-3
|
390
|
-
-1 => :d, # Deci: 10^-1
|
391
|
-
0 => :none, # N/A
|
392
|
-
1 => :da, # Deca: 10^1
|
393
|
-
2 => :h, # Hecto: 10^2
|
394
|
-
3 => :k, # Kilo: 10^3
|
395
|
-
6 => :M, # Mega: 10^6
|
396
|
-
9 => :G, # Giga: 10^9
|
397
|
-
12 => :T, # Tera: 10^12
|
398
|
-
}
|
399
|
-
|
400
|
-
UNIT_SYMBOL = {
|
401
|
-
0 => :none,
|
402
|
-
2 => :m,
|
403
|
-
3 => :g,
|
404
|
-
4 => :rev_per_sec,
|
405
|
-
5 => :A,
|
406
|
-
6 => :K,
|
407
|
-
7 => :mol,
|
408
|
-
8 => :cd,
|
409
|
-
9 => :deg,
|
410
|
-
10 => :rad,
|
411
|
-
11 => :sr,
|
412
|
-
21 => :gy,
|
413
|
-
22 => :bq,
|
414
|
-
23 => :deg_C,
|
415
|
-
24 => :sv,
|
416
|
-
25 => :F,
|
417
|
-
27 => :sec,
|
418
|
-
28 => :H,
|
419
|
-
29 => :V,
|
420
|
-
30 => :ohm,
|
421
|
-
31 => :J,
|
422
|
-
33 => :Hz,
|
423
|
-
34 => :lx,
|
424
|
-
35 => :lm,
|
425
|
-
36 => :wb,
|
426
|
-
37 => :t,
|
427
|
-
38 => :W,
|
428
|
-
41 => :m2,
|
429
|
-
42 => :m3,
|
430
|
-
43 => :m_per_sec,
|
431
|
-
44 => :m_per_sec2,
|
432
|
-
45 => :m3_per_sec,
|
433
|
-
46 => :m_per_m3,
|
434
|
-
47 => :kg_m,
|
435
|
-
48 => :kg_per_m3,
|
436
|
-
49 => :m2_per_sec,
|
437
|
-
50 => :w_per_mK,
|
438
|
-
51 => :J_per_kg,
|
439
|
-
53 => :siemens,
|
440
|
-
54 => :rad_per_sec,
|
441
|
-
61 => :VA,
|
442
|
-
63 => :VAr,
|
443
|
-
66 => :Vs,
|
444
|
-
67 => :V2,
|
445
|
-
68 => :As,
|
446
|
-
69 => :A2,
|
447
|
-
70 => :A2s,
|
448
|
-
71 => :VAh,
|
449
|
-
72 => :Wh,
|
450
|
-
74 => :V_per_Hz,
|
451
|
-
75 => :Hz_per_sec,
|
452
|
-
76 => :char,
|
453
|
-
77 => :char_per_sec,
|
454
|
-
78 => :gM2,
|
455
|
-
79 => :b,
|
456
|
-
80 => :money,
|
457
|
-
81 => :W_per_sec,
|
458
|
-
82 => :litre_per_sec,
|
459
|
-
100 => :q,
|
460
|
-
101 => :qh,
|
461
|
-
102 => :ohm_m,
|
462
|
-
103 => :A_per_m,
|
463
|
-
104 => :V2h,
|
464
|
-
105 => :A2h,
|
465
|
-
106 => :Ah,
|
466
|
-
107 => :Wh_per_m3,
|
467
|
-
108 => :time_stamp,
|
468
|
-
109 => :status,
|
469
|
-
111 => :count,
|
470
|
-
113 => :bm,
|
471
|
-
114 => :code,
|
472
|
-
115 => :Wh_per_rev,
|
473
|
-
116 => :VArh_per_rev,
|
474
|
-
117 => :VAh_per_rev,
|
475
|
-
118 => :me_code,
|
476
|
-
119 => :ft3,
|
477
|
-
120 => :ft3_compensated,
|
478
|
-
123 => :ft3_compensated_per_h,
|
479
|
-
125 => :m3_per_h,
|
480
|
-
126 => :m3_compensated_per_h,
|
481
|
-
127 => :m3_uncompensated_per_h,
|
482
|
-
128 => :us_gal,
|
483
|
-
129 => :us_gal_per_h,
|
484
|
-
130 => :imperial_gal,
|
485
|
-
131 => :imperial_gal_per_h,
|
486
|
-
132 => :btu,
|
487
|
-
133 => :btu_per_h,
|
488
|
-
134 => :litre,
|
489
|
-
137 => :litre_per_h,
|
490
|
-
138 => :litre_compensated_per_h,
|
491
|
-
139 => :litre_uncompensated_per_h,
|
492
|
-
140 => :paG,
|
493
|
-
141 => :psiA,
|
494
|
-
142 => :psiG,
|
495
|
-
143 => :litre_per_litre,
|
496
|
-
144 => :g_per_G,
|
497
|
-
145 => :mol_per_m3,
|
498
|
-
146 => :mol_per_mol,
|
499
|
-
147 => :mol_per_kg,
|
500
|
-
148 => :m_per_m,
|
501
|
-
149 => :sec_per_sec,
|
502
|
-
150 => :Hz_per_Hz,
|
503
|
-
151 => :V_per_V,
|
504
|
-
152 => :A_per_A,
|
505
|
-
153 => :W_per_VA,
|
506
|
-
154 => :rev,
|
507
|
-
155 => :paA,
|
508
|
-
156 => :litre_uncompensated,
|
509
|
-
157 => :litre_compensated,
|
510
|
-
158 => :kat,
|
511
|
-
159 => :min,
|
512
|
-
160 => :h,
|
513
|
-
161 => :q45,
|
514
|
-
162 => :q60,
|
515
|
-
163 => :q45h,
|
516
|
-
164 => :q60h,
|
517
|
-
166 => :m3_uncompensated,
|
518
|
-
167 => :m3_compensated,
|
519
|
-
168 => :W_per_W,
|
520
|
-
169 => :them
|
521
|
-
}
|
522
3
|
end
|
523
4
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module GreenButtonData
|
2
|
+
module Enumerations
|
3
|
+
ACCUMULATION = {
|
4
|
+
0 => :none,
|
5
|
+
1 => :bulk_quantity,
|
6
|
+
2 => :continuous_cumulative,
|
7
|
+
3 => :cumulative,
|
8
|
+
4 => :delta_data,
|
9
|
+
6 => :indicating,
|
10
|
+
9 => :summation,
|
11
|
+
10 => :time_delay,
|
12
|
+
12 => :instantaneous,
|
13
|
+
13 => :latching_quantity,
|
14
|
+
14 => :bounded_quantity
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module GreenButtonData
|
2
|
+
module Enumerations
|
3
|
+
COMMODITY = {
|
4
|
+
0 => :none, # NA
|
5
|
+
1 => :electricity_secondary_metered, # Secondary electricity meter
|
6
|
+
2 => :electricity_primary_metered, # Primary electricity meter
|
7
|
+
3 => :communication, # A measurement of the communication infrastructure itself
|
8
|
+
4 => :air, # Air
|
9
|
+
5 => :insulative_gas, # SF6 is found below (ID: 22)
|
10
|
+
6 => :insulative_oil, # Oil for insulation
|
11
|
+
7 => :natural_gas, # Natural gas (LNG)
|
12
|
+
8 => :propane, # Propane gas (LPG)
|
13
|
+
9 => :potable_water, # Drinkable water (drinking fountains)
|
14
|
+
10 => :steam, # Water in steam form; usually for heating
|
15
|
+
11 => :waste_water, # Sewerage
|
16
|
+
12 => :heating_fluid, # Fluid for heating in liquid form
|
17
|
+
13 => :cooling_fluid, # Cooling fluid; returns warmer than sent
|
18
|
+
14 => :nonpotable_water, # Reclaimed water
|
19
|
+
15 => :nox, # Nitrous Oxides
|
20
|
+
16 => :so2, # Sulfur Dioxide SO₂
|
21
|
+
17 => :ch4, # Methane CH₄
|
22
|
+
18 => :co2, # Carbon Dioxide CO₂
|
23
|
+
19 => :carbon, # Carbon
|
24
|
+
20 => :hch, # Hexachlorocyclohexane HCH
|
25
|
+
21 => :pfc, # Perfluorocarbons PFC
|
26
|
+
22 => :sf6, # Sulfurhexafluoride SF₆
|
27
|
+
23 => :tv_license, # Television
|
28
|
+
24 => :internet, # Internet service
|
29
|
+
25 => :refuse # Trash
|
30
|
+
}
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module GreenButtonData
|
2
|
+
module Enumerations
|
3
|
+
CURRENCY = {
|
4
|
+
0 => :other,
|
5
|
+
36 => :aud,
|
6
|
+
124 => :cad,
|
7
|
+
156 => :cny,
|
8
|
+
208 => :dkk,
|
9
|
+
356 => :inr,
|
10
|
+
392 => :jpy,
|
11
|
+
578 => :nok,
|
12
|
+
643 => :rub,
|
13
|
+
752 => :sek,
|
14
|
+
756 => :chf,
|
15
|
+
826 => :gbp,
|
16
|
+
840 => :usd,
|
17
|
+
978 => :eur
|
18
|
+
}
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module GreenButtonData
|
2
|
+
module Enumerations
|
3
|
+
DATA_QUALIFIER = {
|
4
|
+
0 => :none,
|
5
|
+
2 => :average,
|
6
|
+
4 => :excess,
|
7
|
+
5 => :high_threshold,
|
8
|
+
7 => :low_threshold,
|
9
|
+
8 => :maximum,
|
10
|
+
9 => :minimum,
|
11
|
+
11 => :nominal,
|
12
|
+
12 => :normal,
|
13
|
+
16 => :second_maximum,
|
14
|
+
17 => :second_minimum,
|
15
|
+
23 => :third_maximum,
|
16
|
+
24 => :fourth_maximum,
|
17
|
+
25 => :fifth_maximum,
|
18
|
+
26 => :sum
|
19
|
+
}
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module GreenButtonData
|
2
|
+
module Enumerations
|
3
|
+
FLOW_DIRECTION = {
|
4
|
+
0 => :none,
|
5
|
+
1 => :forward,
|
6
|
+
2 => :lagging,
|
7
|
+
3 => :leading,
|
8
|
+
4 => :net,
|
9
|
+
5 => :q1plus_q2,
|
10
|
+
7 => :q1plus_q3,
|
11
|
+
8 => :q1plus_q4,
|
12
|
+
9 => :q1minus_q4,
|
13
|
+
10 => :q2plus_q3,
|
14
|
+
11 => :q2plus_q4,
|
15
|
+
12 => :q2minus_q3,
|
16
|
+
13 => :q3plus_q4,
|
17
|
+
14 => :q3minus_q2,
|
18
|
+
15 => :quadrant1,
|
19
|
+
16 => :quadrant2,
|
20
|
+
17 => :quadrant3,
|
21
|
+
18 => :quadrant4,
|
22
|
+
19 => :reverse,
|
23
|
+
20 => :total,
|
24
|
+
21 => :total_by_phase
|
25
|
+
}
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
module GreenButtonData
|
2
|
+
module Enumerations
|
3
|
+
MEASUREMENT = {
|
4
|
+
0 => :none,
|
5
|
+
2 => :apparent_power_factor,
|
6
|
+
3 => :currency,
|
7
|
+
4 => :current,
|
8
|
+
5 => :current_angle,
|
9
|
+
6 => :current_imbalance,
|
10
|
+
7 => :date,
|
11
|
+
8 => :demand,
|
12
|
+
9 => :distance,
|
13
|
+
10 => :distortion_volt_amperes,
|
14
|
+
11 => :energization,
|
15
|
+
12 => :energy,
|
16
|
+
13 => :energization_load_side,
|
17
|
+
14 => :fan,
|
18
|
+
15 => :frequency,
|
19
|
+
16 => :funds,
|
20
|
+
17 => :ieee1366asai,
|
21
|
+
18 => :ieee1366asidi,
|
22
|
+
19 => :ieee1366asifi,
|
23
|
+
20 => :ieee1366caidi,
|
24
|
+
21 => :ieee1366caifi,
|
25
|
+
22 => :ieee1366cemin,
|
26
|
+
23 => :ieee1366cemsmin,
|
27
|
+
24 => :ieee1366ctaidi,
|
28
|
+
25 => :ieee1366maifi,
|
29
|
+
26 => :ieee1366maifie,
|
30
|
+
27 => :ieee1366saidi,
|
31
|
+
28 => :ieee1366saifi,
|
32
|
+
31 => :line_losses,
|
33
|
+
32 => :losses,
|
34
|
+
33 => :negative_sequence,
|
35
|
+
34 => :phasor_power_factor,
|
36
|
+
35 => :phasor_reactive_power,
|
37
|
+
36 => :positive_sequence,
|
38
|
+
37 => :power,
|
39
|
+
38 => :power_factor,
|
40
|
+
40 => :quantity_power,
|
41
|
+
41 => :sag,
|
42
|
+
42 => :swell,
|
43
|
+
43 => :switch_position,
|
44
|
+
44 => :tap_position,
|
45
|
+
45 => :tariff_rate,
|
46
|
+
46 => :temperature,
|
47
|
+
47 => :total_harmonic_distortion,
|
48
|
+
48 => :transformer_losses,
|
49
|
+
49 => :unipede_voltage_dip_10_to_15,
|
50
|
+
50 => :unipede_voltage_dip_15_to_30,
|
51
|
+
51 => :unipede_voltage_dip_30_to_60,
|
52
|
+
52 => :unipede_voltage_dip_60_to_90,
|
53
|
+
53 => :unipede_voltage_dip_90_to_100,
|
54
|
+
54 => :voltage,
|
55
|
+
55 => :voltage_angle,
|
56
|
+
56 => :voltage_excursion,
|
57
|
+
57 => :voltage_imbalance,
|
58
|
+
58 => :volume,
|
59
|
+
59 => :zero_flow_duration,
|
60
|
+
60 => :zero_sequence,
|
61
|
+
64 => :distortion_power_factor,
|
62
|
+
81 => :frequency_excursion,
|
63
|
+
90 => :application_context,
|
64
|
+
91 => :ap_title,
|
65
|
+
92 => :asset_number,
|
66
|
+
93 => :bandwidth,
|
67
|
+
94 => :battery_voltage,
|
68
|
+
95 => :broadcast_address,
|
69
|
+
96 => :device_address_type_1,
|
70
|
+
97 => :device_address_type_2,
|
71
|
+
98 => :device_address_type_3,
|
72
|
+
99 => :device_address_type_4,
|
73
|
+
100 => :device_class,
|
74
|
+
101 => :electronic_serial_number,
|
75
|
+
102 => :end_device_id,
|
76
|
+
103 => :group_address_type_1,
|
77
|
+
104 => :group_address_type_2,
|
78
|
+
105 => :group_address_type_3,
|
79
|
+
106 => :group_address_type_4,
|
80
|
+
107 => :ip_address,
|
81
|
+
108 => :mac_address,
|
82
|
+
109 => :mfg_assigned_configuration_id,
|
83
|
+
110 => :mfg_assigned_physical_serial_number,
|
84
|
+
111 => :mfg_assigned_product_number,
|
85
|
+
112 => :mfg_assigned_unique_communication_address,
|
86
|
+
113 => :multi_cast_address,
|
87
|
+
114 => :one_way_address,
|
88
|
+
115 => :signal_strength,
|
89
|
+
116 => :two_way_address,
|
90
|
+
117 => :signal_to_noise_ratio,
|
91
|
+
118 => :alarm,
|
92
|
+
119 => :battery_carry_over,
|
93
|
+
120 => :data_overflow_alarm,
|
94
|
+
121 => :demand_limit,
|
95
|
+
122 => :demand_reset,
|
96
|
+
123 => :diagnostic,
|
97
|
+
124 => :emergency_limit,
|
98
|
+
125 => :encoder_tamper,
|
99
|
+
126 => :ieee1366_momentary_interruption,
|
100
|
+
127 => :ieee1366_momentary_interruption_event,
|
101
|
+
128 => :ieee1366_sustained_interruption,
|
102
|
+
129 => :interruption_behaviour,
|
103
|
+
130 => :inversion_tamper,
|
104
|
+
131 => :load_interrupt,
|
105
|
+
132 => :load_shed,
|
106
|
+
133 => :maintenance,
|
107
|
+
134 => :physical_tamper,
|
108
|
+
135 => :power_loss_tamper,
|
109
|
+
136 => :power_outage,
|
110
|
+
137 => :power_quality,
|
111
|
+
138 => :power_restoration,
|
112
|
+
139 => :programmed,
|
113
|
+
140 => :push_button,
|
114
|
+
141 => :relay_activation,
|
115
|
+
142 => :relay_cycle,
|
116
|
+
143 => :removal_tamper,
|
117
|
+
144 => :reprogramming_tamper,
|
118
|
+
145 => :reverse_rotation_tamper,
|
119
|
+
146 => :switch_armed,
|
120
|
+
147 => :switch_disabled,
|
121
|
+
148 => :tamper,
|
122
|
+
150 => :bill_last_period,
|
123
|
+
151 => :bill_to_date,
|
124
|
+
152 => :bill_carryover,
|
125
|
+
153 => :connection_fee,
|
126
|
+
154 => :audible_volume,
|
127
|
+
155 => :volumetric_flow
|
128
|
+
}
|
129
|
+
end
|
130
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module GreenButtonData
|
2
|
+
module Enumerations
|
3
|
+
PHASE_CODE = {
|
4
|
+
0 => :none,
|
5
|
+
16 => :n,
|
6
|
+
17 => :n_g,
|
7
|
+
32 => :c,
|
8
|
+
33 => :c_n,
|
9
|
+
40 => :c_av,
|
10
|
+
41 => :ca_n,
|
11
|
+
64 => :b,
|
12
|
+
65 => :b_n,
|
13
|
+
66 => :b_c,
|
14
|
+
72 => :b_av,
|
15
|
+
97 => :b_c_n, # TODO: Check with GB XML schema maintainers? https://github.com/energyos/OpenESPI-Common-java/blob/master/etc/espiDerived.xsd
|
16
|
+
97 => :a_c_n,
|
17
|
+
128 => :a,
|
18
|
+
129 => :a_n,
|
19
|
+
132 => :a_b,
|
20
|
+
136 => :a_to_av,
|
21
|
+
193 => :a_b_n,
|
22
|
+
224 => :a_b_c,
|
23
|
+
225 => :a_b_c_n,
|
24
|
+
272 => :s2_n,
|
25
|
+
512 => :s1,
|
26
|
+
528 => :s1_n,
|
27
|
+
768 => :s1_2,
|
28
|
+
769 => :s12_n,
|
29
|
+
784 => :s1_2_n
|
30
|
+
}
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module GreenButtonData
|
2
|
+
module Enumerations
|
3
|
+
QUALITY_OF_READING = {
|
4
|
+
0 => :valid,
|
5
|
+
7 => :manually_edited,
|
6
|
+
8 => :estimated_using_reference_day,
|
7
|
+
9 => :estimated_using_linear_interpolation,
|
8
|
+
10 => :questionable,
|
9
|
+
11 => :derived,
|
10
|
+
12 => :projected_forecast,
|
11
|
+
13 => :mixed,
|
12
|
+
14 => :raw,
|
13
|
+
15 => :normalized_for_weather,
|
14
|
+
16 => :other,
|
15
|
+
17 => :validated,
|
16
|
+
18 => :verified,
|
17
|
+
19 => :revenue_quality
|
18
|
+
}
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module GreenButtonData
|
2
|
+
module Enumerations
|
3
|
+
TIME_ATTRIBUTE = {
|
4
|
+
0 => :none,
|
5
|
+
1 => :ten_minute,
|
6
|
+
2 => :fifteen_minute,
|
7
|
+
3 => :one_minute,
|
8
|
+
4 => :twenty_four_hour,
|
9
|
+
5 => :thirty_minute,
|
10
|
+
6 => :five_minute,
|
11
|
+
7 => :sixty_minute,
|
12
|
+
10 => :two_minute,
|
13
|
+
14 => :three_minute,
|
14
|
+
15 => :present,
|
15
|
+
16 => :previous,
|
16
|
+
31 => :twenty_minute,
|
17
|
+
50 => :fixed_block_60_min,
|
18
|
+
51 => :fixed_block_30_min,
|
19
|
+
52 => :fixed_block_20_min,
|
20
|
+
53 => :fixed_block_15_min,
|
21
|
+
54 => :fixed_block_10_min,
|
22
|
+
55 => :fixed_block_5_min,
|
23
|
+
56 => :fixed_block_1_min,
|
24
|
+
57 => :rolling_block_60_min_interval_30_min_sub_interval,
|
25
|
+
58 => :rolling_block_60_min_interval_20_min_sub_interval,
|
26
|
+
59 => :rolling_block_60_min_interval_15_min_sub_interval,
|
27
|
+
60 => :rolling_block_60_min_interval_12_min_sub_interval,
|
28
|
+
61 => :rolling_block_60_min_interval_10_min_sub_interval,
|
29
|
+
62 => :rolling_block_60_min_interval_6_min_sub_interval,
|
30
|
+
63 => :rolling_block_60_min_interval_5_min_sub_interval,
|
31
|
+
64 => :rolling_block_60_min_interval_4_min_sub_interval,
|
32
|
+
65 => :rolling_block_30_min_interval_15_min_sub_interval,
|
33
|
+
66 => :rolling_block_30_min_interval_10_min_sub_interval,
|
34
|
+
67 => :rolling_block_30_min_interval_6_min_sub_interval,
|
35
|
+
68 => :rolling_block_30_min_interval_5_min_sub_interval,
|
36
|
+
69 => :rolling_block_30_min_interval_3_min_sub_interval,
|
37
|
+
70 => :rolling_block_30_min_interval_2_min_sub_interval,
|
38
|
+
71 => :rolling_block_15_min_interval_5_min_sub_interval,
|
39
|
+
72 => :rolling_block_15_min_interval_3_min_sub_interval,
|
40
|
+
73 => :rolling_block_15_min_interval_1_min_sub_interval,
|
41
|
+
74 => :rolling_block_10_min_interval_5_min_sub_interval,
|
42
|
+
75 => :rolling_block_10_min_interval_2_min_sub_interval,
|
43
|
+
76 => :rolling_block_10_min_interval_1_min_sub_interval,
|
44
|
+
77 => :rolling_block_5_min_interval_1_min_sub_interval
|
45
|
+
}
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module GreenButtonData
|
2
|
+
module Enumerations
|
3
|
+
UNIT_MULTIPLIER = {
|
4
|
+
-12 => :p, # Pico: 10^-12
|
5
|
+
-9 => :n, # Nano: 10^-9
|
6
|
+
-6 => :micro, # Micro: 10^-6
|
7
|
+
-3 => :m, # Milli: 10^-3
|
8
|
+
-1 => :d, # Deci: 10^-1
|
9
|
+
0 => :none, # N/A
|
10
|
+
1 => :da, # Deca: 10^1
|
11
|
+
2 => :h, # Hecto: 10^2
|
12
|
+
3 => :k, # Kilo: 10^3
|
13
|
+
6 => :M, # Mega: 10^6
|
14
|
+
9 => :G, # Giga: 10^9
|
15
|
+
12 => :T, # Tera: 10^12
|
16
|
+
}
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
module GreenButtonData
|
2
|
+
module Enumerations
|
3
|
+
UNIT_SYMBOL = {
|
4
|
+
0 => :none,
|
5
|
+
2 => :m,
|
6
|
+
3 => :g,
|
7
|
+
4 => :rev_per_sec,
|
8
|
+
5 => :A,
|
9
|
+
6 => :K,
|
10
|
+
7 => :mol,
|
11
|
+
8 => :cd,
|
12
|
+
9 => :deg,
|
13
|
+
10 => :rad,
|
14
|
+
11 => :sr,
|
15
|
+
21 => :gy,
|
16
|
+
22 => :bq,
|
17
|
+
23 => :deg_C,
|
18
|
+
24 => :sv,
|
19
|
+
25 => :F,
|
20
|
+
27 => :sec,
|
21
|
+
28 => :H,
|
22
|
+
29 => :V,
|
23
|
+
30 => :ohm,
|
24
|
+
31 => :J,
|
25
|
+
33 => :Hz,
|
26
|
+
34 => :lx,
|
27
|
+
35 => :lm,
|
28
|
+
36 => :wb,
|
29
|
+
37 => :t,
|
30
|
+
38 => :W,
|
31
|
+
41 => :m2,
|
32
|
+
42 => :m3,
|
33
|
+
43 => :m_per_sec,
|
34
|
+
44 => :m_per_sec2,
|
35
|
+
45 => :m3_per_sec,
|
36
|
+
46 => :m_per_m3,
|
37
|
+
47 => :kg_m,
|
38
|
+
48 => :kg_per_m3,
|
39
|
+
49 => :m2_per_sec,
|
40
|
+
50 => :w_per_mK,
|
41
|
+
51 => :J_per_kg,
|
42
|
+
53 => :siemens,
|
43
|
+
54 => :rad_per_sec,
|
44
|
+
61 => :VA,
|
45
|
+
63 => :VAr,
|
46
|
+
66 => :Vs,
|
47
|
+
67 => :V2,
|
48
|
+
68 => :As,
|
49
|
+
69 => :A2,
|
50
|
+
70 => :A2s,
|
51
|
+
71 => :VAh,
|
52
|
+
72 => :Wh,
|
53
|
+
74 => :V_per_Hz,
|
54
|
+
75 => :Hz_per_sec,
|
55
|
+
76 => :char,
|
56
|
+
77 => :char_per_sec,
|
57
|
+
78 => :gM2,
|
58
|
+
79 => :b,
|
59
|
+
80 => :money,
|
60
|
+
81 => :W_per_sec,
|
61
|
+
82 => :litre_per_sec,
|
62
|
+
100 => :q,
|
63
|
+
101 => :qh,
|
64
|
+
102 => :ohm_m,
|
65
|
+
103 => :A_per_m,
|
66
|
+
104 => :V2h,
|
67
|
+
105 => :A2h,
|
68
|
+
106 => :Ah,
|
69
|
+
107 => :Wh_per_m3,
|
70
|
+
108 => :time_stamp,
|
71
|
+
109 => :status,
|
72
|
+
111 => :count,
|
73
|
+
113 => :bm,
|
74
|
+
114 => :code,
|
75
|
+
115 => :Wh_per_rev,
|
76
|
+
116 => :VArh_per_rev,
|
77
|
+
117 => :VAh_per_rev,
|
78
|
+
118 => :me_code,
|
79
|
+
119 => :ft3,
|
80
|
+
120 => :ft3_compensated,
|
81
|
+
123 => :ft3_compensated_per_h,
|
82
|
+
125 => :m3_per_h,
|
83
|
+
126 => :m3_compensated_per_h,
|
84
|
+
127 => :m3_uncompensated_per_h,
|
85
|
+
128 => :us_gal,
|
86
|
+
129 => :us_gal_per_h,
|
87
|
+
130 => :imperial_gal,
|
88
|
+
131 => :imperial_gal_per_h,
|
89
|
+
132 => :btu,
|
90
|
+
133 => :btu_per_h,
|
91
|
+
134 => :litre,
|
92
|
+
137 => :litre_per_h,
|
93
|
+
138 => :litre_compensated_per_h,
|
94
|
+
139 => :litre_uncompensated_per_h,
|
95
|
+
140 => :paG,
|
96
|
+
141 => :psiA,
|
97
|
+
142 => :psiG,
|
98
|
+
143 => :litre_per_litre,
|
99
|
+
144 => :g_per_G,
|
100
|
+
145 => :mol_per_m3,
|
101
|
+
146 => :mol_per_mol,
|
102
|
+
147 => :mol_per_kg,
|
103
|
+
148 => :m_per_m,
|
104
|
+
149 => :sec_per_sec,
|
105
|
+
150 => :Hz_per_Hz,
|
106
|
+
151 => :V_per_V,
|
107
|
+
152 => :A_per_A,
|
108
|
+
153 => :W_per_VA,
|
109
|
+
154 => :rev,
|
110
|
+
155 => :paA,
|
111
|
+
156 => :litre_uncompensated,
|
112
|
+
157 => :litre_compensated,
|
113
|
+
158 => :kat,
|
114
|
+
159 => :min,
|
115
|
+
160 => :h,
|
116
|
+
161 => :q45,
|
117
|
+
162 => :q60,
|
118
|
+
163 => :q45h,
|
119
|
+
164 => :q60h,
|
120
|
+
166 => :m3_uncompensated,
|
121
|
+
167 => :m3_compensated,
|
122
|
+
168 => :W_per_W,
|
123
|
+
169 => :them
|
124
|
+
}
|
125
|
+
end
|
126
|
+
end
|
@@ -12,7 +12,7 @@ module GreenButtonData
|
|
12
12
|
|
13
13
|
element :link, as: :up, value: :href, with: { rel: 'up' }
|
14
14
|
element :link, as: :self, value: :href, with: { rel: 'self' }
|
15
|
-
|
15
|
+
elements :link, as: :related, value: :href, with: { rel: 'related' }
|
16
16
|
|
17
17
|
element :content, class: Content, as: :content
|
18
18
|
|
@@ -38,7 +38,7 @@ module GreenButtonData
|
|
38
38
|
element :'ns1:id', as: :entry_id
|
39
39
|
element :'ns1:link', as: :up, value: :href, with: { rel: 'up' }
|
40
40
|
element :'ns1:link', as: :self, value: :href, with: { rel: 'self' }
|
41
|
-
|
41
|
+
elements :'ns1:link', as: :related, value: :href, with: { rel: 'related' }
|
42
42
|
element :'ns1:content', class: Content, as: :content
|
43
43
|
element :'ns1:published', as: :published
|
44
44
|
element :'ns1:updated', as: :updated
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe GreenButtonData::Parser::Entry do
|
4
|
+
context "no namespace" do
|
5
|
+
let(:feed) { GreenButtonData::Feed }
|
6
|
+
let :entries do
|
7
|
+
feed.parse(espi_usage_point)
|
8
|
+
.entries
|
9
|
+
end
|
10
|
+
|
11
|
+
subject { entries.first }
|
12
|
+
|
13
|
+
it "should parse id" do
|
14
|
+
expect(subject.id).to eq "urn:uuid:c8c34b3a-d175-447b-bd00-176f60194de0"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should parse up" do
|
18
|
+
expect(subject.up).to eq "https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/Subscription/5/UsagePoint"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should parse self" do
|
22
|
+
expect(subject.self).to eq "https://services.greenbuttondata.org//DataCustodian/espi/1_1/resource/Subscription/5/UsagePoint/1"
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should parse related" do
|
26
|
+
expect(subject.related.size).to eq 3
|
27
|
+
expect(subject.related).to all be_a String
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context "PG&E namespace" do
|
32
|
+
let(:feed) { GreenButtonData::Feed }
|
33
|
+
let :entries do
|
34
|
+
feed.parse(pge_usage_point)
|
35
|
+
.entries
|
36
|
+
end
|
37
|
+
|
38
|
+
subject { entries.first }
|
39
|
+
|
40
|
+
it "should parse id" do
|
41
|
+
expect(subject.id).to eq "00000000-0000-0000-0000-000000000002"
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should parse up" do
|
45
|
+
expect(subject.up).to eq "https://api.pge.com/GreenButtonConnect/espi/1_1/resource/Subscription/0/UsagePoint"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should parse self" do
|
49
|
+
expect(subject.self).to eq "https://api.pge.com/GreenButtonConnect/espi/1_1/resource/Subscription/0/UsagePoint/1"
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should parse related" do
|
53
|
+
expect(subject.related.size).to eq 3
|
54
|
+
expect(subject.related).to all be_a String
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: green-button-data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Jo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -86,6 +86,25 @@ files:
|
|
86
86
|
- lib/green-button-data/core_ext/fixnum.rb
|
87
87
|
- lib/green-button-data/dst.rb
|
88
88
|
- lib/green-button-data/enumerations.rb
|
89
|
+
- lib/green-button-data/enumerations/accumulation.rb
|
90
|
+
- lib/green-button-data/enumerations/authorization_status.rb
|
91
|
+
- lib/green-button-data/enumerations/commodity.rb
|
92
|
+
- lib/green-button-data/enumerations/currency.rb
|
93
|
+
- lib/green-button-data/enumerations/data_custodian_application_status.rb
|
94
|
+
- lib/green-button-data/enumerations/data_qualifier.rb
|
95
|
+
- lib/green-button-data/enumerations/espi_service_status.rb
|
96
|
+
- lib/green-button-data/enumerations/flow_direction.rb
|
97
|
+
- lib/green-button-data/enumerations/measurement.rb
|
98
|
+
- lib/green-button-data/enumerations/phase_code.rb
|
99
|
+
- lib/green-button-data/enumerations/quality_of_reading.rb
|
100
|
+
- lib/green-button-data/enumerations/service.rb
|
101
|
+
- lib/green-button-data/enumerations/third_party_application_status.rb
|
102
|
+
- lib/green-button-data/enumerations/third_party_application_type.rb
|
103
|
+
- lib/green-button-data/enumerations/third_party_application_use.rb
|
104
|
+
- lib/green-button-data/enumerations/time_attribute.rb
|
105
|
+
- lib/green-button-data/enumerations/time_period_of_interest.rb
|
106
|
+
- lib/green-button-data/enumerations/unit_multiplier.rb
|
107
|
+
- lib/green-button-data/enumerations/unit_symbol.rb
|
89
108
|
- lib/green-button-data/feed.rb
|
90
109
|
- lib/green-button-data/parser.rb
|
91
110
|
- lib/green-button-data/parser/application_information.rb
|
@@ -120,6 +139,7 @@ files:
|
|
120
139
|
- spec/green-button-data/core_ext/fixnum_spec.rb
|
121
140
|
- spec/green-button-data/parser/application_information_spec.rb
|
122
141
|
- spec/green-button-data/parser/authorization_spec.rb
|
142
|
+
- spec/green-button-data/parser/entry_spec.rb
|
123
143
|
- spec/green-button-data/parser/interval_block_spec.rb
|
124
144
|
- spec/green-button-data/parser/local_time_parameter_spec.rb
|
125
145
|
- spec/green-button-data/parser/reading_type_spec.rb
|
@@ -139,7 +159,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
139
159
|
requirements:
|
140
160
|
- - ! '>='
|
141
161
|
- !ruby/object:Gem::Version
|
142
|
-
version:
|
162
|
+
version: 1.9.3
|
143
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
164
|
requirements:
|
145
165
|
- - ! '>='
|