Numerical and Experimental Evaluation of Error Estimation for Two-Way Ranging Methods †

The Two-Way Ranging (TWR) method is commonly used for measuring the distance between two wireless transceiver nodes, especially when clock synchronization between the two nodes is not available. For modeling the time-of-flight (TOF) error between two wireless transceiver nodes in TWR, the existing error model, described in the IEEE 802.15.4-2011 standard, is solely based on clock drift. However, it is inadequate for in-depth comparative analysis between different TWR methods. In this paper, we propose a novel TOF Error Estimation Model (TEEM) for TWR methods. Using the proposed model, we evaluate the comparative analysis between different TWR methods. The analytical results were validated with both numerical simulation and experimental results. Moreover, we demonstrate the pitfalls of the symmetric double-sided TWR (SDS-TWR) method, which is the most highlighted TWR method in the literature because of its highly accurate performance on clock-drift error reduction when reply times are symmetric. We argue that alternative double-sided TWR (AltDS-TWR) outperforms SDS-TWR. The argument was verified with both numerical simulation and experimental evaluation results.


Introduction
The field of localization systems in wireless communications is growing since it enables a wireless mobile node to have both data communication and positioning capabilities. The localization process is typically categorized into two phases: (i) ranging (measurement) phase, during which the distance between the transceivers is measured, and (ii) positioning (location-update) phase, during which the current position of the wireless node is determined using the knowledge from the ranging phase and positioning algorithms [1]. Regarding positioning, besides wireless-only positioning systems, multiple sensor approaches, like diversity navigation, have been proposed as well [1]. In those systems, ranging is supported by using additional information, e.g., from an Inertial Measurement Unit (IMU). In this paper, we focus on the accuracy of wireless ranging based on Ultrawide Bandwidth (UWB), and specifically study different Two-Way Ranging (TWR) methods available in the literature.
TWR plays an important role in measuring the distance between two wireless transceiver devices when clock synchronization is not available or absent in a time-based localization system. By knowing IEEE 802. 15.4 uses clock drifts as the only dominant error to compare TOF errors among different TWR methods [3].
Brief introductions for each of the evaluated TWR methods, which are the single-sided TWR (SS-TWR), (symmetric) DS-TWR, AltDS-TWR, and asymmetric double-sided TWR (ADS-TWR), are presented in this section. These methods were carefully chosen to reflect the general overview of the available TWR methods in the literature. The remaining TWR methods, derived mainly from the presented techniques, are: SDS-TWR with multiple acknowledgments [7], asynchronous double TWR (D-TWR) [8], burst-mode SDS-TWR [9], SDS-TWR with unequal reply-time method [10], TWR using estimated frequency offsets [11], parallel DS-TWR [12], and passive extended DS-TWR [13].

(Simple) SS-TWR
For SS-TWR [3,18] (the shaded area in Figure 1), the round-trip time of the signal can be formulated as: t roundA = 2 T to f + t replyB (1) where t roundA = τ ARx − τ ATx is the true round-trip time of a signal measured at Device A and t replyB = τ BTx − τ BRx is the true reply time of a signal measured at Device B ( Figure 1). τ ATx and τ ARx are the transmitted and received timestamps measured at Device A, and τ BTx and τ BRx are the transmitted and received timestamps measured at Device B, respectively. In particular, the round-trip time of a signal (t roundA ) is measured from the beginning of Device A transmitting the ranging message (τ ATx in Figure 1) until the reception of the replied signal back from Device B (τ ARx in Figure 1). Therefore, the TOF for the SS-TWR method can be obtained as:

SDS-TWR
The round-trip time of double-sided TWR [3,18] (Figure 1) can be formulated as: where t roundA and t roundB are the true round-trip times of a signal measured at Device A and B, respectively. t replyA and t replyB are the true reply times measured at Device A and B, respectively. By combining Equations (3a) and (3b), the resulting TOF for SDS-TWR or DS-TWR can be expressed as: In DS-TWR, the ranging time for a single measurement is approximately less than twice as long as SS-TWR due to the additional reply time, as depicted in Figure 1.

AltDS-TWR
The AltDS-TWR method [4] shares the same core concept as Equations (3a) and (3b) from Section 2.2 ( Figure 1), as follows: However, instead of combining the two equations, the AltDS-TWR method is achieved by multiplying Equations (5a) and (5b) as: t roundA · t roundB = (2 T to f + t replyB ) · (2 T to f + t replyA ) By simplifying the equation, the T to f is obtained as follows: T to f = t roundA · t roundB − t replyA · t replyB t roundA + t replyA + t roundB + t replyB (6) The detailed derivation of the formula can be found in Reference [4].

ADS-TWR
Asymmetric double-sided TWR [19] (Figure 2) can be formulated as follows: By combining Equations (7a) and (7b), the T to f for ADS-TWR can be achieved as: The major motivation behind the implementation of ADS-TWR is to reduce the ranging time of the system while attaining the same performance level as SDS-TWR or AltDS-TWR.

