Skip to content

Commit bdcda6e

Browse files
deeper testing of generation profile, clarification of discrepancy between averages
1 parent 1d1cef5 commit bdcda6e

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

tests/geophires_x_tests/test_economics_sam.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ def _npv(r: GeophiresXResult) -> float:
105105

106106
def test_electricity_generation_profile(self):
107107
r = self._get_result({})
108+
lifetime = r.result['ECONOMIC PARAMETERS']['Project lifetime']['value']
108109

109110
cash_flow = r.result['SAM CASH FLOW PROFILE']
110111

@@ -114,13 +115,26 @@ def get_row(name: str) -> list[float]:
114115
geophires_avg_net_gen_GWh = r.result['SURFACE EQUIPMENT SIMULATION RESULTS'][
115116
'Average Annual Net Electricity Generation'
116117
]['value']
117-
allowed_delta_percent = 15 # FIXME WIP investigate why this is so high
118+
119+
sam_gen_profile = get_row('Electricity to grid net (kWh)')
120+
121+
# Discrepancy is probably due to windowing and/or rounding effects
122+
# (TODO to investigate further when time permits)
123+
allowed_delta_percent = 15
118124
self.assertAlmostEqualWithinPercentage(
119125
geophires_avg_net_gen_GWh,
120-
np.average(get_row('Electricity to grid net (kWh)')) * 1e-6,
126+
np.average(sam_gen_profile) * 1e-6,
121127
allowed_delta_percent,
122128
)
123129

130+
elec_idx = r.result['HEAT AND/OR ELECTRICITY EXTRACTION AND GENERATION PROFILE'][0].index(
131+
'ELECTRICITY PROVIDED (GWh/year)'
132+
)
133+
for i in range(lifetime):
134+
geophires_elec = r.result['HEAT AND/OR ELECTRICITY EXTRACTION AND GENERATION PROFILE'][1:][i][elec_idx]
135+
sam_elec = sam_gen_profile[i + 1] * 1e-6
136+
self.assertAlmostEqual(geophires_elec, sam_elec, places=0)
137+
124138
def test_cash_flow(self):
125139
m: Model = EconomicsSamTestCase._new_model(Path(self._egs_test_file_path()))
126140

0 commit comments

Comments
 (0)