Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

Can't not add a ESR for a Capacitor

0 votes
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!
asked Mar 30 by fish_94 (20 points)
edited Mar 31 by fish_94

1 Answer

0 votes
Best answer

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.

answered Mar 31 by Bryan Lieblick (691 points)
selected 4 days ago by fish_94
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.