Class: AEMO::Region Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/aemo/region.rb,
lib/aemo/dispatchable.rb

Overview

This class is abstract.

AEMO::Region

Author:

  • Joel Courtney

Since:

  • 0.1.0

Constant Summary collapse

REGIONS =

Regions under juristiction

Since:

  • 0.1.0

{
  '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 =

Since:

  • 0.1.0

['Generator', 'Load Norm Off', 'Network Service Provider'].freeze
CATEGORY =

Since:

  • 0.1.0

['Market', 'Non-Market'].freeze
CLASSIFICATION =

Since:

  • 0.1.0

['Scheduled', 'Semi-Scheduled', 'Non-Scheduled'].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(region) ⇒ self

Create a new instance of AEMO::Region

Parameters:

  • region (String)

    State

Raises:

  • (ArgumentError)

Since:

  • 0.1.0



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/aemo/region.rb', line 35

def initialize(region)
  raise ArgumentError, "Region '#{region}' is not valid." unless valid_region?(region)
  @region = region.upcase
  @full_name = REGIONS[@region]
  @current_trading = []
  @current_dispatch = []
  @aemo_market_node = if %w[NSW QLD SA TAS VIC].include?(@region)
                        AEMO::Market::Node.new(region)
                      elsif @region == 'ACT'
                        AEMO::Market::Node.new('NSW')
                      end
end

Instance Attribute Details

#aemo_market_nodeObject (readonly)

Since:

  • 0.1.0



23
24
25
# File 'lib/aemo/region.rb', line 23

def aemo_market_node
  @aemo_market_node
end

#regionObject

Since:

  • 0.1.0



22
23
24
# File 'lib/aemo/region.rb', line 22

def region
  @region
end

Class Method Details

.allObject

Since:

  • 0.1.0



26
27
28
# File 'lib/aemo/region.rb', line 26

def all
  REGIONS.keys.map { |k| AEMO::Region.new(k) }
end

Instance Method Details

#abbrString

Abbreviation method

Returns:

  • (String)

Since:

  • 0.1.0



51
52
53
# File 'lib/aemo/region.rb', line 51

def abbr
  @region
end

#current_dispatchArray<AEMO::Market::Interval>

Return the current dispatch data

Returns:

Since:

  • 0.1.0



68
69
70
# File 'lib/aemo/region.rb', line 68

def current_dispatch
  @aemo_market_node.current_dispatch
end

#current_tradingArray<AEMO::Market::Interval>

Return the current trading data

Returns:

Since:

  • 0.1.0



75
76
77
# File 'lib/aemo/region.rb', line 75

def current_trading
  @aemo_market_node.current_trading
end

#fullnameString

Returns:

  • (String)

Since:

  • 0.1.0



61
62
63
# File 'lib/aemo/region.rb', line 61

def fullname
  REGIONS[@region]
end

#to_sString

Returns:

  • (String)

Since:

  • 0.1.0



56
57
58
# File 'lib/aemo/region.rb', line 56

def to_s
  @region
end