vlcsim.scene.vled.VLed
- class vlcsim.scene.vled.VLed(x: float, y: float, z: float, nLedsX: int, nLedsY: int, ledPower: float, theta: float)[source]
Bases:
AccessPointVisible Light LED (VLed) access point for VLC communication.
VLed represents a LED-based access point that transmits data using visible light. It extends AccessPoint with optical transmission parameters including LED array configuration, optical power, and beam characteristics.
The class automatically calculates derived parameters such as total power and Lambertian emission order based on the LED configuration.
- Class Attributes:
numberOfVLeds (int): Counter tracking total number of VLed instances created
- Properties:
- Inherited from AccessPoint:
x, y, z, position, state, ID, B, sliceTime, slicesInFrame
- VLed-specific:
nLedsX (int): Number of LEDs in X direction (rows) nLedsY (int): Number of LEDs in Y direction (columns) ledPower (float): Power per LED in milliwatts theta (float): Semi-angle at half illumination in degrees numberOfLeds (int): Total LEDs in array (read-only) totalPower (float): Total optical power in milliwatts ml (float): Lambertian emission order (read-only)
Example
Creating a VLed access point:
# Create 2x2 LED array at ceiling center # Position: (5m, 5m, 3m) # Each LED: 20mW power # Beam angle: 60 degrees semi-angle vled = VLed(x=5.0, y=5.0, z=3.0, nLedsX=2, nLedsY=2, ledPower=20, theta=60) # Configure TDM parameters vled.sliceTime = 0.1 # 100ms per slice vled.slicesInFrame = 10 # 10 slices per frame vled.B = 5e5 # 500 kHz bandwidth # Total power is automatically calculated print(f"Total power: {vled.totalPower}mW") # 80mW (4 LEDs * 20mW) print(f"Lambertian order: {vled.ml}")
Note
ID is automatically assigned incrementally starting from 0
Lambertian emission order ml is calculated as -log10(2)/log10(cos(theta))
totalPower equals nLedsX * nLedsY * ledPower
Typical theta values range from 30-70 degrees for indoor VLC
- __init__(x: float, y: float, z: float, nLedsX: int, nLedsY: int, ledPower: float, theta: float) None[source]
Initialize a VLed access point with optical parameters.
Creates a VLed with specified position and LED array configuration. Automatically calculates total power and Lambertian emission order.
- Parameters:
x – X-coordinate position in meters
y – Y-coordinate position in meters
z – Z-coordinate position in meters (typically ceiling height)
nLedsX – Number of LEDs in X direction (rows in the array)
nLedsY – Number of LEDs in Y direction (columns in the array)
ledPower – Optical power per LED in milliwatts (mW)
theta – Semi-angle at half illumination in degrees
Example:
# Create 4x4 LED panel at room center ceiling vled = VLed(x=5.0, y=5.0, z=3.0, nLedsX=4, nLedsY=4, ledPower=50, theta=60)
Note
Total LEDs = nLedsX * nLedsY
Total power = numberOfLeds * ledPower
Lambertian order ml = -log10(2)/log10(cos(theta))
VLed ID is auto-assigned from numberOfVLeds class counter
Methods
__init__(x, y, z, nLedsX, nLedsY, ledPower, ...)Initialize a VLed access point with optical parameters.
setBUSY()Set this access point to BUSY state.
setIDLE()Set this access point to IDLE state.
Attributes
Get the bandwidth of this access point.
Get the unique identifier of this access point.
Get the optical power per individual LED.
Get the Lambertian emission order.
Get the number of LEDs in X direction (rows).
Get the number of LEDs in Y direction (columns).
Get the total number of LEDs in this VLed array.
numberOfVLedsGet the 3D position vector of this access point.
Get the time duration of each TDM slice.
Get the number of time slices in each TDM frame.
Get the current operational state of this access point.
Get the semi-angle at half illumination.
Get the total optical power of this VLed array.
Get the X-coordinate of this access point.
Get the Y-coordinate of this access point.
Get the Z-coordinate of this access point.
- property B: float
Get the bandwidth of this access point.
- Returns:
Bandwidth in Hz (default: 1 MHz)
- Return type:
float
- property ID: int | None
Get the unique identifier of this access point.
- Returns:
Access point ID, None if not yet assigned
- Return type:
int or None
- property ledPower: float
Get the optical power per individual LED.
- Returns:
Power per LED in milliwatts (mW)
- Return type:
float
- property ml: float
Get the Lambertian emission order.
The Lambertian order characterizes the directionality of the LED emission pattern. Higher values indicate more directional (focused) emission.
The formula is:
\[ml = -\frac{\log_{10} 2}{\log_{10} (\cos(\theta))}\]- Returns:
Lambertian emission order (dimensionless)
- Return type:
float
Note
theta=60° → ml ≈ 1 (wide beam)
theta=30° → ml ≈ 3.3 (narrow beam)
Higher ml means more concentrated light at center
- property nLedsX: int
Get the number of LEDs in X direction (rows).
- Returns:
Number of LED rows in the array
- Return type:
int
- property nLedsY: int
Get the number of LEDs in Y direction (columns).
- Returns:
Number of LED columns in the array
- Return type:
int
- property numberOfLeds: int
Get the total number of LEDs in this VLed array.
Calculated as nLedsX * nLedsY.
- Returns:
Total number of LEDs in the array
- Return type:
int
- property position: ndarray[Any, dtype[float64]]
Get the 3D position vector of this access point.
- Returns:
Position vector [x, y, z] in meters
- Return type:
ndarray
- setBUSY() None
Set this access point to BUSY state.
Transitions the access point to BUSY, indicating it is actively serving connections.
- setIDLE() None
Set this access point to IDLE state.
Transitions the access point to IDLE, indicating it is ready to accept new connections.
- property sliceTime: float
Get the time duration of each TDM slice.
The slice time determines how long each connection can use the access point in a single time slice.
- Returns:
Slice time duration in seconds (default: 0.1s)
- Return type:
float
- property slicesInFrame: int
Get the number of time slices in each TDM frame.
This determines the frame structure for time-division multiplexing. Total frame duration equals sliceTime * slicesInFrame.
- Returns:
Number of slices per frame (default: 10)
- Return type:
int
- property state: state
Get the current operational state of this access point.
- Returns:
Current state, either IDLE or BUSY
- Return type:
stateap
- stateap(value)
alias of
state
- property theta: float
Get the semi-angle at half illumination.
Theta defines the beam width of the LED. It is the angle from the optical axis at which the luminous intensity drops to half of its maximum value.
- Returns:
Semi-angle in degrees
- Return type:
float
Note
Typical values for indoor VLC range from 30-70 degrees. Smaller angles create more focused beams with higher intensity at center.
- property totalPower: float
Get the total optical power of this VLed array.
Calculated as numberOfLeds * ledPower.
- Returns:
Total optical power in milliwatts (mW)
- Return type:
float
Example:
vled = VLed(5, 5, 3, nLedsX=4, nLedsY=4, ledPower=50, theta=60) # totalPower = 4 * 4 * 50 = 800 mW
- property x: float
Get the X-coordinate of this access point.
- Returns:
X-coordinate in meters
- Return type:
float
- property y: float
Get the Y-coordinate of this access point.
- Returns:
Y-coordinate in meters
- Return type:
float
- property z: float
Get the Z-coordinate of this access point.
- Returns:
Z-coordinate in meters (typically height)
- Return type:
float