开发者

Modelica - set min attribute

I want to create a new medium model in Modelica. All medium model have a type temperature with min, max, star开发者_高级运维t and nominal attribute. I would like to set the minimum temperature to the value stored in fluidLimits.TMIN (which is an instance of a FluidLimits record) but I always get warnings stating that the min attribute is ignored, because it has a non-literal value. Writing min=Modelica.Constants.small instead works. See the first lines of my medium model definition below:

partial package SomeMediumModel
  extends Modelica.Media.Interfaces.PartialTwoPhaseMedium(
    Temperature(min=fluidLimits.TMIN, max=600));

  constant FluidLimits fluidLimits;
  ...
end SomeMediumModel;

Is there an example of how to use the FluidLimits record? What do I have to change in order to make min accept the value from fluidLimits.TMIN ?


I'm not quite sure why this doesn't work. It seems to me it should work since fluidLimits is a constant. I'm guessing FluidLimits is a record?

It seems like a potential bug. I'd report it to your tool vendor and see what they say. In the meantime, a potential workaround would be to define a package like this:

partial package SomeMediumModel
  extends Modelica.Media.Interfaces.PartialTwoPhaseMedium(
    Temperature(min=FluidLimitsPackage.TMIN, max=600));

  package FluidLimitsPackage
    constant Modelica.Constants.Temperature TMIN=275;
  end FluidLimitsPackage;
  ...
end SomeMediumModel;

I suspect the issue you are having is that the tool just doesn't recognize that this is truly a constant. This approach (which is untested, BTW) might work around that. But in any case, you should definitely report it to your tool vendor to make sure they are aware of it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