<p>Vadim Yanitskiy <strong>merged</strong> this change.</p><p><a href="https://gerrit.osmocom.org/12181">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Jenkins Builder: Verified
Pau Espin Pedrol: Looks good to me, approved
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">trx_toolkit/burst_fwd.py: document and refactor BurstForwarder<br><br>Instead of having all configuration variables of BurstForwarder<br>initialized in the class heading, let's introduce two functions<br>for initialization (resetting to defaults) of both UL/DL params.<br>This would allow to reset a BurstForwarder instance from the<br>control interface in follow-up patches.<br><br>Let's also introduce some basic documentation for the class<br>fields, which were defined in the heading previously.<br><br>Change-Id: I6b1bf41cf22f01a7e7ecc91c625fb0d2bf4bfeac<br>---<br>M src/target/trx_toolkit/burst_fwd.py<br>1 file changed, 117 insertions(+), 39 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/target/trx_toolkit/burst_fwd.py b/src/target/trx_toolkit/burst_fwd.py</span><br><span>index 3834849..f3eeddd 100644</span><br><span>--- a/src/target/trx_toolkit/burst_fwd.py</span><br><span>+++ b/src/target/trx_toolkit/burst_fwd.py</span><br><span>@@ -4,7 +4,7 @@</span><br><span> # TRX Toolkit</span><br><span> # BTS <-> BB burst forwarding</span><br><span> #</span><br><span style="color: hsl(0, 100%, 40%);">-# (C) 2017 by Vadim Yanitskiy <axilirator@gmail.com></span><br><span style="color: hsl(120, 100%, 40%);">+# (C) 2017-2018 by Vadim Yanitskiy <axilirator@gmail.com></span><br><span> #</span><br><span> # All Rights Reserved</span><br><span> #</span><br><span>@@ -27,58 +27,136 @@</span><br><span> from data_msg import *</span><br><span> </span><br><span> class BurstForwarder:</span><br><span style="color: hsl(0, 100%, 40%);">- # Timeslot filter (drop everything by default)</span><br><span style="color: hsl(0, 100%, 40%);">- ts_pass = None</span><br><span style="color: hsl(120, 100%, 40%);">+ """ Performs burst forwarding and preprocessing between MS and BTS.</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- # Freq. filter</span><br><span style="color: hsl(0, 100%, 40%);">- bts_freq = None</span><br><span style="color: hsl(0, 100%, 40%);">- bb_freq = None</span><br><span style="color: hsl(120, 100%, 40%);">+ == Pass-filtering parameters</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- # Randomization of RSSI</span><br><span style="color: hsl(0, 100%, 40%);">- randomize_dl_rssi = False</span><br><span style="color: hsl(0, 100%, 40%);">- randomize_ul_rssi = False</span><br><span style="color: hsl(120, 100%, 40%);">+ BurstForwarder may drop or pass an UL/DL burst depending</span><br><span style="color: hsl(120, 100%, 40%);">+ on the following parameters:</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- # Randomization of ToA</span><br><span style="color: hsl(0, 100%, 40%);">- randomize_dl_toa256 = False</span><br><span style="color: hsl(0, 100%, 40%);">- randomize_ul_toa256 = False</span><br><span style="color: hsl(120, 100%, 40%);">+ - bts_freq / bb_freq - the current BTS / MS frequency</span><br><span style="color: hsl(120, 100%, 40%);">+ that was set using RXTUNE control command. By default,</span><br><span style="color: hsl(120, 100%, 40%);">+ both freq. values are set to None, so nothing is being</span><br><span style="color: hsl(120, 100%, 40%);">+ forwarded (i.e. bursts are getting dropped).</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- # Timing Advance value indicated by MS (0 by default)</span><br><span style="color: hsl(0, 100%, 40%);">- # Valid range: 0..63, where each unit means</span><br><span style="color: hsl(0, 100%, 40%);">- # one GSM symbol advance.</span><br><span style="color: hsl(0, 100%, 40%);">- ta = 0</span><br><span style="color: hsl(120, 100%, 40%);">+ FIXME: currently, we don't care about TXTUNE command</span><br><span style="color: hsl(120, 100%, 40%);">+ and transmit frequencies. It would be great to distinguish</span><br><span style="color: hsl(120, 100%, 40%);">+ between RX and TX frequencies for both BTS and MS.</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- # Timing of Arrival values indicated by transceiver</span><br><span style="color: hsl(0, 100%, 40%);">- # in units of 1/256 of GSM symbol periods. A pair of</span><br><span style="color: hsl(0, 100%, 40%);">- # base and threshold values defines a range of ToA value</span><br><span style="color: hsl(0, 100%, 40%);">- # randomization: from (base - threshold) to (base + threshold).</span><br><span style="color: hsl(0, 100%, 40%);">- toa256_dl_base = 0</span><br><span style="color: hsl(0, 100%, 40%);">- toa256_ul_base = 0</span><br><span style="color: hsl(120, 100%, 40%);">+ - ts_pass - currently active timeslot, configured by the MS.</span><br><span style="color: hsl(120, 100%, 40%);">+ It can be activated or deactivated using SETSLOT control</span><br><span style="color: hsl(120, 100%, 40%);">+ command from the MS.</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- toa256_dl_threshold = 128</span><br><span style="color: hsl(0, 100%, 40%);">- toa256_ul_threshold = 128</span><br><span style="color: hsl(120, 100%, 40%);">+ FIXME: only a single timeslot can be activated!</span><br><span style="color: hsl(120, 100%, 40%);">+ FIXME: there is no such list for the BTS side.</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- # RSSI values indicated by transceiver in dBm.</span><br><span style="color: hsl(0, 100%, 40%);">- # A pair of base and threshold values defines a range of RSSI</span><br><span style="color: hsl(0, 100%, 40%);">- # randomization: from (base - threshold) to (base + threshold).</span><br><span style="color: hsl(0, 100%, 40%);">- rssi_dl_base = -60</span><br><span style="color: hsl(0, 100%, 40%);">- rssi_ul_base = -70</span><br><span style="color: hsl(120, 100%, 40%);">+ == Preprocessing and measurement simulation</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- rssi_dl_threshold = 10</span><br><span style="color: hsl(0, 100%, 40%);">- rssi_ul_threshold = 5</span><br><span style="color: hsl(120, 100%, 40%);">+ Since this is a virtual environment, we can simulate different</span><br><span style="color: hsl(120, 100%, 40%);">+ parameters of a virtual RF interface:</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- # Path loss simulation: DL/UL burst dropping</span><br><span style="color: hsl(0, 100%, 40%);">- # Indicates how many bursts should be dropped</span><br><span style="color: hsl(0, 100%, 40%);">- # and which dropping period is used. By default,</span><br><span style="color: hsl(0, 100%, 40%);">- # period is 1, i.e. every burst (fn % 1 is always 0)</span><br><span style="color: hsl(0, 100%, 40%);">- burst_dl_drop_amount = 0</span><br><span style="color: hsl(0, 100%, 40%);">- burst_ul_drop_amount = 0</span><br><span style="color: hsl(0, 100%, 40%);">- burst_dl_drop_period = 1</span><br><span style="color: hsl(0, 100%, 40%);">- burst_ul_drop_period = 1</span><br><span style="color: hsl(120, 100%, 40%);">+ - ToA (Timing of Arrival) - measured difference between expected</span><br><span style="color: hsl(120, 100%, 40%);">+ and actual time of burst arrival in units of 1/256 of GSM symbol</span><br><span style="color: hsl(120, 100%, 40%);">+ periods. A pair of both base and threshold values defines a range</span><br><span style="color: hsl(120, 100%, 40%);">+ of ToA value randomization:</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ DL: from (toa256_dl_base - toa256_dl_threshold)</span><br><span style="color: hsl(120, 100%, 40%);">+ to (toa256_dl_base + toa256_dl_threshold),</span><br><span style="color: hsl(120, 100%, 40%);">+ UL: from (toa256_ul_base - toa256_ul_threshold)</span><br><span style="color: hsl(120, 100%, 40%);">+ to (toa256_ul_base + toa256_ul_threshold).</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ - RSSI (Received Signal Strength Indication) - measured "power" of</span><br><span style="color: hsl(120, 100%, 40%);">+ the signal (per burst) in dBm. A pair of both base and threshold</span><br><span style="color: hsl(120, 100%, 40%);">+ values defines a range of RSSI value randomization:</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ DL: from (rssi_dl_base - rssi_dl_threshold)</span><br><span style="color: hsl(120, 100%, 40%);">+ to (rssi_dl_base + rssi_dl_threshold),</span><br><span style="color: hsl(120, 100%, 40%);">+ UL: from (rssi_ul_base - rssi_ul_threshold)</span><br><span style="color: hsl(120, 100%, 40%);">+ to (rssi_ul_base + rssi_ul_threshold).</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ Please note that the randomization of both RSSI and ToA</span><br><span style="color: hsl(120, 100%, 40%);">+ is optional, and should be enabled manually.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ === Timing Advance handling</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ The BTS is using ToA measurements for UL bursts in order to calculate</span><br><span style="color: hsl(120, 100%, 40%);">+ Timing Advance value, that is then indicated to a MS, which in its turn</span><br><span style="color: hsl(120, 100%, 40%);">+ shall apply this value to the transmitted signal in order to compensate</span><br><span style="color: hsl(120, 100%, 40%);">+ the delay. Basically, every burst is transmitted in advance defined by</span><br><span style="color: hsl(120, 100%, 40%);">+ the indicated Timing Advance value. The valid range is 0..63, where</span><br><span style="color: hsl(120, 100%, 40%);">+ each unit means one GSM symbol advance. The actual Timing Advance value</span><br><span style="color: hsl(120, 100%, 40%);">+ is set using SETTA control command from MS. By default, it's set to 0.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ === Path loss simulation - burst dropping</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ In some cases, e.g. due to a weak signal or high interference, a burst</span><br><span style="color: hsl(120, 100%, 40%);">+ can be lost, i.e. not detected by the receiver. This can also be</span><br><span style="color: hsl(120, 100%, 40%);">+ simulated using FAKE_DROP command on both control interfaces:</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ - burst_{dl|ul}_drop_amount - the amount of DL/UL bursts</span><br><span style="color: hsl(120, 100%, 40%);">+ to be dropped (i.e. not forwarded towards the MS/BTS),</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ - burst_{dl|ul}_drop_period - drop every X DL/UL burst, e.g.</span><br><span style="color: hsl(120, 100%, 40%);">+ 1 - drop every consequent burst, 2 - drop every second burst, etc.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ """</span><br><span> </span><br><span> def __init__(self, bts_link, bb_link):</span><br><span> self.bts_link = bts_link</span><br><span> self.bb_link = bb_link</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ # Randomization of RSSI</span><br><span style="color: hsl(120, 100%, 40%);">+ randomize_dl_rssi = False</span><br><span style="color: hsl(120, 100%, 40%);">+ randomize_ul_rssi = False</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ # Randomization of ToA</span><br><span style="color: hsl(120, 100%, 40%);">+ randomize_dl_toa256 = False</span><br><span style="color: hsl(120, 100%, 40%);">+ randomize_ul_toa256 = False</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ # Init default parameters</span><br><span style="color: hsl(120, 100%, 40%);">+ self.reset_dl()</span><br><span style="color: hsl(120, 100%, 40%);">+ self.reset_ul()</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ # Initialize (or reset to) default parameters for Downlink</span><br><span style="color: hsl(120, 100%, 40%);">+ def reset_dl(self):</span><br><span style="color: hsl(120, 100%, 40%);">+ # Unset current DL freq.</span><br><span style="color: hsl(120, 100%, 40%);">+ self.bts_freq = None</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ # Indicated RSSI / ToA values</span><br><span style="color: hsl(120, 100%, 40%);">+ self.toa256_dl_base = 0</span><br><span style="color: hsl(120, 100%, 40%);">+ self.rssi_dl_base = -60</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ # RSSI / ToA randomization threshold</span><br><span style="color: hsl(120, 100%, 40%);">+ self.toa256_dl_threshold = 0</span><br><span style="color: hsl(120, 100%, 40%);">+ self.rssi_dl_threshold = 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ # Path loss simulation (burst dropping)</span><br><span style="color: hsl(120, 100%, 40%);">+ self.burst_dl_drop_amount = 0</span><br><span style="color: hsl(120, 100%, 40%);">+ self.burst_dl_drop_period = 1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ # Initialize (or reset to) default parameters for Uplink</span><br><span style="color: hsl(120, 100%, 40%);">+ def reset_ul(self):</span><br><span style="color: hsl(120, 100%, 40%);">+ # Unset current DL freq.</span><br><span style="color: hsl(120, 100%, 40%);">+ self.bb_freq = None</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ # Indicated RSSI / ToA values</span><br><span style="color: hsl(120, 100%, 40%);">+ self.rssi_ul_base = -70</span><br><span style="color: hsl(120, 100%, 40%);">+ self.toa256_ul_base = 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ # RSSI / ToA randomization threshold</span><br><span style="color: hsl(120, 100%, 40%);">+ self.toa256_ul_threshold = 0</span><br><span style="color: hsl(120, 100%, 40%);">+ self.rssi_ul_threshold = 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ # Path loss simulation (burst dropping)</span><br><span style="color: hsl(120, 100%, 40%);">+ self.burst_ul_drop_amount = 0</span><br><span style="color: hsl(120, 100%, 40%);">+ self.burst_ul_drop_period = 1</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ # Init timeslot filter (drop everything by default)</span><br><span style="color: hsl(120, 100%, 40%);">+ self.ts_pass = None</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ # Reset Timing Advance value</span><br><span style="color: hsl(120, 100%, 40%);">+ self.ta = 0</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> # Converts TA value from symbols to</span><br><span> # units of 1/256 of GSM symbol periods</span><br><span> def calc_ta256(self):</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/12181">change 12181</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/12181"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: osmocom-bb </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I6b1bf41cf22f01a7e7ecc91c625fb0d2bf4bfeac </div>
<div style="display:none"> Gerrit-Change-Number: 12181 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Vadim Yanitskiy <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder (1000002) </div>
<div style="display:none"> Gerrit-Reviewer: Pau Espin Pedrol <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Vadim Yanitskiy <axilirator@gmail.com> </div>