vlcsim.scene.Scenario

class vlcsim.scene.Scenario(width: float, length: float, height: float, nGrids: int, rho: float)[source]

Bases: object

Represents the simulation scenario’s physical environment and configuration.

The Scenario class manages the 3D room dimensions, lighting infrastructure (VLEDs and RF femtocells), receivers, and performs channel gain and capacity calculations for both line-of-sight and wall-reflected signals.

numberOfAPs

Class variable tracking the total number of access points (VLEDs + RF) created across all scenarios.

Properties:
  • Dimensions: width, length, height, start_x/y, end_x/y

  • Infrastructure: vleds, rfs, vledsPositions, rfsPositions

  • Counts: numberOfVLeds, numberOfRFs

Example

>>> scenario = Scenario(width=5.0, length=5.0, height=3.0, nGrids=5, rho=0.8)
>>> vled = VLed(x=0, y=0, z=3.0, ml=1.0, pt=10.0)
>>> scenario.addVLed(vled)
>>> scenario.numberOfVLeds
1
__init__(width: float, length: float, height: float, nGrids: int, rho: float) None[source]

Initialize a simulation scenario with room dimensions and parameters.

Parameters:
  • width – Room width in meters (Y-axis dimension)

  • length – Room length in meters (X-axis dimension)

  • height – Room height in meters (Z-axis dimension)

  • nGrids – Number of grid divisions per meter for discretization

  • rho – Wall reflection coefficient (0.0 to 1.0)

Note

The room coordinate system is centered at (0, 0, 0) in the XY plane, with Z extending from 0 (floor) to height (ceiling).

Methods

__init__(width, length, height, nGrids, rho)

Initialize a simulation scenario with room dimensions and parameters.

addRF(rf)

Add an RF femtocell to the scenario.

addVLed(vled)

Add a VLED access point to the scenario.

capacityRf(receiver, rf)

Calculate the channel capacity for an RF link.

capacityVled(receiver, vled)

Calculate the channel capacity for a VLC link.

getPowerInPointFromVled(receiver, vledID)

Calculate the received optical power via line-of-sight from a VLED.

getPowerInPointFromWalls(receiver, vledID)

Calculate the received optical power from wall reflections.

snrRf(receiver, rf)

Calculate the Signal-to-Noise Ratio for an RF channel.

snrVled(receiver, vled)

Calculate the Signal-to-Noise Ratio for a VLC channel.

Attributes

end_x

Get the ending X coordinate of the room.

end_y

Get the ending Y coordinate of the room.

height

Get the scenario room height.

length

Get the scenario room length.

numberOfAPs

Class variable tracking the total number of access points created.

numberOfRFs

Get the number of RF femtocells in this scenario.

numberOfVLeds

Get the number of VLEDs in this scenario.

rfs

Get the list of RF femtocells in this scenario.

rfsPositions

Get the access point indices for RF femtocells.

start_x

Get the starting X coordinate of the room.

start_y

Get the starting Y coordinate of the room.

vleds

Get the list of VLEDs in this scenario.

vledsPositions

Get the access point indices for VLEDs.

width

Get the scenario room width.

addRF(rf: RF) None[source]

Add an RF femtocell to the scenario.

Parameters:

rf – The RF femtocell device to add

addVLed(vled: VLed) None[source]

Add a VLED access point to the scenario.

Parameters:

vled – The VLED device to add

capacityRf(receiver: Receiver, rf: RF) float[source]

Calculate the channel capacity for an RF link.

Uses Shannon’s capacity formula with the SNR from the RF channel.

Parameters:
  • receiver – Receiver device

  • rf – Transmitting RF femtocell

Returns:

Channel capacity in bits/s

Return type:

float

capacityVled(receiver: Receiver, vled: VLed) float[source]

Calculate the channel capacity for a VLC link.

Uses Shannon’s capacity formula with the SNR from the VLED channel.

Parameters:
  • receiver – Receiver device

  • vled – Transmitting VLED

Returns:

Channel capacity in bits/s

Return type:

float

property end_x: float

Get the ending X coordinate of the room.

Returns:

Ending X coordinate in meters (right edge)

Return type:

float

property end_y: float

Get the ending Y coordinate of the room.

Returns:

Ending Y coordinate in meters (back edge)

Return type:

float

getPowerInPointFromVled(receiver: Receiver, vledID: int | None) float[source]

Calculate the received optical power via line-of-sight from a VLED.

Parameters:
  • receiver – The receiver device at the measurement point

  • vledID – ID of the transmitting VLED, or None

Returns:

Received LOS power in watts

Return type:

float

Note

Returns 0.0 if vledID is None, out of bounds, or receiver is outside the FOV of the VLED.

getPowerInPointFromWalls(receiver: Receiver, vledID: int | None) float[source]

Calculate the received optical power from wall reflections.

Parameters:
  • receiver – The receiver device at the measurement point

  • vledID – ID of the transmitting VLED, or None

Returns:

Received power from wall reflections in watts

Return type:

float

Note

Returns 0.0 if vledID is None or out of bounds.

property height: float

Get the scenario room height.

Returns:

Room height in meters (Z-axis dimension)

Return type:

float

property length: float

Get the scenario room length.

Returns:

Room length in meters (X-axis dimension)

Return type:

float

numberOfAPs = 0

Class variable tracking the total number of access points created.

property numberOfRFs: int

Get the number of RF femtocells in this scenario.

Returns:

Number of RF access points

Return type:

int

property numberOfVLeds: int

Get the number of VLEDs in this scenario.

Returns:

Number of VLED access points

Return type:

int

property rfs: List[RF]

Get the list of RF femtocells in this scenario.

Returns:

List of all RF access points

Return type:

List[RF]

property rfsPositions: List[int]

Get the access point indices for RF femtocells.

Returns:

List of AP indices corresponding to each RF

Return type:

List[int]

snrRf(receiver: Receiver, rf: RF) float[source]

Calculate the Signal-to-Noise Ratio for an RF channel.

Computes the SNR at a receiver from an RF femtocell using the pathloss model.

Parameters:
  • receiver – Receiver device

  • rf – Transmitting RF femtocell

Returns:

SNR (dimensionless)

Return type:

float

snrVled(receiver: Receiver, vled: VLed) float[source]

Calculate the Signal-to-Noise Ratio for a VLC channel.

Computes the total SNR at a receiver from a VLED, considering both line-of-sight and wall-reflected signals, including shot noise and thermal noise components.

Parameters:
  • receiver – Receiver device

  • vled – Transmitting VLED

Returns:

SNR (dimensionless), or 0.0 if noise is zero

Return type:

float

property start_x: float

Get the starting X coordinate of the room.

Returns:

Starting X coordinate in meters (left edge)

Return type:

float

property start_y: float

Get the starting Y coordinate of the room.

Returns:

Starting Y coordinate in meters (front edge)

Return type:

float

property vleds: List[VLed]

Get the list of VLEDs in this scenario.

Returns:

List of all VLED access points

Return type:

List[VLed]

property vledsPositions: List[int]

Get the access point indices for VLEDs.

Returns:

List of AP indices corresponding to each VLED

Return type:

List[int]

property width: float

Get the scenario room width.

Returns:

Room width in meters (Y-axis dimension)

Return type:

float