-
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
BSM2 Anoxic CSTR Costing #1186
BSM2 Anoxic CSTR Costing #1186
Conversation
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.
Probably we want to add a testing file for the costing, rather than direclty add to the current BSM2 cause other unit models' costings are still pending.
I could be wrong, but I don't think we have tests for any of the other costing models? I don't see an obvious problem with just adding costing to the BSM2 flowsheet piece-by-piece |
The other costing tests are within their specific test files, like if you check |
Would that belong in WaterTAP or IDAES tho? For example, the HEX and mixer are IDAES models that we added WaterTAP costing for, and neither of these models have tests associated with them from what I can see. Although maybe we should add tests for these... |
watertap/examples/flowsheets/case_studies/full_water_resource_recovery_facility/BSM2.py
Outdated
Show resolved
Hide resolved
The test should be in WaterTAP, probably in the costing directory. There's not a test for the Mixer because we never wrote one. There's an open issue (#1187) to make sure all the costing methods have a unit test. Most do, but a few do not. |
@bknueven I'll make your |
watertap/unit_models/cstr.py
Outdated
# | ||
############################################################################### | ||
""" | ||
Anoxic CSTR unit model for BSM2 and plant-wide wastewater treatment modeling. |
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.
Rename filename to anoxic_cstr
instead of cstr
. Either that, or rename the class which is currently named AnoxicCSTR
. The only dilemma I see with this sort of naming is that anoxic is not anaerobic, technically. So maybe it makes more sense to rename the class as CSTR, which would just build on top of IDAES' CSTR and be the WaterTAP version,
watertap/unit_models/cstr.py
Outdated
# Call UnitModel.build to set up dynamics | ||
super(AnoxicCSTRData, self).build() | ||
|
||
self.HRT = Var( |
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 know that we used the acronym (HRT) in ZO models previously. I spelled it out in my recent PR and I think @agarciadiego did too. We should be consistent and spell it out here too.
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.
Looks good- just some quick changes needed
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1186 +/- ##
==========================================
+ Coverage 90.75% 94.78% +4.03%
==========================================
Files 352 355 +3
Lines 35446 35478 +32
==========================================
+ Hits 32168 33628 +1460
+ Misses 3278 1850 -1428 ☔ View full report in Codecov by Sentry. |
def build_cstr_cost_param_block(blk): | ||
# Source: https://www.fwrj.com/articles/9812.pdf | ||
blk.sizing_cost = pyo.Var( | ||
initialize=0.34, |
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.
This is the unit cost for the largest size shown in the range from the reference. Perhaps we should choose a value like the mean or median.
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 reason I chose the largest size is because the flowrate in BSM2 actually goes way beyond the ranges listed in this reference. The largest flow in the reference is 100,000 GPD (378.5 m3/day) whereas the BSM2 feed flowrate is 20648 m3/day. So I didn't think it made sense to choose a mean or median value. Although if we intend on using this CSTR for non-BSM2 purposes, then it would make more sense to use an average value.
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.
Fair enough!
|
||
# Check solutions | ||
assert pytest.approx(526.45, rel=1e-5) == value(m.fs.unit.costing.capital_cost) | ||
assert pytest.approx(9.0847e-8, rel=1e-5) == value(m.fs.costing.LCOW) |
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.
THis is the only check failing (on Mac) which leads me to believe that a tweak in scaling might resolve. However, this LCOW is approximately 0, and I am not totally confident that the result should/would be that low.
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.
Perhaps I'll try using the median value for the sizing cost above and see if this resolves the issue (although I'm not convinced it will).
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.
It was actually just a unit/scaling problem. Once I specified that the inlet flowrate was in m3/s and corrected the LCOW value, the Mac failure resolved itself. I didn't change the unit cost value though... still not sure if using the average/median makes sense.
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.
What was the unit/scaling problem?
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 needed to specify the units of volumetric flow when I set the operating conditions in the test file
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.
LGTM!
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.
LGTM
Summary/Motivation:
Adds costing method for anoxic CSTRs
Legal Acknowledgement
By contributing to this software project, I agree to the following terms and conditions for my contribution: