Giter VIP home page Giter VIP logo

lorawan_toa's Introduction

LoRa/LoRaWAN Time on Air calculator

A calculator of the time on air (ToA) of LoRa/LoRaWAN PHY frame in Python.

This script refers to the section 4.1.1.6. LoRa Packet Structure, [SX1276/77/78/79 Datasheet rev.5][http://www.semtech.com/images/datasheet/sx1276.pdf].

The default parameters of the equation is based on LoRaWAN AS923 in the LoRaWAN regional parameters v1.1.

Note

The default value of Explicit Header is enable. It is guessed from the PHY frame format though there is no explit text in the LoRaWAN specification.

The value of LowDataRateOptimization is set automatically when the symbol duration exceeds 16ms. Because the datasheet requires that it must be used when the symbol duration exceeds 16ms. This is the case below:

  • SF=12 and 11 in 125 kHz.
  • SF=12 in 250 kHz.

You can disable this feature by the --disable-auto-ldro option. The LDRO is disabled by default if you disable the auto LDRO. If you want to enable the LDRO, you can specify the --enable-ldro option.

In the downlink stream, the CRC at the tail of the PHY frame is not used. To calculate the ToA for the downlink stream, the --downlink option should be specified.

Usage

lorawan_toa.py [-h] [--band-width NUMBER] [--disable-auto-ldro]
               [--enable-ldro] [--disable-eh] [--downlink]
               [--disable-crc] [--cr NUMBER] [--preamble NUMBER]
               [--duty-cycle NUMBER] [-v] [-d]
               SF SIZE

LoRa Time on Air calculator.

positional arguments:
  SF                   Spreading Factor. It should be from 7 to 12.
  SIZE                 PHY payload size in byte. It's equal to the MAC payload
                       + 5.

optional arguments:
  -h, --help           show this help message and exit
  --band-width NUMBER  bandwidth in kHz. default is 125 kHz.
  --disable-auto-ldro  disable the auto LDRO and disable LDRO.
  --enable-ldro        This option is available when the auto LDRO is
                       disabled.
  --disable-eh         disable the explicit header.
  --downlink           disable the CRC field, which is for the LoRaWAN
                       downlink stream.
  --disable-crc        same effect as the --downlink option.
  --cr NUMBER          specify the CR value. default is 1 as LoRaWAN does.
  --preamble NUMBER    specify the preamble. default is 8 for AS923.
  --duty-cycle NUMBER  specify the duty cycle in percentage. default is 1 %.
  -v                   enable verbose mode.
  -d                   increase debug mode.

Examples

with the -v option, it shows the ToA as well as the related information. below example, it show detail information in SF 12, 64 bytes of PHY payload, 125 kHz bandwidth, preamble 8.

% python lorawan_toa.py 12 64 -v
PHY payload size    : 16 Bytes
MAC payload size    : 11 Bytes
Spreading Factor    : 7
Band width          : 125 kHz
Low data rate opt.  : disable
Explicit header     : enable
CR (coding rate)    : 1 (4/5)
Symbol Rate         : 976.562 symbol/s
Symbol Time         : 1.024 msec/symbol
Preamble size       : 8 symbols
Packet symbol size  : 38 symbols
Preamble ToA        : 12.544 msec
Payload ToA         : 38.912 msec
Time on Air         : 51.456 msec
Duty Cycle          : 1 %
Min span of a cycle : 5 sec
Max Frames per day  : 16791 frames

without the -v option, it simply shows the ToA.

% python lorawan_toa.py 12 64
2793.472

graph_as923.py

It makes a set of figures about Time on Air and PHYPayload size,
especially LoRaWAN AS923 using matlib like below.

LoRa ToA

lorawan_toa's People

Contributors

tanupoo avatar

Stargazers

Timothy avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.