Auto Reconnect PLC after Loss of Connection in OPC Server

Updated Nov 10, 2020



  • OPC Servers

I am using NI OPC Server to communicate with my PLC through COM port. Every time when I unplug the COM cable and then plug it back to my PLC, the communication between PLC and NI OPC Server fails, so I have to manually reconnect or restart NI OPC Server to establish the communication again.

Is there a way to automatically re-establish the connection after communication fails in NI OPC Server?

In the OPC Servers Configuration, there is a setting called "Auto-Demotion" in the Device Properties as shown in Figure 1 below.

Figure 1
Tick the option box "Enable auto device demotion on communication failures", then your can set how many successive failures would trigger the demotion and how long you want the device to be demoted for.

Once the Auto-Demotion is enabled, the device will be demoted every time when there are a certain number of successive communication failures happened depending on your settings. When the demotion period is over, the device will then be auto-promoted to determine if the communications can be re-established again.

Therefore, the OPC Server will cycle between demoting and promoting the device until the connection is restored.

Additional Information

In the Timing settings of the Device Properties as shown below in Figure 2, you can set the timeout length and how many successive timeouts would be considered a communication failure.

Figure 2