Opened 7 years ago

Closed 7 years ago

#4910 closed defect (fixed)

Package constant not evaluated in function body by the NF

Reported by: Francesco Casella Owned by: Per Östlund
Priority: high Milestone: 2.0.0
Component: New Instantiation Version:
Keywords: Cc:

Description

Please check ScalableTestSuite.Thermal.Advection.ScaledExperiments.SteamPipe_N_10. The following error is generated

ScalableTestSuite_noopt_ScalableTestSuite.Thermal.Advection.ScaledExperiments.SteamPipe_N_10_functions.c:598:19:
error: use of undeclared identifier '_Modelica'
  _Tlim = fmin(_T,_Modelica._Media._Water._IF97_Utilities._BaseIF97._data._TCRIT);
                  ^

Flattening with the old FE produces

function Modelica.Media.Water.IF97_Utilities.BaseIF97.Basic.dptofT "Derivative of pressure w.r.t. temperature along the saturation pressure curve"
  input Real T(quantity = "ThermodynamicTemperature", unit = "K", displayUnit = "degC", min = 0.0, start = 288.15, nominal = 300.0) "Temperature (K)";
  output Real dpt(unit = "Pa/K") "Temperature derivative of pressure";
  protected Real[31] o "Vector of auxiliary variables";
  protected Real Tlim "Temperature limited to TCRIT";
algorithm
  Tlim := min(T, 647.096);

while the new FE gives

function Modelica.Media.Water.IF97_Utilities.BaseIF97.Basic.dptofT "Derivative of pressure w.r.t. temperature along the saturation pressure curve"
  input Real T(quantity = "ThermodynamicTemperature", unit = "K", displayUnit = "degC", min = 0.0, start = 288.15, nominal = 300.0) "Temperature (K)";
  output Real dpt(unit = "Pa/K") "Temperature derivative of pressure";
  protected Real[31] o "Vector of auxiliary variables";
  protected Real Tlim "Temperature limited to TCRIT";
algorithm
  Tlim := min(T, Modelica.Media.Water.IF97_Utilities.BaseIF97.data.TCRIT);

I guess TCRIT should be evaluated to a numerical literal by the front-end

Change History (3)

comment:1 by Francesco Casella, 7 years ago

Component: *unknown*New Instantiation
Milestone: Future2.0.0
Owner: changed from somebody to Per Östlund

comment:2 by Per Östlund, 7 years ago

Fixed in 5e1a956. The issue was that the NF doesn't evaluate arguments of external functions (because of #4904), but it's definition of external erroneously included functions declared as external "builtin" (like min).

comment:3 by Per Östlund, 7 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.