From 0e5f68d118580e54f33b12bf0ab95bf9aee8019e Mon Sep 17 00:00:00 2001 From: pesap Date: Mon, 18 Nov 2024 19:15:33 -0700 Subject: [PATCH] fix: Added correct unit validation for `FuelPrice`. --- src/r2x/defaults/plexos_output.json | 1 + src/r2x/models/generators.py | 4 ++-- src/r2x/units.py | 6 +++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/r2x/defaults/plexos_output.json b/src/r2x/defaults/plexos_output.json index c0928ebe..8de7e2d7 100644 --- a/src/r2x/defaults/plexos_output.json +++ b/src/r2x/defaults/plexos_output.json @@ -6,6 +6,7 @@ "Charge Efficiency": "%", "Fixed Load": "MW", "Forced Outage Rate": "%", + "Fuel Price": "$/MMbtu", "Heat Rate": "MMBtu/MWh", "Initial SoC": "%", "Initial Volume": "GWh", diff --git a/src/r2x/models/generators.py b/src/r2x/models/generators.py index 10c99fd9..a7c74c56 100644 --- a/src/r2x/models/generators.py +++ b/src/r2x/models/generators.py @@ -11,10 +11,10 @@ from r2x.enums import PrimeMoversType from r2x.units import ( ActivePower, - FuelPrice, Percentage, PowerRate, ApparentPower, + VOMPrice, ureg, Time, Energy, @@ -59,7 +59,7 @@ class Generator(Device): must_run: Annotated[int | None, Field(description="If we need to force the dispatch of the device.")] = ( None ) - vom_price: Annotated[FuelPrice, Field(description="Variable operational price $/MWh.")] | None = None + vom_price: Annotated[VOMPrice, Field(description="Variable operational price $/MWh.")] | None = None prime_mover_type: ( Annotated[PrimeMoversType, Field(description="Prime mover technology according to EIA 923.")] | None ) = None diff --git a/src/r2x/units.py b/src/r2x/units.py index 3f23ff6c..1158484d 100644 --- a/src/r2x/units.py +++ b/src/r2x/units.py @@ -46,7 +46,11 @@ class HeatRate(BaseQuantity): class FuelPrice(BaseQuantity): - __base_unit__ = "usd/watthour" + __base_unit__ = "usd/Btu" + + +class VOMPrice(BaseQuantity): + __base_unit__ = "usd/kWh" class Energy(BaseQuantity):