Opened 4 years ago

Closed 4 years ago

#6329 closed discussion (invalid)

Array of Component

Reported by: lukas.koenemann@… 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)

test2.mo (535 bytes ) - added by lukas.koenemann@… 4 years ago.
example for test

Download all attachments as: .zip

Change History (3)

by lukas.koenemann@…, 4 years ago

Attachment: test2.mo added

example for test

comment:1 by Francesco Casella, 4 years ago

Component: *unknown*New Instantiation
Milestone: NeedsInput1.17.0
Owner: changed from somebody to Per Östlund
Status: newassigned
Type: taskdiscussion

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.

in reply to:  1 comment:2 by Per Östlund, 4 years ago

Resolution: invalid
Status: assignedclosed

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.

Note: See TracTickets for help on using tickets.