Indoor High-Precision 3D Positioning System Based on Visible-Light Communication Using Improved Whale Optimization Algorithm

: Visible-light communication (VLC) is a promising method for indoor positioning. The received signal strength algorithm is the most widely used localization algorithm in visible-light positioning (VLP) systems. However, in a VLP system, the photodiode (PD) will have a small rotation angle during movement, which will result in a massive positioning error ignoring the angle. In this study, a three-dimensional (3D) indoor VLP system using an improved whale optimization algorithm (IWOA) is proposed to reduce the error caused by the PD rotation. Firstly, the model of the VLC system with the PD rotation angles is introduced. Secondly, a novel IWOA with an elite opposition-based learning strategy and L é vy ﬂight strategy is proposed. The convergence speed and accuracy of the WOA are improved. Lastly, the IWOA algorithm is efﬁciently utilized to address the problem with the PD rotation in the indoor VLP system. Simulation results show that the average error of 3D positioning is 2.14 cm with no PD rotation. When the PD has a rotation angle, the average positioning error estimated by ignoring the rotation angle is 27.14 cm, while that estimated by considering the rotation angle is 7.85 cm. In the VLP system, the positioning error with the PD rotation angle is effectively reduced by the proposed algorithm, which can be applied in a variety of indoor location scenes.


Introduction
With the rapid development of wireless sensor networks and mobile services, locationbased services (LBSs) have been significantly expanded in recent years [1]. High-precision indoor positioning is gaining attention for its wide applications, including in museums, shopping malls, underground parking areas, and tunnels. Many technologies are applied to indoor positioning, with typical systems based on a global positioning system (GPS), radiofrequency identification (RFID), wireless local area network (WLAN), ultrawide-band radio (UWB), and visible-light communication (VLC). The GPSs are extensively used for outdoor positioning and have high location accuracy. When applied in the indoor environment, a GPS suffers from considerable signal attenuation due to the fading of satellite signal strength and shadow effect. Most WLAN positioning systems use the method of fingerprint matching, but it is difficult to create fingerprint libraries, and a WLAN is highly reliant on the environment. Positioning systems such as RFID and UWB have high positioning accuracy, but require additional hardware devices. VLC is an emerging communication technology which uses light-emitting diode (LED) emitters for high-speed data transmission. VLC technology is currently used in a variety of applications, such as light fidelity (Li-Fi) [2] and visible-light positioning (VLP). However, a positioning Photonics 2022, 9,  system based on VLC is becoming a research hotspot due to its high precision, low cost, good security, and anti-electromagnetic interference capability [3]. A VLC-based positioning system employs the signals to measure the position of a mobile device, and the positioning can be classified into two types based on the receiving terminal: image-sensor-based [4,5] and photodiode (PD)-based [6]. LEDs provide their ID or location information to image-sensor-based positioning systems, and the image sensor receives the signals and uses image information processing to estimate its position. An image-sensor-based positioning system facilitates high-precision positioning, but the image processing is time-consuming and complicated. The PD-based positioning system offers low cost and provides a wide range of indoor positioning applications.
Various schemes have been proposed for PD-based positioning systems, where the angle or distance between the transmitter and receiver is calculated through triangulation, such as time of arrival (TOA), time difference of arrival (TDOA), angle of arrival (AOA), and received signal strength (RSS) [7,8]. Owing to the high light-transmission rates and the short distances between LEDs and PDs, small time errors can result in large errors in the estimation of distances. Therefore, TOA and TDOA technologies need to adopt a strict time synchronization mechanism. Although the AOA technique does not require a strict time synchronization mechanism, a sensor array is used to receive radio signals, and the location system is very complicated and expensive. On the contrary, a positioning system based on RSS can easily estimate the distance from the received signal strength and obtain high-precision positioning. Hence, several visible-light positioning systems based on RSS have been presented in recent years [9][10][11].
It is well known that the use of metaheuristic algorithms comprises an effective technique for solving nonlinear optimization problems. Many metaheuristic algorithms have been applied to resolve complex engineering problems [12][13][14][15]. However, threedimensional (3D) indoor location systems based on visible-light communication can be viewed as a global optimization problem, and a variety of metaheuristic optimization algorithms have been used to address the problem. Cai et al. developed an indoor VLP system using particle swarm optimization, and an average distance error of 3.9 mm was obtained within 20 iterations in an indoor environment measuring 3 m × 3 m × 4 m [16]. Guan et al. proposed a VLP system, which used a modified genetic algorithm (GA) and artificial neural network, and an average error of positioning of 1.02 cm was achieved [17]. Huang et al. proposed an indoor VLP system based on a modified artificial fish swarm algorithm (MAFSA), and a positioning error of 4.05 mm was achieved in an indoor space of 4 m × 4 m × 6 m [18]. Xu et al. presented an indoor 3D visible-light location system using adaptive parameter particle swarm optimization, and the system achieved similar positioning results with a smaller swarm [19]. Chen et al. proposed an indoor VLP system based on an improved hybrid bat algorithm, and the system achieved an average positioning error of 1.16 cm in a space of 5 m × 5 m × 3 m [20]. Chen et al. proposed an indoor 3D VLC system based on an improved immune particle swarm optimization algorithm, which considered the influence of environmental interference, and an average positioning error of 3.12 cm was achieved [21].
The aforementioned positioning algorithms assumed that the LED and PD remain parallel when the PD is moving, and the positioning algorithms can achieve high-precision positioning. In an indoor positioning system, it is difficult to keep the PD and LED parallel during movement, resulting in random rotation angles [22]. A large positioning error would be observed if the LED and PD are assumed to be parallel. To solve the PD random-rotation problem, this paper proposes a 3D indoor location system based on visible-light communication using an improved whale optimization algorithm (IWOA). The final results show that the IWOA with elite opposition-based learning and Lévy flight strategies improves solution accuracy and convergence speed.
The rest of this paper is organized as follows: Section 2 describes the fundamentals of a VLC system model. The IWOA is proposed in Section 3. Simulation results are presented and analyzed in Section 4. Conclusions are discussed in Section 5.

VLC System Model
The channel model of VLC and the indoor positioning system model are shown in Figure 1. Owing to the long distance between the LEDs and the PDs, the LEDs can be viewed as a Lambertian radiation source. According to the Lambertian radiation model, the channel current gain between the LEDs to PDs can be given by Equation (1) [23].
where A represents the effective PD area, d is the distance between the PD and LED, and φ and ψ denote the angle irradiance and angle of incidence, respectively. ψ c is the field of view of the receiver, T s (ψ) is the gain of the optical filter, and m is the Lambertian order, defined as m = − log 2/ log(cos(φ 1/2 )), where φ 1/2 is the half-power angle of the LED. The gain of the optical concentrator g(ψ) can be expressed as where n represents the optical concentrator's refractive index. The receiving power of the PD P r can be expressed as where P t is the emitting power of the LED.

VLC System Model
The channel model of VLC and the indoor positioning system model are shown in Figure 1. Owing to the long distance between the LEDs and the PDs, the LEDs can be viewed as a Lambertian radiation source. According to the Lambertian radiation model, the channel current gain between the LEDs to PDs can be given by Equation (1) Where A represents the effective PD area, d is the distance between the PD and LED, and  and  denote the angle irradiance and angle of incidence, respectively. c  is the field of view of the receiver, () s T  is the gain of the optical filter, and m is the Lambertian order, defined as where 1/ 2  is the half-power angle of the LED. The gain of the optical concentrator () g  can be expressed as where n represents the optical concentrator's refractive index. The receiving power of the PD r P can be expressed as where t P is the emitting power of the LED. The VLC system mainly consists of shot noise σ 2 shot and thermal noise σ 2 thermal , and the total noise σ 2 noise is composed of both. The total noise is usually modeled as an additive white Gaussian noise (AWGN) [24]. The received signal strength can be expressed by the signal-to-noise ratio (SNR), represented as follows [25]: where R p is the PD's optical conversion efficiency. Four LEDs are mounted on the ceiling board in a room, each of which is used for communication and illumination. A PD receives the signals from the four LEDs as a receiver, which is positioned at a random location in the room. Assuming that the normal of the i-th LED is → n led,i = [0, 0, − 1] T , the normal of the PD is → n pd = [0 0 1] T , and the vector from the i-th LED to PD is → d i , then cos(φ i ) and cos(ψ i ) can be calculated as The RSS P i r from the i-th LED is calculated as follows: At present, most of the positioning methods researched assume that the horizontal normal of the LEDs and the PD align with each other, and the angles of departure and arrival are equal. However, in a visible positioning system, it is difficult to maintain the parallel position while moving the PD. If the PD and LED are assumed to be parallel, a large positioning error will be observed. The PD has a small angle tilt, which can be considered a consequence of the PD rotation. Supposing that α, β, and γ represent the rotation angles of PD about the X-axis, Y-axis, and Z-axis, respectively, the rotation matrix can then be defined as follows [26]: Therefore, the normal vector → n pd of the PD is changed as follows: The RSS P i r_tilt from the i-th LED is then changed as follows: Thus, a fitness function of visible-light location based on the RSS can be given by where P i r_meas represents the value of RSS measurement for the i-th LED, and P i r_tilt represents the value of RSS calculated by Equation (10). The optimal rotation angles and position of PD can be obtained by minimizing the fitness function.

Whale Optimization Algorithm
The 3D indoor location problem can be solved with a global optimization algorithm, and the WOA is a novel metaheuristic algorithm for addressing the global optimization problem by mimicking the social behavior of humpback whales, as presented by Mirjalili and Lewis in 2016 [27]. The WOA is characterized by good optimization search ability, few controlling parameters, and simplicity of implementation.
The WOA uses three stages to update the position of individuals; these stages are surrounding prey, searching for prey, and spiral updating position [27].
Surrounding prey: If p < 0.5 and |A 1 | < 1, Search for prey: If p < 0.5 and |A 1 | ≥ 1, Spiral updating position: If p ≥ 0.5, where X i,G is the solution of the current generation, X i,G+1 is the solution of the next generation, X best is the best solution obtained thus far, X rand,G is a random solution chosen from the current generation, p is a random number, NP is the number of individuals in the population, t is the current number of iterations, T max is the maximum number of iterations, a is linearly decreased from 2 to 0 over the course of multiple iterations, r is a random number in the range [0, 1], b is a constant which defines the shape of the logarithmic spiral, and l is a random real number in the range [−1, 1].

Improved Whale Optimization Algorithm
Similar to other metaheuristic algorithms, the WOA is predisposed to low convergence accuracy and premature convergence when dealing with complex optimization problems. The random initialization affects the performance of the algorithm, and the population diversity causes the algorithm to be trapped in a local optimum [28][29][30]. Therefore, to improve the search performance of the WOA, the IWOA with two strategies is proposed here.

Elite Opposition-Based Learning
Elite opposition-based learning (EOBL) is an innovative approach in the field of computational intelligence, and it has been applied in many metaheuristic algorithms [31][32][33]. An EOBL strategy is mainly used to improve the diversity of population by evaluating the fitness function of the current and opposition solutions, and then the better solutions are selected as the initial individual. The individual with the minimum value of fitness function is regarded as the elite individual in the population. The EOBL strategy can be expressed as follows [32]: Photonics 2022, 9,93 6 of 17 where X i and X i are the current and opposition solutions, respectively, k is a random number in the range [0, 1], L represents the lower boundaries of the scheduled area, and U represents the upper boundaries of the scheduled area.

Lévy Flight
Lévy flight is a random search method that has been successfully used in a variety of metaheuristic algorithms [34][35][36]. Comparing the fitness values before and after the Lévy flight, the better solutions are selected to participate in next-generation evolution with a greedy strategy. The Lévy flight strategy can be expressed as where X i,G1 represents the solution of the current generation after Lévy flight, β is a constant number with a value set to 1.5, µ and v are random numbers obeying the normal distribution, and Γ is the gamma function. The Lévy flight strategy improves the local search capability of the individual. The IWOA can be built by implementing the above strategies for the WOA, and the framework for the proposed algorithm is shown in Figure 2. SENSITIVE where ,1 iG X represents the solution of the current generation after Lévy flight,  is a constant number with a value set to 1.5,  and v are random numbers obeying the normal distribution, and  is the gamma function. The Lévy flight strategy improves the local search capability of the individual.
The IWOA can be built by implementing the above strategies for the WOA, and the framework for the proposed algorithm is shown in Figure 2.

