Skip to main content

MTConnect Tutorials

FairCom Edge tutorials for Windows detailing ways to interact with an MTConnect simulator

In these tutorials, you will interact with the FairCom Edge database server using the FairCom Explorer Web Utility to pull and store data from an MTConnect simulator.

In the MTConnect architecture, FairCom Edge is the Client application. Data flows from the controller/adapter to the agent and finally to the client application.

So, to have an environment to test, you need a controller and agent simulators.

Download and extract an MTConnect C++ Agent release from https://github.com/mtconnect/cppagent/releases/. For example, agent-2.4.0.7-win64.zip. This archive will have a directory within it with the same name as the archive (minus the file extension). For this version that directory name is agent-2.4.0.7-win64. The commands you will run later will be executed from this directory.

To run the simulator, install:

  • Ruby: https://rubyinstaller.org/

  • bundler: gem install bundler

From the agent-2.4.0.7-win64 directory, execute the controller and agent simulators and test them.

  1. Run the MTConnect controller simulator:

    ruby simulator\run_scenario.rb -l -p 7878 --scenario -v simulator\simple_scenario_1.txt

    Leave it running.

  2. Run the MTConnect Agent simulator:

    bin\agent run demo\agent\agent.cfg

    Leave it running.

  3. To test that it is working, replace the IP address with the correct address from the MTConnect agent and execute:

    curl 127.0.0.1:5001/current

    A big XML string should be returned.

Make sure MTConnect is enabled in the FairCom server.

Start the Data Explorer Web app and execute the following command in the API Explorer to create an Input that collects data from MTConnect:

{
  "api": "hub",
  "action": "createInput",
  "params": {
    "inputName": "MTConnect1",
    "serviceName": "mtconnect",
    "dataCollectionIntervalMilliseconds": 5000,
    "settings": {
      "host": "127.0.0.1:5001",
      "propertyMapList": [
        {
      "propertyPath": "OKUMA.123456_LZ1actm",
      "deviceUuid": "OKUMA.123456",
      "dataItemId": "LZ1actm",
      "dataType": "string",
      "defaultValue": "-1"
        }
      ]
    },
    "ownerName": "admin",
    "tableName": "mtconnectTable",
     "dataBase": "faircom",
    "retentionPolicy": "autoPurge",
    "retentionPeriod": 30,
    "retentionUnit": "day",
    "metadata": {}
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

Open the table /faircom/mtconnectTable to look at persisted values (source_payload field). The json will look like this:

{
  "create_ts":"2025-01-27T13:19:33.843Z",
  "OKUMA.123456_LZ1actm":"-1"
}

Startup Configuration

Verify that the MTConnect service is enabled in the FairCom Edge server

  1. Edit the services.json file in the config folder.

  2. Locate the "integrationServices" object of the service for the desired platform.

  3. Set "enabled" to true.

  4. Save any changes.

Example 1. Windows
{
         "serviceName":"mtconnect",
         "serviceLibrary":"mtconnectservice.dll",
         "schemaName":"mtconnect",
         "enabled":true
      },
Example 2. Unix/Linux
{
         "serviceName":"mtconnect",
         "serviceLibrary":"libmtconnectservice.so",
         "schemaName":"mtconnect",
         "enabled":true
},