A realistic simulation of LoRa (Long Range) wireless communication between two nodes. This tool demonstrates key concepts in wireless networking, packet transmission, error detection, adaptive data rate (ADR), and channel interference modeling.
This simulator can be used for:
- Learning how LoRa works
- Testing network behavior under noise and distance
- Demonstrating understanding of wireless protocols
- Visualizing performance trends using graphs
Each packet includes a CRC32 checksum to validate integrity upon reception.
Signal strength degrades realistically as the distance increases.
Simulates external interference by introducing random corruption.
Automatically adjusts spreading factor based on link quality to optimize throughput or reliability.
Packets are retransmitted up to 3 times if not received correctly.
Run simulations directly from the terminal with customizable parameters.
Visualize how delivery rate changes over distance using matplotlib.
Make sure you have the following installed:
pip install numpy matplotlib💡 Note: Python 3.8+ is recommended.
Runs a default simulation at 3000 meters with 10 packets and SF=10.
python simulator.pyExample with custom settings:
python simulator.py --distance 5000 --packets 15 --sf 9 --noise 0.2Generates a graph showing how delivery rate decreases with increasing distance.
python simulator.py --plot --noise 0.1[Summary]
Packets Sent: 10
Packets Received: 8
Packets Corrupted: 1
Packets Lost: 1
Delivery Rate: 80.00%
| Flag | Full Name | Description | Example |
|---|---|---|---|
-h |
--help |
Show help message and exit | python simulator.py --help |
--distance |
Distance in meters | Simulated distance between sender and receiver | --distance 5000 |
--sf |
Spreading Factor | Initial spreading factor (7–12) | --sf 9 |
--packets |
Number of Packets | Total number of packets to send | --packets 20 |
--noise |
Channel Noise Level | Simulated channel noise [0.0 to 1.0] | --noise 0.3 |
--quiet |
Quiet Mode | Suppress per-packet output | --quiet |
--plot |
Run Distance Sweep | Run simulations at multiple distances | --plot |
# Basic simulation with default settings
python simulator.py
# Custom simulation: 5000m, 15 packets, SF=9, moderate noise
python simulator.py --distance 5000 --packets 15 --sf 9 --noise 0.2
# Plot delivery rate across multiple distances
python simulator.py --plot --noise 0.1