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

Costing docs- initial template rollout #1361

Merged
merged 19 commits into from
Apr 29, 2024

Conversation

adam-a-a
Copy link
Contributor

@adam-a-a adam-a-a commented Apr 18, 2024

Fixes/Resolves:

Partially addresses #1360

Summary/Motivation:

Initiates our effort to document costing of unit models by creating a landing page and template for all unit models currently in the costing/unit_models directory.

After this PR, assignees should manually fill out their unit model costing rst files.

Changes proposed in this PR:

  • landing page for unit model costing docs
  • template for unit model costing doc
  • automation script that writes out template and index file for all units listed in costing.unit_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.txt 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.

@adam-a-a adam-a-a added Priority:High High Priority Issue or PR 1.0 Hard requirement for the 1.0 release labels Apr 18, 2024
with open("detailed_unit_model_costing.rst", "a") as f:
f.write(f" {unit_name_list[i]}\n")

with open(f"{unit_name_list[i]}.rst", "w", encoding="utf-8") as f:
Copy link
Contributor

Choose a reason for hiding this comment

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

So we can reuse this when more models are added, I think this should check for the existence of f"{unit_name_list[i]}.rst" before opening this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As in- "do not overwrite the file if it exists already"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or simply "only open and write to the file if it has been created already"?

Copy link
Contributor

Choose a reason for hiding this comment

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

As in- "do not overwrite the file if it exists already"?

This one -- I assume these will be filled-out in subsequent PRs, and we don't want to overwrite files which already exist.

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 was originally contemplating whether to automatically fill the tables with model params/vars as was done previously for the ZO model costing documentation. However, I am thinking we might as well just let each assignee manually fill out the relevant sections without needing to run this script (at least for the time being.

I can add a boolean option to enable/disable overwriting here, but unsure how necessary it would be if we turn the guidance into--don't run the script--just manually edit your rst file as needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, we'll want you're suggestion for later on, when new unit model methods get added. So I will try to add it in this PR.

@adam-a-a
Copy link
Contributor Author

@hunterbarber - I used the same structure that you used for GAC costing documentation, except I added a separate section for Costing Parameters (and Costing Variables). Check it out and let me know if you have thoughts on why it should stay as one section, as you had it.

@adam-a-a adam-a-a marked this pull request as ready for review April 20, 2024 20:33
@@ -0,0 +1,27 @@
name,unit
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 could probably get rid of this csv and just read filenames from costing/unit_models, but isn't necessary to make that change yet.

@adam-a-a adam-a-a mentioned this pull request Apr 22, 2024
28 tasks
Copy link
Contributor

@MarcusHolly MarcusHolly left a comment

Choose a reason for hiding this comment

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

LGTM. One minor comment: should we include a link to the unit model documentation in the unit model costing method page? I think we had intended to include a link to the unit model costing method page in the unit model documentation, so doing the inverse on top of that might be redundant. Although doing so couldn't hurt...

Copy link
Contributor

@hunterbarber hunterbarber left a comment

Choose a reason for hiding this comment

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

Just a couple comments. After seeing responses I'll come back and approve.

f.write("\n\nReferences\n")
f.write("-" * len("References"))
f.write(
"\nAim to include at least one reference in most cases, but delete this section if no references used for cost relationships/default values"
Copy link
Contributor

Choose a reason for hiding this comment

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

A disclaimer that the default values of parameters (say unit cost) correspond to the dollar value of the year of the reference (e.g. USD2020). Not necessarily saying this should go in the references, but if supplying units of default parameters should $ be listed as USDYYYY in all of these docs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps a link to other docs on costing, wherever currency units are explained, with a brief description on the fact that we can resolve variations in defaults (or provided values) with base_currency

Copy link
Contributor

Choose a reason for hiding this comment

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

Everything would be converted to base flowsheet currency when solving, so that link probably should exist at a higher level documentation like the watertap_costing_package just so it is not unnecessarily duplicated in every unit model. For these docs then, are you agreeing that the parameter tables should be completed using USD_YYYY instead of $ for the currency units?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, if reporting default parameters, makes sense to report the currency year.

)

# TODO: add module directives to unit and cost method
f.write("\nCode Documentation\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'm assuming the author can should just include both the 0D and 1D models here, or other instances where unit_model:cost_model aren't 1:1. Say the some units having more dependencies on rectifier, heat exchanger, pumps, etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

Because of that, I don't know if it makes sense to have once section as the model directly using the method/class and an optional section for other costing dependencies. Just a thought.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So instead of including any link to unit models here, I can just include the cost method, and later, within unit model tech refs, we can point to the relevant default costing method for the unit at hand. For example, in the tech ref for GAC, under costing section, We would just have a sentence pointing to the default costing method used and its tech ref (or something like that).

…g_rst_file.py

Co-authored-by: MarcusHolly <96305519+MarcusHolly@users.noreply.github.com>
@adam-a-a adam-a-a enabled auto-merge (squash) April 29, 2024 19:49
@adam-a-a adam-a-a merged commit d1c0e84 into watertap-org:main Apr 29, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.0 Hard requirement for the 1.0 release Priority:High High Priority Issue or PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants