Opened 13 years ago

Last modified 13 years ago

#1596 closed defect (fixed)

Simple equation not found

Reported by: Martin Sjölund Owned by: Martin Sjölund
Priority: high Milestone:
Component: Version: trunk
Keywords: Cc: Martin Sjölund, Frenkel TUD

Description

The following generates x=0.0 in the algebraics section, but should be a known variable. If the equation was stored as 0.0 = (r-x)-r;, this should have been found. Would it be better to remove BackendDAE.EQUATION and only use BackendDAE.RESIDUAL_EQUATION?

model M
  Real r,x;
equation
  r = time*3;
  r = r-x;
end M;

Change History (4)

comment:1 by Martin Sjölund, 13 years ago

The following then generates a non-linear system:

model M
  Real r,x;
equation
  r = sin(x)+2+time;
  r = r-x;
end M;

comment:2 by Jens Frenkel, 13 years ago

To optimize the equations it is definitely beneficial to have only BackendDAE.RESIDUAL_EQUATION, but some algorithms, for example the old index reduction algorithm use the BackendDAE.EQUATION type to do the heuristic analyses of dummy state selection. With other words sometimes it is a usefull hind if there is a equation like a=exp, but matematical this should not be the determining factor.

comment:3 by Martin Sjölund, 13 years ago

Adding preOptModule=residualForm now helps finding this:

x  
  [a.mo:2:3-2:11]
  operations (3): 
    simple equation: x = 0.0
    solve:
      0.0 = x
      =>
      x = 0.0
    added assertions:
  
    residual:
      r = r - x
      =>
      0.0 = x

However, yes it does cause some of our testcases to give different results. The total time for the testsuite is also increased.

comment:4 by Jens Frenkel, 13 years ago

resolved in 11364

Note: See TracTickets for help on using tickets.