PowerMeter-Reader icon indicating copy to clipboard operation
PowerMeter-Reader copied to clipboard

Reading iEM3355

Open iridiu opened this issue 7 years ago • 2 comments

Hi Luca, I have a very similar power meter (iEM3355) and I have difficulties in reading the registers. I have installed your software in a virtual environment with Python V3.5.3 and Pymodbus V2.0.0, but I'm receiving few errors. It doesn't matter in which way I install Pymodbus or if Python version is 2.7 or 3.5.3, I receive this errors:

(ModBus) pi@HOOS-Computer:~/ModBus $ python main.py -m 2018-09-24 18:08:49,832 - utils - DEBUG - Log Management ModbusWrapperClient => utils 2018-09-24 18:08:49,847 - utils - DEBUG - Log Management SchneiderElectriciEM3255 => utils 2018-09-24 18:08:49,849 - utils - DEBUG - Log Management main => utils 2018-09-24 18:08:49,865 - utils - DEBUG - Read 47 modbus registers: ['Nominal Frequency => 2016,1,uint16', 'TotalActivePW => 3059,2,float32', 'L1Active => 3053,2,float32', 'Digital Output Association => 2130,1,uint16', 'Input Pulse Constant => 7051,2,float32', 'YYYY => 1844,1,uint16', 'PartialActiveEnergy => 3255,4,int64', 'Pulse Weight => 2131,2,float32', 'L1Current => 2999,2,float32', 'L3Active => 3057,2,float32', 'Digital Input Control Mode => 7273,1,uint16', 'L2Active => 3055,2,float32', 'FREQ => 3109,2,float32', 'Baud Rate => 6501,1,uint16', 'L3Current => 3003,2,float32', 'PartialReactiveEnergy => 3271,4,int64', 'Parity: => 6502,1,uint16', 'MS => 1847,1,raw', 'TotalActiveEnergy => 3203,4,int64', 'Hardware Revision => 135,5,utf8', 'TotalApparentPW => 3075,2,float32', 'Input Label => 7031,20,utf8', 'TotalReactivePW => 3067,2,float32', 'Serial Number => 129,2,uint32', 'L1Voltage => 3027,2,float32', 'Meter Name => 29,20,utf8', 'L2Current => 3001,2,float32', 'Date of Manufacture => 131,4,datetime', 'Power System => 2015,1,uint16', 'L2Voltage => 3029,2,float32', 'Number of Phases => 2013,1,uint16', 'Firmware Version => 1636,1,uint16', 'Address => 6500,1,uint16', 'TotalPowerFactor => 3083,2,float32', 'Manufacturer => 69,20,utf8', 'Input Digital Input Association => 7054,1,uint16', 'Number of Wires => 2014,1,uint16', 'MM-WW-GG => 1845,1,raw', 'Meter Model => 49,20,utf8', 'Protocol => 6499,1,uint16', 'Digital Input Status => 8904,2,bitmap', 'Meter Operation Timer => 2003,2,uint32', 'L3Voltage => 3031,2,float32', 'TotalReactiveEnergy => 3219,4,int64', 'Energy Pulse Duration => 2128,1,uint16', 'Digital Output Control Mode Status => 9672,1,uint16', 'HH-MM => 1846,1,raw', ] 2018-09-24 18:08:49,866 - utils - DEBUG - modbusmap: {'Nominal Frequency': [2016, 1, 'uint16'], 'TotalActivePW': [3059, 2, 'float32'], 'L1Active': [3053, 2, 'float32'], 'Digital Output Association': [2130, 1, 'uint16'], 'Input Pulse Constant': [7051, 2, 'float32'], 'YYYY': [1844, 1, 'uint16'], 'PartialActiveEnergy': [3255, 4, 'int64'], 'Pulse Weight': [2131, 2, 'float32'], 'L1Current': [2999, 2, 'float32'], 'L3Active': [3057, 2, 'float32'], 'Digital Input Control Mode': [7273, 1, 'uint16'], 'L2Active': [3055, 2, 'float32'], 'FREQ': [3109, 2, 'float32'], 'Baud Rate': [6501, 1, 'uint16'], 'L3Current': [3003, 2, 'float32'], 'PartialReactiveEnergy': [3271, 4, 'int64'], 'Parity:': [6502, 1, 'uint16'], 'MS': [1847, 1, 'raw'], 'TotalActiveEnergy': [3203, 4, 'int64'], 'Hardware Revision': [135, 5, 'utf8'], 'TotalApparentPW': [3075, 2, 'float32'], 'Input Label': [7031, 20, 'utf8'], 'TotalReactivePW': [3067, 2, 'float32'], 'Serial Number': [129, 2, 'uint32'], 'L1Voltage': [3027, 2, 'float32'], 'Meter Name': [29, 20, 'utf8'], 'L2Current': [3001, 2, 'float32'], 'Date of Manufacture': [131, 4, 'datetime'], 'Power System': [2015, 1, 'uint16'], 'L2Voltage': [3029, 2, 'float32'], 'Number of Phases': [2013, 1, 'uint16'], 'Firmware Version': [1636, 1, 'uint16'], 'Address': [6500, 1, 'uint16'], 'TotalPowerFactor': [3083, 2, 'float32'], 'Manufacturer': [69, 20, 'utf8'], 'Input Digital Input Association': [7054, 1, 'uint16'], 'Number of Wires': [2014, 1, 'uint16'], 'MM-WW-GG': [1845, 1, 'raw'], 'Meter Model': [49, 20, 'utf8'], 'Protocol': [6499, 1, 'uint16'], 'Digital Input Status': [8904, 2, 'bitmap'], 'Meter Operation Timer': [2003, 2, 'uint32'], 'L3Voltage': [3031, 2, 'float32'], 'TotalReactiveEnergy': [3219, 4, 'int64'], 'Energy Pulse Duration': [2128, 1, 'uint16'], 'Digital Output Control Mode Status': [9672, 1, 'uint16'], 'HH-MM': [1846, 1, 'raw']} 2018-09-24 18:08:49,871 - utils - DEBUG - valid_addresses: [29, 30, 32, 35, 39, 44, 49, 50, 52, 55, 57, 59, 64, 65, 69, 70, 72, 74, 75, 77, 79, 84, 85, 90, 94, 95, 97, 104, 105, 107, 114, 115, 120, 124, 127, 129, 130, 131, 132, 134, 135, 136, 137, 138, 140, 141, 145, 147, 149, 150, 154, 160, 165, 169, 174, 182, 185, 189, 200, 202, 205, 219, 220, 222, 239, 240, 259, 279, 1636, 1637, 1844, 1845, 1846, 1847, 1848, 2003, 2004, 2006, 2013, 2014, 2015, 2016, 2017, 2128, 2129, 2130, 2131, 2132, 2134, 2999, 3000, 3001, 3002, 3003, 3004, 3006, 3027, 3028, 3029, 3030, 3031, 3032, 3034, 3053, 3054, 3055, 3056, 3057, 3058, 3059, 3060, 3062, 3067, 3068, 3070, 3075, 3076, 3078, 3083, 3084, 3086, 3109, 3110, 3112, 3203, 3204, 3206, 3209, 3213, 3219, 3220, 3222, 3225, 3229, 3255, 3256, 3258, 3261, 3265, 3271, 3272, 3274, 3277, 3281, 6499, 6500, 6501, 6502, 6503, 7031, 7032, 7034, 7037, 7041, 7046, 7051, 7052, 7054, 7055, 7059, 7067, 7076, 7086, 7097, 7109, 7122, 7136, 7151, 7167, 7184, 7202, 7221, 7241, 7273, 7274, 8904, 8905, 8907, 9672, 9673] 2018-09-24 18:08:49,872 - utils - DEBUG - load_valid_addresses Connesso? True

