Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Plant SCADA

TagEventQueue

  • Last UpdatedJul 18, 2023
  • 2 minute read

Opens the tag update event queue. The I/O server writes events into this queue as they are processed. These events include tag updates from drivers that support time-stamped data.

To read events from this queue, use the QueRead() or QuePeek() functions. The data put into the queue contains the following fields:

  • Driver (the driver used to communicate with the I/O device)

  • Port (the name of the port to which the I/O device is connected)

  • Unit (the name of the I/O device)

  • Tag (the variable tag name)

  • Seconds (a UTC timestamp representing the number of seconds since 1970)

  • Milliseconds (number of milliseconds since the last second)

  • Value (the tag value)

  • Quality (OPC component only equivalent to QualityGetPart, mode 7)

To use this function, you need to enable the tag update event queue with the [IOServer]EnableEventQueue parameter. This parameter will tell the I/O Server to start placing events into the queue. The function TagEventFormat() returns a handle to the format of the data placed into the string field.

Enabling this formatting feature can increase CPU loading and reduce performance of the I/O Server as every tag update event is formatted and placed in the queue. You should reconsider using this feature if a decrease in performance is noticeable.

The maximum length of each queue is controlled by the [Code]Queue parameter. You may need to adjust this parameter so as not to miss alarm events. When the queue is full, the I/O Server will discard events.

Syntax

TagEventQueue()

Parameters - None

Return Value

The queue handle of the Tag Update Event queue.

QuePeek, QueRead, TagEventFormat

Example

FUNCTION

ReadEvents()

INT status;

INT queue;

INT format;

INT eventId;

STRING event;

INT sec;

INT ms;

TIMESTAMP time;

 

queue = TagEventQueue();

format = TagEventFormat();


IF (queue <> -1 AND format <> -1) THEN

WHILE (true) DO

status = QueRead(queue, eventId, event, 1);

IF status = 0 THEN

ErrLog("eventId: " + IntToStr(eventId));

StrToFmt(format, event);

ErrLog(" driver: " + FmtGetField(format, "Driver"));

ErrLog(" port: " + FmtGetField(format, "Port"));

ErrLog(" unit: " + FmtGetField(format, "Unit"));

ErrLog(" tag: " + FmtGetField(format, "Tag"));

sec = FmtGetField(format, "Seconds");

ms = FmtGetField(format, "Milliseconds");

time = TimeIntToTimestamp(sec, ms, 1);

ErrLog(" time: " + TimestampToStr(time,14));

ErrLog(" value: " + FmtGetField(format, "Value"));

ErrLog(" quality: " + FmtGetField(format, "Quality"));

END

END

END

END

See Also

Tag Functions

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in