vlcsim.simulator.Event
- class vlcsim.simulator.Event(type: event | None = None, time: float = -1, id_connection: int = -1)[source]
Bases:
objectRepresents a simulation event in the discrete-event simulation.
The Event class encapsulates all information about a simulation event including timing, type, and associated connection. Events are stored in a Future Event List (FEL) and processed chronologically by the Simulator.
- event
Event type enumeration with 5 possible values
- Type:
Enum
- Event Types:
ARRIVE: New connection arrives to scenario
DEPARTURE: Connection completes transmission and leaves
PAUSE: Connection pauses transmission (TDM frame/slice boundary)
RESUME: Connection resumes transmission after pause
NEXT_CONNECTION_TRY: Connection retries allocation after waiting
Example:
# Create arrival event event = Event(type=Event.event.ARRIVE, time=5.2, id_connection=42) event.connection = connection_object # Check event type if event.type == Event.event.ARRIVE: print(f"Connection {event.id_connection} arrived at {event.time}")
Methods
__init__([type, time, id_connection])Attributes
Get the Connection object associated with this event.
Get the connection ID associated with this event.
Get the simulation time when this event occurs.
Get the event type.
- property connection: Connection | None
Get the Connection object associated with this event.
- Returns:
Connection object if set, None otherwise
- Return type:
Connection or None
- enum event(value)
Bases:
EnumEvent type enumeration.Event type enumeration. · Five event types for simulation lifecycle:
ARRIVE: Connection arrives to scenario (triggers allocation)
DEPARTURE: Connection completes transmission and leaves
PAUSE: Connection temporarily pauses (TDM frame/slice boundary)
RESUME: Connection resumes transmission after pause
NEXT_CONNECTION_TRY: Connection retries allocation after random wait
Valid values are as follows:
- ARRIVE = <event.ARRIVE: 1>
- DEPARTURE = <event.DEPARTURE: 2>
- PAUSE = <event.PAUSE: 3>
- RESUME = <event.RESUME: 4>
- NEXT_CONNECTION_TRY = <event.NEXT_CONNECTION_TRY: 5>
- property id_connection: int
Get the connection ID associated with this event.
- Returns:
Unique connection identifier
- Return type:
int
- property time: float
Get the simulation time when this event occurs.
- Returns:
Event occurrence time in seconds
- Return type:
float