InTouch Script - Returning to primary server after failover
I have found that when having a secondary server configured as a redundant data source in Wonderware InTouch, InTouch does not automatically switch back to to my primary source after the server comes back online - is there a way to handle this?
This is certainly possible via a simple Application Script.
Two topics are set up in InTouch, the first for Data Exchange (if you are using multiple topics this solution will also work), and the second for a single heart beat tag. A tag was setup on a separate Access name, pointing to the primary TOP Server - this tag was called "HeartBeat1" - and all data exchange was through Access name "TopServer"
The script works by monitoring the Quality of the HeartBeat1 tag, and switches the machine that the data is coming from based on the the current quality.
IF (HeartBeat1.QualityStatusString <> "Good")
THEN IOSetAccessName("TopServer", "192.168.111.45", "server_runtime", "Channel1_Device1");
ELSE IOSetAccessName("TopServer", "192.168.111.64", "server_runtime", "Channel1_Device1");
ENDIF;
The script above is admittedly very simple, and in that sense inefficient. Improvements include:
- Multiple value checks could be done to check the current value of the node before changing the value
- The value of multiple access names could be changed at once
- A delay could be introduced to wait before reconnecting or checking the status of heartbeat tag