Skip to content

Commit dc3fa78

Browse files
extend contingency test to cover heat pump & absorption chiller
1 parent 31be83b commit dc3fa78

File tree

1 file changed

+55
-33
lines changed

1 file changed

+55
-33
lines changed

tests/test_geophires_x.py

Lines changed: 55 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,41 +1121,63 @@ def capex(result_cap_costs):
11211121
return result_cap_costs['Total capital costs']['value']
11221122

11231123
default_contingency_percent = 15
1124-
result_default = _get_result()
1125-
1126-
self.assertEqual(
1127-
# Test assumption check, update default_contingency_percent if GEOPHIRES default value is changed
1128-
capex(result_default),
1129-
capex(_get_result(contingency_percentage=default_contingency_percent)),
1130-
)
11311124

11321125
for higher_contingency in range(20, 35, 5):
11331126
assert higher_contingency > default_contingency_percent # test assumption check
1134-
result_higher_contingency = _get_result(contingency_percentage=higher_contingency)
11351127

1136-
self.assertGreater(
1137-
capex(result_higher_contingency),
1138-
capex(result_default),
1139-
)
1140-
self.assertEqual(
1141-
# Contingency is not applied to drilling costs
1142-
result_default['Drilling and completion costs']['value'],
1143-
result_higher_contingency['Drilling and completion costs']['value'],
1144-
)
1145-
1146-
default_contingency_factor = 1.0 - (default_contingency_percent / 100.0)
1147-
higher_contingency_factor = 1 + (higher_contingency / 100.0)
1148-
for cost_category in [
1149-
'Stimulation costs',
1150-
'Surface power plant costs',
1151-
'Field gathering system costs',
1152-
'Total surface equipment costs',
1153-
'Exploration costs',
1128+
for input_file_path_ in [
1129+
'geophires_x_tests/generic-egs-case.txt',
1130+
'examples/example10_HP.txt',
1131+
'examples/example11_AC.txt',
11541132
]:
1155-
self.assertAlmostEqualWithinPercentage(
1156-
result_default[cost_category]['value'] * default_contingency_factor * higher_contingency_factor,
1157-
result_higher_contingency[cost_category]['value'],
1158-
percent=min( # Rounding throws off by a few percent
1159-
2.5, (higher_contingency - default_contingency_percent) / 2.0
1160-
),
1161-
)
1133+
with self.subTest(msg=f'higher_contingency={higher_contingency}, input_file_path={input_file_path_}'):
1134+
result_default = _get_result(input_file_path=input_file_path_)
1135+
1136+
self.assertEqual(
1137+
# Test assumption check, update default_contingency_percent
1138+
# if GEOPHIRES default value is changed.
1139+
capex(result_default),
1140+
capex(
1141+
_get_result(
1142+
contingency_percentage=default_contingency_percent,
1143+
input_file_path=input_file_path_,
1144+
)
1145+
),
1146+
)
1147+
1148+
result_higher_contingency = _get_result(
1149+
contingency_percentage=higher_contingency, input_file_path=input_file_path_
1150+
)
1151+
1152+
self.assertGreater(
1153+
capex(result_higher_contingency),
1154+
capex(result_default),
1155+
)
1156+
self.assertEqual(
1157+
# Contingency is not applied to drilling costs
1158+
result_default['Drilling and completion costs']['value'],
1159+
result_higher_contingency['Drilling and completion costs']['value'],
1160+
)
1161+
1162+
default_contingency_factor = 1.0 - (default_contingency_percent / 100.0)
1163+
higher_contingency_factor = 1 + (higher_contingency / 100.0)
1164+
for cost_category in [
1165+
'Stimulation costs',
1166+
'Surface power plant costs',
1167+
'Field gathering system costs',
1168+
'Total surface equipment costs',
1169+
'Exploration costs',
1170+
]:
1171+
expected = (
1172+
result_default[cost_category]['value']
1173+
* default_contingency_factor
1174+
* higher_contingency_factor
1175+
)
1176+
1177+
self.assertAlmostEqualWithinPercentage(
1178+
expected,
1179+
result_higher_contingency[cost_category]['value'],
1180+
percent=min( # Rounding throws off by a few percent
1181+
4.5, (higher_contingency - default_contingency_percent) / 2.0
1182+
),
1183+
)

0 commit comments

Comments
 (0)