Opened 11 years ago

Closed 8 years ago

#2546 closed defect (fixed)

No state simulation after 1e+08 seconds

Reported by: Jan Kokert Owned by: somebody
Priority: high Milestone: 1.12.0
Component: Run-time Version: trunk
Keywords: state simulation 1e+08 seconds Cc:

Description

Hi!

I found a really strange bug in OpenModelica:

If you simualte the minimal example beneath, you won't see any state signal change (duty cycling) after 1e+08 seconds.
It is not a matter of the cycle period or cycles count but the simualtion time.

In contrast, a continuous signal x = sin(time) is simulated correctly.

model StateTest
  Modelica.StateGraph.Transition transition(enableTimer = true, waitTime = 3599);
  Modelica.StateGraph.Step sleeping;
  Modelica.StateGraph.Transition transition1(enableTimer = true, waitTime = 1);
  Modelica.StateGraph.InitialStep initialStep;
  Real x;
equation
  connect(initialStep.outPort[1],transition1.inPort);
  connect(transition.outPort,initialStep.inPort[1]);
  connect(transition1.outPort,sleeping.inPort[1]);
  connect(sleeping.outPort[1],transition.inPort);
  // simualte 5 years (3600*24*365*5)
  x = sin(3.141 * time / (3600 * 24 * 365));
  annotation(uses(Modelica(version = "3.2")), experiment(StopTime = 157680000));
end StateTest;

Change History (18)

comment:1 by Adrian Pop, 11 years ago

Try with StopTime = 157680000.0 (real) and see what it happens.
I think is an issue with conversion of Integer to Real, but I'm not sure.

comment:2 by Adrian Pop, 11 years ago

I guess you can safely ignore my comment as I jumped to conclusions prematurely.

in reply to:  2 comment:3 by Jan Kokert, 11 years ago

Replying to adrpo:

I guess you can safely ignore my comment as I jumped to conclusions prematurely.

Hi Adrian!

I repaced "157680000" with "157680000.0" but the bug is the same.
:-(

comment:4 by Adrian Pop, 11 years ago

Owner: changed from probably noone to Willi Braun
Status: newassigned

comment:5 by Martin Sjölund, 11 years ago

I wanted to try this using a non-dassl solver, but they stop due to chattering...

comment:6 by Jan Kokert, 11 years ago

Hi sjoelund.se!

What do you mean with "chattering" and which solver did you use exactly?

comment:7 by Martin Sjölund, 11 years ago

All of them cause chattering, but dassl is the only one that recovers.

Basically, if there are 100 state events in a row and no regular point, the solver is not working as well as it should (only root finding is working). So we report the error.

In this case, I guess this is due to the me using the normal numberOfIntervals=500, which means if there are more than 50000 state events occurring there will be a warning the simulation is slow.

But for euler/RK, the system looks stiff... Which doesn't make sense (they do precise root finding too, and I guess some previous value was not good enough).

comment:8 by Martin Sjölund, 10 years ago

Milestone: 1.9.11.9.2

This ticket was not closed for 1.9.1, which has now been released. It was batch modified for milestone 1.9.2 (but maybe an empty milestone was more appropriate; feel free to change it).

comment:9 by Martin Sjölund, 10 years ago

Milestone: 1.9.21.9.3

Milestone changed to 1.9.3 since 1.9.2 was released.

comment:10 by Jan Kokert, 10 years ago

Hi!

I was curious if this bug still exists and sadly yes, it's still there.
Even if you replace waitTime = 3599 by waitTime = 9999999, which will generate only 10 transitions, the simulation of states stops at 1E+08.
With the latest OMEdit version the simulation in general is possible also with non-Dassl solvers and without "chattering".
Maybe the internal state timer is limited to 1E+08???

BR

comment:11 by Martin Sjölund, 9 years ago

Milestone: 1.9.31.9.4

Moved to new milestone 1.9.4

comment:12 by Martin Sjölund, 9 years ago

Milestone: 1.9.41.9.5

Milestone pushed to 1.9.5

comment:13 by Martin Sjölund, 9 years ago

Milestone: 1.9.51.10.0

Milestone renamed

comment:14 by Martin Sjölund, 8 years ago

Milestone: 1.10.01.11.0

Ticket retargeted after milestone closed

comment:15 by Martin Sjölund, 8 years ago

Milestone: 1.11.01.12.0

Milestone moved to 1.12.0 due to 1.11.0 already being released.

comment:16 by Lennart Ochel, 8 years ago

Component: BackendRun-time
Owner: changed from Willi Braun to somebody

It seems that this works now, right?

comment:17 by Jan Kokert, 8 years ago

Yes, it works for me now - Great! I will close the ticket now

comment:18 by Jan Kokert, 8 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.