# A Low-Cost Collaborative Location Scheme with GNSS and RFID for the Internet of Things
## 3 Collaborative Scheme with Global Navigation Satellite System (GNSS) and RFID Location
### Tag-Location Principle  
According to the description of the system overview, assuming \(n\) tuples have been achieved, for the i-th location, we get the value \((t_{\rm i},p_{\rm i},d_{\rm i})\), where \(t_{\rm i}\) represents the locating time; \(p_{\rm i}\) is the position of the mobile RFID reader, using \((x_{\rm i},y_{\rm i})\) denotes the coordinates value of the position \(p_{\rm i}\) at time \(t_{\rm i}\). \(d_{\rm i}\) is measured by the RFID reader under the RFID ranging principle, which records the distance between the reader and the tag. The effective ranging distance is about 160 m, which may change with the surrounding conditions. Given the coordinates of the target tag as \((x_{\rm P},y_{\rm P})\), this satisfies the following equation, where \(n\) denotes the \(n\)-th location:  
\[\left(x_{\rm i}-x_{\rm P}\right)^{2}+\left(y_{\rm i}-y_{\rm P}\right)^{2}={d_ {\rm i}}^{2}\;{\rm i}=1,2,3\ldots n \tag{1}\]  
With two points of mobile moving trajectory and the target tag point, such as triangle \((\Delta ABP)\), is constructed as shown in Figure 3a. According to Equation (1), this triangle can be transformed to an algebraic equation in Equation (2). The solution of Equation (2) is the coordinates of the target tag. Unfortunately, in an algebraic sense, this algebraic equation has two solutions, namely \(p\) and \(p_{1}\) shown in Figure 3a, which is a conflict of the reality that it has only one target tag at point \(p\). \[\left\{ \begin{array}{ll}\left(x_{\rm i}-x_{\rm P}\right)^{2}+\left(y_{\rm i }-y_{\rm P}\right)^{2}={d_{\rm i}}^{2}\;i=1,2,3\ldots n\\ \left(x_{\rm i}-x_{\rm P}\right)^{2}+\left(y_{\rm j}-y_{\rm P}\right)^{2}={d_ {\rm j}}^{2}\;j=1,2,3\ldots n\end{array} \right. \tag{2}\]  
Figure 2: Snapshot of RFID tag location process. Inspired by the redundant observation methodology in the geomatics domain, in addition to a necessary number of measurements, we took redundant observations and measures to strengthen the measurement accuracy in the survey process [35]. In our location scheme, every triangle has two solutions, namely \(p\) and \(p_{\text{i}}\) (i = 1, 2, 3,... ), in which point \(P\) is ideally in the same position while the \(p_{i}\) is different mainly for all triangles (as shown in Figure 3a). Therefore, \(p\) is the unique value of the target tag. As the mobile reader moves, we will obtain more numbers of the triangles, along with the coordinates of the target tag. However, due to measurement error, we will get a suite of possible positions of point \(p\), as \(P\), \(P^{\prime}\), and \(P^{\prime\prime}\) in Figure 3a. A simple arithmetic mean value is then taken to achieve the estimated position of \(p\) with Equation (3), wherein \((x_{\text{P}},y_{\text{P}})\) denotes the coordinates of point \(p\). The pseudo code of the tag localization algorithm is shown in Algorithm 1. \[(x_{\text{P}},y_{\text{P}})=\ \frac{1}{n}\sum_{\text{i=1}}^{n}(x_{i},\ y_{ \text{i}}) \tag{3}\]  
The algorithm implementation for computing the tag location is as below:  
```
Input: reader location, distance Output: coordinate of target tag
1 For each point in saved reader location points set do
2 set\(p_{\text{i}}\) = point coordinate of points set
3 set\(p_{\text{i+1}}\) = reader location
4 set\(d_{\text{1}}\) = distance between \(p_{\text{i}}\) and tag
5 set\(d_{\text{2}}\) = distance between \(p_{\text{i}}\) and \(p_{\text{i+1}}\)
6 set\(d_{\text{3}}\) = distance between \(p_{\text{i+1}}\) and tag
7 if\((p_{\text{i}},p_{\text{i+1}},d_{\text{1}},d_{\text{2}},d_{\text{3}})\) can build a triangle then
8 calculate the coordinate of target tag
9 add the coordinate to a candidate points set
10 else
11 continuous the next loop
12 end if
13 End for
14 Add \((p_{\text{i+1}},d_{\text{3}})\) to reader location points set for next reader location calculate
15 For each coordinate of candidate points set do
16 Calculate the mean value of all points
17 End for

Figure 3: Proposed location algorithm. (a) One triangle composed of three points, practical model of triangulation.