Introduction

Location-based services (LBSs) are becoming indispensable in our daily lives, such as in requesting nearby businesses, services or people. In an LBS, the mobile device, especially a smartphone, plays an important role as the typical user terminal. The widespread use of such mobile device results in LBSs being easily available. In other words, the majority of people enjoy LBSs through their smartphones. Therefore, accurate user position, one of the essential issues of LBSs, should be provided using smartphone-embedded sensors and modules.

Commonly, the set of embedded sensors includes accelerometers, magnetometers, gyroscopes and cameras, in addition to modules for cellular communication, general connectivity such as Wi-Fi network adapter and Bluetooth interface, and a global navigation satellite system (GNSS) receiver. Among them, accelerometers, gyroscopes and magnetometers are typically integrated as inertial navigation systems (INSs) whose accuracy is little affected by surrounding conditions but highly depends on the initial location and decreases quickly with time (Collin et al. 2003; Chen et al. 2014). The camera is used to obtain images from the surrounding environment to be exploited as a method of image recognition positioning. However, the image recognition needs an a priori database of visual landmarks to identify the location, generally involving increased memory size and computing load (Werner et al. 2011; Liang et al. 2013). For cellular positioning, the positioning accuracy level depends on the number of the reference stations and varies from ten meters to several hundred meters (Gundegard et al. 2013; Wang et al. 2014). Wi-Fi positioning based on the received signal strength (RSS) and fingerprinting methods has large positioning errors due to the RSS offset between the reference and user devices, in addition to long-duration fingerprinting updates (Liu et al. 2014; Wang et al. 2015). Bluetooth has a short coverage distance and hence requires a large number of signal sources to cover a large area (Lee et al. 2014). GNSS, compared to the aforementioned positioning algorithms, can provide user position more effectively with high accuracy, computationally less expensive and large coverage regions, and it has become the most popular and widely used positioning system at present. However, its usage for indoor positioning poses difficult challenges due to the 20–30 dB additional signal attenuation and blocking caused by buildings (Mautz 2009).

Although high-sensitivity global positioning system (HSGPS) and assisted-GPS (A-GPS) are used indoors to improve the acquisition and tracking of weak signals at the cost of indoor positioning accuracy (Sundaramurthy et al. 2011; Zandbergen and Barbeau 2011; Shafiee et al. 2012), they still do not function in such GNSS-denied indoor environment as an underground parking lot. Moreover, the improvement in HSGPS in terms of sensitivity commonly involves hardware-level modification on GNSS modules, such as narrow-bandwidth long-integration-time tracking loops, vector-based tracking algorithms and improved GPS antennas (Lin et al. 2013; Nirjon et al. 2013). The GPS repeater or/and amplifier is able to forward the outdoor GPS signals to indoor user terminals, but the estimated position is the outdoor antenna position rather than the true user position (Ozsoy et al. 2013; Giammarini et al. 2015).

To employ the embedded GPS module of a mobile device in indoor environments without firmware-/hardware-level modification, a new architecture of a GPS-based indoor positioning system has been proposed in previous studies (Xu et al. 2015). The system uses a receiver-and-transmitter (Rx/Tx) device to extract each satellite signal from the received outdoor GPS signal (the superposition of several satellites signal) and forward these using indoor transmitting antennas separately. The mobile-device-embedded GNSS module is able to receive copies/surrogates of GNSS signals indoors. However, if the received indoor GPS signal is non-line-of-sight, the GPS module is unable to estimate the true user position. Therefore, we used the \(\rho - \rho\) algorithm to estimate the true user position. The \(\rho - \rho\) algorithm uses pseudoranges to estimate the distances between the user terminal and the indoor transmitting antennas. Finally, the user position is calculated by using three or more measures. Unfortunately, pseudoranges are unavailable in the majority of mobile devices, but positioning results can be obtained from any mobile device. Thus, we proposed a new positioning algorithm based on the direct position estimation from the user terminal for the GNSS-based indoor positioning system, called the R–R algorithm.

Next, we give an overview of the GNSS-based indoor positioning system. Then, the algorithm and the positioning error are analyzed in details after a short review of the general GPS positioning algorithm. Furthermore, a simulated GNSS-based indoor positioning system is illustrated and used to test performances of the positioning algorithm. Finally, conclusions and a short discussion are given with further research.

GNSS-based indoor positioning system

The GNSS-based indoor positioning system (GNSS–IPS) is composed by a receiver-and-transmitter (Rx/Tx), a server and a user terminal, as shown in Fig. 1.

Fig. 1
figure 1

Architecture of GNSS-based indoor positioning system

The Rx/Tx is used to receive the outdoor GNSS signals, to separate them by satellite and to forward them indoors. These functions are implemented by one Rx component and several Tx components through two inverse processes. The Rx component, including an outdoor receiving antenna (RA), works as a general GNSS receiver. It collects the authentic GNSS radio frequency signal (\({\text{RF}}^{\text{GNSS}}\)) using the outside receiving antenna and tracks the satellite signal in channels through demodulation and PRN code wipe-off. One satellite signal is processed in one channel. Each channel of the Rx component is connected with one Tx component and sends its local carrier, code and navigation data sequence of one satellite to the corresponding Tx component. It should be noted that when the Rx component tracks the GNSS signal, i.e., the tracking loop of the receiver is in the lock state, the local carrier and code are considered the same as that of the received GNSS signal. Thus, every satellite signal is able to be repeated through mixing its local carrier, code and navigation data. One repeated signal refers to one satellite signal. Then, the received mixed GNSS signals are separated. Additionally, the Rx component computes the satellite position \(\varvec{R}_{i}^{\text{sat}}\) using the navigation message and estimates the outside antenna position \(\varvec{R}^{rx}\) using \(\varvec{R}_{i}^{\text{sat}}\) and measured pseudoranges. The satellite position \(\varvec{R}_{i}^{\text{sat}}\) and the outside antenna position \(\varvec{R}^{rx}\) are sent to the server. The Tx components mix the local carrier, code and navigation data sequence from the Rx component to generate the indoor signal. Each Tx component includes one indoor transmitting antenna (TA) to emit the signal corresponding to one satellite signal. Clearly, the number of Tx components, as well as the number of indoor transmitting antennas, must be ≥4 for estimating the position of the embedded GNSS module.

