Menu
  • Use Cases
  • Stacks
  • Stackbuilder
  • MyStacks
  • Support
  • About Us
  • Contact
  • Use Cases
  • Stacks
  • Stackbuilder
  • MyStacks
  • Support
  • About Us
  • Contact
  • View Cart

MTConnect Example with Ethernet

MTConnect is one of many messaging protocols used to communicate between machines. This document describes, using an example, setting up a MTConnect Adapter for an Interstack Device that communicates temperature and humidity sample values to an MTConnect Agent on a LAN via Ethernet.

The screenshot above shows the MTConnect Demo( ~015516494ace3a11e7b226c27461e15f81) project which can be imported to your Stackbuilder [ click on the Project tab on the set of Palettes to the right. Then from the OS Menu, go to Block–>Import. Copy and Paste the UUID string to import the project into your Projects collection. Once available, double click on it to open]

The 4 blocks that make up the project are as follows
Base – High Speed Every Stack needs a Base module. In our project, the Base provides a kickstart message via the “22:Stack Ready” terminal to initialize the other blocks and provides time functions
Unix Time – from Base This block provides an convenient way to extract Unix Time from the Base. The “5:startup_unixtime” terminal is wired in to the MTConnect Ethernet Block to provide timestamps for messages sent by the adapter to the agent.
humidity, temp data This is a test data generator that outputs temperature and humidity data at set intervals with a default of 2 seconds. The interval can be set by the user via the ‘sampleinterval’ property of this block.

MTConnect Ethernet Block
This block provides the communication between the adapter and the agent via the Ethernet Module on the stack. This block automatically deals with the MTConnect PING PONG protocol for keep alives and the AVAIL dataitem.
This Block is available in the Library Tabs–>Network & Communications to be drag and dropped in to your projects.

Details of this block are as follows:

PROPERTIES:
‘mtc.port’ – The port number in which the Adapter will listen for incoming connections from the agent. Default is 7878.
‘mtc.delimiter’ – The delimiter character used in the messages sent by the adapter. Default is ‘|’ character as per MTConnect standard.
‘mtc.heartbeat’ – The heartbeat interval for the PING PONG messages. Default is 10000. Units are milliseconds.
‘mtc.include_ts’ – Boolean that determines whether a timestamp will be sent with each message. Default is True.
‘mtc.newlinechar’ – The newline character to be used to indicate the end of a message. Default is ‘\r\n’. On some agents, they may requires just the ‘\n’ or ‘\r’.
‘mtc.staticip’ – The static IP Address to be set for the Ethernet. Should be a valid IP Address string of the format ‘xxx.xxx.xxx.xxx’. Default is EMPTY indicating the IP Address for the Ethernet module is DYNAMICALLY set via DHCP. Check with your network administrator if you need to provide a static ip.

INPUT TERMINALS:
1:init – Initializes the adapter, sets up the ethernet connection with the LAN and starts the server to listen for incoming connections from the agent.
2:starttime – Receives the unix time from the Unix Time block for including timestamps in the MTConnect message protocol
3:msg_in – Receives data from the stack which will be sent out as MTConnect message. This terminal can receive three kinds of message.
Delimited string of key values – e.g. “temperature|34.34|humidity|56.45” where | is the delimiter character between the consecutive keys and values
Python List of keys and values – e.g, [“temperature”,34.34,”humidity”,56.45] Pythton dictionary of keys and values – {‘temperature’:34.34,”humidity”:56.45} This is the format sent by the “humidity, temp data” block in the demo as it the most convenient to use.

Each time a message is received in msg_in, it will be sent out on the LAN as long as there’s an agent listening.

Example Output of running the demo.
You can directly run the imported Demo or make a copy of it and run your version.
Once you load the project to the Stack via the “Send to Stack” button, the Console tab from the bottom will show up as shown below.

After the STARTUP message, if the Ethernet cable is plugged into the Ethernet module (and in the case of DHCP) the next message will indicate the IP Address of the this Ethernet Adapter. Make note of the IP Address to configure your agent to connect at this IP address.

Example agent config and example data specification for the stack adapter device are provided for reference.
agent.cfg
Isxmtcdev.xml

For MTConnect agent configuration please refer to MTConnect Agent (github)

Once the agent is started and begins communication with the Stack Adapter, the console log on Stackbuilder will indicate the messages being sent to the agent

To confirm the receipt of these messages by the agent, you can verify by requesting the current state of the agent for the specified adapter. Here’s an example of the kind of information available from the adapter.

Refer to documentation on many other topics at interstacks.com/knowledge-base.
Please email info@interstacks.com with any questions.

Popular Articles

  • MyStacks Cloud Dashboard
  • Internet communication with HTTP block
  • Download and install Stackbuilder

Contact Us

Contact us with any questions or help with deploying your IoT projects.

CONTACT US

Connect

  • Facebook
  • Twitter
  • LinkedIn
  • Email

Sign up for the latest Interstacks news.

Join Our Newsletter
  Thank you for Signing Up
  Please correct the marked field(s) below.
1,false,1,First Name,2
Email:
1,true,6,Subscriber Email,2
Name:
1,false,1,Last Name,2

Copyright © 2023 Interstacks. All rights reserved. Privacy Policy | Terms and Conditions

Site by Imagebox