I have some models leading to the following warning:
Differentiating (if noEvent(Re2[7] > 1) then 0.25*log10(13/Re2[7]+rugosrel/3.7/D)^(-2) else 0.01) under the assumption that it is continuous at switching.
What could be done would be the use of smooth transition between 2 if-branches.
We can imagine a case where the solver would switch back and forth between the two branches of an if (because it would find 2 different solutions), whereas it would be easier for it with a smooth transition between the branches.
Having a smooth transition could also help inversions for the solver.
Those solutions are already implemented in Modelica (see example uses of Modelica.Fluid.Utilities.regStep, where "a 2nd order polynomial is used for a smooth transition from y1 to y2.") and used in other libraries such as TAeZoSysPro.
Regarding noEvent, the implemented solution for MSL for Modelica.Fluid.Utilities.regStep (done with the smooth operator) does not contain noEvent operator, but could be added as mentioned in the link @giorgio.simonini provided.
I think I was misunderstanding the smooth function, thinking it automatically (and magically!) proposes some smoothing between the two terms, which is not the case. It only indicates that the "expr is p times continuously differentiable".
...by the way, could we imagine a kind of magic function by ourself, something like:
y = y1*x + y2*(1-x) (kind of homotopy) with x varying from 0 to 1 in the junction "spot". For sure that works only if both y1 and y2 do not have any discontinuities in the "spot" (division by 0 or other amenities).
...but this does not guaranties differentiability at the boundaries... maybe with a Sigmoid function ?