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 ?

回答 (1 件)

Selena Mastrodonato
Selena Mastrodonato 2023 年 5 月 11 日

0 投票

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

8 件のコメント

FAIZ UL HASSAN
FAIZ UL HASSAN 2023 年 5 月 11 日
編集済み: FAIZ UL HASSAN 2023 年 5 月 11 日
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.
Selena Mastrodonato
Selena Mastrodonato 2023 年 5 月 11 日
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 2023 年 5 月 11 日
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.
Selena Mastrodonato
Selena Mastrodonato 2023 年 5 月 11 日
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 2023 年 5 月 12 日
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.
Selena Mastrodonato
Selena Mastrodonato 2023 年 5 月 12 日
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 2023 年 5 月 12 日
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.
Selena Mastrodonato
Selena Mastrodonato 2023 年 5 月 12 日
Could you please attach the model?

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeConfigure Simulation Conditions についてさらに検索

製品

リリース

R2022b

タグ

質問済み:

2023 年 5 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by