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
MTConnectErrorsentity.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
HTTPGETverb, 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:
protocol: The protocol used for the request. Must behttporhttps.authority: The network domain or address of the agent with an optional port.path: A Hierarchical Identifier following a slash (/) and before the optional question-mark (?). Thepathseparates segments by a slash (/).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 (&).
pathPortion of an HTTP RequestThe
pathportion of the request-target has the following segments:device-nameoruuid: optionalnameoruuidof theDevicerequest: request, must be one of the following: (also see Operations for Agent)probecurrentsampleassetorassetsassetrequest has additional optional segment<asset ids>
If
nameoruuidsegement are not specified in the HTTP Request, an agent MUST return information for all pieces of equipment. The following sections willExamples:
http://localhost:5000/my_device/probeThe request only provides information about
my_device.http://localhost:5000/probeThe 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
Agentfor 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
intervalparameter, 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 theintervalparameter 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-replaceencoded 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
intervalmilliseconds.When streaming for a sample request, if there are no available observations after the
intervaltime elapsed, the agent MUST wait for either theheartbeattime to elapse or an observation arrives. If theheartbeattime 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
intervalparameter is:http://localhost:5000/sample?interval=1000HTTP 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: chunkedLines 1-9 in http-response-header represent a standard header for a MIME
multipart/x-mixed-replacemessage. 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-lengthMUST be omitted andTransfer-EncodingMUST be set tochunked(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 (
--). TheContent-typeandContent-lengthheader 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
Steamsentity (See Observation Information Model for more details onStreams) to the client software application.The heartbeat MUST occur on a periodic basis given by the optional
heartbeatquery 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
ComponentMAY include a set ofReferenceentities 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
idattribute matches the value provided for theidRefattribute 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
idattribute matches the value provided for theidRefattribute 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