Skip to content

AP71/CSMACA-RL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RL-Enhanced CSMA/CA Protocol Simulator

Python SimPy Status

A discrete-event simulator (DES) developed in Python to evaluate the performance of an adaptive IEEE 802.11 MAC protocol enhanced with Reinforcement Learning (Q-Learning).

The project compares the standard CSMA/CA mechanism (Binary Exponential Backoff) against an intelligent agent that autonomously learns the optimal Contention Window (CW) to minimize collisions and maximize throughput in high-density networks.

Features

  • Discrete Event Simulation: Powered by SimPy for microsecond-level precision.
  • Protocols Implemented:
    • Standard CSMA/CA (IEEE 802.11 DCF)
    • Standard CSMA/CA + RTS/CTS
    • RL-Enhanced (Q-Learning)
    • RL-Enhanced + RTS/CTS
  • Theoretical Validation: Comparison against Bianchi's Analytical Model.
  • Metrics: Throughput, PDR, Collision Rate, Latency, Jitter, Fairness, and Average CW.

Project Structure

The project logic is encapsulated within the utils package, keeping the root directory clean.

rl-csma-simulator/
│
├── res/                  # Plots of simulation results
│   ├── avg_cw.png          # Average CW plot
│   ├── collision_rate.png   # Collision Rate plot
│   ├── latency.png          # Latency plot
│   ├── pdr.png              # Packet Delivery Ratio plot
│   └── throughput.png       # Throughput plot
│
├── utils/                  # Core Logic & Helper Classes
│   ├── __init__.py
│   ├── config.py           # Simulation parameters (CW, Timing, etc.)
│   ├── Node.py             # Node logic (Standard & RL implementation)
│   ├── packet.py           # Packet structure
│   ├── Channel.py          # Shared medium management
│   ├── plot_from_csv.py    # Plotting utilities
│   ├── RealtimeGUI.py      # Real-time visualization
│   ├── RLNode.py           # RL-enhanced Node logic
│   ├── StatsCollector.py   # Metrics collection
│   └── QLearningAgent.py   # RL Agent logic
│
├── main.py                 # Main simulation entry point
├── BianchiModel.py         # Bianchi's analytical model implementation
├── simulation_results.csv  # Output data (generated after run)
├── requirements.txt        # Python dependencies
└── README.md               # Project documentation

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages