modelica - 模型中的混合气体
问题描述
我使用 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中使用了相同的循环。是否可以认为此功能正常工作?我究竟做错了什么?
解决方案
我在 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 没有任何影响,而且我看不出它有什么重要的原因。
推荐阅读
- scala - 我在 rdd 中有一组要按顺序执行的查询
- javascript - React包json加载环境变量
- c - 使用 C 中的宏提取内容
- identityserver4 - 如何在 Api 项目中为登录用户获取 userId?
- c# - 查找 Entity Framework Core 最新 SDK 3.1.100-preview1-014024
- javascript - 提交后在待办事项列表上编辑我的输入
- applescript - Applescript - 带有 applescript 设置文件标签的幻影结果
- mysql - 如何将数据从一个表复制到同一个数据库中的另一个表?
- r - 如何在绘图上添加回归方程和 R2
- git - 从 Master 到 Branch(Master 提交 --> Branch),cherry-pick 是否有效?