(original) (raw)
LoRaSim
NOTE: This website has now been moved to GitHub.LoRaSim is a discrete-event simulator based on SimPy for simulating collisions in LoRa networks and to analyse scalability.
Contents
Do LoRa Low-Power Wide-Area Networks Scale?, Martin Bor, Utz Roedig, Thiemo Voigt, and Juan Alonso, MSWiM 2016.
Mitigating Inter-Network Interference in LoRa Networks, Thiemo Voigt, Martin Bor, Utz Roedig, and Juan Alonso, EWSN 2017.
Download
Download LoRaSim (110 kB, last updated 10 July 2017)
Installation
LoRaSim consist of four Python scripts: loraDir.py, loraDirMulBs.py, directionalLoraIntf.py, and oneDirectionalLoraIntf.py. loraDir.py simulates a single base station, loraDirMulBs.py simulates more than one base station (up to 24), directionalLoraIntf simulates nodes with directional antennae and multiple networks, oneDirectionalLoraIntf.py simulates base stations with directional antennae and mulitple networks. All require the following packages: matplotlib, simpy and numpy.
It is recommend to use virtualenv to keep your Python environment isolated, together with virtualenvwrapper to make working with virtual environments much more pleasant, e.g.:
$ pip install virtualenvwrapper
...
$ export WORKON_HOME=~/.virtualenvs
$ mkdir -p $WORKON_HOME
$ source /usr/local/bin/virtualenvwrapper.sh
$ mkvirtualenv -p python2 lorasimYou can install the required packages using the provided requirements.txt file:
(lorasim)$ pip install -r requirements.txtUsage
All simulators operate mostly in the same way, and take the same parameters. The main difference is that loraDirMulBS.py simulates up to 24 basestations, and xx takes.
Synopsis
./loraDir.py <_NODES_> <_AVGSEND_> <_EXPERIMENT_> <_SIMTIME_> [_COLLISION_]
./loraDirMulBS.py <_NODES_> <_AVGSEND_> <_EXPERIMENT_> <_SIMTIME_> <_BASESTATIONS_> [_COLLISION_]
directionalLoraIntf.py <_NODES_> <_AVGSEND_> <_EXPERIMENT_> <_SIMTIME_> <_BASESTATIONS_> <_COLLISION_> <_DIRECTIONALITY_> <_NETWORKS_> <_BASEDIST_>
oneDirectionalLoraIntf.py <_NODES_> <_AVGSEND_> <_EXPERIMENT_> <_SIMTIME_> <_BASESTATIONS_> <_COLLISION_> <_DIRECTIONALITY_> <_NETWORKS_> <_BASEDIST_>
Description
NODES
number of nodes to simulate.
AVGSEND
average sending interval in milliseconds.
EXPERIMENT
experiment is an integer that determines with what radio settings the simulation is run. All nodes are configured with a fixed transmit power and a single transmit frequency, unless stated otherwise.
0
use the settings with the the slowest datarate (SF12, BW125, CR4/8).
1
similar to experiment 0, but use a random choice of 3 transmit frequencies.
2
use the settings with the fastest data rate (SF6, BW500, CR4/5).
3
optimise the setting per node based on the distance to the gateway.
4
use the settings as defined in LoRaWAN (SF12, BW125, CR4/5).
5
similar to experiment 3, but also optimises the transmit power.
SIMTIME
total running time in milliseconds.
BASESTATIONS
number of base stations to simulate. Can be either 1, 2, 3, 4, 6, 8 or 24.
COLLISION
set to 1 to enable the full collision check, 0 to use a simplified check (default). With the simplified check, two messages collide when they arrive at the same time, on the same frequency and spreading factor. The full collision check considers the ‘capture effect’, whereby one of the two colliding message may still pass depending on the relative timing and difference in receive power.
DIRECTIONALITY
set to 1 to enable directional antennae for nodes.
NETWORKS
number of LoRa networks.
BASEDIST
X-distance between two base stations.
Output
The result of every simulation run will be appended to a file named expX.dat, whereby X is the experiment number. The file contains a space separated table of values for nodes, collisions, transmissions and total energy spent. The data file can be easily plotted using e.g. gnuplot.
Changelog
0.2.1 - 2017-07-10
Fixed
- Use base 10 logarithm instead of natural logarithm for the log-distance path loss model. Thanks to Gopika Premsankar for reporting this bug!
0.2.0 - 2017-05-12
Added
- Support for directional antennae (nodes and basestation).
0.1.1 - 2017-04-07
Fixed
- checkcollision(): return col = 1 when current packets collide in full_collision. Previously, collided packets would be unmarked as collided by the calling function, thereby overestimating the goodput of the network. Thanks to Mariusz Slabicki for reporting this bug!
- Restore graphics for loraDir
- Use raw_input to pause graphics, so it also works on Windows
0.1.0 - 2016-10-17
Initial release.
License & Copyright
LoRaSim - Copyright (c) 2016-2017 Thiemo Voigt and Martin Bor. This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/.
Thiemo Voigt thiemo@sics.se
Martin Bor m.bor@lancaster.ac.uk