aemo 0.1.22 → 0.1.23

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0d12cca1c4b2adde869316eea0d16874d7e2c29
4
- data.tar.gz: 1f2707793c79ce1ef1dbd7c469c2738498ec3770
3
+ metadata.gz: b20ce4d815543d07216701db47a72312737db305
4
+ data.tar.gz: fdfc8776f7fa87f93e1610577e8fe3676ab1f43d
5
5
  SHA512:
6
- metadata.gz: 34020a0543ec0f72a4ba36f125d4f1351892b7472f78eb4395ecd9b20f756f20e8943d493c3e06a975bbb5797247d37606275c4094f12612ffc37348ba177fb6
7
- data.tar.gz: b10d68d05989bfd3a4620bbbca36040ecb435542704fa5f75f1a1fb9977a008ff54379f16eb4a9a72088c179626791e7518e769fb35d3b163558521e4442f182
6
+ metadata.gz: 51800d16c005e07a0be7fd05de0ccda4224b1aed8159fa148a16d994fac919ff068fec769bedac7f319a0264087ed57471de7e62c8e10e622c0bba0963af5732
7
+ data.tar.gz: c48aaa496f7796c066229953d4a95b667819bd608bfed1ccb854487c006d171c4ccf06cc6d9bf9694bee28d880e6d902485190c2e07567045714a2ef4d330855
@@ -1,7 +1,10 @@
1
1
  require 'csv'
2
2
  require 'time'
3
+
3
4
  module AEMO
4
- class NEM12
5
+ # Namespace for classes and modules that handle AEMO Gem NEM12 interactions
6
+ # @since 0.1.4
7
+ module NEM12
5
8
  # As per AEMO NEM12 Specification
6
9
  # http://www.aemo.com.au/Consultations/National-Electricity-Market/Open/~/media/Files/Other/consultations/nem/Meter%20Data%20File%20Format%20Specification%20NEM12_NEM13/MDFF_Specification_NEM12_NEM13_Final_v102_clean.ashx
7
10
  RECORD_INDICATORS = {
@@ -223,45 +226,11 @@ module AEMO
223
226
 
224
227
  }
225
228
 
226
- DATA_STREAM_SUFFIX = {
227
- # Averaged Data Streams
228
- 'A' => { :stream => 'Average', :description => 'Import', :units => 'kWh' },
229
- 'D' => { :stream => 'Average', :description => 'Export', :units => 'kWh' },
230
- 'J' => { :stream => 'Average', :description => 'Import', :units => 'kVArh' },
231
- 'P' => { :stream => 'Average', :description => 'Export', :units => 'kVArh' },
232
- 'S' => { :stream => 'Average', :description => '', :units => 'kVAh' },
233
- # Master Data Streams
234
- 'B' => { :stream => 'Master', :description => 'Import', :units => 'kWh' },
235
- 'E' => { :stream => 'Master', :description => 'Export', :units => 'kWh' },
236
- 'K' => { :stream => 'Master', :description => 'Import', :units => 'kVArh' },
237
- 'Q' => { :stream => 'Master', :description => 'Export', :units => 'kVArh' },
238
- 'T' => { :stream => 'Master', :description => '', :units => 'kVAh' },
239
- 'G' => { :stream => 'Master', :description => 'Power Factor', :units => 'PF' },
240
- 'H' => { :stream => 'Master', :description => 'Q Metering', :units => 'Qh' },
241
- 'M' => { :stream => 'Master', :description => 'Par Metering', :units => 'parh' },
242
- 'V' => { :stream => 'Master', :description => 'Volts or V2h or Amps or A2h', :units => '' },
243
- # Check Meter Streams
244
- 'C' => { :stream => 'Check', :description => 'Import', :units => 'kWh' },
245
- 'F' => { :stream => 'Check', :description => 'Export', :units => 'kWh' },
246
- 'L' => { :stream => 'Check', :description => 'Import', :units => 'kVArh' },
247
- 'R' => { :stream => 'Check', :description => 'Export', :units => 'kVArh' },
248
- 'U' => { :stream => 'Check', :description => '', :units => 'kVAh' },
249
- 'Y' => { :stream => 'Check', :description => 'Q Metering', :units => 'Qh' },
250
- 'W' => { :stream => 'Check', :description => 'Par Metering Path', :units => '' },
251
- 'Z' => { :stream => 'Check', :description => 'Volts or V2h or Amps or A2h', :units => '' },
252
- # Net Meter Streams
253
- # AEMO: NOTE THAT D AND J ARE PREVIOUSLY DEFINED
254
- # 'D' => { :stream => 'Net', :description => 'Net', :units => 'kWh' },
255
- # 'J' => { :stream => 'Net', :description => 'Net', :units => 'kVArh' }
256
- }
257
-
258
- @nmi = nil
259
- @data_details = []
260
- @interval_data = []
261
- @interval_events = []
229
+ @file_contents = nil
230
+ @header = nil
231
+ @nmi_data_details = []
262
232
 
263
- attr_accessor :nmi, :file_contents
264
- attr_reader :data_details, :interval_data, :interval_events
233
+ attr_accessor :file_contents, :header, :nmi_data_details
265
234
 
266
235
  # Initialize a NEM12 file
267
236
  def initialize(nmi,options={})
@@ -648,7 +648,9 @@ module AEMO
648
648
  def dlfc_values(start = DateTime.now, finish=DateTime.now)
649
649
  raise 'No DLF set, ensure that you have set the value either via the update_from_msats! function or manually' if @dlf.nil?
650
650
  raise 'DLF is invalid' unless DLF_CODES.keys.include?(@dlf)
651
- raise 'Invalid date' unless [DateTime,Time].include?(datetime.class)
651
+ raise 'Invalid start' unless [DateTime,Time].include?(start.class)
652
+ raise 'Invalid finish' unless [DateTime,Time].include?(finish.class)
653
+ raise 'start cannot be after finish' if start > finish
652
654
  DLF_CODES[@dlf].reject{|x| start > DateTime.parse(x['ToDate']) || finish < DateTime.parse(x['FromDate']) }.map{|x| { 'start' => x['FromDate'], 'finish' => x['ToDate'], 'value' => x['Value'].to_f}}
653
655
  end
654
656
 
@@ -22,7 +22,7 @@
22
22
  # @author Joel Courtney <euphemize@gmail.com>
23
23
  module AEMO
24
24
  # aemo version
25
- VERSION = '0.1.22'
25
+ VERSION = '0.1.23'
26
26
 
27
27
  # aemo version split amongst different revisions
28
28
  MAJOR_VERSION, MINOR_VERSION, REVISION = VERSION.split('.').map(&:to_i)
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.1.22
4
+ version: 0.1.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Courtney