With the same signal structure, code sequences, carrier frequency and navigation data sequence as the authentic GNSS signals, the generated indoor signals can be received and processed by the embedded GNSS module in the user terminal, such as a smartphone, a tablet or other mobile devices. On the other hand, the embedded GNSS module considers the generated indoor signals as line-of-sight (LOS) signals from the satellites to the user. However, the signals are non-nine-of-sight (NLOS). Therefore, using the NLOS signals, the embedded GPS module is unable to measure the true pseudoranges from the user to the satellites and unable to estimate the true user position. The measured “pseudoranges” contain the distances from the satellites to the outdoor antenna. Thus, the measured pseudoranges and estimated user position relate to the outdoor antenna position. For simplicity and distinction, the “false” user position is called the pseudo-position in the following text. To estimate the true user position, the user terminal requires a position estimation module. The module reads the necessary measurements from the GNSS module to calculate the distances from the user position to the indoor transmitting antennas. Three or more distances are needed to estimate the user position in theory. In the system, the minimum number of distances is four because of the requirement of the embedded GNSS module, which is equal to the minimum number of Tx components. If the necessary measurements from the GNSS module are pseudoranges \(\rho_{i}^{u}\) from the pseudo-position to the satellites and \(\rho_{i}^{rx}\) from the outdoor antenna to the satellites, the distances \(d_{i } \left( {i = 1,2, \ldots N} \right)\) will be calculated from \(\rho_{i}^{u} - \rho_{i}^{rx}\) (Xu et al. 2015). However, in many cases, the pseudo-position, denoted as \(\overline{\varvec{R}}^{u}\), rather than \(\rho_{i}^{u}\) is available, although the pseudo-position is calculated using \(\rho_{i}^{u}\). Therefore, the aim of the positioning module is to calculate the real user position \(\varvec{R}^{u}\) from the known information including the pseudo-position \(\overline{\varvec{R}}^{u}\), the indoor transmitting antenna position \(\varvec{R}_{i}^{\text{TA}}\), the outdoor antenna position \(\varvec{R}^{rx}\) and GNSS satellite position \(\varvec{R}_{i}^{\text{sat}}\). According to this goal, the R–R positioning algorithm is proposed and given in the positioning algorithm section. It should be noted that the outdoor receiving antenna position \(\varvec{R}^{rx}\), indoor transmitting antenna positions \(\varvec{R}_{i}^{\text{TA}}\), satellite positions \(\varvec{R}_{i}^{\text{sat}}\), system error corrections and corresponding PRN with channel (TA) (PRN@Chn) are obtained from the server via a wireless communication module, such as a Wi-Fi module. Generally, the user terminal includes three modules, a GNSS module, a wireless communication module and a position estimation module. Among them, the GNSS module and the wireless communication module are mobile-device-embedded modules. The position estimation module is implemented through a software approach. For end users, without firmware- or hardware-level modification on their current mobile devices, the indoor system will be utilized after a software installation.

The server is used to log and deliver \(\varvec{R}^{rx}\), \(\varvec{R}_{i}^{\text{TA}}\), \(\varvec{R}_{i}^{\text{sat}}\), system error corrections and PRN@Chn. The outside antenna position \(\varvec{R}^{rx}\) can be updated by the Rx component or simplified as a constant due to its fixed position. Each transmitting antenna is fixed indoors and the position \(\varvec{R}_{i}^{\text{TA}}\) is predetermined. The satellite position \(\varvec{R}_{i}^{\text{sat}}\) is updated from the Rx component or online ephemeris. The system delay corrections are predetermined. The PRN@Chn is used to match the GNSS satellite and indoor TA.

The implementation of the system refers to the power limitation of the indoor transmitting signal. On the one hand, the indoor signal power should be strong enough to block authentic signals, which can be received indoors in some cases. In that way, no authentic signal is received by the embedded GNSS module to affect the indoor positioning estimation. On the other hand, the indoor signal power should be weak to avoid signals leaking outdoors and affecting the outside receivers. Adjusting the transmitting power of the indoor signal is an important issue in the system implementation. Some GNSS-denied regions such as underground parking lots are preferable environment for the system to isolate the indoor and outdoor signals.

Positioning algorithm

As shown in the above section, the distance \(d_{i}\) from each indoor TA to the user terminal is a required measurement to estimate the true user position. Thus, the positioning algorithm for the user terminal contains two steps: (1) to estimate the distance measurements \(d_{i}\) using \(\overline{\varvec{R}}^{u}\), \(\varvec{R}^{rx}\) and \(\varvec{R}_{i}^{\text{sat}}\) and (2) to calculate the user position \(\varvec{R}^{u}\) using \(d_{i}\).

After a brief review of the general GNSS positioning algorithm, the calculations of distance \(d_{i}\) and user position in the ideal case are obtained. Then, the distance errors are discussed.

GNSS positioning algorithm

In the user terminal, the embedded GNSS module estimates the user position using the pseudorange measurements \(\rho_{i}^{u}\). The user position and user clock error are the unknown parameters, denoted by \(\overline{\varvec{X}}^{u} = \left[ {\bar{x}^{u} ,\bar{y}^{u} ,\bar{z}^{u} ,\delta_{\text{clk}}^{u} } \right]^{\text{T}}\), and can be calculated by solving the following equations:

$$\overline{\varvec{X}}^{u} = \arg \mathop {\hbox{min} }\limits_{{\overline{\varvec{X}}^{u} }} \mathop {\mathop {\sum }\limits^{N} }\limits_{i = 1} \left( {\left\| {\varvec{R}_{i}^{\text{sat}} - \overline{\varvec{R}}^{u} } \right\| - \rho_{i}^{u} } \right)^{2}$$
(1)

where \(\varvec{R}_{i}^{\text{sat}} = \left[ {x_{i}^{\text{sat}} , y_{i}^{\text{sat}} ,z_{i}^{\text{sat}} } \right]^{\text{T}}\) is the ith satellite position vector and \(\overline{\varvec{R}}^{u} = \left[ {\bar{x},\bar{y},\bar{z}} \right]^{\text{T}}\) is the uncorrected user position vector output from the GNSS receiver module directly. Equation (1) is a nonlinear equation and its first-order Taylor series expansion at the approximate solution \(\overline{\varvec{X}}_{ - }^{u} = \left[ {\bar{x}_{ - }^{u} ,\bar{y}_{ - }^{u} ,\bar{z}_{ - }^{u} ,\overline{\delta }_{{{\text{clk}}, - }}^{u} } \right]^{\text{T}}\) can be written as:

$$\rho_{i}^{u} = \rho_{i, - }^{u} + \varvec{h}_{i} \left( {\overline{\varvec{X}}^{u} - \overline{\varvec{X}}_{ - }^{u} } \right) + O\left[ {\left( {\overline{\varvec{X}}^{u} } \right)^{2} } \right]$$
(2)

where

$$\varvec{h}_{i} = \left[ { - \frac{{x_{i}^{\text{sat}} - \bar{x}_{ - }^{u} }}{{\rho_{i, - }^{u} }}, - \frac{{y_{i}^{\text{sat}} - \bar{y}_{ - }^{u} }}{{\rho_{i, - }^{u} }}, - \frac{{z_{i}^{\text{sat}} - \bar{z}_{ - }^{u} }}{{\rho_{i, - }^{u} }},1} \right] = \left[ {\varvec{a}_{i} ,1} \right]$$
(3)

The term \(O\left[ {\left( {\overline{\varvec{R}}^{u} } \right)} \right]^{2}\) represents the higher-order (≥2) terms of the Taylor series and is the source of linearization error. Generally, \(O\left[ {\left( {\overline{\varvec{R}}^{u} } \right)} \right]^{2}\) is small and can be ignored. Then, a simplified linear equation can be obtained as follows:

$$\delta \rho_{i}^{u} = \rho_{i}^{u} - \rho_{i, - }^{u} = \varvec{h}_{i} \Delta \overline{\varvec{X}}^{u}$$
(4)

where

$$\Delta \overline{\varvec{X}}^{u} = \left[ {\begin{array}{*{20}c} {\Delta \overline{\varvec{R}}^{u} } \\ {\Delta \overline{\delta }_{\text{clk}}^{u} } \\ \end{array} } \right] = \left[ {\begin{array}{*{20}c} {\overline{\varvec{R}}^{u} - \overline{\varvec{R}}_{ - }^{u} } \\ {\overline{\delta }_{\text{clk}}^{u} - \overline{\delta }_{{{\text{clk}}, - }}^{u} } \\ \end{array} } \right]$$
(5)

When more than four pseudorange measurements are available, the term \(\Delta \overline{\varvec{X}}^{u}\) can be calculated from:

$$\Delta \overline{\varvec{X}}^{u} = (\varvec{H}^{\text{T}} \varvec{H})^{ - 1} \varvec{H}^{\text{T}} \Delta\varvec{\rho}^{u}$$
(6)

where \(\varvec{H} = \left[ {\varvec{h}_{1} ,\varvec{h}_{2} , \ldots ,\varvec{h}_{N} } \right]^{\text{T}}\) and \(\Delta\varvec{\rho}^{u} = \left[ {\delta \rho_{1}^{u} ,\delta \rho_{2}^{u} , \ldots ,\delta \rho_{N}^{u} } \right]^{\text{T}}\). The user position results are corrected as:

$$\overline{\varvec{X}}^{u} = \overline{\varvec{X}}_{ - }^{u} + \Delta \overline{\varvec{X}}^{u}$$
(7)

Substituting (7) into (4) yields:

$$\rho_{i}^{u} - \rho_{i, - }^{u} = \varvec{h}_{i} \left( {\overline{\varvec{X}}^{u} - \overline{\varvec{X}}_{ - }^{u} } \right) = \varvec{a}_{i} \left( {\overline{\varvec{R}}^{u} - \overline{\varvec{R}}_{ - }^{u} } \right) + \left( {\overline{\delta }_{\text{clk}}^{u} - \overline{\delta }_{{{\text{clk}}, - }}^{u} } \right)$$
(8)

Equation (8) shows the relationship between the pseudorange difference and two corresponding positions. The relationship would be true only when the two positions are near to each other.

Indoor positioning algorithm

The previous section describes the pseudorange-based positioning estimation in the user terminal-embedded GNSS module. Unfortunately, the estimation is an incorrect user position due to the NLOS pseudorange measurements from the embedded GNSS module. As shown in Fig. 2, the geometric path of the user-terminal-received signal, denoted by the blue solid line, exhibits a zig–zag pattern from the satellite to the indoor user through the RA and TAs. The embedded GNSS module receives the NLOS signal and measures the zig–zag path.

Fig. 2
figure 2

Sketch of the true user position and the pseudo-position

In Fig. 2, each NLOS path from the satellite to the user terminal includes three segments. One segment is from the GNSS satellite to the outside antenna. This range is equal to the pseudorange measurement \(\rho_{i}^{rx}\) minus the Rx clock error \(\delta_{\text{clk}}^{rx}\). Another segment is the system delay \(\delta_{i}\) of the IPS system due to the signal processing and propagation from the outside antenna to the indoor transmitting antenna. The expected range \(d_{i}\) from the indoor transmitting antenna to the user terminal is the last segment of the NLOS path. The sum of the three segments and the clock error \(\overline{\delta }_{\text{clk}}^{u}\) of the embedded GNSS module is equal to the pseudorange measured by the embedded GNSS module. Then, the pseudorange measurement \(\rho_{i}^{u}\) from the embedded GNSS module can be written as:

