An Adaptive Location-Based Tracking Algorithm Using Wireless Sensor Network for Smart Factory Environment

In recent years, how to improve the performance of smart factories and reduce the cost of operation has been the focus of industry attention. This study proposes a new type of location-based service (LBS) to improve the accuracy of location information delivered by self-propelled robots. Traditional localization algorithms based on signal strength cannot produce accurate localization results because of the multipath eﬀect. This study proposes a localization algorithm that combines the Kalman ﬁlter (KF) and the adaptive-network-based fuzzy inference system (ANFIS). Speciﬁcally, the KF was adopted to eliminate noise during the signal transmission process. Through the learning of the ANFIS, the environment parameter suitable for the target was generated, to overcome the deﬁciency of traditional localization algorithms that cannot obtain real signal strength. In this study, an ex-periment was conducted in a real environment to compare the proposed localization algorithm with other commonly used algorithms. The experimental results show that the proposed localization algorithm produces minimal errors and stable localization results.


Introduction
rough the development of artificial intelligence, the maintenance and repair of machines in smart factories are different from the old way. ere are already smart factories that use mechanical vibration and noise detection or environmental data to improve the reliability of equipment or knives [1][2][3][4]. However, installing sensors for detection in all the equipment would increase the cost significantly. is time, self-propelled robots can be used for inspection, effectively reducing the related costs. Of course, locationbased service technology is very important at this point because it can effectively provide accurate equipment information. Location-based services (LBSs) have been widely applied in warehouse management, transportation, personnel tracking, and medical care [5,6].
Currently, the commonly used location-based systems can be divided into indoor and outdoor systems [7]. In particular, although the global positioning system (GPS) is the most frequently used outdoor location-based system, it cannot be effectively used in an indoor environment because of the shading effect of buildings. erefore, other techniques, such as radio frequency identification, wireless local area network, Bluetooth, and ZigBee, are required for indoor localization [8]. All of these techniques involve transmitting radio wave signals to establish a wireless sensor network for positioning. However, during the transmission process, signals may be influenced by the multipath effect; therefore, information received by the reader may be distorted, influencing the accuracy and stability of localization [9][10][11]. e interference in signal transmission is not entirely caused by obstacles; signal transmission may be interfered with by signals emitted from other electronic devices [12]. In addition, various receivers may experience different levels of interference because of varying transmission directions, despite using the same signal transmitter. erefore, the result of positioning is influenced by obstacles in an environment, signals from other electronic devices, and the direction of signal transmission [13].
To solve the problems produced by varying transmission directions and the multipath effect caused by obstacles, this study proposed a localization algorithm by combining the Kalman filter (KF) to enhance the accuracy and stability of localization.
e proposed algorithm was subsequently compared with existing localization algorithms.
is study has proposed an adaptive tracking system. Section 2 discusses related literature, the concepts of the location algorithm, Kalman filter, and adaptive-networkbased fuzzy inference system (ANFIS). Section 3 illustrates the proposed algorithm for the smart factory. Section 4 details the demonstration of the experimental operations and examines the algorithm in the smart factory environment. Finally, Section 5 includes the conclusion and highlights follow-up research.

Related Work
Among the propagation path loss models, the most widely used models are the free-space propagation, log-distance path loss, and Hata models. In the free-space propagation model, the Friis free-space model is typically adopted. When the distance between a transmitter and receiver is given, the model can be used to calculate the average received power of the receiver as follows [14]: where P t represents the transmission power of the transmitter; λ is the wavelength of the electromagnetic wave; L denotes the system dissipation coefficient; and G t and G r are the antenna gains for the transmitter and receiver, respectively. e calculation of antenna gains is related to the effective aperture (A e ): e effective aperture is related to the antenna design. erefore, when the transmitter and receiver use different antennas, despite using the same transmission power, the power received by the receiver may differ.
In equation (1), when the distance between the transmitter and receiver is 0 (d � 0), the received power cannot be determined. erefore, a close-in distance (d 0 ) is defined in the model, and the received power in this condition is a reference power.
us, the Friis free-space model can be expressed as (3): (3)

Kalman Filter.
e KF is a well-known tool used to eliminate noise and can provide an efficient calculation approach for estimating system states [15,16]. By applying a series of regression models, the efficiency of the least-square method can be enhanced [17]. Because the internal state of a system cannot consistently be directly estimated, the KF has two primary assumptions: (1) the system is linear, and (2) the system error distribution and initial estimate probability distribution are both Gaussian distributions [16]. e KF applies the linear stochastic difference equation to construct prediction and measurement models, as expressed in equations (4) and (5): where x k indicates the state of a system at time k, A represents the conversion model for the system state, B denotes the control model for the control factor u k , z k is the observation state of a system at time k, and H is an observation model. In addition, w k and v k are system noise and observation noise, respectively, which are assumed to be mutually independent and to follow Gaussian distribution. w k and v k are expressed as equations (6) and (7): e calculation of the KF is a regression process that involves two steps, namely, prediction and correction. At the prediction step, the system state (x k−1 ) at time k-1 is used to calculate the a priori state of the system (x − k ) at time k.
At the correction step, the observation value of the system at time k is used to adjust the system state at time k.
where P − k is the a priori estimation error of the system at time k, p k is the estimation error of the system at time k, and K k indicates the Kalman gain of the system at time k. In the KF, the Kalman gain is applied to adjust the state estimates; therefore, the estimation errors of the systems can converge over time.
Other KF-related studies include that of Yim et al., who used KNN to find the distance between the target and the antenna and gave different weights to the EKF depending on whether the target was located at a corner or not [15].

Adaptive-Network-Based Fuzzy Inference System.
e ANFIS has the characteristic of neural network learning and the advantage of the rules of a fuzzy inference system and can thus process nonlinear and complex systems and identify system rules. Figure 1 shows the framework of the ANFIS, which consists of five layers. e layers that comprise squares involve parameters, among which an optimal parameter can be obtained in each layer through learning adjustment. No parameters are involved in the layers comprising circles. e layers are explained as follows.

Layer 1: Input Layer
where x is the input of A, and A i is the i th semantic tag for input A. μ Ai (x) is the membership function (MF) for the i th semantic tag of input A. e bell-shaped distribution is the most frequently used MF that has values within the range of 0 to 1, as shown in (11): where a i , b i , and c i are parameters of the MF.

Layer 2: Rule
Layer. e firing strength of the fuzzy rules is calculated using equation (12):

Layer 4: Inference
Layer. e output of the normalization layer is multiplied by the fuzzy rules to calculate the result of each rule.
where f i is the i th rule, and p i , q i , and r i are parameters for the i th rule.

Layer 5: Output
Layer. e weighted average of the results of the inference layer is computed to be the output of the ANFIS.
e parameters in each layer of the ANFIS are adjusted using a hybrid learning algorithm. When the optimal parameter adjustment is achieved, the calculation efficiency of the system and the output accuracy can be improved. Related studies using ANFIS include the following: Oliveira et al. combined signal strength and Link Quality Indication (LQI) to calculate distance and then used a fuzzy inference system to find the target location [19]; Lee et al. applied the parameters considered in the computational process to a fuzzy inference system to generate a new filter, which was then combined with a prototype filter to find the location of the target [20]; and other related practical applications of the relevant literature [21,22].

Localization Algorithm Combining the Kalman Filter and Adaptive-Network-Based Fuzzy Inference System.
e proposed localization algorithm assumed that the relationship between RSSI and distance remains the same in the same environment with the same distance. In addition, the concept of reference tag was used to identify the environment parameters suitable for the targeted object. e algorithm comprises four steps, as shown in Figure 2. e following section describes Figure 2. For more information, please refer to the descriptions on pages 7-11.
First, considering the use of antennas to receive the signal of the reference tag and the object to be measured, the signal will be distorted by the influence of multipath during the transmission process. erefore, this study uses the characteristics of the Kalman filter (KF) to eliminate the noise during the transmission of the signal, so that the received signal is clean. e KF was then integrated with the modified Friis free-space model to identify the relationship between signals and distance.
rough the correction learning of the ANFIS, the environment parameter suitable for the target was yielded, which was then combined with the modified WCG to determine the location of the target.

Kalman Filter.
e KF can filter noise caused by interference in signal transmission; therefore, readers can receive clean signals emitted by reference tags and the target without interference. Because all of the reference tags and Layer 5 Figure 1: e framework of ANFIS [18].
Mathematical Problems in Engineering targets used in this study were static, their states would not change during the system conversion from the true state to the observation state, except for being interfered with by noise. erefore, the prediction and measurement models of the KF were simplified as equations (16) and (17): where where S k is the true state of the system at time k, RSSI ref k represents the signal strength of a reference tag at time k, RSSI tgt k signifies the signal strength of the target at time k, w k indicates the noise in the true state of the system at time k, and Q is the variance of the true system state. However, because the variation of the system's true state cannot be obtained easily, Q is typically excluded from the consideration.
where Z k is the observation state of the system at time k; RSSI ref,measure k is the observed signal of a reference tag at time k; RSSI tgt,measure k represents the observed signal of a target at time k; v k indicates the noise in the observation state of the system at time k; and R denotes the variance of the observation state. e observation state of the system was used to predict the estimate of the true state of the system, and the correction was performed to reduce errors in the estimate and the actual value. e initial estimate (s 0 ) and error (P 0 ) were given, and iteration calculation was performed, as shown in equations (20)-(24): where s − k is the a priori true state estimate of the system at time k, s − k is the true state estimate of the system at time k, P − k signifies the a priori estimation error of the system at time k, P k indicates the estimation error of the system at time k, and K k is the Kalman gain of the system at time k.

Friis Free-Space Model.
e Friis free-space model is the propagation path loss model obtained in a free space based on the inverse square law, which assumes that RSSI is inversely square proportional to distance (RSSI ∝ 1/d 2 ). However, the real environment is subject to the influence of the multipath effect; in other words, the signals received by readers frequently interfere. erefore, the relationship between signal values and distance is not inversely square proportional. us, the Friis free-space model was modified to be where RSSI  (25); and n is the environment parameter, which varies according to the change in environment and distance.
Moreover, when the environment and distance between the transmitter and receiver are the same, the receiver signal strength is influenced by various levels of interference in signal transmission, causing changes in the value of n. us, this study employed reference tags to determine the possible value of n in the environment. e approach is as follows: Assume that I readers (i � 1, 2, . . ., I) and J reference tags (j � 1, 2, . . ., J) were deployed in an indoor environment for localization. e value of n was calculated as follows: where RSSI ref,clean ij represents the clean signal sent by the j th reference tag and received by the i th reader, d ij indicates the distance between the i th reader and the j th reference tag, and n ref ij is the value of n for the i th reader corresponding to the j th reference tag.

Adaptive-Network-Based Fuzzy Inference System.
is study applied the ANFIS to obtain the value of n for the target connected to various readers. e ANFIS model involves three input data, one output data, and five layers. e input data represented as RSSI clean i (i � 1, 2, 3) were clean signals received by the i th reader. e output data were the values of n for readers corresponding to reference tags and the target.
(1) Input Layer. Each input involved three MFs, which can be expressed as follows: where μ RSSI clean il (x) indicates the first MF of the clean signal received by the i th reader. e MF was a bell-shaped distribution with values ranging from 0 to 1, as shown in (28), where x is the input signal, and a l , b l , and c l are MF parameters.
(2) Rule Layer. e firing strength of the fuzzy rules was calculated as follows: (y) × μ RSSI clean 2c (z), (29) where m is the m th rule; a, b, and c are the semantic tags for the first, second, and third readers, respectively; and a � b � c � 1, 2, 3.
(3) Normalization Layer. e firing strength of all rules was normalized using (30).
where f m is the m th rule, and p m , q m , r m , and s m are parameters for the m th rule. (5) Output Layer. e results yielded in the inference layer were summed to be the output value of the ANFIS.
e clean signal of reference tags (RSSI ref,clean ij ) and the n values for reference tags corresponding to various readers (n ref ij ) were used as the input and output of training data in the hybrid learning algorithm. Consequently, the optimal ANFIS in the environment was employed to determine the value of n (n tgt i ) for the target corresponding to various readers.

Calculation of the Target Location.
e n (n tgt i ) obtained using the ANFIS was incorporated in the modified WCG as follows: where (x t , y t ) is the coordinate of the target; (x i , y i ) is the coordinate of the i th reader; and RSSI tgt,clean i indicates the clean signal sent by the target and received by the i th reader.

Experiment Evaluation
is study aims to evaluate whether the proposed algorithm meets the future operational requirements of the smart factory through three practical experimental operations. First, the proposed localization algorithm was verified to be capable of generating a more accurate and stable localization result. Second, the number of reference tags was adjusted to examine whether the localization accuracy was influenced by the number of reference tags used. Finally, the localization environment was interfered with to demonstrate that the proposed localization algorithm can generate the same localization results regardless of the interference.

Experimental Operation 1.
e first experiment was conducted in a 20 m × 10 m smart factory environment, in which three readers, six reference tags, and one target was deployed, as shown in Figure 3. e first experiment comprised two parts. In the first part, the type and number of MFs in the ANFIS in the proposed localization algorithm were altered to determine the parameters that can generate satisfactory localization outcomes. e quality of the localization outcomes depended on the distance difference between the actual location and the estimated location of the Mathematical Problems in Engineering 5 target given in equation (34) as well as the level of distance difference.
where x and y denote the actual x-axis and y-axis coordinate values for the target, and x t and y t are the estimated x-axis and y-axis coordinate values for the target, respectively. e initial state of the system (s 0 ) is zero, and the initial covariance (P 0 ) is 100. By setting the system observation state and initial parameters, the Kalman gain during the calculation process was adjusted and further used to identify the true state of the system, enabling covariance convergence. e localization algorithm proposed in this study categorized the MFs of the ANFIS into three types, namely, triangular-shaped, bell-shaped, and Gauss curves. Two and three MFs were adopted from each type for analysis. rough various combinations of the MFs, the environment parameters that generated superior localization results and were suitable for the target were calculated by employing the MATLAB toolbox for the ANFIS. e experimental results are presented in Table 1.
e standard deviations shown in Table 1 revealed that the results generated using three MFs were more stable compared with those generated using two MFs. Moreover, among the three MF types, the average error produced by the Gauss curve MF was the smallest, and the bell-shaped MF produced optimal stability. Because the Gauss curve and bell-shaped MFs had similar average errors, this study adopted three bell-shaped MFs for the ANFIS parameter setting. e proposed localization algorithm was compared with other frequently used algorithms, such as the LANDMARC [23], WCG [24], ANFIS, and DV-Hop [25] algorithms, and the comparison results are shown in Table 2. Figure 4 shows that the proposed localization algorithm that combined the KF and ANFIS produced minimal localization errors, compared with other algorithms. e comparison presented in Table 2 revealed that the proposed localization algorithm demonstrated optimal localization stability.
e localization results using LANDMARC, WCG, and ANFIS algorithms contained a high number of errors and lacked stability because these algorithms did not consider possible interference in the signal propagation process or the consequent signal distortion. is study applied the concept of reference tag and eliminated noise in the signal transmission process by employing the KF. e propagation path loss model was then used to generate environment parameters, and the environment parameter that was most suitable for the target was obtained using the ANFIS. e weighting method was finally adopted to determine the location of the target. e experimental results indicated that the proposed localization algorithm that combined the KF and ANFIS can be applied to indoor localization.

Experimental Operation 2.
By changing the number of reference tags, the experiment in this experiment aimed to verify whether the number of reference tags influenced the localization results produced by the proposed localization algorithm. us, the number of reference tags was set as three and six. e experiment was conducted in a 5 m × 6 m smart factory environment (Figures 5 and 6). Table 3 indicates that the proposed localization algorithm produced stable localization results regardless of using three or six reference tags; however, the result obtained using six reference tags was superior.
is can be explained as follows: e proposed localization algorithm applied the ANFIS to calculate possible environment parameters. In the calculation, the data of the reference tags were used as the training data to identify the inference system suitable for the environment. erefore, using a high number of reference tags, the possible environment parameters can be identified easily, and accurate localization results can be obtained.

Experimental Operation 3.
e experimental results obtained in the second experiment were used in experiment 3. An interference experiment was conducted in a 9 m × 10 m smart factory environment. Specifically, in a localization environment, the transmission of signals was interfered with by human walking. Subsequently, data were analyzed to verify whether the proposed localization algorithm can generate a localization result at a high level of  accuracy and stability. e third experimental environment is shown in Figure 7.
Because the proposed localization algorithm applied the KF to eliminate noise during the signal transmission process, the interference of human walking did not cause the localization results to change significantly. Table 4 and Figure 8 show that the tests with and without interference produced similar average errors and stable localization results.
In this study, we compared the proposed method with the current common localization algorithms (LANDMARC, WCG, ANFIS, and DV-Hop) operated in the smart factory environment through experimental operation 1; the results confirm that the proposed algorithm has significantly improved the localization error and is relatively stable (lowest value of standard deviation). Furthermore, experimental operation 2 was used to verify whether the larger the number of reference tags, the more it interferes with the accuracy of localization in the smart factory environment; as a result, in the smart factory environment, the more the number of reference tags is in the proposed algorithm, the more likely it is to find the possible interference parameters and to obtain more accurate localization results. However, in the real-life application, it is not possible to completely exclude the interference of the movement of people on the positioning. erefore, in experimental operation 3, we verified whether the interference of human movement on the signal transmission affects the accuracy and stability of localization in the smart factory environment. Overall, we conclude that     x-axis (cm)

Reader
Reference tag Target Figure 6: e second experimental smart factory environment in which six reference tags were used.    regardless of the interference of signal transmission caused by the movement of people, there is no effect on the positioning results in terms of average positioning error or stability.

Conclusion
Traditional localization algorithms based on signal strength cannot produce accurate localization results because of the multipath effect. is study provides a practical contribution by offering an adaptive tracking system with improved tracking algorithms. e system combines KF and ANFIS and applies the concept of reference tags to a smart factory environment. Compared with the positioning error derived from the conventional ANFIS algorithm, the hybrid positioning algorithm (KF + ANFIS) provided in this study reduces the positioning error by up to 89% (�(628.12-67.03)/ 628.12). Compared with other common localization algorithms, including LANDMARC, WCG, and DV-Hop, the localization error is also reduced by at least 50%. Specifically, the KF was employed to eliminate noise in signal transmission, and a propagation path loss model was adopted to obtain the environment parameters in signal transmission. rough the learning of the ANFIS, the environment parameter most suitable for the target was generated and was subsequently used in the weighting method to determine the location of the target. is technology can be applied not only in smart factories but also in the marketing field. In recent years, it has been proposed to provide local advertising with the user's location information. is helps to market products and services. e contribution of this study can improve the accuracy of indoor positioning and reduce the provision of misinformation.
Moreover, this study involved experimenting in a real environment for parameter setting, and the proposed localization algorithm was compared with other commonly used localization algorithms. e data analysis revealed that the proposed localization algorithm can produce an accurate and stable localization result superior to that produced by others. In addition, experiments regarding the number of reference tags and interference in a localization environment were conducted in this study. e experimental result revealed that an increase in the number of reference tags can cause an increase in localization accuracy. e proposed localization algorithm can produce stable localization results with similar errors regardless of interference in the localization environment.
Although the results produced by the localization algorithm proposed in this study still involved errors, a certain level of stability was achieved. Future studies can identify the stability errors in an environment to obtain an accurate localization result. e combination of various types and numbers of MFs in the ANFIS can be used to improve the accuracy of the localization result for self-propelled inspection robots, thereby effectively reducing the related costs. is location-based service technology can effectively provide accurate equipment information that widely applies in warehouse management, transportation, personnel tracking, and medical care.

Data Availability
"No data were used to support this study".

Conflicts of Interest
e authors declare that they have no conflicts of interest.