loraemu

module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2023 License: MIT

README

LoRaEMU

Screenshot

GoDoc

LoRaEMU is a simple LoRa (not LoRaWAN) simulator written in go.

The idea is that for each node (which represents some kind of LoRa device) in the simulation you can connect to that device over websocket. Packets that are sent to the websocket are treated as LoRa packets and handled in the simulator. Any packets that the node receives in the simulation will be sent back over websocket.

Features

  • Uses Log-Distance Path Loss with configurable gamma exponent to simulate dBm path loss between nodes
  • Calculates airtime
  • Detects collisions based on the airtime of sends
  • Detects if a single signal is still strong enough to be received while collision
  • Packets can be received and sent per node via websocket
  • Web view to see a live view of the simulation and edit nodes
  • REST API to fetch and modify nodes on the fly
  • NS-2 mobility file support to dynamically move nodes

Binaries

Check the README.md files of the cli binaries for more information on running LoRaEMU:

  • LoRaEMU: /cmd/emu
  • LoRaEMU Log Inspector: /cmd/log-inspector

Log-Distance Path Loss Model

The model tries to model how radio waves propagate and predicts the path loss based on distance and the gamma value. The gamma value can be used to model certain environmental settings. Examples are:

Environment Gamma Value
Free Space 2
Urban Area Cellular radio 2.7 to 3.5
Shadowed urban cellular radio 3 to 5
In building line of sight 1.6 to 1.8
Obstructed in building 4 to 6
Obstructed in factories 2 to 3

Collisions

If a node receives 2 or more packets at the same time this will result in a collision, which means packet decoding is not possible. The exception is the case of one signal being at least 6dBm stronger than all the other that are received at the time. LoRa can still decode this stronger packet successfully.

WebSocket API

The core of LoRaEMU is the websocket interface. The interface enables external processes to take control of the transmissions of a LoRa node. If your applications want to take part it just needs to connect to the websocket route that matches the target node in the simulation. Any bytes it sends to the websocket will trigger a simulated transmission. If the node would receive any LoRa packets they are sent back over websocket in the form as a JSON RxPacket.

WebSocket Concept

Building All

To build LoRaEMU, it's utilities and the Frontend you need:

  • go (at least 1.18) installed
  • NodeJS with the npm command available

Then run:

./build_all

Directories

Path Synopsis
cmd
emu

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL