# PMSM FOC works in offline simulation but not on RT Box

**URL:** <https://forum.plexim.com/t/pmsm-foc-works-in-offline-simulation-but-not-on-rt-box/3336>\
**Category:** RT Box\
**Tags:** plecs, rt-box, pmsm\
**Created:** [October 9, 2026, 12:20am UTC](https://forum.plexim.com/t/pmsm-foc-works-in-offline-simulation-but-not-on-rt-box/3336 "2026-10-09T00:20:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![angular\_dot](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@angular\_dot](https://forum.plexim.com/u/angular_dot)\
**Post date:** [October 9, 2026, 12:20am UTC](https://forum.plexim.com/t/pmsm-foc-works-in-offline-simulation-but-not-on-rt-box/3336/1 "2026-10-09T00:20:50Z")

</div>

[SSZ.plecs](https://forum.plexim.com/uploads/short-url/yKLZ5b7nv4rXG7JZMh6c1BNCU5A.plecs) (211.1 KB)

Hello,

I am using the Plexim **“Sensorless Vector Control of a PMSM” demo model** as a reference to implement the FOC of my own PMSM. I have modified the demo model with my motor parameters, switching frequency, controller parameters, and operating conditions.

I have successfully implemented and tested the modified FOC model in **PLECS offline simulation** , and it is working as expected.

 ![Picture1](https://europe1.discourse-cdn.com/flex006/uploads/plecs/original/2X/3/38ac42efa7fb00fa524aa9d59fcf0bd857e1449b.webp)

However, when I try to run the same model on the **RT Box** , it does not work as expected.

I am not sure what I am missing when moving from the offline simulation to the RT Box implementation. The motor and controller parameters have been calculated/tuned for my PMSM, and the required controller blocks have been discretized for real-time implementation. Since I started from the working Plexim demo model and the modified model is also working correctly offline, I expected similar behavior after deploying it to the RT Box.

My main configuration is:

- PMSM FOC
- DC-link voltage: **600 V**
- Switching frequency: **6 kHz**
- Pole pairs: **2**
- Rated power: **10 kW**
- Rated mechanical speed: **1500 rpm**
- Current and speed PI controllers adapted for my motor
- Discrete controller implementation for RT Box

I would like to understand whether there are any additional changes required when moving from the offline model to RT Box, particularly regarding:

- Plant and controller sample times
- Fixed-step/discrete implementation
- PWM configuration and timing
- RT Box task configuration
- I/O scaling or delays
- Any other RT Box-specific settings that may cause the offline and real-time results to differ

I am attaching my modified PLECS model so that the configuration can be checked directly.

I would really appreciate any suggestions about what I may have missed or what I should check to identify why the model works correctly offline but not on the RT Box.

Thank you in advance for your help.
