Skip to content

Commit 46522ac

Browse files
output interest rate (tangentially related to WIP to pass it to SAM)
1 parent 5c5d8f9 commit 46522ac

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

src/geophires_x/EconomicsSam.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ def _get_single_owner_parameters(model: Model) -> dict[str, Any]:
138138
# Debt/equity ratio ('Fraction of Investment in Bonds' parameter)
139139
ret['debt_percent'] = econ.FIB.quantity().to(convertible_unit('%')).magnitude
140140

141-
# TODO interest rate
141+
# TODO/WIP interest rate
142+
# ret['real_discount_rate']
142143

143144
# 'Property Tax Rate'
144145
ret['property_tax_rate'] = econ.PTR.quantity().to(convertible_unit('%')).magnitude

src/geophires_x/Outputs.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,13 @@ def PrintOutputs(self, model: Model):
250250

251251
elif model.economics.econmodel.value in (EconomicModel.BICYCLE, EconomicModel.SAM_SINGLE_OWNER_PPA):
252252
f.write(f' Economic Model = {model.economics.econmodel.value.value}\n')
253+
254+
if model.economics.econmodel.value in EconomicModel.SAM_SINGLE_OWNER_PPA:
255+
# TODO disambiguate interest rate for all economic models - see
256+
# 535c02d4adbeeeca553b61e9b996fccf00016529
257+
irfl = Outputs._field_label(econ.interest_rate.Name, 49)
258+
f.write(f' {irfl}{econ.interest_rate.value:10.2f} {econ.interest_rate.CurrentUnits.value}\n')
259+
253260
f.write(f' Accrued financing during construction: {model.economics.inflrateconstruction.value*100:10.2f} {model.economics.inflrateconstruction.CurrentUnits.value}\n')
254261
f.write(f' Project lifetime: {model.surfaceplant.plant_lifetime.value:10.0f} {model.surfaceplant.plant_lifetime.CurrentUnits.value}\n')
255262
f.write(f' Capacity factor: {model.surfaceplant.utilization_factor.value * 100:10.1f} %\n')

tests/geophires_x_tests/test_economics_sam.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
class EconomicsSamTestCase(BaseTestCase):
2626

2727
def _egs_test_file_path(self) -> str:
28-
return self._get_test_file_path('generic-egs-case-2.txt')
28+
return self._get_test_file_path('generic-egs-case-2_sam-single-owner-ppa.txt')
2929

3030
def _get_result(self, _params) -> GeophiresXResult:
3131
return GeophiresXClient().get_geophires_result(
@@ -46,6 +46,10 @@ def _npv(r: GeophiresXResult) -> float:
4646
base_lcoe = _lcoe(base_result)
4747
self.assertGreater(base_lcoe, 7)
4848

49+
ir = base_result.result['ECONOMIC PARAMETERS']['Interest Rate']
50+
self.assertEqual(ir['value'], 7.0)
51+
self.assertEqual(ir['unit'], '%')
52+
4953
npvs = [_npv(self._get_result({'Starting Electricity Sale Price': x / 100.0})) for x in range(1, 20, 4)]
5054
for i in range(len(npvs) - 1):
5155
self.assertLess(npvs[i], npvs[i + 1])

0 commit comments

Comments
 (0)