@@ -1122,15 +1122,16 @@ def capex(result_cap_costs):
1122
1122
1123
1123
default_contingency_percent = 15
1124
1124
1125
- for higher_contingency in range (20 , 35 , 5 ):
1126
- assert higher_contingency > default_contingency_percent # test assumption check
1125
+ for contingency_percent in range (5 , 35 , 5 ):
1126
+ if contingency_percent == default_contingency_percent :
1127
+ continue
1127
1128
1128
1129
for input_file_path_ in [
1129
1130
'geophires_x_tests/generic-egs-case.txt' ,
1130
1131
'examples/example10_HP.txt' ,
1131
1132
'examples/example11_AC.txt' ,
1132
1133
]:
1133
- with self .subTest (msg = f'higher_contingency= { higher_contingency } , input_file_path={ input_file_path_ } ' ):
1134
+ with self .subTest (msg = f'contingency= { contingency_percent } , input_file_path={ input_file_path_ } ' ):
1134
1135
result_default = _get_result (input_file_path = input_file_path_ )
1135
1136
1136
1137
self .assertEqual (
@@ -1145,39 +1146,54 @@ def capex(result_cap_costs):
1145
1146
),
1146
1147
)
1147
1148
1148
- result_higher_contingency = _get_result (
1149
- contingency_percentage = higher_contingency , input_file_path = input_file_path_
1149
+ result_different_contingency = _get_result (
1150
+ contingency_percentage = contingency_percent , input_file_path = input_file_path_
1150
1151
)
1151
1152
1152
- self .assertGreater (
1153
- capex (result_higher_contingency ),
1154
- capex (result_default ),
1155
- )
1153
+ if contingency_percent > default_contingency_percent :
1154
+ self .assertGreater (
1155
+ capex (result_different_contingency ),
1156
+ capex (result_default ),
1157
+ )
1158
+ else :
1159
+ self .assertLess (
1160
+ capex (result_different_contingency ),
1161
+ capex (result_default ),
1162
+ )
1163
+
1156
1164
self .assertEqual (
1157
1165
# Contingency is not applied to drilling costs
1158
1166
result_default ['Drilling and completion costs' ]['value' ],
1159
- result_higher_contingency ['Drilling and completion costs' ]['value' ],
1167
+ result_different_contingency ['Drilling and completion costs' ]['value' ],
1160
1168
)
1161
1169
1162
- default_contingency_factor = 1.0 - (default_contingency_percent / 100.0 )
1163
- higher_contingency_factor = 1 + (higher_contingency / 100.0 )
1164
1170
for cost_category in [
1165
1171
'Stimulation costs' ,
1166
1172
'Surface power plant costs' ,
1167
1173
'Field gathering system costs' ,
1168
1174
'Total surface equipment costs' ,
1169
1175
'Exploration costs' ,
1170
1176
]:
1177
+ default_contingency_factor = 1.0 + (default_contingency_percent / 100.0 )
1178
+ different_contingency_factor = 1.0 + (contingency_percent / 100.0 )
1179
+
1171
1180
expected = (
1172
1181
result_default [cost_category ]['value' ]
1173
- * default_contingency_factor
1174
- * higher_contingency_factor
1182
+ / default_contingency_factor
1183
+ * different_contingency_factor
1184
+ )
1185
+
1186
+ actual = result_different_contingency [cost_category ]['value' ]
1187
+
1188
+ # Rounding throws off by a few percent
1189
+ max_allowed_delta_percent = max (
1190
+ # TODO to audit more thoroughly and avoid usage of these tuned constants
1191
+ 2.5 if contingency_percent > default_contingency_percent else 5.4 ,
1192
+ (contingency_percent - default_contingency_percent ) / 2.0 ,
1175
1193
)
1176
1194
1177
1195
self .assertAlmostEqualWithinPercentage (
1178
1196
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
- ),
1197
+ actual ,
1198
+ percent = max_allowed_delta_percent ,
1183
1199
)
0 commit comments