Opened 6 years ago
Closed 6 years ago
#5078 closed defect (fixed)
Record constructors are wrongly re-used 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 Modelica.Media.Examples.MixtureGases. The NF gives this error:
[/var/lib/hudson/slave/workspace/OpenModelica_TEST_LIBS/OpenModelica/OMCompiler/build/lib/omlibrary/Modelica trunk/Media/IdealGases/Common/package.mo:835:5-836:71:writable] Error: Cannot resolve type of expression array(Modelica.Media.IdealGases.Common.Functions.cp_T({Modelica.Media.IdealGases.Common.DataRecord("CH4", 0.01604246, -4650159.63885838, 624355.7409524474, 1000.0, {-176685.0998, 2786.18102, -12.0257785, 0.0391761929, -3.61905443e-05, 2.026853043e-08, -4.976705489999999e-12}, {-23313.1436, 89.0432275}, {3730042.76, -13835.01485, 20.49107091, -0.001961974759, 4.72731304e-07, -3.72881469e-11, 1.623737207e-15}, {75320.6691, -121.9124889}, 518.2791167938085), Modelica.Media.IdealGases.Common.DataRecord("C2H6", 0.03006904, -2788633.890539904, 395476.3437741943, 1000.0, {-186204.4161, 3406.19186, -19.51705092, 0.0756583559, -8.204173219999999e-05, 5.0611358e-08, -1.319281992e-11}, {-27029.3289, 129.8140496}, {5025782.13, -20330.22397, 33.2255293, -0.00383670341, 7.23840586e-07, -7.3191825e-11, 3.065468699e-15}, {111596.395, -203.9410584}, 276.5127187299628), Modelica.Media.IdealGases.Common.DataRecord("C3H8", 0.04409562, -2373931.923397381, 334301.1845620949, 1000.0, {-243314.4337, 4656.27081, -29.39466091, 0.1188952745, -0.0001376308269, 8.814823909999999e-08, -2.342987994e-11}, {-35403.3527, 184.1749277}, {6420731.680000001, -26597.91134, 45.3435684, -0.00502066392, 9.471216939999999e-07, -9.57540523e-11, 4.00967288e-15}, {145558.2459, -281.8374734}, 188.5555073270316), Modelica.Media.IdealGases.Common.DataRecord("C4H10_n_butane", 0.0581222, -2164233.28779709, 330832.0228759407, 1000.0, {-317587.254, 6176.331819999999, -38.9156212, 0.1584654284, -0.0001860050159, 1.199676349e-07, -3.20167055e-11}, {-45403.63390000001, 237.9488665}, {7682322.45, -32560.5151, 57.3673275, -0.00619791681, 1.180186048e-06, -1.221893698e-10, 5.250635250000001e-15}, {177452.656, -358.791876}, 143.0515706563069), Modelica.Media.IdealGases.Common.DataRecord("N2", 0.0280134, 0.0, 309498.4543111511, 1000.0, {22103.71497, -381.846182, 6.08273836, -0.00853091441, 1.384646189e-05, -9.62579362e-09, 2.519705809e-12}, {710.846086, -10.76003744}, {587712.406, -2239.249073, 6.06694922, -0.00061396855, 1.491806679e-07, -1.923105485e-11, 1.061954386e-15}, {12832.10415, -15.86640027}, 296.8033869505308), Modelica.Media.IdealGases.Common.DataRecord("CO2", 0.0440095, -8941478.544405185, 212805.6215135368, 1000.0, {49436.5054, -626.411601, 5.30172524, 0.002503813816, -2.127308728e-07, -7.68998878e-10, 2.849677801e-13}, {-45281.9846, -7.04827944}, {117696.2419, -1788.791477, 8.291523189999999, -9.22315678e-05, 4.86367688e-09, -1.891053312e-12, 6.330036589999999e-16}, {-39083.5059, -26.52669281}, 188.9244822140674)}[i], state.T) for i in 1:6) * (state.X). The operands have types Real[6], Real[2] in component <NO_COMPONENT>.
The model contains two medium package declaration: Medium1
, with 2 components, and Medium2
, with 6 components. Apparently, the wrong cp_T
function is called in the offending statement.
Maybe related to #5075?
Change History (4)
comment:1 by , 6 years ago
comment:3 by , 6 years ago
Summary: | The NF messes up with functions from different packages? → Record constructors are wrongly re-used by the NF |
---|
As noted by @perost in ticket:5075#comment:7 the issue is that
The whole handling of functions and record constructors needs to be redesigned, because currently they're shared in many places where they shouldn't be shared. That's why you get missing constructors sometimes, because the wrong constructors are reused and the correct ones are newer generated.
I closed #5075 as a duplicate and just kept this one, because I think this test case shows what the problem is in the simplest possible way.
comment:4 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
This issue is now resolved. The model still fails, but for some other reason.
The error is now in
NFTyping.typeClassSections
the reason appears to be similar.