vlcsim.simulator.Event

class vlcsim.simulator.Event(type: event | None = None, time: float = -1, id_connection: int = -1)[source]

Bases: object

Represents 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}")
__init__(type: event | None = None, time: float = -1, id_connection: int = -1) None[source]

Methods

__init__([type, time, id_connection])

Attributes

connection

Get the Connection object associated with this event.

id_connection

Get the connection ID associated with this event.

time

Get the simulation time when this event occurs.

type

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: Enum

Event 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

property type: event

Get the event type.

Returns:

One of the five event types (ARRIVE, DEPARTURE, PAUSE, RESUME, NEXT_CONNECTION_TRY)

Return type:

event