From 0e64e4ee0827d980f558b9b551c3f5c91d4fdcb1 Mon Sep 17 00:00:00 2001 From: Daniel Olsen Date: Mon, 8 Feb 2021 12:33:49 -0800 Subject: [PATCH 1/3] test: add test for nuclear cost calculation --- .../design/investment/tests/test_investment_costs.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/powersimdata/design/investment/tests/test_investment_costs.py b/powersimdata/design/investment/tests/test_investment_costs.py index 2b8f3d46c..b2991ecc3 100644 --- a/powersimdata/design/investment/tests/test_investment_costs.py +++ b/powersimdata/design/investment/tests/test_investment_costs.py @@ -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"] @@ -120,6 +120,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()} From 305d3674e18a9d0f3af80294d5162862680fc8d5 Mon Sep 17 00:00:00 2001 From: Daniel Olsen Date: Mon, 8 Feb 2021 12:34:13 -0800 Subject: [PATCH 2/3] data: update gen investment consts to include nuclear --- powersimdata/design/investment/const.py | 1 + 1 file changed, 1 insertion(+) diff --git a/powersimdata/design/investment/const.py b/powersimdata/design/investment/const.py index a16484291..b878597b7 100644 --- a/powersimdata/design/investment/const.py +++ b/powersimdata/design/investment/const.py @@ -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 } regional_multiplier_gen_translation = { From a791c4ccf04419c54deedfd7c99fbe54bdc89a39 Mon Sep 17 00:00:00 2001 From: Daniel Olsen Date: Mon, 8 Feb 2021 12:38:32 -0800 Subject: [PATCH 3/3] doc: add/reorganize test comments for readability --- .../design/investment/tests/test_investment_costs.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/powersimdata/design/investment/tests/test_investment_costs.py b/powersimdata/design/investment/tests/test_investment_costs.py index b2991ecc3..223768e04 100644 --- a/powersimdata/design/investment/tests/test_investment_costs.py +++ b/powersimdata/design/investment/tests/test_investment_costs.py @@ -97,11 +97,12 @@ 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) @@ -109,6 +110,7 @@ def test_calculate_dc_inv_costs(mock_grid): 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,