﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
5075	Package names flattened incorrectly by the NF within function bodies	Francesco Casella	Per Östlund	"Please check [https://libraries.openmodelica.org/branches/newInst/Modelica_trunk/files/Modelica_trunk_Modelica.Fluid.Examples.AST_BatchPlant.BatchPlant_StandardWater.err Modelica.Fluid.Examples.AST_BatchPlant.BatchPlant_StandardWater]. The model flattened with the old FE contains the following function

{{{
function Modelica.Fluid.Examples.AST_BatchPlant.BaseClasses.InnerTank$B5$InnerTankSide.Medium.setState_pTX ""Inline before index reduction"" ""Return thermodynamic state of water as function of p, T, and optional region""
  input Real p(quantity = ""Pressure"", unit = ""Pa"", displayUnit = ""bar"", min = 611.657, max = 100000000.0, start = 5000000.0, nominal = 1000000.0) ""Pressure"";
  input Real T(quantity = ""ThermodynamicTemperature"", unit = ""K"", displayUnit = ""degC"", min = 273.15, max = 2273.15, start = 500.0, nominal = 500.0) ""Temperature"";
  input Real[:] X(quantity = ""MassFraction"", unit = ""kg/kg"", min = 0.0, max = 1.0, nominal = 0.1) = {1.0} ""Mass fractions"";
  output Modelica.Fluid.Examples.AST_BatchPlant.BaseClasses.InnerTank$B5$InnerTankSide.Medium.ThermodynamicState state ""Thermodynamic state record"";
  input Integer phase(min = 0, max = 2) = 0 ""2 for two-phase, 1 for one-phase, 0 if not known"";
  input Integer region = 0 ""If 0, region is unknown, otherwise known and this input"";
algorithm
  state := Modelica.Fluid.Examples.AST_BatchPlant.BaseClasses.InnerTank$B5$InnerTankSide.Medium.ThermodynamicState(1, Modelica.Fluid.Examples.AST_BatchPlant.BaseClasses.InnerTank$B5$InnerTankSide.Medium.specificEnthalpy_pT(p, T, 0, region), Modelica.Fluid.Examples.AST_BatchPlant.BaseClasses.InnerTank$B5$InnerTankSide.Medium.density_pT(p, T, 0, region), T, p);
end Modelica.Fluid.Examples.AST_BatchPlant.BaseClasses.InnerTank$B5$InnerTankSide.Medium.setState_pTX;
}}}
whereas the NF renders this as
{{{
function Modelica.Fluid.Examples.AST_BatchPlant.BatchPlant_StandardWater.volume4.Medium.setState_pTX ""Inline before index reduction"" ""Return thermodynamic state of water as function of p, T, and optional region""
  input Real p(quantity = ""Pressure"", unit = ""Pa"", displayUnit = ""bar"", min = 611.657, max = 100000000.0, start = 5000000.0, nominal = 1000000.0) ""Pressure"";
  input Real T(quantity = ""ThermodynamicTemperature"", unit = ""K"", displayUnit = ""degC"", min = 273.15, max = 2273.15, start = 500.0, nominal = 500.0) ""Temperature"";
  input Real[:] X = {1.0} ""Mass fractions"";
  input Integer phase(min = 0, max = 2) = 0 ""2 for two-phase, 1 for one-phase, 0 if not known"";
  input Integer region = 0 ""If 0, region is unknown, otherwise known and this input"";
  output volume4.Medium.ThermodynamicState state ""Thermodynamic state record"";
algorithm
  state := Modelica.Fluid.Examples.AST_BatchPlant.BatchPlant_StandardWater.volume4.Medium.ThermodynamicState(1, Modelica.Fluid.Examples.AST_BatchPlant.BatchPlant_StandardWater.volume4.Medium.specificEnthalpy_pT(p, T, 0, region), Modelica.Fluid.Examples.AST_BatchPlant.BatchPlant_StandardWater.volume4.Medium.density_pT(p, T, 0, region), T, p);
end Modelica.Fluid.Examples.AST_BatchPlant.BatchPlant_StandardWater.volume4.Medium.setState_pTX;
}}}
which causes the generation of incorrect C code that fails to compile.

I understand all paths beginning with {{{Modelica.Fluid.Examples.AST_BatchPlant.BatchPlant_StandardWater.volume4}}} should instead begin with {{{Modelica.Fluid.Examples.AST_BatchPlant.BaseClasses.InnerTank$B5$InnerTankSide}}}"	defect	closed	high	2.0.0	New Instantiation		duplicate		
