-
Notifications
You must be signed in to change notification settings - Fork 40
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
fix: calculate investment cost for nuclear generators #391
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 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 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 |
---|---|---|
|
@@ -39,10 +39,10 @@ | |
] | ||
|
||
mock_plant = { | ||
"plant_id": ["A", "B", "C", "D", "E", "F", "G"], | ||
"bus_id": [2010228, 2010228, 2021106, 2010319, 2010319, 2010319, 2010320], | ||
"type": ["solar", "coal", "wind", "solar", "solar", "ng", "wind"], | ||
"Pmax": [15, 30, 10, 12, 8, 20, 15], | ||
"plant_id": ["A", "B", "C", "D", "E", "F", "G", "H"], | ||
"bus_id": [2010228, 2010228, 2021106, 2010319, 2010319, 2010319, 2010320, 2021106], | ||
"type": ["solar", "coal", "wind", "solar", "solar", "ng", "wind", "nuclear"], | ||
"Pmax": [15, 30, 10, 12, 8, 20, 15, 1000], | ||
} | ||
mock_plant["lat"] = [ | ||
mock_bus["lat"][mock_bus["bus_id"].index(bus)] for bus in mock_plant["bus_id"] | ||
|
@@ -97,18 +97,20 @@ def test_calculate_ac_inv_costs(mock_grid): | |
|
||
|
||
def test_calculate_dc_inv_costs(mock_grid): | ||
expected_dc_cost = 10 * 679.1799258421203 * 457.1428571 * calculate_inflation( | ||
2015 | ||
) + 135e3 * 10 * 2 * calculate_inflation( # lines | ||
2020 | ||
) # terminals | ||
expected_dc_cost = ( | ||
# lines | ||
10 * 679.1799258421203 * 457.1428571 * calculate_inflation(2015) | ||
# terminals | ||
+ 135e3 * 10 * 2 * calculate_inflation(2020) | ||
) | ||
dc_cost = _calculate_dc_inv_costs(mock_grid) | ||
assert dc_cost == pytest.approx(expected_dc_cost) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are no changes here. Just reorganizing the lines, correct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct. |
||
|
||
|
||
def test_calculate_gen_inv_costs_2030(mock_grid): | ||
gen_inv_cost = _calculate_gen_inv_costs(mock_grid, 2030, "Moderate").to_dict() | ||
expected_gen_inv_cost = { | ||
# for each: capacity (kW) * regional multiplier * base technology cost | ||
"solar": sum( | ||
[ | ||
15e3 * 1.01701 * 836.3842785, | ||
|
@@ -120,6 +122,7 @@ def test_calculate_gen_inv_costs_2030(mock_grid): | |
"wind": 10e3 * 1.16979 * 1297.964758 + 15e3 * 1.04348 * 1297.964758, | ||
"ng": 20e3 * 1.050755 * 983.2351768, | ||
"storage": 100e3 * 1.012360 * 817 + 200e3 * 1.043730 * 817, | ||
"nuclear": 1000e3 * 1.07252 * 6727.799801, | ||
} | ||
inflation = calculate_inflation(2018) | ||
expected_gen_inv_cost = {k: v * inflation for k, v in expected_gen_inv_cost.items()} | ||
|
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.
That is a pretty bad choice for accessing nuclear information.
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.
To be clear, this is not wildcard matching. The CSV file literally has an entry
*
.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.
Yeah, it is terrible. I guess there is a documentation but anything else could be more explanatory.
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.
There is definitely room for improvement. Currently, we're somewhat-arbitrarily selecting one
TechDetail
to consider for each technology, hard-coded. It would be nice to give the user more flexibility to select different ones, when they are available, or maybe even to define their own.