Applies To:
  • CitectSCADA 5.20, 5.21

Summary:
Using Alarm Property Tags, you can disable an alarm with a command like:

AlarmTagName.Disabled = 1, however, you can't enable it with

AlarmTagName.Disabled = 0. Whether you write 0 or 1 to it, it always disables the tag.

 

Solution:
This has been fixed in Citect 5.21 Service Pack G, 5.30 Service Pack A, and later.

For a work-around in older Citect versions you will have to use Cicode functions. Copy the following functions into a Cicode file in your project. If your project is running on a stand-alone computer, you'll only need the first function, ServerAlarmMode.

// This function allows you to enable and disable alarms by name.
// This function can only run on the Alarm server
//
// ARGUMENTS:     sTag = Alarm tag name
//                iMode 0 = Disable Alarm
//                      1 = Enable Alarm
//
FUNCTION
ServerAlarmMode(STRING sTag, INT iMode)
    INT iCurrent;
    INT iNext;

      iCurrent = AlarmFirstTagRec(sTag, "", "");
    WHILE iCurrent <> -1 DO
        iNext = AlarmNextTagRec(iCurrent, sTag, "", "");

        IF iMode = 0 THEN
            AlarmDisableRec(iCurrent);
        ELSE
            AlarmEnableRec(iCurrent);
        END

        iCurrent = iNext;
    END
END


// This function allows you to enable and disable alarms by name.
// This can be run on any client or server (including the Alarm server)
// This uses MsgRPC to request that the alarm server run the
ServerAlarmMode() function.
//
// ARGUMENTS: sTag = Alarm tag name
// iMode 0 = Disable Alarm
// 1 = Enable Alarm
//
FUNCTION
AlarmMode(STRING sTag, INT iMode)

           INT hCitectAlarm;

        hCitectAlarm = MsgOpen("Alarm", 0, 0);
      IF hCitectAlarm >= 0 THEN
            MsgRPC(hCitectAlarm, "ServerAlarmMode", "^"" + sTag + "^"," + iMode:#, 1);
            MsgClose("Alarm", hCitectAlarm);
      ELSE
            Message("Error", "Cannot connect to Alarm server", 16);
      END
END

To enable an alarm called Alarm1, use the command: AlarmMode("Alarm1", 1);

To disable it, use the command: AlarmMode("Alarm1", 0);

For a stand-alone project, you don't need the AlarmMode function. Use ServerAlarmMode instead.

For more information on alarm property tags, look up "Alarms: Alarm properties as tags" in the Citect Help Topics Index (without the "").

 

Keywords:
 

Attachments