Opened 8 years ago
Last modified 8 years ago
#4224 closed defect
Activated wrapFunctionCalls lets events fail with Cpp runtime — at Version 2
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 (last modified by )
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:
- The backend introduces a common subexpression for
integer((time - startTime)/period)
, even though it only appears once and the expression hardly justifies the overhead of a common subexpression.
- The Cpp runtime generates no event for the when clause with common subexpression.
Note:
See TracTickets
for help on using tickets.
Commit 1d06167 adds
integer()
toisSkipCase
.Should all event triggering mathematical functions be added here or does the Cpp runtime have to be changed to cover them in common subexpressions?
What about the
Integer
conversion function -- cf.String
conversion?