modelica中的混合气体

modelica中的混合气体,modelica,openmodelica,Modelica,Openmodelica,我使用OpenModelica,我有一些混合气体模型 package ExhaustGas import Modelica.Media.IdealGases.Common; extends Modelica.Media.IdealGases.Common.MixtureGasNasa(mediumName = "ExhaustGas", data = {Common.SingleGasesData.O2, Common.SingleGasesData.CO2, Common.SingleGa

我使用OpenModelica,我有一些混合气体模型

package ExhaustGas
import Modelica.Media.IdealGases.Common;
  extends Modelica.Media.IdealGases.Common.MixtureGasNasa(mediumName = "ExhaustGas", data = {Common.SingleGasesData.O2, Common.SingleGasesData.CO2, Common.SingleGasesData.H2O, Common.SingleGasesData.N2, Common.SingleGasesData.Ar, Common.SingleGasesData.SO2}, fluidConstants = {Common.FluidData.O2, Common.FluidData.CO2, Common.FluidData.H2O, Common.FluidData.N2, Common.FluidData.Ar, Common.FluidData.SO2}, substanceNames = {"Oxygen", "Carbondioxide", "Water", "Nitrogen", "Argon", "Sulfurdioxide"}, reference_X = {0.1383, 0.032, 0.0688, 1 - 0.1383 - 0.032 - 0.0688 - 0.0000000001 - 0.0000000001, 0.0000000001, 0.0000000001});
end ExhaustGas;
我运行代码:

algorithm
for i in 1:6 loop
      etaX[i] := ExhaustGas.fluidConstants[i].criticalTemperature;
end for;
我得到

{154.58, 154.58, 154.58, 154.58, 154.58, 154.58}
也就是说,只有氧气值被写入数组

函数Modelica.Media.IdealGases.Common.MixtureGasNasa.DynamicDiscosity中使用了相同的循环。
是否可以认为此功能正常工作?我做错了什么?

我在Dymola使用的Dymola 2018中没有看到任何类似的问题,没有明显的原因,因此这似乎是OpenModelica中的一个问题

为了让示例运行,我使用了:

model ExhaustGas
  import Modelica.Media.IdealGases.Common;
  package P=Modelica.Media.IdealGases.Common.MixtureGasNasa (
    mediumName="ExhaustGas",
    data={Common.SingleGasesData.O2,Common.SingleGasesData.CO2,Common.SingleGasesData.H2O,
        Common.SingleGasesData.N2,Common.SingleGasesData.Ar,Common.SingleGasesData.SO2},
    fluidConstants={Common.FluidData.O2,Common.FluidData.CO2,Common.FluidData.H2O,
        Common.FluidData.N2,Common.FluidData.Ar,Common.FluidData.SO2},
    substanceNames={"Oxygen","Carbondioxide","Water","Nitrogen","Argon","Sulfurdioxide"},
    reference_X={0.1383,0.032,0.0688,1 - 0.1383 - 0.032 - 0.0688 - 0.0000000001 -
        0.0000000001,0.0000000001,0.0000000001});

  Real etaX[6];
algorithm 
  for i in 1:6 loop
      etaX[i] =  P.fluidConstants[i].criticalTemperature;
  end for;
end ExhaustGas;
因为从包继承的模型是不合法的。我注意到正常沸点超出范围的两个警告


更改:我将其更改为使用算法而不是方程,这对Dymola没有任何影响,我也看不出有什么原因值得关注。

我在Dymola使用的Dymola 2018中看不到任何类似的问题,因为没有明显的原因,所以这似乎是OpenModelica中的一个问题

为了让示例运行,我使用了:

model ExhaustGas
  import Modelica.Media.IdealGases.Common;
  package P=Modelica.Media.IdealGases.Common.MixtureGasNasa (
    mediumName="ExhaustGas",
    data={Common.SingleGasesData.O2,Common.SingleGasesData.CO2,Common.SingleGasesData.H2O,
        Common.SingleGasesData.N2,Common.SingleGasesData.Ar,Common.SingleGasesData.SO2},
    fluidConstants={Common.FluidData.O2,Common.FluidData.CO2,Common.FluidData.H2O,
        Common.FluidData.N2,Common.FluidData.Ar,Common.FluidData.SO2},
    substanceNames={"Oxygen","Carbondioxide","Water","Nitrogen","Argon","Sulfurdioxide"},
    reference_X={0.1383,0.032,0.0688,1 - 0.1383 - 0.032 - 0.0688 - 0.0000000001 -
        0.0000000001,0.0000000001,0.0000000001});

  Real etaX[6];
algorithm 
  for i in 1:6 loop
      etaX[i] =  P.fluidConstants[i].criticalTemperature;
  end for;
end ExhaustGas;
因为从包继承的模型是不合法的。我注意到正常沸点超出范围的两个警告


更改:我将其更改为使用算法而不是方程,这对Dymola没有任何影响,我也看不出有任何理由认为这很重要。

但是如果我将方程更改为算法,它会错误地工作。好吧,我错过了您使用的算法,但这只是缩小了错误范围。从包继承的包的工作原理完全相同。我真的不明白你对normalBoilingPoint的看法。但如果我将方程改为算法,它的工作就不正确了。好吧,我错过了你使用的算法,但这只是缩小了错误的范围。从包继承的包的工作原理完全相同。我真的不明白你对normalBoilingPoint的看法。你使用的OpenModelica版本是什么?Hans Olsson答案中的示例适用于OpenModelica v1.14.0-dev-26633-gd9901afc5b。{154.58304.12647.096126.2150.86430.8}是你期望的答案吗?我对耽搁表示歉意。我使用的是v1.13.2。是的,{154.58304.12647.096126.2150.86430.8}是预期答案。您使用的OpenModelica版本是什么?Hans Olsson答案中的示例适用于OpenModelica v1.14.0-dev-26633-gd9901afc5b。{154.58304.12647.096126.2150.86430.8}是你期望的答案吗?我对耽搁表示歉意。我使用的是v1.13.2。是的,{154.58304.12447.096126.2150.86430.8}是预期答案。