Error occurred while running the simulation

5 次查看(过去 30 天)
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?

回答(1 个)

Sam Chak
Sam Chak 2022-12-30
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 个评论
Marco Pellegrino
Marco Pellegrino 2022-12-30
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 2022-12-30
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by