Author Topic: How to Avoid PLC and PC timeouts  (Read 3155 times)

paintman

  • Newbie
  • *
  • Posts: 17
    • View Profile
How to Avoid PLC and PC timeouts
« on: February 28, 2024, 03:28:51 PM »
Hello,

I am using advancedhmi v35 and visual studio 2022, I wrote a VB.net script to continuously monitor data on the PLC (a GuardLogix 5380 Safety Controller). It works very well, but we run into an issue where the line will go on break for lunch etc and during that time the HMI says it has lost connection to the PLC. I am connected through an EhternetIPforCLXCom connection, I even setup a counter function that continuously runs to keep the EthernetIPforCLXCom1_DataReceived sub active; however, it still times out and when the line is started back the HMI never reconnects. Is there a better way to perform a handshake to allow the PC and PLC to not lose the connection between the two?
I though about creating a section on the PC that will reset the counter when it reaches a certain level. Any advice would be greatly appreciated.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: How to Avoid PLC and PC timeouts
« Reply #1 on: February 28, 2024, 04:08:32 PM »
Are you using v3.99x or 3.99y ?

How are you reading data in the code? Read or BeginRead? How frequently are you reading?

paintman

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: How to Avoid PLC and PC timeouts
« Reply #2 on: February 29, 2024, 08:42:38 AM »
Are you using v3.99x or 3.99y ?

How are you reading data in the code? Read or BeginRead? How frequently are you reading?

I am using 3.99y, as for reading the data im not utilizing either of those (im fairly new to vb in general). I am just using the mydriver.read/write to pull the information from the plc. So it just reads during each scan cycle. Would begin read be better?

Currently in the operation when it sees a release bit it goes through a few nested if loops then will write the data to a text file which is linked to a list view and it its a part number its never seen before itll write the information to the PLC array

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: How to Avoid PLC and PC timeouts
« Reply #3 on: February 29, 2024, 09:19:33 AM »
BeginRead is an asynchronous command which takes a lot more overhead to use. I would only use it if you need non-blocking code.

If you are just monitoring values for change, I would use the DataSubscriber


paintman

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: How to Avoid PLC and PC timeouts
« Reply #4 on: February 29, 2024, 10:02:39 AM »
Does the datasubscriber work for multiple PLC tags or is it for a single tag per subscriber? Currently the most important one I am trying to read is an array of tags with 8 elements to each tag.

Or would it be best to just setup the data subscriber to read the stop release bit and then run the full sequence of code?

Also does the datasubscriber read two way changes? Like if the bit changes from 0 to 1 it runs the sequence then when it changes back from 1 to 0 it reads again?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: How to Avoid PLC and PC timeouts
« Reply #5 on: February 29, 2024, 10:36:16 AM »
The DataSubscriber2 allows you to setup multiple tags in a single DataSubscriber2. It will fire on changes in both directions.

paintman

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: How to Avoid PLC and PC timeouts
« Reply #6 on: February 29, 2024, 11:18:57 AM »
Awesome, for my situation with the array, it may be Paintpart[23] and the associated elements, or [65] depending on the carrier number at the station. With the data subscriber it looks like I can only call specific tags and not have a variablized tag. Would I need to just call the base name Paintpart then specific the actual tag location later in the code?

ps sorry for asking so many questions

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: How to Avoid PLC and PC timeouts
« Reply #7 on: February 29, 2024, 02:14:26 PM »
You should be able to do a PLCAddress of PaintPart[0] and NumberOfElements of 65 (or greater). Then use e.Values(x) to access each array element,

paintman

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: How to Avoid PLC and PC timeouts
« Reply #8 on: April 02, 2024, 12:58:56 PM »
Hey Archie, I know this is an old thread but I had to take a step back for other projects.

I don't think I fully understand the way the elements, plcaddressitems, and e.values would work. Does e.values report single values based on the elements?
So we have 85 carriers on our line that pass through a scanner to tell us which one it is (they are not in order)
So in my code it would be Carrier_Info[Stop_1.Carrier_Number] as the main tag and then the elements follow would be paint_color, name, oven_cycle and so on.

So would I need to just define 85 plcaddress items each with 8 elements and then still use the carrier number variable to define the e.value?