aemo 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/aemo.gemspec +2 -2
  3. data/lib/aemo.rb +1 -0
  4. data/lib/aemo/nmi.rb +375 -0
  5. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ba274738c0e34092ed68c13514d9c1b7bcbca6b
4
- data.tar.gz: 9f7bdf4173e22a4126ba046ca73e4f4bdebde738
3
+ metadata.gz: b4cc289d4d7970c23318336e42aac4062aeba374
4
+ data.tar.gz: 7f07cf1aa6fd5e47f23a035a82aaa51ee332fd84
5
5
  SHA512:
6
- metadata.gz: bf633a733423f986ce4455eef3db76d18bdc656c9766e8c2697f369082dace85096a6242597adabe0f453034e52bc2d7187fdaaa03483a0909222a32960dbec0
7
- data.tar.gz: 8717d3baeb5f1ae3a141299977c060beffb133e01bea097773ffbb737b1d0163d40c0316688c677b7166644381114204b753f8f622e170956a4447e090c3e42e
6
+ metadata.gz: 16a93457ddbf13d0eca18f0be91e8de731c9f41a7511f528a410bedbfcb37f144d7225a4148e6456c17d4cbcf9eebce6df0b05199d23402ab231509d838e9392
7
+ data.tar.gz: 288b14ba40832243066d5c15bf11dcc9189d2bb1926092dfc7117fef853d7c89ce505a5349bf9c9e9b597791d75ea42e716bf36d2b2e1a9f0dcdf0093d4b1885
data/aemo.gemspec CHANGED
@@ -3,9 +3,9 @@ $:.push File.expand_path('../lib', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'aemo'
6
- s.version = '0.1.3'
6
+ s.version = '0.1.4'
7
7
  s.platform = Gem::Platform::RUBY
8
- s.date = '2014-08-19'
8
+ s.date = '2014-12-05'
9
9
  s.summary = 'AEMO Gem'
10
10
  s.description = 'Gem providing functionality for the Australian Energy Market Operator data'
11
11
  s.authors = ['Joel Courtney']
data/lib/aemo.rb CHANGED
@@ -4,6 +4,7 @@ require 'aemo/market.rb'
4
4
  require 'aemo/market/interval.rb'
5
5
  require 'aemo/region.rb'
6
6
  require 'aemo/nem12.rb'
7
+ require 'aemo/nmi.rb'
7
8
 
8
9
  module AEMO
9
10
  end
data/lib/aemo/nmi.rb ADDED
@@ -0,0 +1,375 @@
1
+ module AEMO
2
+ class NMI
3
+ REGIONS = {
4
+ 'ACT' => 'Australian Capital Territory',
5
+ 'NSW' => 'New South Wales',
6
+ 'QLD' => 'Queensland',
7
+ 'SA' => 'South Australia',
8
+ 'TAS' => 'Tasmania',
9
+ 'VIC' => 'Victoria',
10
+ 'WA' => 'Western Australia',
11
+ 'NT' => 'Northern Territory'
12
+ }
13
+ NETWORK_SERVICE_PROVIDERS = [
14
+ # ACT
15
+ {
16
+ type: 'electrical',
17
+ key: 'ACTEWP',
18
+ states: ['ACT'],
19
+ names: ['Actew Distribution Ltd','Jemena Networks (ACT) Pty Ltd'],
20
+ nmi_blocks: [
21
+ /^NGGG[A-HJ-NP-VX-Z0-9][A-HJ-NP-Z0-9]{5}$/,
22
+ /^7001[0-9]{6}$/
23
+ ]
24
+ },
25
+ # NSW
26
+ {
27
+ type: 'electrical',
28
+ key: 'ENERGYAP',
29
+ states: ['NSW'],
30
+ names: ['Ausgrid'],
31
+ nmi_blocks: [
32
+ /^NTTT[A-HJ-NP-VX-Z0-9][A-HJ-NP-Z0-9]{5}$/,
33
+ /^410[2-4][0-9]{6}$/
34
+ ]
35
+ },
36
+ {
37
+ type: 'electrical',
38
+ key: 'INTEGP',
39
+ states: ['NSW'],
40
+ names: ['Endeavour Energy'],
41
+ nmi_blocks: [
42
+ /^NEEE[A-HJ-NP-VX-Z0-9][A-HJ-NP-Z0-9]{5}$/,
43
+ /^431[0-9][0-9]{6}$/
44
+ ]
45
+ },
46
+ {
47
+ type: 'electrical',
48
+ key: 'CNRGYP',
49
+ states: ['NSW'],
50
+ names: ['Essential Energy'],
51
+ nmi_blocks: [
52
+ /^NAAA[A-HJ-NP-VX-Z0-9][A-HJ-NP-Z0-9]{5}$/,
53
+ /^NBBB[A-HJ-NP-VX-Z0-9][A-HJ-NP-Z0-9]{5}$/,
54
+ /^NDDD[A-HJ-NP-VX-Z0-9][A-HJ-NP-Z0-9]{5}$/,
55
+ /^NFFF[A-HJ-NP-VX-Z0-9][A-HJ-NP-Z0-9]{5}$/,
56
+ /^4001[0-9]{6}$/,
57
+ /^4508[0-9]{6}$/,
58
+ /^4204[0-9]{6}$/,
59
+ /^4407[0-9]{6}$/
60
+ ]
61
+ },
62
+ {
63
+ type: 'electrical',
64
+ key: 'TRANSGP',
65
+ states: ['NSW'],
66
+ names: ['TransGrid'],
67
+ nmi_blocks: [
68
+ /^NCCC[A-HJ-NP-VX-Z0-9][A-HJ-NP-Z0-9]{5}$/,
69
+ /^410[2-4][0-9]{6}$/
70
+ ]
71
+ },
72
+ {
73
+ type: 'electrical',
74
+ key: 'SNOWY',
75
+ states: ['NSW'],
76
+ names: ['Snowy Hydro'],
77
+ nmi_blocks: [
78
+ /^4708109[0-9]{3}$/
79
+ ]
80
+ },
81
+ # NT
82
+ {
83
+ type: 'electrical',
84
+ key: 'RESERVED_NT',
85
+ states: ['NT'],
86
+ names: [],
87
+ nmi_blocks: [
88
+ /^250[0-9]{7}$/
89
+ ]
90
+ },
91
+ # QUEENSLAND
92
+ {
93
+ type: 'electrical',
94
+ key: 'ERGONETP',
95
+ states: ['QLD'],
96
+ names: ['Ergon Energy'],
97
+ nmi_blocks: [
98
+ /^QAAA[A-HJ-NP-VX-Z0-9][A-HJ-NP-Z0-9]{5}$/,
99
+ /^QCCC[A-HJ-NP-VX-Z0-9][A-HJ-NP-Z0-9]{5}$/,
100
+ /^QDDD[A-HJ-NP-VX-Z0-9][A-HJ-NP-Z0-9]{5}$/,
101
+ /^QEEE[A-HJ-NP-VX-Z0-9][A-HJ-NP-Z0-9]{5}$/,
102
+ /^QFFF[A-HJ-NP-VX-Z0-9][A-HJ-NP-Z0-9]{5}$/,
103
+ /^QGGG[A-HJ-NP-VX-Z0-9][A-HJ-NP-Z0-9]{5}$/,
104
+ /^30[0-9]{8}$/
105
+ ]
106
+ },
107
+ {
108
+ type: 'electrical',
109
+ key: 'ENERGEXP',
110
+ states: ['QLD'],
111
+ names: ['ENERGEX'],
112
+ nmi_blocks: [
113
+ /^QB[0-9]{2}[A-HJ-NP-VX-Z0-9][A-HJ-NP-Z0-9]{5}$/,
114
+ /^31[0-9]{8}$/
115
+ ]
116
+ },
117
+ {
118
+ type: 'electrical',
119
+ key: 'PLINKP',
120
+ states: ['QLD'],
121
+ names: ['QLD Electricity Transmission Corp (Powerlink)'],
122
+ nmi_blocks: [
123
+ /^QtniW[A-HJ-NP-Z0-9]{5}$/,
124
+ /^320200[0-9]{4}$/
125
+ ]
126
+ },
127
+ # SA
128
+ {
129
+ type: 'electrical',
130
+ key: 'UMPLP',
131
+ states: ['SA'],
132
+ names: ['SA Power Networks'],
133
+ nmi_blocks: [
134
+ /^SAAA[A-HJ-NP-VX-Z0-9][A-HJ-NP-Z0-9]{5}$/,
135
+ /^SASMPL[0-9]{4}$/,
136
+ /^200[1-2][0-9]{6}$/
137
+ ]
138
+ },
139
+ {
140
+ type: 'electrical',
141
+ key: 'ETSATP',
142
+ states: ['SA'],
143
+ names: ['ElectraNet'],
144
+ nmi_blocks: [
145
+ /^StniW[A-HJ-NP-Z0-9]{5}$/,
146
+ /^310200[0-9]{4}$/
147
+ ]
148
+ },
149
+ # TASMANIA
150
+ {
151
+ type: 'electrical',
152
+ key: 'AURORAP',
153
+ states: ['TAS'],
154
+ names: ['Aurora Energy'],
155
+ nmi_blocks: [
156
+ /^T00000(([0-4][0-9]{3})|(5001))$/,
157
+ /^8000[0-9]{6}$/,
158
+ /^8590[2-3][0-9]{5}$/
159
+ ]
160
+ },
161
+ {
162
+ type: 'electrical',
163
+ key: 'TRANSEND',
164
+ states: ['TAS'],
165
+ names: ['Transend Networks'],
166
+ nmi_blocks: [
167
+ /^TtniW[A-HJ-NP-Z0-9]{5}$/
168
+ ]
169
+ },
170
+ # VICTORIA
171
+ {
172
+ type: 'electrical',
173
+ key: 'CITIPP',
174
+ states: ['VIC'],
175
+ names: ['CitiPower'],
176
+ nmi_blocks: [
177
+ /^VAAA[A-HJ-NP-VX-Z0-9][A-HJ-NP-Z0-9]{5}$/,
178
+ /^610[2-3][0-9]{6}$/
179
+ ]
180
+ },
181
+ {
182
+ type: 'electrical',
183
+ key: 'EASTERN',
184
+ states: ['VIC'],
185
+ names: ['AusNet'],
186
+ nmi_blocks: [
187
+ /^VBBB[A-HJ-NP-VX-Z0-9][A-HJ-NP-Z0-9]{5}$/,
188
+ /^630[5-6][0-9]{6}$/
189
+ ]
190
+ },
191
+ {
192
+ type: 'electrical',
193
+ key: 'POWCP',
194
+ states: ['VIC'],
195
+ names: ['Powercor'],
196
+ nmi_blocks: [
197
+ /^VCCC[A-HJ-NP-VX-Z0-9][A-HJ-NP-Z0-9]{5}$/,
198
+ /^620[3-4][0-9]{6}$/
199
+ ]
200
+ },
201
+ {
202
+ type: 'electrical',
203
+ key: 'Jemena Electricity Networks',
204
+ states: ['VIC'],
205
+ names: ['SOLARISP'],
206
+ nmi_blocks: [
207
+ /^VDDD[A-HJ-NP-VX-Z0-9][A-HJ-NP-Z0-9]{5}$/,
208
+ /^6001[0-9]{6}$/
209
+ ]
210
+ },
211
+ {
212
+ type: 'electrical',
213
+ key: 'UNITED',
214
+ states: ['VIC'],
215
+ names: ['United Energy Distribution'],
216
+ nmi_blocks: [
217
+ /^VEEE[A-HJ-NP-VX-Z0-9][A-HJ-NP-Z0-9]{5}$/,
218
+ /^640[7-8][0-9]{6}$/
219
+ ]
220
+ },
221
+ {
222
+ type: 'electrical',
223
+ key: 'GPUPP',
224
+ states: ['SA'],
225
+ names: ['AusNet'],
226
+ nmi_blocks: [
227
+ /^VtniW[A-HJ-NP-Z0-9]{5}$/,
228
+ /^650900[0-9]{4}$/
229
+ ]
230
+ },
231
+ # WA
232
+ {
233
+ type: 'electrical',
234
+ key: 'WESTERNPOWER',
235
+ states: ['WA'],
236
+ names: ['Western Power'],
237
+ nmi_blocks: [
238
+ /^WAAA[A-HJ-NP-VX-Z0-9][A-HJ-NP-Z0-9]{5}$/,
239
+ /^801[0-9]{7}$/,
240
+ /^8020[0-9]{6}$/
241
+ ]
242
+ },
243
+ {
244
+ type: 'electrical',
245
+ key: 'GPUPP',
246
+ states: ['SA'],
247
+ names: ['AusNet'],
248
+ nmi_blocks: [
249
+ /^8021[0-9]{6}$/
250
+ ]
251
+ },
252
+ # GAS
253
+ {
254
+ type: 'gas',
255
+ key: nil,
256
+ states: ['NSW','ACT'],
257
+ names: [],
258
+ nmi_blocks: [
259
+ /^52[0-9]{8}$/
260
+ ]
261
+ },
262
+ {
263
+ type: 'gas',
264
+ key: nil,
265
+ states: ['VIC'],
266
+ names: [],
267
+ nmi_blocks: [
268
+ /^53[0-9]{8}$/
269
+ ]
270
+ },
271
+ {
272
+ type: 'gas',
273
+ key: nil,
274
+ states: ['QLD'],
275
+ names: [],
276
+ nmi_blocks: [
277
+ /^54[0-9]{8}$/
278
+ ]
279
+ },
280
+ {
281
+ type: 'gas',
282
+ key: nil,
283
+ states: ['SA'],
284
+ names: [],
285
+ nmi_blocks: [
286
+ /^55[0-9]{8}$/
287
+ ]
288
+ },
289
+ {
290
+ type: 'gas',
291
+ key: nil,
292
+ states: ['WA'],
293
+ names: [],
294
+ nmi_blocks: [
295
+ /^56[0-9]{8}$/
296
+ ]
297
+ },
298
+ {
299
+ type: 'gas',
300
+ key: nil,
301
+ states: ['TAS'],
302
+ names: [],
303
+ nmi_blocks: [
304
+ /^57[0-9]{8}$/
305
+ ]
306
+ },
307
+ # MISC
308
+ {
309
+ type: 'electrical',
310
+ key: nil,
311
+ states: [],
312
+ names: ['Federal Airports Corporation (Sydney Airport)'],
313
+ nmi_blocks: [
314
+ /^NJJJNR[A-HJ-NP-Z0-9]{4}$/
315
+ ]
316
+ },
317
+ {
318
+ type: 'electrical',
319
+ key: nil,
320
+ states: [],
321
+ names: ['Exempt Networks - various'],
322
+ nmi_blocks: [
323
+ /^NKKKNR[A-HJ-NP-Z0-9]{4}$/,
324
+ /^7102[0-9]{6}$/
325
+ ]
326
+ },
327
+ {
328
+ type: 'electrical',
329
+ key: nil,
330
+ states: [],
331
+ names: ['AEMO Reserved Block 1'],
332
+ nmi_blocks: [
333
+ /^880[1-5][0-9]{6}$/
334
+ ]
335
+ },
336
+ {
337
+ type: 'electrical',
338
+ key: nil,
339
+ states: [],
340
+ names: ['AEMO Reserved Block 1'],
341
+ nmi_blocks: [
342
+ /^9[0-9]{9}$/
343
+ ]
344
+ }
345
+ ]
346
+
347
+ attr_accessor :region
348
+
349
+ def initialize(nmi)
350
+ @nmi = nmi
351
+ @network = NMI.find_network(nmi)
352
+ end
353
+
354
+
355
+ def self.find_network(nmi)
356
+ nmi_network = nil
357
+ NETWORK_SERVICE_PROVIDERS.each do |network|
358
+ network[:nmi_blocks].each do |nmi_block|
359
+ nmi_network = network if nmi.match(nmi_block)
360
+ end
361
+ break unless nmi_network.nil?
362
+ end
363
+ nmi_network
364
+ end
365
+
366
+ # ######### #
367
+ protected
368
+ # ######### #
369
+
370
+ def is_valid_region?(region)
371
+ REGIONS.keys.include?(region)
372
+ end
373
+
374
+ end
375
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aemo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Courtney
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-19 00:00:00.000000000 Z
11
+ date: 2014-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -82,6 +82,7 @@ files:
82
82
  - lib/aemo/market/interval.rb
83
83
  - lib/aemo/nem12.rb
84
84
  - lib/aemo/nem13.rb
85
+ - lib/aemo/nmi.rb
85
86
  - lib/aemo/region.rb
86
87
  - spec/aemo/market_spec.rb
87
88
  - spec/aemo/nem12_spec.rb