Help - Search - Members - Calendar
Full Version: component Array
Modelica Forum > Modelica > Modelica
noname
Hi everyone,
i have another question. I have a componenet/model called myComponent with more than 2 Parameters (u,v...) and i want to set up an Array of n of these components. The normal way to set this up would be:

QUELLTEXT
myComponent[n] componentArray;


or if you want to assign the same parameters to all elements:

QUELLTEXT
myComponent[n] componentArray(each u=1,v=2,....);


but how do i set it up if want all elements to look the same besides lets say the first and the last to get something like:

QUELLTEXT
componentArray[1] with u=2,v=7...
componentArray[2] with u=1,v=2...
..
..
componentArray[n-1] with u=1,v=2...
componentArray[n] with u=7,v=8...


kind regards
Hannes Wagner
noname
noone? ohmy.gif

Well I know, that way to set up component/model array is/was in developement according to Mr Tiller

IPB Bild
from M. Tiller Introduction to Physical Modeling With Modelica

but i hope that Modelica moved on beacaus his Book is from 2001. So it would be great if someone could throw some light on this.

kind regards
Hannes Wagner
using Dymola 6.0b
Rene Nölle
Hello everybody

Is there a new solution or developed way for that problem of setting up component/model array or not yet?
Roland
QUOTE(noname @ Nov 2 2006, 03:47 PM) *

[...]
how do i set it up if want all elements to look the same besides lets say the first and the last to get something like:

CODE
componentArray[1] with u=2,v=7...
componentArray[2] with u=1,v=2...
..
..
componentArray[n-1] with u=1,v=2...
componentArray[n] with u=7,v=8...



You can do whit with the following (I have to admit not quite simple looking) line:

CODE
myComponent componentArray[N](u = cat(1, {2}, {1 for i in 2:N-1}, {2}), v = cat(1, {7}, {2 for i in 2:N-1}, {8}));


A small hint: Types - in your example "myComponent" - should start with a capital letter. Although this does not influence the model itself in any way, this convention allows for other people to quicker understand your models.

Regards,
Roland
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.