Author Topic: ModbusTCP Error handling in bad network latencies  (Read 2758 times)

sts69

  • Newbie
  • *
  • Posts: 18
    • View Profile
ModbusTCP Error handling in bad network latencies
« on: September 23, 2013, 09:08:47 PM »
Hi,

can be compensated with simple adjustments in the ModbusTCP driver poor latencies of the network?
Often there are error messages in the buttons and Displays :-(
I have at the moment 600ms polling intervals (less would be bad).

THX
Steffen

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: ModbusTCP Error handling in bad network latencies
« Reply #1 on: September 24, 2013, 07:30:38 AM »
Are you doing any read/writes in code? If so, is any of it on background threads? About how many addresses are you accessing? Do you have multiple instances of the driver, like multiple forms with a driver on each form?

Even on really slow networks, 600ms should be easily handled. There may be something else in the code the driver doesn't agree with. The Modbus driver hasn't been upgraded yet to be thread safe, so there are situations that can give it problems.

sts69

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: ModbusTCP Error handling in bad network latencies
« Reply #2 on: September 24, 2013, 01:28:01 PM »
I read 16 digital Inputs and 16 Register (Counters) and i read/write 8 coils. I m not write any code in Background. My Lan is very old (Thin Ethernet). The Modbusdriver has one Instance in one Form only.
I suppose the connection sometimes breaks off and is not automatically rebuilt. after a restart then goes again for some time.

thanks for Help
Steffen

TSLJon

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: ModbusTCP Error handling in bad network latencies
« Reply #3 on: September 25, 2013, 02:30:05 AM »
Hi Steven, yes I have the same problem getting Com Fail 20 after a while. I do monitor directly through the internet to the devices though. I've been giving it some thought myself as you say when you reset/reload the form it is fine for a while. I've tried a button with refresh but no joy.

My thoughts are to try and make it when it sees Com Fail 20 to auto reset that individual PLC value.... But i'm not quite sure how to do it.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: ModbusTCP Error handling in bad network latencies
« Reply #4 on: September 25, 2013, 09:57:47 AM »
The ModbusTCP driver was developed mostly on a simulator, so it never really got the rigorous testing of network dropouts and missed packets. As soon as I get the opportunity, I'll run it through some tests to try to duplicate bad network conditions to see if I can track down why it doesn't seem to recover properly.

sts69

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: ModbusTCP Error handling in bad network latencies
« Reply #5 on: September 25, 2013, 11:23:13 AM »
@ TSLJon,
yes, this is the Error (Com Fail 20).

@ Archie,
on the Simulator is all very good.
I will be testing with a better network, but a fault tolerant driver would certainly be good :-)

vielen dank für das super programm!
Steffen

TSLJon

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: ModbusTCP Error handling in bad network latencies
« Reply #6 on: September 26, 2013, 02:54:45 AM »
Hi Archie, thank you. Happy to contribute towards a separate ModbusTCP donation pot if that helps?

Or can log Wireshark if needed on my live network. As we pull directly through the internet I am going to put some traffic prioritisation on the routers as well.

Really pleased with AdvancedHMI :)

TSLJon

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: ModbusTCP Error handling in bad network latencies
« Reply #7 on: September 27, 2013, 09:48:33 AM »
I'm unsure of the code to restart the process but at Line 420 of ModbusTCPCom.vb as shown below:

Code: [Select]
Else
            Throw New MfgControl.AdvancedHMI.Drivers.Common.PLCDriverException("Com Fail - " & result)
        End If

Could be not get it to simply just resubmit the request? As in go back to the start?