Introduction


Applies to WIN-911 3.18.14 and newer.


WIN-911 can indicate its operational status by writing a incrementing value to an InTouch tag, we call this function a 'Heartbeat' as it provides a 'vital-sign' to an InTouch Application.

The Heartbeat writes an incrementing value (0 - 9) to an Integer tag on a defined Write Interval. Once the Heartbeat reaches 9, it rolls back to zero, and the process is repeated. If the tag fails to update, you can assume that WIN-911 has lost the connection to InTouch and is no longer able to receive alarm event information.


The WIN-911 InTouch Data Source utilizes a combination of the Wonderware Alarm Toolkit and SuiteLink to integrate with InTouch applications. The Heartbeat writes to an InTouch tag via SuiteLink. The Alarm Toolkit connection is used to receive alarms from an InTouch application. Meaning, a successful heartbeat indicates a healthy SuiteLink connection but not necessarily a healthy alarm connection. As a result we've added a Heartbeat Suspension option which will suspend the Heartbeat if alarm activity is not detected on a defined tag.


In order to use the Heartbeat Suspension feature, you will need to create a tag in InTouch which goes in and out of alarm. You can then set WIN-911 to monitor the tag for a changing alarm state, if an alarm is not detected within a defined timeout period, the Heartbeat will be suspended. Once alarm activity has been detected on the tag, the heartbeat will resume.



Setting Up the Heartbeat


The WIN-911 Heartbeat requires an Integer tag; you will need to create a tag in your InTouch application. For the purposes of this document, we will be using a Memory Integer tag. 


Create Heartbeat Tag

  • Open your InTouch application with WindowMaker
  • From the menu bar, select Special -> Tagname Dictionary
  • Click the New button
  • Set Tagname to win911heartbeat (you can use any name you like)
  • Click the Type button and select Memory Integer from the list
  • Click the Save button






Enable Heartbeat 

  • Open WIN-911 Workspace from the Start menu
  • Navigate to Alarming -> InTouch -> Applications
  • Select the Application you'd like to edit and click the edit icon on the bottom right
  • Select the Heartbeat tab
  • Check Enable Heartbeat
  • Enter "win911heartbeat" for the Tagname
  • Set Write Interval to 1 minute
  • Click the Save button





You will need to create a tag which goes in and out of alarm automatically. First we'll create the tag, in a following section we'll use a script to automatically change the value.

Create Heartbeat Suspension Tag

  • Open your InTouch application with WindowMaker
  • From the menu bar, select Special -> Tagname Dictionary
  • Click the New button
  • Set Tagname to heartbeatsuspension (you can use any name you like)
  • Click the Type button and select Memory Discrete from the list
  • Select the Details & Alarms radio button
  • Select On for Alarm State
  • You may wish to set the alarm to a low priority in order to filter the alarm from your Alarm Summary later
  • Click the Save button





Enable Heartbeat Suspension 

  • Open WIN-911 Workspace from the Start menu
  • Navigate to Alarming -> InTouch -> Applications
  • Select the Application you'd like to edit and click the edit icon on the bottom right
  • Select the Heartbeat tab
  • Check Enable Heartbeat Suspension
  • Enter "heartbeatsuspension"
  • Set Timeout to 2 minutes
  • Click the Save button

Create Scripts


We need to create a total of 3 scripts. The first is a Data Change script triggered by $Minute which increments a heartbeatcounter tag and changes the value of the heartbeatsuspension tag we created earlier. The second, also a Data Change script, will reset the heartbeatcounter tag to 0 whenever WIN-911 writes to the win911heartbeat tag. The final script will be used to take an action once the heartbeat fails. 


Counter and Alarm Script

  • Open your InTouch project in WindowMaker
  • From the menu bar, select Special -> Scripts -> Data Change Scripts...
  • Enter $Minute for the Tagname
  • Paste the following for the script
    heartbeatcounter=heartbeatcounter+1;
    
    IF heartbeatsuspension == 0 THEN
        heartbeatsuspension = 1;
    ELSE
        heartbeatsuspension = 0;
    ENDIF;
  • Since we did not previously define the heartbeatcounter tag, InTouch will offer to create it for you. Accept the default tag it creates.
  • Click OK

Heartbeat Script

  • Open your InTouch project in WindowMaker
  • From the menu bar, select Special -> Scripts -> Data Change Scripts...
  • Enter win911heartbeat for the Tagname
  • Paste the following for the script
    heartbeatcounter=0;
  • Click OK

Action Script

  • Open your InTouch project in WindowMaker
  • From the menu bar, select Special -> Scripts -> Condition Scripts...
  • Paste the following for the Condition
    heartbeatcounter > 1
  • Since the Heartbeat script is resetting the heartbeatcounter to 0 when there is an update from WIN-911, if the heartbeatcounter reaches 2, InTouch hasn't received an update in 2 minutes. You can raise this threshold higher if want to give WIN-911 more time to re-establish the connection.
  • You can use the script to take some action of your choosing. For example, pop up a Window or change a tag value.
  • Display a Window
    Show "EnterWindowNameHere";


  • Change InTouch Tag
    WIN911_Faulted = 1
    • If you choose to change a tag value, you may wish to set your tag back to 0 in the Heartbeat Script
  • Click OK

Testing the Heartbeat


Once you have completed the steps in the article, you should have a functioning heartbeat. Start WindowViewer, WIN-911 will connect and start writing with the Heartbeat. You can test your scripts by shutting down the WIN-911 InTouch Data Source. If your Action Script is triggered after about 2 minutes, you know your scripts are working properly. If you have any questions, please contact the Product Support team.