Skip to main content

A high-fidelity, AI-ready IEEE 802.11 simulator powered by O(log N) Time-Leaping mechanism for complex MAC layer dynamics.

Project description

PyWINS

PyWINS (Python Wireless Network Simulator) is a lightweight, discrete-event-driven simulator designed for analyzing the performance of the IEEE 802.11 MAC layer dynamics.

Unlike traditional time-stepping simulators, PyWINS implements a Time-Leaping mechanism based on a Min-Heap data structure. This allows the system clock to skip idle intervals instantaneously, ensuring high execution efficiency even in large-scale network topologies.

🚀 Key Features

  • Time-Leaping Kernel: Powered by a Min-Heap priority queue, the simulator efficiently manages events without the overhead of fixed time-step polling.
  • Full CSMA/CA Logic: Implements the complete IEEE 802.11 DCF protocol stack, including Carrier Sensing, Binary Exponential Backoff (BEB), DIFS/SIFS timing, and ACK timeouts.
  • Custom Topology Support: Uses an Adjacency Matrix (via listen lists) to define node connectivity. This allows for the precise simulation of complex interference scenarios such as Hidden Terminals and Exposed Terminals.
  • Pure Python: Built entirely in Python with minimal dependencies, making it easy to read, modify, and integrate with AI/ML frameworks.

🛠️ Installation

You can install PyWINS via pip:

pip install PyWINS

💻 Quick Start

1. Basic Simulation

Simulate a standard fully-connected network (Single BSS) with 5 nodes.

Python

from pywins import Simulator

# Initialize simulator with 5 nodes
# Default: All nodes can hear each other (Fully Connected)
sim = Simulator(STATIONS=5, total_time=1e6)

# Configure MAC parameters (e.g., 802.11a standard)
sim.update(RATE=54, MAX_RETRY=7, CW_MIN=16)

# Run simulation
drop_rate, ratio, throughput = sim.run()

print(f"Simulation Results:")
print(f"Throughput: {throughput:.2f} Mbps")
print(f"Drop Rate: {drop_rate:.2%}")

2. Hidden Terminal Scenario

Simulate a specific topology where two nodes are "hidden" from each other, causing collisions at the Access Point (AP).

Python

from pywins import Simulator

# Define Topology using Adjacency List (Listen Matrix)
# Node 0 (AP): Can hear Node 1 and Node 2
# Node 1 (STA): Can only hear Node 0 (Blind to Node 2)
# Node 2 (STA): Can only hear Node 0 (Blind to Node 1)
hidden_topology = [[1, 2], [0], [0]]

# Initialize simulator with custom topology
sim = Simulator(STATIONS=3, listen=hidden_topology)

# Reduce retry limit to simulate high-contention pressure
sim.update(RATE=54, MAX_RETRY=4)

# Run simulation
drop_rate, ratio, throughput = sim.run()

print(f"Hidden Terminal Scenario:")
print(f"Throughput: {throughput:.2f} Mbps")
print(f"Drop Rate: {drop_rate:.2%}")

🏗️ Architecture

PyWINS follows a modular Three-Layer Architecture:

  1. Core Scheduling Layer: Manages the global event queue and system clock advancement.
  2. Network Entity Layer: Handles Node Finite State Machines (FSM) and protocol decision-making.
  3. Physical Environment Layer: Manages logical connectivity and interference relationships.

📄 License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pywins-0.1.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pywins-0.1.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file pywins-0.1.0.tar.gz.

File metadata

  • Download URL: pywins-0.1.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.0

File hashes

Hashes for pywins-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bceca2e2b2a0812203e5c0e2a01b421b33711511bc4657a92e99bbf2f33b8535
MD5 5ac136992e6dc9139962f579bbd13c86
BLAKE2b-256 ed5f61f85aef55b1774bc539808e3919314eb05522917127321dcc19496eee59

See more details on using hashes here.

File details

Details for the file pywins-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pywins-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.0

File hashes

Hashes for pywins-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6483ce86d2f16decdcb6ab8cc21cb0dc8de5c2028f6165e502bc35cbda1919e4
MD5 76e1146c09b55553fd5c581affbc2c9b
BLAKE2b-256 8d0e9e03c58ce49bf5836af21579e883145c4330e394d02c49d6e4b456356143

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page