Skip to content

Commit eb24b59

Browse files
split SAM economics test into separate test_economics_sam file
1 parent e91a37c commit eb24b59

File tree

2 files changed

+34
-26
lines changed

2 files changed

+34
-26
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from base_test_case import BaseTestCase
2+
from geophires_x_client import GeophiresInputParameters
3+
from geophires_x_client import GeophiresXClient
4+
from geophires_x_client import GeophiresXResult
5+
6+
7+
class EconomicsSamTestCase(BaseTestCase):
8+
9+
def _get_result(self, _params) -> GeophiresXResult:
10+
return GeophiresXClient().get_geophires_result(
11+
GeophiresInputParameters(
12+
from_file_path=self._get_test_file_path('generic-egs-case.txt'),
13+
params={'Economic Model': 5, **_params},
14+
)
15+
)
16+
17+
def test_economic_model_single_owner_ppa_sam(self):
18+
def _lcoe(r: GeophiresXResult) -> float:
19+
return r.result['SUMMARY OF RESULTS']['Electricity breakeven price']['value']
20+
21+
def _npv(r: GeophiresXResult) -> float:
22+
return r.result['ECONOMIC PARAMETERS']['Project NPV']['value']
23+
24+
base_result = self._get_result({})
25+
base_lcoe = _lcoe(base_result)
26+
self.assertGreater(base_lcoe, 6)
27+
28+
npvs = [_npv(self._get_result({'Starting Electricity Sale Price': x / 100.0})) for x in range(1, 20, 4)]
29+
for i in range(len(npvs) - 1):
30+
self.assertLess(npvs[i], npvs[i + 1])
31+
32+
def test_only_electricity_end_use_supported(self):
33+
with self.assertRaises(RuntimeError):
34+
self._get_result({'End-Use Option': 2})

tests/test_geophires_x.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -913,29 +913,3 @@ def test_negative_electricity_production_raises_error(self):
913913
)
914914
client.get_geophires_result(params)
915915
self.assertIn('Electricity production calculated as negative', str(e.exception))
916-
917-
def test_economic_model_single_owner_ppa_sam(self):
918-
def _get_result(_params) -> GeophiresXResult:
919-
return GeophiresXClient().get_geophires_result(
920-
GeophiresInputParameters(
921-
from_file_path=self._get_test_file_path('geophires_x_tests/generic-egs-case.txt'),
922-
params={'Economic Model': 5, **_params},
923-
)
924-
)
925-
926-
def _lcoe(r: GeophiresXResult) -> float:
927-
return r.result['SUMMARY OF RESULTS']['Electricity breakeven price']['value']
928-
929-
def _npv(r: GeophiresXResult) -> float:
930-
return r.result['ECONOMIC PARAMETERS']['Project NPV']['value']
931-
932-
base_result = _get_result({})
933-
base_lcoe = _lcoe(base_result)
934-
self.assertGreater(base_lcoe, 6)
935-
936-
npvs = [_npv(_get_result({'Starting Electricity Sale Price': x / 100.0})) for x in range(1, 20, 2)]
937-
for i in range(len(npvs) - 1):
938-
self.assertLess(npvs[i], npvs[i + 1])
939-
940-
with self.assertRaises(RuntimeError):
941-
_get_result({'End-Use Option': 2})

0 commit comments

Comments
 (0)