Opened 6 years ago

Last modified 3 years ago

#5099 new enhancement

Merging min/max attributes for alias elimination

Reported by: casella Owned by: Karim.Abdelhak
Priority: critical Milestone:
Component: Backend Version:
Keywords: Cc: wbraun, vitalij, bachmann, Andrea.Bartolini

Description (last modified by casella)

Min/max attributes can have an important influence on the correctness and performance of Modelica models. In particular, this is critical for the optimization of the inStream() operator, see Section 9.2 of the Modelica Specification.

The current implementation of inStream() (see #3885) opimizes away terms with min >= 0 and max <= 0 after alias elimination. It is thus essential that min/max information is not lost in the process: when many variables in an alias set are represented by one variable in the problem that will be solved numerically, the min/max attributes of this variable should span the intersection of the min/max intervals of each variable in the set.

In particular, it is important to merge the min/max attributes of variables showing up in alias equations that can stem from connect statements and from typical modelling equations involving flow variables, that is:

x = y
x + y = 0
(-x) + y = 0
x + (-y) = 0
x = -y
-x = y

This functionality is partially implemented as of 29/08/2018 (see e.g. here and here), but there are still problems. On the one hand, I'm not sure that all cases listed above are covered. On the other hand, when running the following simple test case with -d=optdaedump

model TestMinMax
  Real x(min = 0);
  Real y;
  Real z;
equation
  x+y=0;
  z = x;
  y = time;
end TestMinMax;

the following output is obtained

1: z:VARIABLE() .TestMinMax type: Real
2: y:VARIABLE() .TestMinMax type: Real
3: x:VARIABLE(min = 0.0 ) .TestMinMax type: Real

while one would expect to see min = 0 on z and max = 0 on y.

This issue should preferably be solved in 1.13.0, because it has an impact on the optimization of stream connectors, that are widely used in a number of Modelica libraries.

It should also be addressed in the removeSimpleEquations=new module which is currently under development.

Change History (6)

comment:1 Changed 6 years ago by casella

  • Description modified (diff)

comment:2 Changed 6 years ago by casella

  • Milestone changed from 1.13.0 to 1.14.0

Rescheduled to 1.14.0 after 1.13.0 releasee

comment:3 Changed 5 years ago by casella

  • Milestone changed from 1.14.0 to 1.16.0

Releasing 1.14.0 which is stable and has many improvements w.r.t. 1.13.2. This issue is rescheduled to 1.16.0

comment:4 Changed 4 years ago by casella

  • Milestone changed from 1.16.0 to 1.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:5 Changed 4 years ago by casella

  • Milestone changed from 1.17.0 to 1.18.0

Retargeted to 1.18.0 because of 1.17.0 timed release.

comment:6 Changed 3 years ago by casella

  • Milestone 1.18.0 deleted

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.