Class: ElectricityMeasurement

Inherits:
Measurement show all
Defined in:
lib/wattics-api-client/measurements.rb

Instance Attribute Summary collapse

Attributes inherited from Measurement

#timestamp

Instance Method Summary collapse

Methods inherited from Measurement

#<=>

Instance Attribute Details

#active_energy_phase_aObject

Returns the value of attribute active_energy_phase_a.



38
39
40
# File 'lib/wattics-api-client/measurements.rb', line 38

def active_energy_phase_a
  @active_energy_phase_a
end

#active_energy_phase_bObject

Returns the value of attribute active_energy_phase_b.



38
39
40
# File 'lib/wattics-api-client/measurements.rb', line 38

def active_energy_phase_b
  @active_energy_phase_b
end

#active_energy_phase_cObject

Returns the value of attribute active_energy_phase_c.



38
39
40
# File 'lib/wattics-api-client/measurements.rb', line 38

def active_energy_phase_c
  @active_energy_phase_c
end

#active_power_phase_aObject

Returns the value of attribute active_power_phase_a.



38
39
40
# File 'lib/wattics-api-client/measurements.rb', line 38

def active_power_phase_a
  @active_power_phase_a
end

#active_power_phase_bObject

Returns the value of attribute active_power_phase_b.



38
39
40
# File 'lib/wattics-api-client/measurements.rb', line 38

def active_power_phase_b
  @active_power_phase_b
end

#active_power_phase_cObject

Returns the value of attribute active_power_phase_c.



38
39
40
# File 'lib/wattics-api-client/measurements.rb', line 38

def active_power_phase_c
  @active_power_phase_c
end

#apparent_power_phase_aObject

Returns the value of attribute apparent_power_phase_a.



38
39
40
# File 'lib/wattics-api-client/measurements.rb', line 38

def apparent_power_phase_a
  @apparent_power_phase_a
end

#apparent_power_phase_bObject

Returns the value of attribute apparent_power_phase_b.



38
39
40
# File 'lib/wattics-api-client/measurements.rb', line 38

def apparent_power_phase_b
  @apparent_power_phase_b
end

#apparent_power_phase_cObject

Returns the value of attribute apparent_power_phase_c.



38
39
40
# File 'lib/wattics-api-client/measurements.rb', line 38

def apparent_power_phase_c
  @apparent_power_phase_c
end

#current_phase_aObject

Returns the value of attribute current_phase_a.



38
39
40
# File 'lib/wattics-api-client/measurements.rb', line 38

def current_phase_a
  @current_phase_a
end

#current_phase_bObject

Returns the value of attribute current_phase_b.



38
39
40
# File 'lib/wattics-api-client/measurements.rb', line 38

def current_phase_b
  @current_phase_b
end

#current_phase_cObject

Returns the value of attribute current_phase_c.



38
39
40
# File 'lib/wattics-api-client/measurements.rb', line 38

def current_phase_c
  @current_phase_c
end

#idObject

Returns the value of attribute id.



38
39
40
# File 'lib/wattics-api-client/measurements.rb', line 38

def id
  @id
end

#line_to_line_voltage_phase_abObject

Returns the value of attribute line_to_line_voltage_phase_ab.



38
39
40
# File 'lib/wattics-api-client/measurements.rb', line 38

def line_to_line_voltage_phase_ab
  @line_to_line_voltage_phase_ab
end

#line_to_line_voltage_phase_acObject

Returns the value of attribute line_to_line_voltage_phase_ac.



38
39
40
# File 'lib/wattics-api-client/measurements.rb', line 38

def line_to_line_voltage_phase_ac
  @line_to_line_voltage_phase_ac
end

#line_to_line_voltage_phase_bcObject

Returns the value of attribute line_to_line_voltage_phase_bc.



38
39
40
# File 'lib/wattics-api-client/measurements.rb', line 38

def line_to_line_voltage_phase_bc
  @line_to_line_voltage_phase_bc
end

#reactive_power_phase_aObject

Returns the value of attribute reactive_power_phase_a.



38
39
40
# File 'lib/wattics-api-client/measurements.rb', line 38

def reactive_power_phase_a
  @reactive_power_phase_a
end

#reactive_power_phase_bObject

