Repository navigation
Conversation
5cf34b2 to
8c1bcb7
Compare
8c1bcb7 to
a693f1c
Compare
| """_summary_ | ||
| This is a very simple placeholder cost model: | ||
|
|
||
| - Reference: 240,000 USD for a 1 MW HX with U ~ 1000 W/m²-K |
There was a problem hiding this comment.
I don't know the source for this function, I would rather use something from a chemical plant design handbook.
From Sinott and Towler (2021):
U-tube shell and tube HX:
Total installed costs = [(a+b*S^n) * f_year * f_install * f_material]
a = 28000
b = 54
n = 1.2
S - heat transfer area in m^2
limits: 10 m^2 <= S <= 1000 m^2
This is in CEPCI index = 532.9 so need to be converted (it's for Jan. 2010)
To get it to 2022 USD f_year = 816/532.9
f_install = 1.61 (default, maybe let the user add their own?)
It also assums simple carbon steel, so we need to account for materials once temperatures are higher
f_material = 1 for carbon steel (should be a default value), if user specifies another more expensive material they should include f_material
For the OpEx I am not sure we want to include it in a cost function, this should be in the general economic calculation (like ProFAST)
| exp_Q = inputs["exp_Q"][0] | ||
|
|
||
| scale_Q = (Q_total_W / Q_ref) ** exp_Q if Q_total_W > 0 else 0.0 | ||
| capex = C_ref * scale_Q |
There was a problem hiding this comment.
Do we want to add installation factor in here, or are those things usually accounted for elsewhere in H2I analysis?
I think in ther steel paper at least the cost functions are for totat installed costs
elenya-grant
left a comment
There was a problem hiding this comment.
Howdy Chris! I'm not sure whether this is ready for a full in-depth review yet but I left a few small comments and did a quick review (I will do another deeper-review once this is not longer a draft). Overall it seems like some very useful and cool functionality! Thanks for the work on this!
Some higher-level notes are:
heat_exchanger_model/hx_shell_tube_steady.py: more inline comments and docstrings would be helpful in the functions defined in here- Could you update the performance model to use the recently introduced
PerformanceModelBaseClass? I'd be happy to help here if needed! - Don't forget to add the performance and cost model(s) to
supported_models.py
…into feature/heat_exchanger
kbrunik
left a comment
There was a problem hiding this comment.
I really like the changes regarding the multivariable streams, it looks really great! I've left some additional comments throughout the PR, I am curious if there are situations that you would expect the heat exchanger to fail in and making sure we add in some safeguards to help protect the users. I think you're at the stage where you could add a doc page too! Thanks Chris for working on this :)
| @@ -0,0 +1,916 @@ | |||
| """ | |||
There was a problem hiding this comment.
Yes, I think fewer files make it easier to follow and that having it in the class would be the preferred method
|
|
||
| @define(kw_only=True) | ||
| class ShellTubeHXPerformanceModelConfig(BaseConfig): | ||
| """ |
There was a problem hiding this comment.
Nice! looks like it still should be added to the docstring but glad to see the extra args!
There was a problem hiding this comment.
I'd recommend adding performance to the python file name to distinguish that this is just the performance model
| from CoolProp.CoolProp import PropsSI | ||
|
|
||
| from h2integrate.core.utilities import BaseConfig, merge_shared_inputs | ||
| from h2integrate.core.validators import gt_zero |
There was a problem hiding this comment.
Looks like this is still using the h2i validators, this was recently changed in PR #835 to just use the built in validators in attrs. I'll comment below the updated ways to use the validators
| working_fluid_name: CoolProp fluid name for the working stream. | ||
| """ | ||
|
|
||
| process_fluid_temp_C: float = field(validator=gt_zero) |
There was a problem hiding this comment.
Here's the updated validator:
float = field(validator=validators.gt(0))
| capital expenditure. Default is 0.04 (4%). | ||
| """ | ||
|
|
||
| cost_year: int = field(default=2022, converter=int, validator=must_equal(2022)) |
There was a problem hiding this comment.
I think this is fine to keep as the CEPCI translation since it's technically more correct than a general inflation.
| capital expenditure. Default is 0.04 (4%). | ||
| """ | ||
|
|
||
| cost_year: int = field(default=2022, converter=int, validator=must_equal(2022)) |
There was a problem hiding this comment.
but can you update the validator to validator=validators.in_([2022])?
|
|
||
| cost_year: int = field(default=2022, converter=int, validator=must_equal(2022)) | ||
| S: float = field(default=10.0, converter=float, validator=[gt(10), lt(1000)]) | ||
| install_factor: float = field(default=1.61, converter=float, validator=gt_zero) |
There was a problem hiding this comment.
Updated install_factor, material_factor, opex_percentage validators to validator=gt(0)
| expected_pump_power_kW = 0.28157427036731625 | ||
|
|
||
| rel = 1e-5 | ||
| assert Q_total_kW[0] == approx(expected_Q_total_kW, rel=rel) |
There was a problem hiding this comment.
Can you update the tests to use pytest subtests? It makes it faster to diagnose when/what is failing in the tests
There was a problem hiding this comment.
can you add a test to make sure the "swap" functionality works?
…into feature/heat_exchanger
Add HX performance and cost components
This PR adds a simple heat exchanger model, along with a cost model. This model is meant to be used with other models that are being developed, such as the electric thermal energy storage model #810 and a yet to be opened electric/natural gas boiler model PR. As such, an explicit example using this technology has not yet been added, but will be as part of an integrated example of these components.
This model is meant to accept two fluids, a source fluid (that brings the heat) and a working fluid (that removes the heat). I would appreciate specific review on the implementation of these inputs/outputs and whether they should be changed in some way to reflect commodity streams, or some other form.
Also, review of the organization of the code would be helpful. I originally had the specific heat exchanger functions located in a sub-folder
converters/heat/heat_exchanger_model, but the current version has those functions integrated directly into the model class. So feedback on which method will determine what remains and what gets removed.Docs will be updated once reviewed to be informed by any required changes.
Section 1: Type of Contribution
Section 2: Draft PR Checklist
TODO:
Type of Reviewer Feedback Requested (on Draft PR)
Structural feedback:
heatfolder to theconvertersdirectory.Implementation feedback:
Other feedback:
Section 3: General PR Checklist
docs/files are up-to-date, or added when necessaryCHANGELOG.mdhas been updated to describe the changes made in this PRSection 3: Related Issues
Section 4: Impacted Areas of the Software
Section 4.1: New Files
converters/heat/shell_tube_hx.pyconverters/heat/shell_tube_hx_cost_model.pyconverters/heat/test/test_shell_tube_hx.pyconverters/heat/test/test_shell_tube_hx_cost_model.pySection 4.2: Modified Files
Section 5: Additional Supporting Information
Section 6: Test Results, if applicable
Section 7 (Optional): New Model Checklist
docs/developer_guide/coding_guidelines.mdattrsclass to define theConfigto load in attributes for the modelBaseConfigorCostModelBaseConfiginitialize()method,setup()method,compute()methodCostModelBaseClasssupported_models.pycreate_financial_modelinh2integrate_model.pytest_all_examples.pydocs/user_guide/model_overview.mddocs/section<model_name>.mdis added to the_toc.yml