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

Modelica.Blocks.Tables.CombiTable1D

Modelica.Blocks.Tables.CombiTable1D

Hi,
I have a simple model that has an algorithm section. Using the same look-up table, I am trying to find losses that correspond to 2 different inputs and I want to get the total loss in the end.
model test1_alg
  parameter Real rating(start = 40000);
  Real loss1;
  Real loss;
  Real P1=-40000 ;
  Real  P2 =-10000;
  Modelica.Blocks.Tables.CombiTable1D Loss_inputP(tableOnFile = true, tableName = "table_input_loss", fileName = "..../input_loss.txt") ;
algorithm
  Loss_inputP.u[1] := abs(P1) * 100 / rating;
  loss1 := rating * Loss_inputP.y[1] / 100;
  Loss_inputP.u[1] := abs(P2) * 100 / rating;
  loss := rating * Loss_inputP.y[1] / 100;
  loss1 := loss + loss1;
end test1_alg;

When I test this model, I observe that the very first output of the look-up table is lost. This is what I expect:
Loss_inputP.u[1]=100
loss1= 8000 (from the table)
Loss_inputP.u[1]=25
loss= 1000 (from the table)
so loss1 should be 9000 in the end.

HOWEVER, simulation result has loss=1000 and loss1=2000 indicating that the first look-up is kind of overwritten.

Can anybody give me some explanations? (The model above is a very simplified one with  respect to the original model I am working on.)

Thank you very much in advance.


For some reason I was not able to attach the txt file. Here's the table used:
#1
double table_input_loss(15,2)
0    0
2.55    2.5
3    2.5
7.5    2.5
12.5    2.5
17.5    2.5
22.5    2.5
32.5    2.5
42.5    2.5
54    4
67.5    7.5
82.5    12.5
100    20
120    30
142.5    42.5

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