具有未指定维度的 Modelica 数组 [英] Modelica arrays with unspecified dimension
本文介绍了具有未指定维度的 Modelica 数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
给定一个具有连接器数组 x 的模型,其大小未指定,例如
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;
如何使用特定大小实例化 x,例如像这样的?
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);
...
推荐答案
为什么需要未指定维度?你可以这样做:
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);
...
这篇关于具有未指定维度的 Modelica 数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文