-
Notifications
You must be signed in to change notification settings - Fork 43
Paper mill and synthetic aviation fuels #818
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
mariya-koleva
wants to merge
9
commits into
develop
Choose a base branch
from
paper_mill
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8a89456
Paper mill + SAF converters and example added
mariya-koleva 746a9f6
Changed example numbering
mariya-koleva 4008b14
Some changes necessary for H2I to recognize paper mill and SAF models
johnjasa d296fbf
Removed my name in output file writing
mariya-koleva ff21f60
Refactoring portions of the paper mill and SAF models
johnjasa 420eb63
precommit updates
johnjasa b339be4
Refactoring the inputs and outputs structure of paper mill and SAF
johnjasa 64e394f
Merge branch 'develop' into paper_mill
johnjasa d67ce47
Merge branch 'develop' into paper_mill
johnjasa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| name: H2Integrate_config | ||
| system_summary: This reference paper mill plant is located in Minnesota and for its first pass, it contains paper mill plant | ||
| powered by grid. The system is designed to produce paper at a constant rate throughout the year. | ||
| driver_config: driver_config.yaml | ||
| technology_config: tech_config.yaml | ||
| plant_config: plant_config.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,185 @@ | ||
| # """ | ||
| # Created on Fri May 15 07:38:06 2026 | ||
|
|
||
| # @author: mkoleva | ||
| # """ | ||
|
|
||
| # import pandas as pd | ||
| # import matplotlib.pyplot as plt | ||
|
|
||
| # # Load Excel file | ||
| # file_path = "Breakdown_costs_per_scenario.xlsx" | ||
| # df = pd.read_excel(file_path, sheet_name="Sheet1", header=None) | ||
|
|
||
| # # Scenario labels — edit however you prefer | ||
| # scenarios = [ | ||
| # "Paper + Pulp", | ||
| # "SAF with H2", | ||
| # "SAF with low-carbon H2", | ||
| # "Paper + Pulp\nSAF with H2", | ||
| # "Paper + Pulp\nSAF with low-carbon H2" | ||
| # ] | ||
|
|
||
| # # Extract cost component names | ||
| # components = df.iloc[3:, 0].values | ||
|
|
||
| # # Build scenario value arrays (sum of appropriate columns) | ||
| # records = {} | ||
| # records["Paper + Pulp"] = df.iloc[3:, [1, 2, 3]].astype(float).sum(axis=1).values | ||
| # records["SAF with H2"] = df.iloc[3:, [3]].astype(float).sum(axis=1).values | ||
| # records["SAF with low-carbon H2"] = df.iloc[3:, [4]].astype(float).sum(axis=1).values | ||
| # records["Paper + Pulp\nSAF with H2"] = df.iloc[3:, [5, 6, 7]].astype(float).sum(axis=1).values | ||
| # results = df.iloc[3:, [8, 9, 10]] | ||
| # records["Paper + Pulp\nSAF with low-carbon H2"] = results.astype(float).sum(axis=1).values | ||
|
|
||
| # # Build DataFrame | ||
| # plot_df = pd.DataFrame(records, index=components) | ||
| # plot_df = plot_df[scenarios] # order consistently | ||
|
|
||
| # # Assign custom colors | ||
| # colors = [] | ||
| # for comp in plot_df.index: | ||
| # if "CapEx" in comp: | ||
| # colors.append("navy") | ||
| # elif "OpEx" in comp: | ||
| # colors.append("orange") | ||
| # elif "Feedstock" in comp: | ||
| # colors.append("deepskyblue") | ||
| # elif "Taxes" in comp: | ||
| # colors.append("lightpink") | ||
| # elif "Finances" in comp: | ||
| # colors.append("yellowgreen") | ||
| # else: | ||
| # colors.append(None) # Let matplotlib choose default | ||
|
|
||
| # # Plotting | ||
| # plt.figure(figsize=(10, 6)) | ||
| # bottom = [0] * len(scenarios) | ||
|
|
||
| # for idx, comp in enumerate(plot_df.index): | ||
| # plt.bar( | ||
| # scenarios, | ||
| # plot_df.loc[comp], | ||
| # bottom=bottom, | ||
| # color=colors[idx], | ||
| # label=comp | ||
| # ) | ||
| # bottom = [bottom[i] + plot_df.loc[comp][i] for i in range(len(scenarios))] | ||
|
|
||
| # plt.xlabel("Scenario") | ||
| # plt.ylabel("Cost ($/kg)") | ||
| # plt.title("Cost Breakdown per Scenario") | ||
|
|
||
| # # FORCE horizontal x-axis labels | ||
| # plt.xticks(rotation=0, ha="center") | ||
|
|
||
| # plt.legend() | ||
| # plt.tight_layout() | ||
|
|
||
| # plt.savefig("stacked_cost_breakdown_final.png", dpi=300) | ||
| # plt.show() | ||
|
|
||
| import textwrap | ||
|
|
||
| import numpy as np | ||
| import pandas as pd | ||
| import matplotlib.pyplot as plt | ||
|
|
||
|
|
||
| # ------------------------------------------------------------- | ||
| # LOAD EXCEL | ||
| # ------------------------------------------------------------- | ||
| file_path = "Breakdown_costs_per_scenario.xlsx" | ||
| df = pd.read_excel(file_path, sheet_name="Sheet1", header=None) | ||
|
|
||
| # ------------------------------------------------------------- | ||
| # READ STRUCTURE | ||
| # ------------------------------------------------------------- | ||
| scenario_row = df.iloc[0, 1:].tolist() | ||
| product_row = df.iloc[1, 1:].tolist() | ||
| components = df.iloc[2:, 0].astype(str).str.strip().tolist() | ||
| values = df.iloc[2:, 1:].astype(float) | ||
|
|
||
| # ------------------------------------------------------------- | ||
| # CLEAN NANS | ||
| # ------------------------------------------------------------- | ||
| valid = [i for i, s in enumerate(scenario_row) if str(s) != "nan"] | ||
| scenario_row = [scenario_row[i] for i in valid] | ||
| product_row = [product_row[i] for i in valid] | ||
| values = values.iloc[:, valid] | ||
|
|
||
| # ------------------------------------------------------------- | ||
| # MULTILINE SCENARIO LABELS (automatic wrapping) | ||
| # ------------------------------------------------------------- | ||
| scenario_row_wrapped = ["\n".join(textwrap.wrap(s, width=18)) for s in scenario_row] | ||
|
|
||
| # ------------------------------------------------------------- | ||
| # BUILD MULTIINDEX | ||
| # ------------------------------------------------------------- | ||
| tuples = list(zip(scenario_row_wrapped, product_row)) | ||
| df_plot = pd.DataFrame(values.values, index=components, columns=pd.MultiIndex.from_tuples(tuples)) | ||
|
|
||
| # ------------------------------------------------------------- | ||
| # FLATTENED PRODUCT LABELS | ||
| # ------------------------------------------------------------- | ||
| flat_products = product_row | ||
|
|
||
| # ------------------------------------------------------------- | ||
| # GROUP POSITIONS FOR SCENARIO LABELS | ||
| # ------------------------------------------------------------- | ||
| scenario_groups = {} | ||
| for idx, scen in enumerate(scenario_row_wrapped): | ||
| scenario_groups.setdefault(scen, []).append(idx) | ||
|
|
||
| x = np.arange(len(flat_products)) | ||
|
|
||
| # ------------------------------------------------------------- | ||
| # COLOR MAP | ||
| # ------------------------------------------------------------- | ||
| color_map = { | ||
| "CapEx ($/kg)": "navy", | ||
| "OpEx ($/kg)": "orange", | ||
| "Feedstock ($/kg)": "deepskyblue", | ||
| "Taxes ($/kg)": "lightpink", | ||
| "Finances ($/kg)": "yellowgreen", | ||
| } | ||
|
|
||
| # ------------------------------------------------------------- | ||
| # PLOT | ||
| # ------------------------------------------------------------- | ||
| plt.figure(figsize=(18, 7)) | ||
|
|
||
| bottom = np.zeros(len(x)) | ||
|
|
||
| for comp in components: | ||
| y = df_plot.loc[comp].values | ||
| plt.bar(x, y, bottom=bottom, color=color_map[comp], label=comp) | ||
| bottom += y | ||
|
|
||
| # ------------------------------------------------------------- | ||
| # X-AXIS LABELS (PRODUCT LEVEL) | ||
| # ------------------------------------------------------------- | ||
| plt.xticks(x, flat_products, rotation=0, ha="center") | ||
|
|
||
| # ------------------------------------------------------------- | ||
| # Y-AXIS LABEL | ||
| # ------------------------------------------------------------- | ||
| plt.ylabel("Levelized cost ($/kg)") | ||
|
|
||
| plt.title("Cost Breakdown by Product and Scenario") | ||
|
|
||
| # ------------------------------------------------------------- | ||
| # SCENARIO LABELS (CENTERED ABOVE GROUPS) | ||
| # ------------------------------------------------------------- | ||
| ymin, ymax = plt.ylim() | ||
| for scen, idxs in scenario_groups.items(): | ||
| center = np.mean(idxs) | ||
| plt.text( | ||
| center, ymax + ymax * 0.04, scen, ha="center", va="bottom", fontsize=11, fontweight="bold" | ||
| ) | ||
|
|
||
| plt.ylim(ymin, ymax * 1.25) | ||
|
|
||
| plt.legend(title="Cost Component", bbox_to_anchor=(1.02, 1), loc="upper left") | ||
| plt.tight_layout() | ||
| plt.show() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| name: driver_config | ||
| description: This analysis runs a paper mill plant and matches other examples in H2Integrate | ||
| general: | ||
| folder_output: outputs | ||
| recorder: | ||
| file: cases.sql | ||
| overwrite_recorder: true | ||
| flag: true | ||
| includes: ['*'] | ||
| excludes: ['*_resource*'] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It looks like this file depends on an Excel sheet, but this isn't included as part of this PR. Do you mean to add the sheet, or have a different script that produces it? Or maybe just remove this file entirely?
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.
Just removing it entirely would be fine. The excel was added to help me do the plots for the E2C NE MN project.