Opened 8 years ago

Last modified 3 years ago

#3944 closed defect

Check of models with partial Medium packages fails — at Version 2

Reported by: Francesco Casella Owned by: Per Östlund
Priority: high Milestone: 1.19.0
Component: New Instantiation Version:
Keywords: Cc: buchner@…

Description (last modified by Francesco Casella)

Consider this simple model:

model check
  inner Modelica.Fluid.System system;
  replaceable package gas = Modelica.Media.Interfaces.PartialMedium;
  Modelica.Fluid.Vessels.ClosedVolume free_volume(
    V = 0.01, use_portsData = false, 
    redeclare package Medium = gas);
end check;

Moving the issue to 2.1.0, as it is less critical than coverage issues.
The model is perfectly legitimate for a library. It cannot be simulated directly, because it lacks an actual medium implementation, but is othewise locally balanced and well defined.

Checking in OMC produces the following error:

[1] 10:08:59 Translation Warning
[Modelica.Media: 4475:17-4600:23]: Forcing full instantiation of partial class BaseProperties$free_volume$medium during checkModel.

[2] 10:08:59 Translation Error
Internal error - InstUtil.moveBindings: Mismatched number of equations and variables.

[3] 10:08:59 Translation Error
Error occurred while flattening model check

A better implementation should recognize that partial classes are involved and only perform local balancedness tests, possibly warning that Medium must be redeclared in order to actually use the model.

Change History (2)

comment:1 by Christoph <buchner@…>, 8 years ago

Cc: buchner@… added

comment:2 by Francesco Casella, 6 years ago

Component: FrontendNew Instantiation
Description: modified (diff)
Milestone: 2.0.02.1.0
Owner: changed from somebody to Per Östlund

The issue is still valid, with the NF one gets:

[1] 23:32:46 Translation Error
[C:/dev/OM64bit/OMCompiler/Compiler/NFFrontEnd/NFCeval.mo: 1478:9-1479:93]:
Internal error NFCeval.evalRelationEqual failed to evaluate 
‘free_volume.Medium.ThermoStates == Modelica.Media.Interfaces.Choices.IndependentVariables.ph‘
Note: See TracTickets for help on using tickets.