Simulink does messes up step sizes (and doesn't do what I tell it)

2 次查看(过去 30 天)
Hi all,
I want to simulate a variable-step size system. The model includes a coupler to a circuit simulator and hence transmits the current step size to the other simulator on each step.
When I run the simulation, I get errors like these on the other side:
ERROR (SIMLNK-57): [Internal] An invalid message was received from the AMS simulator: NextTimeHit must be in future, NextTimeHit=3.875e-07, lastTime=3.875e-07, now=3.875e-07
It seems that simulink makes too small time steps, probably below numerical precision so they arrive as identical numbers on the other side. Alright, so I set:
Min step size: 1000e-12
This should prevent Simulink from making too small steps. But the problem persists!
Now I just remove the coupler and observe the difference in time steps (I export "Clock" to workspace):
plot(diff(simout_time));
This is the result:
Clearly, there are steps which are below the numerical precision (3.388e-21) although I told Simulink that the minimum step should be 1e-9 !!
How can this be fixed?
PS: Taking a fixed-step solvers works as expected but this is not what I want.
  1 个评论
Joachim Kahr
Joachim Kahr 2019-4-5
编辑:Joachim Kahr 2019-4-5
Has anyone found a solution to this problem?
I face the same problem and are not sure if this problem is only simulink related or if the communication over the socket leads to this problems.
KR,
Joachim
edit: setting the sample time of the coupler to a fixed step size is kind of a workaround as the min step size of the simulator does not affect the step size inherited from the coupler. anyway, this is a tradeoff between simulation time and accuracy....

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 General Applications 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by