Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: This rename collides with the existing m.gamma = Var(m.abs, m.compon, ...) later in HDA_model(). Pyomo replaces this scalar Param with the IndexedVar, and HDA_model() now fails during construction in build_compressor() with TypeError: unsupported operand type(s) for -: 'IndexedVar' and 'float' when evaluating m.gamma - 1.0. This HDA change is unrelated to the Kaibel hull fix. Please restore m.gam for the heat-capacity ratio, or choose a non-conflicting name and update all scalar references without overwriting the activity-coefficient m.gamma variable.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in a70395b by renaming the HDA scalar to m.heat_capacity_ratio and updating the dependent equations. tests/test_pr47_regressions.py now checks that m.gamma remains indexed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 90e289d. The heat-capacity ratio is back to m.gam; the existing indexed activity-coefficient m.gamma is no longer overwritten, and the regression covers both.

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