CHAPTER 4 SIMULATION, ANALYSIS AND IMPLEMENTATION 45
4.4 Analytical Performance Analysis
Figure 47: The reason why our algorithm is better
4.4 Analytical Performance Analysis
In this section, we try to analyze the success rate of the topology of previous example without majority. The location of the anchor is the same as Figure ??. The RSSI between different devices is a Gaussian random variable defined as Ri,j , where i and j are sequence numbers of devices. Assume α and p are the same as Section 4.1, Ri,j can be defined by σ and the distance between the two devices . Assume we have two Gaussian random variable A = Ri,j and B = Rm,n, the formula to compare the two random variables are as follows:
P (A < B) =
Here we define the event Success as finding the correct configuration and define
doi:10.6342/NTU201702027
4.4. ANALYTICAL PERFORMANCE ANALYSIS 57
Successi→i+1 as the event that we successfully find the next sequence number of device from sequence number i. The probability of Success can be defined as follows:
P (Success) =
7
Y
i=0
P (Successi→i+1) (4.11)
Refer to Figure 20, the R0,1 must be greater than all other RSSI. Thus, the probability P (Success0→1) can be defined as :
P (Success0→1) =
9
Y
i=2
P (R0,1> R0,i). (4.12) Refer to Figure 21, we can see that R1,2 must be at least greater than all other RSSI except for R1,4. For simplicity, we assume R1,4 is also greater than all other RSSI except for R1,2. Then, R0,2 must be greater than R0,4 in Figure 22. Therefore, the upper-bound of probability P (Success1→2) can be defined as :
P (Success1→2)upper−bound = (
9
Y
i=3,i6=4
P (R1,2 > R1,i)) × P (R0,2> R0,4). (4.13)
Similarly, the upper-bound of probability P (Success2→3) can be defined as:
P (Success2→3)upper−bound = (
9
Y
i=4,i6=9
P (R2,3 > R2,i)) × P (R1,3> R1,9). (4.14)
Next, we want to calculate P (Success3→4). Refer to Figure 23, we only consider that R3,4 is greater than R3,5, R3,7, and R3,9 for simplicity. From Figure 24 and 25, we know that R3,4 and R3,8 must be greater than R3,6 and R1,4 must be greater than R1,8. Then the probability can be defined as:
P (Success3→4)upper−bound = (
4.4. ANALYTICAL PERFORMANCE ANALYSIS 58
For the rest probabilities, devices only need to find the closest devices and the probability can be defined as:
P (Successi→i+1) =
9
Y
j=i+2
P (Ri,i+1 > Ri,j), where 4 ≤ i ≤ 7. (4.16) The curve of the analytical result and the simulation result are shown in Figure 48.
We can see that the analytical result corresponds with the simulation.
Figure 48: Comparison between simulation and analytical result
We also plot all P (Successi→i+1), as shown in Figure 49. Obviously, the bottleneck of this topology is at sequence number 3. With MER=0.2, P (Success3→4) is under 0.6 while other P (Successi→i+1) are greater than 0.8. This makes sense because from sequence number 3 to 4, it encounters the most ambiguity number. Also, only
doi:10.6342/NTU201702027
4.5. PROTOCOL AND IMPLEMENTATION 59
sequence number 3 need to ask previous devices twice.
Figure 49: All P (Successi→i+1), i = 1, 2, ..., 7
If we can use two anchors, we can assign the second anchor to the location of sequence number 3 as a “checkpoint”. From doing this, we can avoid the bottleneck of this topology and become more robust. Other topologies can use the similar analyze method to calculate all P (Successi→i+1) and find the bottleneck of that topology.
4.5 Protocol and Implementation
In addition to designing the topology-based algorithm, we also design a simple protocol for the algorithm. We adopt the concept of the token ring protocol, as shown in Figure 50.
In our protocol, only the device which holds the token can action, and we call that device as the token holder. The way to decide the next token holder is based on our algorithm. We assume that all devices hold the ambiguity list for the current topology. The current token holder uses the topology-based configuration algorithm to find the device of the next sequence number, and then send the token to that device. Thus, the next device becomes the token holder. Until the final device, it will
4.5. PROTOCOL AND IMPLEMENTATION 60
use flooding to send the token back to the anchor, and this round is done. The system repeats this procedure for majority number times which is set by programmers and each device will record the result of every round. The details of what each device will do are shown in Figure 51.
Figure 50: The concept of the protocol
Figure 51: The details of the protocol
There is a good property of this protocol: it can concurrently do multiple rounds.
Devices which have a sequence number will do nothing until the end of this round, so these devices can start the next round. Concurrency can accelerate the configuration
doi:10.6342/NTU201702027
4.5. PROTOCOL AND IMPLEMENTATION 61
speed of our algorithm. Other algorithms cannot achieve concurrency because they need to check if there are two devices in one location or not.
Figure 52: FCM2401 Module
Figure 53: The implementation and indoor environment
The algorithm is easy to implement in the distributed way. We have also im-plemented the proposed algorithm with the protocol mentioned above on the board FCM2401 which equipped with STM32F0 chip and IEEE 802.15.4 wireless module.
4.6. SUMMARY 62
The implementation shows that our algorithm can really be used indoors and without any RSSI model measurement.
4.6 Summary
The performance metrics among three algorithms is in Table 4. The calculation of complexity of topology-based configuration algorithm is as follows. Each device needs to compare at most N RSSIs, where N is the total number of devices. We have N devices, so the complexity is O(n2). However, if the protocol proposed is used, the complexity can reduce to O(n) due to the concurrency. The performance metrics show that our algorithm is the most accurate and do not have any trade off.
Trilateration MDS-ICP Topology
based Convert RSSIs
to distances Yes No No
Accuracy Medium Low High
Complexity O(n2) > O(n3) O(n2) or O(n) Scaled, Rotated
and Flipped No Yes No
Table 4: Performance metrics among three algorithms
doi:10.6342/NTU201702027
CHAPTER 5
CONCLUSIONS
In this thesis, we proposed a topology-based algorithm for location configuration of IoT applications which have a prior topology information. In our solution, devel-opers do not need to estimate the transformation model between RSSIs and distances and the accuracy is very high. Simulations show that, with the grid topology, the performance of our solution can achieve 80% success rate with 0.8 MER, which is much better than other algorithms. Moreover, the complexity can be only O(n) with the protocol designed by us.
The protocol we designed is based on token ring and it can simply achieve con-currency to accelerate the configuration speed. The implementation shows that our algorithm can really be used indoors and without any RSSI model measurement.
Our solution can be used in not only smart agriculture but also many applications such as smart lights in a factory, smart street lights, sensors of smart health-care systems, etc. With our solution, developers and service providers can avoid labor-intensive RSSI measurements and achieve high success rate to configure locations of devices. For the most of IoT applications, configurations of devices will be much easier and effective with the help of our location configuration solution.
63
doi:10.6342/NTU201702027
APPENDIX A
ALGORITHM TO FIND ALL REGIONS
We design an algorithm to analyze a topology and find all regions without overlap-ping. We first introduce some definitions with Figure 54. Notice that the blue lines are perpendicular bisectors and the green lines are boundaries, as shown in Figure 30.
• Vertex
Intersect points of perpendicular bisectors. In Figure 54, all red points are vertices.
• Edge
A line connects only two vertices. In Figure 54, edges are a part of perpendicular bisectors or boundaries. Thus, edges are green or blue.
• Region
An area enclosed by edges. Each region is a polygon, and any polygon does not intersect with any edge.
• Degree of an edge
Times to be used to construct a region. In Figure 54, the degree of blue edges is two, and the degree of green edges is one.
doi:10.6342/NTU201702027 65
Figure 54: Vertices, edges and regions
Now we want to convert Figure 54 to an adjacency matrix. Figure 55 is a simplified example for converting a graph to an adjacency matrix. The order of each column and row of the matrix represent each vertex in the graph. If there exists an edge between vertex-2 and vertex-4, we record the degree of that edge at [2, 4] and [4, 2] in the matrix. We can see that because the degree of the edge is two, the value of [2, 4]
in the matrix is two. Notice that the adjacency matrix is a symmetric matrix.
66
Figure 55: Simplified example for the adjacency matrix
All regions can be found with the adjacency matrix. First, we extract all triangles, because all triangles are regions. As shown in Figure 56, we can find a triangle from one vertex to other two vertices. Here the three edges and three vertices represent a region. We record the region and delete one degree of each edge in the adjacency matrix, as shown in Figure 57.
Figure 56: The way to find all triangles
doi:10.6342/NTU201702027 67
Figure 57: Remove degrees of edges
After extracted a triangle, the graph and the adjacency matrix is shown in Fig-ure 58. Now the remained region is a polygon with five edges. It is too difficult to find a polygon with five edges just as what we do with triangles, so we use an alternative way to extract the polygon. We “fold” the adjacency matrix as the following rules:
Step-1 Find a vertex which is connected by only two edges. The two another vertices of the two edges form a folded edge. For example, in Figure 59, if we find a vertex-2 which has two edges [3, 2] and [4, 2], vertex-3 and vertex-4 form a folded edge [3, 4].
Step-2 Remove degrees of the two edges on the original adjacency matrix and record them.
Step-3 Add the degree of the folded edge to the folded adjacency matrix
Step-4 Repeat Step-1 to 3 until the original adjacency matrix becomes a zero matrix
Figure 59 to 61 are each step of our algorithm, and the folded result is in Figure 62.
68
Figure 58: The graph and the adjacency matrix after extract a triangle
Figure 59: Fold the [3, 2] and [3, 4]
doi:10.6342/NTU201702027 69
Figure 60: Fold the [5, 4] and [5, 6]
Figure 61: Extract the edge [3, 6]
70
Figure 62: The folded graph and folded adjacency matrix
We can extract the triangle from the folded adjacency matrix and then transform the triangle back to the polygon in Figure 58. If the polygon folded is still not a triangle, just fold it recursively. We can repeat the folding and extract triangles to find all regions and the complete algorithm is shown in Figure 63. Here we also show another more complicated example in Figure 64 to 66.
Euler planar theorem is another way to check the correctness of the number of all regions. The graph is a planar graph because of the definition of vertices. There is no edge intersection and the each edge does not cross another edge. Thus, the graph is a planar graph. Euler planar theorem is as follows:
Euler Planar Theorem. If a finite, connected, planar graph is drawn in the plane without any edge intersections, and v is the number of vertices, e is the number of edges and r is the number of regions (regions bounded by edges, including the outer, infinitely large region), then
v − e + f = 2 (A.1)
doi:10.6342/NTU201702027 71
Because our algorithm does not consider the outer, infinitely large region, we use v − e + f = 1 as the formula to check the number of regions.
Figure 63: The algorithm to find all regions
Figure 64: A more complicated topology
72
Figure 65: Recursively find all regions
Figure 66: Final result of finding the max-min point
doi:10.6342/NTU201702027
APPENDIX B
EXAMPLES OF OTHER TOPOLOGIES
Figure 67: Example of topology 1
73
74
Figure 68: Example of topology 2
doi:10.6342/NTU201702027 75
Figure 69: Example of topology 3
76
Figure 70: Example of topology 4
doi:10.6342/NTU201702027 77
Figure 71: Example of topology 5
doi:10.6342/NTU201702027
REFERENCES
[1] S. Chen, H. Xu, D. Liu, B. Hu, and H. Wang, “A vision of iot: Applications, challenges, and opportunities with china perspective,” IEEE Internet of Things journal, vol. 1, no. 4, pp. 349–359, 2014.
[2] “Top 6 Fast Growing Tech Industries in China - Internet of Things and Social Media.” http://www.thexnode.com/blog/
top-6-fast-growing-tech-industries-in-china-internet-of-things.
[3] A. Al-Fuqaha, M. Guizani, M. Mohammadi, M. Aledhari, and M. Ayyash, “In-ternet of things: A survey on enabling technologies, protocols, and applications,”
IEEE Communications Surveys & Tutorials, vol. 17, no. 4, pp. 2347–2376, 2015.
[4] J. Xu, W. Liu, F. Lang, Y. Zhang, C. Wang, et al., “Distance measurement model based on rssi in wsn.,” Wireless Sensor Network, vol. 2, no. 8, pp. 606–611, 2010.
[5] S. Shrestha, E. Laitinen, J. Talvitie, and E. S. Lohan, “Rssi channel effects in cellular and wlan positioning,” in Positioning Navigation and Communication (WPNC), 2012 9th Workshop on, pp. 187–192, IEEE, 2012.
[6] A. Savvides, C.-C. Han, and M. B. Strivastava, “Dynamic fine-grained localiza-tion in ad-hoc networks of sensors,” in Proceedings of the 7th annual internalocaliza-tional conference on Mobile computing and networking, pp. 166–179, ACM, 2001.
[7] L. Doherty, L. El Ghaoui, et al., “Convex position estimation in wireless sensor networks,” in INFOCOM 2001. Twentieth Annual Joint Conference of the IEEE Computer and Communications Societies. Proceedings. IEEE, vol. 3, pp. 1655–
1663, IEEE, 2001.
doi:10.6342/NTU201702027
REFERENCES 79
[8] D. Moore, J. Leonard, D. Rus, and S. Teller, “Robust distributed network local-ization with noisy range measurements,” in Proceedings of the 2nd international conference on Embedded networked sensor systems, pp. 50–61, ACM, 2004.
[9] K. A. Khalid and T. A. Gulliver, “Range-based localization in wireless networks using decision trees,” in GLOBECOM Workshops (GC Wkshps), 2010 IEEE, pp. 131–135, IEEE, 2010.
[10] R. Nagpal, H. Shrobe, and J. Bachrach, “Organizing a global coordinate system from local information on an ad hoc sensor network,” in Information Processing in Sensor Networks, pp. 333–348, Springer, 2003.
[11] I. Borg and P. J. Groenen, Modern multidimensional scaling: Theory and appli-cations. Springer Science & Business Media, 2005.
[12] X. Ji and H. Zha, “Sensor positioning in wireless ad-hoc sensor networks using multidimensional scaling,” in INFOCOM 2004. Twenty-third AnnualJoint Con-ference of the IEEE Computer and Communications Societies, vol. 4, pp. 2652–
2661, IEEE, 2004.
[13] Y. Shang and W. Ruml, “Improved mds-based localization,” in INFOCOM 2004.
Twenty-third AnnualJoint Conference of the IEEE Computer and Communica-tions Societies, vol. 4, pp. 2640–2651, IEEE, 2004.
[14] B. Zitova and J. Flusser, “Image registration methods: a survey,” Image and vision computing, vol. 21, no. 11, pp. 977–1000, 2003.
[15] Y. Chen and G. Medioni, “Object modelling by registration of multiple range images,” Image and vision computing, vol. 10, no. 3, pp. 145–155, 1992.
[16] P. J. Besl and N. D. McKay, “Method for registration of 3-d shapes,” in Robotics-DL tentative, pp. 586–606, International Society for Optics and Photonics, 1992.
REFERENCES 80
[17] R. Mautz, “Indoor positioning technologies,” 2012.