@@ -427,36 +427,49 @@ def test_inflation_rate_during_construction(self):
427427
428428 self .assertAlmostEqual (tic_no_infl * (1 + infl_rate ), tic_infl , places = 0 )
429429
430- # TODO/WIP enable when multiple construction years are supported https://github.com/NREL/GEOPHIRES-X/issues/406
431- # def _infl_cost_musd(r: GeophiresXResult) -> float:
432- # return r.result['CAPITAL COSTS (M$)']['Inflation costs during construction']['value']
433- #
434- # params_3 = {
435- # 'Construction Years': 3,
436- # 'Inflation Rate': 0.04769,
437- # 'Inflated Bond Interest Rate During Construction': 0,
438- # # 'Fraction of Investment in Bonds': 0,
439- # }
440- # r3: GeophiresXResult = self._get_result(
441- # params_3,
442- # file_path=self._get_test_file_path('generic-egs-case-3_no-inflation-rate-during-construction.txt')
443- # )
444- # cash_flow_3 = r3.result['SAM CASH FLOW PROFILE']
445- # # FIXME WIP...
446- # # self.assertEqual(15.0, _accrued_financing(r3))
447- # tic_3 = EconomicsSamTestCase._get_cash_flow_row(cash_flow_3, tic)[-1]
448- # self.assertAlmostEqual(tic_no_infl * (1 + infl_rate), tic_3, places=0)
449- #
450- # params4 = {
451- # 'Construction Years': 3,
452- # 'Inflation Rate During Construction': 0.15,
453- # 'Inflated Bond Interest Rate During Construction': 0,
454- # }
455- # r4: GeophiresXResult = self._get_result(
456- # params4,
457- # file_path=self._get_test_file_path('generic-egs-case-3_no-inflation-rate-during-construction.txt')
458- # )
459- # # self.assertEqual(15.0, _accrued_financing(r4)) # FIXME WIP
430+ def _infl_cost_musd (r : GeophiresXResult ) -> float :
431+ return r .result ['CAPITAL COSTS (M$)' ]['Inflation costs during construction' ]['value' ]
432+
433+ params_3 = {
434+ 'Construction Years' : 3 ,
435+ 'Inflation Rate' : 0.04769 ,
436+ 'Inflated Bond Interest Rate During Construction' : 0 ,
437+ }
438+ r3 : GeophiresXResult = self ._get_result (
439+ params_3 , file_path = self ._get_test_file_path ('generic-egs-case-3_no-inflation-rate-during-construction.txt' )
440+ )
441+
442+ # Validate that inflation during construction is calculated by compounding the inflation rate over construction years
443+ occ_3 = r3 .result ['CAPITAL COSTS (M$)' ]['Overnight Capital Cost' ]['value' ]
444+ infl_rate_3 = params_3 ['Inflation Rate' ]
445+ # Default uniform schedule for 3 years
446+ schedule = [1 / 3 , 1 / 3 , 1 / 3 ]
447+
448+ expected_infl_cost_3 = sum ([occ_3 * s * ((1 + infl_rate_3 ) ** (y + 1 ) - 1 ) for y , s in enumerate (schedule )])
449+
450+ self .assertAlmostEqual (expected_infl_cost_3 , _infl_cost_musd (r3 ), places = 1 )
451+
452+ cash_flow_3 = r3 .result ['SAM CASH FLOW PROFILE' ]
453+ tic_3 = EconomicsSamTestCase ._get_cash_flow_row (cash_flow_3 , tic )[- 1 ]
454+
455+ # Verify TIC matches OCC + Inflation Cost (IDC is 0)
456+ self .assertAlmostEqual (occ_3 + expected_infl_cost_3 , quantity (abs (tic_3 ), 'USD' ).to ('MUSD' ).magnitude , places = 0 )
457+
458+ params4 = {
459+ 'Construction Years' : 3 ,
460+ 'Inflation Rate During Construction' : 0.15 ,
461+ 'Inflated Bond Interest Rate During Construction' : 0 ,
462+ }
463+ r4 : GeophiresXResult = self ._get_result (
464+ params4 , file_path = self ._get_test_file_path ('generic-egs-case-3_no-inflation-rate-during-construction.txt' )
465+ )
466+
467+ # r4 treats 'Inflation Rate During Construction' as the annual inflation rate in the current implementation
468+ infl_rate_4 = params4 ['Inflation Rate During Construction' ]
469+ occ_4 = r4 .result ['CAPITAL COSTS (M$)' ]['Overnight Capital Cost' ]['value' ]
470+
471+ expected_infl_cost_4 = sum ([occ_4 * s * ((1 + infl_rate_4 ) ** (y + 1 ) - 1 ) for y , s in enumerate (schedule )])
472+ self .assertAlmostEqual (expected_infl_cost_4 , _infl_cost_musd (r4 ), places = 1 )
460473
461474 def test_ptc (self ):
462475 def assert_ptc (params , expected_ptc_usd_per_kWh ):
0 commit comments