Modelica中的条件组件

Modelica中的条件组件,modelica,dymola,openmodelica,Modelica,Dymola,Openmodelica,我想用条件表达式来简化包含300000多个方程的大型通用模型,这样只剩下相关部分。 为了说明这个问题,我使用了以下最小模型: model Test parameter Boolean level1=true; parameter Boolean level2=false; Integer x=1 if level1; Integer y=2 if level2; Integer z; equation if level1 and level2 then z = x

我想用条件表达式来简化包含300000多个方程的大型通用模型,这样只剩下相关部分。 为了说明这个问题,我使用了以下最小模型:

model Test
  parameter Boolean level1=true;
  parameter Boolean level2=false;
  Integer x=1 if level1;
  Integer y=2 if level2;
  Integer z;
equation
  if level1 and level2 then
    z = x+y;
  elseif level1 then
    z = x;
  elseif level2 then
    z = y;
  else
    z=0;
  end if;
end Test;
该模型在Dymola中不起作用, 出现以下错误消息:

未声明的变量:y,因为y的声明是有条件的 除去

在OpenModelica中,该模型起作用所以我的问题是,这款Modelica是否兼容? 在Modelica 3.4规范第4.4.5节中,我没有发现任何会使该模型无效的内容


感谢您的帮助。

否,因为
y
x
被声明为有条件的,并且4.4.5包含了“使用条件属性声明的组件只能在连接中修改和/或使用”的语句

没有特殊规则可以从if语句的分支中删除它们