Error occurred while running the simulation

17 Ansichten (letzte 30 Tage)
Marco Pellegrino
Marco Pellegrino am 30 Dez. 2022
Kommentiert: Sam Chak am 30 Dez. 2022
Hi,
I keep getting this error:
An error occurred while running the simulation and the simulation was terminated
Caused by:
Solver encountered an error while simulating model at time 6.6282282635683543e-17 and cannot continue. Please check the model for errors.
Nonlinear iteration is not converging with step size reduced to hmin (2.35482E-31) at time 6.62823E-17. Try reducing the minimum step size and/or relax the relative error tolerance.
I tried changing the solver from 'auto' to 'ode45' as someone suggested in other answers but the simulation now takes "infinite" time.
How could I try to figure out this issue?

Antworten (1)

Sam Chak
Sam Chak am 30 Dez. 2022
Hi Marco,
In most cases, the problem is likely caused by the singularity event, something like approaching the division-by-zero, or tan(90°). Also check if the system is "stiff" at the beginning of the simulation.
  2 Kommentare
Marco Pellegrino
Marco Pellegrino am 30 Dez. 2022
Thank you so much for your reply. How can I check it through the simulation? (I'm sorry but I'm not yet an experienced user).
Sam Chak
Sam Chak am 30 Dez. 2022
If your Simulink model consists of only fundamental blocks (no mask), then it should be rather easy to detect if there are any division block and trigonometric function block. Sometimes, then problem can be due to the system response is rapidly diverging to . Take a look at this example in MATLAB (not Simulink).
fun = @(t, x) (1e4)*x;
tspan = linspace(0, 10, 1001);
x0 = 1;
[t, x] = ode45(fun, tspan, x0)
t = 1001×1
0 0.0100 0.0200 0.0300 0.0400 0.0500 0.0600 0.0700 0.0800 0.0900
x = 1001×1
1.0e+260 * 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 3.7851 NaN NaN NaN
Also check if your system has discontinuities. Best is to post a clear screenshot of the Simulink model. Let the experienced users of Simulink help you to identify the root cause.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Event Functions finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by