Applies To:
  • CitectSCADA v7.x
  • VijeoCitect v7.x

Summary:
How to determine if an alarm is unacknowledged for a particular category. There is the AlarmActive() cicode function, but this looks at all Categories, I only want to look at particular categories.

Solution:

The following function shows how to browse into the alarms and get the number of alarm meeting the required criteria:

****************************************************************************************************
INT iSession=-1;
INT iNumRecords = 0;


// Function AlarmCategoryfilter() returns -1 if no alarm found otherwise returns the number of alarm

INT FUNCTION AlarmCategoryfilter(STRING sSumType, STRING sCategory)

INT iRETURNvalue=-1;

iSession = AlmTagsOpen("SUMTYPE=" + sSumType + "; CATEGORY=" + sCategory, "",""); // Initiales a new Alarm browse session. 

    IF iSession <> -1 THEN 
        iNumRecords = AlmTagsNumRecords(iSession); // Get the number of alarm found by AlmTagsOpen() 
            IF iNumRecords <> 0 THEN 
                iRETURNvalue=iNumRecords; // Number of alarm meeting the required criteria 
            ELSE 
                iRETURNvalue=-1; 
            END 
    ELSE 
        DebugMsg("###_Error_AlmTagsOpen_Failed"); 
    END

RETURN iRETURNvalue

END
****************************************************************************************************

For example, to know if some alarms from category 1,2 or 5 are unacknowledged, call AlarmCategoryFilter() function as below:

AlarmCategoryFilter("UNACKNOWLEDGED", "1 OR 2 OR 5")

 

Please note that AlmTagsOpen() is a blocking function. To display the value returned by AlarmCategoryFilter() on a graphic page, call that function from a report/event and store the return value into a Disk I/O Device tag. Then, use the Disk I/O Device tag to display the value on a graphic page.

For further information about AlmTagsOpen(), please also see KB articles Q5522 and Q5380.

 

 

 

 

 

 


Keywords:
Alarm, AlarmActive, Category, Filter, Unacknowledged

Attachments