aemo 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aemo/nem12.rb +35 -7
- data/lib/aemo/nmi/allocation.rb +1 -1
- data/lib/aemo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23bf34dda3b788053ddf01fcd40497dc7f06a8cff209d03dac214d45391d753e
|
4
|
+
data.tar.gz: 1128cc1092cfe865449d4781da7f730fb2b528898bf8e7030f38dca21ce0ce87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ba042960c1b4ce73347433c3814c20b8a36c6eba00c1c1ae8d250b8d9bf128cf360a5ec4f62fa61fdfa97836d6117f8ca24f524e27be131737e2ff07d6b4965
|
7
|
+
data.tar.gz: ab12814656e7a026ff59a945ee08308474fe91407a7516f863ff3ae765be37de100ebcc99a1a22c4fe3351fa91e8289e1bfed549c15afbf2d111ea7f569682ea
|
data/lib/aemo/nem12.rb
CHANGED
@@ -274,6 +274,8 @@ module AEMO
|
|
274
274
|
attr_accessor :file_contents, :header, :nmi_data_details, :nmi
|
275
275
|
|
276
276
|
# Initialize a NEM12 file
|
277
|
+
# @param [string] nmi
|
278
|
+
# @param [Hash] options
|
277
279
|
def initialize(nmi, options = {})
|
278
280
|
@nmi = AEMO::NMI.new(nmi) unless nmi.empty?
|
279
281
|
@data_details = []
|
@@ -291,6 +293,7 @@ module AEMO
|
|
291
293
|
|
292
294
|
# Parses the header record
|
293
295
|
# @param [String] line A single line in string format
|
296
|
+
# @param [Hash] options
|
294
297
|
# @return [Hash] the line parsed into a hash of information
|
295
298
|
def self.parse_nem12_100(line, options = {})
|
296
299
|
csv = line.parse_csv
|
@@ -312,6 +315,7 @@ module AEMO
|
|
312
315
|
|
313
316
|
# Parses the NMI Data Details
|
314
317
|
# @param [String] line A single line in string format
|
318
|
+
# @param [Hash] options
|
315
319
|
# @return [Hash] the line parsed into a hash of information
|
316
320
|
def parse_nem12_200(line, options = {})
|
317
321
|
csv = line.parse_csv
|
@@ -346,6 +350,7 @@ module AEMO
|
|
346
350
|
end
|
347
351
|
|
348
352
|
# @param [String] line A single line in string format
|
353
|
+
# @param [Hash] options
|
349
354
|
# @return [Array of hashes] the line parsed into a hash of information
|
350
355
|
def parse_nem12_300(line, options = {})
|
351
356
|
csv = line.parse_csv
|
@@ -380,7 +385,7 @@ module AEMO
|
|
380
385
|
if csv[intervals_offset + 3].match(/\d{14}/).nil? || csv[intervals_offset + 3] != Time.parse(csv[intervals_offset + 3].to_s).strftime('%Y%m%d%H%M%S')
|
381
386
|
raise ArgumentError, 'UpdateDateTime is not valid'
|
382
387
|
end
|
383
|
-
if !csv[intervals_offset + 4].
|
388
|
+
if !csv[intervals_offset + 4].blank? && csv[intervals_offset + 4].match(/\d{14}/).nil? || !csv[intervals_offset + 4].blank? && csv[intervals_offset + 4] != Time.parse(csv[intervals_offset + 4].to_s).strftime('%Y%m%d%H%M%S')
|
384
389
|
raise ArgumentError, 'MSATSLoadDateTime is not valid'
|
385
390
|
end
|
386
391
|
end
|
@@ -397,7 +402,23 @@ module AEMO
|
|
397
402
|
flag[:reason_code] = csv[intervals_offset + 1].to_i unless csv[intervals_offset + 1].nil?
|
398
403
|
end
|
399
404
|
|
400
|
-
|
405
|
+
# Deal with updated_at & msats_load_at
|
406
|
+
updated_at = nil
|
407
|
+
msats_load_at = nil
|
408
|
+
|
409
|
+
if options[:strict]
|
410
|
+
updated_at = Time.parse(csv[intervals_offset + 3]) unless csv[intervals_offset + 3].blank?
|
411
|
+
msats_load_at = Time.parse(csv[intervals_offset + 4]) unless csv[intervals_offset + 4].blank?
|
412
|
+
end
|
413
|
+
|
414
|
+
base_interval = {
|
415
|
+
data_details: @data_details.last,
|
416
|
+
datetime: Time.parse("#{csv[1]}000000+1000"),
|
417
|
+
value: nil,
|
418
|
+
flag: flag,
|
419
|
+
updated_at: updated_at,
|
420
|
+
msats_load_at: msats_load_at
|
421
|
+
}
|
401
422
|
|
402
423
|
intervals = []
|
403
424
|
(2..(number_of_intervals + 1)).each do |i|
|
@@ -411,8 +432,9 @@ module AEMO
|
|
411
432
|
end
|
412
433
|
|
413
434
|
# @param [String] line A single line in string format
|
435
|
+
# @param [Hash] options
|
414
436
|
# @return [Hash] the line parsed into a hash of information
|
415
|
-
def parse_nem12_400(line)
|
437
|
+
def parse_nem12_400(line, options = {})
|
416
438
|
csv = line.parse_csv
|
417
439
|
raise ArgumentError, 'RecordIndicator is not 400' if csv[0] != '400'
|
418
440
|
raise ArgumentError, 'StartInterval is not valid' if csv[1].nil? || csv[1].match(/^\d+$/).nil?
|
@@ -451,11 +473,17 @@ module AEMO
|
|
451
473
|
interval_events
|
452
474
|
end
|
453
475
|
|
476
|
+
# What even is a 500 row?
|
477
|
+
#
|
454
478
|
# @param [String] line A single line in string format
|
479
|
+
# @param [Hash] _options
|
455
480
|
# @return [Hash] the line parsed into a hash of information
|
456
481
|
def parse_nem12_500(_line, _options = {}); end
|
457
482
|
|
483
|
+
# 900 is the last row a NEM12 should see...
|
484
|
+
#
|
458
485
|
# @param [String] line A single line in string format
|
486
|
+
# @param [Hash] _options
|
459
487
|
# @return [Hash] the line parsed into a hash of information
|
460
488
|
def parse_nem12_900(_line, _options = {}); end
|
461
489
|
|
@@ -522,13 +550,13 @@ module AEMO
|
|
522
550
|
nem12s << AEMO::NEM12.new('')
|
523
551
|
nem12s.last.parse_nem12_200(line, strict: strict)
|
524
552
|
when 300
|
525
|
-
nem12s.last.parse_nem12_300(line)
|
553
|
+
nem12s.last.parse_nem12_300(line, strict: strict)
|
526
554
|
when 400
|
527
|
-
nem12s.last.parse_nem12_400(line)
|
555
|
+
nem12s.last.parse_nem12_400(line, strict: strict)
|
528
556
|
# when 500
|
529
|
-
# nem12s.last.parse_nem12_500(line)
|
557
|
+
# nem12s.last.parse_nem12_500(line, strict: strict)
|
530
558
|
# when 900
|
531
|
-
# nem12s.last.parse_nem12_900(line)
|
559
|
+
# nem12s.last.parse_nem12_900(line, strict: strict)
|
532
560
|
end
|
533
561
|
end
|
534
562
|
# Return the array of NEM12 groups
|
data/lib/aemo/nmi/allocation.rb
CHANGED
@@ -440,7 +440,7 @@ module AEMO
|
|
440
440
|
def initialize(title, type, opts = {})
|
441
441
|
@title = title
|
442
442
|
@type = parse_allocation_type(type)
|
443
|
-
@identifier = opts.fetch(:
|
443
|
+
@identifier = opts.fetch(:participant_id, title.upcase)
|
444
444
|
@friendly_title = opts.fetch(:friendly_title, title)
|
445
445
|
@exclude_nmi_patterns = opts.fetch(:excludes, [])
|
446
446
|
@include_nmi_patterns = opts.fetch(:includes, [])
|
data/lib/aemo/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aemo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Courtney
|
@@ -571,7 +571,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
571
571
|
- !ruby/object:Gem::Version
|
572
572
|
version: '0'
|
573
573
|
requirements: []
|
574
|
-
rubygems_version: 3.0.
|
574
|
+
rubygems_version: 3.0.3
|
575
575
|
signing_key:
|
576
576
|
specification_version: 4
|
577
577
|
summary: Gem providing functionality for the Australian Energy Market Operator data
|