@@ -105,6 +105,7 @@ def _npv(r: GeophiresXResult) -> float:
105
105
106
106
def test_electricity_generation_profile (self ):
107
107
r = self ._get_result ({})
108
+ lifetime = r .result ['ECONOMIC PARAMETERS' ]['Project lifetime' ]['value' ]
108
109
109
110
cash_flow = r .result ['SAM CASH FLOW PROFILE' ]
110
111
@@ -114,13 +115,26 @@ def get_row(name: str) -> list[float]:
114
115
geophires_avg_net_gen_GWh = r .result ['SURFACE EQUIPMENT SIMULATION RESULTS' ][
115
116
'Average Annual Net Electricity Generation'
116
117
]['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
118
124
self .assertAlmostEqualWithinPercentage (
119
125
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 ,
121
127
allowed_delta_percent ,
122
128
)
123
129
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
+
124
138
def test_cash_flow (self ):
125
139
m : Model = EconomicsSamTestCase ._new_model (Path (self ._egs_test_file_path ()))
126
140
0 commit comments