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
  • » m7453
  • » Profile

Posts

Posts

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!

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