Opened 8 years ago

Last modified 8 years ago

#4224 closed defect

Activated wrapFunctionCalls lets events fail with Cpp runtime — at Initial Version

Reported by: Rüdiger Franke Owned by: Lennart Ochel
Priority: critical Milestone: 1.12.0
Component: Backend Version: v1.12.0
Keywords: Cc: Niklas Worschech, Patrick Täuber

Description

Commit wrapFunctionCalls is activated ... lets the event processing of the Cpp runtime fail.

See the following example:

model TrapezoidTest
  Modelica.Blocks.Sources.Trapezoid trapezoid(
    offset=1,
    period=10,
    amplitude=4,
    rising=1,
    width=4,
    falling=1,
    startTime=2)
    annotation (Placement(visible = true, transformation(extent = {{-50, 34}, {-30, 54}}, rotation = 0)));
equation
  annotation(experiment(StopTime=20));
end TrapezoidTest;

trapezoid.y stays at constant 1 throughout the simulation, instead of raising to 5 twice. The model Modelica.Blocks.Sources.Trapezoid contains the following when clause:

equation
  when integer((time - startTime)/period) > pre(count) then
    count = pre(count) + 1;
    T_start = time;
  end when;

There are two problems:

  1. The backend introduces a common subexpression for integer((time - startTime)/period), even though it only appears once and an integer division hardly justifies the overhead of a common subexpression.
  1. The Cpp runtime generates no event for the when clause with common subexpression.

Change History (0)

Note: See TracTickets for help on using tickets.