【问题标题】:Modelica Evaluation OrderModelica 评估顺序
【发布时间】:2014-02-27 09:11:03
【问题描述】:

我真的无法在 Modelica 规范中找到任何答案,所以请教各位。该规范指出 A tool is free to solve equations, reorder expressions and to not evaluate expressions if their values do not influence the result (e.g. short-circuit evaluation of Boolean expressions). If-statements and if-expressions guarantee that their clauses are only evaluated if the appropriate condition is true, but relational operators generating state or time events will during continuous integration have the value from the most recent event. If a numeric operation overflows the result is undefined. For literals it is recommended to automatically convert the number to another type with greater precision. 现在,我想知道,该工具是否可以选择在积分器步骤中多次评估表达式?例如(可能不是一个有效的例子,只是为了让你们知道我在想什么:))

Real x;

equation
  der(x) = -t;
  Modelica.Utilities.Streams.print(String(time));

这将多次打印相同的时间,所以我认为正在进行某种迭代。但我真的很想得到一些消息来源的证实。

【问题讨论】:

    标签: evaluation modelica numerical-analysis dymola


    【解决方案1】:

    这很正常。 可变步长求解器(如 dassl)可以返回 来回及时找到曲线的方向。 此外,如果您有事件,可以生成更多值 同时。

    如果您想在方程式所需的确切时间点打印时间或值:

    when sample(0, 1) then
      Modelica.Utilities.Streams.print(String(time));
    end when;
    

    在 Modelica 规范中阅读有关示例的更多信息。

    也可以使用像 Euler 这样的固定步长求解器。

    【讨论】:

    • 即使是固定步长求解器也可能会根据寻根策略及时倒退;)
    • 感谢阿德里安·波普!我以为是这样。我现在实际上正在写我的硕士论文,这就是为什么我想真正确定。你知道我在哪里可以找到这方面的信息吗?写报告时可以作为参考。
    • 如果您想了解系统仿真的详细信息,那么您可以看看这些书籍: - François E. Cellier 和 Ernesto Kofman 的 Continuous System Simulation - François E. Cellier 的 Continuous System Modeling 和于尔根·格莱芬德
    猜你喜欢
    • 1970-01-01
    • 2023-02-15
    • 1970-01-01
    • 2018-11-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-05
    相关资源
    最近更新 更多