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

Posts

Posts

Solved by adding a input and evaluating it at the beginning:

Code:

loadModel(Modelica)

Sam

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

Jul-17-12 10:12:14
read data from a text file and use it in a simulation

Hi all,
Let's say I have a simple model: y = a*t+b
Where:
t is the time
a is a variable that is read from a txt file, which depend on time.
b is a fixed parameter

model simple
  constant Real b=1;
  Real a,y
equation
  y = a*time+b;
end simple;

now I have the txt file looking like:
t      a
0     1.0
5     1.1
11   1.0
17   0.9
...

I would like to launch a simulation taking the values from txt file (with linear interpolation between values for a continuous time simulation).

Is there a example on this topic somewhere ?

Thanks in advance,
Sam

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