Skip to content

Commit

Permalink
Added test for ticket 2337
Browse files Browse the repository at this point in the history
  • Loading branch information
lochel committed Sep 24, 2015
1 parent 0fed4ef commit cf47666
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions simulation/modelica/equations/Makefile
Expand Up @@ -21,6 +21,7 @@ IfEquation5.mos \
IfEquation6.mos \
IfEquationUnbalanced.mos \
ModelBalance1.mos ModelBalance2.mos ModelBalance3.mos \
ticket-2337.mos \
WatchDog1AlgorithmWhen.mos WatchDog2EquationWhen.mos \
WhenEquation.mos WhenEquation1.mos \
WhenNoRetCall.mos \
Expand Down
32 changes: 32 additions & 0 deletions simulation/modelica/equations/ticket-2337.mos
@@ -0,0 +1,32 @@
// name: ticket-2337
// keywords: when equations, #2337
// status: correct

loadString("
model whenBug
Real x(start=2, fixed=true);
Real y(start=1, fixed=true);
equation
when sample(0, 0.1) then
x = 2;
y = x + y; // singularity loop
end when;
end whenBug;
"); getErrorString();

translateModel(whenBug); getErrorString();

// Result:
// true
// ""
// false
// "Error: Failed to solve equation
// y = x + y;
// [<interactive>:6:2-9:10:writable] Error: Internal error BackendDAECreate.lowerWhenEqn: equation not handled:
// equation
// when sample(1, 0.0, 0.1) then
// x = 2.0;
// y = x + y;
// end when;
// "
// endResult

0 comments on commit cf47666

Please sign in to comment.