7
7
from pathlib import Path
8
8
from typing import Any
9
9
10
+ import numpy as np
11
+
12
+ # noinspection PyProtectedMember
13
+ from geophires_x .EconomicsSam import _cash_flow_profile_row
10
14
from geophires_x .OptionList import PlantType
11
15
from geophires_x .OptionList import WellDrillingCostCorrelation
12
16
from geophires_x_client import GeophiresXClient
13
17
from geophires_x_client import GeophiresXResult
18
+
19
+ # noinspection PyProtectedMember
14
20
from geophires_x_client import _get_logger
15
21
from geophires_x_client .geophires_input_parameters import EndUseOption
16
22
from geophires_x_client .geophires_input_parameters import GeophiresInputParameters
@@ -1306,7 +1312,9 @@ def test_royalty_rate(self):
1306
1312
from_file_path = self ._get_test_file_path (
1307
1313
'geophires_x_tests/generic-egs-case-2_sam-single-owner-ppa.txt'
1308
1314
),
1309
- params = {'Royalty Rate' : royalty_rate },
1315
+ params = {
1316
+ 'Royalty Rate' : royalty_rate ,
1317
+ },
1310
1318
)
1311
1319
)
1312
1320
opex_result = result .result ['OPERATING AND MAINTENANCE COSTS (M$/yr)' ]
@@ -1332,7 +1340,22 @@ def test_royalty_rate(self):
1332
1340
1333
1341
if royalty_rate > 0.0 :
1334
1342
self .assertEqual (58.88 , opex_result [royalties_output_name ]['value' ])
1335
- self .assertGreater (royalty_holder_npv_MUSD , 0 ) # FIXME WIP
1336
- else :
1343
+ self .assertGreater (royalty_holder_npv_MUSD , 0 )
1344
+
1345
+ royalties_cash_flow_MUSD = [
1346
+ it * 1e-6
1347
+ for it in _cash_flow_profile_row (
1348
+ result .result ['SAM CASH FLOW PROFILE' ], 'O&M production-based expense ($)'
1349
+ )
1350
+ ]
1351
+
1352
+ self .assertAlmostEqual (
1353
+ np .average (royalties_cash_flow_MUSD [1 :]), opex_result [royalties_output_name ]['value' ], places = 1
1354
+ )
1355
+
1356
+ if royalty_rate == 0.1 :
1357
+ self .assertAlmostEqual (708.07 , royalty_holder_npv_MUSD , places = 2 )
1358
+
1359
+ if royalty_rate == 0.0 :
1337
1360
self .assertEqual (0 , opex_result [royalties_output_name ]['value' ])
1338
1361
self .assertEqual (0 , royalty_holder_npv_MUSD )
0 commit comments