$$\rho_{i}^{u} = \left( {\rho_{i}^{rx} - \delta_{\text{clk}}^{rx} } \right) + \delta_{i} + d_{i} + \overline{\delta }_{\text{clk}}^{u}$$
(9)

The solution of (9) and (1) is just the output of the embedded GNSS module, pseudo-position \(\overline{\varvec{R}}^{u}\).

In (9), the terms of \(\delta_{i}\) and \(d_{i}\) are much smaller than the range from the GNSS satellite to the outside antenna. Therefore, the outside antenna position \(\varvec{R}^{rx}\) is close to the pseudo-position \(\overline{\varvec{R}}^{u}\); i.e., \(\varvec{R}^{rx}\) is an approximate solution of (1). Let \(\overline{\varvec{X}}_{ - }^{u} = \varvec{X}^{rx} = \left[ {\left( {\varvec{R}^{rx} } \right)^{\text{T}} ,\delta_{\text{clk}}^{rx} } \right]^{\text{T}}\), we can rewrite (8) as:

$$\begin{aligned} &{\rho_{i}^{u} - \rho_{i}^{rx} = \varvec{h}_{i} \left( {\overline{\varvec{X}}^{u} - \varvec{X}^{rx} } \right) = \varvec{a}_{i} \left( {\overline{\varvec{R}}^{u} - \varvec{R}^{rx} } \right) + \left( {\overline{\delta }_{\text{clk}}^{u} - \delta_{\text{clk}}^{rx} } \right)} \\ &{\varvec{a}_{i} = \left[ { - \frac{{x_{i}^{\text{sat}} - x^{rx} }}{{\rho_{i}^{rx} }}, - \frac{{y_{i}^{\text{sat}} - y^{rx} }}{{\rho_{i}^{rx} }}, - \frac{{z_{i}^{\text{sat}} - z^{rx} }}{{\rho_{i}^{rx} }}} \right]} \\ \end{aligned}$$
(10)

Substituting (10) into (9) yields:

$$l_{i} = d_{i} + \delta_{i} = \left( {\rho_{i}^{u} - \overline{\delta }_{\text{clk}}^{u} } \right) - \left( {\rho_{i}^{rx} - \delta_{\text{clk}}^{rx} } \right) = \varvec{a}_{i} \left( {\overline{\varvec{R}}^{u} - \varvec{R}^{rx} } \right)$$
(11)

In (11), the terms of \(\varvec{a}_{i}\), \(\overline{\varvec{R}}^{u}\) and \(\varvec{R}^{rx}\) are known. From the known parameters, we are able to estimate \(l_{i}\) which is the sum of distance \(d_{i}\) from the indoor antenna to the user terminal and the system bias \(\delta_{i}\). The distance \(d_{i}\) is used to estimate the true user position. Similar to the GNSS positioning algorithm, the user position is estimated through solving the equation:

$$\varvec{X}^{u} = \arg \min_{{\varvec{X}^{u} }} \mathop {\mathop {\sum }\limits^{N} }\limits_{i = 1} \left( {\left\| {\varvec{R}_{i}^{\text{TA}} - \varvec{R}^{u} } \right\| - \varvec{a}_{i} \left( {\overline{\varvec{R}}^{u} - \varvec{R}^{rx} } \right) + \hat{\delta }_{i} } \right)^{2}$$
(12)

where \(\varvec{X}^{u} = \left[ {\varvec{R}^{u} ,\delta_{\text{clk}}^{u} } \right]^{\text{T}}\), \(\varvec{R}^{u}\) is the unknown user positioning, \(\varvec{R}_{i}^{\text{TA}}\) is the position of the ith indoor transmitting antenna and \(\hat{\delta }_{i}\) is the clock correction pre-measured and logged in the server.

It should be noted that the system bias \(\delta_{i}\) is caused from the length of the cable connected to the outdoor receiving antenna, the hardware delay in the Rx/Tx and the length of the cable connected to the transmitting antenna. If the bias \(\delta_{i}\) in every \(l_{i}\) is identical, similar to the receiver clock error, it can be ignored, as its effect can be removed using (12). In reality, the bias \(\delta_{i}\) differs due to the distribution of the transmitting antennas and the intrinsic clock misalignments of electric components. To remove the system bias, a pre-correction should be completed before the IPS installation to obtain the correction information (Xu et al. 2015).

Equations (11) and (12) show that the real user position can be estimated from the pseudo-position obtained from the GNSS module in the user terminal and the positions of the GNSS satellites, the outside antenna and indoor transmitting antennas. All the parameters can be directly obtained from the server via Wi-Fi and mobile devices. Thus, the IPS system is low cost for the end users without required modification of their mobile devices except for the installation of an application/software.

The least square (LS) algorithm is commonly used to solve (12), as well as (1). In the worst case, only four measurements are used to estimate the 3-D position and receiver clock error. When \(d_{i}\) is as short as hundreds of meters, the LS algorithm becomes very sensitive to the accuracies of the initial position and measurements. Small errors in the initial position and measurement will lead to a huge disturbance of the LS solution, especially of the height solution. Then, the solution of LS tends to diverge. For an indoor environment, meter-level accuracy for the initial position or the measurement is not sufficient to stabilize LS. To improve the stability of LS, it is effective to reduce the errors of the initial position and measurements and increase the number of measurements to ensure high degree of freedom. In the study, three unknown parameters, i.e., the 2-D position and the receiver clock error, are solved to ensure one degree of freedom.

Error analysis

