Modelica评估订单

时间:2014-02-27 09:11:04

标签: evaluation modelica numerical-analysis dymola

我无法在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));

这将同时打印几次,所以我认为有某种迭代正在进行。但我真的希望得到一些消息来源的肯定。

1 个答案:

答案 0 :(得分:5)

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

如果您想在方程式时按正确的时间打印时间或值:

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

在Modelica规范中阅读更多关于样本的内容。

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

相关问题