Skip to content

Byproduct recovery framework tutorial #141

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

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

Lingyan90
Copy link
Contributor

Addresses Issue:

This tutorial explains how to use the byproduct recovery framework.

Summary/Motivation:

This tutorial demonstrated how to apply the byproduct recovery framework to an elements recovery plants. A case study of lithium-colbalt recovery from diafiltration process is utilized.

Changes proposed in this PR:

  • Added a byproduct recovery framework tutorial file
  • Added the tutorial name in doc\_toc.yml

Reviewer's checklist / merge requirements:

  • The head branch (i.e. the "source" of the changes) is not the main branch on the PR author's fork
  • Documentation
  • Tests
  • Diagnostic tests for models

Legal Acknowledgement

By contributing to this software project, I agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the license terms described in the LICENSE.md file
    at the top level of this directory.

  2. I represent I am authorized to make the contributions and grant the license. If my employer has
    rights to intellectual property that includes these contributions, I represent that I have
    received permission to make contributions and grant the required license on behalf of that
    employer.

@Lingyan90 Lingyan90 self-assigned this Mar 27, 2025
@Lingyan90 Lingyan90 requested a review from bpaul4 March 27, 2025 14:36
Copy link

codecov bot commented Mar 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.03%. Comparing base (5a1c38c) to head (59e74b7).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #141   +/-   ##
=======================================
  Coverage   97.03%   97.03%           
=======================================
  Files          65       65           
  Lines        9715     9715           
=======================================
  Hits         9427     9427           
  Misses        288      288           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@bpaul4 bpaul4 left a comment

Choose a reason for hiding this comment

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

Hi @Lingyan90, the content here is good, I have some initial comments.

docs/_toc.yml Outdated
@@ -5,4 +5,5 @@ chapters:
- file: tutorials/diafiltration
- file: tutorials/diafiltration-solution
- file: tutorials/uky_flowsheet-solution
- file: tutorials/byproduct_recovery_determination
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename the file so that the CI framework can find it:

Suggested change
- file: tutorials/byproduct_recovery_determination
- file: tutorials/byproduct_recovery_determination-solution

@@ -0,0 +1,706 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Add "-solution" to the file name.

