【问题标题】:Find the variable that causes nonlinear error in Modelica models在 Modelica 模型中找出导致非线性误差的变量
【发布时间】:2021-10-14 07:58:32
【问题描述】:

我在Dymola中调试一个非线性模型,模型停在56600s,最后一个错误是

IF97 medium function g2 called with too low pressure
p = 611.643 Pa <= 611.657 Pa (triple point pressure)
Failed condition: p > 611.657

所以我尝试定位导致此错误的变量,但我不确定是否有一种简单的方法可以在 Dymola 中找到它,或者我需要输出非线性迭代详细信息,这将是一个巨大的日志文件。我的问题是:
我怎样才能简单地找到wrong variable

这是 dslog.txt 文件:

Expression preheaterHP_LevelController.limiter.u < preheaterHP_LevelController.limiter.uMin became false ( (preheaterHP_LevelController.limiter.u) - (preheaterHP_LevelController.limiter.uMin) = 1.2054e-09 )
Iterating to find consistent restart conditions.
      during event at Time :  52544.06110892259
Expression pPI1.limiter.u < pPI1.limiter.uMin became false ( (pPI1.limiter.u) - (pPI1.limiter.uMin) = 7.89853e-09 )
Iterating to find consistent restart conditions.
      during event at Time :  52681.07501417062

POINTA=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>

Expression  -vol_turbineHP1.drain[2].m_flow > 0.0 became true ( ( -vol_turbineHP1.drain[2].m_flow)-(0.0) = 1.96259e-14 )
Iterating to find consistent restart conditions.
      during event at Time :  56087.88419083787

=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>

POINTB=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>

Error: The following error was detected at time: 56600
  IF97 medium function g2 called with too low pressure
p = 611.643 Pa <= 611.657 Pa (triple point pressure)
  Failed condition: p > 611.657

=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>=>

Error: The following error was detected at time: 56598.40726897018
  IF97 medium function g2 called with too low pressure
p = 611.656 Pa <= 611.657 Pa (triple point pressure)
  Failed condition: p > 611.657
Error: The following error was detected at time: 56598.30750099612
  IF97 medium function g2 called with too low pressure
p = 611.657 Pa <= 611.657 Pa (triple point pressure)
  Failed condition: p > 611.657
Error: The following error was detected at time: 56598.30750099612
  IF97 medium function g2 called with too low pressure
p = 611.657 Pa <= 611.657 Pa (triple point pressure)
  Failed condition: p > 611.657

Integration terminated before reaching "StopTime" at T = 5.66e+04

【问题讨论】:

    标签: modelica dymola


    【解决方案1】:

    对于大多数模型,您应该确保您没有禁用 Simulation Setup>Debug>Include function call in messages 默认设置如下:

    Error: The following error was detected at time: 0
      IF97 medium function tsat called with too low pressure
    p = -210190 Pa <= 611.657 Pa (triple point pressure)
      Failed condition: p > 611.657
    The stack of functions is:
    Modelica.Media.Water.IF97_Utilities.BaseIF97.Basic.tsat
    Modelica.Media.Water.IF97_Utilities.BaseIF97.Regions.boilingcurve_p
    Modelica.Media.Water.IF97_Utilities.BaseIF97.Regions.hl_p
    Modelica.Media.Water.IF97_Utilities.BaseIF97.Regions.region_ph
    Modelica.Media.Water.IF97_Utilities.waterBaseProp_ph
    Modelica.Media.Water.IF97_Utilities.rho_props_ph(
    V18.port_a.p,
    volume4.medium.h,
    Modelica.Media.Water.IF97_Utilities.waterBaseProp_ph(V18.port_a.p, volume4.medium.h, 0, 0))
    Modelica.Media.Water.IF97_Utilities.rho_ph(pipeB7Pump.port_b.p, V18.port_a.h_outflow, 0, 0)
    Modelica.Media.Water.WaterIF97_ph.density_ph_Unique5(pipeB7Pump.port_b.p, V18.port_a.h_outflow, 0, 0)
    Modelica.Media.Water.WaterI...
    

    对于非常大的模型,这将被禁用(这将在 C 代码中编写并带有附加说明)。

    可以构建 dymosim 的调试版本(通过设置 Advanced.BuildDebugDymosim=true )并在这种情况下设置断点,然后从那里开始。

    【讨论】:

    • 我勾选了Include function call in messages选项,但是模型似乎太大了,以至于Dymola没有输出函数调用消息。有没有关于Advanced.BuildDebugDymosim=true的详细用法或信息,我在帮助文档中没有找到这个关键字。
    • 该标志确保 Dymosim.exe 中存在调试信息,以便您可以将普通 C/C++ 调试器附加到正在运行的模拟并获得良好的堆栈帧。
    猜你喜欢
    • 1970-01-01
    • 2013-07-31
    • 2016-08-20
    • 2017-08-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-04
    • 2020-08-08
    相关资源
    最近更新 更多