In the above discussion, \(\varvec{R}^{rx}\) and \(\overline{\varvec{R}}^{u}\) are assumed to be synchronous in Rx time which is difficult to achieve. In the ideal case, \(\varvec{R}^{rx}\) is estimated using the pseudorange measurements at \(t_{0}\), denoted by \(\rho_{{i,t_{0} }}^{rx} \left( {i = 1,2, \ldots ,N} \right)\). These pseudorange measurements are included in the transmitting signal to the user terminal and yield \(\overline{\varvec{R}}_{{t_{0} }}^{u}\). In practice, due to the low data delivery rate of the server and the low precision of web time synchronization used in both user terminal and server, the user terminal calculates the user position \(\overline{\varvec{R}}^{u}\) corresponding to the pseudorange measurements at time \(t_{1}\), while the obtained \(\varvec{R}^{rx}\) from the server refers to measurements at time \(t_{0}\). The case of \(\varvec{R}_{{t_{0} }}^{rx}\) being earlier than \(\overline{\varvec{R}}_{{t_{1} }}^{u}\), i.e., \(t_{0} < t_{1}\), will be easily available under the situation of \(\varvec{R}^{rx}\) delayed delivery. If the delay is shorter than the indoor GNSS signal processing and propagation periods, the case of \(\varvec{R}_{{t_{0} }}^{rx}\) being later than \(\overline{\varvec{R}}_{{t_{1} }}^{u}\), i.e., \(t_{0} > t_{1}\), will occur. For both cases, the range measurements \(l_{i}\) at time \(t_{1}\), according to (8), can be written as:

$$\begin{array}{*{20}c} {l_{{i,t_{1} }} = \varvec{a}_{{i,t_{1} }} \left( {\overline{\varvec{R}}_{{t_{1} }}^{u} - \varvec{R}_{{t_{0} }}^{rx} } \right)} \\ \end{array}$$
(13)

where the pseudo-position \(\overline{\varvec{R}}_{{t_{1} }}^{u}\) and the outdoor antenna position \(\varvec{R}_{{t_{0} }}^{rx}\) are modeled as:

$$\begin{array}{*{20}c} {\overline{\varvec{R}}_{{t_{1} }}^{u} } \\ \end{array} = {\hat{\bar{\varvec{R}}}}_{{t_{1} }}^{u} +\varvec{\upsilon}_{{t_{1} }}^{u}$$
(14)
$$\begin{array}{*{20}c} {\varvec{R}_{{t_{0} }}^{rx} } \\ \end{array} = \begin{array}{*{20}c} {\hat{\varvec{R}}_{{t_{0} }}^{rx} } \\ \end{array} +\varvec{\upsilon}_{{t_{0} }}^{rx}$$
(15)

where \({\hat{\bar{\varvec{R}}}}_{{t_{1} }}^{u}\) and \({\hat{\bar{\varvec{R}}}}_{{t_{0} }}^{rx}\) are the error-free pseudo-position and error-free outdoor antenna position, respectively; \(\varvec{\upsilon}_{{t_{1} }}^{u}\) and \(\varvec{\upsilon}_{{t_{0} }}^{rx}\) are the positioning errors including the bias error and the white Gaussian noise.

Substituting (15) and (14) into (13) yields the distance error, which can be written as:

$$\delta l_{{i,t_{1} }} = l_{{i,t_{1} }} - \hat{l}_{{i,t_{1} }} = \varvec{a}_{{i,t_{1} }} \left( {\varvec{\upsilon}_{{t_{1} }}^{u} -\varvec{\upsilon}_{{t_{0} }}^{rx} } \right)$$
(16)

where \(\hat{l}_{{i,t_{1} }} = \varvec{a}_{{i,t_{1} }} \left( {{\hat{\bar{\varvec{R}}}}_{{t_{1} }}^{u} - \hat{\varvec{R}}_{{t_{0} }}^{rx} } \right) = \varvec{a}_{{i,t_{1} }} \left({\hat{\bar{ {\varvec{R}}}}_{{t_{1} }}^{u} - \hat{\varvec{R}}_{{t_{1} }}^{rx} } \right)\), in which the errorless outdoor antenna position is time invariant, i.e., \(\hat{\varvec{R}}_{{t_{0} }}^{rx} = \hat{\varvec{R}}_{{t_{1} }}^{rx} = \hat{\varvec{R}}^{rx}\), since the antenna is fixed. According to the GNSS positioning equation, as shown in (6), the positioning error can be written as:

$$\varvec{\upsilon}_{{t_{1} }}^{u} = \overline{\varvec{R}}_{{t_{1} }}^{u} - {\hat{\bar{\varvec{R}}}}_{{t_{1} }}^{u} = (\varvec{A}_{{t_{1} }}^{\text{T}} \varvec{A}_{{t_{1} }} )^{ - 1} \varvec{A}_{{t_{1} }}^{\text{T}} \left( {\varvec{\delta}_{{t_{1} }}^{\text{iono}} +\varvec{\delta}_{{t_{1} }}^{\text{trop}} +\varvec{\varepsilon}_{{t_{1} }}^{u} +\varvec{\varepsilon}_{{t_{1} }}^{rx} - \Delta \overline{\varvec{\delta}}_{{{\text{clk}},t_{1} }}^{u} } \right)$$
(17)

where the matrix \(\varvec{A}_{{t_{1} }}\) is \(\left[ {\varvec{a}_{{1,t_{1} }} , \varvec{a}_{{2,t_{1} }} \ldots \varvec{a}_{{N,t_{1} }} } \right]^{\text{T}}\), \(\varvec{\delta}_{{t_{1} }}^{iono}\) and \(\varvec{\delta}_{{t_{1} }}^{\text{trop}}\) are the ionospheric delay array and tropospheric delay array at \(t_{1}\), \(\varvec{\varepsilon}_{{t_{1} }}^{u}\) is the noise array at \(t_{1}\), \(\varepsilon_{{t_{1} }}^{rx}\) is the inherited noise from the Rx/Tx and \(\Delta \overline{\delta }_{{{\text{clk}},t_{1} }}^{u} = \overline{\delta }_{{{\text{clk}},t_{1} }}^{u} - \hat{\bar{\delta }}_{{{\text{clk}},t_{1} }}^{u}\) is the residual of the receiver clock bias. The ionospheric and tropospheric delays in \(\varvec{\upsilon}_{{t_{1} }}^{u}\) are those of the outdoor signals since both delays refer to the outdoor signal propagation path. Another common error, the satellite clock error, is ignored since it can be modeled and corrected.

