Skip to main content

Command: Simulation

Function: The command switches the development system to simulation mode.

Call: Online menu

In simulation mode, you can start and debug the active application on a "simulated target device". A physical target device is not necessary for testing the online behavior of an application. When logging in for the first time, you are prompted whether to create or load the application. For a simulated device, you do not have to configure the communication settings. In simulation mode, CODESYS displays the entry of the controller in the device tree in italics.

After successful login, the red triangle icon_device_not_connected.png symbol in the device tree indicates simulation mode. You can use the corresponding online commands to test the application.

To switch off simulation mode, log out of the controller and execute the Simulation command again.

The command affects the active application only.

Note

The PLC Shell is not supported in simulation mode.

Differences between simulation mode and operation with a physical controller

Simulation

Physical Controller

Real-time behavior / multicore

  • Runs in the CODESYS process with normal priority

  • Single-core

    Worse real-time behavior

  • Real-time operating system

  • Single-core or multicore

Architecture scope

  • Simulation 64-bit (depends on the CODESYS installation)

    Possible compile error in the IEC application if the application has been previously run only as 32-bit (for example, use of DWORD as POINTER)

  • Controller 32-bit

FPU (rounding error)

  • Uses FPU of the PC

  • Different configuration of the FPU exceptions

  • Uses FPU of the controller or FPU emulation

  • Different configuration of the FPU exceptions

Handling of exceptions

  • Exception handling of the Windows Runtime System

  • Exception handling of the controller

External libraries (Cmp/Sys/CAA/OEM/…)

  • Only a few external Cmp/SysLibs are physically available.

    As compared to embedded, more SysLibs could also be available.

  • Other implementation/behavior of the SysLibs (Windows in contrast to the OS of the controller)

  • "Unresolved Reference error“ on download is ignored. The application can still be downloaded to the controller and started. If the missing functions are actually called, they return nonsense values.

    Therefore, an IEC implementation can also be specified for external POUs. This substitute IEC code is then executed in the simulation.

  • "Unresolved Reference error" on download when external libraries do not exist in the controller

I/O drivers

  • I/O configuration is generated but not evaluated.

  • Fieldbus stacks are not evaluated.

  • I/O channels are not updated and no bus telegrams are sent.

  • Mostly no restriction, but depends on the capabilities of the controller

SoftMotion drivers

  • All SoftMotion axes are set to virtual and therefore simulated.

  • Mostly no restriction, but depends on the capabilities of the controller

For more information, see: Testing in Simulation Mode