SLMP Quickstart tutorial

Startup configuration

Verify that the SLMP 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 for the SLMP service
    1. Windows Example
    2. "integrationServices": [
      {
       "serviceName": "slmp",
       "serviceLibrary": "slmpservice.dll",
       "schemaName": "slmp",
       "enabled": true
      },
    3. Unix/Linux Example
    4. "integrationServices": [
      {
       "serviceName": "slmp",
       "serviceLibrary": "libslmpservice.so",
       "schemaName": "slmp",
       "enabled": true
      },
  4. Save any changes.

 

Windows Tutorial

Prerequisites

Install FairCom Edge

 

  1. Open a command prompt.
  2. Navigate to the simulator in the <FairCom Folder>/server/slmp/test folder, such as C:\FairCom\FairCom-Edge.windows.64bit.v4.2.0.173\server\slmp\test\<OS>
  3. Execute slmp_server_simulator.bat. Leave it running.

 

This procedure creates an Integration Table named slmpTable in the faircom database to store data received from a SLMP (CC-Link) source. The Integration Table automatically creates the ts_index, error, and source_payload JSON fields. The jsonToTableFields transform extracts values from source_payload and stores them in the D200 and SD210 fields defined in the request.

  1. Run FairCom user interface. Open a Google Chrome web browser and enter a URL like the following: https://localhost:8443/. As needed, change localhost to the server hostname where you installed FairCom Edge. 
  2. At Code/API Console, paste the following to Request and click Run.
    1. {
       "api": "hub",
       "action": "createIntegrationTable",
       "params": {
         "tableName": "slmpTable1",
         "fields": [
           {
             "propertyPath": "prop_D200",
             "name": "D200",
             "type": "integer"
           },
           {
             "propertyPath": "prop_SD210",
             "name": "SD210",
             "type": "integer"
           }
         ],
         "transformSteps": [
           {
             "transformStepMethod": "jsonToTableFields",
             "mapOfPropertiesToFields": [
               {
                 "fieldName": "D200",
                 "recordPath": "source_payload.prop_D200"
               },
               {
                 "fieldName": "SD210",
                 "recordPath": "source_payload.prop_SD210"
               }
             ]
           }
         ]
       },
       "authToken": "replaceWithAuthTokenFromCreateSession"
      }     
  3. Observe the response at Output and ensure the action is completed successfully.

Note "errorCode" with a value of 0 indicates success. "errorCode" with a non-zero value indicates a failure. See Errors and contact FairCom for more information about an error.

 

This procedure creates an input that captures data from a SLMP (CC-Link) source and writes the incoming data to the slmpTable1 Integration Table for subsequent processing.

  1. Run FairCom user interface.
  2. At Code/API Console, paste the following to Request and click Run.
    1. {
        "api":"hub",
        "action":"createInput",
        "params":{
           "inputName":"input1",
           "serviceName":"slmp",
           "tableName":"slmpTable1",
           "dataCollectionIntervalMilliseconds":1000,
           "settings":{
              "slmpProtocol":"tcp",       
              "slmpIpAddress":"127.0.0.1",
              "slmpPort": 2000, 
              "slmpMonitoringTimerMilliseconds":1000,
              "propertyMapList":[
                 {
                    "propertyPath":"prop_D200",
                    "slmpHeadDeviceNumber":200, 
                    "slmpDeviceCode": "D", 
                    "slmpNumberOfPoints": 1,
                    "slmpDataType": "short"
                 },
                 {
                    "propertyPath":"prop_SD210",
                    "slmpHeadDeviceNumber":210, 
                    "slmpDeviceCode": "SD", 
                    "slmpNumberOfPoints": 1,
                    "slmpDataType": "short"
                 }
              ]
           }
        },
        "authToken": "replaceWithAuthTokenFromCreateSession"
      }
  3. Observe the response at Output and ensure the action is completed successfully.

 

View the slmptable1 table in the faircom database for the transformed data

  1. At Data/Integration Tables, view the slmptable1 table to see data being collected.
  2. Perform a SQL query against the data. At Data/SQL Commands, write the following statement, for example: select * from slmptable1 where D200 > 100.
  3. Click Run to get the result.
  4. Observe the response and ensure the action is completed successfully.