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

In the task module, the process intervals for each task are configured in milliseconds [ms]. Adjusting the task time can directly impact CPU load. Please note that CPU0 and CPU1 are dedicated to real-time tasks and must not be overloaded to ensure optimal performance.

Most relevant tasks are:

  • “Control_task” - Specifies the cycle time for the control_task. The default value is set to 1000 ms (1 kHz) and is isolated on CPU0. Utilization_max can be found in the DESK-Tool under Control_task.
  • “Fieldbus_task” - Specifies the cycle time for the fieldbus_task. The default value is set to 1000 ms (1 kHz) and is isolated on CPU1. Utilization_max can be found in the DESK-Tool under Fieldbus_task.