Conventional TOF Error Estimation Approaches
The existing conventional TOF error-estimation approach, i.e., the IEEE 802.15.4-2011 standard [3] (pp. 258-275), is specifically only based on clock-drift error effects in TWR methods. The fundamental model can be simplified as in the following equations according to the method originally proposed in Reference [18] and presented in Reference [3]. Then, the method was later extensively applied and studied in References [4,8,9,19,20]. The corresponding concept is depicted in Figure 1. The representation of the equations is inspired by the work in Reference [4].
wheret roundA andt roundB are the estimated round-trip times of Devices A and B, respectively. t roundA and t roundB are the true round-trip times of Devices A and B, respectively.t replyA andt replyB are the estimated replied times of Devices A and B, respectively. t replyA and t replyB are the true replied times of Devices A and B, respectively. e A and e B are the clock-drift errors introduced by Devices A and B, respectively. It is conventionally assumed that T to f << t replyA or t replyB . The reason is that reply times are in the order of several milliseconds, while T to f is in the order of nanoseconds [3]. Moreover, a linear algebra approach on error analysis of a co-operative position system using GPS and TWR was performed in Reference [21]. The overall concept is interesting because the presented method can be used as a transition system that bridges the localization systems of UWB (indoor) and GPS (outdoor). However, error analysis performed for TWR in the work is too shallow. The authors assumed in their work that, firstly, clock-drift errors are compensated just by using the SDS-TWR method, and secondly, ranging measurement error is purely white Gaussian noises. This assumption is too broad to reflect the actual TOF error in the TWR method. In addition, the error model and protocol specifically for the parallel double-sided TWR (PDS-TWR) method were performed in Reference [12]. The authors clearly sketch the source of error in two phases, namely, the ranging and localization processes, and focused on the former phase. Then, the variation of ranging error upon symmetric and quasisymmetric cases are discussed. It was proven in their work that PDS-TWR outperforms SDS-TWR. However, the error term used in their proposed model is unclear, which is defined as the difference between a duration measured with the PHY of a node and real duration (ppm). In addition, the presented error model is not generic and defined only for PDS-TWR method.

Proposed Analytical Model
In the following, we outline the problem statement and sketch various error sources (Section 3.1). Subsequently, we describe our extended error model (Section 3.2).

Problem Statement
TWR methods are excellent in ranging distances between two wireless transceiver devices without using clock synchronization. However, clock-drift errors in oscillators (e.g., ±20 ppm in the IEEE 802.51.4-2011 standard [3]) degrade their performance. The conventional TOF error approach specifically tackles clock drifts as the only dominant error source in TWR methods.
However, the estimation of T to f in a time-based wireless communication system is fundamentally perturbed by various delay error sources as already mentioned in Section 1. These delay sources, especially for time-based localization schemes, can be categorized as follows: • Propagation-Time Delay (PTD): propagation time is the time required for a message to be transmitted from the transmitter to the receiver in a wireless channel [2]. PTD occurs in two cases: When the direct path signal is completely obstructed or blocked, or when the signal has to traverse through different materials [5]. In other words, PTD occurs when the path of the signal has been reflected or obstructed by obstacles.

•
Transmission-Time Delay (TTD): This is the delay caused by the time required for building a message at the application layer (software), accessing time in the medium access control (MAC) layer (protocol), and transmitting time of the message in the physical (PHY) layer [2,14]. This includes delays introduced by the antenna, PCB, and other external and internal electronic components.

•
Receiving-Time Delay (RTD): The delay caused by the time required for receiving a message at the PHY, MAC, and application layers, similar to transmission-time delay [2,14].

•
Preamble Accumulation-Time Delay (PATD: This is the time required for detecting a certain preamble sequence and finding the start-frame delimiter (SFD) sequence in the PHY layer [22], especially when a coherent receiver [23] is used in the system. PATD is influenced by the presence of a multipath [24] and quick frame arrival time [3] (pp. 261-263) because of a relatively short distance measurement [22] (p. 32). It is more significant when the reflected signal arrives within the chip period of the first path signal [24].
For the sake of simplicity without loss of generality, the mentioned delay errors for T to f estimation in wireless communication systems can be modeled as a simple linear equation. For a single round-trip time in the SS-TWR technique (Figure 1), the total round-trip time delay can be formulated as: Delay i (10) where ∆ ABA is the total delay that occurred within a single round-trip-time of a signal in the TWR method measured at Device A ( Figure 1). That is, the total delay produced by a signal transmitted from Device A to B and back to Device A. The Delay can be one or more of the previously mentioned individual delays, which are TTD, PTD, PATD, and RTD. The total number of delays that could affect the mentioned round-trip delay error in the SS-TWR method is given as n (10). Note that the constant "2" in Equation (10) appears to represent the two-way traveling routes of a signal in the SS-TWR method for a single measurement. Here, it is assumed that the delays produced in the first route (Device A to B) and the second route (Device B to A) are the same. Regarding this, the absolute error and relative error for the above-mentioned total delay in the single round-trip-time of TWR (shaded area in Figure 1) can be calculated as follows [25] (p. 62): = estimated value − exact value =t roundA − t roundA (11) ξ = absolute error exact value = t roundA =t roundA − t roundA t roundA (12) where and ξ are the absolute error and relative error of the above-mentioned delay (∆ ABA ).
Assuming that the absolute error is only affected by the above-mentioned delay (∆ ABA ) in the measurement, the estimated round-trip-time for SS-TWR becomest roundA = t roundA + ∆ ABA . By substituting this value into Equation (12), the relative error for the total delay within the single-round-trip time of SS-TWR can be represented as: where ξ ABA is the relative error of the total delay in a single-round-trip time of a signal in SS-TWR method measured at Device A (shaded area in Figure 1). If there is absolutely no delay (∆ ABA = 0) between the two transceivers in the SS-TWR method, the corresponding relative error upon round-trip time delay (ξ ABA ) equals zero. Otherwise, the round-trip time delay (ξ ABA ) is the relative error achieved from the summation of all related delays along the path. Correspondingly, relative delay errors for the DS-TWR method are ξ BAB and ξ ABA .

Proposed TOF Error-Estimation Model
As it is explained in Section 3.1, our proposed model is based on both clock-drift error and the relative error in a round-trip time delay. The analytical formulas for the proposed TOF error-estimation model are provided as follows, in reference to Figure 1: where ξ ABA and ξ BAB (as introduced in Section 3.1) represent the delay defined as the relative error in the single round-trip time of a signal measured at Device A or B respectively.
Since ξ ABA and ξ BAB represent the relative error of the total delay within a single round trip of a TWR system, it is sufficient that their effects are represented in the estimated round-trip time (t roundA Equation (14a) andt roundB ) alone as provided in Equations (14a) and (14c). Therefore, the estimated reply time (t replyA andt replyB ) can stay unchanged as in the conventional clock-drift error approach (Section 2.5).
It should be noted that ξ ABA and ξ BAB in Equations (14a) and (14c), defined in Section 3.1, are completely different parameters from clock-drift errors e A and e B , which are susceptible to the finite crystal tolerance of the clock oscillators [3].

Extended State-of-the-Art TWR Methods
In this section, we compare the proposed and conventional TOF error-estimation models on the evaluated four TWR methods.

Extended SS-TWR Method
By using Equation (2), the estimated TOF for the SS-TWR method can be written as: whereT to f is the estimated TOF in the system. The difference between the estimated and true TOF for SS-TWR is: By applying Equations (14a) and (14d), the equation becomes: Substituting t roundA with Equation (1) yields: This leads to the TOF error for SS-TWR as: For the sake of comparison, the TOF error for SS-TWR using the conventional approach from Equations (9a) and (9d) is:T It should be noted that our model Equation (15) reduces to conventional Model Equation (16), if ξ ABA = 0.

Extended SDS-TWR Method
Similar to Section 4.1, if Equation (4) is applied in the proposed error model from Equations (14a)-(14d), and by replacing t roundA and t roundB with Equations (3a) and (3b), the TOF error between the estimated and the true value for SDS-TWR becomes: For the sake of comparison, the conventional model for TOF error in the SDS-TWR method using Equations (9a)-(9d) is: Again, Equation (17) reduces to (18), if there is no delay in message delivery.

Extended AltDS-TWR Method
By applying Equation (6) into the proposed error model from Equations (14a)-(14d), and by assuming T to f << t replyA (or) t replyB (Section 5.1), the TOF error between the estimated and the true value for AltDS-TWR becomes:T where C 1 = ξ BAB (1 + e A ) + ξ ABA (1 + e B ) + ξ BAB ξ ABA , C 2 = 2 + e A + e B + ξ BAB and C 3 = 2 + e A + e B + ξ ABA . The formula derivation is publicly available in Reference [26]. For the sake of comparison, the TOF error for the AltDS-TWR method [4] using the conventional model from Equations (9a)-(9d) is: Again, Equation (19) equals zero if it is assumed that ξ BAB = 0 and ξ ABA = 0. This explains that the actual TOF error is associated only with T to f as in Equation (20). This is because it is assumed that T to f is negligible (T to f << t replyA (or) T to f << t replyB ) when Equation (19) is formulated [26].

Extended ADS-TWR Method
By substituting Equations (14a), (14c) and (14d) in Equation (8), and by replacing the t roundA and t roundB with Equations (7a) and (7b), the TOF error for the ADS-TWR method can be formulated as: For comparison, the TOF error for the ADS-TWR method using the conventional model from Equations (9a), (9c) and (9d) is:

Analytical Comparison of TWR Methods
In this section, we compare the analytical results of TOF error among different TWR methods. To do this, we classify three types of assumptions as defined in Section 5.1.

Error-Model Classification in Three Types
In order to uniformly compare the four evaluated TWR methods, we establish three assumptions (Table 1). In each of the three assumptions, it is assumed that T to f is negligible compared to reply time ( t replyA and t replyB ), i.e., T to f << t reply , t replyA , t replyB . Detailed comparison and discussion upon these three assumptions are addressed in Sections 5.2-5.4. The three types of assumptions (Table 1) are: Type I Assumption: This is an ideal case. Assume T to f << t reply , e A = e B = e = 0, and t replyA = t replyB = t reply . In this assumption, not only are there no clock-drift errors between the two evaluated devices, but reply times are also assumed to be the same.
Type II Assumption: This is a special case. Assume T to f << t reply and t replyA = t replyB = t reply . In this assumption, clock-drift error does exist in the evaluated two devices. However, reply times between them are assumed to be the same.
Type III Assumption: This is a typical case. Assume T to f << t reply and t replyA = t replyB . In this assumption, not only does clock-drift error exist in the evaluated two devices, but also the reply time between them is different.

Comparison of TWR Methods in Ideal Cases (Type I)
According to the Type I assumption, we can conclude that ξ BAB = ξ ABA = ξ. By applying this ideal assumption to Equations (15), (17), (19) and (21), the TOF error between the estimated and true value among TWR methods can be summarized as follows: The TOF error for all methods is now approximated as given in Equation (23). The formula derivation for AltDS-TWR is publicly available in Reference [26].

Comparison of TWR Methods in Special Cases (Type II)
By applying a Type II assumption in Equations (15), (17), (19), and (21), the TOF error between the estimated and true value among TWR methods can be represented as follows: The SS-TWR method becomes: The SDS-TWR method turns into: The AltDS-TWR method is:T The formula derivation is publicly available in Reference [26]. The ADS-TWR method becomes: By comparing Equation (24) to (27), we can conclude that SDS-TWR (25) and AltDS-TWR (26) are superior to SS-TWR (24) and ADS-TWR (27). The reason is that, if ξ BAB = 0 and ξ ABA = 0, the TOF error for SDS-TWR (25) and AltDS-TWR (26) is approximately equal to zero.

Comparison of TWR Methods in Typical Cases (Type III)
By applying a Type III assumption in Equations (15), (17), (19) and (21), the TOF error among the evaluated TWR methods is as follows: The SS-TWR method becomes: The SDS-TWR method turns into: The AltDS-TWR method is:T where The formula derivation is available in Reference [26]. The ADS-TWR method becomes: By comparing Equations (28)-(31), we can conclude that the AltDS-TWR Equation (30) method stands out to be the best choice for minimizing TOF error. This is because the TOF error is approximately equal to zero if it is assumed that there are absolutely no delay errors in the message delivery, i.e., ξ BAB = 0 and ξ ABA = 0.

Numerical Simulation Results
In this section, we present the numerical simulation results of the proposed analytical model given in Section 5. Simulations have been performed upon the parameters, which are clock-drift errors e A and e B , the reply time of responder device (t replyA and t replyB ), and the relative delay error in the round-trip time of a signal (ξ BAB and ξ ABA ), introduced in Section 3.1. The numerical sample values used for the simulations are shown in Table 2. The relative delay error in round-trip time for both transceivers is assumed to be the same, i.e., ξ = ξ BAB = ξ ABA , in the presented simulation results. Moreover, the same random seed value is used for e A and e B throughout the simulations.

Simulation Results for Ideal Cases (Type I)
The ideal condition is the simplest and also the reference case because it defines how the system is expected to behave. From Figure 3, it is observed that TOF error in an ideal case increases monotonically as both round-trip time delay (ξ) and reply time (t reply ) are increased. Moreover, all TWR methods perform equally well in ideal conditions.

Simulation Results for Special Cases (Type II)
A comparison between the TWR methods for special cases (Type II) is illustrated in Figure 4 relative to round-trip time delay (ξ) and reply time (t reply ). Fxed reply time t reply = 490 µs is set in the simulation to match the hardware setup in the experimental evaluation (Section 7). Interestingly, it is evident that the AltDS-TWR method retains the exact same performance as the SDS-TWR method (Figure 4c).
In this special case, both the AltDS-TWR and SDS-TWR method provide numerically stable outputs for TOF error estimation (Figure 4c). In essence, TOF error in all evaluated methods is perpetually increased due to clock drifts as reply time (t reply ) and round-trip time delay (ξ) are increased ( Figure 4).
According to the value of parameters used in the simulation (Table 2), the TOF error for both the SDS-TWR and AltDS-TWR method is less than 1 ns if ξ < 3 ppm and t reply < 650 µs. This corresponds to approximately less than 30 cm error in physical-distance measurement. Under the assumption that the round-trip time delay for both transceivers is symmetric, if ξ can be decreased to 2 ppm, then t reply can be relaxed up to 1 ms without the loss of the above-mentioned accuracy (30 cm). The same principle applies the other way around, too, i.e, decreasing t reply relaxes the increase of ξ.  Table 2); (b) TOF error vs. delay (ξ); and (c) TOF error specifically for SDS-TWR and AltDS-TWR.

