Applies To:
  • CitectSCADA

I am using a Time Stamped Alarm with a millisecond timer, and the value for the Timer variable is different to the time stamp displayed in the alarm summary. 


Why do I get different Values?

A Time stamped alarm shows a different time stamp from the timer itself because of the alarm scan time ([Alarm]ScanTime in the ini file).

Indeed, the timer variable is the time when the trigger variable changes to 1, this variable is checked at every page scan([Page]ScanTime ini parameter).
The time stamp in alarm summary field is picked up during the alarm scan, so every half second by default ([Alarm]ScanTime=500).

You will find that even if you set the same scan times for alarms and pages, you will get inconsistent values. Time Stamped Alarms are not designed for millisecond accuracy. You will get a delay up to [Alarm]Scantime value.

That's basically why you can get a difference between these two values.

How do I get the same time stamp for the summary field and the timer value?

To get a time stamp which is exactly the time when your alarm has been triggered, you will have to use Time Stamped Digital Alarms.

Time Stamped Digital Alarms behave differently from traditional time stamped alarms. As it is specified in the help, you have to use the AlarmNotifyVarChange() cicode function to trigger the alarm. You have to notify the alarm server each time your digital trigger is modified, then pickup the time when the digital trigger has been modified and use this time as the time stamp for the alarm.

For clarification you can have a look at the cicode example below where Digital1 is the digital tag which triggers the Time Stamped Digital Alarm:







     iHandle = TagSubscribe("DIGITAL1");


     iAddCB = SubscriptionAddCallback(iHandle, "TriggerTSDAlarm");








STRING sValueTimeStamp;

STRING sValueTimeStampMS;

STRING sValue;


     sValueTimeStamp = SubscriptionGetAttribute(iHandle, "ValueTimestamp");

     sValueTimeStampMS = SubscriptionGetAttribute(iHandle, "ValueTimestampMS");

     sValue = SubscriptionGetAttribute(iHandle, "Value");




Note: this configuration is not needed with the latest DNPR and OPC driver versions as they use the Driver Runtime Interface. In this case, only the Time Stamped Digital Alarm form has to be setup on SCADA side. For more info, please refer to KB article Q5795

 Time Stamps, Time Stamped  Digital Alarms, milliseconds accuracy, AlarmNotifyVarChange