

|
|
|
Automatic Acknowledgment of Alarms in Industrial Application Server 2.0
A number of customers have asked how to
utilize automatic acknowledgement of “Return to
Acknowledgement of alarms in Industrial Application server outside of the alarm engine is handled by writing a message to the ".AckMsg" field of the alarm instance. In other words, if an AlarmViewer ActiveX control shows TIC101.Hi in any alarm state then writing a message to TIC101.Hi.AckMsg attribute acknowledges the alarm.
The proper procedure, in this case, is to then write a script in Intouch that provides the same functionality. Because InTouch is a client to Industrial Application Server, writing to the .AckMsg attribute will be seen by the object as a user writable function. Before digging into the code, a few things should be noted:
1.) This Script requires three tags to be created: two memory messages, called "name_of_tag" and “AlarmState,” and an I/O Message called “Dynamic_Tag_To_Ack.”
2.) This Script is created utilizing the AlarmViewerCtrl ActiveX object. The script provided below will not work if the application is using legacy Distributed Alarm Object (DAO) also provided in Intouch. The AlarmViewerCtrl ActiveX can be created in Intouch by opening up the Wizard Selector, and selecting “AlarmViewerCtrl” from the “ActiveX Controls” section of the selector.
Figure 1: The AlarmViewerCtrl ActiveX Selection
3.) This script must be written for every AlarmViewerCtrl ActiveX in your application. In other words, if an application has two AlarmViewerCtrl ActiveX objects, two instances of this script must be used for each ActiveX. This script can be put into the window/while showing script that the ActiveX resides on, keeping in mind that the script should not be run extremely often (1000-5000 milleseconds should suffice) as it could affect system performance.
Now that those points have been noted, the following code represents a script that will automatically acknowledge “Unacknowledged Return” alarms created by Industrial Application Server.
{----------------------------------------------------}
{Instantiate local variable for loop counters}
Dim Loop_ctr as integer;
{Initialize the loop counter}
Loop_ctr = 1;
{Get the total alarms from the Control}
AlarmViewerAlarms = #AlarmViewerCtrl1.TotalAlarms;
{Loop through each alarm to see if it is unack_rtn}
FOR Loop_ctr = 1 TO (AlarmViewerAlarms - 1)
AlarmState = #AlarmViewerCtrl1.GetItem(Loop_ctr, "State");
{If the tag is unack_return, acknowledge the selected tag with the time and date}
IF AlarmState == "UNACK_RTN" THEN
Name_of_Tag = #AlarmViewerCtrl1.GetItem(Loop_ctr, "Name");
#AlarmViewerCtrl1.SelectTag ("\Intouch", "$System", Name_of_Tag,1, 999);
#AlarmViewerCtrl1.AckSelectedTag (Name_of_Tag);
{Loop to ensure reference is confirmed}
{Send message to .MsgAck galaxy attribute}
Dynamic_Tag_to_Ack.Reference= "Galaxy." + Name_of_Tag + ".AckMsg";
Dynamic_Tag_to_Ack = "Returned at " + $DateString + " " + $TimeString;
ENDIF;
NEXT;
{-----------------------------------------}
The script works in the following path: Each time the script is run, the system loops through each alarm present on the particular activeX object. If the current alarm in the loop’s state is “UNACK_RTN”, or unacknowledged return, the script gets the name of the alarm from the ActiveX control, highlights the entry, and then acknowledges the attribute on the InTouch side. Meanwhile, it dynamically assigns the .AckMsg attribute to the I/O message tag created, and writes a message saying that it was returned at the current date and time. This then resets the alarm state of the object attribute. The script continues this procedure for every alarm shown in the ActiveX object.
Using this script within InTouch for each of your ActiveX Alarm Viewers, the user will be able to automatically acknowledge “Unacknowledged Return” alarms created by Industrial Application Server. In addition to the code above, attached to this document is a sample set of objects, as well as a sample InTouch application that demonstrates how to apply this code. For instructions on how to install and run this demonstration application, please refer to the next section.
Download the AlarmAckDemo: .zip (1085 kb)
AlarmAck Demo Installation Guide:
Figure 2: The AlarmAck Demo InTouch Window
The AlarmAck Demo comes supplied with two files: AlarmAck.zip, which contains the InTouch application “AlarmAckDemo”, and AckDemo_Objects.aaPKG, an AutomationObject export that contains the objects necessary to install into your galaxy. This demo requires InTouch 9.0 P02 or higher, as well as Industrial Application Server 2.0 P01 or higher.
Installing the Automation Objects
To import the objects, open up the IDE to the target galaxy. From the File menu, select import/automation Objects, then browse to the aaPKG file and click ok. Set the migration mode to “Migrate”. The import will bring in the following:
- 1 Template, named “QDemo_AnalogAlarm” - 1 Area, named “AlarmArea” - 2 AutomationObjects, named “AnalogAlarm_001” and “AnalogAlarm_002”
By default, these objects will either be placed in the “Unassigned Area” or in your default area, if there is one selected in the target galaxy. Before deploying these objects, be sure of these two points:
1) The platform that you are deploying to has the “Intouch Alarm Provider” checked, and if your alarm group section is not blank, the area “AlarmArea” is included in your alarm group list.
Figure 3: The Alarm Provider selection in the IAS Platform Object
2) The AutomationObjects imported must be deployed as being hosted by the “AlarmArea” in the Model/Deployment View (if hosted in the Model, it is hosted in the deployment as well, only one drag is necessary).
Figure 4: Example of how the imported objects should be hosted
Now, deploy the objects, and the demonstration logic has started. To run the InTouch app, simply open the application in runtime. You may need to resize the application to your current resolution. This will require a development license in order to do so. Other than that minor change, the InTouch application requires no configuration.
The demo simply loops each of the two objects between 30 and 90, incrementing the value of each object by 10 every second (for advanced users who would like to see the simple script driving this simulation, feel free to check out the “Alarm” script in the QDemo_AnalogAlarm template). There are alarms set for both objects, a Lo alarm at 30 and a High alarm at 70. The script that automatically acknowledges the alarm is a window/while showing script running every 1000 ms. Keep in mind tht this is, for getting rid of unack_rtn alarms, a bit aggressive in speed. If the target application generates numerous unack_rtns very often, it would be advantageous to ratchet the occurrence of this script down, as it will eventually affect performance of the application as a whole if run too often. While the script is identical to what is printed in this document, to see the script in InTouch, simply open the application in WindowMaker, open the “Alarm Demo” window, select Window Properties (Ctrl+W), and open up the Window Scripts. Again, this requires a development license to open up the application in Development Mode. To learn more, feel free to contact our technical support team!
|
|
©2003 Q-mation, Inc. All rights reserved. All trademarks are the property of their respective owners. |