Similarly, the outdoor antenna position error is written as:

$$\varvec{\upsilon}_{{t_{0} }}^{rx} = \varvec{R}_{{t_{0} }}^{rx} - \hat{\varvec{R}}_{{t_{0} }}^{rx} = (\varvec{A}_{{t_{0} }}^{\text{T}} \varvec{A}_{{t_{0} }} )^{ - 1}\varvec{A}_{{t_{0} }}^{\text{T}} \left( {\varvec{\delta}_{{t_{0} }}^{\text{iono}} +\varvec{\delta}_{{t_{0} }}^{\text{trop}} +\varvec{\varepsilon}_{{t_{0} }}^{rx} - \Delta \varvec{\delta}_{{{\text{clk}},t_{0} }}^{rx} } \right)$$
(18)

During a short period, the satellite travel distance is much less than the distance between the satellite and the outdoor antenna; hence, \(\varvec{A}_{{t_{0} }} \approx \varvec{A}_{{t_{1} }}\) can be obtained. Therefore, the distance error depends on the error difference of the pseudo-position and outdoor antenna position and can be written as:

$$\delta l_{{i,t_{1} }} = \left( {\delta_{{i,t_{1} }}^{\text{iono}} - \delta_{{i,t_{0} }}^{\text{iono}} } \right) + \left( {\delta_{{i,t_{1} }}^{\text{trop}} - \delta_{{i,t_{0} }}^{\text{trop}} } \right) + \left( {\varepsilon_{{i,t_{1} }}^{u} + \varepsilon_{{i,t_{1} }}^{rx} - \varepsilon_{{i,t_{0} }}^{rx} } \right) - \left( {\Delta \overline{\delta }_{{{\text{clk}},t_{1} }}^{u} - \Delta \delta_{{{\text{clk}},t_{0} }}^{rx} } \right)$$
(19)

Equation (19) gives the distance error estimated from \(\varvec{R}^{rx}\) and \(\overline{\varvec{R}}^{u}\). The ionospheric and tropospheric delays vary slowly and can be considered as constants over a short period of time, i.e., \(\delta_{{i,t_{1} }}^{\text{iono}} - \delta_{{i,t_{0} }}^{\text{iono}} \approx 0\) and \(\delta_{{i,t_{1} }}^{\text{trop}} - \delta_{{i,t_{0} }}^{\text{trop}} \approx 0\). This implies that the R–R positioning algorithm is able to remove the effects of the ionospheric delays and tropospheric delays. Thus, it is not necessary to mitigate the two delays from \(\varvec{R}^{rx}\) and \(\overline{\varvec{R}}^{u}\). Certainly, if different mitigation methods are employed in calculating \(\varvec{R}^{rx}\) and \(\overline{\varvec{R}}^{u}\), the R–R positioning algorithm is unable to cancel the two delays. Additionally, in the case of \(t_{1} > > t_{0}\) or \(t_{1} < < t_{0}\), \(\delta_{{i,t_{1} }}^{\text{iono}} - \delta_{{i,t_{0} }}^{\text{iono}} \ne 0\) and \(\delta_{{i,t_{1} }}^{\text{trop}} - \delta_{{i,t_{0} }}^{\text{trop}} \ne 0\) lead to some increase in the positioning error.

The term \(\varepsilon_{{i,t_{1} }}^{u} + \varepsilon_{{i,t_{1} }}^{rx} - \varepsilon_{{i,t_{0} }}^{rx}\) in (19) reaches its minimum value \(\varepsilon_{{i,t_{1} }}^{u}\) at \(t_{1} = t_{0}\). In this case, the distance noise level is \(\sigma_{u}\). Otherwise, in the case of \(t_{1} \ne t_{0}\), the noise level is \(2\sigma_{rx} + \sigma_{u}^{2}\), including the noise from the embedded GPS and the Rx.

The last term \(\Delta \overline{\delta }_{{{\text{clk}},t_{1} }}^{u} - \Delta \delta_{{{\text{clk}},t_{0} }}^{rx}\) in (19) is the residual difference of clock errors between the GNSS module and Rx. The residual difference is the same for all distances and can be estimated as a part of the receiver clock bias using (12). This term affects the positioning accuracy only slightly.

Generally, the distance accuracy of the indoor positioning system mainly depends on the positioning accuracy of the Rx and embedded GNSS module and is less affected by the outdoor environment. To improve the accuracy of the indoor positioning system, effective methods include improving the synchronization of \(\varvec{R}^{rx}\) and \(\overline{\varvec{R}}^{u}\) using fast \(\varvec{R}^{rx}\) delivery frequency, and reducing the noise level of \(\varvec{R}^{rx}\) and \(\overline{\varvec{R}}^{u}\).

Simulation

To test the performance of the positioning algorithm, the proposed indoor positioning system is simulated based on a GPS L1 software receiver with the following scheme as shown in Fig. 3.

Fig. 3
figure 3

Simulation method

The GPS L1 signals received by the outdoor antenna are imitated by GPS IF data that have been collected by a front end and logged in the computer. The logged data are processed in the software receiver to obtain the satellite PRN number, the outdoor antenna position \(\varvec{R}^{rx}\) and the available satellite position \(\varvec{R}_{i}^{sat}\). The GPS receiver in the Rx component also outputs the local carrier, code and navigation data of each satellite tracking channel to the Tx component to generate the indoor signals. In the simulation, signal tracking in the Rx component and indoor signal generation in the Tx component are combined to improve the simulation efficiency and save storage space. The indoor signal generation is completed by an additional multiplier in the satellite channel of the software receiver. The multiplier generates the indoor signal for a single Tx component to the user terminal by taking a product of the local carrier and code with a delay of \(d_{i} + \delta_{i}\) and the navigation data.

