## 5 Performance Testing  
Various implementation factors that could affect the BLE signals and the overall positioning accuracy were identified in performance testing. A series of tests was performed, including (1) a deployment position test (ceiling vs. wall), (2) a deployment density test, (3) a fingerprint space interval test, (4) a fingerprint collection time test, (5) a transmission interval test, (6) a venue test and (7) a crowd analysis test; to evaluate the performance of the iBeacon deployments in indoor positioning. Tests were conducted in sequences that allowed findings from earlier tests to be incorporated into later tests. For each test, we collected sets of fingerprint data using the mobile devices as the signal database, with handheld posture and sets of random samples spread across the room as test points. The true positions of the test points were surveyed by steel tape, and these true positions were compared with the positioning results obtained from the tests for evaluation and analysis. The weighted k-nearest neighbour method was employed for all performance tests in this study, for matching the signals collected at test points to the fingerprint database. This method assigns the weighting to the k-nearest neighbour points based on the signal distance, and calculates the coordinates of the test points \((x,y)\) using (1):  
\[(x,y)=\frac{\sum_{i=1}^{k}w_{i}(x_{i},y_{i})}{\sum_{i=1}^{k}w_{i}} \tag{1}\] \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Environmental** & **Average Packet Loss** & \multirow{2}{*}{**Average RSSI (dBm)**} & **Standard Deviation** \\
**Condition** & **Rate (\%)** & & **of RSSI (dBm)** \\ \hline Temperature & 4.1 & \(-\)75.51 & 4.94 \\ Wind & 2.2 & \(-\)77.67 & 3.84 \\ Tree & 1.8 & \(-\)71.87 & 4.01 \\ Vehicle traffic & 2.4 & \(-\)72.87 & 4.19 \\ Pedestrian traffic & 2.8 & \(-\)73.83 & 4.70 \\ Blocked by pedestrian & 2.9 & \(-\)75.52 & 6.08 \\ Control & 2.3 & \(-\)73.35 & 4.70 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Average packet loss rate, RSSI and standard deviation of RSSI. where \(k\) is the selected number of nearest neighbour, \((x_{i},y_{i})\) are the coordinates of the points having the shortest distance with the test point and \(w_{i}\) is the weighting calculated by distance:  
\[w_{i}=\frac{1}{d_{i}} \tag{2}\]  
where \(d_{i}\) is the Euclidean distance of signals. Based on the findings from our preliminary study, the positioning accuracy is the highest when selecting k equals to 4 in the weighted k-nearest neighbour method. Thus, we used this value for all the performance tests. The fingerprint grid interval was 1 m and the fingerprint collection time was 10 s, except when testing the effects of fingerprint grid interval and collection time on positioning accuracy. The fingerprint data were collected with static status to one direction, facing the blackboard/whiteboard at the front only, because most students would sit in this direction in normal teaching and learning spaces. The testing data were collected with the same configurations as the training data. Tests conducted after the first test, i.e., the deployment position test, used the signal data collected from ceiling-mounted iBeacons due to the superior accuracy of that placement method. The tests were conducted in the classrooms of the Hong Kong Polytechnic University as described in Table 2 and shown in Figure 5.