A Novel Enhanced Positioning Trilateration Algorithm Implemented for Medical Implant In-Body Localization

Medical implants based onwireless communication will play crucial role in healthcare systems. Some applications need to know the exact position of each implant. RF positioning seems to be an effective approach for implant localization. The two most common positioning data typically used for RF positioning are received signal strength and time of flight of a radio signal between transmitter and receivers (medical implant and network of reference devices with known position).This leads to positioningmethods: received signal strength (RSS) and time of arrival (ToA). Both methods are based on trilateration. Used positioning data are very important, but the positioning algorithm which estimates the implant position is important as well. In this paper, the proposal of novel algorithm for trilateration is presented.The proposed algorithm improves the quality of basic trilateration algorithms with the same quality of measured positioning data. It is called Enhanced Positioning Trilateration Algorithm (EPTA). The proposed algorithm can be divided into two phases. The first phase is focused on the selection of the most suitable sensors for position estimation. The goal of the second one lies in the positioning accuracy improving by adaptive algorithm. Finally, we provide performance analysis of the proposed algorithm by computer simulations.


Introduction
In the past few years, wireless communication devices for medical applications are studied extensively towards practical use. Wearable and implantable medical devices such as body sensors or smart pills are gaining important roles in healthcare systems by controlling and transmitting the vital information of the patients. The body's condition and detection of any possible problems in the human body at anytime and anywhere can be performed by means of the mentioned technology [1][2][3]. These can be a great help for doctors to diagnose and to cure diseases [4]. The development in semiconductor technology enables designing smaller and cheaper medical wireless devices which are more convenient to be implanted inside a human body.
Generally, it is very important to know the ranging and position of each implant, because it can help to optimize transmission power and to know where the biological information from medical implant was obtained. Various technologies for the localization of the implant have been proposed in feasibility studies [5,6] and have been widely investigated recently [5][6][7][8][9][10][11][12][13][14]. Among all the different methods that have been suggested for an implant positioning, RF signal based methods have the advantage of application-nonspecific property and relatively low-cost hardware implementation [5,7]. The investigated solutions include ultrasound [15], magnetic tracking [16,17], computer vision [13,14], and time of arrival (ToA) based pattern recognition [8]. Interesting solution based on RSS was presented in [11]. The authors generate new positioning solutions, but in most of the cases a small modification of the core algorithm can bring success. Positioning environment is completely different with traditional positioning systems placed in outdoor or indoor. On the other hand, the positioning philosophy can be applicable in the case of human body implant localization. The human body is formed of various organs with complex structures. Furthermore, each organ has different characteristics of conductivity and relative permittivity. These parameters influence RF signal propagation and radio channel in human body is very hostile. Therefore, radio signal propagation is not easily predictable. Positioning data are influenced by this fact and it determines main limits of all positioning methods used. The paper presents how positioning algorithm can improve positioning accuracy of the fundamental method without implementation of new kinds of measurements, sensors, and pills. In this paper, we propose the positioning algorithm of medical implanted devices applicable in daily life, for example, MRI and CT system. The proposed algorithm uses a network of sensors, whose locations are known, and we call them "reference node RN. " On the other hand, there is a medical implanted device, whose location is unknown, and we call it "blindfolded node BN. " position of BN is estimated during the positioning process. In Figure 1, there is depicted gastrointestinal (GI) tract and example of MRI. We focus on an implant positioning situated in this area.
Our Enhanced Positioning Trilateration Algorithm (EPTA) can be divided into two-stage algorithms. Position of the sensors has significant impact on the positioning accuracy. Therefore, the most suitable sensors from all sensors in the range for position estimation are selected in the first stage. This is done by an optimization algorithm. In the second stage, the final position estimation is done by means of Adaptive Geometric Algorithm (AGA) from the sensors selected during the first stage. The proposed algorithm was tested by simulation model created in MATLAB. We adopted radiofrequency parameters defined by Med-ical Implant Communication Services (MICSs). The standard allows twoway communication with medical implants in frequency band 401-406 MHz with the maximum bandwidth of 300 KHz and maximum transmitted power of 25 W [18]. This is an ultralow power, unlicensed mobile radio service for transmitting data in support of diagnostic or therapeutic functions associated with implanted medical devices. Because this paper is mainly focused on positioning algorithm proposal, we will use simplified statistically modeled radio channel presented in [18]. RSS information will be utilized for ranging between transmitter and receiver. According to RSS, distance between the nodes will be estimated. Finally, BN position will be calculated by means of trilateration method.
The rest of the paper will be organized as follows: in the next section geometric trilateration algorithm will be described. Proposed EPTA algorithm is described in detail in Section 3. Section 4 introduces simulation model and achieved results are shown in Section 5. Section 6 concludes the paper and introduces a plan for the future work.

