-
Notifications
You must be signed in to change notification settings - Fork 22
A-LEAF plugin #119
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
Merged
Merged
A-LEAF plugin #119
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
844b0b6
test case aleaf
JiaZhou-PU 14c8872
overlay to replace in pandas
JiaZhou-PU 5a59ab5
add prerun
JiaZhou-PU 68c4b18
Merge pull request #1 from watts-dev/development
JiaZhou-PU e237fb5
add docstring
JiaZhou-PU 13bc361
add plugin usage
JiaZhou-PU e542382
remove init typo
JiaZhou-PU 557cbe4
address comments
JiaZhou-PU 5e8ba3e
address comments from paul
JiaZhou-PU 03bea7e
add plugin generic
JiaZhou-PU cf586f1
remove juia dep
JiaZhou-PU f1b8178
Small edits from review
paulromano 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
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,19 @@ | ||
| Scenario FUEL Type Unit 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 | ||
| Reference Coal Real 2021 $/MMBtu 1.64 1.61 1.65 1.57 1.52 1.50 1.49 1.50 1.50 1.50 1.50 1.50 1.51 1.52 1.53 1.54 1.56 1.56 1.58 1.59 1.60 1.60 1.62 1.63 1.64 1.65 1.65 1.66 1.66 1.75 1.85 1.96 2.07 2.19 2.31 2.44 2.58 2.73 2.89 | ||
| Reference NG Real 2021 $/MMBtu 3.84 3.49 3.17 3.00 2.98 3.08 3.25 3.36 3.46 3.54 3.58 3.65 3.64 3.64 3.65 3.67 3.68 3.69 3.72 3.73 3.70 3.71 3.65 3.61 3.60 3.60 3.62 3.60 3.59 3.80 4.01 4.24 4.48 4.74 5.01 5.29 5.59 5.91 6.25 | ||
| Reference Petroleum Real 2021 $/MMBtu 12.18 10.50 11.39 11.61 11.89 12.20 12.46 12.58 12.82 13.08 13.27 13.42 13.54 13.67 13.86 14.03 14.20 14.26 14.55 14.70 14.75 15.00 15.28 15.36 15.58 15.65 15.62 15.65 15.59 16.48 17.42 18.41 19.46 20.57 21.74 22.98 24.29 25.68 27.14 | ||
| Reference Nuclear Real 2021 $/MMBtu 0.72 0.72 0.72 0.72 0.72 0.73 0.73 0.73 0.73 0.73 0.73 0.74 0.74 0.74 0.74 0.74 0.74 0.75 0.75 0.75 0.75 0.76 0.76 0.76 0.76 0.76 0.77 0.77 0.77 0.81 0.86 0.91 0.96 1.02 1.07 1.14 1.20 1.27 1.34 | ||
| Reference Biomass Real 2020 $/MMBTU 5.00 5.11 5.22 5.34 5.45 5.57 5.70 5.82 5.95 6.08 6.22 6.35 6.49 6.63 6.78 6.93 7.08 7.24 7.40 7.56 7.73 7.90 8.07 8.25 8.43 8.61 8.80 9.00 9.20 9.72 10.27 10.86 11.48 12.13 12.82 13.56 14.33 15.15 16.01 | ||
| Reference OGS Real 2020 $/MMBTU 3.84 3.49 3.17 3.00 2.98 3.08 3.25 3.36 3.46 3.54 3.58 3.65 3.64 3.64 3.65 3.67 3.68 3.69 3.72 3.73 3.70 3.71 3.65 3.61 3.60 3.60 3.62 3.60 3.59 3.80 4.01 4.24 4.48 4.74 5.01 5.29 5.59 5.91 6.25 | ||
| Base Coal Real 2020 $/MMBTU 1.57 1.54 1.57 1.50 1.45 1.43 1.43 1.43 1.43 1.44 1.43 1.43 1.44 1.45 1.46 1.47 1.49 1.49 1.51 1.52 1.52 1.53 1.54 1.56 1.56 1.57 1.57 1.58 1.58 1.67 1.77 1.87 1.98 2.09 2.21 2.33 2.47 2.61 2.76 | ||
| Base NG Real 2020 $/MMBTU 3.67 3.34 3.03 2.87 2.84 2.94 3.10 3.21 3.30 3.38 3.42 3.48 3.48 3.47 3.48 3.50 3.52 3.52 3.55 3.56 3.54 3.54 3.48 3.45 3.44 3.43 3.46 3.44 3.43 3.62 3.83 4.05 4.28 4.52 4.78 5.05 5.34 5.65 5.97 | ||
| Base Petroleum Real 2020 $/MMBTU 11.63 10.03 10.88 11.09 11.35 11.65 11.90 12.01 12.24 12.49 12.68 12.82 12.93 13.05 13.24 13.40 13.56 13.61 13.90 14.04 14.09 14.32 14.60 14.67 14.88 14.95 14.92 14.94 14.89 15.74 16.63 17.58 18.58 19.64 20.76 21.95 23.20 24.52 25.92 | ||
| Base Nuclear Real 2020 $/MMBTU {% for year, price in fuel_price.items() %}{{ price }}{% if not loop.last %} {% endif %}{% endfor %} | ||
| Base Biomass Real 2020 $/MMBTU 5.00 5.11 5.22 5.34 5.45 5.57 5.70 5.82 5.95 6.08 6.22 6.35 6.49 6.63 6.78 6.93 7.08 7.24 7.40 7.56 7.73 7.90 8.07 8.25 8.43 8.61 8.80 9.00 9.20 9.72 10.27 10.86 11.48 12.13 12.82 13.56 14.33 15.15 16.01 | ||
| Base OGS Real 2020 $/MMBTU 3.67 3.34 3.03 2.87 2.84 2.94 3.10 3.21 3.30 3.38 3.42 3.48 3.48 3.47 3.48 3.50 3.52 3.52 3.55 3.56 3.54 3.54 3.48 3.45 3.44 3.43 3.46 3.44 3.43 3.62 3.83 4.05 4.28 4.52 4.78 5.05 5.34 5.65 5.97 | ||
| Low Coal Real 2020 $/MMBTU 1.41 1.38 1.42 1.35 1.31 1.29 1.28 1.29 1.29 1.29 1.29 1.29 1.30 1.30 1.32 1.33 1.34 1.34 1.36 1.37 1.37 1.38 1.39 1.40 1.41 1.42 1.41 1.42 1.43 1.51 1.59 1.68 1.78 1.88 1.99 2.10 2.22 2.35 2.48 | ||
| Low NG Real 2020 $/MMBTU 3.30 3.00 2.73 2.58 2.56 2.64 2.79 2.89 2.97 3.05 3.07 3.13 3.13 3.13 3.14 3.15 3.17 3.17 3.20 3.20 3.18 3.19 3.13 3.11 3.10 3.09 3.11 3.09 3.09 3.26 3.45 3.64 3.85 4.07 4.30 4.55 4.81 5.08 5.37 | ||
| Low Petroleum Real 2020 $/MMBTU 10.46 9.03 9.79 9.98 10.22 10.48 10.71 10.81 11.02 11.24 11.41 11.53 11.64 11.75 11.91 12.06 12.21 12.25 12.51 12.63 12.68 12.89 13.14 13.21 13.39 13.45 13.43 13.45 13.40 14.16 14.97 15.82 16.73 17.68 18.69 19.75 20.88 22.07 23.33 | ||
| Low Nuclear Real 2020 $/MMBTU 0.62 0.62 0.62 0.62 0.62 0.62 0.62 0.63 0.63 0.63 0.63 0.63 0.63 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 0.41 1.03 1.09 1.15 | ||
| Low Biomass Real 2020 $/MMBTU 4.50 4.60 4.70 4.80 4.91 5.02 5.13 5.24 5.36 5.47 5.59 5.72 5.84 5.97 6.10 6.24 6.37 6.51 6.66 6.80 6.95 7.11 7.26 7.42 7.59 7.75 7.92 8.10 8.28 8.75 9.25 9.77 10.33 10.92 11.54 12.20 12.90 13.63 14.41 | ||
| Low OGS Real 2020 $/MMBTU 3.30 3.00 2.73 2.58 2.56 2.64 2.79 2.89 2.97 3.05 3.07 3.13 3.13 3.13 3.14 3.15 3.17 3.17 3.20 3.20 3.18 3.19 3.13 3.11 3.10 3.09 3.11 3.09 3.09 3.26 3.45 3.64 3.85 4.07 4.30 4.55 4.81 5.08 5.37 |
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,21 @@ | ||
| # 1App_ALEAF_LCGTEP | ||
|
|
||
| ## Purpose | ||
|
|
||
| This example provides a demonstration for using WATTS to run and analyze simulations with A-LEAF (Argonne Low-carbon Electricity Analysis Framework) under various supply chain disruption scenarios. The example explores different fuel price settings to understand the impact on US nuclear capacity expansion result. | ||
|
|
||
|
|
||
| ## Code(s) | ||
|
|
||
| - A-LEAF | ||
|
|
||
| ## Keywords | ||
|
|
||
| - Energy Market | ||
| - Capacity Expansion | ||
| - Economic Modeling | ||
|
|
||
| ## File descriptions | ||
|
|
||
| - [__watts_exec.py__](watts_exec.py): WATTS workflow for this example. This is the file to execute to run the problem described above. | ||
| - [__A-LEAF_fuel_template__](Fuel.txt): Fuel price for this example |
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,67 @@ | ||
| # SPDX-FileCopyrightText: 2022-2025 UChicago Argonne, LLC | ||
| # SPDX-License-Identifier: MIT | ||
|
|
||
| """ | ||
| This example demonstrates how to use WATTS to run an A-LEAF calculation. | ||
| """ | ||
|
|
||
| import watts | ||
| from pathlib import Path | ||
| import pandas as pd | ||
|
|
||
| params = watts.Parameters() | ||
|
|
||
|
|
||
| fuel_price = { | ||
| 2022: 0.62, 2023: 0.62, 2024: 0.62, 2025: 0.62, 2026: 0.62, 2027: 0.62, | ||
| 2028: 0.63, 2029: 0.63, 2030: 0.63, 2031: 0.76, 2032: 0.76, 2033: 0.76, | ||
| 2034: 0.76, 2035: 0.76, 2036: 0.77, 2037: 0.77, 2038: 0.77, 2039: 0.77, | ||
| 2040: 0.77, 2041: 0.78, 2042: 0.78, 2043: 0.78, 2044: 0.78, 2045: 0.78, | ||
| 2046: 0.79, 2047: 0.79, 2048: 0.79, 2049: 0.79, 2050: 0.79, 2051: 0.80, | ||
| 2052: 0.80, 2053: 0.80, 2054: 0.80, 2055: 0.80, 2056: 0.81, 2057: 0.81, | ||
| 2058: 0.81, 2059: 0.81, 2060: 0.81 | ||
| } | ||
|
|
||
|
|
||
| # Set nuclear prices from reference and calculated growth | ||
| starting_year = 2031 | ||
| starting_price = 0.76 | ||
|
|
||
| # Compute prices dynamically for years after the starting year | ||
| growth_rates = {year: 1.0028 if year <= 2050 else 1.057 for year in range(starting_year + 1, 2061)} | ||
| computed_prices = {starting_year: starting_price} | ||
| for year in range(starting_year + 1, 2061): | ||
| prev_price = computed_prices[year - 1] | ||
| computed_prices[year] = round(prev_price * growth_rates[year], 3) | ||
|
|
||
| fuel_price.update(computed_prices) | ||
|
|
||
| # Initialize parameters and pass the fuel price dictionary | ||
| params = watts.Parameters() | ||
| params['fuel_price'] = fuel_price | ||
| # Display parameter summary | ||
| params.show_summary(show_metadata=True, sort_by='key') | ||
|
|
||
| # Set default path for results | ||
| results_path = Path.cwd() / 'results' | ||
| results_path.mkdir(exist_ok=True, parents=True) | ||
| watts.Database.set_default_path(results_path) | ||
|
|
||
| # Create ALEAF plugin | ||
| # aleaf_plugin = watts.PluginALEAF('Fuel.txt', extra_templates={'Simulation Configuration': 'Simulation Configuration.txt'}) | ||
| aleaf_plugin = watts.PluginALEAF('Fuel.txt') | ||
| # Run ALEAF | ||
| aleaf_result = aleaf_plugin(params) | ||
| print('ALEAF simulation completed.') | ||
|
|
||
| # Get the technology summary | ||
| techsummary = aleaf_result.csv_data | ||
| # keep only the capacity columns | ||
| techsummary = techsummary[['Year', 'UnitGroup', 'Unit_Type', 'Fuel', 'ICAP', 'ICap_New', 'ICap_Ret']] | ||
|
|
||
| # group the technology summary by year and fuel | ||
| grouped_df = techsummary.groupby(['Year','Fuel']).sum() | ||
| # print out the grouped dataframe | ||
| print(grouped_df) | ||
|
|
||
|
|
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
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.
Uh oh!
There was an error while loading. Please reload this page.