Skip to content

Commit c9d012b

Browse files
test_contingency
1 parent bc86612 commit c9d012b

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

tests/test_geophires_x.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,3 +1092,70 @@ def wellfield_cost(result_cap_costs):
10921092
# Note this is not necessarily true for all cases, but generally would be expected,
10931093
# and is true for Fervo_Project_Cape-4 specifically.
10941094
)
1095+
1096+
def test_contingency(self):
1097+
def _get_result(
1098+
contingency_percentage: Optional[int] = None,
1099+
input_file_path: str = 'geophires_x_tests/generic-egs-case.txt',
1100+
) -> float:
1101+
p = {}
1102+
1103+
if contingency_percentage is not None:
1104+
p['Contingency Percentage'] = contingency_percentage
1105+
1106+
return (
1107+
GeophiresXClient()
1108+
.get_geophires_result(
1109+
ImmutableGeophiresInputParameters(
1110+
from_file_path=self._get_test_file_path(input_file_path),
1111+
params=p,
1112+
)
1113+
)
1114+
.result['CAPITAL COSTS (M$)']
1115+
)
1116+
1117+
def capex(result_cap_costs):
1118+
if result_cap_costs.get('Total CAPEX') is not None:
1119+
return result_cap_costs['Total CAPEX']['value']
1120+
1121+
return result_cap_costs['Total capital costs']['value']
1122+
1123+
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+
)
1131+
1132+
for higher_contingency in range(20, 30, 5):
1133+
assert higher_contingency > default_contingency_percent # test assumption check
1134+
result_higher_contingency = _get_result(contingency_percentage=higher_contingency)
1135+
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',
1154+
]:
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+
)

0 commit comments

Comments
 (0)