Abnormal Zero Current in Hardware-in-the-Loop Simulation of a Three-Phase Three-Stage Cascaded PET with VSG Control

Your model is configured to run using the CPU for the electric circuit simulation, meaning that an offline “CodeGen” simulation (where the same C code used on the RT box runs in an offline simulation) can show the expected realtime behavior. You can right-click the RT Box subsystem and select “Subsystem + Simulation Mode + CodeGen” the enable this behavior.

When I run your model in the CodeGen mode the result is unstable. I haven’t analyzed your system enough to say exactly why, but there are a few candidates:

  • The CHB PWM generation is using a carrier compare generated in the C-Script. This introduces PWM quantization as your switching frequency is 10 kHz and you have an RT Box step size of 10 usec, so just 11 discrete PWM operating states are possible. See this previous forum post, although this topic has come up many other times on the forum. Since you are using the LaunchPad and have limited numbers of IO, one approach would be to have the CHB cells be average models. Instead of PWM input, you would put the average duty cycle for each switch into the CHB cells.
  • You are modeling the DAB components with H-Bridges instead of Nanostep components. This makes sense to have a simplified DAB component because you are limited to a total number of 6 DAB Nanostep instances. However, with this approach the DAB currents only update at the CPU step size which has just 10 samples per switching period. You should check the accuracy of this approach, but I suspect there is a large error here as DAB converters requires smaller update rates relative to the switching frequency to resolve smaller phase shifts. Perhaps one of your legs could be an average model?
  • There still can be underlying control issues that I have not investigated.