我有一个人为的Modelica模型,其中有一个由多个 when
语句操纵的状态机变量:
model WhenExample
type State = enumeration(first, second, third);
State state;
initial equation
state = State.first;
equation
when sample(0, 1) then
state = State.second;
end when;
when sample(0, 3) then
state = State.third;
end when;
end WhenExample;
在OpenModelica OMC下编译时,我收到以下错误:
[1] 16:46:39 Symbolic Error
Too many equations, over-determined system. The model has 2 equation(s) and 1 variable(s).
这有点意义,因为我的单个 state
变量有两个方程式 . 但是,这些方程仅适用于离散时间点,对吧?
我是否需要确保特定变量的所有"manipulations"仅在单个 when
语句中发生?
1 回答
请参见Modelica规范,第8.5节“事件和同步”:https://www.modelica.org/documents/ModelicaSpec33Revision1.pdf
就在第8.6节之前,有一个例子可以帮助你 . 基于此的一些代码如下: