Opened 9 years ago

Last modified 9 years ago

#3772 closed defect

event clock error — at Version 2

Reported by: Niklas Worschech Owned by: Lennart Ochel
Priority: blocker Milestone: Future
Component: Backend Version:
Keywords: Modelica_Synchronous, synchronous features, cpp runtime Cc: Rüdiger Franke, Bernhard Thiele, Volker Waurich

Description (last modified by Niklas Worschech)

For the following example the clock interval is unknown in SimCode.
The model is from the cpp runtime testfolder.

model EventClock "See Modelica 3.3 spec, section 16.3 Clock Constructors"
  Integer nextInterval(start = 1);
  Real nextTick(start = 0);
equation
  when Clock(time > hold(nextTick) / 210) then
    nextInterval = previous(nextInterval) + 1;
    nextTick = previous(nextTick) + nextInterval;
  end when;
end EventClock;

The generated cpp code equation for the interval calculation is:
_clockInterval[0] = 0.0 * 1.0 / 1.0;
But the interval values should be 0.00953,0.0238,0.042 ...

Change History (2)

comment:1 by Rüdiger Franke, 9 years ago

See #3752

Both the C and the Cpp templates currently call the frontend function Expression.getClockInterval. It returns 0.0 for an unknown (inferred) clock.

The runtime code generation should introduce a default clock in #3752.

Here we have an event clock, for which Expression.getClockInterval returns 0.0 too. The runtime code generation must treat the event clock in that case.

See: https://github.com/OpenModelica/OpenModelica-testsuite/blob/master/openmodelica/cppruntime/clockedEventTest.mos

Last edited 9 years ago by Rüdiger Franke (previous) (diff)

comment:2 by Niklas Worschech, 9 years ago

Description: modified (diff)
Summary: unknown clock intervalevent clock error
Note: See TracTickets for help on using tickets.