﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
5229	Issue with record constructors and function calls in Modelica.Media with the NF	Francesco Casella	Per Östlund	"Many models in ThermoPower show the same type of error when compiled with the NF, see for example [https://libraries.openmodelica.org/branches/newInst/ThermoPower/files/ThermoPower_ThermoPower.Test.DistributedParameterComponents.TestGasFlow1DFV_A.err ThermoPower.Test.DistributedParameterComponents.TestGasFlow1DFV_A]. The following error message is reported:
{{{
ThermoPower_ThermoPower.Test.DistributedParameterComponents.TestGasFlow1DFV_A.c:526:86: warning: implicit declaration of function 'omc_ThermoPower_Test_DistributedParameterComponents_TestGasFlow1DFV__A_Medium_ThermodynamicState' is invalid in C99 [-Wimplicit-function-declaration]
  copy_real_array_data(omc_ThermoPower_Gas_Flow1DFV_Medium_density__derX(threadData, omc_ThermoPower_Test_DistributedParameterComponents_TestGasFlow1DFV__A_Medium_ThermodynamicState(threadData, data->localData[0]->realVars[10] /* hex.p STATE(1) */, data->localData[0]->realVars[9] /* hex.Ttilde[9] STATE(1) */)), &tmp3);
                                                                                     ^
ThermoPower_ThermoPower.Test.DistributedParameterComponents.TestGasFlow1DFV_A.c:526:86: error: passing 'int' to parameter of incompatible type 'ThermoPower_Test_DistributedParameterComponents_TestGasFlow1DFV__A_Medium_ThermodynamicState' (aka 'struct ThermoPower_Test_DistributedParameterComponents_TestGasFlow1DFV__A_Medium_ThermodynamicState_s')
  copy_real_array_data(omc_ThermoPower_Gas_Flow1DFV_Medium_density__derX(threadData, omc_ThermoPower_Test_DistributedParameterComponents_TestGasFlow1DFV__A_Medium_ThermodynamicState(threadData, data->localData[0]->realVars[10] /* hex.p STATE(1) */, data->localData[0]->realVars[9] /* hex.Ttilde[9] STATE(1) */)), &tmp3);
}}}
With the old FE, the following function is present in the flattened model
{{{
function ThermoPower.Test.DistributedParameterComponents.TestGasFlow1DFV_A.Medium.ThermodynamicState ""Automatically generated record constructor for ThermoPower.Test.DistributedParameterComponents.TestGasFlow1DFV_A.Medium.ThermodynamicState""
  input Real p(start = 1000000.0, nominal = 1000000.0, min = 0.0, max = 100000000.0, quantity = ""Pressure"", unit = ""Pa"", displayUnit = ""bar"");
  input Real T(min = 200.0, max = 6000.0, start = 500.0, nominal = 500.0, quantity = ""ThermodynamicTemperature"", unit = ""K"", displayUnit = ""degC"");
  output ThermodynamicState res;
end ThermoPower.Test.DistributedParameterComponents.TestGasFlow1DFV_A.Medium.ThermodynamicState;
}}}
while with the new front end there is no function with such a name in the flattened model. I'm not sure if this is relevant, but that's weirdest thing I noticed with this model so far."	defect	closed	high	2.0.0	New Instantiation		fixed		
