Preparing for SOE Collecting

<< Click to Display Table of Contents >>

 

Preparing for SOE Collecting

Before using SOE Collecting Tags, users must prepare a device by creating a DB Table (V area) and developing a programmable logic compatible with all SOE collecting procedures developed for this Driver.

 

Table of SOE Events

This table aims to configure the size of an event buffer and manage their input and output in a circular buffer routine. This table is constantly updated by both a device and this Driver.

The Table of SOE Events must contain registers about control and storage of events, based on the data structure described on the next table.

Data structure

Address

Description

Data Type

0.0

 

STRUCT

+0.0

Table status

WORD (unsigned 16-bit)

+2.0

Recording pointer

WORD (unsigned 16-bit)

+4.0

Acquisition status

WORD (unsigned 16-bit)

+6.0

Maximum limit of items on the circular buffer

WORD (unsigned 16-bit)

+8.0

Circular buffer

ARRAY[1..n] (limit of user-defined items)

 +0.0

 

STRUCT

 +0.0

TIMESTAMP_LOLO (year)

  WORD (unsigned 16-bit)

 +2.0

TIMESTAMP_LOHI (day and month)

  WORD (unsigned 16-bit)

 +4.0

TIMESTAMP_HILO (hour and minute)

  WORD (unsigned 16-bit)

 +6.0

TIMESTAMP_HIHI (second and millisecond)

  WORD (unsigned 16-bit)

 +8.0

 Value of event type 1 (one)

   Data type of an event (user-defined)

 +n.0

 Value of event type 2 (two)

   Repeats the same data type

 +n.0

 Value of event type 3 (three)

   Repeats the same data type

 +n.0

 Value of event type n

   Repeats the same data type

 =n.0

 

END_STRUCT

=n.0

 

END_STRUCT

 

Description of Event Control Registers

Table Status: It must be kept exclusively by a device, indicating the number of events available for reading in the circular buffer. It must be updated by a device whenever new events are added to the circular buffer, or after completing the collecting of events by an application, which can be detected when the Acquisition Status changes

Recording Pointer: It must be kept exclusively by a device, indicating the index, starting at 0 (zero), of the position where the next event must be inserted. This index must be incremented by a device whenever a new event is inserted in the circular buffer, then returning to index 0 (zero) after reaching the maximum limit of the circular buffer

Acquisition Status: It must be kept by a device and by this Driver, indicating the number of records already read at every transaction. After each collecting, this Driver writes to this register the number of events that it could read. When detecting this change, a device must immediately subtract this value written by this Driver from the Table Status and then reset the Acquisition Status

Maximum Limit of Items of the Circular Buffer: A constant value that specifies the maximum limit of events to store in the circular buffer before the pointer moves back to index 0 (zero). It must contain exactly the limit value of the Array resized for events of the circular buffer

 

Description of Event Storage Registers

TIMESTAMP: Time when an event occurred

Event Value: Value of the occurred event, which can be composed by 1 (one) or n values, ​all with the same data type, in which they are grouped together for the same TIMESTAMP generated when an event occurs

 

TIMESTAMP format

A TIMESTAMP is represented by four Words, according to the data structure described on the next table.

Data structure

Word

Content

Range

0

Year

Between 0 (zero) and 65535

1

Day and month

ddddddddmmmmmmmm

2

Hour and minute

hhhhhhhhmmmmmmmm

3

Second and millisecond

ssssssmmmmmmmmmm

 

The first Word contains an integer value referring to a year

The second Word is divided into a high byte to represent a day and into a low byte to represent a month

The third Word is divided into a high byte to represent hours and into a low byte to represent minutes

The fourth Word uses the six highest bits to represent seconds and the 10 lowest bits to represent milliseconds

 

Acquisition Procedure

A device must start inserting events in ascending order, starting from the base address of the table, referring to the beginning of the circular buffer. At every new event inserted, the recording pointer must be incremented, starting to point to the next available address of the buffer.

This Driver performs an event reading from the oldest one to the newest one. The starting address for reading is calculated by this Driver using the value of Recording Pointer and Table Status.

If the number of available events is greater than the maximum allowed in a single protocol's communication frame, this Driver performs multiple block readings, updating the value of Acquisition Status at the end of the process with the total number of events read.

When detecting that this Driver wrote a value greater than 0 (zero) to Acquisition Status, a device must immediately subtract the value of Acquisition Status from the value of Table Status and then reset Acquisition Status.

A device can insert new events on the table during the acquisition process by this device, as long as there is no overflow in the circular buffer, then incrementing Table Status.

The next figure presents a flowchart, as a UML Activity Diagram, with a suggested implementation for the logic of a device.

SOE flowchart

SOE flowchart

Was this page useful?