Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

vector of tableIDs

vector of tableIDs

Hello,

I 'm new to the Modelica language and try to learn it by trial and error. I wrote a new object including some parts of the "CombiTable2D"-object of the Modelica Standard Library. In my new object I have to read different table-files. Therefore i created different Instances for the tableID's, for example:

Code:


Modelica.Blocks.Types.ExternalCombiTable2D tableID1=Modelica.Blocks.Types.ExternalCombiTable2D(tableName1,fileName1,table1,smoothness);

Modelica.Blocks.Types.ExternalCombiTable2D tableID2=Modelica.Blocks.Types.ExternalCombiTable2D(tableName2,fileName2,table2,smoothness);

Now it would be necessery for my planned model, that I can creat a vector like this:

Code:


Modelica.Blocks.Types.ExternalCombiTable2D tableIDs[5];

algorithm
for i in 1:5 loop           
tableIDs[i]:=tableID1;           
end for;
tableIDs[3]:=tableID2;

This does not work in my model: "tableIDs" is not a vector.
When I creat the vector like the following code, it works fine.

Code:


Modelica.Blocks.Types.ExternalCombiTable2D tableIDs[5]={tableID1,tableID1,tableID2,tableID1,tableID1};

But I need to create it in a for loop. Can anyone tell me what I did wrong?

Thanks for your help!

Re: vector of tableIDs

You are not allowed to assign to an external object except in the declaration binding. You can never change an external object pointer or alias one external object to another.

Re: vector of tableIDs

Thank you for your fast help! I probably have to reconsider my modelling concept now.

There are 0 guests and 0 other users also viewing this topic
You are here: