# BSSH: Bluetooth Indoor Positioning Strategy for Ship Cabin Based on Hierarchical Area

Authors: JunBo Gao; ZhenXiao Qin; Tao Fan; Wei Sun
Journal: Mobile Information Systems
 (2022)

---

## Abstract

In the process of ship's ocean transportation, the monitoring of crew's work completion is a very important part in the ship safety management, and using indoor positioning technology can improve the construction of ship management system. However, the current indoor positioning technology is not ideal in the engine room environment in the face of the complex electromagnetic environment and spatial structure. In order to improve the positioning accuracy, this paper proposes a Bluetooth indoor positioning strategy for ship cabin based on hierarchical area (BSSH) for deploying and dividing the regions requiring indoor positioning and combines Bluetooth Low Energy (BLE) with Bluetooth fingerprint positioning technology. Processing the fingerprint library by using region hierarchy and proximity classification algorithms to obtain reliable results in the ship environment, the results show that better Beacon deployment and hierarchical area algorithms can lead to a localization accuracy of 80.38%.


---

## Body

## 1. Introduction

With the development of navigation technology, the ship owner's requirements of ships’ safety management are also increasing [1], but there are still some factors that restrict the improvement of its safety management level in the modern ship's engine. Among them, the comprehensive quality of personnel has a great influence on the level of ship's engine safety management, especially on whether the duty officers execute the duty regulations correctly and effectively. The monitoring of engine site duty track by indoor positioning technology can eliminate the safety problems caused by human factors, so as to ensure the safety of ship navigation.At present, the indoor positioning research based on fingerprint technology in ships mainly focuses on passenger cabins and decks, not differing much from the typical indoor environment. While the spatial structure of engine room is complex and the floor distribution is irregular, the mainstream indoor positioning technology is designed based on the positioning of typical indoor environment [2] and cannot effectively cope with the complex space structure in the engine room [3]. The motivation of the work in this paper is to study BLE-based indoor positioning technology and to solve the problem of low positioning accuracy in the complex spatial environment of the cabin.In this paper, by building a fingerprint model and establishing a fingerprint library in the comprehensive laboratory of ship's cabin at Shanghai Maritime University, a Bluetooth indoor localization strategy (BSSH) based on hierarchical region for ship's cabin is proposed on this basis. Experimental results show that the regional localization accuracy of BSSH under certain deployment conditions is better than the mainstream K-Nearest Neighbor (KNN) indoor localization technique based on Euclidean distance [4]. The method improves the accuracy of localization while reducing the amount of matching search, and it can be applied to ship indoor localization applications.The main contributions of this paper are as follows:(1)
The mainstream localization algorithm will have a significant decrease in accuracy in ship carbon environment, and this paper proposes BSSH as having better output results in cabin environment.(2)
This algorithm classifies the data of the fingerprint library according to the characteristics of the data to be measured according to the proximity, which reduces the search volume of fingerprint matching, making the data to be matched reduced by two-thirds and speeding up the localization speed.(3)
In order to enhance the robustness of this algorithm, an optimized region selection strategy is proposed in this paper to improve the region localization accuracy.The rest of this paper is organized as follows. Section2 briefly introduces the work related to indoor localization technique based on Bluetooth fingerprint technology and shipboard Bluetooth indoor localization technique. Section 3 introduces the BSSH proposed in this paper. Section 4 describes the experimental procedure as well as the analysis of the results. Section 5 concludes the paper.


## 2. Related Work

This section briefly introduces why Bluetooth is chosen as the beacon device and the work related to shipboard Bluetooth indoor positioning technology.In order to get a better understanding of the actual working environment of the engine operation, we take the Anji 23 ship in Figure1 as the experiment object. Through the experiments, we found the following challenges in indoor positioning in the engine room environment.(1)
Complex space structure: there are many equipment inside the engine room. At the same time, due to the special nature of the ship, the object blocking effect is more obvious, and indoor positioning is very difficult [5].(2)
Equipment installation problem: the engine room has strict construction safety requirements, and no perforation work and additional equipment can be installed in the engine room bulkhead, so too larger positioning equipment such as UBW and cellular network cannot be used in the engine room.(3)
Equipment loss problem: as cargo ships sail on the sea for a long time, the natural environment is more severe compared with land, and as the engine room is a high-temperature and pollution-prone environment, the corrosion degree of equipment far exceeds that in the passenger cabin environment of cruise ships. There are certain requirements for the cost of equipment, so taking into account the cost, expensive source equipment cannot be used. For example, the deployment and maintenance of ultra-wideband (UWB) are more troublesome [6]. It is not suitable to be used in the cabin environment; WIFI positioning is suitable for luxury cruise ships, not for cargo ships. Therefore, compared with the costly deployment of WIFI [7], Bluetooth is more suitable for use in a wheelhouse environment.(4)
Electromagnetic shielding effect: the operation of many instruments and equipment inside the ship's hold will produce a very serious electromagnetic shielding effect when the cargo ship is underway, thus reducing the positioning accuracy of mainstream methods [8].Figure 1
Anji 23 ship and its ship cabin. (a) Anji 23 ship. (b) The scene graph of cabin.
(a)(b)In summary, it was decided to use Bluetooth as the positioning device and to use Bluetooth Low Energy (BLE) to reduce the cost of equipment replacement [9]. And the methods of indoor positioning technology fall into two categories: range-free and range-based [10]. Fingerprint technology belongs to one of the range-free methods and is also the positioning method used in this paper.Fingerprint-based indoor positioning techniques focus on the radio-statistical characteristics of the space and require a large amount of existing infrastructure [11]. In a real shipboard environment, the decks and walls are steel framed, which causes a multipath effect on the signal, resulting in strong reflections of the wireless signal [12]. At the same time, signal propagation changes dynamically during a given voyage, including transient disturbances such as object motion, door opening and closing, and long-term changes in speed, temperature, humidity, and weather conditions. Therefore, Received Signal Strength Indication (RSSI) is considered to be a complex combination of radio path loss factors, metal reflections, multipath effects, ship engine noise, and other factors [13, 14]. Fingerprinting is more suitable for the complex positioning environment of the engine room than distance-based geometric positioning methods.The current research on fingerprint technology by scholars mainly focuses on typical indoor environments. Jin Saizhou et al. used coarse and fine granularity division to build a fingerprint library about the location mapping of RSSI sampling points and proposed an adaptive Bluetooth fingerprint localization algorithm based on region preference, which can effectively eliminate the points far from the localization point [15]. Mo Qian et al. used proximity to classify the fingerprint database, which significantly reduces the cost of classification process for fingerprint database compared with the commonly used K-mean clustering algorithm[16]. Kezhong Liu et al. proposed a fault-tolerant region based cabin localization method, which significantly improves the reliability of Bluetooth localization in the cabin environment [17]. In order to solve the problem of ship movement, Mozi Chen et al. calibrated the fingerprint library from single speed to multi-speed by using the method of reconstructing fingerprint data and found that the method improved the regional localization accuracy from 63% to 83.9% after practical tests [18].From the above work, it can be seen that the current Bluetooth-based indoor positioning mainly focuses on the construction of fingerprint libraries and indoor positioning in typical indoor environments, such as factories, cruise ship cabins, and other flat environments, and lacks effective indoor positioning in cabin environments.


## 3. Bluetooth Indoor Positioning Strategy for Ship Cabin Based on Hierarchical Area (BSSH)

For the special environment of the cabin, this paper proposes the Bluetooth indoor positioning strategy for ship cabin based on hierarchical area (BSSH), which effectively improves the indoor positioning accuracy in the cabin environment by layered positioning method. The specific steps of BSSH are shown in Figure2.Figure 2
Flow chart of hierarchical regional positioning.Step 1.
Collect the fingerprint data of the pointD to be measured.Step 2.
Data cleaning and noise reduction are performed on the collected datad to remove biased data to reduce the effect of noise on the localization results.Step 3.
Set the value K of the conventional KNN localization method. Find the K sets of fingerprint data with the smallest Euclidean distance fromD in the fingerprint database, as shown in equation (3).(1)RSSI1,RSSI2,RSSI3，…,RSSIn1,RSSI1,RSSI2,RSSI3，…RSSIn,2…RSSI1,RSSI2,RSSI3，…RSSInK.
The Euclidean distance is calculated as in (4), where X, Y represent the elements of two different vectors, and xi， yi represent the elements corresponding to the two vectors.(2)distX,Y=∑i=1nxi−yi2,i∈1，n.
After obtaining K sets of fingerprint data, get K sets of regions according to the region labels corresponding to the fingerprint data, and obtain the three sets of regions with the largest number of frequenciesa1, a2, a3。Use a1 as the result of the traditional method to locate and obtain the nearest point A in the fingerprint database to the point D to be tested, and calculate the average Euclidean distance da1 between the fingerprint data of group K and the fingerprint data of the point to be tested to obtain the first set of results: a1,da1。Step 4.
The areasa1, a2, a3 obtained by Step 3 are used as the floor determination areas, and the areas are grouped into the corresponding floors according to the predivided floors. The fingerprint database is divided into dimensions according to the floors. Then classify the data in the fingerprint database according to the proximity [16]. According to the characteristics of the fingerprint data of the point to be measured, the top three intensity beacons are taken as three groups of labels, as well as the fingerprint data whose proximity meets the above; these labels are selected in the fingerprint database as the matching fingerprint database. The results of stratified region localization b1, b2, b3 will be obtained based on regions a1, a2, a3, and the corresponding mean Euclidean distances db1,db2,db3 will be obtained using the same method as Step3 to obtain three sets of results for the stratified region localization method: b1,db1b2,db2, b3,db3.Step 5.
The four sets of data will be compared according to different situations for regional selection:(i
)All four groups of regions are in agreement, and the result of traditional positioning methoda1 is chosen as the positioning region.(ii)
The three sets of results obtained from stratified area localization are consistent but different from the results of mainstream methods, and the result of stratified area localizationb1 is chosen as the localization area.(iii)
The results of the mainstream positioning method agree with the first of the three sets of results obtained from the hierarchical regional positioning, and the results of the mainstream positioning methoda1 are used as the positioning region.(iv)
When the average Euclidean distanced of the results of the conventional positioning method is the largest among the four sets of data, the set of data with the smallest average Euclidean distance d among the three sets of results of the hierarchical regional positioning is selected as the positioning region.(v)
When the average Euclidean distanced of the results of the mainstream localization methods is not the largest, the one with the largest average Euclidean distance d among the four sets of data is selected as the localization area.
BSSH is based on the KNN algorithm, which divides the data in the fingerprint database into regions when the fingerprint database is established. Using the KNN algorithm usually selects K (K ≥ 2) groups of fingerprint data that are closest to the Euclidean distance of the loci to be determined and selects the region with the largest frequency.
In the offline, RSSI signals are collected in the ship's cabin integrated laboratory to construct an offline location fingerprint library, and the RSSI calculation formula [19] is(3)RSSI=A−10n∗lgd.
Ten sets of data are collected at each fingerprint collection point, and the fingerprint library matching time is reduced by optimizing the ten sets of data with the calculation formula as in (2).(4)RSSI=∑i=110RSSIi−MAXR−MINR8.
RSSI denotes the optimized fingerprint information value, andMAXR, MINR denote the maximum and minimum values among ten sets of RSSI signals, respectively.
In the online stage, the data of the fingerprint database are divided using BSSH to turn the three-dimensional localization problem, into a two-dimensional localization problem.
The principle of these two steps is that when the average Euclidean distance of the mainstream localization method is the largest, it means that the deviation of the results of it is less, because if the region is correctly determined, the total error of the minimum Euclidean distance obtained by using the hierarchical region determination method is less than the minimum Euclidean distance obtained by the traditional method. Therefore, if the above conditions are satisfied, it is sufficient to use a set of data with the least average Euclidean distance as the determination area.
On the contrary, it means that the mainstream method has a larger localization error and the data under the error tier area obtained will have a smaller average Euclidean distance in the localization calculation, so the set of data with the largest average Euclidean distance is used as the determination area.
In summary, the BSSH proposed in this paper provides a solution to solve the indoor localization problem of the engine room. Firstly, the collected fingerprint data are processed and cleaned, and the specific parameters of its Gaussian model are estimated using the great likelihood method [20]. Secondly, the hierarchical area localization method is used to reduce the localization bias caused by fingerprint data from different floors to different locations. Finally, the localization results are analyzed, and according to the localization situation, suitable results are selected to further improve the localization accuracy.


## 4. Experimental Procedure and Analysis of Results

In this section, this paper performed simulation experiments which are used to evaluate the positioning accuracy of BSSH, and the experimental scenario is a ship's cabin integrated laboratory of Shanghai Maritime University. In this work, Bluetooth beacons are used with nRF52810 chip supporting Bluetooth 4.0, broadcasting power at -95dB-4 dB and its practical distance within 50m.


### 4.1. Deployment of Experimental Environment

The experimental site this paper used was the automated ship cabin laboratory of Shanghai Maritime University. In the experimental environment of 23m × 24 m×15m, located in the middle is the mainframe, which has three levels, and there is a three-level corridor to the north of the mainframe and a two-level corridor to the south, arranged with various marine instruments and equipment, as shown in Figure3. Nine beacons were arranged respectively according to the distribution of instrumentation and equipment to ensure that the Bluetooth signal could cover the whole area. In order to facilitate the subsequent collection of fingerprint data, the 9 Bluetooth beacons were numbered from 1 to 9 respectively, and the distribution of the numbered Bluetooth beacons was shown in Figure 4.Figure 3
Experimental environment of the automation laboratory. Figure3 is reproduced from Gao et al.: (a) the experimental site of this article, (b) the Bluetooth beacon, and (c) the layout of the Bluetooth beacon.
(a)(b)(c)Figure 4
Spatial distribution of the Bluetooth beacons. Figure4 is reproduced from Gao et al.


### 4.2. Acquisition and Processing of Experimental Data

After the Bluetooth beacons were arranged, the broadcast power of the Bluetooth beacons was set to 0 dBm. The data acquisition of Bluetooth fingerprint data for this experiment was performed by dividing the experimental environment of 23m × 24 m × 15 m into small grids of 1 m × 1 m × 1 m, i. e., each cubic meter represents one fingerprint acquisition point. Taking the southwest corner of the automated cabin laboratory as the origin, each fingerprint collection point was numbered according to the three-dimensional coordinates, and ten sets of data were collected for each fingerprint collection point, as shown in Table 1, which shows the data collection of fingerprint collection points with coordinates (1, 1, 1).Table 1
Fingerprint data collected at fingerprint collection points (1, 1, 1).
Coordinates123456789(1,1,1)−86−82−85−79−85−86−84−85−90(1,1,1)−91−79−91−79−85−86−90−93−90(1,1,1)−91−78−93−88−83-86−90−85−90(1,1,1)−88−78−91−88−83-86−81−86−90(1,1,1)−95−85−91−88−83−86−81−84−90(1,1,1)−86−85−91−88−86−86−81−85−89By collecting 1000 sets of RSSI data at the point to be measured, it found that Bluetooth signal reception strength approximately conforms to a Gaussian distribution with data analysis. That was the probability of the received RSSI value satisfying a Gaussian distribution model when the measurement distance is constant. The distribution of 1000 sets of data is shown in Figure5, and the probability density function is shown in (5): (5)R=12πσexp−RSSI−μ22σ2.Figure 5
RSSI probability distribution of individual test points.μ is the mathematical expectation and s is the standard deviation. In this paper, the great likelihood estimation [20] is used to obtain the values of parameters µ and s in the model, and the solution formula is shown in (6) and (7), where N denotes a set of the number of RSSIs that conform to the Gaussian distribution. For the specific derivation process, please refer to the literature [21]. By processing it, a total of 24680 sets of raw data were collected from 2468 fingerprint collection points at 5520 coordinates, removing the unreachable fingerprint collection points. The 2468 sets of processed Bluetooth fingerprint data were obtained by great likelihood estimation and used as our Bluetooth fingerprint library for online matching.(6)μRSSI=1N∑i=1NRSSIi,(7)σ^2RSSI=1N−1∑i=1NRSSIi−μRSSI2.


### 4.3. Area Division of the Experimental Environment and Stratification of Fingerprint Library Data

#### 4.3.1. Area Division of the Experimental Environment

Since the majority of engineer's shift revolves around instruments and equipment, so this paper adopted area positioning. The Bluetooth beacons were deployed according to the distribution of the instruments, and then the positioning areas were divided according to the Bluetooth beacons. The whole automated nacelle lab was divided into 8 areas according to the beacons, and the areas are divided as shown in Figure6. The criteria for the division are based on the deployment of Bluetooth beacons, and the areas are divided according to the distribution of the beacons.Figure 6
Positioning area division situation.The whole space was divided into 8 localization areas based on the instrument and Bluetooth beacons, while the data in the fingerprint library were marked according to the division.


#### 4.3.2. Hierarchical Processing of Fingerprint Database Data

RSSI model of Bluetooth is used in space, especially in such a complex electromagnetic environment in the engine room; the RSSI strength of Bluetooth beacons decays exponentially with distance [13, 17]. Using the average path loss model expressed as a function of distance, as shown in (8), PL(d) denotes the path loss. n is the path loss exponent, which indicates the rate at which the path loss increases with distance, d is the signal reception distance, and d_0 = 1 m is the reference distance. x_σ is a zero-mean Gaussian distributed random variable (in dBm), and s is the standard deviation [18],(8)PLd=PLd0+10nlogdd0+Xσ.The path loss of Bluetooth beacons was tested experimentally in an automated cabin laboratory environment, as shown in Figure7:Figure 7
RSSI path loss situation.It can be seen that the Bluetooth beacon shows an exponential decrease within 3 meters, and beyond 3 meters, the intensity loss gradually tends to a straight line.Therefore, when performing the stratification, the planar stratification with floor 24×25, as shown in Figure8(a), the distance between beacons after stratification will be longer than the exponential decay region, thus causing the Bluetooth fingerprint data to have less significant features and lower accuracy under the horizontal stratification. So, 24 × 15 longitudinal stratification is used, as shown in Figure 8(b), to make the beacon data more distinctive under longitudinal stratification by reducing the distance between individual beacons after stratification. With the stratification process, regions 1 and 4 are categorized as layer 1, regions 2 and 5 are categorized as layer 2, and regions 3, 6, 8, and 9 are categorized as layer 3. The area localization after stratification only requires Euclidean distance calculation for the beacon data belonging to the layer according to the previously obtained layer number, discarding the influence of extraneous beacons with long distances on the results and transforming 3D localization into a 2D localization problem.Figure 8
Two stratification cases.
(a)(b)Then the fingerprint library is classified according to the signal intensity magnitude, and the three beacons with the highest intensity are used as classification criteria in the hierarchical region localization matching according to the signal characteristics of the fingerprint data at the point to be measured. Matching in the classified fingerprint library could reduce the search volume and eliminate the irrelevant fingerprint data from the hierarchical region search to improve the localization accuracy.For example, when using localization, the layers are determined based on the localization area obtained by the traditional localization method, and the beacons 2, 5, and 4 are classified as the first layer, 3, 4, and 7 are classified as the second layer, and 1, 6, 8, and 9 are classified as the third layer. According to the layer where they are located, the corresponding dimensions are selected in the stratified region positioning as shown in Figure9. Then they are selected by the characteristics of the fingerprint coordinates of the point to be tested. For example, the intensity of the data beacon 1 of the point to be tested is in the top three of the nine beacons; then, we select all the fingerprint data with classification label 1 as the fingerprint library to be matched.Figure 9
Fingerprint library hierarchy diagram.


### 4.4. Comparison and Analysis of Experimental Results

In order to verify the performance of BSSH in the cabin environment, this paper did a comparison test between BSSH and mainstream algorithms. Two hundred sets of fingerprint data, totalling 1600 sets, were randomly collected in eight regions as the data to be localized.


#### 4.4.1. Mainstream Positioning Algorithm Results Analysis

For the experiments of mainstream localization algorithms, we used Euclidean distance, Chebyshev distance, and Manhattan distance for 1600 sets of data, respectively, and the experimental results are shown in Figure10.Figure 10
Accuracy of different calculation methods at different K values.The results show that the selection of K value has a close relationship with the accuracy, which is poor and less stable when the K value is little, and the localization results gradually stabilize when the K value is taken above 20. Figure10 shows that the Euclidean distance performs better than Chebyshev and Manhattan distances in the cabin environment when performing area localization. Therefore, the Euclidean distance was used as in the subsequent experiments.When conducting experiments on mainstream localization methods, the value of K is taken as 20, and the frequency of these 20 data area labels is used as the localization result by calculating the 20 sets of data with the smallest Euclidean distance in the fingerprint database for the data points to be measured.The final result is as follows: among 1600 sets of test data, 1213 sets were correctly positioned, with an accuracy rate of 75.81%.


#### 4.4.2. The Analysis Results of BSSH

This paper adopts a hierarchical region to process the fingerprint database, which eliminates the influence of distant beacons from the point to be located on the localization results and reduces the computational effort while reducing errors.Through the experiment, it was found that Bluetooth beacons changed little in intensity more than 3 meters, and these beacons tend to have less impact on the results. And in the stratification process, the layers were determined in a wrong layer, because these beacons were often far away from the point to be measured, resulting in the vast majority of fingerprint library data after stratification to remove the beacons that originally had a greater impact. Such a situation occurs as follows:Fingerprint data of the point to be measured: (54,62,79,76,75,78,76,87,86)Fingerprint library theoretical match points: (38,72,78,76,77,67,85,76,87)Algorithm yields the far side closer to point: (72,71,79,46,65,76,78,76,78)Distances of 31.22 and 56.64 for the nine data sets are calculated by the conventional method; distances of 23.38 and 20.39 for the three underlined data sets are calculated by the stratified method.When the situation occurs, these data could lead to matching to a large number of misaligned areas squeezing the correct areas. So, this paper classified the fingerprint library by proximity and the results obtained through the classification process can not only reduce the determination of the affected areas when matching to the wrong layer, but also reduce the search time.The results obtained by the above strategy are as follows. Among 1600 sets of test data, 1286 sets were correctly located, with an accuracy rate of 80.38%, which is 4.57% higher than the accuracy rate of mainstream methods, significantly improving the accuracy and stability of indoor positioning in the ship cabin environment.


#### 4.4.3. Overall Analysis

The accuracy of each region under the two methods was verified separately, as shown in Figure11, and it can be seen that the accuracy of each region was improved by 5%–9% using the hierarchical region localization algorithm, even for regions 7 and 8, which are located in the third layer away from other regions.Figure 11
Accuracy improvement in each region.


## 4.1. Deployment of Experimental Environment

The experimental site this paper used was the automated ship cabin laboratory of Shanghai Maritime University. In the experimental environment of 23m × 24 m×15m, located in the middle is the mainframe, which has three levels, and there is a three-level corridor to the north of the mainframe and a two-level corridor to the south, arranged with various marine instruments and equipment, as shown in Figure3. Nine beacons were arranged respectively according to the distribution of instrumentation and equipment to ensure that the Bluetooth signal could cover the whole area. In order to facilitate the subsequent collection of fingerprint data, the 9 Bluetooth beacons were numbered from 1 to 9 respectively, and the distribution of the numbered Bluetooth beacons was shown in Figure 4.Figure 3
Experimental environment of the automation laboratory. Figure3 is reproduced from Gao et al.: (a) the experimental site of this article, (b) the Bluetooth beacon, and (c) the layout of the Bluetooth beacon.
(a)(b)(c)Figure 4
Spatial distribution of the Bluetooth beacons. Figure4 is reproduced from Gao et al.


## 4.2. Acquisition and Processing of Experimental Data

After the Bluetooth beacons were arranged, the broadcast power of the Bluetooth beacons was set to 0 dBm. The data acquisition of Bluetooth fingerprint data for this experiment was performed by dividing the experimental environment of 23m × 24 m × 15 m into small grids of 1 m × 1 m × 1 m, i. e., each cubic meter represents one fingerprint acquisition point. Taking the southwest corner of the automated cabin laboratory as the origin, each fingerprint collection point was numbered according to the three-dimensional coordinates, and ten sets of data were collected for each fingerprint collection point, as shown in Table 1, which shows the data collection of fingerprint collection points with coordinates (1, 1, 1).Table 1
Fingerprint data collected at fingerprint collection points (1, 1, 1).
Coordinates123456789(1,1,1)−86−82−85−79−85−86−84−85−90(1,1,1)−91−79−91−79−85−86−90−93−90(1,1,1)−91−78−93−88−83-86−90−85−90(1,1,1)−88−78−91−88−83-86−81−86−90(1,1,1)−95−85−91−88−83−86−81−84−90(1,1,1)−86−85−91−88−86−86−81−85−89By collecting 1000 sets of RSSI data at the point to be measured, it found that Bluetooth signal reception strength approximately conforms to a Gaussian distribution with data analysis. That was the probability of the received RSSI value satisfying a Gaussian distribution model when the measurement distance is constant. The distribution of 1000 sets of data is shown in Figure5, and the probability density function is shown in (5): (5)R=12πσexp−RSSI−μ22σ2.Figure 5
RSSI probability distribution of individual test points.μ is the mathematical expectation and s is the standard deviation. In this paper, the great likelihood estimation [20] is used to obtain the values of parameters µ and s in the model, and the solution formula is shown in (6) and (7), where N denotes a set of the number of RSSIs that conform to the Gaussian distribution. For the specific derivation process, please refer to the literature [21]. By processing it, a total of 24680 sets of raw data were collected from 2468 fingerprint collection points at 5520 coordinates, removing the unreachable fingerprint collection points. The 2468 sets of processed Bluetooth fingerprint data were obtained by great likelihood estimation and used as our Bluetooth fingerprint library for online matching.(6)μRSSI=1N∑i=1NRSSIi,(7)σ^2RSSI=1N−1∑i=1NRSSIi−μRSSI2.


## 4.3. Area Division of the Experimental Environment and Stratification of Fingerprint Library Data

### 4.3.1. Area Division of the Experimental Environment

Since the majority of engineer's shift revolves around instruments and equipment, so this paper adopted area positioning. The Bluetooth beacons were deployed according to the distribution of the instruments, and then the positioning areas were divided according to the Bluetooth beacons. The whole automated nacelle lab was divided into 8 areas according to the beacons, and the areas are divided as shown in Figure6. The criteria for the division are based on the deployment of Bluetooth beacons, and the areas are divided according to the distribution of the beacons.Figure 6
Positioning area division situation.The whole space was divided into 8 localization areas based on the instrument and Bluetooth beacons, while the data in the fingerprint library were marked according to the division.


### 4.3.2. Hierarchical Processing of Fingerprint Database Data

RSSI model of Bluetooth is used in space, especially in such a complex electromagnetic environment in the engine room; the RSSI strength of Bluetooth beacons decays exponentially with distance [13, 17]. Using the average path loss model expressed as a function of distance, as shown in (8), PL(d) denotes the path loss. n is the path loss exponent, which indicates the rate at which the path loss increases with distance, d is the signal reception distance, and d_0 = 1 m is the reference distance. x_σ is a zero-mean Gaussian distributed random variable (in dBm), and s is the standard deviation [18],(8)PLd=PLd0+10nlogdd0+Xσ.The path loss of Bluetooth beacons was tested experimentally in an automated cabin laboratory environment, as shown in Figure7:Figure 7
RSSI path loss situation.It can be seen that the Bluetooth beacon shows an exponential decrease within 3 meters, and beyond 3 meters, the intensity loss gradually tends to a straight line.Therefore, when performing the stratification, the planar stratification with floor 24×25, as shown in Figure8(a), the distance between beacons after stratification will be longer than the exponential decay region, thus causing the Bluetooth fingerprint data to have less significant features and lower accuracy under the horizontal stratification. So, 24 × 15 longitudinal stratification is used, as shown in Figure 8(b), to make the beacon data more distinctive under longitudinal stratification by reducing the distance between individual beacons after stratification. With the stratification process, regions 1 and 4 are categorized as layer 1, regions 2 and 5 are categorized as layer 2, and regions 3, 6, 8, and 9 are categorized as layer 3. The area localization after stratification only requires Euclidean distance calculation for the beacon data belonging to the layer according to the previously obtained layer number, discarding the influence of extraneous beacons with long distances on the results and transforming 3D localization into a 2D localization problem.Figure 8
Two stratification cases.
(a)(b)Then the fingerprint library is classified according to the signal intensity magnitude, and the three beacons with the highest intensity are used as classification criteria in the hierarchical region localization matching according to the signal characteristics of the fingerprint data at the point to be measured. Matching in the classified fingerprint library could reduce the search volume and eliminate the irrelevant fingerprint data from the hierarchical region search to improve the localization accuracy.For example, when using localization, the layers are determined based on the localization area obtained by the traditional localization method, and the beacons 2, 5, and 4 are classified as the first layer, 3, 4, and 7 are classified as the second layer, and 1, 6, 8, and 9 are classified as the third layer. According to the layer where they are located, the corresponding dimensions are selected in the stratified region positioning as shown in Figure9. Then they are selected by the characteristics of the fingerprint coordinates of the point to be tested. For example, the intensity of the data beacon 1 of the point to be tested is in the top three of the nine beacons; then, we select all the fingerprint data with classification label 1 as the fingerprint library to be matched.Figure 9
Fingerprint library hierarchy diagram.


## 4.3.1. Area Division of the Experimental Environment

Since the majority of engineer's shift revolves around instruments and equipment, so this paper adopted area positioning. The Bluetooth beacons were deployed according to the distribution of the instruments, and then the positioning areas were divided according to the Bluetooth beacons. The whole automated nacelle lab was divided into 8 areas according to the beacons, and the areas are divided as shown in Figure6. The criteria for the division are based on the deployment of Bluetooth beacons, and the areas are divided according to the distribution of the beacons.Figure 6
Positioning area division situation.The whole space was divided into 8 localization areas based on the instrument and Bluetooth beacons, while the data in the fingerprint library were marked according to the division.


## 4.3.2. Hierarchical Processing of Fingerprint Database Data

RSSI model of Bluetooth is used in space, especially in such a complex electromagnetic environment in the engine room; the RSSI strength of Bluetooth beacons decays exponentially with distance [13, 17]. Using the average path loss model expressed as a function of distance, as shown in (8), PL(d) denotes the path loss. n is the path loss exponent, which indicates the rate at which the path loss increases with distance, d is the signal reception distance, and d_0 = 1 m is the reference distance. x_σ is a zero-mean Gaussian distributed random variable (in dBm), and s is the standard deviation [18],(8)PLd=PLd0+10nlogdd0+Xσ.The path loss of Bluetooth beacons was tested experimentally in an automated cabin laboratory environment, as shown in Figure7:Figure 7
RSSI path loss situation.It can be seen that the Bluetooth beacon shows an exponential decrease within 3 meters, and beyond 3 meters, the intensity loss gradually tends to a straight line.Therefore, when performing the stratification, the planar stratification with floor 24×25, as shown in Figure8(a), the distance between beacons after stratification will be longer than the exponential decay region, thus causing the Bluetooth fingerprint data to have less significant features and lower accuracy under the horizontal stratification. So, 24 × 15 longitudinal stratification is used, as shown in Figure 8(b), to make the beacon data more distinctive under longitudinal stratification by reducing the distance between individual beacons after stratification. With the stratification process, regions 1 and 4 are categorized as layer 1, regions 2 and 5 are categorized as layer 2, and regions 3, 6, 8, and 9 are categorized as layer 3. The area localization after stratification only requires Euclidean distance calculation for the beacon data belonging to the layer according to the previously obtained layer number, discarding the influence of extraneous beacons with long distances on the results and transforming 3D localization into a 2D localization problem.Figure 8
Two stratification cases.
(a)(b)Then the fingerprint library is classified according to the signal intensity magnitude, and the three beacons with the highest intensity are used as classification criteria in the hierarchical region localization matching according to the signal characteristics of the fingerprint data at the point to be measured. Matching in the classified fingerprint library could reduce the search volume and eliminate the irrelevant fingerprint data from the hierarchical region search to improve the localization accuracy.For example, when using localization, the layers are determined based on the localization area obtained by the traditional localization method, and the beacons 2, 5, and 4 are classified as the first layer, 3, 4, and 7 are classified as the second layer, and 1, 6, 8, and 9 are classified as the third layer. According to the layer where they are located, the corresponding dimensions are selected in the stratified region positioning as shown in Figure9. Then they are selected by the characteristics of the fingerprint coordinates of the point to be tested. For example, the intensity of the data beacon 1 of the point to be tested is in the top three of the nine beacons; then, we select all the fingerprint data with classification label 1 as the fingerprint library to be matched.Figure 9
Fingerprint library hierarchy diagram.


## 4.4. Comparison and Analysis of Experimental Results

In order to verify the performance of BSSH in the cabin environment, this paper did a comparison test between BSSH and mainstream algorithms. Two hundred sets of fingerprint data, totalling 1600 sets, were randomly collected in eight regions as the data to be localized.


### 4.4.1. Mainstream Positioning Algorithm Results Analysis

For the experiments of mainstream localization algorithms, we used Euclidean distance, Chebyshev distance, and Manhattan distance for 1600 sets of data, respectively, and the experimental results are shown in Figure10.Figure 10
Accuracy of different calculation methods at different K values.The results show that the selection of K value has a close relationship with the accuracy, which is poor and less stable when the K value is little, and the localization results gradually stabilize when the K value is taken above 20. Figure10 shows that the Euclidean distance performs better than Chebyshev and Manhattan distances in the cabin environment when performing area localization. Therefore, the Euclidean distance was used as in the subsequent experiments.When conducting experiments on mainstream localization methods, the value of K is taken as 20, and the frequency of these 20 data area labels is used as the localization result by calculating the 20 sets of data with the smallest Euclidean distance in the fingerprint database for the data points to be measured.The final result is as follows: among 1600 sets of test data, 1213 sets were correctly positioned, with an accuracy rate of 75.81%.


### 4.4.2. The Analysis Results of BSSH

