﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
5651	Problem with findZeroCrossings	Francesco Casella	Lennart Ochel	"Please consider the following test model
{{{
model foo

  parameter Real tfill=1;
  parameter Real tempty=5;
  parameter Real empty_level = 0;

  Real x(start=0,fixed=true);
  Boolean fill(start=false,fixed=true);
  Boolean empty(start=false,fixed=true);

equation

  der(x) = if fill and not empty then 1 elseif empty and not fill then -1 else 0;

algorithm

  when time>=tfill then fill := true; end when;
  when fill and x>=1 then fill := false; end when;
  when time>=tempty then empty := true; end when;
  when empty and x<=empty_level then empty := false;
end when;

annotation(experiment(StartTime = 0, StopTime = 10,
                      Tolerance = 1e-6, Interval = 0.02));

end foo;
}}}
The expected solution is that {{{x}}} starts growing at time = 1, stops at time = 2, starts going down at time = 4, and stops again when it hits zero. That's in fact what is obtained.

If you replace the last statement in the algorithm with
{{{
  when empty and x<=0 then empty := false; end when;
}}}
the last event is completely missed, and the level goes down forever.

However, if you replace the {{{0}}} with any non-zero constant, no matter how small, e.g, 
{{{
  when empty and x<=1e-32 then empty := false; end when;
}}}

the correct behaviour is restored.

This is a serious issue, because we get plain wrong results.
"	defect	closed	blocker	1.14.0	Backend		fixed		Karim Adbdelhak Andreas Heuermann alberto.leva@… chiara.cimino@…