"source": [
"# __Byproduct Recovery Framework Tutorial__\n",
"\n",
"The purpose of this tutorial is to introduce the __byproduct recovery decision framework__ (``determine_byproduct_recovery.py``), which is based on the criterion of whether the total annual revenue is non negative. This framework serves as a supporting tool to help determine whether certain critical minerals (CMs) and/or rare Earth elements (REEs) should be recovered. \n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"The purpose of this tutorial is to introduce the __byproduct recovery decision framework__ (``determine_byproduct_recovery.py``), which is based on the criterion of whether the total annual revenue is non negative. This framework serves as a supporting tool to help determine whether certain critical minerals (CMs) and/or rare Earth elements (REEs) should be recovered. \n",
"The purpose of this tutorial is to introduce the __byproduct recovery decision framework__ (``determine_byproduct_recovery.py``), which determines economic viability of converting waste streams into saleable byproducts based on a known viability criterion. This framework serves as a supporting tool to help determine whether certain critical minerals (CMs) and/or rare Earth elements (REEs) should be recovered. \n",

"\n",
"While this tutorial focuses on revenue-based decisions, byproduct recovery decisions can also be guided by other criteria—such as the abundance of the byproduct or its current market value.\n",
"\n",
"The decision tree used in this tutorial is referenced from Chapter 8 of the book _Chemical engineering design: principles, practice and economics of plant and process design_ by Towler, Gavin, and Ray Sinnott, Butterworth-Heinemann, 2021.\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"The decision tree used in this tutorial is referenced from Chapter 8 of the book _Chemical engineering design: principles, practice and economics of plant and process design_ by Towler, Gavin, and Ray Sinnott, Butterworth-Heinemann, 2021.\n",
"The decision tree used in the byproduct recovery decision framework is referenced from Chapter 8 of the book _Chemical engineering design: principles, practice and economics of plant and process design_ by Towler, Gavin, and Ray Sinnott, Butterworth-Heinemann, 2021.\n",

"The decision tree used in this tutorial is referenced from Chapter 8 of the book _Chemical engineering design: principles, practice and economics of plant and process design_ by Towler, Gavin, and Ray Sinnott, Butterworth-Heinemann, 2021.\n",
"![My Image](byproduct_recovery_determination_tree.png)\n",
"\n",
"The framework includes a built in hypothesis example that results in positive revenue. In this tutorial, we will also demonstrate how to apply this framework to assess whether __lithium__ and __colbolt__ should be recovered through a dialfiltration process. \n",
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think the sentence is needed.

Suggested change
"The framework includes a built in hypothesis example that results in positive revenue. In this tutorial, we will also demonstrate how to apply this framework to assess whether __lithium__ and __colbolt__ should be recovered through a dialfiltration process. \n",
"In this tutorial, we will also demonstrate how to apply this framework to assess whether __lithium__ and __colbolt__ should be recovered through a dialfiltration process. \n",

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I revised the first sentence of line 18 to indicate that the framework’s Python script includes a built-in example. I’d prefer to include this information in the tutorial as well, so users can refer to it as a simpler, more accessible example.

"source": [
"These prices will be used to compute __annual revenue__, which is a key input to the byproduct recovery decision framework.\n",
"\n",
"__2. Specify the Product Putputs__\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

outputs?

"\n",
"Next, define the __products__ recovered from the byproduct recovery plant.\n",
"\n",
"The __byproduct recovery framework__ accepts flexible inputs, where products are listed in a structure called ``material_list``, and their associated data (e.g. flow rate, price) are organized in a dictionary called ``material_data``.\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

I would say "modular" or "user" instead of "flexible".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i used "user" instead

"id": "dbe5705c-f654-4190-b490-87cdc41579dd",
"metadata": {},
"source": [
"__3. Set Additional Parameters and Evaluate Net Benefit__\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest only putting backticks around text if it's code object names, otherwise use bold or italics instead.

Copy link
Contributor Author

@Lingyan90 Lingyan90 Mar 28, 2025

Choose a reason for hiding this comment

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

yes, bold was intended. updated with bold instead

"source": [
"__4. Calculate the Overall Net Benefit__\n",
"\n",
"After setting parameters such as production rate, market price, and associated costs for each product, you can use the byproduct recovery framework to calculate the overall net benefit.\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

avoid "you"

"\n",
"The __overall net benefit__ is used to determine profitability:\n",
"\n",
"- If ``net_benefit_value`` > 0 → The byproduct recovery process is __profitable__.\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought the criteria was an input, but I see now that it's hard coded at zero. Do we want to make this a user-input with a default at 0, for example a user could pass "2000" and the method would check if the net benefit is greater than or less than $2000.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The final decision message has the information of whether this plant is loss money or have positive net benifit and also shows the final value. I think it fine to put it this way. Users can determine from the final message whether it meet their expectation or not.

rename the tutorial file
fix typos
@lbianchi-lbl lbianchi-lbl added documentation Improvements or additions to documentation tutorials labels Mar 31, 2025
@lbianchi-lbl
Copy link
Contributor

This is related to the generally applicable functionality introduced mainly in #123.

@bpaul4 bpaul4 requested a review from Agfritz April 8, 2025 14:08
@ksbeattie ksbeattie added the Priority:Normal Normal Priority Issue or PR label Apr 14, 2025
@bpaul4 bpaul4 requested a review from MAZamarripa April 22, 2025 14:08
Copy link

@Agfritz Agfritz left a comment

Choose a reason for hiding this comment

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

Great work on this tutorial! It looks good, I just had some comments on formatting and functionality.

Copy link

Choose a reason for hiding this comment

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

Cell ID: 0a29c413-0a01-4f16-bf26-29a60dae142a Line 3: Recommend revising text since REEs are a subset of critical minerals. Also, this framework can be generalized to other byproducts as well (not just CMs). Suggested text:
"This framework serves as a supporting tool to help determine whether evaluated byproducts should be recovered. The focus of this tutorial is critical minerals (CMs), but this framework can be generalized to other recoverable byproducts if appropriate pricing data is provided."

Copy link

Choose a reason for hiding this comment

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

Cell ID: 0a29c413-0a01-4f16-bf26-29a60dae142a line 5-22:
Recommend rephrasing as "To evaluate byproduct recovery, annualized net benefit is assessed with the following equations:"
Also, the equations do not appear to be rendering properly when i open the file in jupyter notebooks as shown below:
image

Copy link

Choose a reason for hiding this comment

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

Cell ID: 0a29c413-0a01-4f16-bf26-29a60dae142a line 39:
The image of the byproduct framework is not rendering for me in Jupyter notebooks:
image

Copy link

Choose a reason for hiding this comment

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

Cell ID: c67e54d8-fa6d-4cbb-85b6-10405d55197d
To install directly from jupyter, required exclamation before pip:
!pip install pyomo
!pip install idaes-pse

Copy link

Choose a reason for hiding this comment

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

Cell ID: 7661675a-353f-48b7-8e8a-ff0a05a813e8 line 5:
Recommend rephrasing to "Installation of PrOMMiS packages require several additional steps, refer the README.me file for details: https://github.com/prommis/prommis/blob/main/README.md for guidance."

Copy link

Choose a reason for hiding this comment

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

Cell ID: 04c9f0b2-437d-4791-a4a0-950471099cbf line 5 recommend rephrasing to "To determine whether lithium and cobalt should be recovered, the user first needs to import the diafiltration process and access the cost and revenue."

Copy link

Choose a reason for hiding this comment

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

Cell ID: dd13f5b4-1ceb-4755-a220-950708a60bff:
Recommend adding instructions for user to set their own sale prices here as well. They may want to use more updated prices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation Priority:Normal Normal Priority Issue or PR tutorials
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants