- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » combiTable2D problem: SOLVED
combiTable2D problem: SOLVED
combiTable2D problem: SOLVED
Hi All,
Can anyone advise how to use tableOnFile option of combiTable2D? It seems that there is a problem with interpreting external file content during simulation.
model lookup_test "table lookup"
Modelica.Blocks.Sources.Ramp u1_input(height = 2, duration = 1, offset = 0, startTime = 0);
Modelica.Blocks.Tables.CombiTable2D lookupFunction(tableOnFile = true, tableName = "table2D_1", fileName = "D:/Modelica/RailSim/Tests/lookup_test.txt");
Modelica.Blocks.Sources.Constant u2_input(k = 2);
equation
connect(u2_input.y,lookupFunction.u2);
connect(u1_input.y,lookupFunction.u1);
end lookup_test;
lookup_test.txt contains the following (as in example for combiTable2D):
#1
double table2D_1(3,4) # comment line
0.0 1.0 2.0 3.0 # u[2] grid points
1.0 1.0 3.0 5.0
2.0 2.0 4.0 6.0
double table2D_2(4,4) # comment line
0.0 1.0 2.0 3.0 # u[2] grid points
1.0 1.0 3.0 5.0
2.0 2.0 4.0 6.0
3.0 3.0 5.0 7.0
SIMULATION RESULT:
Simulation execution failed for model: lookup_test
No table named `table2D_1' in file `D:/Modelica/RailSim/Tests/lookup_test.txt'.
Simulation terminated while the initialization. Could not find suitable initial values.
I also tried to load .mat file generated by Matlab (v4) / Dymola 2012 (demo), but no luck with simulation run. u1 and u2 are strictly monotonous in the input table, but OM gives the following message:
ISimulation execution failed for model: Model1
Table2D: independent variable u1 not strictly monotonous: 21.15 >= 0.
Simulation terminated while the initialization. Could not find suitable initial values.
In contrast, when tableOnFile=false and data specified within the model, it works fine.
Similar problem reported http://openmodelica.org/index.php/forum/topic?id=351
Any ideas what is wrong with interpreting external file?
Many thanks!
Win 7, OpenModelica 1.7.0
Re: combiTable2D problem: SOLVED
Hi Ivan,
for some years now, I had problems importing external data to OpenModelica.
I already used several workarounds.
A fast and reliable solution, which I am actually using is from Jörg Rädler:
http://www.j-raedler.de/2010/11/accessi … tareader2/
in combination with octcdf to create nc-files with octave.
If you have further questions, ask!
Christian
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » combiTable2D problem: SOLVED