Returns the value of attribute reactive_power_phase_b.



38
39
40
# File 'lib/wattics-api-client/measurements.rb', line 38

def reactive_power_phase_b
  @reactive_power_phase_b
end

#reactive_power_phase_cObject

Returns the value of attribute reactive_power_phase_c.



38
39
40
# File 'lib/wattics-api-client/measurements.rb', line 38

def reactive_power_phase_c
  @reactive_power_phase_c
end

#voltage_phase_aObject

Returns the value of attribute voltage_phase_a.



38
39
40
# File 'lib/wattics-api-client/measurements.rb', line 38

def voltage_phase_a
  @voltage_phase_a
end

#voltage_phase_bObject

Returns the value of attribute voltage_phase_b.



38
39
40
# File 'lib/wattics-api-client/measurements.rb', line 38

def voltage_phase_b
  @voltage_phase_b
end

#voltage_phase_cObject

Returns the value of attribute voltage_phase_c.



38
39
40
# File 'lib/wattics-api-client/measurements.rb', line 38

def voltage_phase_c
  @voltage_phase_c
end

Instance Method Details

#jsonObject



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/wattics-api-client/measurements.rb', line 74

def json
  {
    id: @id.to_s,
    tsISO8601: @timestamp,
    aP_1: @active_power_phase_a,
    aP_2: @active_power_phase_b,
    aP_3: @active_power_phase_c,
    rP_1: @reactive_power_phase_a,
    rP_2: @reactive_power_phase_b,
    rP_3: @reactive_power_phase_c,
    apP_1: @apparent_power_phase_a,
    apP_2: @apparent_power_phase_b,
    apP_3: @apparent_power_phase_c,
    v_1: @voltage_phase_a,
    v_2: @voltage_phase_b,
    v_3: @voltage_phase_c,
    c_1: @current_phase_a,
    c_2: @current_phase_b,
    c_3: @current_phase_c,
    pC_1: @active_energy_phase_a,
    pC_2: @active_energy_phase_b,
    pC_3: @active_energy_phase_c,
    v_12: @line_to_line_voltage_phase_ab,
    v_13: @line_to_line_voltage_phase_ac,
    v_23: @line_to_line_voltage_phase_bc
  }.select { |_k, v| v }.to_json
end

#to_sObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/wattics-api-client/measurements.rb', line 46

def to_s
  'ElectricityMeasurement{' \
    "id='" + @id.to_s + '\'' \
    ', timestamp=' + @timestamp.to_s +
    ', active_power_phase_a=' + @active_power_phase_a.to_s +
    ', active_power_phase_b=' + @active_power_phase_b.to_s +
    ', active_power_phase_c=' + @active_power_phase_c.to_s +
    ', reactive_power_phase_a=' + @reactive_power_phase_a.to_s +
    ', reactive_power_phase_b=' + @reactive_power_phase_b.to_s +
    ', reactive_power_phase_c=' + @reactive_power_phase_c.to_s +
    ', apparent_power_phase_a=' + @apparent_power_phase_a.to_s +
    ', apparent_power_phase_b=' + @apparent_power_phase_b.to_s +
    ', apparent_power_phase_c=' + @apparent_power_phase_c.to_s +
    ', voltage_phase_a=' + @voltage_phase_a.to_s +
    ', voltage_phase_b=' + @voltage_phase_b.to_s +
    ', voltage_phase_c=' + @voltage_phase_c.to_s +
    ', current_phase_a=' + @current_phase_a.to_s +
    ', current_phase_b=' + @current_phase_b.to_s +
    ', current_phase_c=' + @current_phase_c.to_s +
    ', active_energy_phase_a=' + @active_energy_phase_a.to_s +
    ', active_energy_phase_b=' + @active_energy_phase_b.to_s +
    ', active_energy_phase_c=' + @active_energy_phase_c.to_s +
    ', line_to_line_voltage_phase_ab=' + @line_to_line_voltage_phase_ab.to_s +
    ', line_to_line_voltage_phase_ac=' + @line_to_line_voltage_phase_ac.to_s +
    ', line_to_line_voltage_phase_bc=' + @line_to_line_voltage_phase_bc.to_s +
    '}'
end