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

%w[Market Non-Market].freeze
CLASSIFICATION =

Since:

  • 0.1.0

%w[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
47
# 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



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

def abbr
  @region
end

#current_dispatchArray<AEMO::Market::Interval>

Return the current dispatch data

Returns:

Since:

  • 0.1.0



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

def current_dispatch
  @aemo_market_node.current_dispatch
end

#current_tradingArray<AEMO::Market::Interval>

Return the current trading data

Returns:

Since:

  • 0.1.0



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

def current_trading
  @aemo_market_node.current_trading
end

#fullnameString

Returns:

  • (String)

Since:

  • 0.1.0



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

def fullname
  REGIONS[@region]
end

#to_sString

Returns:

  • (String)

Since:

  • 0.1.0



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

def to_s
  @region
end