Introduction


Applies to WIN-911 3.18.14 and newer.


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

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


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


In order to use the Heartbeat Suspension feature, you will need to create an attribute in System Platform 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 attribute, the heartbeat will resume.



Setting Up the Heartbeat


The WIN-911 Heartbeat requires an integer attribute; you will need to create the attribute in your Galaxy. For the purposes of this document, we will be defining memory attributes in a $UserDefined object.


Create $UserDefined Object 

  • Open your Galaxy in the ArchestrA IDE
  • Create a new $UserDefined object by dragging the $UserDefined template from the Template Toolbox into the Unassigned Area in the Model pane
  • Name the object "WIN911" and assign it to an Area of your choosing. 
    • You must assign the object to an Area that WIN-911 is monitoring











Create Heartbeat Attribute

  • Open the WIN911 object you created in the previous step
  • From the Attributes tab, select the Add button to create a new Attribute and match the following parameters
    • Name: Heartbeat
    • Data Type: Integer
    • Writeability: User writeable
  • Click the Save button

Enable Heartbeat 

  • Open WIN-911 Workspace from the Start menu
  • Navigate to Alarming -> System Platform -> Galaxies
  • Select your Galaxy and click the edit icon on the bottom right
  • Select the Heartbeat tab
  • Check Enable Heartbeat
  • Enter "WIN911.Heartbeat" for the Attribute
  • Set Write Interval to 1 minute
  • Click the Save button





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

Create Heartbeat Suspension Attribute 

  • Open the WIN911 object you created in a previous step
  • From the Attributes tab, click the Add button to create a new Attribute and match the following parameters
    • Name: HeartbeatSuspension
    • Data Type: Boolean
    • Writeability: User writeable
  • Click State alarm button to enable alarming
  • 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 -> System Platform -> Galaxies
  • Select your Galaxy and click the edit icon on the bottom right
  • Select the Heartbeat tab
  • Check Enable Heartbeat
  • Enter "WIN911.HeartbeatSuspension" for the Attribute
  • Set Timeout to 2 minutes
  • Click the Save button



Create Scripts


We need to create a total of 3 scripts. The first is a Periodic script set to run every minute, it increments a HeartbeatCounter attribute and toggles the value of the HeartbeatSuspension attribute we created earlier. The second is a Data Change script, which resets the HeartbeatCounter attribute to 0 whenever WIN-911 successfully writes to the Heartbeat attribute. The final script will be used to take an action once the heartbeat fails. 


Counter and Alarm Script

  • Open the WIN911 object you created in a previous step
  • Create a new integer attribute called HeartbeatCounter, make sure you save it.
    • You can accept the default settings, no alarming is needed for this attribute.
  • Select the Scripts tab
  • Click the blue Add button on the top left
  • Enter Heartbeat_Counter and hit <ENTER>
  • Set Trigger type to Periodic
  • Set Trigger period to 00:01:00.0000000
  • Paste the following for the script
    WIN911.HeartbeatCounter=WIN911.HeartbeatCounter+1;
    
    IF WIN911.HeartbeatSuspension == 0 THEN
        WIN911.HeartbeatSuspension = 1;
    ELSE
        WIN911.HeartbeatSuspension = 0;
    ENDIF;
  • Click the Red Check button to validate the script
  • If the script is validated, click the Save button

Heartbeat Script

  • From the Scripts tab in the WIN911 object, click the blue Add button to create a new script
  • Enter Heartbeat_Reset for the name and hit <ENTER>
  • Set Expression to WIN911.Heartbeat
  • Set Trigger type to Data Change
  • Paste the following for the script
    WIN911.HeartbeatCounter = 0;
  • Click the Red Check button to validate the script
  • If the script is validated, click the Save button

Action Script

  • From the Scripts tab in the WIN911 object, click the blue Add button to create a new script
  • Enter Heartbeat_Failed for the name and hit <ENTER>
  • Set Expression to WIN911.HeartbeatCounter>1
  • Set Trigger type to OnTrue
  • Since the Heartbeat_Reset script is resetting the WIN911.HeartbeatCounter to 0 when there is an update from WIN-911, if the WIN911.HeartbeatCounter reaches 2, System Platform hasn't received an update in 2 minutes and this script will trigger. 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, change another attribute's value.
  • Change Attribute Value
    • Create a new Boolean attribute named "Heartbeat_Fault" and enable the State alarm
    • Set your script to change the value of the attribute to true or 1
      WIN911.Heartbeat_Faulted = 1
    • If you choose to change an attribute value, you may wish to set your attribute back to 0 in the Heartbeat Script to reset the alarm
  • Save your changes

Testing the Heartbeat


Once you have completed the steps in the article and you've deployed the WIN911 object, you should have a functioning heartbeat. You can test your scripts by shutting down the WIN-911 System Platform Runtime . 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.