Skip to content

Commit d2763c5

Browse files
authored
fix algodue (#2306)
1 parent 3bd8bca commit d2763c5

2 files changed

Lines changed: 40 additions & 102 deletions

File tree

packages/modules/common/algodue.py

Lines changed: 0 additions & 98 deletions
This file was deleted.

packages/modules/devices/algodue/algodue/counter.py

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ def __init__(self,
3030
def update(self):
3131
with self.__tcp_client:
3232

33-
frequency = self.__tcp_client.read_input_registers(0x1038, ModbusDataType.FLOAT_32, unit=self.id)
34-
currents = self.__tcp_client.read_input_registers(0x100E, [ModbusDataType.FLOAT_32]*3, unit=self.id)
35-
powers = self.__tcp_client.read_input_registers(0x1020, [ModbusDataType.FLOAT_32]*3, unit=self.id)
33+
frequency = self.__tcp_client.read_input_registers(0x1038, ModbusDataType.FLOAT_32, unit=self.__modbus_id)
34+
currents = self.__tcp_client.read_input_registers(
35+
0x100E, [ModbusDataType.FLOAT_32]*3, unit=self.__modbus_id)
36+
powers = self.__tcp_client.read_input_registers(0x1020, [ModbusDataType.FLOAT_32]*3, unit=self.__modbus_id)
3637
power = sum(powers)
37-
voltages = self.__tcp_client.read_input_registers(0x1000, [ModbusDataType.FLOAT_32]*3, unit=self.id)
38+
voltages = self.__tcp_client.read_input_registers(
39+
0x1000, [ModbusDataType.FLOAT_32]*3, unit=self.__modbus_id)
3840

3941
imported, exported = self.sim_counter.sim_count(power)
4042

@@ -51,3 +53,37 @@ def update(self):
5153

5254

5355
component_descriptor = ComponentDescriptor(configuration_factory=AlgodueCounterSetup)
56+
57+
# serial_chars = self.client.read_holding_registers(0x500, [ModbusDataType.UINT_8]*10, unit=self.id)
58+
# model_id = self.client.read_holding_registers(0x505, ModbusDataType.UINT_16, unit=self.id)
59+
# model_string = "unknown"
60+
# if model_id == 0x03:
61+
# model_string = "6 A, 3 phases, 4 wires"
62+
# elif model_id == 0x08:
63+
# model_string = "80 A, 3 phases, 4 wires"
64+
# elif model_id == 0x0c:
65+
# model_string = "80 A, 1 phase, 2 wires"
66+
# elif model_id == 0x10:
67+
# model_string = "40 A, 1 phase, 2 wires"
68+
# elif model_id == 0x12:
69+
# model_string = "63 A, 3 phases, 4 wires"
70+
71+
# type_id = self.client.read_holding_registers(0x506, ModbusDataType.UINT_16, unit=self.id)
72+
# type_string = "unknown"
73+
# if type_id == 0x00:
74+
# type_string = "NO MID, RESET"
75+
# elif type_id == 0x01:
76+
# type_string = "MID"
77+
# elif type_id == 0x02:
78+
# type_string = "NO MID"
79+
# elif type_id == 0x03:
80+
# type_string = "NO MID, Wiring selection"
81+
# elif type_id == 0x05:
82+
# type_string = "MID no varh"
83+
# elif type_id == 0x09:
84+
# type_string = "MID Wiring selection"
85+
# elif type_id == 0x0a:
86+
# type_string = "MID no varh, Wiring selection"
87+
# elif type_id == 0x0b:
88+
# type_string = "NO MID, RESET, Wiring selection"
89+
# meterinfo = "Algodue UEM " + model_string + ", " + type_string

0 commit comments

Comments
 (0)