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

fix: calculate investment cost for nuclear generators #391

Merged
merged 3 commits into from
Feb 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions powersimdata/design/investment/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"LTRG1", # Single tech for wind
"4Hr Battery Storage", # Single tech for storage
"Seattle", # Single tech for solar
"*", # Single tech for nuclear
Copy link
Collaborator

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.

Copy link
Contributor Author

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 *.

Copy link
Collaborator

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.

Copy link
Contributor Author

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.

}

regional_multiplier_gen_translation = {
Expand Down
21 changes: 12 additions & 9 deletions powersimdata/design/investment/tests/test_investment_costs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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)
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are no changes here. Just reorganizing the lines, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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,
Expand All @@ -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()}
Expand Down