Trilateration Algorithm
In general, there are two different kinds of proposed approaches to determine BN location based on the trilateration [19] as follows: (i) the geometric approach based on geometric algorithm (GA) [20], (ii) the statistical approach based on least square (LS) algorithm [19,21].
We decide to implement the geometric approach for a medical implant positioning; therefore, the principles of the geometric algorithm are described.
The images of MRI or CT system are two-dimensional images, so we consider only two-dimensional images. Positioning principles will be explained in 2D, but the proposed algorithm also works in 3D. Let the real BN location be given by [ ; ] and the coordinates of the th RN be defined by [ ; ], = 1, 2, . . . , , where is the number of RNs. The distance , between BN and the th RN, is The RSS measurement determines a circle centred at the corresponding RS with BS located on the circle. Note that the radius of the circle expresses the distance between BS and RS. Then BS position can be estimated by the intersection of at least three circles. It could be done by Geometric Algorithm (GA). The principle of GA is explained in the following part.  Two situations, which are analysed and used for BN position estimation in this paper, are depicted in Figure 2. As can be seen, there are a few intersections of all circles.
The first situation is depicted in Figure 2(a). A one intersection of any two circles, which lies inside the third circle, is an interior intersection. An interior intersection is used for MS position estimation and therefore we called it a relevant intersection. Three-circle BN model determines 3 different relevant intersections, for example, there are , , relevant intersections in Figure 2(a). These relevant intersections determine an area which belongs to all the circles. It is called a relevant area. The exact location of BN is expected to be inside the relevant area.
The second situation is shown in Figure 2(b). This is a more complicated scenario compared to previous one, because there are no interior intersections. Consequently, the relevant intersections are chosen by the different way. Only one point of the intersection pair with shorter mutual distance is taken into consideration. Hence, three relevant intersections are obtained. As shown in Figure 2(b), the relevant intersections are , , and . These relevant intersections also determine the relevant area.
For both previous situations, relevant intersections , , and determine the relevant area, where BN should be situated. A size of the relevant area depends on a particular situation. Generally, it can be said that the relevant area should be as small as possible in order to allow precise estimation.
The final estimation of BN position is defined as a centroid or centre of gravity of polygon created from all the relevant intersections. The estimated coordinates of the BN are calculated as follows: where is the number of relevant intersections. For three circles = 3. Three RNs are minimal amount for "uniquely" BN position estimation in 2D. Increasing the amount of RNs used for position estimation can improve positioning accuracy, but it depends on the utilized positioning data. Trilateration positioning methods are based on a ranging between the reference and the blindfolded node. The estimated distance is practically always affected by a ranging error; therefore, it is important to select the optimally distributed RNs. We focused on positioning methods which use three RNs for position estimation; for this reason the proposal is oriented in optimized selection of the three RNs. It results from ranging based on RSS affected by error. Optimally, the three nearest RNs to the BN are used for position estimation, because further RNs (fourth. . . ) bring errors into the position estimation. It is caused by the fact that RSS variation of 1 dB could introduce error related to distance estimation (see Figure 3).
Variation probability of RSS is the same in all cases; that is, it does not depend on RN-BN distance. However, distance error depends on RN-BN distance (see blue and red lines in Figure 3). In the case when distance between the RN and the BN is shorter, the error of the estimated distance should be smaller as well. Correspondingly, longer value of distance between nodes introduces higher error of the estimated distance. Therefore only three nearest RNs are supported by our proposed algorithm.

