Opened 6 years ago
Closed 6 years ago
#5229 closed defect (fixed)
Issue with record constructors and function calls in Modelica.Media with the NF
Reported by: | Francesco Casella | Owned by: | Per Östlund |
---|---|---|---|
Priority: | high | Milestone: | 2.0.0 |
Component: | New Instantiation | Version: | |
Keywords: | Cc: |
Description
Many models in ThermoPower show the same type of error when compiled with the NF, see for example 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.
Note:
See TracTickets
for help on using tickets.
This issue also affects most of the Fluid models. I've already fixed it locally, but the fix causes issues with operator overloading that I'm still trying to fix.