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

Posts

Posts

Alright, I'm creating a ticket for the issue.

I was able to reproduce the bug on a smaller model, which narrows the problem to the "if" statement:

Code:

model Test

  Real y;
  Boolean b1 = y < 100.0;
  Boolean b2 = y <= 100.0;
  Boolean b3 = y == 100.0;
  Boolean b4 = y >= 100.0;
  Boolean b5 = y > 100.0;
equation
  y = if time > 2 then 100 else 0;
end Test;

Hello,
I'm facing a problem with relational operators in OpenModelica (1.9.1 r22929).
Here is a small model that produces weird results:

Code:

model Test

  Modelica.Blocks.Continuous.Integrator i1;
  Modelica.Blocks.Nonlinear.Limiter sat(uMin = 0.0, uMax = 100.0);
  Real u(start = 0);
  Real y;
  Boolean b1 = y < 100;
  Boolean b2 = y <= 100;
  Boolean b3 = y == 100;
  Boolean b4 = y >= 100;
  Boolean b5 = y > 100;
equation
  der(u) = 50;
  connect(i1.u, u);
  connect(i1.y, sat.u);
  connect(sat.y, y);
end Test;

After running the simulation for two seconds, 'y' is equal to 100.
The problem is that 'b1', 'b2' and 'b3' are all true although that is illogical.

Is anyone able to reproduce the results?

Thanks

Hello Willi,
I discovered the problem thanks to your answer.
I had a bunch of cyclic StateGraph states that could transition from one to another within a same iteration, causing an infinite loop.

Thank you again!

Hello,
I have a model for which the simulation fails when the simulation time is set above a certain point. The error I get is "Too many event iterations. System is inconsistent. Simulation terminate". The breaking point corresponds to a StateGraph transition condition (e.g. condition = time > 100 will fail if the simulation time goes beyond 100), but if I simulate that part of the model alone, there is no problem.

I'm not quite sure what the error really means, how to fix the problem, and if some simulation settings could prevent it.
Does anyone have any idea?

Thank you in advance

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