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.

How to avoid algebraic loop when use variable load under external mode

0 votes
364 views
Hi
I made a three-phase grid-tied inverter integrated with pv & bess model, and using "from file" block to import solar irradiation and variable load value in 24 seconds, under simulation everything is fine, controller works well.
But in codegen mode, it appears three error as attachment.

It seems like "from file" can not be used in codegen mode, then which method can I adopt to solve those problem, and can be work in codegen mode.
asked Jun 4 by W.shawn.D (17 points)

1 Answer

0 votes

> But in codegen mode, it appears three error as attachment.

I cannot see your model, but our previous discussion on PV Models is likely relevant.  You either need to break the algebraic loop ensuring the inputs to your PV model are not directly influenced by the output (e.g. are states like capacitor voltage or inductor current), or you can break the loop with a low pass filter or discrete delay.  Do not use a Memory block (see the component help for a description as to why this is not advisable).

> It seems like "from file" can not be used in codegen mode, then which method can I adopt to solve those problem, and can be work in codegen mode.

You can process the CSV data into look-up tables.  See this forum post describing the technique.  The difference is that the file is read only at the start of the simulation / code generation process during model initialization.   The "DC Microgrid" C2000 model uses a similar technique, but encodes the data as a vector in the model initialization commands.

Note that rather than using the "Clock" block you'll want to use an integrator with rollover to prevent issues as the time approaches infinity.  Again, look in the "DC Microgrid" demo model at the "Time Generator" subsystem in the "DC Power Grid" part of the model.

answered Jun 6 by Bryan Lieblick (2,045 points)
...