Skip to content

Add visualization for LCOW and SEC breakdowns - #1848

Draft
kurbansitterley wants to merge 20 commits into
watertap-org:mainfrom
kurbansitterley:create-lcow-breakdown-method
Draft

Add visualization for LCOW and SEC breakdowns#1848
kurbansitterley wants to merge 20 commits into
watertap-org:mainfrom
kurbansitterley:create-lcow-breakdown-method

Conversation

@kurbansitterley

@kurbansitterley kurbansitterley commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Fixes/Resolves:

maybe #1820

Summary/Motivation:

Plots that break down the LCOW into component parts (CAPEX + OPEX for each unit) has been done many times in publications that use WaterTAP. In addition to being a great way to visualize results, it is also a good "smell check" for your results when, despite the aggregate LCOW being reasonable, you can see what is making up the LCOW and if any unit is contributing too much/little.

Many users of WaterTAP likely do not have the plotting chops to make these visualizations themselves and might appreciate a method on the costing package that will do it for them.

Changes proposed in this PR:

This PR will add two methods to the WaterTAP costing package:
-plot_LCOW_breakdown
-plot_SEC_breakdown

Each of these will use the add_flow_component_breakdown method that already exists to create stacked bar plots of the results for either metric. Each has similar keyword arguments that dictate the type of breakdown:

  • by indicates if the breakdown should be made by each component (e.g., include each pump separately for a flowsheet with multiple pumps) or by the aggregate of all like units (e.g., combine all the pumps into one)
  • separate_flows is a bool that indicates whether the flows should be combined into the OPEX portion of the plot or plotted separately
  • relative indicates whether or not the plot should be the fractional contribution of each component (e.g., % of total LCOW) or use the apparent value

Other keywords are:

  • save_as is the filename to save the figure as
  • tol is the tolerance to use when checking the calculated breakdown against the value on the flowsheet
  • colormap is the matplotlib colormap to use for the plot

I will also say this loudly and clearly:

These are not meant to be publication-ready figures

These methods are meant to be "quick and dirty" and create simple visualizations as a starting point or troubleshooting tool for identifying where goofy costing results are coming from. I have also intentionally created these methods to not accept many keywords for customization and for many of the plotting decisions to be made for you (mostly by using matplotlib defaults). Adding too many ways for the user to customize the plot is a slippery slope.

Everyone (including myself) has their own tastes or "theory" for what makes a good visualization. I have intentionally tried to make these as vanilla as possible. I have included the colormap keyword only for the case where the default tab20 is not sufficient to distinguish between components (which would be a pretty big flowsheet).

Both of these methods return fig, ax so a savvy user can add further customizations if they desire.

Lastly- I use the LSRRO flowsheet to test this functionality, so as part of this PR I added a main function to the LSRRO flowsheet and a test file.

Here are a few examples:

MVC flowsheet

m.fs.costing.plot_LCOW_breakdown(by="component", separate_flows=False, relative=False)
image
m.fs.costing.plot_LCOW_breakdown(by="component", separate_flows=False, relative=True)
image

LSRRO

m.fs.costing.plot_SEC_breakdown(by="component", separate_flows=False, relative=False)
image
m.fs.costing.plot_SEC_breakdown(by="component", separate_flows=False, relative=True)
image
m.fs.costing.plot_LCOW_breakdown(relative=False, by="aggregate", separate_flows=True)
image
m.fs.costing.plot_LCOW_breakdown(by="component", separate_flows=False, relative=False)
image

TODO:

  • fix bounds on plot for relative=True, by="aggregate", separate_flows=False

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.

@ksbeattie ksbeattie added the Priority:Normal Normal Priority Issue or PR label Jul 16, 2026
@ksbeattie ksbeattie added Priority:High High Priority Issue or PR and removed Priority:Normal Normal Priority Issue or PR labels Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority:High High Priority Issue or PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants