Unfinished Proj – MTConnect

(As the year 2013 comes to an end, I’m looking back at some of my unfinished projects from the past year. This article is about projects related to MTConnect.)

In the past year, I have written about MTConnect quite a few times. And I’m not a paid shill or anything. After so many years in the machine tool industry, dealing with islands of isolated proprietary data, the openness of the MTConnect standard is very exciting, particularly since it has the backing of so many industry giants.

Not all of my projects are what I would consider finished, though.

MTConnect Adapter Library

This isn’t mine in any sense. At the [MC]2 conference in spring, Will Sobel presented a lecture on MTConnect Adapter development in C#. The lecture included source code for a sample adapter.

I waited a few months for the source code to be converted into a toolkit. Finally I started to do it myself, posting the code on GitHub. Before I did any significant work on the toolkit, though, an official toolkit made its way onto the MTConnect GitHub page.

Unfinished? Yes, because now there’s an official version.

Rather than look at my unfinished project, anyone developing an MTConnect adapter in .NET should take a look at the official MTConnect Adapter .NET SDK.

MTConnect-Node

MTConnect-Node was an attempted implementation of an MTConnect agent in Node.js. I started this project a long time ago, more with the intent of learning Node.js than creating a working agent.

Since the last update, I’ve learned a little more about writing better Node code. The project would need a major overhaul to implement all of the features in the standard. From time to time I’ve outlined some planned changes and additions, but haven’t found the time or the inclination to work on it.

Unfinished? Yes. Usable? No. It was a good learning experience, though.

If you’re looking for an MTConnect Agent, use the C++ agent provided by the MTConnect Institute itself.

MTConnect-JS

I started MTConnect-JS as a convenient way to access MTConnect data in Javascript. The project provides an Agent object that can be used in several ways.

For simple monitoring, you can provide callback functions to run whenever a certain document type is received:

var agent = new Agent(options);
var $agent = $(agent);
$agent.bind('devices', function(e, doc){
    // code to execute when an MTConnectDevices document is received
})
.bind('streams', function(e, doc){
    // code to execute when an MTConnectStreams document is received
    // i.e. from a current or a sample request
})
.bind('errors', function(e, doc){
    // code to execute when an MTConnectErrors document is received
});

agent.monitor();

Or for more elaborate monitoring, you can manually request a probe, sample, or current from the Agent object. (I never implemented assets. So far I haven’t encountered them anywhere but on the demo agent.)

In a web browser, such requests will typically run afoul of the same-origin policy. (I talk about accessing MTConnect data from a web application elsewhere.) The Agent object will work with CORS if enabled, but will also accept a “proxy” option. This option is a string that, if specified, will be prefixed to every URL requested.

All of this is documented in this post. The monitoring application does work, although it’s barebones. I took a modified version of it to [MC]2 this past spring.

Unfinished? Yes. It does work, but it’s barebones.

Anyone interested in the project, barebones as it is, can get the source here.

The Future

If any of these projects see any progress in 2014, it will probably be MTConnect-JS. I’ve wanted to enhance it with JQuery widgets that display updates, widgets for data item status, etc. Also, asset support is missing, but should be an easy addition.

As for the other two projects… If I were to work on an Agent implementation, I would be more interested in an up-to-date .NET agent than in working on MTConnect-Node, though I wouldn’t rule it out. The MTConnect Adapter library was supplanted by the official version before I had made any significant change to the code, so most likely I will take down my version.

Will I work on any new MTConnect projects in 2014? Who knows? I feel that there should be a Windows 8 app, but ITAMCO or someone else may beat me to that. Have to wait and see.

2 thoughts on “Unfinished Proj – MTConnect

  1. Thanks! I would also prefer JSON, since I usually consume the data in a web application.

    The MTConnect standard specifies XML, but I doubt anyone would complain about an agent that could also optionally return JSON. It was on my wish-list for this project, but I never got around to it.

  2. The NodeJS seems to be an Interesting approach! However, presenting the data in JSON instead of XML would be nice 🙂 (But this is an MTConnect thing?)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s