Indicate discrete variable changing
change(v)
Is expanded into "(v<>pre(v))". The same restrictions as for the pre() operator apply.
model BothEdges Boolean u; Integer i; equation u = Modelica.Math.sin(time) > 0.5; when change(u) then i = pre(i) + 1; end when; end BothEdges;