Simulation Results and Analysis
Simulations were conducted to validate the performance of the proposed positioning method. Four LEDs were placed on the ceiling of the room as signal generators, with the size of 5 m × 5 m × 6 m, and the coordinates of the LEDs were [5,0,6] T , [0,0,6] T , [0,5,6] T , and [5,5,6] T . The encoding information based on code division multiple access (CDMA) modulation is transmitted by each LED, and then this information is received by the PD. The location of the PD can be estimated by the IWOA. The main parameters of the simulation are shown in Table 1.

Simulation Results and Analysis
Simulations were conducted to validate the performance of the proposed positioning method. Four LEDs were placed on the ceiling of the room as signal generators, with the size of 5 m × 5 m × 6 m, and the coordinates of the LEDs were [5, 0, 6] T , [0, 0, 6] T , [0, 5, 6] T , and [5, 5, 6] T . The encoding information based on code division multiple access (CDMA) modulation is transmitted by each LED, and then this information is received by the PD. The location of the PD can be estimated by the IWOA. The main parameters of the simulation are shown in Table 1. In the actual positioning system based on visible-light communication, the PD has a certain rotation angle when moving. The rotation angle of PD along the X-axis is small, the rotation angle along the Y-axis is small, and the rotation angle along the Z-axis is large. Thus, in order to assess the effectiveness of the proposed location method, simulation analysis was carried out without and with PD rotation.

Single-Point Analysis without PD Rotation
To prove the effectiveness of the IWOA, a single point (2.0, 2.0, 2.0) (m) was chosen for the simulation research. As shown in Figure 3, the red point is the test point, and the blue points are the individuals in the IWOA. At the initial moment, 50 individuals were randomly distributed in a space of 5 m × 5 m × 6 m, which facilitated the whale population to search for the global optimal solution quickly. With the increasing number of iterations, the scattered individuals moved closer to the test point, and all the individuals converged to the test point at 100 iterations. At this time, the value of the fitness function was 2.7701 × 10 −9 , the positioning error of 2.34 cm was achieved, and the final estimated location was (2.0086, 2.0041, 2.0214) (m), indicating that the IWOA had high positioning precision. In the actual positioning system based on visible-light communication, the PD has a certain rotation angle when moving. The rotation angle of PD along the X-axis is small, the rotation angle along the Y-axis is small, and the rotation angle along the Z-axis is large. Thus, in order to assess the effectiveness of the proposed location method, simulation analysis was carried out without and with PD rotation.

Single-Point Analysis without PD Rotation
To prove the effectiveness of the IWOA, a single point (2.0, 2.0, 2.0) (m) was chosen for the simulation research. As shown in Figure 3, the red point is the test point, and the blue points are the individuals in the IWOA. At the initial moment, 50 individuals were randomly distributed in a space of 5 m × 5 m × 6 m, which facilitated the whale population to search for the global optimal solution quickly. With the increasing number of iterations, the scattered individuals moved closer to the test point, and all the individuals converged to the test point at 100 iterations. At this time, the value of the fitness function was 2.7701 × 10 −9 , the positioning error of 2.34 cm was achieved, and the final estimated location was (2.0086, 2.0041, 2.0214) (m), indicating that the IWOA had high positioning precision.
To further demonstrate the effectiveness of the proposed algorithm, IWOA, WOA [27], and MAFSA [18] were simulated in this paper. Simulations were performed for the algorithms under the same conditions. The convergence curves of IWOA, WOA, and MAFSA are shown in Figure 4, indicating that the IWOA improved solution accuracy and was superior to the WOA and MAFSA.  To further demonstrate the effectiveness of the proposed algorithm, IWOA, WOA [27], and MAFSA [18] were simulated in this paper. Simulations were performed for the algorithms under the same conditions. The convergence curves of IWOA, WOA, and MAFSA are shown in Figure 4, indicating that the IWOA improved solution accuracy and was superior to the WOA and MAFSA.

Multipoint Analysis without PD Rotation
To assess the overall positioning performance of the IWOA, the test positions were placed at different heights, i.e., 0.5, 1.0, 1.5, 2.0, 2.5, and 3.0 m, and 2166 test points were generated in the space, the interval between them being 0.25 m in length and width. To effectively represent the optimization performance of the algorithm, the cumulative distribution function (CDF) of the positioning error was used, and the Euclidean distance was used to express the positioning error.

Multipoint Analysis without PD Rotation
To assess the overall positioning performance of the IWOA, the test positions were placed at different heights, i.e., 0.5, 1.0, 1.5, 2.0, 2.5, and 3.0 m, and 2166 test points were generated in the space, the interval between them being 0.25 m in length and width. To effectively represent the optimization performance of the algorithm, the cumulative distribution function (CDF) of the positioning error was used, and the Euclidean distance was used to express the positioning error.
The PD was considered without any rotation angle for all test points, and the estimated positioning of each test point could be achieved by IWOA optimization. Owing to the randomization of the optimization algorithm searching, the optimization estimation for each test point was run 30 times independently to select the optimal results, and the positioning results at different heights were as shown in Figure 5, where the "×" and " " symbols represent the real and estimated positions of the test point, respectively. It can be seen from Figure 5a-f that the estimated positions were located close to the real positions, demonstrating the positioning accuracy very well. SENSITIVE mated positioning of each test point could be achieved by IWOA optimization. Owing to the randomization of the optimization algorithm searching, the optimization estimation for each test point was run 30 times independently to select the optimal results, and the positioning results at different heights were as shown in Figure 5, where the "×" and "△" symbols represent the real and estimated positions of the test point, respectively. It can be seen from Figure 5a-f that the estimated positions were located close to the real positions, demonstrating the positioning accuracy very well.  Histograms of the positioning errors with all test points are shown in Figure 6, and the CDF curves are shown in Figure 7. It can be seen from Figure 6 that the average error of 3D positioning was 2.14 cm, the maximum positioning error was 16.81 cm, and the minimum positioning error was 0.11 cm. As shown in Figure 7, if 95% of the test points were accepted, the 3D positioning error of the IWOA would be less than 4.49 cm, the horizontal positioning error would be less than 3.05 cm, and the vertical positioning error would be less than 3.78 cm. Histograms of the positioning errors with all test points are shown in Figure 6, and the CDF curves are shown in Figure 7. It can be seen from Figure 6 that the average error of 3D positioning was 2.14 cm, the maximum positioning error was 16.81 cm, and the minimum positioning error was 0.11 cm. As shown in Figure 7, if 95% of the test points were accepted, the 3D positioning error of the IWOA would be less than 4.49 cm, the horizontal positioning error would be less than 3.05 cm, and the vertical positioning error would be less than 3.78 cm.  The above experimental results validate that a centimeter level of positioning error can be achieved by the proposed IWOA in an indoor VLP system.

Multipoint Analysis with PD Rotation
In the preceding section, the PD was assumed to have no rotation angle while moving; however, in an actual VLP system, the PD would have a certain rotation angle. To quantify positioning accuracy, it is supposed that rotation angles along the X-axis and Yaxis are in the ranges [0°, 10°] and [0°, 10°], and the rotation angle along the Z-axis is in the range [0°, 360°]. The position of all test points was consistent with the preceding section. It was assumed that the PD rotated randomly within the set angle range at each test point. The IWOA was used to estimate the positions of test points when the estimation of angle was ignored and considered. The positioning results when the estimation of rotation angle was ignored are shown in Figure 8, and those when the estimation of rotation angle was considered are shown in Figure 9.
When the rotation angles along the X-axis, Y-axis, and Z-axis were within the ranges [0°, 10°], [0°, 10°], and [0°, 360°], respectively, the average error of 3D positioning reached 27.14 cm when angle estimation was ignored, as shown in Figures 8a-e. If 95% of the test points were accepted, a 3D positioning error less than 48.91 cm, a horizontal positioning  The above experimental results validate that a centimeter level of positioning error can be achieved by the proposed IWOA in an indoor VLP system.

Multipoint Analysis with PD Rotation
In the preceding section, the PD was assumed to have no rotation angle while moving; however, in an actual VLP system, the PD would have a certain rotation angle. To quantify positioning accuracy, it is supposed that rotation angles along the X-axis and Yaxis are in the ranges [0°, 10°] and [0°, 10°], and the rotation angle along the Z-axis is in the range [0°, 360°]. The position of all test points was consistent with the preceding section. It was assumed that the PD rotated randomly within the set angle range at each test point. The IWOA was used to estimate the positions of test points when the estimation of angle was ignored and considered. The positioning results when the estimation of rotation angle was ignored are shown in Figure 8, and those when the estimation of rotation angle was considered are shown in Figure 9.
When the rotation angles along the X-axis, Y-axis, and Z-axis were within the ranges [0°, 10°], [0°, 10°], and [0°, 360°], respectively, the average error of 3D positioning reached 27.14 cm when angle estimation was ignored, as shown in Figures 8a-e. If 95% of the test points were accepted, a 3D positioning error less than 48.91 cm, a horizontal positioning The above experimental results validate that a centimeter level of positioning error can be achieved by the proposed IWOA in an indoor VLP system.

Multipoint Analysis with PD Rotation
In the preceding section, the PD was assumed to have no rotation angle while moving; however, in an actual VLP system, the PD would have a certain rotation angle. To quantify positioning accuracy, it is supposed that rotation angles along the X-axis and Y-axis are in the ranges [0 • , 10 • ] and [0 • , 10 • ], and the rotation angle along the Z-axis is in the range [0 • , 360 • ]. The position of all test points was consistent with the preceding section. It was assumed that the PD rotated randomly within the set angle range at each test point. The IWOA was used to estimate the positions of test points when the estimation of angle was ignored and considered. The positioning results when the estimation of rotation angle was ignored are shown in Figure 8, and those when the estimation of rotation angle was considered are shown in Figure 9.   SENSITIVE cm when angle estimation was considered, as shown in Figures 9a-e. If 95% of the test points were accepted, a 3D positioning error less than 18.62 cm, a horizontal positioning error less than 16.08 cm, and a vertical positioning error less than 15.02 cm would be achieved by the IWOA algorithm. The results show that the IWOA, which took PD rotation angle estimation into account, could significantly improve 3D positioning accuracy.   When the rotation angles along the X-axis, Y-axis, and Z-axis were within the ranges [0 • , 10 • ], [0 • , 10 • ], and [0 • , 360 • ], respectively, the average error of 3D positioning reached 27.14 cm when angle estimation was ignored, as shown in Figure 8a-e. If 95% of the test points were accepted, a 3D positioning error less than 48.91 cm, a horizontal positioning error less than 45.82 cm, and a vertical positioning error of less than 39.54 cm would be achieved by the IWOA algorithm.
When the rotation angles along the X-axis, Y-axis, and Z-axis were within the ranges [0 • , 10 • ], [0 • , 10 • ], and [0 • , 360 • ], respectively, the average error of 3D positioning was 7.85 cm when angle estimation was considered, as shown in Figure 9a-e. If 95% of the test points were accepted, a 3D positioning error less than 18.62 cm, a horizontal positioning error less than 16.08 cm, and a vertical positioning error less than 15.02 cm would be achieved by the IWOA algorithm. The results show that the IWOA, which took PD rotation angle estimation into account, could significantly improve 3D positioning accuracy.
As explained previously, when the PD was considered without rotation angle, high localization accuracy was achieved by the proposed IWOA positioning optimization algorithm in the VLP system. When the PD was considered with a rotation angle, the positioning simulation results show that the IWOA considering rotation angle estimation outperformed the IWOA ignoring it.

Conclusions
In this work, a 3D indoor VLP system based on an improved whale optimization algorithm (IWOA) was proposed to reduce the error caused by photodiode (PD) rotation. In addition to introducing the VLC system with the PD rotation angles, a novel IWOA with an elite opposition-based learning strategy and Lévy flight strategy was proposed. The 3D indoor positioning problem with PD rotation was effectively solved by the IWOA. Simulation results show that the average error of 3D positioning was 2.14 cm without PD rotation angle, and positioning errors less than 4.49 cm were achieved for 95% of the test points in 3D positioning. When PD was considered with a rotation angle, the average error of 3D positioning was 27.14 cm, and positioning errors less than 48.91 cm were achieved in 3D positioning for 95% of the test points when ignoring angle estimation. The average error of 3D positioning was 7.85 cm, and positioning errors less than 18.62 cm were achieved in 3D positioning for 95% of test points when the estimation of angle was considered. The proposed method effectively reduced the significant errors resulting from PD rotation in an indoor VLP system, and it can be applied in a variety of indoor location scenes.