Skip to content

Commit

Permalink
test: Added PJM test system and fixed enum representation to be just
Browse files Browse the repository at this point in the history
str.
  • Loading branch information
pesap committed Sep 4, 2024
1 parent cd4d606 commit 545f6a5
Show file tree
Hide file tree
Showing 9 changed files with 1,911 additions and 56 deletions.
95 changes: 52 additions & 43 deletions src/r2x/enums.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,21 @@
"""R2X enums."""

from enum import Enum, auto


class StrEnum(Enum):
"""Class to allow printing of Enums.
NOTE: This class could be deprecated once most people migrate to
python3.11. For the mean time, we are going to maintain this for backwards
compatibility.
"""

def __str__(self) -> str:
return str(self.value)
from enum import auto, StrEnum


class ReserveType(StrEnum):
"""Class representing different types of Reserves."""

Spinning = auto()
Flexibility = auto()
Regulation = auto()
SPINNING = auto()
FLEXIBILITY = auto()
REGULATION = auto()


class ReserveDirection(StrEnum):
"""Class representing different Reserve Direction."""

Up = auto()
Down = auto()
UP = auto()
DOWN = auto()


class ACBusTypes(StrEnum):
Expand All @@ -36,33 +24,54 @@ class ACBusTypes(StrEnum):
For PCM translations, must of the buses are `PV`.
"""

PV = "PV"
PV = auto()
PQ = auto()
REF = auto()


class PrimeMoversType(StrEnum):
"""EIA prime mover codes."""

BA = "BA"
BT = "BT"
CA = "CA"
CC = "CC"
CE = "CE"
CP = "CP"
CS = "CS"
CT = "CT"
ES = "ES"
FC = "FC"
FW = "FW"
GT = "GT"
HA = "HA"
HB = "HB"
HK = "HK"
HY = "HY"
IC = "IC"
PS = "PS"
OT = "OT"
ST = "ST"
PV = "PV"
WT = "WT"
WS = "WS"
RTPV = "RTPV"
BA = auto()
BT = auto()
CA = auto()
CC = auto()
CE = auto()
CP = auto()
CS = auto()
CT = auto()
ES = auto()
FC = auto()
FW = auto()
GT = auto()
HA = auto()
HB = auto()
HK = auto()
HY = auto()
IC = auto()
PS = auto()
OT = auto()
ST = auto()
PV = auto()
WT = auto()
WS = auto()
RTPV = auto()


class ThermalFuels(StrEnum):
"""Thermal fuels that reflect options in the EIA annual energy review."""

COAL = auto()
WASTE_COAL = auto()
DISTILLATE_FUEL_OIL = auto()
WASTE_OIL = auto()
PETROLEUM_COKE = auto()
RESIDUAL_FUEL_OIL = auto()
NATURAL_GAS = auto()
OTHER_GAS = auto()
NUCLEAR = auto()
AG_BIPRODUCT = auto()
MUNICIPAL_WASTE = auto()
WOOD_WASTE = auto()
GEOTHERMAL = auto()
OTHER = auto()
6 changes: 3 additions & 3 deletions src/r2x/exporter/plexos.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ def _get_time_series_properties(self, component): # noqa: C901
time_series_property["Load Subtracter"] = "0"
case Reserve():
match component.reserve_type:
case ReserveType.Spinning:
case ReserveType.SPINNING:
time_series_property["Min Provision"] = "0"
case ReserveType.Flexibility:
case ReserveType.FLEXIBILITY:
time_series_property["Min Provision"] = "0"
case ReserveType.Regulation:
case ReserveType.REGULATION:
time_series_property["Static Risk"] = "0"
case _:
raise NotImplementedError(f"Reserve {component.type} not supported")
Expand Down
4 changes: 2 additions & 2 deletions src/r2x/models/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ def example(cls) -> "Reserve":
return Reserve(
name="ExampleReserve",
region=LoadZone.example(),
direction=ReserveDirection.Up,
reserve_type=ReserveType.Regulation,
direction=ReserveDirection.UP,
reserve_type=ReserveType.REGULATION,
)


Expand Down
Loading

0 comments on commit 545f6a5

Please sign in to comment.