Samples, Events, and Condition

From MTConnect® User's Portal
Revision as of 13:36, 8 August 2013 by Tjones25 (Talk | contribs)

Jump to: navigation, search

All Samples and Events values MUST be able to provide UNAVAILABLE as a valid value when the data source is not connected or the data source is unable to retrieve information. The UNAVAILABLE value will persist until the connection is restored and a new value can be retrieved. This state does not imply the device is no longer operational, it only implies that the state cannot be determined.



A Sample is an abstract type. This means there will never be an actual element called Sample, but any XML element that is a sub-type of Sample can be used as a sub-element of Samples. Examples of sample sub-types are Position, Load, and Angle. Sample types MUST have numeric values.

The Samples XML element MUST contain at least one Sample element. The Samples XML element acts only as a container for all the Sample XML elements to provide a logical structure to the XML Document.

Sample Element

If two adjacent samples for the same Component and DataItem have the same value, the second sample MUST NOT be sent to the client application and does not need to be retained by the MTConnect Agent. This will greatly reduce the amount of information sent to the application. The application can always assume that if the sample is not present, it has the previous value.

For DataItems containing an attribute for Duration, the timestamp associated with the sample references the time the sample value was reported or the statistics were computed, NOT the time the interval began. The time the interval began can be computed by subtracting the duration from the timestamp. Two samples can have overlapping intervals as in the case where statistics are computed at various frequencies.

For example, a one minute average and a five minute average can both have the same start time (Lets say 05:10:00), but their timestamps will be 05:11:00 with a duration of 60 seconds for the one minute average and a timestamp of 05:15:00 with a duration of 300 seconds for the five minute average. This allows for varying statistical methods to be applied with different interval lengths without having duplicate timestamps and durations. If a statistical data item does not report for a period greater than the previous duration, it can be assumed the computed value has not changed since the last value.

The same concepts are used for time-series samples as well where the timestamp of the series is set to the time the last value was recorded and the timestamp minus the duration is the time the first sample was recorded.

Sample Schema
Sample Attributes

A Sample MUST contain CDATA as the content between the element tags. A position is formatted like this:

1.	<Position sequence=”112” timestamp=”2007-08-09T12:32:45.1232” name=”Xabs” dataItemId=”10”>123.3333</Position>

In this example the 123.3333 is the CDATA for the position. All the CDATA in a Sample is typed, meaning that it can be validated using an XML parser. This restricts the format of the values to a specific pattern.

Time Series

A Time Series is a Sample which includes multiple readings of a DataItem taken at a specified sample rate. A time series can be used for collecting high frequency samples of a DataItem and then providing the series of samples to an application as a single DataItem. A time series contains the same attributes as a Sample, plus one additional attribute sampleCount. For a Time Series, sampleRate defines the time period (frequency) for the collection of each reading of the DataItem and sampleCount defines the total number of readings being transmitted. The CDATA MUST be a series of floating point numbers. The number of readings MUST match the sampleCount. The units for a Time Series MUST be the same as specified for the DataItem.

The XML element of the Sample for a DataItem with an attribute of representation will be the transformation of the DataItem type by capitalizing the first character of each word and then removing the underscore and adding the representation type. For example, ANGULAR_VELOCITY with representation defined as TimeSeries MUST be AngularVelocityTimeSeries. If representation is not defined or it is VALUE, then the transformation MUST be AngularVelocity.

Time Series Schema
Time Series Attributes

Sample XML Element Tag Names

For a list of XML elements that can be placed in the Samples section of the ComponentStream, click here.