Cannot solve due to algebraic loop involving

Cannot solve algebraic loop involving 'Model_Test/Controller' because it consists of blocks that cannot be assigned algebraic variables, such as blocks with discrete-valued outputs, blocks with non-double or complex outputs, Stateflow blocks, or nonvirtual subsystems. Consider breaking the algebraic loop.
Component:Simulink | Category:Model error
Algebraic loop error with 'Model_Test/ Model '
Component:Simulink | Category:Model error
Algebraic loop error with 'Model_Test/Controller'
How to fix this error ?

Respuestas (1)

Selena Mastrodonato
Selena Mastrodonato el 11 de Mayo de 2023

0 votos

Hi @FAIZ UL HASSAN, try to add a Unit delay block.

8 comentarios

FAIZ UL HASSAN
FAIZ UL HASSAN el 11 de Mayo de 2023
Editada: FAIZ UL HASSAN el 11 de Mayo de 2023
Hi @Selena Mastrodonato An error occurred while running the simulation and the simulation was terminated
Caused by:
  • Solver encountered an error while simulating model 'Model_Test' at time 5.5795761657837017e-05 and cannot continue. Please check the model for errors.
  • Nonlinear iteration is not converging with step size reduced to hmin (1.98226E-19) at time 5.57958E-05. Try reducing the minimum step size and/or relax the relative error tolerance.
How to fix this ? Simulation time is 260 seconds, which will be increased later on.
Try to change the solver type in the settings. There is a similar question here: https://it.mathworks.com/matlabcentral/answers/451575-what-does-the-nonlinear-iteration-is-not-converging-error-mean
FAIZ UL HASSAN
FAIZ UL HASSAN el 11 de Mayo de 2023
An error occurred while running the simulation and the simulation was terminated
Caused by:
  • Solver encountered an error while simulating model 'Model_Test' at time 5.2992237741531963e-05 and cannot continue. Please check the model for errors.
  • Nonlinear iteration is not converging with step size reduced to hmin (1.88266E-19) at time 5.29922E-05. Try reducing the minimum step size and/or relax the relative error tolerance.
An error occurred while running the simulation and the simulation was terminated
Caused by:
  • Solver encountered an error while simulating model 'Model_Test' at time 5.4300459462878509e-05 and cannot continue. Please check the model for errors.
  • Nonlinear iteration is not converging with step size reduced to hmin (1.92914E-19) at time 5.43005E-05. Try reducing the minimum step size and/or relax the relative error tolerance.
Still getting these errors as I tried different solver with changes in minimum step size, unable to fix this.
To understand where the fix is needed, try to insert some labels on the signals of main interest, and check if one or more of them is diverging to +/-infinity: switching from variable step size to fixed step size in your simulation settings may help you overcome all these errors.
Add also a picture of your model if the problem still persists. You probably know where the problem should reside, just provide some numeric information when needed.
FAIZ UL HASSAN
FAIZ UL HASSAN el 12 de Mayo de 2023
An error occurred while running the simulation and the simulation was terminated
Caused by:
  • Derivative of state '1' in block 'Model_TestNew/Integrator3' at time 0.2 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)
Component:Simulink | Category:Block error
Still getting this error, as I tried reducing the fixed step size with auto solver. I also tried variable step size with possible solver like ode45, ode15 and recommended settings. Error is on this integrator in which I just changed the initial condition.
Which is the initial condition? Did you also try ode15s (stiff/NDF) with variable step?
Anyway, you should debug the model with Simulink debugger to identify where the singularity occurs (an Inf or NaN).
Maybe it causes an algebraic loop, so you could try also to insert a unit delay block
FAIZ UL HASSAN
FAIZ UL HASSAN el 12 de Mayo de 2023
Initial condition for output graph to start from (non zero value) and yes I tried ode15s (stiff/NDF) with different values of relative and absolute tolerance. I already added unit delay for algebraic loop.
Could you please attach the model?

Iniciar sesión para comentar.

Categorías

Más información sobre Configure Simulation Conditions en Centro de ayuda y File Exchange.

Productos

Versión

R2022b

Etiquetas

Preguntada:

el 11 de Mayo de 2023

Comentada:

el 12 de Mayo de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by