aemo 0.1.8 → 0.1.9
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/aemo.gemspec +1 -1
- data/lib/aemo/nem12.rb +44 -50
- data/lib/aemo/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: 339e83560f9d3cbf2dde96d4097b1cdd905b7299
|
|
4
|
+
data.tar.gz: 276afbdd7bc7a07948a54195ee7efe7fd187b940
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 710fcb76538f49718313d3b89d9930820dee43dfe70a5c8eebda6d67e41a232234ad43b0edcbdffe95c47fb2403872d9ec4e2ced6ea99c7a068ab4ea2adbb51e
|
|
7
|
+
data.tar.gz: 4fb67cf0b3611f6a7b4f82a1bdadf8824f1189d8ab490b6893675725640ed0ce2d442bb74b9449ce3b5839c318e8e5fd2dc789a3bb26024705f920081a8fdaeb
|
data/aemo.gemspec
CHANGED
data/lib/aemo/nem12.rb
CHANGED
|
@@ -87,36 +87,36 @@ module AEMO
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
METHOD_FLAGS = {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
90
|
+
11 => { type: ["SUB"], installation_type: [1,2,3,4], short_descriptor: "Check", description: "" },
|
|
91
|
+
12 => { type: ["SUB"], installation_type: [1,2,3,4], short_descriptor: "Calculated", description: "" },
|
|
92
|
+
13 => { type: ["SUB"], installation_type: [1,2,3,4], short_descriptor: "SCADA", description: "" },
|
|
93
|
+
14 => { type: ["SUB"], installation_type: [1,2,3,4], short_descriptor: "Like Day", description: "" },
|
|
94
|
+
15 => { type: ["SUB"], installation_type: [1,2,3,4], short_descriptor: "Average Like Day", description: "" },
|
|
95
|
+
16 => { type: ["SUB"], installation_type: [1,2,3,4], short_descriptor: "Agreed", description: "" },
|
|
96
|
+
17 => { type: ["SUB"], installation_type: [1,2,3,4], short_descriptor: "Linear", description: "" },
|
|
97
|
+
18 => { type: ["SUB"], installation_type: [1,2,3,4], short_descriptor: "Alternate", description: "" },
|
|
98
|
+
19 => { type: ["SUB"], installation_type: [1,2,3,4], short_descriptor: "Zero", description: "" },
|
|
99
|
+
51 => { type: ["EST","SUB"], installation_type: 5, short_descriptor: "Previous Year", description: "" },
|
|
100
|
+
52 => { type: ["EST","SUB"], installation_type: 5, short_descriptor: "Previous Read", description: "" },
|
|
101
|
+
53 => { type: ["SUB"], installation_type: 5, short_descriptor: "Revision", description: "" },
|
|
102
|
+
54 => { type: ["SUB"], installation_type: 5, short_descriptor: "Linear", description: "" },
|
|
103
|
+
55 => { type: ["SUB"], installation_type: 5, short_descriptor: "Agreed", description: "" },
|
|
104
|
+
56 => { type: ["EST","SUB"], installation_type: 5, short_descriptor: "Prior to First Read – Agreed", description: "" },
|
|
105
|
+
57 => { type: ["EST","SUB"], installation_type: 5, short_descriptor: "Customer Class", description: "" },
|
|
106
|
+
58 => { type: ["EST","SUB"], installation_type: 5, short_descriptor: "Zero", description: "" },
|
|
107
|
+
61 => { type: ["EST","SUB"], installation_type: 6, short_descriptor: "Previous Year", description: "" },
|
|
108
|
+
62 => { type: ["EST","SUB"], installation_type: 6, short_descriptor: "Previous Read", description: "" },
|
|
109
|
+
63 => { type: ["EST","SUB"], installation_type: 6, short_descriptor: "Customer Class", description: "" },
|
|
110
|
+
64 => { type: ["SUB"], installation_type: 6, short_descriptor: "Agreed", description: "" },
|
|
111
|
+
65 => { type: ["EST"], installation_type: 6, short_descriptor: "ADL", description: "" },
|
|
112
|
+
66 => { type: ["SUB"], installation_type: 6, short_descriptor: "Revision", description: "" },
|
|
113
|
+
67 => { type: ["SUB"], installation_type: 6, short_descriptor: "Customer Read", description: "" },
|
|
114
|
+
68 => { type: ["EST","SUB"], installation_type: 6, short_descriptor: "Zero", description: "" },
|
|
115
|
+
71 => { type: ["SUB"], installation_type: 7, short_descriptor: "Recalculation", description: "" },
|
|
116
|
+
72 => { type: ["SUB"], installation_type: 7, short_descriptor: "Revised Table", description: "" },
|
|
117
|
+
73 => { type: ["SUB"], installation_type: 7, short_descriptor: "Revised Algorithm", description: "" },
|
|
118
|
+
74 => { type: ["SUB"], installation_type: 7, short_descriptor: "Agreed", description: "" },
|
|
119
|
+
75 => { type: ["EST"], installation_type: 7, short_descriptor: "Existing Table", description: "" }
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
REASON_CODES = {
|
|
@@ -220,6 +220,7 @@ module AEMO
|
|
|
220
220
|
97 => 'Excluded Data',
|
|
221
221
|
98 => 'Parity Error',
|
|
222
222
|
99 => 'Energy Type (Register Changed)'
|
|
223
|
+
|
|
223
224
|
}
|
|
224
225
|
|
|
225
226
|
DATA_STREAM_SUFFIX = {
|
|
@@ -370,7 +371,7 @@ module AEMO
|
|
|
370
371
|
raise ArgumentError, 'QualityMethod does not have valid QualityFlag' unless QUALITY_FLAGS.keys.include?(csv[intervals_offset + 0][0])
|
|
371
372
|
unless %w(A N V).include?(csv[intervals_offset + 0][0])
|
|
372
373
|
raise ArgumentError, 'QualityMethod does not have valid length' unless csv[intervals_offset + 0].length == 3
|
|
373
|
-
raise ArgumentError, 'QualityMethod does not have valid MethodFlag' unless METHOD_FLAGS.keys.include?(csv[intervals_offset + 0][1..2])
|
|
374
|
+
raise ArgumentError, 'QualityMethod does not have valid MethodFlag' unless METHOD_FLAGS.keys.include?(csv[intervals_offset + 0][1..2].to_i)
|
|
374
375
|
end
|
|
375
376
|
unless %w(A N E).include?(csv[intervals_offset + 0][0])
|
|
376
377
|
raise ArgumentError, 'ReasonCode is not valid' unless REASON_CODES.keys.include?(csv[intervals_offset + 1].to_i)
|
|
@@ -392,10 +393,10 @@ module AEMO
|
|
|
392
393
|
flag ||= { quality_flag: nil, method_flag: nil, reason_code: nil }
|
|
393
394
|
if csv[intervals_offset + 0].length == 3
|
|
394
395
|
flag[:quality_flag] = csv[intervals_offset + 0][0]
|
|
395
|
-
flag[:method_flag] = csv[intervals_offset + 0][1,2]
|
|
396
|
+
flag[:method_flag] = csv[intervals_offset + 0][1,2].to_i
|
|
396
397
|
end
|
|
397
398
|
unless csv[intervals_offset + 1].nil?
|
|
398
|
-
flag[:reason_code] = csv[intervals_offset + 1]
|
|
399
|
+
flag[:reason_code] = csv[intervals_offset + 1].to_i
|
|
399
400
|
end
|
|
400
401
|
end
|
|
401
402
|
|
|
@@ -431,31 +432,24 @@ module AEMO
|
|
|
431
432
|
interval_start_point = @interval_data.length - number_of_intervals
|
|
432
433
|
|
|
433
434
|
# For each of these
|
|
434
|
-
base_interval_event = { datetime: nil, quality_method: csv[3], reason_code: csv[4], reason_description: csv[5] }
|
|
435
|
+
base_interval_event = { datetime: nil, quality_method: csv[3], reason_code: (csv[4].nil? ? nil : csv[4].to_i), reason_description: csv[5] }
|
|
435
436
|
|
|
436
437
|
# Interval Numbers are 1-indexed
|
|
437
438
|
((csv[1].to_i)..(csv[2].to_i)).each do |i|
|
|
438
439
|
interval_event = base_interval_event.dup
|
|
439
440
|
interval_event[:datetime] = @interval_data[interval_start_point + (i-1)][:datetime]
|
|
440
441
|
interval_events << interval_event
|
|
441
|
-
|
|
442
|
-
method_flag
|
|
443
|
-
unless
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
reason_code = nil
|
|
447
|
-
unless (reason_code = interval_event[:reason_code]).nil?
|
|
448
|
-
reason_code = REASON_CODES[reason_code.to_i]
|
|
442
|
+
# Create flag details
|
|
443
|
+
flag ||= { quality_flag: nil, method_flag: nil, reason_code: nil }
|
|
444
|
+
unless interval_event[:quality_method].nil?
|
|
445
|
+
flag[:quality_flag] = interval_event[:quality_method][0]
|
|
446
|
+
flag[:method_flag] = interval_event[:quality_method][1,2].to_i
|
|
449
447
|
end
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
when 'E'
|
|
453
|
-
@interval_data[interval_start_point + (i-1)][:flag] = ['Estimate',method_flag,reason_code].compact.join(' - ')
|
|
454
|
-
when 'F'
|
|
455
|
-
@interval_data[interval_start_point + (i-1)][:flag] = nil
|
|
456
|
-
when 'S'
|
|
457
|
-
@interval_data[interval_start_point + (i-1)][:flag] = ['Substitute',method_flag,reason_code].compact.join(' - ')
|
|
448
|
+
unless interval_event[:reason_code].nil?
|
|
449
|
+
flag[:reason_code] = interval_event[:reason_code]
|
|
458
450
|
end
|
|
451
|
+
# Update with flag details
|
|
452
|
+
@interval_data[interval_start_point + (i-1)][:flag] = flag
|
|
459
453
|
end
|
|
460
454
|
@interval_events += interval_events
|
|
461
455
|
end
|
data/lib/aemo/version.rb
CHANGED