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

Update BSM2-P CSTR Model #1520

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
UnitModelBlockData,
)
from idaes.models.unit_models import (
CSTR,
Feed,
Separator,
Product,
Expand Down Expand Up @@ -68,6 +67,7 @@
from idaes.models.unit_models.mixer import MomentumMixingType
from watertap.unit_models.translators.translator_asm2d_adm1 import Translator_ASM2d_ADM1
from watertap.unit_models.anaerobic_digester import AD
from watertap.unit_models.cstr import CSTR
from watertap.unit_models.dewatering import (
DewateringUnit,
ActivatedSludgeModelType as dewater_type,
Expand Down Expand Up @@ -537,6 +537,10 @@ def scale_variables(m):
if "conc_mass_comp" in var.name:
iscale.set_scaling_factor(var, 1e1)

for unit in ("R1", "R2", "R3", "R4"):
block = getattr(m.fs, unit)
iscale.set_scaling_factor(block.hydraulic_retention_time, 1e-3)
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we are fixing volume, does it make sense to scale this by inverse of volume/flowrate, perhaps using plant influent flowrate as a start?

Copy link
Contributor Author

@MarcusHolly MarcusHolly Nov 7, 2024

Choose a reason for hiding this comment

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

I've just tried doing this, but none of these new scaling factors work (i.e. the system fails to solve)

Copy link
Contributor

Choose a reason for hiding this comment

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

what if we don't provide the scaling facotrs for the HRT as old version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same thing - if we don't provide any scaling factors for HRT, the system fails to solve


for unit in ("R1", "R2", "R3", "R4", "R5", "R6", "R7"):
block = getattr(m.fs, unit)
iscale.set_scaling_factor(
Expand All @@ -550,7 +554,7 @@ def scale_variables(m):

iscale.set_scaling_factor(m.fs.AD.KH_co2, 1e1)
iscale.set_scaling_factor(m.fs.AD.KH_ch4, 1e1)
iscale.set_scaling_factor(m.fs.AD.KH_h2, 1e1)
iscale.set_scaling_factor(m.fs.AD.KH_h2, 1e2)

# Apply scaling
scale_variables(m)
Expand Down
Loading