vlcsim.controller
Controller package for VLC connection management and resource allocation.
This package provides the Connection and Controller classes that manage data transmission connections and resource allocation in VLC simulations.
The Controller module has been refactored into separate files for better organization and maintainability:
connection.py: Connection class for representing transmission connections
controller.py: Controller class for managing allocation and lifecycle
For backward compatibility, all public classes are exported from this package:
- Classes:
Connection: Represents a data transmission connection Controller: Manages connection allocation and lifecycle
Example
Import classes from the controller package:
from vlcsim.controller import Connection, Controller
# Or import from vlcsim directly (backward compatible)
from vlcsim import Connection, Controller
Basic usage:
# Create controller
controller = Controller(x=10.0, y=10.0, z=3.0, nGrids=20, rho=0.8)
# Create connection
receiver = Receiver(x=5.0, y=5.0, z=0.85, aDet=1e-4, ts=0.1,
index=1.5, fov=60.0)
connection = Connection(id=0, receiver=receiver, time=0.0)
connection.capacityRequired = 1e6 # 1 Mbps
# Set allocator and initialize
controller.allocator = Controller.default_alloc
controller.init()
# Assign connection
status, next_time, conn = controller.assignConnection(connection, 0.0)
Note
All imports remain backward compatible with code that previously imported from vlcsim.controller (the old monolithic module).
Modules
Connection class for VLC data transmission management. |
|
Controller class for VLC resource allocation and connection management. |