在Gekko的化学库中访问化合物时,如何确定该化合物的称呼?

时间:2019-11-22 21:56:00

标签: gekko

我正在与Gekko的化学图书馆合作,并试图将化合物添加到我的模型中。 Gekko的readthedocs页面说,有4种添加每种化合物的方法:

1)IUPAC名称(1,2-乙二醇)

2)通用名称(乙二醇)

3)CAS号(107-21-1)

4)式(C2H6O2)

https://gekko.readthedocs.io/en/latest/chemical.html#c.compound

我正在尝试向模型中添加水,但是仅当我将其称为“水”而不是“ H2O”时才起作用。

我的语法错误吗?我怎么知道每种化合物都适用哪个名称?

这将引发错误:

# usage: thermo('mw') for constants
# thermo('lvp',T) for temperature dependent
from gekko import GEKKO, chemical
m = GEKKO()
c = chemical.Properties(m)
# add compounds
c.compound('H2O')
# molecular weight
mw = c.thermo('mw')
# liquid vapor pressure
T = m.Param(value=310)
vp = c.thermo('lvp',T)
m.solve(disp=False)
print(mw)
print(vp)

这有效:

# usage: thermo('mw') for constants
# thermo('lvp',T) for temperature dependent
from gekko import GEKKO, chemical
m = GEKKO()
c = chemical.Properties(m)
# add compounds
c.compound('water')
# molecular weight
mw = c.thermo('mw')
# liquid vapor pressure
T = m.Param(value=310)
vp = c.thermo('lvp',T)
m.solve(disp=False)
print(mw)
print(vp)

0 个答案:

没有答案