Discrepancy Between RT Box 2 Results and Offline Simulation in PLECS 4.9.5

Issue description:
I have encountered an issue with the PLECS Coder for HIL.

Attachments:

In the figure:

  • Figure 1: RT Box 2 results
  • Figure 2: offline simulation results (reference)

Although both results are generated from the same model file, the RT Box results and the offline simulation results do not match. In addition, I noticed that the waveforms returned from the RT Box vary slightly between different runs

Environment:

  • Hardware: RT Box 2
  • Software: PLECS 4.9.5

Your C-Script to calculate the G-values in the Plant uses the absolute simulation time. Since the controller and the plant are running asynchronously and are most likely not started at the same time, it is not surprising that you get different simulation results in each run (and in offline simulation as well).

Thank you for your advice! I’ll give it a try.