The delays of \(d_{i}\) and \(\delta_{i}\) are the outputs of the indoor situation simulation which must preset the user position and TA distribution. The delay of \(d_{i}\) is the propagation range from the user to the TA, calculated from the preset user position and TA position. The system delay \(\delta_{i}\) is the route from the outdoor antenna position to each distributed TA. The one-to-one correspondence between the PRN number, channel number and TA number, denoted using PRN@Chn, is also defined in the indoor situation simulation.

The server is used to log and deliver the information required by the R–R positioning algorithm. Similarly, the simulated server logs the system delay \(\delta_{i}\), the outdoor antenna position \(\varvec{R}^{rx}\), each satellite position \(\varvec{R}_{i}^{sat}\), the transmitting antenna position \(\varvec{R}_{i}^{tx}\) and the PRN@Chn from the Rx component and indoor situation simulation.

A stand-alone software GPS receiver is used as the embedded GPS module in the user terminal to process the integrated signal data and output the pseudo-position \(\overline{\varvec{R}}^{u}\). The user position is estimated using \(\varvec{R}^{rx}\) and \(\overline{\varvec{R}}^{u}\) according to the P–P positioning algorithm. It should be noted that different calculation methods, error correction algorithms and available satellites likely reduce the accuracy of the P–P positioning algorithm. To avoid these effects and test the effectiveness of the proposed algorithm, the positions of \(\varvec{R}^{rx}\) and \(\overline{\varvec{R}}^{u}\) are calculated using the same method.

The parameters of the intermediate frequency data and GPS software receiver used in the simulation are listed in Table 1.

Table 1 Parameters of front end and GPS software receiver

In the simulation, the outdoor GPS signals were collected in an open area on September 24, 2014. Six satellite signals were collected and the satellite distribution is shown in Fig. 4 (top). The outdoor antenna position \(\varvec{R}^{rx}\) (114.00517°E, 22.46882°N, 15.93 m) is estimated using the pseudorange-based positioning algorithm without ionospheric delay correction and tropospheric delay correction. To generate indoor GPS signals, four satellite signals out of the available six satellite signals are selected according to GDOP value. One selection is PRN 1, 17, 28 and 30 for good satellite geometry with GDOP = 5.30, and the other selection is PRN 1, 4, 28 and 30 for an example of bad satellite geometry with GDOP = 17.12. The C/N0 values of the outdoor signals are above 38 dB-Hz. The positioning errors of \(\varvec{R}^{rx}\) estimation for the two selections are shown in Fig. 4 (bottom).

Fig. 4
figure 4

Sky plot (top) and positioning error of \(\varvec{R}^{rx}\) estimation for different satellite selection (bottom)

A virtual indoor situation with the distribution of the RA and four TAs is illustrated in Fig. 5. The X-axis is along the eastward direction, the Y-axis points northward, and the Z-axis is vertically upward. The RA is in the top center and higher than the four TAs since it is an outside antenna. TA 1, 2, 3 and 4 forward the signals corresponding to the selected satellite in the order PRN 1, 17, 28 and 30 in the good satellite geometry case with low GDOP and PRN 1, 4, 28 and 30 in the bad satellite geometry case with high GDOP. The TAs are on a horizontal plane with a 15 m height and are located on the vertexes of a 100 × 100 m square. If the RA and each TA are connected using a cable, the distance between each TA and RA is \(50\sqrt 2 \; + \;0.93\) m.

Fig. 5
figure 5

Distribution of RA and TAs

The user terminal is in the lowest layer with a 12 m fixed height. Under static condition, the simulated user positions in local coordinates are #1 (5 m, 5 m) near a corner, #2 (5 m, 50 m) near an edge and #3 (50 m, 50 m) at the center, as illustrated in Fig. 6 (top). Under dynamic condition, the user moves between (5, 5) and (95, 95) with a velocity of 5 m/s, as displayed in Fig. 6 (bottom). In the simulation tests, 2-D positioning is estimated with a fixed height.

Fig. 6
figure 6

Static condition (top) and dynamic condition (bottom)

Simulation results

The effectiveness of the proposed R–R algorithm is tested under the static and dynamic situation. We also use the dynamic case to compare the performance and robustness to the clocks misalignment of the measurements of the R–R algorithm and ρρ algorithm.

Static positioning results

Figure 7 shows the 2-D pseudo-position results for different satellite selections, equivalent to the positioning estimation from the embedded GPS module. The pseudo-positions of #1 and #2 are far away from the real user position for both good geometry and bad geometry satellite selections, as shown in Fig. 7. The pseudo-position of #3 is fortunately near the real position. The coincidence occurs because #3 is the center of the simulated indoor situation and the distances between the user terminal and all transmitting antennas are same. In short, the pseudo-positions are different from the real user position and require correction.

Fig. 7
figure 7

Pseudo-positions under static condition (uncorrected user positions)

Figure 8 displays the static positioning results calculated from the proposed R–R algorithm under different satellite selections. The estimated user positions of #1, #2 and #3 are close to the real positions. In the tests, root mean squares (RMSs) of the horizontal position errors are below 1.89 m under the low GDOP satellite selection and within 2.05 m under the high GDOP satellite selection. The results show that the R–R positioning algorithm is effective and able to provide meter-level indoor positioning solutions in theory. Meanwhile, the comparable positioning accuracy under different satellite selections suggests that the outdoor geometry has a limited effect on the indoor positioning accuracy.

Fig. 8
figure 8

Static user positioning results

Table 2 shows the estimated distance errors for \(d_{i}\) from the R–R algorithm under different satellite selections. Details of case #1 are illustrated in Fig. 9.

Table 2 Estimated distance errors (RMS) between the user terminal and each TA (m)
Fig. 9
figure 9

Static distance error in case #1 under low GDOP satellite selection (top) and high GDOP satellite selection (bottom)

