Skip to content

Commit fbc1301

Browse files
Document no effective cap for max royalty rate. Add unit test to assert that royalty rate is not supported for non-SAM-EM
1 parent 668c6fe commit fbc1301

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

src/geophires_x/Economics.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -992,15 +992,17 @@ def __init__(self, model: Model):
992992
"increases a 4% rate (0.04) to 4.1% (0.041) in the next year."
993993
)
994994

995+
maximum_royalty_rate_default_val = 1.0
995996
self.maximum_royalty_rate = self.ParameterDict[self.maximum_royalty_rate.Name] = floatParameter(
996997
'Royalty Rate Maximum',
997-
DefaultValue=1.0, # Default to 100% (no effective cap)
998+
DefaultValue=maximum_royalty_rate_default_val,
998999
Min=0.0,
9991000
Max=1.0,
10001001
UnitType=Units.PERCENT,
10011002
PreferredUnits=PercentUnit.TENTH,
10021003
CurrentUnits=PercentUnit.TENTH,
1003-
ToolTipText="The maximum royalty rate after escalation, expressed as a fraction (e.g., 0.06 for a 6% cap)."
1004+
ToolTipText=f"The maximum royalty rate after escalation, expressed as a fraction (e.g., 0.06 for a 6% cap)."
1005+
f"{' Defaults to 100% (no effective cap).' if maximum_royalty_rate_default_val == 1.0 else ''}"
10041006
)
10051007

10061008
# TODO support custom royalty rate schedule as a list parameter

src/geophires_x_schema_generator/geophires-request.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1657,7 +1657,7 @@
16571657
"maximum": 1.0
16581658
},
16591659
"Royalty Rate Maximum": {
1660-
"description": "The maximum royalty rate after escalation, expressed as a fraction (e.g., 0.06 for a 6% cap).",
1660+
"description": "The maximum royalty rate after escalation, expressed as a fraction (e.g., 0.06 for a 6% cap). Defaults to 100% (no effective cap).",
16611661
"type": "number",
16621662
"units": "",
16631663
"category": "Economics",

tests/test_geophires_x.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,3 +1457,16 @@ def test_royalty_rate_with_addon(self):
14571457
addon_cash_flow = _cash_flow_profile_row(result.result['SAM CASH FLOW PROFILE'], 'Capacity payment revenue ($)')
14581458
self.assertEqual(0, addon_cash_flow[0])
14591459
self.assertTrue(all(it == addon_profit_MUSD * 1e6 for it in addon_cash_flow[1:]))
1460+
1461+
def test_royalty_rate_not_supported_for_non_sam_economic_models(self):
1462+
with self.assertRaises(RuntimeError) as re:
1463+
GeophiresXClient().get_geophires_result(
1464+
ImmutableGeophiresInputParameters(
1465+
from_file_path=self._get_test_file_path('examples/Fervo_Project_Cape-3.txt'),
1466+
params={
1467+
'Royalty Rate': 0.1,
1468+
},
1469+
)
1470+
)
1471+
1472+
self.assertIn('Royalties are only supported for SAM Economic Models', str(re.exception))

0 commit comments

Comments
 (0)