4

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)
Joseph
  • 755
  • 1
  • 5
  • 7
  • 3
    The `H2O` compound name works on Windows (using `remote=False`) but it doesn't work on Linux, even with `remote=False`. The remote server is Linux as well so it fails when `remote=True`. You found an OS-specific bug! There may be something with how it is converting to `h2o` and the upper and lower case names not matching. Could you add this as a bug report on Github? https://github.com/BYU-PRISM/GEKKO/issues – John Hedengren Nov 23 '19 at 00:32
  • 2
    Thank you. I added the bug report to Github – Joseph Nov 23 '19 at 17:08

0 Answers0