- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » CombiTimeTable and time values
CombiTimeTable and time values
CombiTimeTable and time values
Hello!
I want to run simulations where the input values have discontinuities. Therefor I want to use Modelica.Blocks.Sources.CombiTimeTable. The Sources.mo file says, that the time in the first column in the table need to be only increasing and not strictly increasing. The model is the following (test.mo):
Code:
model test "Test"
import Modelica.Blocks.Sources;
import Modelica.Blocks.Continuous;
import Modelica.Blocks.Math;
import Modelica.Blocks.Tables;
Sources.CombiTimeTable input1(tableOnFile=true,fileName="data01.txt",tableName="tab1");
Math.Gain gain1(k=2);
equation
connect(input1.y[1],gain1.u);
end test;
The file data01.txt is
Code:
#1
double tab1(7,2) # comment line
0 0
1 0
1 1
2 1
3 4
4 9
5 16
When I run the simulation, the output is
Code:
>>> simulate(test,startTime=0,stopTime=6,outputFormat="mat")
record SimulationResult
resultFile = "",
simulationOptions = "startTime = 0.0, stopTime = 6.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'test', storeInTemp = false, noClean = false, options = '', outputFormat = 'mat', variableFilter = '.*', measureTime = false, cflags = ''",
messages = "Simulation execution failed for model: test
TimeTable: Column with time variable not monotonous: 1 >= 1.
Simulation terminated while the initialization. Could not find suitable initial values.
",
timeFrontend = 0.0,
timeBackend = 0.0,
timeSimCode = 0.0,
timeTemplates = 0.0,
timeCompile = 0.0,
timeSimulation = 0.0,
timeTotal = 0.0
end SimulationResult;
Does anyone know, why it does not work with the used data file.
Thank and best regards!
Re: CombiTimeTable and time values
Yes, tables need to have monotonically increasing values.
We added now a check for that and it should report a warning for it.
Cheers,
Adrian Pop/
- adrpo
- 885 Posts
Re: CombiTimeTable and time values
Hi, doing the code written on the first post with OpenModelica 1.8.1 I get the following error:
simulate(test,startTime=0,stopTime=6,outputFormat="mat")
Code:
record SimulationResult
resultFile = "",
simulationOptions = "startTime = 0.0, stopTime = 6.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'test', storeInTemp = false, noClean = false, options = '', outputFormat = 'mat', variableFilter = '.*', measureTime = false, cflags = '', simflags = ''",
messages = "Simulation failed for model: test
[<interactive>:6:3-6:89:writable] Error: Class Sources.CombiTimeTable not found in scope test.
Error: Error occurred while flattening model test
",
timeFrontend = 0.0,
timeBackend = 0.0,
timeSimCode = 0.0,
timeTemplates = 0.0,
timeCompile = 0.0,
timeSimulation = 0.0,
timeTotal = 0.0
end SimulationResult;
It seems the Source.om is not found or read ? any hints ? Is it OpenModelica specific ?
Thanks in advance,
Sam
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » CombiTimeTable and time values