Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revised vapor composition constraints fix ZeroDivisionError when gdp.hull reformulation is applied #47

Open
wants to merge 2 commits into
base: kaibel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions gdplib/hda/HDA_GDP_gdpopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def HDA_model():

m.alpha = Param(initialize=0.3665, doc="compressor coefficient")
m.compeff = Param(initialize=0.750, doc="compressor efficiency")
m.gam = Param(initialize=1.300, doc="ratio of cp to cv")
m.gamma = Param(initialize=1.300, doc="ratio of cp to cv")
m.abseff = Param(initialize=0.333, doc="absorber tray efficiency")
m.disteff = Param(initialize=0.5000, doc="column tray efficiency")
m.uflow = Param(initialize=50, doc="upper bound - flow logicals")
Expand Down Expand Up @@ -1312,7 +1312,7 @@ def Compelec(_m, comp_):
* m.f[stream]
/ 60.0
* (1.0 / m.compeff)
* (m.gam / (m.gam - 1.0))
* (m.gamma / (m.gamma - 1.0))
for (comp1, stream) in m.icomp
if comp_ == comp1
)
Expand All @@ -1324,7 +1324,7 @@ def Compelec(_m, comp_):

def Ratio(_m, comp_):
if comp == comp_:
return m.presrat[comp_] ** (m.gam / (m.gam - 1.0)) == sum(
return m.presrat[comp_] ** (m.gamma / (m.gamma - 1.0)) == sum(
m.p[stream] for (comp1, stream) in m.ocomp if comp_ == comp1
) / sum(m.p[stream] for (comp1, stream) in m.icomp if comp1 == comp_)
return Constraint.Skip
Expand Down Expand Up @@ -2248,11 +2248,11 @@ def Valcmb(_m, valve, compon):

def Valt(_m, valve):
return sum(
m.t[stream] / (m.p[stream] ** ((m.gam - 1.0) / m.gam))
m.t[stream] / (m.p[stream] ** ((m.gamma - 1.0) / m.gamma))
for (valv, stream) in m.oval
if valv == valve
) == sum(
m.t[stream] / (m.p[stream] ** ((m.gam - 1.0) / m.gam))
m.t[stream] / (m.p[stream] ** ((m.gamma - 1.0) / m.gamma))
for (valv, stream) in m.ival
if valv == valve
)
Expand Down
Loading
Loading