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
  • Index
  • » Users
  • » psch90
  • » Profile

Posts

Posts

Apr-02-14 14:30:57
Category: Programming

I have a central block in my model (a engine). There I can read for example a external ASCII-file (table). In other blocks of the engine I need to transfer some variables from this central block and also read the external table (references of the central block). This works fine so far.

But now it is possible that I have two engines with the same structure in my model. Therefore I need two of these central blocks. The whole process should be automized in the end. So it is not possible to change the references manually.

Any idea for another solution is welcome.

Thank you!

Apr-02-14 12:56:01
Category: Programming

No ideas about this issue?

Mar-28-14 11:44:45
Category: Programming

Hello,

is it possible to change a reference-name in a model, for example with a string? Following Code-example (not working) should explain my question:

model test

parameter String a="excitation";  //this parameter should be exchangeable
Real y;

algorithm
  y:=a.y; // should be: excitation.y
end test;

Is there a way to make this possible? When not, do you have a workaround for my problem?

Thanks a lot!

Mar-24-14 18:57:18
Creating a vector of different tableIDs (2DCombiTable)
Category: Programming

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

Mar-24-14 18:16:11
Creating a vector of different tableIDs (2DCombiTable)
Category: Programming

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!

  • Index
  • » Users
  • » psch90
  • » Profile
You are here: