Opened 5 years ago

Last modified 5 years ago

#5601 new defect

Analyse impact: removeEqualFunctionCalls and avoid as tearing variable

Reported by: vitalij Owned by: somebody
Priority: normal Milestone: Future
Component: Backend Version:
Keywords: Cc: Karim.Abdelhak, AnHeuermann, casella

Description (last modified by casella)

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).

Maybe this should be done only for initialization.

Change History (1)

comment:1 in reply to: ↑ description Changed 5 years ago by casella

  • Description modified (diff)
  • Summary changed from Analayse impact: removeEqualFunctionCalls and avoid as tearing variable to Analyse impact: removeEqualFunctionCalls and avoid as tearing variable

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.

Note: See TracTickets for help on using tickets.