-
Notifications
You must be signed in to change notification settings - Fork 27
Iron: Adding electrowinning capabilities #432
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
base: develop
Are you sure you want to change the base?
Conversation
kbrunik
left a comment
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.
Thanks for working on this! Overall super cool and exciting to have some more functionality added to H2I. I know this isn't quite finished with regards to documentation and testing but thought I could share some initial thoughts.
johnjasa
left a comment
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.
Thanks for this great PR, Jonathan! I'm glad we're back to moving the iron work forward so well.
I've pushed up some refactoring changes directly. This move some of the calculations that occurred in separate files into a singular file. Could you please take a look and see if you support those changes or if you think the setup was better before them? Given how the calcs are done now, I think it's more clear, but if you were planning to expand out the modeling or use a combination of Stinn or Humbert models in other constituent components later, then I could see the use case for having separate functions. Of course, feel free to undo any changes I did.
Otherwise, I have a large-ish overall question about how you see the usefulness of the cost_coeffs.csv and cost_model.py files would be going forward. Given that we have more of the H2I framework built out and understood now than when we were working on this a year ago, I think we could simplify the setup to move away from having multiple files to define each method, and instead have the calcs defined in-line within the corresponding compute() methods for each converter. Do you think this is reasonable, or should we retain the cost_model.py and cost_coeffs.csv setup from before for a technical reason?
kbrunik
left a comment
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 didn't get a chance to fully review @johnjasa comments so some might be duplicative since I started before John submitted his review. I think it's looking pretty good! Just a few changes hopefully, but exciting this is moving along :)
docs/technology_models/iron_ewin.md
Outdated
|
|
||
| H2I contains models to simulate to separation of mostly pure iron from iron oxides. | ||
| The main input feedstock is iron ore, while the output commodity is "sponge iron", i.e. iron that is typically brittle ("spongey") and contains less carbon than most steel alloys. | ||
| This sponge iron can then be connected to an electric arc furnace (EAF) to produce steel. |
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 sponge iron can then be connected to an electric arc furnace (EAF) to produce steel. | |
| This sponge iron can then be used in other processes such as acting as a feedstock for an electric arc furnace (EAF) which produces steel. |
|
|
||
| To use this model, specify `"humbert_electrowinning_performance"` as the performance model and `"humbert_stinn_electrowinning_cost"` as the cost model. | ||
|
|
||
| ## Shared Parameters |
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.
My understanding based on some feedback I received on a different PR is that we want to start relying on the API docs to autopopulate definitions like this. @johnjasa is this something we could beta here by linking the API documentation?
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 think the way @elenya-grant and I approached the other iron models was to remove some of the file abstraction and have the py files live in the iron folder instead of subfolders. I think it could make sense to move this function directly into the humbert_stinn_ewin_cost.py within the cost class
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 think it could make sense to move this into iron and out of the subfolder.
| cost_model (dict): Dictionary with the file path to cost coefficients. | ||
| electrolysis_temp (float): Electrolysis temperature in degrees Celsius (°C). | ||
| pressure (float): System pressure. | ||
| intsalled capacity (float): Installed capacity in tonnes per year (t/y). |
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.
| intsalled capacity (float): Installed capacity in tonnes per year (t/y). | |
| installed_capacity (float): Installed capacity in tonnes per year (t/y). |
elenya-grant
left a comment
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.
Hi Jonathan! I think this is super cool and the example is very well done! I didn't take a super deep look into the new models but provided some initial feedback (some of it may be irrelevant depending on other changes you plan on making). Would be happy to do a deeper review once it's ready! Thanks for the work on this! Very exciting!
h2integrate/converters/iron/test/test_humbert_stinn_ewin_cost.py
Outdated
Show resolved
Hide resolved
|
|
||
| def compute(self, inputs, outputs, discrete_inputs, discrete_outputs): | ||
| # Physical constants | ||
| F = 96485.3321 # Faraday constant: Electric charge per mole of electrons (C/mol) |
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.
similar comments about F and M being moved to h2integrate/tools/constants.py
| self.add_output("labor_opex", val=0.0, units="USD/year") | ||
| self.add_output("NaOH_opex", val=0.0, units="USD/year") | ||
| self.add_output("CaCl2_opex", val=0.0, units="USD/year") | ||
| self.add_output("limestone_opex", val=0.0, units="USD/year") |
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.
shouldn't feedstock costs (lime, electricity, ore, etc) be taken care of with feedstock component(s)? In my mind, this should only output costs associated with this tech, not its feedstocks.
| elec_price = inputs["price_electricity"] | ||
|
|
||
| # Add ore transport cost TODO: turn iron_transport into proper transporter | ||
| ore_price += ore_transport_cost |
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.
ore transport is now a separate model, should not be included here.
|
|
||
| # Humbert Opex model - from SI spreadsheet (doi.org/10.1007/s40831-024-00878-3) | ||
| # Default costs - adjusted to 2018 to match Stinn via CPI | ||
| labor_rate = 55.90 # USD/person-hour |
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.
Should labor_rate be an attribute of the configuration class?
| labor_rate = 55.90 # USD/person-hour | ||
| NaOH_cost = 415.179 # USD/tonne | ||
| CaCl2_cost = 207.59 # USD/tonne | ||
| limestone_cost = 0 |
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 think these feedstock costs should be taken care of with the feedstock component.
Iron: Adding electrowinning capabilities
This PR adds three iron electrowinning technologies:
For the time being, the performance and cost are modeled fairly simply. Performance is modeled based on upper and lower bounds of energy required for each type as defined by Humbert. Cost is modeled based on correlations of capital cost developed for electrowinning of many different metals developed by Stinn and Allanore, and an opex model developed by Humbert in the spreadsheet available as SI to the linked paper, which also provides input values for the Stinn/Allanore capex model.
Section 1: Type of Contribution
Section 2: Draft PR Checklist
N/A
Type of Reviewer Feedback Requested (on Draft PR)
Structural feedback:
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
h2integrate\converters\iron\:humbert_ewin_perf.py: New iron electrowinning performance modelhumbert_electrowinning_performancebased on Humberthumbert_stinn_ewin_cost.py: New iron electrowinning cost modelhumbert_stinn_electrowinning_costbased on Humbert and Stinn and Allanorestinn\table1.csv: Input data table mostly from Stinn and Allanore but iron costs from Humberth2integrate\converters\iron\stinn\cost_model.py: Modified the transcription of the Humbert SI equations to interface with thehumbert_stinn_electrowinning_costmodelexamples\27_iron_electrowinning\: New example that produces an LCOI for all 3 types of iron electrowinningSection 4.2: Modified Files
h2integrate\converters\iron\stinn\:cost_model.py: Modified the transcription of the Stinn and Allanore equations to interface with thehumbert_stinn_electrowinning_costmodelcost_coeffs.csv: Added in some coefficients that were previously hard-coded intocost_model.pyh2integrate\core\supported_models.py: Addedhumbert_electrowinning_performanceandhumbert_stinn_electrowinning_costas supported modelsh2integrate\finances\profast_base.py: Addedsponge_ironas a mass commoditySection 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