﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
4995	Constants with non-constant subscripts not evaluated in functions	Per Östlund	Per Östlund	"The NF only evaluates constants that also has constant subscripts, but this causes some issues with e.g. Modelica.Media.Examples.Tests.MediaTestModels.IdealGases.SimpleNaturalGas that contains the function `Medium.molarMass`:
{{{
function molarMass
  input volume.Medium.ThermodynamicState state;
  output Real MM(quantity = ""MolarMass"", unit = ""kg/mol"", min = 0.001, max = 0.25, nominal = 0.032);
algorithm
  MM := 1.0 / sum(array(state.X[j] / Medium.data[j].MM for j in 1:6));
end molarMass;
}}}
`Medium.data[j].MM` is a constant here, but it's not evaluated since `j` is an iterator. This causes the generated code to fail to compile, since `Medium.data.MM` isn't accessible in the function scope (and the constant added to the flat model is incorrect anyway since it's missing the binding equation for some reason).

The NF probably needs to evaluate such constants partially, i.e. evaluate only the constant parts of the cref, at least in functions.

See also #4873 for a similar issue."	defect	closed	high	2.0.0	New Instantiation	v1.13.0-dev-nightly	fixed		
