-
Notifications
You must be signed in to change notification settings - Fork 7
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
base: kaibel
Are you sure you want to change the base?
Conversation
…hull reformulation is applied
As long as there are no errors, this PR is ready to be merged. @bernalde |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides some small changes the most important part is verifying that both the Big-M and HR can provided the right solution to the problem and that the new introduced variables/constraints did not modify the optimal solution
@@ -245,7 +243,7 @@ def build_model(): | |||
for comp in m.comp: | |||
m.dHvap[comp] = dHvapb[comp] / m.Hscale | |||
|
|||
## Heat capacity calculation for liquid and vapor phases using Ruczika-D method for each component in the feed, section, and tray | |||
## Heat capacity calculation for liquid and vapor phases for each component in the feed, section, and tray |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove the comment on the method? Is that method not used? If it is used, leave the comment and add a reference
m.prop[comp, 'TC'] / m.Tup, | ||
m.prop[comp, 'TC'] / m.Tlo, | ||
), # (0, None), | ||
initialize=lambda m, sec, tray, comp: m.T0[sec, tray] / m.Tlo, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this way of defining bounds and initializations!
m.prop[comp, 'TC'] | ||
/ m.T[1, n_tray] | ||
m.Tr[1, n_tray, comp] | ||
# m.prop[comp, 'TC'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why leave these lines here? If the code works, remove the comments as they become confusing
@@ -1472,7 +1502,7 @@ def bottom_vapor_composition(disj, comp): | |||
) | |||
) | |||
) | |||
/ m.P[1, n_tray] | |||
# / m.P[1, n_tray] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comment as pressure multiplied in the other side of the equality
The constraint equation to calculate the temperature term for the top section vapor composition. | ||
""" | ||
return m.Tr[4, n_tray, comp] * m.T[4, n_tray] == m.prop[comp, 'TC'] | ||
|
||
@disj.Constraint(m.comp, doc="Top scetion 4 vapor composition") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo here in section
f798d9d
to
2838304
Compare
This PR fix the ZeroDivisionError when gdp.hull reformulation is applied in the Kaibel instance.
File:
gdplib/kaibel/kaibel_solve_gdp.py