Author Topic: How to handle disconnected PLC?  (Read 1505 times)

ENA

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • ENA
How to handle disconnected PLC?
« on: June 28, 2017, 05:23:54 AM »
Hello
I'm doing a bit of a code that writes a string to PLC depending on the statuses read from the same PLC, Micrologix 1400.
I got the functionality that I wanted, but I have a problem, which occurs when AdvancedHMI looses connection to PLC, which I simulate by disconnecting the ethernet cable. The error message occurs, as seen in the attachment.

How can I handle this error, so that my application doesn't crash and resumes normal operation, after the PLC is reconnected?

ENA

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • ENA
Re: How to handle disconnected PLC?
« Reply #1 on: June 28, 2017, 06:07:16 AM »
Shortly after posting this topic, I found this thread:
http://advancedhmi.com/forum/index.php?topic=1697.msg9252#msg9252

Anyway, additional advice would be appreciated.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: How to handle disconnected PLC?
« Reply #2 on: June 28, 2017, 09:41:46 AM »
When accessing the driver via code, the rule is to always wrap your code in a Try-Catch block to properly handle any errors.