Skip to content

Commit 1d1cef5

Browse files
unit test electricity generation profile with FIXME WIP for apparent discrepancy
1 parent 1e0a65c commit 1d1cef5

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/geophires_x_tests/test_economics_sam.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from pathlib import Path
66
from typing import Any
77

8+
import numpy as np
9+
810
from base_test_case import BaseTestCase
911

1012
# ruff: noqa: I001 # Successful module initialization is dependent on this specific import order.
@@ -101,6 +103,24 @@ def _npv(r: GeophiresXResult) -> float:
101103
for i in range(len(npvs) - 1):
102104
self.assertLess(npvs[i], npvs[i + 1])
103105

106+
def test_electricity_generation_profile(self):
107+
r = self._get_result({})
108+
109+
cash_flow = r.result['SAM CASH FLOW PROFILE']
110+
111+
def get_row(name: str) -> list[float]:
112+
return EconomicsSamTestCase._get_cash_flow_row(cash_flow, name)
113+
114+
geophires_avg_net_gen_GWh = r.result['SURFACE EQUIPMENT SIMULATION RESULTS'][
115+
'Average Annual Net Electricity Generation'
116+
]['value']
117+
allowed_delta_percent = 15 # FIXME WIP investigate why this is so high
118+
self.assertAlmostEqualWithinPercentage(
119+
geophires_avg_net_gen_GWh,
120+
np.average(get_row('Electricity to grid net (kWh)')) * 1e-6,
121+
allowed_delta_percent,
122+
)
123+
104124
def test_cash_flow(self):
105125
m: Model = EconomicsSamTestCase._new_model(Path(self._egs_test_file_path()))
106126

0 commit comments

Comments
 (0)