Discrete Event Simulator Usage Guide
The discrete-event simulator mimics the radio section of the device software. It is currently based on Meshtastic 2.1.
Usage
Please git clone
or download this repository, navigate to the Meshtasticator folder (optionally create a virtual environment), and install the necessary requirements using:
pip install -r requirements.txt
To start one simulation with the default configurations, run:
python3 loraMesh.py [nr_nodes]
If no argument is given, you first have to place the nodes on a plot. After you place a node, you can optionally set the node as a Router, change its hop limit, height (elevation), and antenna gain. These settings will automatically save when you place a new node or when you start the simulation.
If the number of nodes is given, it will randomly place nodes in the area. It ensures that each node can reach at least one other node. Furthermore, all nodes are placed at a configurable minimum distance (MINDIST) from each other.
If you placed the nodes yourself, after a simulation the number of nodes, their coordinates, and configuration are automatically saved, and you can rerun the scenario with:
python3 loraMesh.py --from-file
If you want to change any of the configurations, adapt the file out/nodeConfig.yaml before running it with the above command.
For running multiple repetitions of simulations for a set of parameters, e.g., the number of nodes, run:
python3 batchSim.py
After the simulations are done, it plots relevant metrics obtained from the simulations. It saves these metrics in /out/report/ for analysis later on. See plotExample.py for an example Python script to plot the results.
To simulate different parameters, you will have to change the batchSim.py script yourself.
Custom configurations
Here we list some of the configurations, which you can change to model your scenario in /lib/config.py. These apply to all nodes, except those that you configure per node when using the plot.
Modem
The LoRa modem (see Meshtastic radio settings) that is used, as defined below:
Modem | Name | Bandwidth (kHz) | Coding rate | Spreading Factor | Data rate (kbps) |
---|---|---|---|---|---|
0 | Short Fast | 250 | 4/8 | 7 | 6.8 |
1 | Short Slow | 250 | 4/8 | 8 | 3.9 |
2 | Mid Fast | 250 | 4/8 | 9 | 2.2 |
3 | Mid Slow | 250 | 4/8 | 10 | 1.2 |
4 | Long Fast | 250 | 4/8 | 11 | 0.67 |
5 | Long Moderate | 125 | 4/8 | 11 | 0.335 |
6 | Long Slow | 125 | 4/8 | 12 | 0.18 |
7 | Very Long Slow | 62.5 | 4/8 | 12 | 0.09 |