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 simulate non-linear components in discrete simulation mode?

0 votes

I defined a component by myself and I found that I cannot simulate non-linear components in discrete mode,the error message is as follows:

The 'Discrete state-space' method cannot be used with circuits that contain nonlinear feedback loops (i.e. controlled electrical sources that depend on electrical meters). Please switch to the 'Continuous state-space' method or break the feedback loops.

Below is a list of the meters involved:
- MOV_RC_Aug_10/Plant/Algebraic Component1
- MOV_RC_Aug_10/Plant/Algebraic Component
- MOV_RC_Aug_10/Plant/Algebraic Component2

But I want to generate code for RT-BOX and c2000 launchpad ,that means I have to use discrete mode, so how can I manage the problem?

asked Aug 10, 2020 by shichenseu (299 points)

1 Answer

+1 vote
Based on the error message you are using an Algebraic Component in your model.  By definition the Algebraic Component variations introduce an algebraic loop into the model, and the PLECS Coder does not support code generation for models with algebraic loops.

This is documented in the PLECS Documentation under Code Generation + Unsupported Components.

You'll have to derive an alternative way to create your custom component using controlled sources and measurements, along with any necessary delays in the feedback path to break resulting algebraic loops. When breaking the algebraic loops, note the Discretization Behavior setting of any controlled sources, which can be configured to be first-order or zero-order holds.  Refer to the documentation for a more complete description.
answered Aug 10, 2020 by Bryan Lieblick (1,949 points)
Thank U so much!