首页 > 解决方案 > 模型中的混合气体

问题描述

我使用 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.dynamicViscosity中使用了相同的循环。是否可以认为此功能正常工作?我究竟做错了什么?

标签: modelicaopenmodelica

解决方案


我在 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;

因为从包继承的模型是不合法的。我注意到 normalBoilingPoint 超出范围的两个警告。

已更改:我将其更改为使用算法而不是方程式,它对 Dymola 没有任何影响,而且我看不出它有什么重要的原因。


推荐阅读