Class: AEMO::Register

Inherits:
Object
  • Object
show all
Defined in:
lib/aemo/register.rb

Overview

AEMO::Register represents a register on a meter

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ AEMO::Register

Initialize a register

Parameters:

  • opts (Hash) (defaults to: {})

    {} the parameters to set



14
15
16
17
18
19
20
21
22
23
# File 'lib/aemo/register.rb', line 14

def initialize(opts = {})
  @controlled_load     = opts[:controlled_load]
  @dial_format         = opts[:dial_format]
  @multiplier          = opts[:multiplier]
  @network_tariff_code = opts[:network_tariff_code]
  @register_id         = opts[:register_id]
  @status              = opts[:status]
  @time_of_day         = opts[:time_of_day]
  @unit_of_measure     = opts[:unit_of_measure]
end

Instance Attribute Details

#controlled_loadObject

Returns the value of attribute controlled_load.



6
7
8
# File 'lib/aemo/register.rb', line 6

def controlled_load
  @controlled_load
end

#dial_formatObject

Returns the value of attribute dial_format.



6
7
8
# File 'lib/aemo/register.rb', line 6

def dial_format
  @dial_format
end

#multiplierObject

Returns the value of attribute multiplier.



6
7
8
# File 'lib/aemo/register.rb', line 6

def multiplier
  @multiplier
end

#network_tariff_codeObject

Returns the value of attribute network_tariff_code.



6
7
8
# File 'lib/aemo/register.rb', line 6

def network_tariff_code
  @network_tariff_code
end

#register_idObject

Returns the value of attribute register_id.



6
7
8
# File 'lib/aemo/register.rb', line 6

def register_id
  @register_id
end

#statusObject

Returns the value of attribute status.



6
7
8
# File 'lib/aemo/register.rb', line 6

def status
  @status
end

#time_of_dayObject

Returns the value of attribute time_of_day.



6
7
8
# File 'lib/aemo/register.rb', line 6

def time_of_day
  @time_of_day
end

#unit_of_measureObject

Returns the value of attribute unit_of_measure.



6
7
8
# File 'lib/aemo/register.rb', line 6

def unit_of_measure
  @unit_of_measure
end

Class Method Details

.from_hash(register) ⇒ AEMO::Register

Initialize a new register from an MSATS hash

Parameters:

  • register (Hash)

    the MSATS hash

Returns:



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/aemo/register.rb', line 29

def self.from_hash(register)
  AEMO::Register.new(
    controlled_load: register['ControlledLoad'] == 'Y',
    dial_format: register['DialFormat'],
    multiplier: register['Multiplier'],
    network_tariff_code: register['NetworkTariffCode'],
    register_id: register['RegisterID'],
    status: register['Status'],
    time_of_day: register['TimeOfDay'],
    unit_of_measure: register['UnitOfMeasure']
  )
end