The variable used as tolerance margin to decide whether two Real values are equal is used to compare position and speed at the same time.
We could turn tol into a constant as we don't expect the infer the unit of constants based on their usage or maybe use Modelica.Constants.eps?