Skip to content

Commit 89aeef6

Browse files
test_state_itc_amount - verify Investment Tax Credit output value
1 parent a01a49e commit 89aeef6

1 file changed

Lines changed: 29 additions & 10 deletions

File tree

tests/geophires_x_tests/test_economics_sam.py

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,21 +1388,40 @@ def test_chp_fixed_plant_cost_requires_electrical_plant_cost_allocation_ratio(se
13881388
self.assertIn('CHP Electrical Plant Cost Allocation Ratio is required', str(re.exception))
13891389

13901390
def test_state_itc_amount(self):
1391-
r: GeophiresXResult = GeophiresXClient().get_geophires_result(
1392-
ImmutableGeophiresInputParameters(
1393-
from_file_path=self._get_test_file_path('generic-egs-case-2_sam-single-owner-ppa.txt'),
1394-
params={
1395-
'State Investment Tax Credit Amount': 4,
1396-
'Construction Years': 1,
1397-
},
1391+
def _get_result(state_itc_amount_musd: float, fed_itc_rate_frac: float = 0.0) -> GeophiresXResult:
1392+
return GeophiresXClient().get_geophires_result(
1393+
ImmutableGeophiresInputParameters(
1394+
from_file_path=self._get_test_file_path('generic-egs-case-2_sam-single-owner-ppa.txt'),
1395+
params={
1396+
'State Investment Tax Credit Amount': state_itc_amount_musd,
1397+
'Investment Tax Credit Rate': fed_itc_rate_frac,
1398+
'Construction Years': 1,
1399+
},
1400+
)
13981401
)
1399-
)
1402+
1403+
def _itc_output_vu(r: GeophiresXResult) -> dict[str, float]:
1404+
return r.result['ECONOMIC PARAMETERS']['Investment Tax Credit']
1405+
1406+
def _itc_output_q(r: GeophiresXResult) -> dict[str, float]:
1407+
itc_vu = _itc_output_vu(r)
1408+
return quantity(itc_vu['value'], itc_vu['unit'])
1409+
1410+
r_state_itc_amount_only = _get_result(4)
14001411

14011412
line_item = 'State ITC amount income ($)'
1402-
cash_flow_row = self._get_cash_flow_row(r.result['SAM CASH FLOW PROFILE'], line_item)
1413+
cash_flow_row = self._get_cash_flow_row(r_state_itc_amount_only.result['SAM CASH FLOW PROFILE'], line_item)
14031414
self.assertEqual(4_000_000, cash_flow_row[1])
1415+
self.assertEqual(quantity(4, 'MUSD'), _itc_output_q(r_state_itc_amount_only))
1416+
1417+
r_fed_itc_rate_only = _get_result(0, 0.3)
1418+
fed_itc_rate_only_q = _itc_output_q(r_fed_itc_rate_only)
14041419

1405-
# FIXME WIP assert Investment Tax Credit output field is correct state + fed
1420+
r_fed_itc_rate_and_state_itc_amount = _get_result(4, 0.3)
1421+
self.assertEqual(
1422+
_itc_output_q(r_state_itc_amount_only) + fed_itc_rate_only_q,
1423+
_itc_output_q(r_fed_itc_rate_and_state_itc_amount),
1424+
)
14061425

14071426
@staticmethod
14081427
def _new_model(

0 commit comments

Comments
 (0)