windows - Significant 600 ms lag between TwinCAT 3 and Simulink using TCSymbol interface (TE1410). How can I reduce this latency

时间: 2025-01-06 admin 业界

I am running TwinCAT 3.1.4024.47 and Simulink (MATLAB 2022b) on the same PC with Windows 10 PC (16 GB DDR4, SSD M.2, Intel i7 Gen7). I’m using the TCSymbol interface (TE1410) in Simulink. The TwinCAT task cycle time is set to 30 ms, and the Simulink solver step size is set to 0.03 s (to match TwinCAT’s cycle).

Despite these settings, I consistently see a 600 ms delay—which is about 20 cycles—between TwinCAT and Simulink. My goal is to reduce this to 2 cycles (i.e., < 60 ms).

Here’s what I’ve tried so far:

  1. Set process priorities to real-time in Windows Task Manager (Details tab) for MATLAB, Simulink, and the TwinCAT process.
  2. Assigned TwinCAT to an isolated core using CPU affinity.
  3. Tested on a higher-performance PC (32 GB DDR4, i7 Gen11).

None of these steps significantly reduced the lag.

Questions:

  • Are there any known issues or limitations with the TCSymbol interface (TE1410) that cause this kind of latency?
  • Which Windows OS or scheduling configurations are most critical for reducing the delay between TwinCAT and Simulink?
  • Are there alternative approaches or recommended best practices to synchronize Simulink with a TwinCAT task more reliably?

Any insights, tips, or shared experiences would be greatly appreciated. Thank you!