MTConnect 2.8 package

MTConnect Protocol

The agent MUST support the REST Protocol and produce XML representations of the information models.

All other protocols and representations are optional.

Packages

MTConnectAssets Response Document

This section provides semantic information for the MTConnectAssets entity.

MTConnectDevices Response Document

This section provides semantic information for the MTConnectDevices entity.

MTConnectErrors Response Document

This section provides semantic information for the MTConnectErrors entity.

Error Information Model

The Error Information Model establishes the rules and terminology that describes the response document returned by an agent when it encounters an error while interpreting a request for information from a client software application or when an agent experiences an error while publishing the response to a request for information.

An agent provides the information regarding errors encountered when processing a request for information by publishing an MTConnectErrors Response Document to the client software application that made the request for information.

MTConnectExceptionsReport Response Document

This section provides semantic information for the MTConnectExceptionsReport entity.

MTConnectStreams Response Document

This section provides semantic information for the MTConnectStreams entity.

REST Protocol

An agent MUST provide a REST API API supporting HTTP version 1.0 or greater. This interface MUST support HTTP (RFC7230) and use URIs (RFC3986) to identify specific information requested from an agent.

The REST API adheres to the architectural principles of a stateless service to retrieve information associated with pieces of equipment. Additionally, the API is read-only and does not produce any side effects on the agent or the equipment. In REST state management, the client is responsible for recovery in case of an error or loss of connection.

HTTP Request

An agent MUST support the HTTP GET verb, all other verbs are optional. See IETF RFC 7230 for a complete description of the HTTP request structure.

The HTTP uses Uniform Resource Identifiers (URI) as outlined in IETF RFC 3986 as the request-target. IETF RFC 7230 specifies the http URI scheme for the request-target as follows:

  1. protocol: The protocol used for the request. Must be http or https.

  2. authority: The network domain or address of the agent with an optional port.

  3. path: A Hierarchical Identifier following a slash (/) and before the optional question-mark (?). The path separates segments by a slash (/).

  4. query: The portion of the HTTP request following the question-mark (?). The query portion of the HTTP request is composed of key-value pairs, <key>=<value> separated by an ampersand (&).

path Portion of an HTTP Request

The path portion of the request-target has the following segments:

  • device-name or uuid: optional name or uuid of the Device
  • request: request, must be one of the following: (also see Operations for Agent)
    • probe
    • current
    • sample
    • asset or assets
      • asset request has additional optional segment <asset ids>

If name or uuid segement are not specified in the HTTP Request, an agent MUST return information for all pieces of equipment. The following sections will

Examples:

  • http://localhost:5000/my_device/probe

    The request only provides information about my_device.

  • http://localhost:5000/probe

    The request provides information for all devices.

The following section specifies the details for each request.

MTConnect REST API

An agent MUST support probe requests, current requests, sample requests, and asset requests.

See the operations of the Agent for details regarding the requests.

HTTP Errors

When an agent receives an HTTP Request that is incorrectly formatted or is not supported by the agent, the agent MUST publish an HTTP Error Message which includes a specific status code from the tables above indicating that the request could not be handled by the agent.

Also, if the agent experiences an internal error and is unable to provide the requested response document, it MUST publish an HTTP Error Message that includes a specific status code from the table above.

When an agent encounters an error in interpreting or responding to an HTTP Request, the agent MUST also publish an MTConnectErrors Response Document that provides additional details about the error. See Error Information Model for details on the MTConnectErrors Response Document.

Streaming Data

HTTP data streaming is a method for an agent to provide a continuous stream of observations in response to a single request using a publish and subscribe communication pattern.

When an HTTP Request includes an interval parameter, an agent MUST provide data with a minimum delay in milliseconds between the end of one data transmission and the beginning of the next. A value of zero (0) for the interval parameter indicates that the agent should deliver data at the highest rate possible and is only relevant for sample requests .

The format of the response MUST use an x-multipart-replace encoded message with each section separated by MIME boundaries. Each section MUST contain an entire MTConnectStreams Response Document.

