I am trying to adapt the plant of my DAB for controller HIL. I am using the DAB component found in the component library and the offline simulation runs but when I tried to build to RTBox1 I get the error: The secondary terminals of dual_active_bridge/DAB Plant/DAB1 must be connected directly to a capacitor or voltage source.
However, when I remove any resistors that were connected along with the capacitor (C1 and C3) (see image), I am able to build to RTBox, but I get the red error light. Upon trying to run offline simulation again, I get a new error caused by the missing resistor: State discontinuity after switching.
The voltage across capacitor dual_active_bridge/DAB Plant/C3 is forced to jump from 800 to 0.
It appears that the high-side and low-side PWMs (S14/S23 and S58/S67) are being turned on at the same time.
The PWM module starts in its inactive state. In your model, since the PWM polarity is configured as active low (i.e., the active state corresponds to logic 0), the inactive state causes both the high-side and low-side outputs to be driven high simultaneously, resulting in the error.
If I change the PWM polarity to active high, the simulation runs without any errors.
From the way your model is configured, I believe you intended the PWM outputs to be active high, but perhaps I’m missing something. Is there a particular reason you configured the PWM polarity as active low?
I must have accidentally configured the PWM to be active low. The offline simulation all works now!
However, I can successfully build to RTBox1, but the blue ‘Running’ LED is not turning on and the red ‘Error’ LED is on instead. How can I see what the cause of the error is? It is not an issue with the RTBox since it works properly for other models.
I see, the issue is that my FPGA version (4.0.6) must match the application library version (4.0.7). Is there a way to upgrade the FPGA version or is my only option to downgrade the application library version? I cannot seem to find any documentation on the FPGA version.
It worked! Thank you so much for your help! I have one more question though: My model works properly in offline simulation, but when I build to RTBox and c2000, my output voltage drops to 0 and there is no power transfer at all. The switching signals are also present but they aren’t the perfect square waves from offline simulation due to the PWM capture. Do you have any idea why it isn’t working online? I double-checked my scales and offsets and everything I could think of and cannot find anything amiss. The image with the imperfect PWM is the online version. I also attached my model again as it has some changes.
I had a quick look at your model, and my primary concern is that the 100 kHz control execution rate is likely too high for the TI MCU.
When I attempt to connect to the MCU using External Mode, I receive an overrun error, which indicates that the control task is not able to complete its execution within the allotted time. As a result, I am unable to run the model in real time.
I would recommend lowering the control task execution rate. Typically, the control task is executed at the switching frequency or lower. In your model, however, the controller is running at 100 kHz, which is 5× the switching frequency. This is not a typical configuration.
I also noticed that you are downsampling the measurements back to 20 kHz before they are used by the controller. This raises the question of why the controller needs to execute at 100 kHz if it is only receiving new measurement data every 20 kHz.
I would recommend reducing the control task rate, retuning your controller and seeing if that resolves the overrun issue.