Skip to content

gds_software.statemachine.elements

State machine element declarations -- frozen Pydantic models for user-facing declarations.

Bases: BaseModel

A state in a state machine.

Maps to: GDS Entity (state X) + StateVariable.

Source code in packages/gds-software/gds_software/statemachine/elements.py
class State(BaseModel, frozen=True):
    """A state in a state machine.

    Maps to: GDS Entity (state X) + StateVariable.
    """

    name: str
    is_initial: bool = False
    is_final: bool = False
    description: str = ""

Bases: BaseModel

An external or internal event that triggers transitions.

Maps to: GDS BoundaryAction (exogenous input U).

Source code in packages/gds-software/gds_software/statemachine/elements.py
class Event(BaseModel, frozen=True):
    """An external or internal event that triggers transitions.

    Maps to: GDS BoundaryAction (exogenous input U).
    """

    name: str
    description: str = ""

Bases: BaseModel

A directed transition between states.

Maps to: GDS Policy (guard evaluation) + Mechanism (state update).

Source code in packages/gds-software/gds_software/statemachine/elements.py
class Transition(BaseModel, frozen=True):
    """A directed transition between states.

    Maps to: GDS Policy (guard evaluation) + Mechanism (state update).
    """

    name: str
    source: str
    target: str
    event: str
    guard: Guard | None = None
    action: str = ""

Bases: BaseModel

A boolean condition on a transition.

Guards are evaluated at transition time — they restrict when a transition may fire.

Source code in packages/gds-software/gds_software/statemachine/elements.py
class Guard(BaseModel, frozen=True):
    """A boolean condition on a transition.

    Guards are evaluated at transition time — they restrict when
    a transition may fire.
    """

    condition: str
    description: str = ""

Bases: BaseModel

An orthogonal region in a hierarchical state machine.

Maps to: GDS ParallelComposition — regions execute concurrently.

Source code in packages/gds-software/gds_software/statemachine/elements.py
class Region(BaseModel, frozen=True):
    """An orthogonal region in a hierarchical state machine.

    Maps to: GDS ParallelComposition — regions execute concurrently.
    """

    name: str
    states: list[str] = Field(default_factory=list)
    description: str = ""