config.json

config.json file explained
/etc/motorcortex/config/
└── config.json

In config.json the main application configuration is determined. For instance in what "Mode": the system should be run (Application mode), where other configuration files can be found and how Tasks shall be configured.

Below is an example of a config.json:

{
  "Mode": "Simulation",
  "Drive": "cia402",
  "Path": {
    "Fieldbus": "io/master.xml",
    "Control": "control/control.xml",
    "UserParameters": "user/parameters.json",
    "Linking": "linking/base.link.json",
    "Mechanism": "mech/mech-parameter.xml",
    "License": "license.lic",
    "Log": "/var/www/motorcortex/log",
    "Persistence": "control/persistence.bin"
  },
  "AxisControl": {
    "Enable": true,
    "NumberOfAxes": 6
  },
  "ManipulatorControl": {
    "Enable": true,
    "Amount": 1
  },
  "Server": {
    "Default": {
      "URL": "wss://*:5568:5567",
      "Direction": "listen",
      "Login": "disable",
      "Certificate": "/etc/ssl/certs/motorcortex.pem"
    }
  },
  "Realtime": {
    "Isolate": [
      0,
      1
    ],
    "Allocate": 16
  },
  "Task": {
    "Control_task": {
      "Sched": "Realtime",
      "Cpu": [
        0
      ],
      "Prio": 80,
      "Dt": 1000
    },
    "Fieldbus_task": {
      "Sched": "Realtime",
      "Cpu": [
        1
      ],
      "Prio": 80,
      "Dt": 1000
    },
    "Simulator_task": {
      "Sched": "Realtime",
      "Dt": 1000
    },
    "Logic_task": {
      "Sched": "Realtime",
      "Dt": 10000
    },
    "Logger_task": {
      "Sched": "Normal",
      "Dt": 1000
    },
    "IO_task": {
      "Sched": "Realtime",
      "Dt": 1000
    },
    "Comm_task": {
      "Sched": "Normal",
      "Dt": 1000
    }
  }
}

#Mode

A commonly used setting is the Mode. This can be set to "Simulation" or "Production". In "Simulation" the application can be run without having hardware. the hardware is then simulated by a simulator, checkout Simulating Devices how to set up hardware in simulation.

Start Application in Simulation mode:

"Mode": "Simulation",  

Start Application in Production mode:

"Mode": "Production",

#Path

Inside Path you defines the default file locations for: prefix path: /etc/motorcortex/config/

Default configuration paths are listed below:

  • “Fieldbus”: "io/master.xml",
  • “Control”: "control/control.xml",
  • “Log”: "/var/www/motorcortex/log",
  • “UserParameters”: "user/parameters.json",
  • “Link”: "base.json",
  • “License”: "license.lic"

License

Deployed licenses are automatically stored in /etc/motorcortex/config/license.lic. Each time a configuration is deployed to the controller the license is overwritten. In some applications, it is desired to deploy the same configuration on multiple controllers, each having it’s own license. For this it can be useful to store in the license in fixed location /etc/motorcortex/license.lic:

For more information about how to install or acquire a license.lic, check out: How to install a license

#Features

Features can be added to your application, each feature contains:

  • “Enable”: Set to true (enable) or false (disable). If true the feature is added to parameterTree.
  • “Amount”: Defines the feature amount, set to 2 will add this feature 2 times.
  • “Linking”: Feature applicable linking can be defined in Linking, define path to xxx.link.json.

#Server

Default server settings:

  • “URL”: Default URL setting is set to Secure connection wss, change to ws for not secure connection.
  • “Login”: Default server login is set to disabled. Change to enable to active server login.
  • “Certificate”: Default certificate motorcortex.pem location.
    "Default": {
      "URL": "wss://*:5568:5567",
      "Direction": "listen",
      "Login": "disable",
      "Certificate": "/etc/ssl/certs/motorcortex.pem"
    }

#Task

  • “Control_task” - Defines control_task cycle time, default dt = 1ms (1kHz)
  • “Fieldbus_task” - Defines fieldbus_task cycle time, default dt = 1ms (1kHz)