SmartGridready / SGrJava

SmartGridready communication handler in Java
Other
0 stars 0 forks source link

EasyModbus Client Library: Problem with crashing operation at first Socket Opening and during long term testing #1

Closed ChrisBroenni closed 1 year ago

ChrisBroenni commented 2 years ago

first observation: after merging 2 Easymobus drivers version into one observed on: Windows 10 occurence: always at first startup, during long term testing (hours) avoided by: pinging devices before startup. Note: first ping always fails, the 3 following are always ok,

Log at Startup:

EasyModbus Client Library Copyright (c) Stefan Rossmann Engineering Solutions www.rossmann-engineering.de

Error loading device description. communicator.common.runtime.GenDriverException: Init device failed. EasyModbus Client Library Copyright (c) Stefan Rossmann Engineering Solutions www.rossmann-engineering.de


Code Sequence:

        static void initVGT_SGCP(String aBaseDir, String aDescriptionFile ) {               

            try {   

                DeviceDescriptionLoader<SGrModbusDeviceDescriptionType> loader = new DeviceDescriptionLoader<>();
                SGrModbusDeviceDescriptionType tstDesc = loader.load(aBaseDir, aDescriptionFile);   

                GenDriverAPI4ModbusTCP mbVGT_SGCP= new GenDriverAPI4ModbusTCP();
                devVGT_SGCP = new SGrModbusDevice(tstDesc, mbVGT_SGCP); 

                mbVGT_SGCP.initDevice("192.168.1.50",502);
                _==>  call crashes in NioSocketImpl.class  Line 615, "endConnect"_
            }

Activities: To be observed Level : Relevant, must be solved before going public

ChrisBroenni commented 2 years ago

typical Timeout incident with Fronis Symo: no problem The exception is handled and operation continues (see last two lines).

Testing FroniusSymo: Caused by: java.net.SocketException: Eine bestehende Verbindung wurde softwaregesteuert durch den Hostcomputer abgebrochen at java.base/sun.nio.ch.NioSocketImpl.implWrite(NioSocketImpl.java:421) at java.base/sun.nio.ch.NioSocketImpl.write(NioSocketImpl.java:441) at java.base/sun.nio.ch.NioSocketImpl$2.write(NioSocketImpl.java:825) at java.base/java.net.Socket$SocketOutputStream.write(Socket.java:1007) at java.base/java.io.DataOutputStream.write(DataOutputStream.java:107) at de.re.easymodbus.modbusclient.ModbusClient.ReadHoldingRegisters(ModbusClient.java:1083) at de.re.easymodbus.adapter.GenDriverAPI4ModbusTCP.ReadHoldingRegisters(GenDriverAPI4ModbusTCP.java:61) ... 4 more SunspInvModel, SspID.len CurrACtot[A]: 56426496, 21365, 0.650 SunspInvModel CurrentAC [A]: 26.340, 8.820, 8.890

ChrisBroenni commented 2 years ago

Typical incident after lost socket connection: needs to be managed so far, it could obly observed using GaroWallbox

GaroWallbox: _Error reading value from device. communicator.common.runtime.GenDriverException: Read holding registers failed. communicator.common.runtime.GenDriverException: Read holding registers failed. at de.re.easymodbus.adapter.GenDriverAPI4ModbusTCP.ReadHoldingRegisters(GenDriverAPI4ModbusTCP.java:63) at communicator.impl.SGrModbusDevice.prvgetValByGDPType(SGrModbusDevice.java:281) at communicator.impl.SGrModbusDevice.getValByGDPType(SGrModbusDevice.java:209) at communicator.impl.IBTlabLoopTester.tstGaroWallbox(IBTlabLoopTester.java:462) at communicator.impl.IBTlabLoopTester.main(IBTlabLoopTester.java:130)

ChrisBroenni commented 2 years ago

12 hour test results:

RTU devices100 % OK TCP devices100 :

_--------> LOOP=15968 Exceptions: WagoMeter=0, ABBMeter=0, VGT_SCP=0, GaroWallbox=13382, FroniusSymo=14016 <--------

Testing WAGO Meter VoltageAC L1,2,3/Frequency [V,Hz]: 231.45, 0.0, 0.0, 50.0 VoltageAC L12/13/23 [V]: 231.45, 231.45, 0.0 CurrentAC L1/2/3 [V]: 0.19, 0.0, 0.0 Powerfactor tot/L1/L2/L3: 0.4, 0.4, 0.0, 0.0 ActiveEnergyAC [kWh]: 26.191, 26.191, 0.000, 26.191 ActivePowerAC [kW]: 0.018, 0.018, 0.000, 0.000 ReactivePowerAC [kvar]: 0.041, 0.040, 0.000, 0.000 ApparentPowerAC [kva]: 0.043, 0.043, 0.000, 0.000 ActiveEnerBalanceAC [KWh]: 26.191, 0.000, 26.191 ReactiveEnerBalanceAC [kvarh]: 44.109, 0.000, 44.109 PowerQuadrant tot/L1/L3/L3 : 1, 1, 1, 1 CurrentDirection L1/L3/L3 : F1, F2, F3

ABBMeter: ActiveEnerBalanceAC [KWh]: 14710.240, 39023.910, -24313.670 ActivePowerAC [KW]: -1478.980, -484.680, -490.280, -513.230 CurrentAC [A]: 2.140, 2.180, 2.490, 0.010

Testing devVGT_SGCP ReadinessState / RunState / ActualActivePower: false, true 684.700

GaroWallbox: Error reading value from device. communicator.common.runtime.GenDriverException: Read holding registers failed. communicator.common.runtime.GenDriverException: Read holding registers failed. at de.re.easymodbus.adapter.GenDriverAPI4ModbusTCP.ReadHoldingRegisters(GenDriverAPI4ModbusTCP.java:63) at communicator.impl.SGrModbusDevice.prv_getValByGDPType(SGrModbusDevice.java:281) at communicator.impl.SGrModbusDevice.getValByGDPType(SGrModbusDevice.java:209) at communicator.impl.IBTlabLoopTester.tstGaroWallbox(IBTlabLoopTester.java:461) at communicator.impl.IBTlabLoopTester.main(IBTlabLoopTester.java:121) Caused by: java.net.SocketException: Eine bestehende Verbindung wurde softwaregesteuert durch den Hostcomputer abgebrochen at java.base/sun.nio.ch.NioSocketImpl.implWrite(NioSocketImpl.java:421) at java.base/sun.nio.ch.NioSocketImpl.write(NioSocketImpl.java:441) at java.base/sun.nio.ch.NioSocketImpl$2.write(NioSocketImpl.java:825) at java.base/java.net.Socket$SocketOutputStream.write(Socket.java:1007) at java.base/java.io.DataOutputStream.write(DataOutputStream.java:107) at de.re.easymodbus.modbusclient.ModbusClient.ReadHoldingRegisters(ModbusClient.java:1083) at de.re.easymodbus.adapter.GenDriverAPI4ModbusTCP.ReadHoldingRegisters(GenDriverAPI4ModbusTCP.java:61) ... 4 more

Testing FroniusSymo: Error reading value from device. communicator.common.runtime.GenDriverException: Read holding registers failed. communicator.common.runtime.GenDriverException: Read holding registers failed. at de.re.easymodbus.adapter.GenDriverAPI4ModbusTCP.ReadHoldingRegisters(GenDriverAPI4ModbusTCP.java:63) at communicator.impl.SGrModbusDevice.prvgetValByGDPType(SGrModbusDevice.java:281) at communicator.impl.SGrModbusDevice.getValByGDPType(SGrModbusDevice.java:192) at communicator.impl.SGrModbusDevice.readValue(SGrModbusDevice.java:152) at communicator.impl.SGrModbusDevice.getVal(SGrModbusDevice.java:91) at communicator.impl.IBTlabLoopTester.tstFroniusSymo(IBTlabLoopTester.java:551) at communicator.impl.IBTlabLoopTester.main(IBTlabLoopTester.java:122) Caused by: java.net.SocketException: Connection reset by peer at java.base/sun.nio.ch.NioSocketImpl.implWrite(NioSocketImpl.java:421) at java.base/sun.nio.ch.NioSocketImpl.write(NioSocketImpl.java:441) at java.base/sun.nio.ch.NioSocketImpl$2.write(NioSocketImpl.java:825) at java.base/java.net.Socket$SocketOutputStream.write(Socket.java:1007) at java.base/java.io.DataOutputStream.write(DataOutputStream.java:107) at de.re.easymodbus.modbusclient.ModbusClient.ReadHoldingRegisters(ModbusClient.java:1083) at de.re.easymodbus.adapter.GenDriverAPI4ModbusTCP.ReadHoldingRegisters(GenDriverAPI4ModbusTCP.java:61) ... 6 more

ChrisBroenni commented 2 years ago

GaroWallbox incident;

line before exception: ==> nioSocketImpl.class, line 405: _/**

ChrisBroenni commented 1 year ago

For Java source, this problem is solved by exception handling improvement