Opened 4 years ago

Closed 4 years ago

#6329 closed discussion (invalid)

Array of Component

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

Changed 4 years ago by lukas.koenemann@…

example for test

comment:1 follow-up: Changed 4 years ago by casella

  • Component changed from *unknown* to New Instantiation
  • Milestone changed from NeedsInput to 1.17.0
  • Owner changed from somebody to perost
  • Status changed from new to assigned
  • Type changed from task to 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 in reply to: ↑ 1 Changed 4 years ago by perost

  • Resolution set to invalid
  • Status changed from assigned to 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.

Note: See TracTickets for help on using tickets.