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.
Pre-requisites
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
Run the simulator
From the agent-2.4.0.7-win64 directory, execute the controller and agent simulators and test them.
- Run the MTConnect controller simulator:
Leave it running.ruby simulator\run_scenario.rb -l -p 7878 --scenario -v simulator\simple_scenario_1.txt - Run the MTConnect Agent simulator:
Leave it running.bin\agent run demo\agent\agent.cfg - To test that it is working, replace the IP address with the correct address from the MTConnect agent and execute:
A big XML string should be returned.curl 127.0.0.1:5001/current
Capture MTConnect data as JSON records in the database
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
- Edit the
services.jsonfile in theconfigfolder. - Locate the
"integrationServices"object of the service for the desired platform. - Set
"enabled"totrue. - 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
},