Skip to content

Commit 490b9d8

Browse files
WIP stash - adjust econ capex/opex with add-ons
1 parent eb9899b commit 490b9d8

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

src/geophires_x/EconomicsAddOns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def Calculate(self, model: Model) -> None:
307307

308308
if is_sam_em:
309309
model.economics.CCap.value = self.AdjustedProjectCAPEX.value
310-
model.economics.Coam.value = self.AdjustedProjectOPEX.value
310+
model.economics.Coam.value = self.AdjustedProjectOPEX.value - np.sum(self.AddOnProfitGainedPerYear.value)
311311
# FIXME WIP
312312

313313
AddOnCapCostPerYear = self.AddOnCAPEXTotal.value / model.surfaceplant.construction_years.value

tests/geophires_x_tests/egs-sam-em-add-ons.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ Production Flow Rate per Well, 80
6262
# AddOns
6363
Do AddOn Calculations, True
6464
AddOn Nickname 1, Desalinization
65-
AddOn CAPEX 1, 10
66-
AddOn OPEX 1, 10
67-
AddOn Electricity Gained 1, -100
68-
AddOn Heat Gained 1, 0.0
69-
AddOn Profit Gained 1, 0.05
65+
AddOn CAPEX 1, 562
66+
AddOn OPEX 1, 0.1
67+
AddOn Profit Gained 1, 107

tests/geophires_x_tests/test_economics_sam.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,10 +574,26 @@ def _accrued_financing(_r: GeophiresXResult) -> float:
574574

575575
def test_add_ons(self):
576576
add_ons_result = self._get_result({}, file_path=self._get_test_file_path('egs-sam-em-add-ons.txt'))
577+
no_add_ons_result = self._get_result(
578+
{'Do AddOn Calculations': False}, file_path=self._get_test_file_path('egs-sam-em-add-ons.txt')
579+
)
577580
self.assertIsNotNone(add_ons_result)
578581

579582
with open(add_ons_result.output_file_path, encoding='utf-8') as f:
583+
print('With Add-Ons:\n')
584+
print(f.read())
585+
print('\n------------\n')
586+
587+
with open(no_add_ons_result.output_file_path, encoding='utf-8') as f:
588+
print('Without Add-Ons:\n')
580589
print(f.read())
590+
print('\n------------\n')
591+
592+
# FIXME WIP
593+
self.assertLess(
594+
no_add_ons_result.result['SUMMARY OF RESULTS']['Total CAPEX']['value'],
595+
add_ons_result.result['SUMMARY OF RESULTS']['Total CAPEX']['value'],
596+
)
581597

582598
@staticmethod
583599
def _new_model(input_file: Path, additional_params: dict[str, Any] | None = None, read_and_calculate=True) -> Model:

0 commit comments

Comments
 (0)