Why do I keep getting solver errors when using custom SSC blocks in SimDriveline 2.4, SimMechanics 4.2 (R2013a)?
1 view (last 30 days)
Show older comments
I have created a custom SSC block for SimDriveline and I am using it in conjunction with other SSC related blocks (SimMechanics, SimDriveline, etc). I am getting solver errors such as:
Transient initialization, solving for consistent states and modes, failed to converge.
...Nonlinear solver: failed to converge, residual norm too large.
......Here is the set of components with unconverged equations:
This error will then point to numerous blocks in the model. When checking for zero crossings at the solver error time, there were not as many zero crossings occuring during the crash time as expected. Changing the solver from variable to fixed step fixes the issue. However, it seems that no matter what settings are used, the variable step solver does not work.
Why is this occurring?
Accepted Answer
MathWorks Support Team
on 7 Jun 2013
It could be possible that the custom SSC block is to blame. To narrow down this issue
look at the inputs to the Simscape network. Based on that, remove the Simscape blocks one by one. As blocks are removed, the error might point closer to the custom SSC block.
If the error has been narrowed down to the custom SSC block, examine the SSC code. Look for any discontinuities, especially in if/else conditions in which states could be switching instantaneously. This is generally bad for variable step solvers as it could cause solver errors such as the one here. For instance:
elseif ((Win>0) && (Tcmd<0)) || ((Win<0) && (Tcmd>0))
eff == -(Tout*Wout)/(Tin*Win);
else % (Win>0 && Tcmd<0) ||(Win<0 && Tcmd>0)
eff == -(Tin*Win)/(Tout*Wout);
end
In this example, it is noted that an error could happen when when switching between the two possibilities for eff (when Tin, Tout and Tcmd are close to zero). By adding more continuity between these conditions your chances of encountering a solver error is reduced.
0 Comments
More Answers (0)
See Also
Categories
Find more on Simulation Setup in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!