RT Box 3: PWM Phase Shift and Duty Cycle Incorrect in Real-Time Simulation

We are experiencing an inconsistency between the offline PLECS simulation and the real-time simulation on an RT Box 3.

The complete PLECS model will be attached to this post for investigation.

Hardware / Software
RT Box: RT Box 3
Controller: TI C2000 LaunchPad XL, TMS320F28069M
PLECS: Version 5.0.6

Model
A three-phase cascaded SVG with two modules per phase, delta-connected. The control uses voltage-current double closed loops and bipolar carrier phase-shifted PWM. The DC side uses a voltage source and capacitor without voltage balancing control.

Problem

In offline simulation, the PWM duty cycle varies sinusoidally and the two modules have the expected 180° phase shift.

In real-time simulation:

-Sw01 and Sw02 do not have the expected 180° phase shift.
-The duty cycle does not vary as expected.
-The SVG output voltage becomes approximately a square wave.

Additional Tests

1.Reducing the step size from 100 µs to 10 µs restores the phase shift, but the duty cycle is still incorrect. Further reduction causes:
Sample time for task 0 on CPU 0 too small - raise sample time or system clock rate.

2.If the DC voltage source and resistor are removed, leaving only the DC-link capacitors, all PWM outputs become constant 0 or 1.

Questions

Could you please help us determine:

1.Why does the PWM behave differently between offline and real-time simulation?
2.Could the sample time, C2000 task scheduling, or code generation be related to the issue?
3.Why does removing the DC voltage source cause the PWM outputs to become constant 0/1?
4.Are there any specific PWM, C2000, or real-time simulation settings we should check?

The complete model is attached for reproduction.

Thank you for your support.

SVG0917C2000_voltagesource02.plecs (301.0 KB)

There is no difference in the PWM generation during offline and realtime generation. However, your system shows runaway behavior, even in offline simulation, and the modulation index values that you feed into the PWM blocks reach amplitudes of more than 100 in realtime simulation. You may want to fix your controller.