下面的 Modelica 包——虽然既不是特别有用也不是特别有趣——不会产生任何警告。
package P
connector C
Real c;
end C;
model A
input C x;
output Real y;
equation
y = x.c;
end A;
model B
input C inp;
output C out;
A a;
equation
a.x = inp;
out.c = a.y;
end B;
end P;
但是,A
在以下情况下不使用连接器时,会出现警告:以下输入缺少绑定方程:a.x
。显然,对于 有一个约束方程a.x
。为什么会有这样的警告?
package P
connector C
Real c;
end C;
model A
input Real x;
output Real y;
equation
y = x;
end A;
model B
input C inp;
output C out;
A a;
equation
a.x = inp.c;
out.c = a.y;
end B;
end P;