Opened 8 years ago
Closed 8 years ago
#4224 closed defect (fixed)
Activated wrapFunctionCalls lets events fail with Cpp runtime
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.
Change History (8)
comment:2 by , 8 years ago
Description: | modified (diff) |
---|
comment:3 by , 8 years ago
integer() was not listed in isSkipCase because it was not necessary for the testsuite.
Also the function isSKipCase_advanced is only for testing purposes and it is not sufficiently analyzed which function call should be added to the SkipCase by now.
comment:4 by , 8 years ago
Is it sufficient to develop against the testsuite?
Shouldn't some structuring be made based on the Modelica specification?
For instance: MLS 3.3 rev1, section 3.7.1 defines "Numeric Functions and Conversion Functions". String
and sign
defined in this section belong to isSkipCase. abs
that is defined at the same place of MLS belongs to isSkipCase_advanced. Integer
that is defined there as well does not belong to isSkipCase???
comment:5 by , 8 years ago
I just added all the functions from section 3.7 to module wrapFunctionCalls: OMCompiler#1408.
comment:7 by , 8 years ago
Status: | new → accepted |
---|
@rfranke Can we close this once the changes are pushed? Or is there more to fix?
comment:8 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
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?