Skip to content

Commit

Permalink
Fix availability derate bug with iterations (#1158)
Browse files Browse the repository at this point in the history
  • Loading branch information
anamileva authored Sep 25, 2024
1 parent ab3df86 commit c4f7d6b
Show file tree
Hide file tree
Showing 16 changed files with 499 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
--> Energy Production <--
Annual Energy (MWh) % Total Power
load_zone period technology
Zone1 2026 Batteries -76.25 -0.02
Gas 160,664.36 51.13
Hybrid_Solar 1,239.36 0.39
Hydro 65,867.85 20.96
Solar 32,823.58 10.45
Wind 53,712.83 17.09
Zone1 2026 Batteries -120.82 -0.04
Gas 145,824.76 48.37
Hybrid_Solar 3,356.50 1.11
Hydro 65,867.85 21.85
Solar 32,823.58 10.89
Wind 53,712.83 17.82
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
--> Energy Production <--
Annual Energy (MWh) % Total Power
load_zone period technology
Zone1 2026 Batteries -75.32 -0.02
Gas 160,307.74 50.08
Hybrid_Solar 2,274.81 0.71
Hydro 65,867.85 20.58
Solar 35,386.91 11.05
Wind 56,339.03 17.60
Zone1 2026 Batteries -149.50 -0.05
Gas 144,792.98 47.28
Hybrid_Solar 4,035.70 1.32
Hydro 65,867.85 21.51
Solar 35,386.91 11.55
Wind 56,339.03 18.40
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
--> Energy Production <--
Annual Energy (MWh) % Total Power
load_zone period technology
Zone1 2026 Batteries -53.62 -0.02
Gas 156,136.49 44.73
Hybrid_Solar 369.43 0.11
Hydro 97,045.58 27.80
Solar 35,691.85 10.23
Wind 59,865.29 17.15
Zone1 2026 Batteries -85.41 -0.03
Gas 140,127.27 41.97
Hybrid_Solar 1,191.10 0.36
Hydro 97,045.58 29.07
Solar 35,691.85 10.69
Wind 59,865.29 17.93
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
--> Energy Production <--
Annual Energy (MWh) % Total Power
load_zone period technology
Zone1 2026 Batteries -42.97 -0.01
Gas 155,551.95 42.56
Hybrid_Solar 187.98 0.05
Hydro 97,045.58 26.55
Solar 36,295.00 9.93
Wind 76,452.35 20.92
Zone1 2026 Batteries -22.01 -0.01
Gas 137,962.74 39.58
Hybrid_Solar 819.17 0.24
Hydro 97,045.58 27.84
Solar 36,295.00 10.41
Wind 76,452.35 21.93
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
--> Energy Production <--
Annual Energy (MWh) % Total Power
load_zone period technology
Zone1 2026 Batteries -96.06 -0.03
Gas 160,215.62 49.87
Hybrid_Solar 2,647.58 0.82
Hydro 65,867.85 20.50
Solar 35,138.66 10.94
Wind 57,510.50 17.90
Zone1 2026 Batteries -68.11 -0.02
Gas 143,995.32 46.81
Hybrid_Solar 5,181.36 1.68
Hydro 65,867.85 21.41
Solar 35,138.66 11.42
Wind 57,510.50 18.69
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
--> Energy Production <--
Annual Energy (MWh) % Total Power
load_zone period technology
Zone1 2026 Batteries -98.12 -0.03
Gas 160,422.41 50.37
Hybrid_Solar 1,431.74 0.45
Hydro 65,867.85 20.68
Solar 36,240.81 11.38
Wind 54,609.64 17.15
Zone1 2026 Batteries -93.83 -0.03
Gas 144,203.40 47.36
Hybrid_Solar 3,663.68 1.20
Hydro 65,867.85 21.63
Solar 36,240.81 11.90
Wind 54,609.64 17.93
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
--> Energy Production <--
Annual Energy (MWh) % Total Power
load_zone period technology
Zone1 2026 Batteries -79.19 -0.02
Gas 156,586.78 45.08
Hybrid_Solar 1,175.53 0.34
Hydro 97,045.58 27.94
Solar 35,138.66 10.12
Wind 57,510.50 16.56
Zone1 2026 Batteries -104.11 -0.03
Gas 140,466.86 42.26
Hybrid_Solar 2,304.47 0.69
Hydro 97,045.58 29.20
Solar 35,138.66 10.57
Wind 57,510.50 17.30
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
--> Energy Production <--
Annual Energy (MWh) % Total Power
load_zone period technology
Zone1 2026 Batteries -74.51 -0.02
Gas 156,987.49 45.47
Hybrid_Solar 466.73 0.14
Hydro 97,045.58 28.11
Solar 36,240.81 10.50
Wind 54,609.64 15.82
Zone1 2026 Batteries -101.14 -0.03
Gas 140,345.28 42.61
Hybrid_Solar 1,260.69 0.38
Hydro 97,045.58 29.46
Solar 36,240.81 11.00
Wind 54,609.64 16.58
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
--> Energy Production <--
Annual Energy (MWh) % Total Power
load_zone period technology
Zone1 2026 Batteries -77.06 -0.02
Gas 158,300.19 47.46
Hybrid_Solar 523.53 0.16
Hydro 65,867.85 19.75
Solar 34,835.95 10.44
Wind 74,097.91 22.22
Zone1 2026 Batteries -66.47 -0.02
Gas 142,804.93 44.78
Hybrid_Solar 1,331.88 0.42
Hydro 65,867.85 20.66
Solar 34,835.95 10.92
Wind 74,097.91 23.24
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
--> Energy Production <--
Annual Energy (MWh) % Total Power
load_zone period technology
Zone1 2026 Batteries -99.08 -0.03
Gas 160,181.64 49.47
Hybrid_Solar 2,404.48 0.74
Hydro 65,867.85 20.34
Solar 36,873.78 11.39
Wind 58,534.70 18.08
Zone1 2026 Batteries -322.84 -0.10
Gas 144,672.54 46.73
Hybrid_Solar 3,949.82 1.28
Hydro 65,867.85 21.28
Solar 36,873.78 11.91
Wind 58,534.70 18.91
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
--> Energy Production <--
Annual Energy (MWh) % Total Power
load_zone period technology
Zone1 2026 Batteries -34.07 -0.01
Gas 155,971.96 43.08
Hybrid_Solar 102.65 0.03
Hydro 97,045.58 26.81
Solar 34,835.95 9.62
Wind 74,097.91 20.47
Zone1 2026 Batteries -63.77 -0.02
Gas 139,067.94 40.26
Hybrid_Solar 474.62 0.14
Hydro 97,045.58 28.09
Solar 34,835.95 10.08
Wind 74,097.91 21.45
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
--> Energy Production <--
Annual Energy (MWh) % Total Power
load_zone period technology
Zone1 2026 Batteries -78.45 -0.02
Gas 156,918.43 44.85
Hybrid_Solar 618.43 0.18
Hydro 97,045.58 27.73
Solar 36,873.78 10.54
Wind 58,534.70 16.73
Zone1 2026 Batteries -99.60 -0.03
Gas 140,623.92 41.97
Hybrid_Solar 2,081.80 0.62
Hydro 97,045.58 28.96
Solar 36,873.78 11.01
Wind 58,534.70 17.47
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2023 Blue Marble Analytics LLC.
# Copyright 2016-2024 Blue Marble Analytics LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -186,6 +186,9 @@ def load_model_data(
# project_availability_exogenous_x.tab, but use the default instead
availability_independent_file = os.path.join(
scenario_directory,
weather_iteration,
hydro_iteration,
availability_iteration,
subproblem,
stage,
"inputs",
Expand All @@ -203,6 +206,9 @@ def load_model_data(

availability_weather_file = os.path.join(
scenario_directory,
weather_iteration,
hydro_iteration,
availability_iteration,
subproblem,
stage,
"inputs",
Expand Down
33 changes: 33 additions & 0 deletions tests/project/availability/availability_types/test_exogenous.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,39 @@ def test_data_loaded_correctly(self):

self.assertDictEqual(expected_availability_derate, actual_availability_derate)

# Param: availability_derate_weather
availability_df_w = pd.read_csv(
os.path.join(
TEST_DATA_DIRECTORY,
"inputs",
"project_availability_exogenous_weather.tab",
),
sep="\t",
)
defaults = {(p, tmp): 1 for (p, tmp) in instance.AVL_EXOG_OPR_TMPS}
derates = {
(p, tmp): avail
for p, tmp, avail in zip(
availability_df_w.project,
availability_df_w.timepoint,
availability_df_w.availability_derate_weather,
)
}
expected_availability_derate_w = dict()
for p, tmp in defaults.keys():
if (p, tmp) in derates.keys():
expected_availability_derate_w[p, tmp] = derates[p, tmp]
else:
expected_availability_derate_w[p, tmp] = defaults[p, tmp]
actual_availability_derate_w = {
(prj, tmp): instance.avl_exog_cap_derate_weather[prj, tmp]
for (prj, tmp) in instance.AVL_EXOG_OPR_TMPS
}

self.assertDictEqual(
expected_availability_derate_w, actual_availability_derate_w
)


if __name__ == "__main__":
unittest.main()
Loading

0 comments on commit c4f7d6b

Please sign in to comment.