SETTINGS 2018-09-24 18:08:49,873 - utils - DEBUG - cachedRead param (startreg=29, counter=20, mb_type=utf8, mb_funcall=3) 2018-09-24 18:08:49,874 - utils - DEBUG - bufferedReadRegisters param (startreg=29, counter=20, mb_type=utf8, mb_funcall=3) 2018-09-24 18:08:49,877 - utils - ERROR - 'ExceptionResponse' object has no attribute 'registers' Traceback (most recent call last): File "/home/pi/ModBus/ModbusWrapperClient.py", line 87, in readRegisters tmp = result.registers AttributeError: 'ExceptionResponse' object has no attribute 'registers' 2018-09-24 18:08:49,880 - utils - DEBUG - BUFFER empty --- 2018-09-24 18:08:49,880 - utils - DEBUG - bufferedReadRegisters param (startreg=29, counter=20, mb_type=utf8, mb_funcall=3) 2018-09-24 18:08:49,883 - utils - ERROR - 'ExceptionResponse' object has no attribute 'registers' Traceback (most recent call last): File "/home/pi/ModBus/ModbusWrapperClient.py", line 87, in readRegisters tmp = result.registers AttributeError: 'ExceptionResponse' object has no attribute 'registers' 2018-09-24 18:08:49,884 - utils - DEBUG - BUFFER empty --- Traceback (most recent call last): File "main.py", line 56, in main() File "main.py", line 25, in main value = pm._modbusRead(i) File "/home/pi/ModBus/SchneiderElectric_iEM3255.py", line 91, in _modbusRead val = self.mb.cachedRead(self.modbusmap[key][0], self.modbusmap[key][1], self.modbusmap[key][2]) File "/home/pi/ModBus/ModbusWrapperClient.py", line 315, in cachedRead regs.append(self.data_buffer[startreg - self.bufferStart + i]) TypeError: 'NoneType' object is not subscriptable

iridiu avatar Sep 24 '18 15:09 iridiu

Hi @iridiu , iEM3355 is a sibling of iEM3255 with a similar/same registry structure. My project works with Python 2.7. Pymodbus, the base of my work, is very powerful but not very verbose about error management. I think you need to investigate deeply about the communication process. You can also try to use minicom on the serial line (please note that this lock down the serial port).

lucab85 avatar Sep 26 '18 12:09 lucab85

Hi Luca,

Same python errors here ... (I'm using a PM3250, but it has the same register-set)

BTW: Is this code able to talk to a serial modbus device (via e.g. /dev/ttyUSB0) ?

Kind Regards, M_VdM.

M-VdM avatar Feb 21 '19 22:02 M-VdM