Opened 17 years ago

Last modified 12 years ago

#130 closed defect (fixed)

Modifiers are not propagated correctly inside redeclared model

Reported by: Francesco Casella Owned by: Francesco Casella
Priority: critical Milestone: 1.9.0
Component: Frontend Version:
Keywords: Cc: Francesco Casella, Adrian Pop

Description

N/A

Attachments (1)

SimpleFluid.mo (13.2 KB ) - added by Francesco Casella 17 years ago.
Modelica package with test cases

Download all attachments as: .zip

Change History (4)

by Francesco Casella, 17 years ago

Attachment: SimpleFluid.mo added

Modelica package with test cases

comment:1 by Francesco Casella, 17 years ago

Created an attachment (id=19)
Modelica package with test cases

Please consider the model SimpleFluid.Examples.Test4 in the attached package (requires the Modelica library to compile).

The Volume model contains the following declaration:

model Volume "ControlVolume"

replaceable model Medium = Media.Air;
Medium medium(p(start = pstart,fixed=false), T(start=Tstart,fixed=false))

"Medium properties";

...

In SimpleFluid.Examples.Test4, we set volume.pstart = 2e5. However, when you instantiate the model, you get:

Real volume.medium.p(quantity = "Pressure", unit = "Pa", displayUnit = "bar", start = 100000.0);

This start value of 100000 is the default value defined in the SimpleFluid.Media.BaseProperties model. We set this to a generic nonzero value, in order to avoid division-by-zero errors at initialization. However, the actual value of 2e5 should be used instead. The fixed = false modifier is also ignored, leading to unwanted additional initial equations.

I'm not sure if the problem is with the replaceable model (which we don't redeclare, though), or with the two-level-deep modifier.

comment:2 by Per Östlund, 13 years ago

volume.medium.p now gets the correct start value, so this issue seems to have been fixed some time ago.

comment:3 by Martin Sjölund, 12 years ago

Component: Frontend
Milestone: 1.9.0
Note: See TracTickets for help on using tickets.