This paper adopts a hierarchical region to process the fingerprint database, which eliminates the influence of distant beacons from the point to be located on the localization results and reduces the computational effort while reducing errors.Through the experiment, it was found that Bluetooth beacons changed little in intensity more than 3 meters, and these beacons tend to have less impact on the results. And in the stratification process, the layers were determined in a wrong layer, because these beacons were often far away from the point to be measured, resulting in the vast majority of fingerprint library data after stratification to remove the beacons that originally had a greater impact. Such a situation occurs as follows:Fingerprint data of the point to be measured: (54,62,79,76,75,78,76,87,86)Fingerprint library theoretical match points: (38,72,78,76,77,67,85,76,87)Algorithm yields the far side closer to point: (72,71,79,46,65,76,78,76,78)Distances of 31.22 and 56.64 for the nine data sets are calculated by the conventional method; distances of 23.38 and 20.39 for the three underlined data sets are calculated by the stratified method.When the situation occurs, these data could lead to matching to a large number of misaligned areas squeezing the correct areas. So, this paper classified the fingerprint library by proximity and the results obtained through the classification process can not only reduce the determination of the affected areas when matching to the wrong layer, but also reduce the search time.The results obtained by the above strategy are as follows. Among 1600 sets of test data, 1286 sets were correctly located, with an accuracy rate of 80.38%, which is 4.57% higher than the accuracy rate of mainstream methods, significantly improving the accuracy and stability of indoor positioning in the ship cabin environment.


### 4.4.3. Overall Analysis

The accuracy of each region under the two methods was verified separately, as shown in Figure11, and it can be seen that the accuracy of each region was improved by 5%–9% using the hierarchical region localization algorithm, even for regions 7 and 8, which are located in the third layer away from other regions.Figure 11
Accuracy improvement in each region.


## 4.4.1. Mainstream Positioning Algorithm Results Analysis

For the experiments of mainstream localization algorithms, we used Euclidean distance, Chebyshev distance, and Manhattan distance for 1600 sets of data, respectively, and the experimental results are shown in Figure10.Figure 10
Accuracy of different calculation methods at different K values.The results show that the selection of K value has a close relationship with the accuracy, which is poor and less stable when the K value is little, and the localization results gradually stabilize when the K value is taken above 20. Figure10 shows that the Euclidean distance performs better than Chebyshev and Manhattan distances in the cabin environment when performing area localization. Therefore, the Euclidean distance was used as in the subsequent experiments.When conducting experiments on mainstream localization methods, the value of K is taken as 20, and the frequency of these 20 data area labels is used as the localization result by calculating the 20 sets of data with the smallest Euclidean distance in the fingerprint database for the data points to be measured.The final result is as follows: among 1600 sets of test data, 1213 sets were correctly positioned, with an accuracy rate of 75.81%.


## 4.4.2. The Analysis Results of BSSH

This paper adopts a hierarchical region to process the fingerprint database, which eliminates the influence of distant beacons from the point to be located on the localization results and reduces the computational effort while reducing errors.Through the experiment, it was found that Bluetooth beacons changed little in intensity more than 3 meters, and these beacons tend to have less impact on the results. And in the stratification process, the layers were determined in a wrong layer, because these beacons were often far away from the point to be measured, resulting in the vast majority of fingerprint library data after stratification to remove the beacons that originally had a greater impact. Such a situation occurs as follows:Fingerprint data of the point to be measured: (54,62,79,76,75,78,76,87,86)Fingerprint library theoretical match points: (38,72,78,76,77,67,85,76,87)Algorithm yields the far side closer to point: (72,71,79,46,65,76,78,76,78)Distances of 31.22 and 56.64 for the nine data sets are calculated by the conventional method; distances of 23.38 and 20.39 for the three underlined data sets are calculated by the stratified method.When the situation occurs, these data could lead to matching to a large number of misaligned areas squeezing the correct areas. So, this paper classified the fingerprint library by proximity and the results obtained through the classification process can not only reduce the determination of the affected areas when matching to the wrong layer, but also reduce the search time.The results obtained by the above strategy are as follows. Among 1600 sets of test data, 1286 sets were correctly located, with an accuracy rate of 80.38%, which is 4.57% higher than the accuracy rate of mainstream methods, significantly improving the accuracy and stability of indoor positioning in the ship cabin environment.


## 4.4.3. Overall Analysis

The accuracy of each region under the two methods was verified separately, as shown in Figure11, and it can be seen that the accuracy of each region was improved by 5%–9% using the hierarchical region localization algorithm, even for regions 7 and 8, which are located in the third layer away from other regions.Figure 11
Accuracy improvement in each region.


## 5. Conclusions

In this paper, a strategy of Bluetooth indoor positioning in ship cabin based on hierarchical area is proposed, and BSSH performs area positioning by area division of the positioning area according to the needs of the engine room watch work, which can reduce the resources of calculation more than precise positioning to the point, improve the accuracy of positioning using hierarchical area positioning algorithm, and verify the performance of the algorithm in comparing the real ship cabin environment. The experimental results show that compared with the traditional KNN positioning algorithm, BSSH has higher positioning accuracy and better stability in the cabin environment, and the accuracy rate reached more than 80%. From 75.81% to 80.38% can effectively meet the application requirements of the engine room watch work. And using BLE as the beacon for positioning significantly reduces the system deployment cost in the ship environment.In this paper, BSSH provides a feasible solution for indoor positioning in the engine room environment, but there are still some problems and drawbacks. Since the spatial structure of the engine room varies in different kinds of ships, the current layering strategy is only applicable to the current simulation environment, and different layering strategies should be used for different engine room environments, and we will deploy it in more real engine room environments in the future to optimize. In the future, we will deploy it in more real cabin environments to optimize the accuracy and stability of BSSH.



---

*Source: 5425306-2022-03-25.xml*