aemo 0.1.20 → 0.1.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/aemo/nmi.rb +34 -0
- data/lib/aemo/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4fefbfadf36ab805001b83fcc76d4069ed77037
|
4
|
+
data.tar.gz: c26ef58c619b413ec5d5737caea274c24070f2f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0294e7adcfc766248ee48d820a74e65736e79434e16ea42bed4b8f744ce1690420652142a4b80b982588ed559d1d6e5874426aa8b3ac6217f192b2b49b8c590
|
7
|
+
data.tar.gz: d1b73d2c0267dd2f4381d731af11e98c404916b85448c05f65f962f40cfb69b1c5198ffc8438bcaa4d897faa51a8cd009c688851cf4cbee164af37f3e4d901fb
|
data/lib/aemo/nmi.rb
CHANGED
@@ -640,6 +640,18 @@ module AEMO
|
|
640
640
|
end
|
641
641
|
end
|
642
642
|
|
643
|
+
# A function to return the distribution loss factor value for a given date
|
644
|
+
#
|
645
|
+
# @param [DateTime,Time] start the date for the distribution loss factor value
|
646
|
+
# @param [DateTime,Time] finish the date for the distribution loss factor value
|
647
|
+
# @return [Array(Hash)] array of hashes of start,finish and value
|
648
|
+
def dlfc_values(start = DateTime.now, finish=DateTime.now)
|
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
|
+
raise 'DLF is invalid' unless DLF_CODES.keys.include?(@dlf)
|
651
|
+
raise 'Invalid date' unless [DateTime,Time].include?(datetime.class)
|
652
|
+
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
|
+
end
|
654
|
+
|
643
655
|
# A function to return the transmission node identifier loss factor value for a given date
|
644
656
|
#
|
645
657
|
# @param [DateTime,Time] datetime the date for the distribution loss factor value
|
@@ -661,6 +673,28 @@ module AEMO
|
|
661
673
|
end
|
662
674
|
end
|
663
675
|
|
676
|
+
# A function to return the transmission node identifier loss factor value for a given date
|
677
|
+
#
|
678
|
+
# @param [DateTime,Time] start the date for the distribution loss factor value
|
679
|
+
# @param [DateTime,Time] finish the date for the distribution loss factor value
|
680
|
+
# @return [Array(Hash)] array of hashes of start,finish and value
|
681
|
+
def tni_values(start=DateTime.now,finish=DateTime.now)
|
682
|
+
raise 'No TNI set, ensure that you have set the value either via the update_from_msats! function or manually' if @tni.nil?
|
683
|
+
raise 'TNI is invalid' unless TNI_CODES.keys.include?(@tni)
|
684
|
+
raise 'Invalid start' unless [DateTime,Time].include?(start.class)
|
685
|
+
raise 'Invalid finish' unless [DateTime,Time].include?(finish.class)
|
686
|
+
raise 'start cannot be after finish' if start > finish
|
687
|
+
possible_values = TNI_CODES[@tni].reject{|x| start > DateTime.parse(x['ToDate']) || finish < DateTime.parse(x['FromDate']) }
|
688
|
+
tni_values = []
|
689
|
+
if possible_values.length == 0
|
690
|
+
nil
|
691
|
+
else
|
692
|
+
possible_values.each do |possible_value|
|
693
|
+
tni_values += possible_value['mlf_data']['loss_factors'].reject{|x| start > DateTime.parse(x['finish']) || finish < DateTime.parse(x['start']) }
|
694
|
+
end
|
695
|
+
end
|
696
|
+
end
|
697
|
+
|
664
698
|
# ######### #
|
665
699
|
protected
|
666
700
|
# ######### #
|
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.1.
|
4
|
+
version: 0.1.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Courtney
|
@@ -108,7 +108,7 @@ dependencies:
|
|
108
108
|
version: '4.2'
|
109
109
|
- - ">="
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version: 4.2.
|
111
|
+
version: 4.2.0
|
112
112
|
type: :runtime
|
113
113
|
prerelease: false
|
114
114
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -118,7 +118,7 @@ dependencies:
|
|
118
118
|
version: '4.2'
|
119
119
|
- - ">="
|
120
120
|
- !ruby/object:Gem::Version
|
121
|
-
version: 4.2.
|
121
|
+
version: 4.2.0
|
122
122
|
- !ruby/object:Gem::Dependency
|
123
123
|
name: bundler
|
124
124
|
requirement: !ruby/object:Gem::Requirement
|