Opened 2 years ago

Last modified 20 months ago

#5504 new enhancement

Switch to use macro for min/max instead of fcn calls

Reported by: Christian Andersson Owned by: jsten
Priority: major Milestone:
Component: Modelica/MiddleEnd Version: trunk
Keywords: Cc:


In our generated code we use calls to our jmi_max/min functions. These should be moved to use the macros JMI_MAX/MIN instead for performance reasons.

Attachments (1)

MinMaxFix.patch (31.9 KB) - added by Christian Andersson 2 years ago.

Download all attachments as: .zip

Change History (4)

Changed 2 years ago by Christian Andersson

Attachment: MinMaxFix.patch added

comment:1 Changed 2 years ago by Christian Andersson

The attached patch fix the issue and updates the tests. There is however one tests that fails and that is compilation of the following model:

model EnhancedEventIteration1

  Real x[7](each start=4);
    parameter Real b_locked[7] = {0.94,0,0,0,0,0,0.5};
    parameter Real b_startforward[7] = {0.94,0,0,1.0,1.0,0.0,0.5};
    parameter Real b_startbackward[7] = {0.94,0,0,-1.0,-1.0,0.0,0.5};
    parameter Real b[7] = {2,2,2,2,2,2,2};

  parameter Real A_locked[7,7] = {{1,0,0,0,0,0,1},

 parameter Real A_not_locked[7,7] = {{1,0,0,0,0,0,1},
 Real y(start=1);
  der(y) = -y;
  if y > 0.5 then
    x = b;
  elseif x[4]>1.0 then
  elseif x[4]<-1.0 then
    A_locked*x = b_locked;
  end if;

end EnhancedEventIteration1;

comment:2 Changed 2 years ago by Christian Andersson

The problem with the model is that GCC runs out of memory during the compilation. This is believed to be due to the excessive use of MIN/MAX macro when trying to compute the automatic nominals for a block. This needs to be looked at why there is a problem.

comment:3 Changed 20 months ago by Christian Andersson

Milestone: 2.2.x

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.