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

if/while in --deaMode

if/while in --deaMode

I tried to find zero-crossings of a function using  --daeMode, but the result was not was I expected. In "ode-Mode" everything is fine.

Code:


loadModel(Modelica,{"4.0.0"});

loadString("
model ExampleDaeMode
  Real x;
  Boolean GREATER;
equation
  x= 1.5* sin(time);
  GREATER = x>0.0;
  when edge(GREATER) then
    Modelica.Utilities.Streams.print (\"time = \" + String(time),\"./mytestfile.txt\");
  end when;
end ExampleDaeMode;
"); getErrorString();

setCommandLineOptions("--daeMode");
simulate (ExampleDaeMode, startTime = -0.1, stopTime = 10.0, stepSize=0.01, tolerance=1e-6 , simflags="-lv=LOG_STATS");
getErrorString();
plot ({GREATER,x});

Build.mos

The same problem when removing the "when - block"

In ExampleDaeMode_16dae.c  a function ExampleDaeMode_evaluateDAEResiduals  was defined, but never called.

Does anyone have similar experience with --daeMode ??

Best Johann

OMCompiler v1.19.0-dev.30+gbc38d8eead
platform Linux64

Edited by: hanshell - Jul-24-21 19:29:07
Attachments:
There are 0 guests and 0 other users also viewing this topic
You are here: