Indoor Visible Light Localization Based on Finite State Markov Chain

: In the study of indoor visible light localization, the variance of the RSS(Received Signal Strength) distribution will be affected by environmental noise, resulting in a larger range of RSS value fluctuations. A method is proposed to decompose the RSS value into the disturbance component caused by the target and the noise component caused by the environment, and then a linear transfer model based on the finite state Markov chain is used to extract the disturbance component in RSS value. Finally, the DTW(Dynamic Time Warping) algorithm is used to match the real-time disturbance component with the fingerprint database to achieve target positioning.


Introduction
Whether it is work or life, 70% -80% of the time is spent indoors by humans. The need for indoor positioning has been reflected in all aspects of people 's lives, such as smart construction sites, smart factories, smart prisons, etc. All are closely related to indoor positioning location information, so a very broad prospect will be in indoor positioning technology. LED(Light Emitting Diode)-based indoor positioning of visible light has become the focus of current research due to its simple implementation, low cost, high accuracy, large spectrum range, and high security [1][2][3].
Due to the presence of environmental noise, the variance of the RSS distribution will be greatly affected by the noise, that is, the fluctuation range of the RSS value becomes larger. At this time, the error of RSS value matching in the positioning stage increases, resulting in a decrease in accuracy [4].
To solve this problem, a localization method based on signal decomposition is proposed in this paper.
This method is used to decompose the measured RSS value into the target disturbance component and  Design, Setting, Description of All Processes and Methodologies Employed: The measured RSS value is decomposed into the disturbance component caused by the target and the noise component caused by the environment, and the disturbance component in the RSS value is extracted using the linear migration model based on the finite state Markov chain. Since the disturbance component is highly robust to environmental noise, the disturbance component is used to construct a fingerprint library to improve the robustness of the positioning system. At the same time, the dynamic time warping algorithm is used to match the disturbance component with the fingerprint library, and high-precision positioning is realized.

The Characteristics of Participants
Hongjie Shen: He is a graduate student at Nanjing Normal University in Nanjing, China. During his graduate school, he has been engaged in the research of visible light indoor positioning algorithms. In April 2020, he published a paer in Spring and participated in the Chinese graduate electronics competition many times.
Jianhua Shao: He is a master tutor, professor, has been engaged in the research of indoor visible light positioning technology for many years, and a worker in the Key Laboratory of Optoelectronics of Jiangsu Province.
Lianjia Deng: She is a graduate student at Nanjing Normal University in Nanjing, China. During her graduate school, she has been engaged in the research of visible light indoor positioning algorithms.
Cong Du: He is a graduate student at Nanjing Normal University in Nanjing, China. During his graduate school, he has been engaged in the research of visible light indoor positioning algorithms.

The Type of Statistical Analysis Used
This paper is run under MATLAB software, the relevant formulas have been listed in the article.studies involving human participants, data or tissue or animals must include statement on ethics approval and consent. Due to the target appears in the positioning area, some links are affected. If the changed RSS value exceeds a certain threshold, it indicates that the link has been interfered [5], and this link is called the interfered link, then the remaining links are undisturbed links. In this paper, the link RSS value is analyzed and compared before and after interference. As shown in Fig.1, it is a wireless communication link formed between the LED and the PD(Photo-Diode). The RSS value of the link is derived from the signals in Fig.1. Before the link is interfered by the target, the RSS value measured by the link includes: visual distance signal (as shown in Fig.1 One), and the reflected signal of obstacles in the environment (as shown in Fig.1 Two). The attenuation of the signal caused by the propagation medium is reflected in the visual distance signal. The signal reflected by the obstacle represents the reflection of the signal caused by other objects in the environment. Therefore, the sum of the above two parts of the signal is called the noise component caused by environmental impact (as shown in Fig.1 One+Two). For a fixed link, and are respectively denoted as the RSS value which the link is undisturbed and the noise component caused by the environment, as given in the following: = When the link is interfered by the target, in addition to the noise component, the disturbed component caused by the target (as shown in Fig.1 Four) is also in the RSS value of the link. ′ represents the RSS value after the link is disturbed, ′ represents the noise component caused by the environment, and represents the disturbance component caused by the target, which can be given as: Regardless of whether the link is disturbed or not, the probability of sudden changes in the environment is very low, so the noise component is approximately unchanged, that is = ′ . However, in the real environment, the surrounding environment changes due to the appearance of the target [6]. For example, some signals will be reflected by the target and then received by other objects. These signals are called secondary reflection signals. Because different obstacles in the environment will cause changes in the secondary reflection signal, that is, the secondary reflection signal is related to the environment, so the secondary noise component is represented by . From the above, the sum of the original noise component and the secondary noise component is defined as the noise component after interference: The equation (2) can be converted to: where RSS value ′ is actually consisted of three parts: the disturbance component caused by the target, the noise component before the link is interfered, and the secondary noise component generated by the target.
Assuming that the positioning target is at ( , ), if there are m interfered links, the RSS sequence of the i-th link in the time window is: where ， [1, ]. The RSS sequence vector composed of m links can be expressed as: where × ， means transpose. Using the mapping relationship between and ( , ) to build a fingerprint database is often used in traditional positioning, that is ( , ) = ( ). However, the noise component in the RSS value will change under the sudden change of the environment, which will make the RSS value obtained in the positioning stage deviate from the fingerprint information in the fingerprint library [7], and eventually cause the positioning accuracy of the system to decrease.

3.2.
Design Linear Transfer Model to Extract Disturbance Component ( , ) caused by the target interference is used in this chapter to build a fingerprint library for positioning. The advantage of this method is that the disturbance component is only related to the location [8], and it is highly robust to environmental noise. However, when a target appears in the positioning area, only the RSS value of the interfered link can be obtained, that is ( , ) = ( ) (sum of ′ and ), and the disturbance component cannot be directly obtained, so extracting from ′ is a challenge.
In response to this challenge, an intuitive solution is to assume ′ ≈ , which can be obtained by formulas (1) and (2): = ′ − (7) However, in an actual condition, the noise component will change after the link is interfered, that is, obtained by formula (3), and cannot be obtained by changing the RSS value before and after the link is interfered. Therefore, in order to obtain the disturbance component , the noise component ′ needs to be estimated first. Now, the problem becomes how to estimate the noise component ′ , and then obtain the disturbance component .
In order to accurately estimate the noise component ′ , it is necessary to obtain ′ according to the impact of the noise component before the link is interfered and the RSS value after the interference. Therefore, a discrete signal model with RSS values affected by the environment is established. Because Gaussian distribution, Rayleigh distribution and other models based on the statistical distribution characteristics of signals cannot describe the changes of discrete signals, a finite Markov chain is used to determine the statistical change of RSS values. The state transition probability is used to express the influence of the environment on the RSS value. Therefore, the finite Markov chain is used to model the link to obtain the state transition probability corresponding to the noise component.
Based on the above analysis, when the spatial distance is close, the RSS value of the link changes similarly [9]. The finite Markov chain is used to model the link, and the state transition probability of the undisturbed link is linearly shifted to obtain the state transition probability corresponding to the noise component ′ of the interfered link. The noise component ′ can be obtained through the noise component before the link is interfered, and finally the disturbance component is obtained according to formula (2).

Modeling Finite State Markov Chain Link
Building a finite state Markov chain based on channel measurement is a representative stochastic method for modeling wireless communication links. The measured value of the channel is used as a random variable to obtain the channel characteristics. Compared with other modeling methods, the finite state Markov chain is not only based on the fading theory but also based on the signal measured value. At the same time, the form is simple, so it is more suitable for modeling environmental fading channels [10]. The finite state Markov chain is constructed by using the RSS value of the link measurement. RSS state sequence can be obtained by training the RSS value, which is a statistical model of the discrete time sampling sequence. Transition probability is used to indicate the impact of the environment on the RSS value. The state transition probability is the basis for the migration between links, and the method of constructing a finite state Markov chain model is introduced below.

RSS Measurement Value Division
The RSS value is equally divided into N adjacent sub-intervals, each interval represents a Markov state. In particular, the RSS values falling within the same interval represent the same state S. Suppose the range of RSS values is [ , ], and the sub-interval size is dB, so the number of intervals is

State Transition Probability Matrix
The RSS value of the undisturbed link includes only the noise component. Since the probability of abrupt changes in the environment in a short time is very low, most of the transitions between states are adjacent. Assuming that , represents the number of measured values that transition from state to , is the number of measured values that are in state , then the transition probability , from state to can be expressed as , = , / , where , [1, ] . Therefore, the link state transition probability matrix P can be denoted as: Since the transitions between states are mostly adjacent, the non-zero elements of the state transition probability matrix P are mostly distributed around the diagonal, which lays a theoretical foundation for the linear transition between links. Assume the steady-state probability of the link is = { } , = / , 1 ≤ ≤ , is the number of measured values in all states. After -th transfer, the transfer probability matrix of the link can be solved by Chapman-Kolmogorov theorem: If Ρ = { , }，then Ρ ( ) = Ρ (9) where P is the initial transition probability matrix, and Ρ ( ) is the transition probability matrix after -th transition.

Abnormal Data Processing
In the actual situation, the measurement value will be lost at certain moments due to the environment or other interference during the measurement of the RSS value. In order to obtain the complete RSS sequence, the measured values before and after the loss are interpolated to obtain the lost measured value. Assuming that there are consecutive measured values lost, the measured values before and after the loss are 1 and +2 , then the lost measured values (2 ≤ ≤ + 1) can be obtained by the following formula: Through the above formula, the state transition probability 1, +2 ( +2 | 1 ) can be supplemented as 1, ( | 1 ) , which not only prevents the appearance of abnormal data, but also guarantees the completeness of the RSS status sequence.

Establish A Linear Migration Model to Obtain Disturbance Components
Based on the above, it is assumed that there is a linear transition relationship between the state transition probabilities corresponding to the noise components of the interfered link and the undisturbed link. By migrating the adjacent undisturbed state transition probability , we obtain the state transition probability corresponding to the interference link noise component ′ . Therefore, in order to achieve linear transition between links, it is necessary to obtain the neighboring undisturbed link that is closest to the interfered link, and then transition is carried out through the state transition probability between the links. Finally, the disturbance component sequence of the interfered link is obtained.

Data Processing
Assume that the link midpoint coordinates ( , ) formed by nodes m and n, which represents the geometric position of the link. Link mn is a disturbed link, the geometric position of undisturbed link is ( , ), and represent the length of link mn and link , respectively. The Euclidean distance between the links is = √( − ) 2 + ( − ) 2 . To obtain the undisturbed link closest to the interfered link mn, the following formula can be obtained: According to the wireless signal propagation model [8], the RSS attenuation of the link is related to the link length. The longer the link length, the greater the RSS attenuation. Therefore, when the link length is the same, the link is equivalent to a particle located at a geometric position, and the distance between the links can be regarded as the distance between the particles. However, when the link length is different, the link length information needs to be considered. If the length of the undisturbed link and the interfered link are closer, and the geometrical position between the links is closer, the RSS value attenuation of the two links is more similar.

Linear Transition Model of State Transition Probability
To obtain the disturbed noise component, the linear migration model satisfies the following two conditions: Condition one: The noise component sequence of the interfered link should be similar to the fluctuation of the RSS value of the noise component sequence of the adjacent undisturbed link; Condition two: The statistical characteristics of the model based on spatial location should be able to reflect the impact of the environment, that is, the statistical characteristic relationship between adjacent links should be reasonable.
Since the state transition probabilities corresponding to the noise components of the interference link of the linear migration model and the adjacent undisturbed link have a linear transition relationship, the migration model satisfies the Condition one.
As shown in Fig.2, after the target appears in the area, some links will be disturbed (which is shown by solid lines), while others will not be disturbed (which is shown by dotted lines). For one of the disturbed links I, assume that represents the state transition probability corresponding to the noise component, link two is the undisturbed link closest to link I, represents the state transition probability corresponding to the noise component of link two.
can be obtained by linear migration of : Since reflects the migration relationship between links, it is possible to obtain on the premise that μ_rec is reasonably statistical based on spatial position, that is, the migration model meets the Condition two.
On the one hand, the dynamic change of the environment is reflected in the average signal power of the local area, and the average power value fluctuates according to the average value related to the location [8]. Therefore, the average signal power fluctuation of the link is related to its position, and the average power fluctuations of links with closer spatial distances are similar. Furthermore, the average signal power of the link can be obtained by interpolating the links with closer distances, and the correlation between the links decreases as the distance increases [9]. On the other hand, if the link has enough fluctuations, the signal strength fluctuation caused by the multipath effect can be reduced by averaging the RSS sequence of the link, then the average of the RSS sequence of the link is equal to the average power of its signal. Therefore, to obtain the mean value of the noise component sequence of the disturbed link, the nearest -th undisturbed link is used for interpolation (such as link one, two, three in Fig.2), and finally is solved. Assuming that represents the average signal power of undisturbed link , is the link length (1 ≤ ≤ ), is the mean value related to position, is the fluctuation of relative to , which can be given as: where can be obtained through the free space propagation model [8]. Assume that the distance between the undisturbed link and the interfered link is (1 ≤ ≤ ), is the length of the interfered link. After obtaining the -th undisturbed links closest to the interfered link by formula (15), the average power fluctuation corresponding to the noise component sequence of the interfered link is obtained by interpolation, as given in the following: where is the unit length fluctuation value of the undisturbed link . Since the link length information is taken into account, the migration model is still applicable to the case where the link length is different. Therefore, the average signal power ′ corresponding to the noise component sequence of the interfered link can be expressed as: where is the length of the interfered link, and are the mean value and fluctuation value of the average power of the signal corresponding to the noise component sequence of the interfered link, respectively.
The average value of the noise component sequence of the interfered link is its average power, that is, ′ = , which can be obtained by formulas (14) and (17):

Acquisition of Disturbance Component Sequence
After obtaining the linear migration factor , the state transition probability corresponding to the noise component of the interfered link is obtained by formula (12), and then the conversion probability matrix is acquired. According to and , the noise component sequence ′ of the interfered link is obtained. Finally, the RSS sequence ′ is subtracted from the noise component sequence ′ , and the disturbance component sequence of the interfered link is obtained:

Establish Fingerprint Library Based on Disturbance Components
Suppose the position of the target is ( , ). For -th interfered links, (1 ≤ ≤ ) is the disturbance component sequence of the k-th link, ( R × ) is the disturbance sequence vector composed of interfered links, is the number of elements in the sequence, as given in the following: where T means transpose, then the information stored in the fingerprint library can be expressed as:

Using DTW Algorithm to Locate Target
In order to accurately match the real-time disturbance component sequence with the prior fingerprint sequence , and to quantify the matching result, the DTW algorithm [11] is used to locate the target. By comparing and regularizing the following two time series, each element in sequence 1 is aligned to one or more consecutive elements in sequence 2, and finally the minimum alignment cost of all element pairs is guaranteed. Two sequences are given as: In the simulation, the disturbance component sequence obtained by any link in the positioning stage is matched with the fingerprint sequence, that is, = , then the cost matrix can be obtained, as shown in Fig.3. The element , in represents the alignment cost of the elements ( ) and ( ) . The lighter the color, the greater the cost. represents the alignment of the sequence element pairs in the matrix , that is, = 1 , ⋯ , ℎ , ⋯ , . ℎ =( ℎ , ℎ ) corresponds to the cost , . The goal of DTW is to find the arrangement that minimizes the cost : ∑ ℎ ℎ=1 = ∑ ℎ , ℎ ℎ=1 (27) Standard dynamic programming [11] is used to solve formula (25) to obtain a regular route that minimizes the overall cost, as shown by the red line in Fig.3. However, the following conditions need to be met: Condition One (Boundary condition): The regular route starts at the first element pair of the sequence and ends at the last element pair. As shown in Fig.3, the lower left corner of the matrix is the starting point, and the upper right corner is the ending point. Condition Two (Monotonic condition): ℎ+1 ≥ ℎ ℎ+1 ≥ ℎ ℎ+1 + ℎ+1 ≥ ℎ + ℎ (29) The elements on the regular route must move to the right, or upward, or diagonally to the right (upper right), as shown by the red line in Fig.3. When performing alignment regularization, the order of the elements of the sequence cannot be changed, but it is allowed to align an element in sequence 1 with multiple elements in sequence 2 and vice versa.
The optimal alignment result obtained by standard dynamic programming (the continuous curve is the result obtained by element interpolation) is shown in Fig.4. The matrix represents the degree of similarity between the sequences, with the minimum cost corresponding to the same link. Therefore, by matching the fingerprint sequence with the minimum cost, the location of the target can be determined.

Analysis and Verification
The system model used in this paper is shown in Fig.5, which consists of the transmitter, the optical wireless channel and the photodetector (PD) receiver. The transmitter is composed of six light-emitting diodes (LEDs) installed on the ceiling and the receiver placed vertically on the ground. The dimension of the model is 1.2m × 1.2m × 0.6m. Six LEDs are located in A (0.15,0.15,0.6), B (0.15,0.55,0.6), C (0.15,0.95,0.6), D (0.95,0.15,0.6), E (0.95,0.55,0.6) and F (0.95,0.95,0.6). LED-ID [12][13][14] technology is used in positioning systems to enable the receiver to distinguish signal strength from different LEDs. In the real environment, the LEDs send the signal with a certain duty cycle, which is received by the photodetector. The signals with duty cycle can be regarded as information marks. At the time of acquisition, we measure 100 times at each grid to reduce the error, then record the signal strength value and corresponding position from each LED lamp to form the matrix. The key parameters are summarized in Table 1 [15].
Fg.5 System model (The system model used in this paper, which consists of the transmitter, the optical wireless channel and the photodetector (PD) receiver)

Table 1 System paraments
In order to verify the method of interpolating the missing data, the probability of correct matching of the RSS measurement sequence and the corresponding positioning error are calculated respectively according to the number of missing elements of the RSS measurement sequence, which is shown in Fig.6  corresponding to the RSS of two links is first calculated, as shown in Fig.7. The similar transition trend is reflected in the RSS value of the adjacent link. Therefore, the linear transition relationship described in equation (12) is shown in the state transition probability of the adjacent link.
Then we prove the feasibility of the linear migration model. Since the disturbance component of the disturbed link cannot be directly obtained, the undisturbed link is used for verification. We obtain the RSS measurement sequence by measuring an undisturbed link, and obtain the RSS estimation sequence by the migration model. The Kolmogorov-Smirnov (K-S) test method [16] is used to determine whether the RSS measurement sequence and the RSS estimation sequence are from the same distribution.
The result is obtained by comparing the Cumulative Distribution Function (CDF) of the two samples.
As shown in Fig.8, it can be seen that the two sample sequences come from the same distribution, thus proving the feasibility of the linear migration model.  large, it will increase the delay. As shown in Fig.9, it is a box plot of 144 grid point positioning errors corresponding to the number of different elements . As increases, the average value of the positioning error starts to decrease from 0.135m. When ≥ 25, the positioning error is maintained at about 0.022m, and the error stability is high, so the value of is selected as 25. Fig.9 The influence of the number of different sequence elements on positioning In the linear migration model based on the finite state Markov chain, in order to solve the migration factor, it is necessary to select the nearest γ-th undisturbed links of the interfered links for interpolation.
We set γ = 1, 3, 5, 7, respectively, which is shown in Fig.10. When γ = 3, the positioning accuracy is the highest. For 80% of the points, the positioning error is less than 0.084m. Therefore, the value of is selected as 3.
In order to investigate the influence of the number of interfered links on the positioning errors, we set m = 1, 3, 5, 7 respectively, which is shown in Fig.11. When m = 3, 80% of the grid point positioning error does not exceed 0.12m, so the value of m is selected as 3.

Results
To improve the efficiency of the improved algorithm, the finite state Markov chain method(a) proposed in this paper is compared with the least squares(b), as shown in Fig.12. Table of Table 2. The maximum error of the proposed method is 0.051m, the minimum error is 0.0013m, and the mean error is 0.022m, which has obvious advantages.

Conclusion and Discussion
In this paper, a novel method is proposed in indoor visible light localization. To solve the problem of lowering positioning accuracy under the influence of environmental noise, a method that can effectively eliminate the influence of environmental noise is proposed. According to the proposed linear migration model based on the finite state Markov chain, the disturbance component in the RSS measurement value is obtained to construct a fingerprint library, which achieves high robustness to environmental noise. In addition, the DTW algorithm is used to achieve high-precision positioning.
However, the method proposed in this paper are all done under simulation. Therefore, whether the positioning algorithm is feasible in the real environment is the focus of the next research.