Applies To:
  • CitectSCADA x.x

Time Stamped Alarms look like something I could use but I do not fully understand how they work. 

Time Stamped Alarms work just like normal digital alarms however they use the PLC time instead of the Citect computer time. Each alarm record had a field for an associated timer variable in the PLC, ie normally each of these alarms needs a register in the PLC to store the alarm time until Citect can read it on the next alarm scan. Citect will normally only read the digital tags on the scan, then if it finds that one of the digital tags has changed to the active state it will then read the associated timer variable in a separate read. There are two parts to the configuration for each alarm record as follows.


1 * activation bit. (Same as normal Digital alarm)

1* timer register. (Store the PLC time when the activation bit is set)

PLC logic to copy the PLC time to the timer register when the activation bit is activated. This timer must not be overwritten until Citect has read it, this will require some hand-shaking with Citect and buffering in the PLC. The hand-shaking and buffering is only required if it is likely to have an alarm cycle rapidly, ie cycle quicker than the Citect alarm scan time. See [Alarm]ScanTime parameter.


The Citect configuration is similar to a normal digital alarm except there is a field for the tag name of the timer register. If hand shaking with the PLC is required then some simple Cicode is also required. The following function can be used (provided your timer is an INT).

INT iSysTime;

PLCTimer(INT iTimer)

   IF SysTime() > iSysTime + 10 THEN // Ensures that the HandShake is only reset once in each alarm scan
      HandShake = 0;
      iSysTime = SysTime();
   Return iTimer;

// Usage: Timer: PLCTimer(Alarm1Timer) Where Alarm1Timer is a Citect tag representing the alarm timer.

This Cicode simply returns the value of whatever tag you pass to it, however it will also reset the handshake bit to tell the PLC that Citect has read the timer variable and it can now overwrite it if required (this could be some sort of unlatch in the PLC. The time check ensures that the PLC Hand shake bit is only written to once if numerous alarms are found to have gone active from one scan to the next. See the online help for more information on Time Stamped Alarms