Simulation Results for Typical Cases (Type III)
The simulation results for a typical condition (Type III) between the four evaluated TWR methods are provided in Figure 5. Figure 5a compares the performance of the TWR methods when the reply time in Device A (t replyA = 840 µs) is greater than the reply time in Device B (t replyB = 400 µs). In contrast, Figure 5b compares the performance of the TWR methods when the two reply times are in the opposite order (t replyA < t replyB ) by switching the value of the mentioned reply times.  It is evident that the SDS-TWR method suffers severe clock-drift error effects in a typical condition (Type III) when the reply time is asymmetric (Figure 5a-e). However, the AltDS-TWR method still holds a numerically stable result in each evaluation (Figure 5f).
Note that the ADS-TWR and SS-TWR methods rely solely on one-sided reply time (t replyB ). Therefore, the duration of t replyB is crucial for their performance. On the one hand, when t replyB < t replyA , the ADS-TWR method yields a lower TOF error than the SDS-TWR method, while SS-TWR has a fairly comparable result (Figure 5a). On the other hand, when t replyB > t replyA , the performance of the SS-TWR and ADS-TWR methods degrades, while the performance of the SDS-TWR method is unchanged. In this scenario, the TOF error in the SDS-TWR method is lower than both the SS-TWR and ADS-TWR method (Figure 5b). The severity of the TOF error in SDS-TWR increases as the magnitudes of difference between the two reply times increases (Figure 5a-e).

Experimental Evaluation Results
The experimental evaluations of the three TWR methods, namely, SS-TWR, SDS-TWR, and AltDS-TWR, are conducted in this section. Note that the ADS-TWR method is not included in the experimental evaluation because the hardware used in the experiment doesn't support the necessary mechanism for ADS-TWR (Figure 2) at the time of our evaluation, which is the instant reply time in Device A (t replyA = 0) or an autoacknowledgment mechanism in one of the two devices.
This section is categorized into three parts. The first part is the experiment setup, where the hardware and its corresponding configurations used in the evaluation are introduced. In the second part, the experiment results for fixed reply times at different locations (LOS at a hall, a multipath scenario at the corridor in an office building, and close LOS less then 2 m) are expressed. The goal is to clarify the errors caused by the delays (PTD and PATD) as mentioned in Section 3.1. In the third part, comparative analysis between three TWRs is conducted at a fixed location (distance) in the laboratory with varying reply times. The goal is to point out the pitfalls of the SDS-TWR method in a typical case, and to prove that AltDS-TWR holds stable results in each reply-time variation. The test environments where the experimental evaluations presented in this section were conducted are illustrated in Figure 6.

