TN - 1398 Determining Active Communications Server
Description
This article from InSource shows.......
- Author: Frank Ross
- Published: October 2023
- Applies to: InTouch
Details
This article provides a solution to determining which server, in a redundant communications server pair, is the active communications server.
Scenario
The InTouch HMI Application is running on both primary and backup servers with only server operating as the active server. The other server is in a standby mode in case of server failure. The HMI Application is writing back to the PLC(s) on a periodic basis. To prevent the HMI Application from writing back to the PLC(s) from both the active and standby server, the application must determine which server is the active server. The goal is only write back to the PLC(s) from one server and not both servers. This could be further exacerbated if Application is running in a Thin Client configuration.
Solution
IOGetAccessNameStatus() Function
The IOGetAccessNameStatus() script function returns an integer indicating the connection status of the primary, secondary, or active I/O source of an Access Name. Typically, the IOGetAccessNameStatus() return value is associated with an integer tag. The value of the tag can drive a discrete value display animation link that shows the status of the Access Names’s active, primary, and secondary I/O sources to an operator.
Syntax
Result=IOGetAccessNameStatus("AccessName", Mode);
Arguments
AccessName --> The existing Access Name for which to return the status.
Mode--> The value assigned to this argument determines what Access Name of the failover pair is queried about its current status.
- 0 - Status of the active Access Name I/O source
- 1 - Status of the Access Name primary I/O source
- 2 - Status of the Access Name secondary I/O source
Example (Status of the Access Name PLC1 Primary I/O Source)
DIM ActiveCommServer AS INTEGER;
ActiveCommServer = IOGetAccessNameStatus("PLC1", 1);
LogMessage("ActiveCommServer = " + StringFromIntg( ActiveCommServer, 10));
Usage Recommendations
Script placement for using the IOGetAccessNameStatus Function should be coded in the same script prior to writing data to the PLC(s)
Also recommended to create a Memory Integer Tag to store the result of the function vs. using the DIM statement.