aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPiotr Krysik <ptrkrysik@gmail.com>2017-10-19 09:20:23 +0200
committerPiotr Krysik <ptrkrysik@gmail.com>2017-10-19 09:20:23 +0200
commit42b2186b1747150b298cff6db59ccbcc2595a85e (patch)
treec165f76312940c527ebac5a53aff5c6e5bfba25c
parent714cb44959a4e075143bcb1a434603c0869f9796 (diff)
Added timing advance and delay corerrection to txtime_burst_tagger block
-rw-r--r--grc/transmitter/gsm_txtime_bursts_tagger.xml23
-rw-r--r--python/transmitter/txtime_bursts_tagger.py16
2 files changed, 34 insertions, 5 deletions
diff --git a/grc/transmitter/gsm_txtime_bursts_tagger.xml b/grc/transmitter/gsm_txtime_bursts_tagger.xml
index 4012c17..4e42886 100644
--- a/grc/transmitter/gsm_txtime_bursts_tagger.xml
+++ b/grc/transmitter/gsm_txtime_bursts_tagger.xml
@@ -3,8 +3,11 @@
<name>txtime_bursts_tagger</name>
<key>gsm_txtime_bursts_tagger</key>
<import>import grgsm</import>
- <make>grgsm.txtime_bursts_tagger($init_fn, $init_time, $time_hint)</make>
+ <make>grgsm.txtime_bursts_tagger($init_fn, $init_time, $time_hint, $timing_advance, $delay_correction)</make>
+ <callback>set_fn_time_reference($init_fn, $init_time)</callback>
<callback>set_time_hint($time_hint)</callback>
+ <callback>set_timing_advance($timing_advance)</callback>
+ <callback>set_delay_correction($delay_correction)</callback>
<param>
<name>init_fn</name>
@@ -30,14 +33,28 @@
<hide>part</hide>
</param>
+ <param>
+ <name>timing_advance</name>
+ <key>timing_advance</key>
+ <value>0</value>
+ <type>float</type>
+ <hide>part</hide>
+ </param>
+
+ <param>
+ <name>delay_correction</name>
+ <key>delay_correction</key>
+ <value>0</value>
+ <type>float</type>
+ <hide>part</hide>
+ </param>
+
<sink>
<name>fn_time</name>
<type>message</type>
<optional>1</optional>
</sink>
-
-
<sink>
<name>bursts</name>
<type>message</type>
diff --git a/python/transmitter/txtime_bursts_tagger.py b/python/transmitter/txtime_bursts_tagger.py
index 489af2a..a083c48 100644
--- a/python/transmitter/txtime_bursts_tagger.py
+++ b/python/transmitter/txtime_bursts_tagger.py
@@ -30,7 +30,7 @@ class txtime_bursts_tagger(gr.basic_block):
"""
A block that adds txtime metadata to a burst
"""
- def __init__(self, init_fn=0, init_time=0, time_hint=None):
+ def __init__(self, init_fn=0, init_time=0, time_hint=None, timing_advance=0, delay_correction=0):
gr.basic_block.__init__(self,
name="txtime_bursts_tagger",
in_sig=[],
@@ -39,6 +39,9 @@ class txtime_bursts_tagger(gr.basic_block):
if time_hint is not None:
self.set_time_hint(time_hint)
+ self.timing_advance = timing_advance
+ self.delay_correction = delay_correction
+
self.message_port_register_in(pmt.intern("fn_time"))
self.message_port_register_in(pmt.intern("bursts"))
self.message_port_register_out(pmt.intern("bursts"))
@@ -50,7 +53,6 @@ class txtime_bursts_tagger(gr.basic_block):
time_hint = pmt.to_python(pmt.dict_ref(msg, pmt.intern("time_hint"), pmt.PMT_NIL))
fn_time = pmt.to_python(pmt.dict_ref(msg, pmt.intern("fn_time"), pmt.PMT_NIL))
-# if self.fn_ref is None:
if time_hint is not None:
self.time_hint = time_hint
elif fn_time is not None:
@@ -68,10 +70,14 @@ class txtime_bursts_tagger(gr.basic_block):
ts_num = burst_with_header[3]
if self.fn_ref is not None:
fn_delta, txtime = fn_time_delta(self.fn_ref, self.time_ref, fn, self.time_hint, ts_num)
+ txtime_corrected = txtime - self.delay_correction
+ txtime_final = txtime_corrected - self.timing_advance
+
txtime_secs = int(txtime)
txtime_fracs = txtime-int(txtime)
#print "txtime_secs",txtime_secs,"txtime_fracs",txtime_fracs
tags_dict = pmt.dict_add(pmt.make_dict(), pmt.intern("tx_time"), pmt.make_tuple(pmt.from_uint64(txtime_secs),pmt.from_double(txtime_fracs)))
+ tags_dict = pmt.dict_add(tags_dict, pmt.intern("fn"), pmt.from_uint64(fn))
new_msg = pmt.cons(tags_dict, pmt.cdr(msg))
self.message_port_pub(pmt.intern("bursts"), new_msg)
@@ -83,3 +89,9 @@ class txtime_bursts_tagger(gr.basic_block):
def set_time_hint(self, time_hint):
self.time_hint = time_hint
+ def set_delay_correction(delay_correction):
+ self.delay_correction = delay_correction
+
+ def set_timing_advance(timing_advance):
+ self.timing_advance = timing_advance
+