Skip to main content

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.

Metadata

Release files for PyWINS 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PyWINS 0.1.0
File Size Uploaded Provenance Actions
pywins-0.1.0.tar.gz 6.8 kB Without provenance Details for pywins-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for PyWINS 0.1.0
File Interpreter ABI Platform Actions
pywins-0.1.0-py3-none-any.whl Python 3 none any Details for pywins-0.1.0-py3-none-any.whl

Total release size: 13.7 kB

Release files / pywins-0.1.0.tar.gz

Download URL pywins-0.1.0.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bceca2e2b2a0812203e5c0e2a01b421b33711511bc4657a92e99bbf2f33b8535
BLAKE2b-256 checksum
How to use checksums
ed5f61f85aef55b1774bc539808e3919314eb05522917127321dcc19496eee59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.0

Release files / pywins-0.1.0-py3-none-any.whl

Download URL pywins-0.1.0-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6483ce86d2f16decdcb6ab8cc21cb0dc8de5c2028f6165e502bc35cbda1919e4
BLAKE2b-256 checksum
How to use checksums
8d0e9e03c58ce49bf5836af21579e883145c4330e394d02c49d6e4b456356143
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.0

Security for PyWINS 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page