Discrepancy Between HIL-to-HIL and RT Box–STM32G474RE Results in Open-Loop Average Inverter Simulation

Hello,
I am currently designing an open-loop control system using an average inverter model on an HIL RT Box, where the plant is modeled on the RT Box and the open-loop controller is implemented on an STM32G474RE. The inverter is designed to inject 100 A of current into the grid by regulating the reference voltage Uref. The offline simulation results shown in Fig 1 indicate that the inverter current injected into the grid matches the design target.
In addition, I performed an HIL-to-HIL simulation, where the plant is modeled on RT Box 2 Core 0 and the controller is implemented on RT Box 2 Core 1. The results shown in Fig 2 indicate that the injected inverter current is slightly different from the offline simulation results, but is acceptable. However, when I performed the simulation using the RT Box together with the STM32G474RE, the results became significantly different, as shown in Fig 3.

How could the discrepancy between the HIL-to-HIL simulation and the RT Box–STM32 simulation?


Fig 1. Offline Simulation


Fig 2. HIL-to-HIL Simulation


Fig 3. RT Box-STM32 Simulation

Here model that i am using for RT Box-STM32 :

Open_Loop_Average_Model_Inverter.plecs (100.9 KB)

Hi Rizal

The sine wave running on the STM32G474 and the grid voltage phase angle (on the RT Box) drift, as the frequency is not exactly the same.

A more robust way would be to use a PLL that locks to the phase-angle of the measured three-phase voltages and recreates a sine wave based on the estimated grid phase-angle. See an example attached:

Open_Loop_Average_Model_Inverter_lc.plecs (112.1 KB)

Hope this helps.

Lino

Dear Mr. Lino

Thankyou for your explaining and solution.

Best regards
Rizal