Sign in to follow this  
Followers 0
ASForrest

How to tell if an ethernet device is offline

5 posts in this topic

Hi all, I've got a program with a couple of dozen ethernet devices attached and sharing data. Most of them are other AB PLC's, so using either produced/consumed tags or a heartbeat, I can monitor the connection status. Of the ones that aren't AB PLC's, almost all have a heartbeat so I can do the same thing. But there's one measly device that doesn't. I'm after a way to monitor the connection status so I know my Servo controller is still online. Does anyone know of a way to do this? It's set up as a Generic Ethernet Module - is there something I can look at in the configuration data that will give me an status/error message or something? Thanks!

Share this post


Link to post
Share on other sites
Let's pretend you called your device "MyDevice" in the IO tree. In your PLC logic, create a GSV (Get System Value) instruction: Class Name: Module Instance Name: MyDevice Attribute Name: EntryStatus Destination: MyDeviceStatus MyDeviceStatus is an INT. If the value of MyDeviceStatus isn't 16#4000 (Hexidecimal 4000) then you can flag a connection fault. There's a bunch of possible statuses, I suggested looking at the help for the instruction. Best of luck! Edited by MrAutomation

Share this post


Link to post
Share on other sites
I'll give that a try. Is the status data not available anywhere in the configuration data? Just I'm conscious of avoiding GSV instructions where possible due to the overhead they require. Especially if I'd have to be triggering it every few seconds to continuously monitor the connection status

Share this post


Link to post
Share on other sites
Unless you are pushing your PLC to it's limits, a few GSVs shouldn't hurt anything. Any time sensitive stuff can/should go into a scheduled task anyways. If your PLC is at a state where adding GSVs causes problems, you probably should upgrade anyways. Also, triggering it every few seconds, as you mentioned, is practically an eternity in PLC time. Depending on the scan times, that's only once out of 50-100 scans.

Share this post


Link to post
Share on other sites
Thanks. My PLC has plenty of headroom at the moment. It's just that I'm creating an AOI for this device so I can drop it into any PLC later on, and I won't always know how close to the limit they're running :) if I put 5 or 6 of these devices on a machine, I'd have to be conscious of that - triggering one GSV would likely be OK, but triggering 6 in the same scan might push it over the line a little on some PLC's. What I ended up doing was clearing a status word every second. The device has one particular INT coming back where the first 8 bits are discrete info and the last 8 are a status code. So I have a BTD to extract that into a SINT to read the status code. I loaded the device's ethernet I/O tags straight into the AOI as an InOut parameter, then every second I clear the last half of the INT in the input data, which would cause the Status Code to be zero (zero is not a valid status code). I then block the BTD from executing for the next 20ms to allow the device to be polled a couple more times and restore the data, so during this time my status code holds the previous value. My RPI for the connection is 5ms, so after that 20ms, if the BTD executes again and the result comes back as a zero, I've lost at least 3 packets and I consider the device offline. Seems to be working quite well.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0