Proposal of Enhanced Positioning Trilateration Algorithm
Enhanced Positioning Trilateration Algorithm consists of two parts. Current position of the reference nodes has a significant impact on the positioning accuracy. Therefore, the most suitable RNs from all RNs in the range are selected for position estimation in the first stage. This is done by optimization algorithm. The algorithm selects only three RNs as mentioned above. In the second stage, the final BN position estimation is done by means of the Adaptive Geometric Algorithm (AGA) using the optimally selected RNs from the first stage.

Optimization Algorithm.
Optimized selection of proper reference nodes is performed in the first stage of our algorithm. This stage is formed by the optimization algorithm. Generally, the network of the reference nodes can consist of fix or mobile sensors. It depends on application. If RN is implanted in the body, the position cannot be considered as fixed due to the movement of human organs. On the other hand, the network of RNs can be implemented as a wearable medical device with the fixed position towards body.
The most suitable constellation of three RNs for trilateration is when RNs lie in the vertexes of a triangle. Lengths of the triangle sides are important and should be as short as possible. Optimization algorithm is based on the abovementioned facts which define the optimal selection of RNs. The whole process of optimization algorithm is shown in Figure 4. The algorithm iterates until the optimal combination of RNs is found. The number of iterations depends on the amount of all RNs in the range of BN, because the different combination of three RNs is investigated in each iteration.
The optimization algorithm could be divided into the following steps. In the first step, arbitrary three RNs which shape triangle are selected from all reference nodes. They are marked RN 1 , RN 2 , and RN 3 in Figures 5(a) and 5(b). The given nodes shape the triangle if the 1st condition is fulfilled: where represents mutual distances between RNs (dotted line: triangle side); stands for the radiuses of the circles = 1, 2, 3.
The combination of three RNs is known after this step. In the next step, there is investigated if selected RNs have mutual intersections. It is performed as the 2nd condition. It is mathematically expressed as where represents mutual distances between RNs; stands for the radiuses of the circles = 1, 2, 3. After this step the combination of three RNs, which have mutual intersections, is known. The intersections are not calculated during this phase.
When RNs shaped to triangle are found, then it is necessary to find out if BN is situated inside of the triangle. In case that the localized node is not situated in the imaginary triangle, the invalid position estimation could be performed ( Figure 6). It is done as the 3rd condition. It is mathematically expressed as where represents mutual distances between RNs; represents radiuses of the circles = 1, 2, 3.
The positive situations are shown in Figure 5. In the first case, there is common point (area) which belongs to all three circles; that is, estimated distances between RNs and BN are longer compared to real distance ( Figure 5  and estimated distances between RNs and BN are shorter compared to the real distance ( Figure 5(b)).
After this step, the coordinates of these three nodes are saved into the variables 1 , 2 , and 3 . Also a sum of three radiuses which corresponds to these circles are saved into variable .
BN position can be estimated after this iteration, but the optimization algorithm does not know if the better combination of RNs exists. The next RNs combinations are investigated in the next iterations. We assume that mutual distances between RNs are important from positioning accuracy point of view. Particular combinations are compared by the mutual distances between RNs. This comparison is done in the next iterations. In the next ( + 1) iteration is found another combination of three RNs. It continues up to the third condition which is fulfilled and a sum of radiuses +1 is compared with . It is the 4th condition and mathematically is expressed as This condition investigates if the distances between the new RNs are shorter compared to the last saved combination. It is done because we assume that the BN position estimation by means of nearer RNs is more accurate compared to further RNs. If the 4th condition is fulfilled, the optimization algorithm will find better constellation and save actual data to variables and . When any new combination of the RNs is not found, the BN position that can be calculated by the data from variables and . It is the end of the optimization algorithm and BN position can be calculated by the arbitrary algorithm for trilateration. We are focused on the geometric algorithm and the position estimation can be done by (2).
As mentioned above the positioning accuracy of the fundamental GA algorithm can be improved. It is performed in the second stage. We propose the AGA algorithm for that purpose. The AGA algorithm continues after the optimization algorithm and the final position estimation is done using the selected reference nodes.

Adaptive Geometric Algorithm (AGA).
The main idea of AGA comes from the basic GA described above. The AGA is implemented as iterative process. In fact, GA is the first iteration of AGA. Thanks to the first iteration, the coordinates of relevant intersections and the aforementioned relevant area are determined. The relevant area is then being reduced over all following iterations. The purpose of AGA is to reduce the relevant area and to finally determine the specific coordinates of BN. AGA process is shown in Figure 7.
The relevant area reduction is done by decreasing or increasing circle radiuses. The circle radiuses are multiplied by a factor . All of these circles are reduced (enlarged) proportionally. The factor can be less ( < 1) or greater than one ( > 1). For the first situation (Figure 2(a)), factor is less than one and for the second situation (Figure 2(b)) factor is greater than one. This iterative process continues until the target relevant area is found. The target relevant area is found in the iteration when the smallest area for all three circles exists. Finally, GA algorithm is applied in the last iteration, but now potentially on way more reduced area compared to the first iteration. Final position estimation of BN (medical implant) is calculated by (2). Thus, position estimated by EPTA is performed in two steps. The most optimally situated RNs toward BN are selected and these data (distances RNs-BN) are used by AGA algorithm for final position estimation.
The performance of the proposed algorithm was tested using simulation model explained in the next part of the paper.

Simulation Model
Simulation model takes into consideration a network of numerous RNs and one BN (implant). The proposed algorithm will be evaluated by means of RSS method; that is, distance estimation BN-RN is performed via received signal strength measurements. The following properties are set for the model: (i) positioning is implemented as network based solution; that is, network of RNs according to its measurements determines position of BN; (ii) signal from BN is measured at the RNs; (iii) it is assumed that RNs do not add any noise to the positioning process; (iv) all RNs and BN in the system are deployed with omnidirectional antennas.
The images of MRI or CT system are two-dimensional images; therefore, we consider only a 2D space which is a cross section of human torso (see Figure 1  in simulation. In the second case, positions of particular reference nodes are randomly generated with uniform distribution on the area of size 40 × 40 mm. The size of the area corresponds to the size of the GI of an adult human. The position of BN is randomly generated with uniform distribution on the observed area. The results are based on 1000 independent runs. Radio channel is modeled statistically according to the model presented in [18]. In our simulation, path loss at a distance from the transmitting antenna is defined as where is the transmit power, denotes the received power, and is the receiver antenna gain. Therefore, as defined above, the path loss would include the transmitter antenna gain. This is usually not the case for channel models corresponding to the most wireless systems, but for MICS, the transmitting antenna is considered to be part of the channel [18].
The path loss in dB at the distance between the transmitter and the receiver can be statistically modeled by the following equation: where 0 is the reference distance (i.e., 50 mm), and is the path loss gradient which is determined by the propagation environment. For example, in free space, = 2. Human body tissue strongly absorbs RF signal. Therefore, much higher value for the path loss gradient is expected. is a zero mean Gaussian random variable (in dB), ∼ (0, 2 ), where is the standard deviation of shadowing effect of human tissue. The parameters of the implant to body surface path loss model are summarized in Table 1.
Note that there are two sets of parameters for path loss from deep and near surface implant to body surface. During our simulation, we use 10 cm distance between the transmitter and the receiver on body surface as the threshold for choosing the model. If the distance is less than 10 cm, we use the near surface to surface path loss model, otherwise the deep tissue to surface model is used. In these simulations, for simplicity, it is assumed that the radio range for all nodes is infinite; that is, every RNs is able to receive signal from BN. An error to the ranging is directly linked with the parameter . In real situation, the fluctuation of the RSS could be caused by a motion of organs in the observed area, status of the organs (e.g., full or empty stomach), and so forth. It can cause fast changes of the RSS value. This is a reason why to calculate an average value from the measured data. The average value is computed by the following equation: where is the number of samples. In this case, = 10. The average value is used for further processing. For analysis of the simulations we calculate the Root Mean Square Error (RMSE) localization error using the formula

Simulation Results
The main goal of the simulations is to evaluate the performance of EPTA algorithm. This part analyzes simulation results obtained by the proposed Enhanced Positioning Trilateration Algorithm (EPTA) in comparison with GA algorithm. Properties of the optimization algorithm (EPTA stage 1) will be tested in the first part of the simulations. Impact of the following parameters on the optimization algorithm positioning accuracy is investigated: (i) impact of the selection of three RNs by means of various settings, (ii) impact of the number of RNs in the network of reference nodes (sensors implemented in wearable jacket).
Finally, evaluation of EPTA algorithm is done. Impact of the following parameters on EPTA positioning accuracy is investigated: (i) impact of reference nodes distribution on the positioning accuracy, (ii) impact of the number of RNs in the network of reference nodes.
The goal of the first simulation experiment is to define dependency between mutual position of selected RNs and BN. Three different cases of RNs selection will be used for this reason: (1) three arbitrary RNs are selected from all RNs and they are used for the positioning; (2) final RNs combination is chosen by optimization algorithm; that is, RNs with the shortest mutual distance are chosen; (3) final RNs combination is also chosen by optimization algorithm, but the 4th condition is changed. RNs with the longest mutual distance are chosen. The reference nodes were distributed in grid in the observed area during this simulation.
According to the obtained results (see Figure 8), important facts can be seen. The most accurate results of all investigated settings were obtained in Case 2; that is, the proposed optimization algorithm with the shortest mutual distance between RNs was implemented. On the other hand, the biggest positioning error was achieved in Case 1, because any optimization algorithm was not implemented into positioning process and three arbitrary RNs were randomly selected. The proposed optimization algorithm was also implemented in Case 3, but RNs with the longest distance between these nodes were selected (modification of the 4th condition). The achieved results were also more accurate compared to random selection of three RNs. It is caused that RNs selected lie in vertexes of a triangle which is optimal situation for trilateration positioning. According to the results from Cases 2 and 3, it can be seen that further RNs to BN bring higher ranging error and final position estimation is less accurate. This confirms the assumption explained above (see Figure 3).
The amount of RNs played an important role on the positioning accuracy in all tested cases. If more RNs are in the range, the optimization algorithm can select from more combinations of RNs and more suitable distributed RNs are selected. It causes higher achieved accuracy by larger network of RNs. This phenomenon was found out in all cases. The most important fact of the results is that optimization algorithm improves the quality of the basic GA algorithm. On the other hand, the quality of positioning accuracy is still not sufficient for medical implant localization.
In the next experiment, performance of EPTA algorithm was investigated. EPTA was compared with optimized GA algorithm. Optimized GA algorithm is EPTA algorithm after first stage, and there is optimization algorithm for RNs selection implemented. Simulation parameters were the same as in previous simulation. The achieved results can be seen in Figure 9.
The simulation was done for various numbers of RNs in the observed. The amount of RNs plays a significant role for EPTA algorithm as well. It is clear that implemented AGA algorithm improves the positioning accuracy of GA optimized algorithm. The achieved positioning error is approximately 40 mm for EPTA (blue curve).
In the experiment, the impact of reference nodes distribution on the EPTA positioning accuracy is investigated. Distribution of RNs was implemented in two ways: in the grid and with random distribution in the observed area. The first way occurs when RNs are implemented, for example, as wearable jacket. The second way represents potential network of RNs with mobile nodes, for example, implemented in the human body. The achieved results can be seen in Figure 10.
The simulation was done again for various numbers of RNs in the area. In this experiment it is important to see that there is not a big difference between two forms of RNs distribution. The difference is only few millimeters. Generally, the distribution of RNs has an impact on positioning accuracy of other methods. Our results are caused by optimized selection of RNs. Therefore the exact deployment of RNs is not important from positioning accuracy point of view. It can be said that EPTA is independent of RN distribution.
In Figure 11, to get more insight on the statistical view of proposed algorithm with respect to the positioning error, we consider the following parameters: the number of RNs = 100, and RNs are distributed in grid. The corresponding curves represent the cumulative probability density function versus the RMSE error.
As it is shown by simulation results, our proposed EPTA algorithm performs better than GA algorithm optimized International Journal of Antennas and Propagation from RNs selection point of view. According to the achieved results, there is difference in positioning error especially with higher probability. EPTA algorithm cuts down extreme cases. Probability 50%, in case of EPTA, corresponds to 30 mm error but for GA optimized it is approximately 60 mm. The difference is significant. It confirms that second stage of EPTA (Adaptive Geometric Algorithm) increases the positioning accuracy.
Complex view on performance of EPTA is done in this simulation. The impact of BN position on positioning accuracy is investigated. We consider the number of RNs = 100 distributed in grid. Position of BN was generated with 5 mm step. In these points the position was estimated. The obtained results for 100 independent trials for each point are shown in Figure 12. Figure 12 depicts that BN position in the observed area has relative huge impact on positioning accuracy. The accuracy at the borders of the area is significantly lower compared to in the middle of the area. There are not so proper constellations of RNs on the accuracy at the borders. Ideal situations occur in the middle of the area, because the RNs are allocated from all sides. In fact, positioning accuracy is almost 90% higher to the border's parts. The recommendation of these results consists in that the network of RNs should be moved according to the expected position of BN.
Finally, we can say that proposed EPTA algorithm achieves sufficient positioning results for medical implant localization. It can be implemented into time based methods. In this case, higher accuracy is expected.

Conclusion
We proposed and verified properties of the new positioning algorithm based on trilateration. We called it Enhanced Positioning Trilateration Algorithm (EPTA). EPTA algorithm selects the three most suitable sensors from all sensors in the range for position estimation in the first stage. This is done by an optimization algorithm. The final position estimation is done by means of Adaptive Geometric Algorithm (AGA) from the sensors selected during the first stage. AGA increases accuracy compared to EPTA algorithm from the first stage.
The algorithm can be implemented in various wireless network platforms. There are also no limits from positioning process implementation point of view; that is, it can be implemented as mobile-based or network-based positioning solution. The algorithm can be implemented in all positioning methods designed for trilateration. The simulation results show the impact of several parameters such as the number of reference nodes, their position, and BN position on positioning accuracy. According to the simulation results, the performance of EPTA is better in comparison with original GA algorithm.
Medical implant positioning limits radio channel in human body. RF signal propagation and radio channel in human body are very hostile. Therefore, radio signal propagation is not easily predictable. Received signal strength as positioning data are influenced by this fact and it determines main limits of all positioning methods. Time based positioning data can be more suitable, but on the other hand this radio channel is not homogeneous from signal propagation velocity point of view.
Future works can lie in investigation of the proposed algorithm in 3D space. Then it can be used for real-time positioning of wireless implant. Some additional work could be made to emphasize the advantages and drawbacks of our algorithm, such as analysis of behavior of our algorithm in more realistic conditions.