From a0b6f4484f18df758e30c9d85e78f0daa6889948 Mon Sep 17 00:00:00 2001 From: Shoichi Sakane Date: Tue, 26 Sep 2017 07:57:29 +0900 Subject: [PATCH] enable to show the MAC frame data rate. --- README.md | 25 +++++++++++++++---------- lorawan_toa.py | 19 ++++++++++--------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 4ffb20a..20dcb58 100644 --- a/README.md +++ b/README.md @@ -33,16 +33,21 @@ The default value is aligned to LoRaWAN AS923. ## Examples - % python lorawan_toa.py -v 12 64 - PHY payload size : 64 Bytes - MAC payload size : 59 Bytes - Spreading Factor : 12 - Band width : 125 kHz - Low data rate opt.: enable - Explicit header : enable - CR (coding rate) : 1 (4/5) - Preamble size : 8 symbols - Time on Air : 2793.472 msec +with the -v option, it shows the ToA as well as the related information. + + % python lorawan_toa.py 12 64 -v + PHY payload size : 64 Bytes + MAC payload size : 59 Bytes + Spreading Factor : 12 + Band width : 125 kHz + Low data rate opt. : enable + Explicit header : enable + CR (coding rate) : 1 (4/5) + Preamble size : 8 symbols + Time on Air : 2793.472 msec + MAC frame data rate : 63.998 bps + +without the -v option, it simply shows the ToA. % python lorawan_toa.py --band-width=500 7 128 71.744 diff --git a/lorawan_toa.py b/lorawan_toa.py index 49eab31..b66b83f 100644 --- a/lorawan_toa.py +++ b/lorawan_toa.py @@ -95,14 +95,15 @@ if __name__ == "__main__" : disable_h=opt.v_h, n_cr=opt.n_cr, n_preamble=opt.n_preamble) if opt.f_verbose: - print "PHY payload size : %d Bytes" % opt.n_size - print "MAC payload size : %d Bytes" % (opt.n_size-5) - print "Spreading Factor : %d" % opt.n_sf - print "Band width : %d kHz" % opt.n_bw - print "Low data rate opt.: %s" % ("enable" if opt.v_de else "disable") - print "Explicit header : %s" % ("disable" if opt.v_h else "enable") - print "CR (coding rate) : %d (4/%d)" % (opt.n_cr, 4+opt.n_cr) - print "Preamble size : %d symbols" % opt.n_preamble - print "Time on Air : %.3f msec" % t_frame + print "PHY payload size : %d Bytes" % opt.n_size + print "MAC payload size : %d Bytes" % (opt.n_size-5) + print "Spreading Factor : %d" % opt.n_sf + print "Band width : %d kHz" % opt.n_bw + print "Low data rate opt. : %s" % ("enable" if opt.v_de else "disable") + print "Explicit header : %s" % ("disable" if opt.v_h else "enable") + print "CR (coding rate) : %d (4/%d)" % (opt.n_cr, 4+opt.n_cr) + print "Preamble size : %d symbols" % opt.n_preamble + print "Time on Air : %.3f msec" % t_frame + print "MAC frame data rate : %.3f bps" % (opt.n_size-5 / t_frame) else: print "%.3f" % t_frame