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 Component2](denied: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?
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.