Class: AEMO::Region Abstract
- Inherits:
-
Object
- Object
- AEMO::Region
- Defined in:
- lib/aemo/region.rb,
lib/aemo/dispatchable.rb
Overview
This class is abstract.
AEMO::Region
Constant Summary collapse
- REGIONS =
Regions under juristiction
{ 'ACT' => 'Australian Capital Territory', 'NSW' => 'New South Wales', 'QLD' => 'Queensland', 'SA' => 'South Australia', 'TAS' => 'Tasmania', 'VIC' => 'Victoria', 'NT' => 'Northern Territory', 'WA' => 'Western Australia' }.freeze
- DISPATCH_TYPE =
['Generator', 'Load Norm Off', 'Network Service Provider'].freeze
- CATEGORY =
['Market', 'Non-Market'].freeze
- CLASSIFICATION =
['Scheduled', 'Semi-Scheduled', 'Non-Scheduled'].freeze
Instance Attribute Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
- #abbr ⇒ Object
- #current_dispatch ⇒ Object
- #current_trading ⇒ Object
- #fullname ⇒ Object
-
#initialize(region) ⇒ Region
constructor
A new instance of Region.
- #to_s ⇒ Object
Constructor Details
#initialize(region) ⇒ Region
Returns a new instance of Region.
22 23 24 25 26 27 |
# File 'lib/aemo/region.rb', line 22 def initialize(region) raise ArgumentError, "Region '#{region}' is not valid." unless valid_region?(region) @region = region @current_trading = [] @current_dispatch = [] end |
Instance Attribute Details
#region ⇒ Object
20 21 22 |
# File 'lib/aemo/region.rb', line 20 def region @region end |
Class Method Details
Instance Method Details
#abbr ⇒ Object
29 30 31 |
# File 'lib/aemo/region.rb', line 29 def abbr @region end |
#current_dispatch ⇒ Object
41 42 43 44 45 46 |
# File 'lib/aemo/region.rb', line 41 def current_dispatch if @current_dispatch.empty? || @current_dispatch.last.datetime != (Time.now - Time.now.to_i % 300) @current_dispatch = AEMO::Market.current_dispatch(@region) end @current_dispatch end |
#current_trading ⇒ Object
48 49 50 51 52 53 |
# File 'lib/aemo/region.rb', line 48 def current_trading if @current_trading.empty? || @current_trading.reject { |i| i.period_type != 'TRADE' }.last.datetime != (Time.now - Time.now.to_i % 300) @current_trading = AEMO::Market.current_trading(@region) end @current_trading end |
#to_s ⇒ Object
33 34 35 |
# File 'lib/aemo/region.rb', line 33 def to_s @region end |