主要内容

Solver Exception Events

公差事件

该示例模拟了两个相同的非线性弹簧阻尼系统。这两个系统具有不同的弹簧刚度。

当你运行分析器的求解程序on this model, you can see the tolerance-exceeding events in theSolver Exceptiontab.

The result indicates that the stiffer spring causes the solver tolerance to exceed the limit. Typically, model states that change the fastest tend to be closest to the solver tolerance limit.

The solver attempts to take the largest possible steps while optimally trading off between speed and accuracy. Occasionally, this tradeoff causes the solver to take steps that exceed the tolerance limit and forces it to reduce the step size. Exceeding the tolerance limit is not a poor modeling practice in itself. This profiler statistic is not meant to help you reduce tolerance exceeding events to zero.

该统计数据可以帮助您确定模型的一部分,这些部分接近公差限制。您可以识别改变最快或最僵硬的模型组件。您可以决定将此模型保留在模拟中,或简化它以加快仿真。

The tolerance-exceeding statistic can also help you identify modeling errors. If you do not expect the highlighted states to change as fast, you can examine your model for errors. In this example, the modeling error could be that the stiffness of the stiffer spring is specified inN/minstead ofN/mm。此错误使弹簧比预期的1000倍更硬。

Newton Iteration Failures

Newton iteration failures are specific to implicit solvers likeode15sode23t, and they result from Newton iterations not converging after a few trials. Similar to tolerance-exceeding events, these failures tend to occur when a system changes quickly.

This example simulates how the radius of a ball of flame changes when you strike a match. The ball of flame grows rapidly until it reaches a critical size, when the amount of oxygen consumed balances the growth in ball surface.

当你运行分析器的求解程序on this model, you can see the Newton iteration failures in theSolver Exceptiontab.

The result indicates that when the combustion begins, the solver tolerance is exceeded multiple times. When equilibrium is attained, the system appears different, and a Newton iteration failure occurs. The Jacobian of the system is recomputed, and the solver continues to move forward.

Newton failures are not indicative of poor modeling practices. This profiler statistic is not meant to help you reduce these failures to zero. In this example, you can reduce the solver tolerance to prevent this failure. But the solver then takes small steps unnecessarily, which is counterproductive. Therefore, in this example, this failure is acceptable.

当短时间内大量出现这种故障时,尤其是在SIMSCAPE™模型中,它就会变得有问题。密集失败表明您的模型在数值上不稳定。提高数值鲁棒性的一种方法是收紧求解器的公差。另一种方法是修改模型以避免快速变化。

无限状态和无限导数例外

An infinite state exception occurs when the magnitude of a state approaches infinity. Similarly, when the magnitude of the derivative of a state approaches infinity, an infinite derivative exception occurs. The solver reduces the step size and makes another attempt at integration.

此示例显示了两个集成商有限公司初始条件略低于Realmax。当他们整合持续的输入的1e305, the solver quickly reaches the infinite state exception.

当您运行此模型的求解器profiler时,您可以看到InfiniteState5InfiniteState7块有188152infinite state exceptions in the求解器例外tab.

Differential Algebraic Equation Failures

与Simulink相比万博1manbetx®模型,使用普通的微分方程。

The use of DAEs adds complexity to Simscape models. Solvers likeode15sode23t可以处理多种类型的DAE。但是,当Simscape组件之间的代数约束复杂且快速变化时,牛顿迭代过程无法解决这些约束。

该示例模拟了一个可以针对两个液压腔之一的压力源。

When you simulate this model, Simulink displays several warnings.

通常,小型型号可以处理此类警告并模拟完成。但是,此警告表明该模型在数值上不强大。对模型的较小更改或集成到较大模型中可能会导致错误。

当你运行分析器的求解程序on this model, you can see the DAE failures in theSolver Exceptiontab.

在这种情况下,例外是由于较大的求解器耐受性而导致的。收紧求解器的公差会迫使求解器采取较小的步骤,并更好地捕获代数约束的变化。

Alternatively, this exception can be avoided by removing the algebraic constraint. In this example, theCheck Valve和the4向方向阀are directly connected. When their pressure–flow relationship changes rapidly, the solver is unable to capture the changes. Inserting aHydraulic Chamberbetween those two components makes them compliant. To learn more about dry nodes, see Simscape documentation.