Simulating Devices

How to set-up your etherCAT devices so they are simulated

Motorcortex enables the user to run an application in Simulation or Production (see config.json); but even in Production it is possible to (partially) simulate the behavior of EtherCAT Devices. In Production, individual EtherCAT Domains can be set to “Simulation” which means that their signals can be linked to a software module that simulated the device’s behavior.

If the application is started in Simulation mode all EtherCAT devices are in Simulation Mode, and Links that are marked with “Simulation” are enabled. In Production Mode any EtherCAT Domain that is set to Simulation puts its Devices into Simulation Mode; this allows using the software with some real devices and some simulated Devices.

When a device is in Simulation it re-wires its links so the data sent towards the device can be forwarded to a Simulator software Module that simulates the behavior of the Device. In the same manner, the data received from the Device is actually obtained from the linked Simulator software Module. A visualization of how signals are linked in the Robot Application is given below, the arrows point in the direction of the flow of information. As you can see in figure below, the data always goes through simulated etherCAT device, so the main application code does not know the difference between a simulated Device and a Real one.

image not found

How to switch between different system modes is explained in the following:


The main purpose of using simulation mode is to create a application without having your physical hardware connected, for this the following tasks are required:

  • Enable simulation mode in config.json
  • Set simulation parameters inside linking.json
  • Add simulated ECAT-devices inside ECAT-Tool
  • Link simulated ECAT-device parameters to motorcortex parameters

The next steps will explain you in detail how to set up your application in simulation mode:

  1. Inside config.json, set system mode to Simulation.

  2. With simulation mode enabled, the linking.json parameters under "systemMode": "Simulation", and "All", are applied these can be adjusted in the linking.json.

  3. In the Domain Configuration Panel you can enable the Simulation switch, but this is not necessary because the system is in Simulation mode. Simulation of a domain is only required in production mode, for example if you want to simulate one or multiple etherCAT devices.

    image not found
  4. Each domain can contain multiple etherCAT devices. In order to simulate the device PDO’s, you have to assign a simulation link to each simulated etherCAT device, so motorcortex knows that the device is included to the simulator. The Link Simulation should be assigned to the following path: root/DriveLogic/driveSimulation.

    image not found
  5. EtherCAT devices contain rxPDO and txPDO parameters that can be linked to a path, for simulation use: root/Simulator/.... For example target position should be linked to root/Simulator/targetPosition, channel 0 because this is linked to the first axis.

    image not found

    Press to open property menu and enable simulation switch the turns blue, this means that the link is only used if the system is in simulation mode!

  6. Step 5, can also be used for all root/Simulator/… parameters:

    Position actual value -> root/Simulator/positionValue
    Target position       -> root/Simulator/targetPosition
    Target torque         -> root/Simulator/targetTorque
    Torque offset         -> root/Simulator/targetTorqueOffset
    Torque actual value   -> root/Simulator/torqueValue
    

Now you are able to run your application in simulation mode.


The main purpose of using production mode is to test you application on your physical hardware, for this the following tasks are required:

  • Enable production mode in config.json
  • Set production parameters inside linking.json
  • Add ECAT-devices inside ECAT-Tool
  • Link ECAT-device parameters to motorcortex parameters

The next steps will explain you in detail, how to set up your application in production mode:

  1. Inside config.json, set system mode to Production.

  2. In production mode, the linking.json parameters under "systemMode": "Production", and "All", are applied and can be adjusted in the linking.json.

  3. In the Domain Configuration Panel the Simulation switch should be disabled.

    image not found

  4. Each domain can contain multiple etherCAT devices. The link simulation should be empty because, the system is in production mode.

  5. EtherCAT devices contain rxPDO and txPDO parameters each can be linked to user defined path.

    image not found

Now you are able to run your application in production mode.


The main purpose of using Simulation in Production mode is to partially test you application on physical hardware, for this the following tasks are required:

  • Enable production mode in config.json
  • Set production parameters inside linking.json
  • Add (simulated) ECAT-devices inside ECAT-Tool
  • Link (simulated) ECAT-device parameters to motorcortex parameters

The next steps will explain you in detail, how to set up your application in production mode with multiple devices simulated:

  1. Inside config.json, set system mode to Production.

  2. In production mode, the linking.json parameters under "systemMode": "Production", and "All", are applied and can be adjusted in the linking.json.

  3. In the Domain Configuration Panel you can create two kind of domains one for simulated devices and the other for real devices check out simulation tab and production tab how to establish each domain.

    image not found
  4. Each domain can contain multiple etherCAT devices. For production The link simulation should be empty, as for simulation check out simulation tab how to set up link simulation.

  5. EtherCAT devices contain rxPDO and txPDO parameters each can be linked to user defined path. Check out production tab and simulation tab how to establish each link.

Now you are able to run your application in production mode with partially simulated etherCAT devices.