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

"Too many event iterations" error

"Too many event iterations" error

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

Re: "Too many event iterations" error

Hello  Raph85,

which OM version do you use?

In the currect trunk it seem that the issue can occurs in some cases, because of the following bug ticket:
https://trac.openmodelica.org/OpenModelica/ticket/3062

In general this error means you have a discrete variable or relation, which changes it's value on every iteration.
For example look at the following model:

Code:


model A
  Real x(start=1);
  Integer i;
  Boolean b1,b2;
equation
  der(x) = x;
  when {x>1.5,pre(b1),pre(b2)} then
    i = pre(i) + 1;
    b2 = not pre(b2);
  end when;
  when {pre(b1),pre(b2)} then
    b1 = not pre(b1);
  end when;
end A;

There it's the case that if the first when equation is evaluated the b2 changes and that causes the evaluation of the second when equation which changes b1, what again activates the first when equation and so on.
So in general it's an modelling issue like the one above.

so long.
Willi

Re: "Too many event iterations" error

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!

There are 0 guests and 0 other users also viewing this topic
You are here: