Opened 2 years ago

Last modified 20 months ago

#5366 reopened defect

Eliminate if/else expressions based on min/max

Reported by: Jesper Mattsson Owned by: Jesper Mattsson
Priority: major Milestone:
Component: Modelica/FrontEnd Version: trunk
Keywords: Cc:

Description

In many cases if-expressions can be locked to a specific branch due to min/max values of the operands in the test expression. This will reduce the number of crossing functions in the compiled FMU (but not the number of events, since only expressions that will never generate any events are eliminated).

Example:

model Test
    Real x(min = 1) = time + 1;
    Real y = if x > 0 then 2 else -x;
end Test;

Change History (5)

comment:1 Changed 2 years ago by Jesper Mattsson

Resolution: fixed
Status: newclosed

r9902

Added constant evaluation of relational expressions based on min/max.

comment:2 Changed 2 years ago by Zimon Kuhs

Resolution: fixed
Status: closedreopened

comment:3 Changed 2 years ago by Zimon Kuhs

r9906

Reverting r9902 as it broke tests.

comment:4 Changed 2 years ago by Christian Andersson

Milestone: 2.1.x2.2.x

comment:5 Changed 20 months ago by Christian Andersson

Milestone: 2.2.x

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.