Author Topic: Erratic data update with multiple devices on same IP  (Read 1243 times)

MrPike

  • Sr. Member
  • ****
  • Posts: 297
    • View Profile
Erratic data update with multiple devices on same IP
« on: January 20, 2015, 03:13:25 PM »
Hi, Im connecting to two devices via an ethernet gateway using ModbusTCP. IP is 172.16.0.2 for device1= id1 and device2=id2.  What Im experiencing is very inconsistant data update the second or third time the page is opened.  Usually(not always) the data seems to update just fine the first time the page is opened.  However if the page is closed and then reopened a couple minutes later the data doesnt update or does so very slowly(minutes later).  I can tell right away if the data will update by viewing the Tx & Rx lights on the gateway.  When data is updating these lights blink rapidly in unison as they should but they blink very slow and erratic when the data doesnt update.  There is no way for me to view the data on the downstream side of the gateway but i took a couple Wireshark captures.  I am not well versed with decipering data captures but I did notice that sometimes only 2 or 3 words are requested by AHMI according to wireshark.  Dont know if this is normal but I would assume it would poll all 10 at a time.  Poll rate is 1000ms(I tried 300-1500ms with same results).  both captures show when the data is not being updated, one after a couple minutes to reopen the page and the other is on initial page opening.  I removed the second device and noticed that data is updated fine everytime.  Any ideas?  Thanks in advance 

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Erratic data update with multiple devices on same IP
« Reply #1 on: January 21, 2015, 09:16:53 AM »
Are the pages being hidden or closed?

MrPike

  • Sr. Member
  • ****
  • Posts: 297
    • View Profile
Re: Erratic data update with multiple devices on same IP
« Reply #2 on: January 21, 2015, 09:50:03 AM »
I am using the FormChangeButton to switch pages.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Erratic data update with multiple devices on same IP
« Reply #3 on: January 21, 2015, 10:11:02 AM »
The FormChangeButton hides the forms. On your additional forms, did you put the code snippet that is part of the MainForm:


     '*******************************************************************************
    '* Stop polling when the form is not visible in order to reduce communications
    '* Copy this section of code to every new form created
    '*******************************************************************************
    Private Sub Form_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.VisibleChanged
.
.
.
.
.
[/color]

MrPike

  • Sr. Member
  • ****
  • Posts: 297
    • View Profile
Re: Erratic data update with multiple devices on same IP
« Reply #4 on: January 21, 2015, 10:29:25 AM »
Yes I have that code on all pages. One thing to mention is I am polling the same device on different pages but not at the same time. I'm not sure if this is causing some of the trouble

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: Erratic data update with multiple devices on same IP
« Reply #5 on: January 21, 2015, 06:55:43 PM »
I don't see anything abnormal in the Wireshark capture. Do you see any messages in the Output Window in Visual Studio?