Message Boards Message Boards

0
|
264 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Bespoke Modelica.Fluid.DynamicPipe model

Posted 22 days ago

Hi,
I am need to modify the Fluid.DynamicPipe model for a specific application (it cannot be done with the flow model, but needs to be the DynamicPipe).
While this was easy enough with MSL3.x where I could just make a copy in my local MSL and modify it there. With this, the extends worked nicely. Yet with MSL4.x, one cannot modify the library.

This leaves me having to make a local copy in my own model structure. It is here that issues arrive. The my modified code is below. With the changes I made, I would expect the compiler to look at the original MSL4.x models as needed, but it doesn’t seem to want to - if returns the message below. Could anyone suggest a solution?

Note that PartialStraightPipe, PartialTwoPortFlow, PartialStraightPipe, PartialTwoPort, PartialDistributedVolume do not need to be modified.
I would like to use my own FlowModels and HeatTransfer models, but this is the next stage. - yet guidance would be helpful.


model w2DynamicPipe1 "Dynamic pipe model with storage of mass and energy"
  import Modelica.Fluid.Types.ModelStructure;
  // extending PartialStraightPipe
  extends Modelica.Fluid.Pipes.BaseClasses.PartialStraightPipe(final port_a_exposesState = modelStructure == ModelStructure.av_b or modelStructure == ModelStructure.av_vb, final port_b_exposesState = modelStructure == ModelStructure.a_vb or modelStructure == ModelStructure.av_vb);
  // extending PartialTwoPortFlow
  extends Modelica.Fluid.Pipes.BaseClasses.PartialTwoPortFlow (final lengths = fill(length / n, n), final crossAreas = fill(crossArea, n), final dimensions = fill(4 * crossArea / perimeter, n), final roughnesses = fill(roughness, n), final dheights = height_ab * dxs);
  // Wall heat transfer

[86] 12:23 Validation of w2DynamicPipe1 finished
Notification: Modelica.Fluid.Interfaces.PartialTwoPort [3:5-3:5] Missing inner. Outer declaration system is missing a corresponding inner declaration. An inner declaration will be added using the outer declaration.
Error: Modelica.Fluid.Interfaces.PartialDistributedVolume [34:5-34:5] Invalid instantiation. Modelica.Media.Interfaces.PartialMedium.BaseProperties is partial.
Validation of model w2_Models.w2pipes.w2DynamicPipe1 completed with 1 error.

Thanks for the help.

POSTED BY: Chris Benson

Hello Chris,

For my answer I will assume that w2DynamicPipe1 is the result of duplicating Modelica.Fluid.Pipes.DynamicPipe in Model Center, since something seem to have gone wrong with the code you included.

You are receiving the following error message:

Error: Modelica.Fluid.Interfaces.PartialDistributedVolume [34:5-34:5] Invalid instantiation. Modelica.Media.Interfaces.PartialMedium.BaseProperties is partial.

w2DynamicPipe1 depends on Modelica.Fluid.Pipes.BaseClasses.PartialTwoPortFlow which itself depends on Modelica.Fluid.Interfaces.PartialDistributedVolume.

This last model contains a replaceable package definition, which is meant to represent the Medium used in the model. This package, in turn, is used to find the definition of a model representing the BaseProperties of the given medium.

In Modelica.Fluid.Interfaces.PartialDistributedVolume, package Medium is initialised to Modelica.Media.Interfaces.PartialMedium which is just a place holder medium, and whose BaseProperties definition is partial.

I suspect you received the previous error, because when using w2DynamicPipe1 you didn't specify a concrete medium to use. In other words, in the model where you want to use a DynamicPipe you should have a line that looks like the following: w2DynamicPipe1 pipe (redeclare package Medium = Modelica.Media.Water); That is, of course, using the appropriate medium for your model.

I may be mistaken though, if so, could you share a sample of how you used w2DynamicPipe1 in your model?

POSTED BY: Quentin Lambert
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract