Skip to content
Xiqun Wang edited this page Apr 24, 2015 · 11 revisions

Adapter Lab Instructions

Prerequisites:

  • Computer: Windows® - the oldest OS we support is XP® Circa 2002 with at least SP 2. Any later version is also fine, like Vista® or Windows® 7.
  • Visual Studio® 2010 or later, Can be Express. We will only need C#, no other languages are required.
  • .NET® 4.0 or later.
  • Some programming experience is helpful. C# is best.

Downloads:

What’s in the box:

  • We have provided the complete project at each step, so if you get lost or stuck, you can always open up the next step and catch up.
  • There's a preconfigured MTConnect agent to test the adapter you will be writing
  • We also provided a small adapter client app (dump.exe) that simple writes the data out to stdout. The default telnet that comes with Windows (not 7) does not format <lf> as <cr><lf> so the output looks ugly.

The following topics will be covered:

  • Creating a simple adapter with a couple of events.
  • Creating both a polling and event based samples (one that calls an API and one that receives change events).
  • Conversion of data from some external representation to MTConnect.
  • Adding conditions when they are in a fault or warning state.
  • Activation of multiple conditions and demonstration of the two ways to handle conditions depending on the controller API.
  • Creating an Asset (CuttingTool) and sending it to the agent. We can also update the cutting tool as well.
  • Creating a real-time audio sensor (assuming you computer has a mic) and creating 1khz time series streaming data.

Notes

All source code is available on github (click code) and each step is on a separate branch. The dump utility is also available in the dump directory. If you would like to download the agent, goto https://github.com/mtconnect/cppagent. I have included 1.2.0.19 as part of the materials

All software is made available using the Apache 2.0 license. (http://www.apache.org/licenses/LICENSE-2.0). You are free to use this in any project, for profit or otherwise. I only ask that if you find a problem, please send me the fix. If you like it, we can even turn it into a library and maintain it.

There are no external dependencies to use this code except for .NET (of course) and Windows. It is a port of the C++ adapters library with a lot of idiomatic changes for C#. There are many examples of existing C++ adapters in the https://github.com/mtconnect/adapter project. The FANUC adapter is one of the most complete and can be used to get an idea of how to create a dynamic adapter with FOCAS 2.