Replying to vitalij:
removeEqualFunctionCalls can replace
f(x,y)
with a
where f(x,y)
is a expression depending from x,y
(if a=f(x,y)
).
In some cases x,y
can have start values. but a
doesn't.
One idea is to avoid a
in tearing select, like start
-attribute is used to prefer
a variable (see #5458).
Sounds like a good idea.
In fact, I wonder if this additional strategy is actually bringing some advantage. If there is one equation a=expr(x,y)
, where x
and y
have start attributes and a
doesn't, if x
and y
get selected as tearing variables, I guess any sensible tearing heuristics will select a
as torn variable.
However, it may be the case that, e.g., x
is finally selected as tearing variable, but y
is not, so it will be computed by some torn equation. In this case, I understand it would be a good idea to avoid selecting a
as tearing variable, so that it will also by the torn equation a := expr(x,y)
, avoiding issues due to the missing start attribute.
Maybe this should be done only for initialization.
In principle I agree, since initialization issues are mostly relevant during initialization, though they can also arise after discontinuities generated at events. I'm not sure if there are cases where avoiding this rule for regular equations brings any other significant advantage.