I am working with Gekko's Chemical Library and I am trying to add compounds to my model. The readthedocs page for Gekko says that there are 4 methods for adding each compound:
1) IUPAC Name (1,2-ethanediol)
2) Common Name (ethylene glycol)
3) CAS Number (107-21-1)
4) Formula (C2H6O2)
https://gekko.readthedocs.io/en/latest/chemical.html#c.compound
I am trying to add water to my model, but it only works when I call it as 'water', not 'H2O'.
Is my syntax wrong? How do I know which name will work for each compound?
This throws an error:
# 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)
This works:
# 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)