Modelica 为预处理生成代码时出现内部错误

Modelica 为预处理生成代码时出现内部错误,modelica,dymola,Modelica,Dymola,我试图通过使用pre操作符来避免Modelica中的代数循环,但是当我使用类似pre(x>0.5)的东西时,在pre的代码生成中会出现内部错误。 如果我使用pre(cond),其中cond是一个布尔型变量,就不会有任何错误 我的问题是:pre操作符是否有一些规定要求我不能在pre操作符中使用表达式 以下是代码和屏幕截图: model WithAlgebraicLoop_Wrong2 "Demonstration of how to avoid generating algebrai

我试图通过使用
pre
操作符来避免Modelica中的代数循环,但是当我使用类似
pre(x>0.5)
的东西时,在pre的代码生成中会出现
内部错误。
如果我使用
pre(cond)
,其中
cond
是一个布尔型变量,就不会有任何错误

我的问题是:
pre
操作符是否有一些规定要求我不能在
pre
操作符中使用表达式

以下是代码和屏幕截图:

model WithAlgebraicLoop_Wrong2
  "Demonstration of how to avoid generating algebraic loop,
  but end up with internal error in code generation for pre"
  Real x,y(start=1,fixed=true);
equation 
  when pre(x>0.5) then
    y=1*time;
  end when;
  x=sin(y*10*time);
end WithAlgebraicLoop_Wrong2;


您可以在Modelica语言规范(->表)中看到,
pre
的参数需要是变量,而不是表达式

model WithAlgebraicLoop_Right "Demonstration of how to avoid generating algebraic loop"
  Real x,y(start=1,fixed=true);
  Boolean cond;
equation 
  cond=x>0.5;
  when pre(cond) then
    y=1*time;
  end when;
  x=sin(y*10*time);
end WithAlgebraicLoop_Right;