Opened 4 years ago
Closed 4 years ago
#6329 closed discussion (invalid)
Array of Component
Reported by: | Owned by: | Per Östlund | |
---|---|---|---|
Priority: | high | Milestone: | 1.17.0 |
Component: | New Instantiation | Version: | v1.17.0-dev |
Keywords: | Cc: |
Description
Hello,
I want to use an array of component with different models/compents that have the same base model. Is that possibel? I have an example attached.
Best regards,
Lukas
Attachments (1)
Change History (3)
by , 4 years ago
follow-up: 2 comment:1 by , 4 years ago
Component: | *unknown* → New Instantiation |
---|---|
Milestone: | NeedsInput → 1.17.0 |
Owner: | changed from | to
Status: | new → assigned |
Type: | task → discussion |
If you check the definition of array in the newly released Modelica 3.5 specification, you can read
A non-record array can be regarded as a collection of type compatible values, section 6.7. An array of records may contain scalar record values whose elements differ in their dimension sizes, but apart from that they must be of the same type. Such heterogenous arrays may only be used completely, sliced as specified, or indexed. An array of arrays must have the same dimension sizes for all of the arrays (with the same exception for records). Modelica arrays can be multidimensional and are “rectangular”, which in the case of matrices has the consequence that all rows in a matrix have equal length, and all columns have equal length.
In your example, C1
and C2
are sub-types of base
, but they are not the same type. So I understand the answer to your question is 'no'.
I'll leave this to @perost for further comments.
comment:2 by , 4 years ago
Resolution: | → invalid |
---|---|
Status: | assigned → closed |
Replying to casella:
I'll leave this to @perost for further comments.
No further comment needed, the array elements must be type compatible like you say.
example for test