21
21
_ppa_pricing_model ,
22
22
_get_fed_and_state_tax_rates ,
23
23
)
24
- from geophires_x .GeoPHIRESUtils import sig_figs
24
+ from geophires_x .GeoPHIRESUtils import sig_figs , quantity
25
25
26
26
# noinspection PyProtectedMember
27
27
from geophires_x .EconomicsSamCashFlow import _clean_profile , _is_category_row_label , _is_designator_row_label
@@ -559,7 +559,8 @@ def _accrued_financing(_r: GeophiresXResult) -> float:
559
559
# 'Inflation Rate': 0.04769,
560
560
# }
561
561
# r3: GeophiresXResult = self._get_result(
562
- # params3, file_path=self._get_test_file_path('generic-egs-case-3_no-inflation-rate-during-construction.txt')
562
+ # params3,
563
+ # file_path=self._get_test_file_path('generic-egs-case-3_no-inflation-rate-during-construction.txt')
563
564
# )
564
565
# self.assertEqual(15.0, _accrued_financing(r3))
565
566
#
@@ -568,18 +569,22 @@ def _accrued_financing(_r: GeophiresXResult) -> float:
568
569
# 'Inflation Rate During Construction': 0.15,
569
570
# }
570
571
# r4: GeophiresXResult = self._get_result(
571
- # params4, file_path=self._get_test_file_path('generic-egs-case-3_no-inflation-rate-during-construction.txt')
572
+ # params4,
573
+ # file_path=self._get_test_file_path('generic-egs-case-3_no-inflation-rate-during-construction.txt')
572
574
# )
573
575
# self.assertEqual(15.0, _accrued_financing(r4))
574
576
575
577
def test_add_ons (self ):
576
- add_ons_result = self ._get_result (
577
- {'Do AddOn Calculations' : True }, file_path = self ._get_test_file_path ('egs-sam-em-add-ons.txt' )
578
- )
579
578
no_add_ons_result = self ._get_result (
580
579
{'Do AddOn Calculations' : False }, file_path = self ._get_test_file_path ('egs-sam-em-add-ons.txt' )
581
580
)
581
+ self ._assert_capex_line_items_sum_to_total (no_add_ons_result )
582
+
583
+ add_ons_result = self ._get_result (
584
+ {'Do AddOn Calculations' : True }, file_path = self ._get_test_file_path ('egs-sam-em-add-ons.txt' )
585
+ )
582
586
self .assertIsNotNone (add_ons_result )
587
+ self ._assert_capex_line_items_sum_to_total (add_ons_result )
583
588
584
589
self .assertGreater (
585
590
add_ons_result .result ['SUMMARY OF RESULTS' ]['Total CAPEX' ]['value' ],
@@ -613,6 +618,26 @@ def test_add_ons(self):
613
618
file_path = self ._get_test_file_path ('egs-sam-em-add-ons.txt' ),
614
619
)
615
620
621
+ def _assert_capex_line_items_sum_to_total (self , r : GeophiresXResult ):
622
+ capex_line_items = {key : value for key , value in r .result ['CAPITAL COSTS (M$)' ].items () if value is not None }
623
+
624
+ total_capex_unit = capex_line_items ['Total CAPEX' ]['unit' ]
625
+ total_capex = quantity (capex_line_items ['Total CAPEX' ]['value' ], total_capex_unit )
626
+
627
+ capex_line_item_sum = 0
628
+ for line_item_name , capex_line_item in capex_line_items .items ():
629
+ if line_item_name not in [
630
+ 'Total CAPEX' ,
631
+ 'Total surface equipment costs' ,
632
+ 'Drilling and completion costs per well' ,
633
+ 'Drilling and completion costs per vertical production well' ,
634
+ 'Drilling and completion costs per vertical injection well' ,
635
+ 'Drilling and completion costs per non-vertical section' ,
636
+ ]:
637
+ capex_line_item_sum += quantity (capex_line_item ['value' ], capex_line_item ['unit' ]).to (total_capex_unit )
638
+
639
+ self .assertEqual (total_capex , capex_line_item_sum )
640
+
616
641
@staticmethod
617
642
def _new_model (input_file : Path , additional_params : dict [str , Any ] | None = None , read_and_calculate = True ) -> Model :
618
643
if additional_params is not None :
0 commit comments