问题
Given a model with an array x of connectors where its size is unspecified, e.g.
connector con
...
end con;
model test
con x[:];
end test;
How can x be instantiated with a specific size, e.g. something like this?
test t(x = ?);
...
equation
connect(t.x[1], a);
connect(t.x[2], b);
...
回答1:
Why do you need unspecified dimension? You can do something like this:
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);
...
来源:https://stackoverflow.com/questions/29187792/modelica-arrays-with-unspecified-dimension