The distance errors for both satellite selections are similar in terms of average values and standard deviations. For instance, in case #1, the distance error of \(d_{1}\) is 1.18 m for the low GDOP satellite selection and 1.16 m for the high GDOP satellite selection, as given in Table 2. The similar accuracy of distance estimation is the reason for the similar accuracy of the user positioning estimation, which is shown in Fig. 8. Meanwhile, the small average error in distances, which is much less than the meter-level ionospheric delay and tropospheric delay, indicates that the propagation error has been removed.

In short, under the static condition, the proposed R–R algorithm is able to estimate accurate indoor user position and is little affected by the outdoor propagation errors and the satellite geometry.

Dynamic positioning results

Since the outdoor satellite geometry has limited effect on the indoor positioning estimation, the high GODP satellite selection is used in the dynamic test. The pseudo-position, the estimated user position and the real trace are shown in Fig. 10.

Fig. 10
figure 10

Dynamic positioning results under low GDOP satellite selection

In Fig. 10, the pseudo-position is unable to display the real user position since the indoor GPS signal is the NLOS signal. The behavior of the estimated user position obtained from the proposed R–R positioning algorithm is close to the preset real position. Its positioning error, as shown in Fig. 11, varies within 3 m. The RMSs of the positioning error are 1.10 m along the X-axis and 1.09 m along the Y-axis. The horizontal positioning error is 1.54 m. Similar to the static results, the R–R algorithm is able to provide positioning solutions with meter-level accuracy under the dynamic condition.

Fig. 11
figure 11

Dynamic positioning error

Figure 12 shows the errors of the distances between the user terminal and the TAs under dynamic condition. In the figure, the maximum estimated distance error (RMS) is 1.54 m for \(d_{4}\) with average error of 0.25 m and STD = 1.39 m. The accuracy of the distance estimation under dynamic condition is meter level, similar to that under static condition.

Fig. 12
figure 12

Dynamic distance errors

Comparison with the \(\boldsymbol{\rho} - \boldsymbol{\rho}\) algorithm

To compare the performance of the \(\rho - \rho\) algorithm used in the previous study (Xu et al. 2015) and the R–R algorithm, the user position and distances from the user terminal to each TA are estimated using the \(\rho - \rho\) algorithm in the dynamic case. Compared to the \(\rho - \rho\) algorithm, the significant advantage of the R–R algorithm is that all required input parameters are easy to obtain from most mobile devices. Both algorithms show similar positioning accuracies when measurements from the Rx and embedded GPS module are synchronous, as illustrated in Figs. 11 and 13. In Fig. 13, the average positioning errors of \(\rho - \rho\) algorithm along both X- and Y-axes are slightly smaller than those of the R–R algorithm. The positioning errors in terms of the STD of the two algorithms are the same. The horizontal positioning accuracy of the \(\rho - \rho\) algorithm is about 1.50 m, similar to that of the R–R algorithm.

Fig. 13
figure 13

Dynamic positioning errors estimated using \(\rho - \rho\) algorithm under low GDOP satellite selection

Figure 14 shows the distance errors obtained by the \(\rho - \rho\) algorithm. Compared with the results of the R–R algorithm in Fig. 12, it can be seen that the distance accuracy of the two algorithms is similar and of approximately meter level.

Fig. 14
figure 14

Distance errors estimated using \(\rho - \rho\) algorithm under low GDOP satellite selection

The positioning errors due to the non-synchronization measurements from the user terminal and the server are shown in Fig. 15. The minimum horizontal positioning error occurs at near zero delay. For the R–R positioning algorithm, the 2-D positioning error is 1.54 m when the delay is zero, and increases to about 3.1 m while the delay reaches 5 s. Then, the positioning error varies approximately 3.1 m within a ±5-s delay. For the \(\rho - \rho\) positioning algorithm, however, the delay leads to large positioning error. As shown in the figure, a 0.5-s delay gives above a positioning error above 40 m for the \(\rho - \rho\) positioning algorithm, but the increment is only 0.81 m for the R–R positioning algorithm. The large error of the \(\rho - \rho\) positioning algorithm is caused by the additional distance bias introduced by the pseudorange rate multiplying the delay. These biases differ because the pseudorange rates are different. Thus, they changed the relative relationships among the measured distances and cannot be removed by (12). The proposed R–R algorithm is superior to the \(\rho - \rho\) positioning algorithm as it has lower synchronization requirements. This benefit is important when the server delivers the information to user terminals via Wi-Fi due to the inevitable network delay. In addition, the results suggest a limitation of the delay. For example, the delay should be within ±0.5 s if the IPS horizontal accuracy is required to be within 2.5 m.

Fig. 15
figure 15

Positioning errors estimated using RR and \(\rho - \rho\) algorithms due to the non-synchronization measurements under the dynamic condition

Conclusions

A previous study of Xu et al. (2015) proposed a new architecture of indoor positioning system to estimate the user position using the pseudorange measurements obtained by a user terminal. Considering that in the majority of mobile devices, positioning estimation rather than pseudorange measurements is available, we propose a position-difference-based indoor positioning algorithm (R–R algorithm) in this study.

The R–R algorithm estimates the distances from the user terminal to indoor antennas backward using the difference between the outdoor antenna position and pseudo-position provided from the smartphone-embedded-GNSS module. Based on the estimated distances and indoor antenna positions, the real user position is easily calculated using the least square method or other methods. We introduced the R–R algorithm and tested it using a software-defined GPS receiver. The test results show that the R–R algorithm is able to estimate distances accurately and output 2-D positions with an accuracy of several meters under both static and dynamic conditions. With respect to the \(\rho - \rho\) algorithm, the proposed algorithm is more robust with regard to non-synchronization measurements and easier to implement since pseudo-positions are obtainable from any mobile device.

In future work, we will focus on the vertical estimation based on a reliable 3-D positioning algorithm which would require accurate distance measurements or a layer detection algorithm which would need a server for logging additional layer information. Additionally, realization problems such as the low-cost Rx/Tx, the indoor transmitting antenna distribution and indoor multi-path effects will be investigated.