Opened 8 years ago

Closed 3 years ago

#3833 closed defect (fixed)

Redeclaring package Medium = Medium in extends does not work

Reported by: adrpo Owned by: adrpo
Priority: high Milestone: 1.16.0
Component: New Instantiation Version:
Keywords: Cc:

Description

Reported here:
http://stackoverflow.com/questions/36228614/why-does-redeclare-package-medium-medium-not-work-when-extending-from-dynamicp/36229835?noredirect=1

The model:

within MyClass;

model Mypipe
  extends Modelica.Fluid.Pipes.DynamicPipe(redeclare package Medium = Medium);
  replaceable package Medium=Modelica.Media.Water.StandardWater;
equation
  annotation(Icon(coordinateSystem(grid = {2, 8})));
end Mypipe;

goes into an infinite loop during instantiation.

Change History (4)

comment:1 Changed 8 years ago by adrpo

  • Owner changed from somebody to adrpo
  • Status changed from new to accepted

comment:2 Changed 4 years ago by Christoph Buchner <buchner@…>

Using 1.14.0-dev.beta1, I get two errors for this model (without the within MyClass;)

[1] 08:11:54 Translation Error
[test: 2:54-2:77]: Recursive short class definition of Medium in terms of Medium.

[2] 08:11:54 Translation Error
[Modelica.Fluid.Interfaces: 20:5-21:69]: Class Medium.ExtraProperty not found in scope FluidPort.

At least there's no infinite loop anymore.

comment:3 Changed 4 years ago by casella

I'm sorry but I don't understand why you write the Mypipe model this way.

DynamicPipe already contains the declaration of a Medium package. Mypipe extends from it, so it already has it, and this causes some kind of conflict if you re-add the declaration with the same name. I can't see the point of doing so. Can't you just write

model Mypipe
  extends Modelica.Fluid.Pipes.DynamicPipe(   
    redeclare replaceable package Medium = Modelica.Media.Water.StandardWater);
  annotation(Icon(coordinateSystem(grid = {2, 8})));
end Mypipe;
Last edited 4 years ago by casella (previous) (diff)

comment:4 Changed 3 years ago by perost

  • Component changed from Frontend to New Instantiation
  • Milestone changed from Future to 1.16.0
  • Resolution set to fixed
  • Status changed from accepted to closed

Closing this as fixed since the model is wrong and the new frontend as mentioned gives an error for it.

Note: See TracTickets for help on using tickets.