-
Notifications
You must be signed in to change notification settings - Fork 57
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
ASM2d/ADM1 Translator Update #1315
Changes from all commits
0174516
76b77a7
36f4a07
bb35c68
cad3e05
f7bf901
60e7c48
585f5b3
c6aeeb7
a7565a8
98af89c
4e856b4
9ba25b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,9 +21,7 @@ | |
|
||
# Import Pyomo libraries | ||
import pyomo.environ as pyo | ||
from pyomo.common.config import ConfigValue, In | ||
|
||
from enum import Enum, auto | ||
from pyomo.common.config import Bool, ConfigValue | ||
|
||
# Import IDAES cores | ||
from idaes.core import ( | ||
|
@@ -48,11 +46,6 @@ | |
_log = idaeslog.getLogger(__name__) | ||
|
||
|
||
class DecaySwitch(Enum): | ||
on = auto() | ||
off = auto() | ||
|
||
|
||
@declare_process_block_class("ModifiedASM2dReactionParameterBlock") | ||
class ModifiedASM2dReactionParameterData(ReactionParameterBlock): | ||
""" | ||
|
@@ -64,20 +57,14 @@ class ModifiedASM2dReactionParameterData(ReactionParameterBlock): | |
CONFIG.declare( | ||
"decay_switch", | ||
ConfigValue( | ||
default=DecaySwitch.on, | ||
domain=In(DecaySwitch), | ||
default=True, | ||
domain=Bool, | ||
description="Switching function for decay", | ||
doc=""" | ||
Switching function for handling decay in reaction rate expressions. | ||
|
||
**default** - `DecaySwitch.on`` | ||
|
||
.. csv-table:: | ||
:header: "Configuration Options", "Description" | ||
|
||
"``DecaySwitch.on``", "The decay of heterotrophs and autotrophs is dependent on the electron acceptor present" | ||
"``DecaySwitch.off``", "The decay of heterotrophs and autotrophs does not change" | ||
""", | ||
doc="""Switching function for handling decay in reaction rate expressions, | ||
**default** - True. | ||
**Valid values:** { | ||
**True** - the decay of heterotrophs and autotrophs is dependent on the electron acceptor present, | ||
**False** - the decay of heterotrophs and autotrophs does not change""", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @MarcusHolly Does this need to be updated on the technical ref ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suspected this but didn't check if any manually written description conflicted with this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The manual descriptions of decay are all still accurate I believe. |
||
), | ||
) | ||
|
||
|
@@ -1268,7 +1255,7 @@ def rate_expression_rule(b, r): | |
) | ||
elif r == "R9": | ||
# R9: Lysis | ||
if self.params.config.decay_switch == DecaySwitch.on: | ||
if self.params.config.decay_switch: | ||
return b.reaction_rate[r] == pyo.units.convert( | ||
b.params.b_H | ||
* ( | ||
|
@@ -1283,7 +1270,7 @@ def rate_expression_rule(b, r): | |
* b.conc_mass_comp_ref["X_H"], | ||
to_units=pyo.units.kg / pyo.units.m**3 / pyo.units.s, | ||
) | ||
elif self.params.config.decay_switch == DecaySwitch.off: | ||
else: | ||
return b.reaction_rate[r] == pyo.units.convert( | ||
b.params.b_H * b.conc_mass_comp_ref["X_H"], | ||
to_units=pyo.units.kg / pyo.units.m**3 / pyo.units.s, | ||
|
@@ -1436,7 +1423,7 @@ def rate_expression_rule(b, r): | |
) | ||
elif r == "R15": | ||
# R15: Lysis of X_PAO | ||
if self.params.config.decay_switch == DecaySwitch.on: | ||
if self.params.config.decay_switch: | ||
return b.reaction_rate[r] == pyo.units.convert( | ||
b.params.b_PAO | ||
* ( | ||
|
@@ -1451,14 +1438,14 @@ def rate_expression_rule(b, r): | |
* b.conc_mass_comp_ref["X_PAO"], | ||
to_units=pyo.units.kg / pyo.units.m**3 / pyo.units.s, | ||
) | ||
elif self.params.config.decay_switch == DecaySwitch.off: | ||
else: | ||
return b.reaction_rate[r] == pyo.units.convert( | ||
b.params.b_PAO * b.conc_mass_comp_ref["X_PAO"], | ||
to_units=pyo.units.kg / pyo.units.m**3 / pyo.units.s, | ||
) | ||
elif r == "R16": | ||
# R16: Lysis of X_PP | ||
if self.params.config.decay_switch == DecaySwitch.on: | ||
if self.params.config.decay_switch: | ||
return b.reaction_rate[r] == pyo.units.convert( | ||
b.params.b_PP | ||
* ( | ||
|
@@ -1473,14 +1460,14 @@ def rate_expression_rule(b, r): | |
* b.conc_mass_comp_ref["X_PP"], | ||
to_units=pyo.units.kg / pyo.units.m**3 / pyo.units.s, | ||
) | ||
elif self.params.config.decay_switch == DecaySwitch.off: | ||
else: | ||
return b.reaction_rate[r] == pyo.units.convert( | ||
b.params.b_PP * b.conc_mass_comp_ref["X_PP"], | ||
to_units=pyo.units.kg / pyo.units.m**3 / pyo.units.s, | ||
) | ||
elif r == "R17": | ||
# R17: Lysis of X_PHA | ||
if self.params.config.decay_switch == DecaySwitch.on: | ||
if self.params.config.decay_switch: | ||
return b.reaction_rate[r] == pyo.units.convert( | ||
b.params.b_PHA | ||
* ( | ||
|
@@ -1495,7 +1482,7 @@ def rate_expression_rule(b, r): | |
* b.conc_mass_comp_ref["X_PHA"], | ||
to_units=pyo.units.kg / pyo.units.m**3 / pyo.units.s, | ||
) | ||
elif self.params.config.decay_switch == DecaySwitch.off: | ||
else: | ||
return b.reaction_rate[r] == pyo.units.convert( | ||
b.params.b_PHA * b.conc_mass_comp_ref["X_PHA"], | ||
to_units=pyo.units.kg / pyo.units.m**3 / pyo.units.s, | ||
|
@@ -1521,7 +1508,7 @@ def rate_expression_rule(b, r): | |
) | ||
elif r == "R19": | ||
# R19: Aerobic growth of X_AUT | ||
if self.params.config.decay_switch == DecaySwitch.on: | ||
if self.params.config.decay_switch: | ||
return b.reaction_rate[r] == pyo.units.convert( | ||
b.params.b_AUT | ||
* ( | ||
|
@@ -1536,7 +1523,7 @@ def rate_expression_rule(b, r): | |
* b.conc_mass_comp_ref["X_AUT"], | ||
to_units=pyo.units.kg / pyo.units.m**3 / pyo.units.s, | ||
) | ||
elif self.params.config.decay_switch == DecaySwitch.off: | ||
else: | ||
return b.reaction_rate[r] == pyo.units.convert( | ||
b.params.b_AUT * b.conc_mass_comp_ref["X_AUT"], | ||
to_units=pyo.units.kg / pyo.units.m**3 / pyo.units.s, | ||
|
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.
So is
Decay
omitted for the time being or is it somewhere else in this file and associated code?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.
The use of the word decay was inaccurate to begin with. That is entirely handled in the reaction package (depending on whether the DecaySwitch is on(True) or off (False). Not sure if that answers your question...
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.
Got it- the decay switch isn't applied in the translator but is applied in the reaction package. Thanks!