Setup and Data-Collection Process for Experimental Evaluations
For experimental evaluations, we used a DWM1000 module [27] from Decawave as the UWB hardware, and an STM32 development board (NUCLEO-L476RG) from STMicroelectronics as the main microcontroller (MCU). Moreover, the built-in high-speed internal (HSI) clock source (16 MHz) from the MCU was applied to all of the evaluation results presented in this article. No external oscillators were connected to the MCU. The HSI has an accuracy of ±1 % using the factory-trimmed RC oscillator according to the datasheet [28].
Aggregated antenna delay calibration was conducted before measurement according to the procedure and algorithm provided by the manufacturer [29,30]. This aggregated antenna delay corresponds to transmission and receiving time delays (TTD and RTD) of the evaluated hardware described in Section 3.1. Therefore, the remaining error that influences the accuracy of TOF error estimation in our measurement would be PTD and PATD. The results presented in Section 7 are the errors and their corresponding parameters in distance (not in TOF). This is because all of the references used in the experiment are measured in distance, which means that TOF value is already calculated as a distance by multiplying with the speed of light (299,702,547 m s −1 in air).
During measurement, one of the transceivers (Device A in Figure 1) is connected to a computer for logging the data received from the MCU via serial USART port. Two-way ranging software, provided by Decawave for production testing of their evaluation kit (EVK1000), which is available online (https: //www.decawave.com/software/) on Decawave's website, was executed on the two transceivers. The software was modified so that the four periods of time (t roundA , t roundB , t replyA , and t replyB ) were individually logged and saved into a file at each measurement. The above-mentioned time periods from the log file were afterward processed with the TWR formulas provided in Section 2 using Matlab. This ensured that the same raw data (time periods) were used for the three TWRs in the evaluation. For instance, a subset of the four collected time periods, i.e., t roundA and t replyB , was used to study SS-TWR.
All of the reference distances in the evaluation were measured with a laser distance meter, CEM iLDM-150 model (http://www.cem-instruments.in/product.php?pname=iLDM-150), which has an accuracy of ±1.5 mm according to the manufacturer. The hardware configuration of the used UWB module in the experimental evaluations is described in Table 3. Antenna height was 1.06 m in all the experiments reported in this paper. This ensured that the effect of Fresnel zones did not perturb measurement results. For a symmetric condition in special cases (Type II), the hardware for the two transceivers was tuned until the two reply times were approximately equal (symmetric). The histogram of the sample data for symmetric replied time (special case, or Type II) collected from one of our measurements is shown in Figure 7. The figure shows the measured time periods for a single trial conducted roughly around 5 min with an updated rate of 10 Hz. The mean values of the reply times are t replyA = 490.94 µs and t replyB = 491.25 µs (Figure 7 and Table 4). This setting and reply time were used throughout all of the evaluation results presented in this paper for a symmetry case (Type II). For an asymmetric condition in a typical case (Type III), the histogram of the sample data collected from one of our measurement is illustrated in Figure 8. Again, the figure illustrates the measured time periods for a single trial. The mean values of the reply times are t replyA = 836.8 µs, and t replyB = 397.4 µs (Figure 8 and Table 4). Note that this is the default setup (out of the box) achieved from the software provided by Decawave. This setting and reply times are used for the measurement conducted in LOS (hall), multipath (Corridor), and close LOS. However, reply time was varied on one device at each evaluation conducted in Section 7.3 to compare the performance difference between the SDS-and AltDS-TWR methods.  Table 4 represents the sample data of reply times for Types II and III, which were randomly drawn from the measurement conducted in the three categories, at LOS, close LOS, and multipath scenarios. It was confirmed that the magnitude of difference (similarity) between the two reply times (t replyA and t replyB ), which is annotated as root mean square error (RMSE) in Table 4, for the symmetry case (Type II) in all of our measurements was always less than 0.35 µs in average.

Comparative Analysis of Distance Errors in Fixed Reply Times at Different Scenarios
In this subsection, experimental evaluations of three scenarios, that is, close LOS, LOS (Hall), and multipath (Corridor), were conducted to validate the error influenced by the PTD and PATD. The effect of PTD can be seen in the multipath scenario, where measurement was conducted in the corridor of an office building (Section 7.2.1), and in the Non-LOS (NLOS) scenario (Section 7.3.2). In the same way, the effect of PATD can be seen in the close LOS scenario, where measurement was conducted within less than 2 m (Section 7.2.2). The complete detailed report of the three scenarios is presented in Section 7.2.3 (see Table 5 for the special case (Type II) and Table 6 for the typical case (Type III)).

Distance Error Comparison for Types II and III at LOS and Multipath Scenarios
To evaluate the distance error caused by the effect of a multipath signal in TWR, measurement was conducted at different ranges for both an LOS scenario (Figure 6c) where measurement was done in a big hall, and a multipath scenario (Figure 6d) where measurement was conducted in the narrow corridor of an office environment. Note that the UWB signal natively overcomes the multipath effects compared to other narrow-band signals. However, signal disturbance because of multipath effects in UWB is still noticeable in distance error estimation, as is shown in the following paragraphs. Figure 9 depicts the measurement results for the exact same distance (4 m) for two separate scenarios (LOS at hall and multipath at corridor). The first row, Figure 9a-c, illustrates the results achieved from the LOS condition, and the second row, Figure 9d-f, illustrates the results achieved from the multipath scenario.
Furthermore, the measured results for both Type II and III are compared side by side in Figure 9 to clearly see the differentiation between the two cases. It can be seen in the experiment result that SDS and AltDS have approximately the same performance level in the special case (Type II) as already stated in the simulation results (Section 6, see Figure 9a,d). However, a significant variation between SDS and AltDS can be observed in the typical case (Type III) as expected from the simulation results (Section 6, see Figure 9b,e).
Regarding distance error in the TWR approach, it was observed that both SDS and AltDS outperformed SS-TWR with significant distinction in all cases (Figure 9). Particularly for the LOS scenario (first row in Figure 9), the measured distances of both SDS and AltDS were very close to the reference value in Type II (Figure 9a). However, AltDS had the smallest error between the three in the typical case (Figure 9b). In the multipath scenario (second row in Figure 9), the distance error caused by SDS and AltDS was still small compared to that of SS-TWR in the special case (Figure 9d), even though their errors were slightly higher compared with the LOS case (Figure 9a,d). In the typical case (Type III), the figure suggests that SDS had the smallest error beetween the three methods (Figure 9e). This condition is further analyzed for clarity in Section 7.3.  In general, the multipath effect caused a big data shift in all of the measurements for all three of the evaluated methods. This shift can clearly be seen by comparing the empirical cumulative distribution function (eCDF) for the LOS scenario, presented in Figure 9c, and for the multipath scenario, presented in Figure 9f. This corresponds to the contribution of the delay caused by the multipath signal in distance or TOF error estimation as stated in Section 3.1. This delay could be the PTD because of the reflection of the signal as well as the PATD in the case of multiple signals arriving within the chip period of the first path signal, as described in Section 3.1. Figure 9 gives inside knowledge for visualizing the experimental data for the two scenarios (LOS and multipath), specifically measured at true reference 4 m. The complete dataset for Types II and III at different ranges in two scenarios (LOS and multipath) is provided in Figure 10. The data in Figure 10 represent the RMSE, which is the square root of the mean error between the measurement and the true reference of the special and typical cases (Types II and III) for the three evaluated TWR (AltDS, SDS, and SS) at different locations in two scenarios (LOS and multipath).

AltDS
In general, it was observed that the distance error for AltDS was less than 6.43 cm in all of the measurements at both the special case (Type II) and the typical case (Type III) (see the first two columns in Figure 10). Moreover, the measured distance error for all locations in AltDS and SDS was approximately equal in the special case (Type II) (see the first and third columns in Figure 10). Obviously, the largest distance errors in the measurement occurred in SS-TWR ( Figure 10).
In the multipath scenario at Type III (esp. 4, 8, and 12 m), the figure suggests that the distance error in SDS provides the smallest among the three evaluated methods (the fourth column in Figure 10). This happens because of the chosen fixed reply time (t replyA = 836.8 µs and t replyB = 397.4 µs) for a typical case in this particular multipath condition. The issue is further clarified by varying the reply time of one device using different values in the measurement (see Section 7.3).

Distance Error Comparison for Types II and III at a Close LOS Scenario
To evaluate the PATD effect, measurement for close LOS (measured distances range from 0.25 up to 2 m) was conducted at one of the CITEC laboratories, Bielefeld University (Figure 6b). PATD occurrence is significant in close LOS, especially when a coherent receiver architecture is used in the hardware [22]. The reason is that a sequence of preamble code is necessary to synchronize in the physical layer before data communication between transceivers can be started using the property of perfect periodic autocorrelation [3,22]. Moreover, most of the commercially available UWB hardware modules, including DWM1000, used in this evaluation are based on a coherent receiver structure. In this experiment evaluation, preamble sequence code index no. 3 was used, which has the code sequence pattern of "− + 0 + +000 − + − + + 00 + +0 + 00 − 0000 − 0 + 0−" according to References [3,22] (p. 203). This sequence is regarded as a short one in UWB configurations. It is expected that, the longer the code sequence is, the more likely to have severe error in close LOS measurement. The reason is that the base symbol rate for the synchronization header is proportional to the preamble symbol transmission rate [3] (pp. 200-207). This means that the longer the preamble length is, the longer it takes to detect the start of frame delimiter (SFD) during accumulation time.
Regarding this, data visualization using boxplots for Types II and III at a true reference of 0.5, 1.0, and 1.5 m is presented in Figure 11. The RMSE regarding measured distance error for the three evaluated TWRs in Types II and III, conducted at close LOS, is provided in Figure 12.   In general, a significantly high rate of outliers (symbolized with red plus signs) is presented in the data of measurement results less than 0.75 m (see the sample data measured at 0.5 m (Figure 11a,d).
It can also be seen that the measured SDS data relatively skew at a 0.5 m reference (Figure 11d). The contribution of outliers in the data decreases as the true-reference distances between the two transceivers increase. Specifically, the RMSE for all TWRs in both cases was roughly greater than 11 cm at reference distances less than 0.75 m (first three rows in Figure 12). Moreover, it can be stated (for this particular UWB setup) that the effect of the PATD on the LOS condition decreases, starting from 1.5 m of the true reference (last three rows in Figure 12). In this case, the measured RMSE for AltDS (both Type II and Type III) and SDS (Type II) is always less than 5 cm. The transition phase (RMSE between 5 and 10 cm) can be spotted in the measured results at the true reference of somewhere between 0.75 and 1.5 m.

Detailed Summary of Experiment Results for Fixed Reply Time
The detailed summary of the measurement results reported in Section 7.2.1 and 7.2.2 is expressed in Table 5 (Type II) and Table 6 (Type III). The smallest value between the three methods is presented in bold in the tables. Two numbers less than 0.02 cm apart were considered equal. It is interesting to observe that the data spread (the difference between maximum and minimum values in the recorded data) in the symmetry case (Type II) was less than 10 cm for both SDS and AltDS when measured in the LOS scenario (rows of "LOS" and columns of "Spread of data" in Table 5). That is the best-case scenario spotted in the measurement. In fact, this condition matches the reported precision range of the manufacturer, i.e., 10 cm. In the worst-case scenario, the data spread reaches up to 41.23 cm in both AltDS and SDS TWRs, while it reaches up to 54.54 cm in SS-TWR. As a whole, the spread of data generally increased in the typical case (Type III) (see Tables 5 and 6). Moreover, the measured data were also spread wider, in general, in both the multipath and the close LOS scenario (Tables 5 and 6).

Comparative Analysis of Distance Error in Variable Reply Times at a Fixed Distance
This section mainly focuses on comparative analysis between AltDS and SDS TWR (Section 7.3.1). The goal is to demonstrate SDS pitfalls with an experimental evaluation. At the same time, it also aims to prove, with experiment results, the efficiency of the AltDS method in a typical case when reply times are varied. Additionally, the effects of NLOS on distance error are also reported in Section 7.3.2 to assure the influence of PTD on the measurement.

Distance Error Analysis between SDS and AltDS at Fixed Reference
A total of ten trials for variable reply times with the magnitude of difference between the two reply times (t replyA and t replyB ) starting from 0.0003 (symmetry case) up to 4.2 ms are provided in (Table 7). The first four trials from Table 7 are illustrated in Figure 13 to visualize the data for better analysis. Note that only one of the two reply times, specifically, t replyA , is varied in the experiment by manipulating the value of delays on the ranging software (see Columns 6 and 7 from Table 7, denoted as "Reply Time (ms)").
The symmetry case is again evaluated in this scenario as provided in Trial 1 to demonstrate comparative analysis between the special case (Type II) and typical case (Type III). In the symmetry case, both AltDS and SDS had identical performance level and the RMSE in distance estimation was also the same in this particular experiment, with an exact value of 3.44 cm ( Figure 13 and the first-row in Table 7). A similar result was already reported in Section 7.2. However, distance error using SS-TWR is significantly higher than both of AltDS and SDS. Figure 13 also clearly demonstrates the pitfall of SDS-TWR, frequently mentioned throughout this article. As the name symmetric is applied in the method itself, a very small error occurs in SDS when the two reply times are exactly the same (Trial 1 in Figure 13). Moreover, we witnessed that SDS is comparable to AltDS in the symmetry case. Note that it rarely happens to have a symmetric reply time in a real-world situation. In this experiment, the two reply times (t replyA and t replyB ) were tuned to the software until they approximately had the same value (see the tuned value of their magnitude of difference (t replyA − t replyB )) in Table 7 ( second column), which had 0.0003 ms in symmetry case (first row). When symmetry in the reply time is broken down, SDS encounters significant distance error. The severity in error monotonously increases as the difference between the reply times (t replyA − t replyB ) increases ( Figure 13 and Table 7). Distance error even reaches 50.75 cm when the the magnitude of difference between the two reply times (t replyA − t replyB ) is 4.24 ms (last row in Table 7).  It is interesting to observe that variation in the reply time (t repyA and t replyB ) does not affect distance error in the AltDS-TWR method. The consistency in distance error using AltDS-TWR across several trials is illustrated in Figure 13, and the exact numerical values are provided in Table 7. The distance error in RMSE for AltDS-TWR ranges in a consistent manner throughout the measurement. The exact value of RMSE varies from 2.74 to 3.72 cm, which is very small, when the magnitude of difference between reply times (t replyA − t replyB ) varied between 0.0003 and 4.24 ms (Table 7). This proves the consistency of distance estimation in AltDS-TWR, which is very useful for multiple application areas. For instance, the presented delay could be thought of as a nondeterministic sensor-data reading and processing time in body area network application, where both positioning and sensor data are necessary to be loaded onto the payload of the UWB MAC layer protocol. Regarding the SS-TWR, it can be examined that distance error is consistent across the evaluated trials ( Figure 13). The reason is that SS-TWR is based only on one reply time, namely, t replyB (2). In the experiment, only one reply time (t replyA ) was varied, and the other reply time (t replyB ) was approximately constant throughout the evaluation (see the seventh column in Table 7).

Distance Error Comparison for Type II and Type III in NLOS Scenario
In order to have a complete measurement report, the NLOS scenario was also evaluated in the experiment. In this scenario, the evaluation was recorded for roughly three minutes in total for both Type II and Type III cases at a reference distance of 2 m. As it is shown in Figure 14, pure LOS data were recorded in the first minute. Then, a human subject blocked the communication between the two transceivers by standing in the middle at a distance of 1 m. After that, the blocking was removed and the pure LOS is recorded again for the remaining one minute. The mean reply times used in this evaluation were t replyA = 490.94 µs and t replyB = 491.25 µs for the symmetric case (Type II), and t replyA = 836.80 µs and t replyB = 397.40 µs for the asymmetric case (Type III), respectively.
As expected, the NLOS condition caused huge error in the measurement (roughly around 40 cm) at both of the two types in all of the evaluated TWRs ( Figure 14). This shows that signal-traveling time was obstructed by the reflected signals from the environment and/or the penetration of the human body in this particular NLOS case. Therefore, it is absolutely necessary that NLOS identification and mitigation techniques are mandatory for an application where NLOS is expected to exist. It can also be seen that there were some spikes in Figure 14, which was caused by the body movement of the human subject during measurement. In the special case (Type II), both AltDS and SDS had the same measurement results, as can be seen in the upper graphic of Figure 14, in which AltDS results (blue color) were merged into the SDS (green color). In the typical case (Type III), diversity among the three TWR methods is visible, as shown in the bottom graphic of Figure 14.

Discussion
In the last decade, SDS-TWR was the most highlighted TWR technique in the literature. The reason is that it provides an impressive output of TOF error against clock drifts when reply times (t replyA and t replyB ) are symmetric. SDS-TWR was so popular that it even became a kind of standard. This means that, whenever a new TWR technique emerges, its performance is benchmarked with SDS-TWR as in References [4,[7][8][9][10][11]. However, SDS-TWR only provides robust TOF outputs when reply times are symmetric. When the symmetry in reply time is unachievable, it encounters severe error effects ( Figures 5 and 13, Table 7). In fact, this is a major drawback and the pitfall of the SDS-TWR method. The constraint on strict symmetry in SDS-TWR has also been addressed in References [7,31].
In contrast, we found that AltDS-TWR method was robust against clock drift in any tested condition (Figures 4, 5 and 13 and Table 7). In general, minimal reply times (t replyA and t replyB ) and relative delay errors of round-trip time (ξ ABA and ξ BAB ) are desirable at any condition in every evaluated TWR method. The reason is that, the shorter the mentioned time in the system is, the better the ranging accuracy (Figures 4 and 5). Note that the default (out of the box) setup achieved from Decawave's software was used in the typical-case (Type III) experiments in LOS, close LOS, and multipath scenarios, except for the variable reply time conducted in Section 7.3.1.
Nonetheless, we proved that the corrupting effect of the delay in reply time does not affect distance-estimation accuracy in AltDS-TWR (Section 7.3.1). This point is important because the current state of the art in UWB-based localization systems only focuses on the accuracy of the positioning algorithm. The available resource space of the data payload section in MAC layer [3] (p. 57), [22] (p. 220) are not used in most of the system-level applications presented in the literature. To mention a few as examples, the system implementation of UWB in References [32][33][34][35] mainly focus on the accuracy of the positioning algorithm by assuming that no payload is included in data communication except for necessary timestamps to be used in the positioning algorithm. Therefore, if the sensor data should also be transmitted, secondary wireless technology is used in such a system.
AltDS-TWR uncovers the ability to provide both positioning and sensor data on the payload of a single UWB system without loss of accuracy in the positioning algorithm. This further ensures that AltDS can be used in sensor systems with nondeterministic processing time. For instance, variation of reply time, provided in Table 7 in Section 7.3.1, can be thought of as a representation of sensor data processing time for wireless communication systems. As an example application, AltDS-TWR can be used in a UWB-based body-sensor network in sports analysis, where position and sensor data from a mobile node are necessary to access in the central server (coach) and analyze the performance of the athlete. Note that it could take unpredictable processing time for reading the data from the sensor depending on the hardware in such a scenario.
Moreover, AltDS-TWR is preferred in real-world scenarios because it is robust against variation of reply time and clock drifts (Sections 6 and 7). Therefore, we conclude that the performance of the AltDS-TWR method is the most reliable between the four evaluated TWR methods, under the evaluation made in our numerical and experimental development at different scenarios.
It should also be noted that the relative error presented in the simulation results (Section 6) includes all delays (PTD, PATD, TTD, and RTD) mentioned in Section 3.1. However, the relative errors regarding TTD and RTD were excluded in the experiment results (Section 7). In practice, a certain approximately constant delay error (with regard to a complete hardware setup) can be identified by evaluating two transceivers under the known ground-truth reference distance in a pure LOS scenario. The procedure of eliminating this constant, which is subtracting the mentioned constant from the measured (estimated) TOF value to match with the ground-truth reference distance, is typically called an aggregated antenna delay calibration in the world of UWB hardware implementation [29]. This corresponds with the elimination of TTD and RTD delays in our case, which was calibrated before measurement was started, as stated in Section 7.1.
Based on the evaluation results presented in this paper, a few recommendations can be drawn as follows: Firstly, distance should not be smaller than 0.75 m. The anchor (fixed) nodes should be placed far away from the dedicated region so that the distance between anchor and mobile nodes is always greater than 0.75 m. Secondly, a fairly small distance error (less than 10 cm) from both AltDSand SDS-TWRs can be achieved if the difference between the reply times (|t replyA − t replyB |) is less than 400 µs. Thirdly, AltDS-TWR is the only solution in the evaluated TWRs when the nondeterministic processing time (e.g. sensor-data reading) are expected in the positioning system.

Conclusions and Future Work
In this paper, we proposed a novel TEEM for TWR methods. The proposed model completely holds the characteristics of the conventional clock-drift error model in TWR methods (Section 4), as defined in Reference [3]. We found that, under ideal conditions, all TWR methods perform equally well (Section 6.1). Subsequently, we showed that AltDS-TWR is superior to SDS-TWR under conditions found in typical applications (Sections 6 and 7). SDS-TWR produces smaller TOF error against clock drifts only when reply times (t replyA and t replyB ) are symmetric. In contrast, AltDS-TWR provides the same level of accuracy to SDS-TWR in the symmetric case, and the most robust solution out of any of the three evaluated conditions in the asymmetric case (Sections 6 and 7).
Distance error estimation between two transceivers was evaluated in this article. For future work, the error caused by multiple anchors (fixed-reference) nodes and a single mobile node will be analyzed. This corresponds to error analysis in a positioning algorithm between multiple anchor nodes and a single mobile node using AltDS-TWR as a ranging method.