Simulink does messes up step sizes (and doesn't do what I tell it)
2 views (last 30 days)
Show older comments
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 Comment
Joachim Kahr
on 5 Apr 2019
Edited: Joachim Kahr
on 5 Apr 2019
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....
Answers (0)
See Also
Categories
Find more on General Applications in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!