My simscape model will not run.

4 views (last 30 days)
dkuang
dkuang on 1 Mar 2016
Answered: Sebastian Castro on 1 Mar 2016
I have tried running a simscape model, but I got an error which states that An error occurred while running the simulation and the simulation was terminated Caused by: Simulink cannot solve the algebraic loop containing 'Motor/Solver Configuration1/EVAL_KEY/INPUT_6_1_1' at time 8.0E-5 using the LineSearch-based algorithm due to one of the following reasons: the model is ill-defined i.e., the system equations do not have a solution; or the nonlinear equation solver failed to converge due to numerical issues. To rule out solver convergence as the cause of this error, either a) switch to TrustRegion-based algorithm using set_param('Motor','AlgebraicLoopSolver','TrustRegion') b) reducing the ode45 solver RelTol parameter so that the solver takes smaller time steps. If the error persists in spite of the above changes, then the model is likely ill-defined and requires modification.
Image of Error
What I can I do to fix this error? Attached is my model I attempted to run.

Answers (1)

Sebastian Castro
Sebastian Castro on 1 Mar 2016
This can happen when you have an algebraic loop in Simulink. This happens when a block's output depends directly on its input, so Simulink cannot solve it step-by-step and has to iterate to solve. Sometimes this iterative solution can fail, which is what you're seeing.
In the context of Simscape, this happens when you are measuring a Simscape output, doing a direct calculation on it, and applying this value back as an input to Simscape.
If your algorithm is discretely sampled, you should add a Unit Delay before that measured "Stator Current" is fed to the controller -- this can represent a sensor delay. If it's a continuous algorithm, you can similarly break the algebraic loop by using a low-pass filter (Transfer Fcn block).
- Sebastian

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!