Hello everyone,
I build a dual-active-bridge Model in PLECS and then I want to build the target with “Generic”. But a error occures. It shows that “Code generation is not supported for models that contain algebraic loops” and I can’t build the file. But if I remove the resistor R1, the error disappears.
I am so confused about it. It’s appreciated if you could help me solve the problem. Thanks a lot!
DAB_online_mitdabmodell_pwmcapture.plecs (46.2 KB)
This is a limitation of the sub-step event power module. From the component documentation:
> The module is implemented with controlled current sources, on both primary and secondary terminals, instead of ideal switches. Both sides of the converter have current source behavior and must be connected to positively biased capacitors or voltage sources.
As you noted, if you remove R1, then the above condition is met.
One idea that might be worthwhile to explore - what if you place a relatively small capacitor (without an ESR) in parallel with your existing capacitor such that Xc,par << XC,esr + Resr? This will allow you to meet the condition to not have an algebraic loop, while still modeling the ESR. You might have to experiment with the Xc,par value to find one that has a minimal impact on the circuit response and is stable for Code Generation.
It is up to you to determine if removing R1 or adding a parallel capacitor is the preferred solution for your application.
Also, to run your model offline I had to change the “Averaging interval (offline only)” parameter to 1e-6 so that it matches the “Sample time” of the DAB module. Otherwise there is an error message.