Skip to content

Commit 4ed04fa

Browse files
authored
[NB] do not collect events from noEvent() (#14378)
* [NB] do not collect events from noEvent() - [testsuite] add test file and update other test - the test improved in some values, not entirely correct yet
1 parent 91e6a8d commit 4ed04fa

File tree

6 files changed

+30
-1
lines changed

6 files changed

+30
-1
lines changed

OMCompiler/Compiler/NBackEnd/Modules/2_Pre/NBEvents.mo

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,9 @@ protected
11411141
exp.call := call;
11421142
then exp;
11431143

1144+
// don't traverse noEvent() calls
1145+
case Expression.CALL() guard(Call.isNamed(exp.call, "noEvent")) then exp;
1146+
11441147
// don't traverse cref subscripts
11451148
case Expression.CREF() then exp;
11461149

testsuite/simulation/modelica/NBackend/ModelicaTest/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
TEST = ../../../../rtest -v
22

33
TESTFILES = \
4+
ModelicaTest.Blocks.Exponentiation.mos \
45
ModelicaTest.Media.TestOnly.WaterIF97_dewEnthalpy.mos \
56
ModelicaTest.Tables.CombiTable1Ds.Test1.mos \
67
ModelicaTest.Math.TestMatrices.mos \
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// name: ModelicaTest.Blocks.Exponentiation
2+
// keywords: NewBackend
3+
// status: correct
4+
5+
loadModel(ModelicaTest, {"4.1.0"});getErrorString();
6+
setCommandLineOptions("--newBackend"); getErrorString();
7+
8+
simulate(ModelicaTest.Blocks.Exponentiation); getErrorString();
9+
diffSimulationResults("ModelicaTest.Blocks.Exponentiation_res.mat", "ReferenceFiles/ModelicaTest.Blocks.Exponentiation_res.mat", "ModelicaTest.Blocks.Exponentiation_diff.csv", 1e-8);
10+
11+
// Result:
12+
// true
13+
// ""
14+
// true
15+
// ""
16+
// record SimulationResult
17+
// resultFile = "ModelicaTest.Blocks.Exponentiation_res.mat",
18+
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-6, method = 'dassl', fileNamePrefix = 'ModelicaTest.Blocks.Exponentiation', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
19+
// messages = "LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
20+
// LOG_SUCCESS | info | The simulation finished successfully.
21+
// "
22+
// end SimulationResult;
23+
// ""
24+
// (true, {})
25+
// endResult

testsuite/simulation/modelica/NBackend/ModelicaTest/ModelicaTest.Blocks.StrictLimiters.mos

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// status: correct
44

55

6-
loadModel(ModelicaTest, {"4.0.0"});getErrorString();
6+
loadModel(ModelicaTest, {"4.1.0"});getErrorString();
77
setCommandLineOptions("--newBackend"); getErrorString();
88

99
simulate(ModelicaTest.Blocks.StrictLimiters); getErrorString();

0 commit comments

Comments
 (0)