具有未指定维度的 Modelica 数组

Modelica arrays with unspecified dimension

给定一个模型,该模型具有未指定大小的连接器数组 x,例如

connector con
...
end con;

model test
con x[:];
end test;

如何将 x 实例化为特定大小,例如是这样的吗?

test t(x = ?);
...
equation
connect(t.x[1], a);
connect(t.x[2], b);
...

为什么需要未指定维度?你可以这样做:

connector con
...
end con;

model test
 constant Integer dim = 1;
 con x[dim];
end test;

// usage
test(dim = 10);
...
equation
  connect(t.x[1], a);
  connect(t.x[2], b);
...