Replies: 3 comments
-
Since pylogix will implicitly make the connection on the first attempt to read a tag value, I would just do that. If the read is successful then you could continue. If not you could initiate a timeout and then try again. Someone else may know of a better way, but this method has worked for me. |
Beta Was this translation helpful? Give feedback.
-
I agree, I just read and check if .Status == "Success". If you don't like that, and there may be good reasons why you don't, then use GetPLCTime(), check that the status was Success. |
Beta Was this translation helpful? Give feedback.
-
If you're looking for code help, something like this should get you started: Keeping in mind that this isn't solely checking for a connection, but a successful read. GetPLCTime() being successful basically means the connection is good, an unsuccessful read doesn't necessarily mean that the connection is bad. It could be a typo in the tag name, tag external access set to None, etc. |
Beta Was this translation helpful? Give feedback.
-
Hi all,
Before I start a tag reading thread that runs at 10hz I would like to prove the PLC connection. The thread is saving mission critical data from the PLC to a historian.
If the proof of connection fails I would like to timeout for 10 seconds before trying again.
Any thoughts on how to prove the PLC connection?
How do you guys handle this?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions