Author Topic: Multiple Ethernet Drivers in a single form  (Read 3182 times)

aduhaime2003

  • Newbie
  • *
  • Posts: 36
    • View Profile
Multiple Ethernet Drivers in a single form
« on: December 23, 2015, 02:32:25 PM »
Within my project I have 10 chambers each with a PLC located on them (micro800).  Currently I am in the process of testing the configuration but have been running into various errors since I have added the additional Ethernet drivers.  There is an exception thrown but no information that I am aware of can help me diagnose it.  I was using multiple windows and with 2 open the system crashes, pointing at one of the variables being read on the second page but if I let the initial page sit open it will crash on its own after a time period.

Is there a limitation and I cannot think of a better way to multiplex the functionality of what I am doing.  As a background the process is the following.

1.  Data is logged within the PLC at an interval and it is also event driven.
2.  New data is placed in a circular queue.
3.  When the queue has new data within it the oldest data is placed in a data buffer and a bit  called "newData" is set.
4.  Advanced hmi checks the newdata bit every few seconds. 
5.  If there is new data the data buffer is read by advanced hmi and it is written to a sql database and the new data bit is unset.
6.  Cycle repeats.

I currently have the system set up to do this reading 1 plc.  I have tried adding multiple instances of the Ethernet driver as well as multiplexing a current Ethernet driver by setting the ip address, reading, incrementing after analyzing the read and repeating.  Both give me a exception thrown.  IT is an exception in the beginRead function {"Send que full, data request too fast or may have lost connection."}.

Any thoughts?  I am not sure which way is better and if I am just experiencing a glitch or I am doing something completely wrong.

Art

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Multiple Ethernet Drivers in a single form
« Reply #1 on: December 23, 2015, 03:36:42 PM »
Why are you using BeginRead as opposed to Read? If you use BeginRead, it is up to your code to watch the DataReturned and throttle your reads as to not overload the communications. The VB program can request a read within a fraction of a millisecond. The PLC usually takes 5-10ms to respond. If you use BeginRead in a loop or many back to back, it wiil quickly overflow the buffer.

bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
Re: Multiple Ethernet Drivers in a single form
« Reply #2 on: December 23, 2015, 03:54:34 PM »
It also sounded like he is using a timer to check the trigger bit.  I use Datasubscriber and set its trigger bit, once it see the DataChanged, then I do a BeginRead(DataArray[0], 11), then in DataReceived, I set the DataArray[0], DataArray[1].... to SQL column names and send it to SQL server

Archie, can Read do array too?
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Multiple Ethernet Drivers in a single form
« Reply #3 on: December 23, 2015, 05:09:48 PM »
can Read do array too?
Read can do everything that BeginRead does. In fact, Read uses the BeginRead, but waits for a reply before returning.

aduhaime2003

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: Multiple Ethernet Drivers in a single form
« Reply #4 on: December 25, 2015, 03:52:36 PM »
I guess it comes down to the fact that I don't know the difference in using read in beginread.  I thought they were interchangeable and the resultant is I write a request for tread/beginread and then have a associated if statement in the datarecieved section.  I must be missing something...

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Multiple Ethernet Drivers in a single form
« Reply #5 on: December 25, 2015, 08:40:40 PM »
The Read is synchronous and will not return until the data is returned from the PLC. For example:

Dim MyTagValue as string = EthernetIPforCLXCom1.Read("MyTag")


BeginRead is asynchronous and only returns a reference number. The data is then returned in the DataReceived event. Since BeginRead does not wait to return, it will queue the read. If too many reads are requested without a delay, that queue will fill up and throw the exeception.

aduhaime2003

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: Multiple Ethernet Drivers in a single form
« Reply #6 on: December 28, 2015, 04:49:26 PM »
I found that it was actually a fundamentally flawed driver.  I believe during another debug session I must have accidentally deleted some code from the driver.  Once I removed all drivers and updated them with the current versions I downloaded everything went back to working. 

As far as the read/ begin read differences I see now that I am using the correct ones for some but other areas would be better suited to a read function.  Thanks for the assistance.