When streaming for a current request, the agent produces an MTConnectStreams Response Document with the most current observations every interval milliseconds.

When streaming for a sample request, if there are no available observations after the interval time elapsed, the agent MUST wait for either the heartbeat time to elapse or an observation arrives. If the heartbeat time elapses and no observations arrive, then an empty MTConnectStreams Response Document MUST be sent.

Note: For more information on MIME, see IETF RFC 1521 and RFC 822.

An example of the format for an HTTP Request that includes an interval parameter is:

http://localhost:5000/sample?interval=1000

HTTP Response Header:

HTTP/1.1 200 OK
Connection: close
Date: Sat, 13 Mar 2010 08:33:37 UTC
Status: 200 OK
Content-Disposition: inline
X-Runtime: 144ms
Content-Type: multipart/x-mixed-replace;boundary=
a8e12eced4fb871ac096a99bf9728425
Transfer-Encoding: chunked

Lines 1-9 in http-response-header represent a standard header for a MIME multipart/x-mixed-replace message. The boundary is a separator for each section of the stream. Lines 7-8 indicate this is a multipart MIME message and the boundary between sections.

With streaming protocols, the Content-length MUST be omitted and Transfer-Encoding MUST be set to chunked (line 9). See IETF RFC 7230 for a full description of the HTTP protocol and chunked encoding.

--a8e12eced4fb871ac096a99bf9728425
Content-type: text/xml
Content-length: 887

<?xml version="1.0" ecoding="UTF-8"?>
<MTConnectStreams ...>...

Each section of the document begins with a boundary preceded by two hyphens (--). The Content-type and Content-length header fields MUST be provided for each section and MUST be followed by <CR><LF><CR><LF> (ASCII code for <CR> is 13 and <LF> 10) before the XML document. The header and the <CR><LF><CR><LF> MUST NOT be included in the computation of the content length.

An agent MUST continue to stream results until the client closes the connection. The agent MUST NOT stop streaming for any reason other than the following:

  • agent process stops
  • The client application stops receiving data
Heartbeat

When streaming data is requested from a sample request, an agent MUST support a heartbeat to indicate to a client application that the HTTP connection is still viable during times when there is no new data available to be published. The heartbeat is indicated by an agent by sending an MTConnect response document with an empty Steams entity (See Observation Information Model for more details on Streams) to the client software application.

The heartbeat MUST occur on a periodic basis given by the optional heartbeat query parameter and MUST default to 10 seconds. An agent MUST maintain a separate heartbeat for each client application for which the agent is responding to a data streaming request.

An agent MUST begin calculating the interval for the time-period of the heartbeat for each client application immediately after a response document is published to that specific client application.

The heartbeat remains in effect for each client software application until the data streaming request is terminated by either the agent or the client application.

References

A Component MAY include a set of Reference entities of the following types that MAY alter the content of the MTConnectStreams Response Documents published in response to a current request or a sample request as specified:

  • A Component reference (ComponentRef) modifies the set of Observations, limited by a path query parameter of a current request or sample request, to include the Observations associated with the entity whose value for its id attribute matches the value provided for the idRef attribute of the ComponentRef element. Additionally, Observations defined for any lower level entity(s) associated with the identified entities MUST also be returned. The result is equivalent to appending //[@id=<"idRef">] to the path query parameters of the current request or sample request. See Agent for more details on path queries.

  • A DataItem reference (DataItemRef) modifies the set of resulting Observations, limited by a path query parameter of a current request or sample request, to include the Observations whose value for its id attribute matches the value provided for the idRef attribute of the DataItemRef element. The result is equivalent to appending //[@id=<"idRef">] to the path query parameters of the current request or sample request. See Agent for more details on path queries.

Source: MTConnect Institute model documentation, version 2.8.

MTConnect term dictionary ยท TAMS Model-Aware MTConnect Browser

An unhandled error has occurred. Reload ๐Ÿ—™