Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#4911 closed defect (fixed)

Array equation eventually not flattened into scalar components 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.Mechanics.Rotational.Examples.HeatLosses.err. The following error is reported:

[/var/lib/hudson/slave/workspace/OpenModelica_TEST_LIBS/OpenModelica/OMCompiler/Compiler/SimCode/SimCodeUtil.mo:2466:7-2466:46:writable] Error: Internal error function createNonlinearResidualEquationsComplex failed for: {{0.0, 0.0, 0.0, 0.0}} = if lossyGear.ideal then lossyGear.interpolation_result - {{1.0, 1.0, 0.0, 0.0}} else lossyGear.interpolation_result - {{Modelica.Math.Vectors.interpolate(lossyGear.lossTable[:,1], lossyGear.lossTable[:,2], abs(inertia4.w), 1), Modelica.Math.Vectors.interpolate(lossyGear.lossTable[:,1], lossyGear.lossTable[:,3], abs(inertia4.w), 1), Modelica.Math.Vectors.interpolate(lossyGear.lossTable[:,1], lossyGear.lossTable[:,4], abs(inertia4.w), 1), Modelica.Math.Vectors.interpolate(lossyGear.lossTable[:,1], lossyGear.lossTable[:,5], abs(inertia4.w), 1)}}[1]
Error: Internal error function createNonlinearResidualEquations failed

Flattening the model with the old FE gives

lossyGear.interpolation_result[1,1] = Modelica.Math.Vectors.interpolate({0.0, 1.0}, {lossyGear.lossTable[1,2], lossyGear.lossTable[2,2]}, abs(lossyGear.w_a), 1)[1];
lossyGear.interpolation_result[1,2] = Modelica.Math.Vectors.interpolate({0.0, 1.0}, {lossyGear.lossTable[1,3], lossyGear.lossTable[2,3]}, abs(lossyGear.w_a), 1)[1];
lossyGear.interpolation_result[1,3] = Modelica.Math.Vectors.interpolate({0.0, 1.0}, {lossyGear.lossTable[1,4], lossyGear.lossTable[2,4]}, abs(lossyGear.w_a), 1)[1];
lossyGear.interpolation_result[1,4] = Modelica.Math.Vectors.interpolate({0.0, 1.0}, {lossyGear.lossTable[1,5], lossyGear.lossTable[2,5]}, abs(lossyGear.w_a), 1)[1];

while the NF gives

lossyGear.interpolation_result = cat(2, {{Modelica.Math.Vectors.interpolate(lossyGear.lossTable[:,1], lossyGear.lossTable[:,2], noEvent(abs(lossyGear.w_a)), 1)}}, {{Modelica.Math.Vectors.interpolate(lossyGear.lossTable[:,1], lossyGear.lossTable[:,3], noEvent(abs(lossyGear.w_a)), 1)}}, {{Modelica.Math.Vectors.interpolate(lossyGear.lossTable[:,1], lossyGear.lossTable[:,4], noEvent(abs(lossyGear.w_a)), 1)}}, {{Modelica.Math.Vectors.interpolate(lossyGear.lossTable[:,1], lossyGear.lossTable[:,5], noEvent(abs(lossyGear.w_a)), 1)}})[1];

which apparently the back-end cannot handle.

Change History (5)

comment:1 by Francesco Casella, 7 years ago

Similar situation in Modelica.Electrical.Machines.Examples.AsynchronousInductionMachines.AIMC_DOL.

[OMCompiler/Compiler/SimCode/SimCodeUtil.mo:5544:7-5544:48:writable] Error:
Internal error for Eqn: 1 : aimc.ir = -{-aimc.idq_rr[1], -aimc.idq_rr[2]}
array equations currently only supported on form v = functioncall(...)

comment:2 by Per Östlund, 6 years ago

Resolution: fixed
Status: newclosed

The issue with HeatLosses seems to have been fixed, but I don't know by what change. The model simulates now but fails verification, though the difference seems fairly minor to me.

The issue with AIMC_DOL was caused by the issue reported in #5037, which has now also been fixed.

in reply to:  2 ; comment:3 by Francesco Casella, 6 years ago

Replying to perost:

The model simulates now but fails verification, though the difference seems fairly minor to me.

From what I understand there is a difference in how Dymola (which was used to generate the reference results) and OMC record variables which become true and then false during event iterations: Dymola records a "true" datapoint, while OMC only records the final result at the end of event iteration.

This coming autumn I'm going to address all these issues with the MA, so we can have a better an fairer platform for cross-tool checking.

in reply to:  3 comment:4 by Per Östlund, 6 years ago

Replying to casella:

Replying to perost:

The model simulates now but fails verification, though the difference seems fairly minor to me.

From what I understand there is a difference in how Dymola (which was used to generate the reference results) and OMC record variables which become true and then false during event iterations: Dymola records a "true" datapoint, while OMC only records the final result at the end of event iteration.

Good point, I didn't check the results from the old frontend but it fails verification in the same way. So it's all fine with regards to the NF then.

comment:5 by Francesco Casella, 6 years ago

From my understanding, most failed verifications on the MSL with the old FE are false positives due to different ways the data is stored, or to subtle differences when events are involved, or to systems with chaotic behaviour; all these show up as well with the NF.

However, there are some issues that are NF-specific, see e.g. #4868 or #5025

Note: See TracTickets for help on using tickets.