Skip to content

couplings

couplings

Coupling configuration for interconnected scenarios.

Classes

Couplings

Couplings(**data)

Bases: Base

Represents active and inactive couplings of a scenario.

Source code in src/pyetm/models/couplings.py
def __init__(self, **data: Any) -> None:
    super().__init__(**data)
Functions
active_groups
active_groups()

Get active coupling groups

Source code in src/pyetm/models/couplings.py
def active_groups(self) -> List[str]:
    """Get active coupling groups"""
    return self.active_couplings
inactive_groups
inactive_groups()

Get inactive coupling groups

Source code in src/pyetm/models/couplings.py
def inactive_groups(self) -> List[str]:
    """Get inactive coupling groups"""
    return self.inactive_couplings
all_groups
all_groups()

Get all coupling groups (active and inactive)

Source code in src/pyetm/models/couplings.py
def all_groups(self) -> Set[str]:
    """Get all coupling groups (active and inactive)"""
    return set(self.active_couplings + self.inactive_couplings)
from_json classmethod
from_json(data)

Create Couplings from JSON data.

Expected format: { "active_couplings": ["external_group1"], "inactive_couplings": ["external_group2"] }

Source code in src/pyetm/models/couplings.py
@classmethod
def from_json(cls, data: Dict[str, Any]) -> "Couplings":
    """
    Create Couplings from JSON data.

    Expected format:
    {
        "active_couplings": ["external_group1"],
        "inactive_couplings": ["external_group2"]
    }
    """
    return cls.model_validate(
        {
            "active_couplings": data.get("active_couplings", []),
            "inactive_couplings": data.get("inactive_couplings", []),
        }
    )