martinav (Customer) asked a question.

How to detect if network is on or off - BRX controller

Is there a way to set a switch to determine if the network is connected or not? I want to use this to show a graphic on my c-more panel that will tell the operator the network is not connected, and other things too.


  • Bolt (Customer)

    Use the PING instruction. You can ping something local on the network, such as the router, and if it fails, set a coil that the HMI uses to alert the operator. Depending on your application, you could also ping external to your network, such as google's server, for that you would have to use DNSLOOKUP first to determine the IP address to use in your PING instruction.

    Selected as Best
  • Bolt (Customer)

    Use the PING instruction. You can ping something local on the network, such as the router, and if it fails, set a coil that the HMI uses to alert the operator. Depending on your application, you could also ping external to your network, such as google's server, for that you would have to use DNSLOOKUP first to determine the IP address to use in your PING instruction.

    Selected as Best
  • PouchesInc (Customer)

    Bolt already gave you the answer you need, but I thought Id share what I do in my BRX's

     

    On the BRX I use to log temperatures at different parts of the facility for storage areas, I get time updates once an hour from an NTP server (NETTIME instruction). If the NTP instruction ever fails to reach the time server and get an update, then it triggers a PING instruction that pings the router.

    If that instruction fails to get a ping of the router, it triggers a new PING instruction to the closest network switch (all our switches are managed type and have an IP). That way I can display an error message that says specifically whether internet connectivity is down, the router is unreachable, or it cannot even connect to the closest network switch. Makes it easier for debugging a network communication problem the PLC is having.

    I suppose if the closest switch ping ever fails and this was for an actual machine with HMIs and the like, I could add something that pings the HMI, and that would tell me if local control panel network connectivity is having an issue to narrow it down even further if necessary. Though I suppose if I couldn't ping the closest near-locally attached HMI then I probably couldn't display the proper error message either...

     

    Now you may want to check for network connectivity more often than once an hour, and may not have need of so accurate time keeping in the PLC. I do a time update once an hour simply because we are required to log the temperatures at each hour. You could use the PING instruction instead of NETTIME to ping a dns server or something like that, that way you aren't spamming requests for a time update if you want to check for connectivity say every 30 seconds or so.

     

    Just an idea if you want to get into things a bit more on the programming side to make troubleshooting easier down the road.

    Expand Post