Are there limitations with regard to executing modules in real-time?
Not all access operations that are possible in Simulink® under non-real-time conditions can be performed in the TwinCAT real-time environment. Known limitations are described below:
- Direct file access:: No direct access to the file system of the IPC can be realized from the TwinCAT runtime. For writing .mat files please use the TwinCAT File Writer block instead of the ToFile block of Simulink®.
- Direct hardware access: Direct access to devices/interfaces requires a corresponding driver, e.g. RS232, USB, network card, ...
It is not possible to access the device drivers of the operating system from the real-time context. At present it is therefore not easily possible to establish an RS232 communication for non-real-time operation with the Instrument Controller ToolboxTM and then use this directly in the TwinCAT runtime. However, TwinCAT offers a wide range of communication options for linking external devices, see TwinCAT 3 Connectivity TF6xxx. - Access to the operating system API: The API of the operating system cannot be used directly from the TwinCAT runtime. An example is the integration of windows.h in C/C++ code. This is integrated by the Simulink CoderTM if the FFTW implementation of the FFT block from the DSP Systems ToolboxTM is used (but not with the Radix 2 implementation), for example.
- Precompiled libraries: It is possible that during code generation by the Simulink CoderTM no platform-independent C/C++ code is generated, but precompiled libraries are included. In these cases, no real-time execution in TwinCAT is possible.