# A Node Placement Algorithm Utilizing Mobile Nodes in WSN and IoT Networks +
## 4 The Node Placement Algorithm
### Dynamic Node Placement (Locally-Significant Paths)
#### 4.1.3 Calculation of the Position That the Mobile Node Should Move to  
The algorithm checks whether there is a single node, which if it stops transmitting towards the defective node, the problem will be alleviated. If there is such a node, then the single point where the mobile node should move to is calculated (Algorithm 1, lines 8-10). Otherwise, if there is more than one node, then for each of these nodes, a specific point is calculated. The objective of this algorithm is to minimize the number of nodes that will transmit data through the mobile nodes, but their total sending rate should be equal to the amount of traffic that the defective node is not able to forward (Algorithm 1, lines 11-15). Furthermore, the mobile nodes should be placed in a position where at least an upper non-defective node should exist in their transmission range to forward the data they receive to the sink (Algorithm 1, lines 17-19). **Finding the position where mobile nodes should move in order to serve one node. ** The calculation of this specific point is performed as follows: Initially, the intersection points between the circle that are created by the radius of the transmitting range of the defective node and the straight line that connects the sink with this node are calculated (function _intersectionPofL&C_). Between these two points, the point that is closer to the destination node in comparison to the point that is closer to the mobile node is chosen. This is illustrated in Figure 2a. Let us consider \((X_{k},Y_{k})\) as the coordinates of the node that is going to be served by the mobile node and \((X_{sink},Y_{sink})\) the coordinates of the sink. In the case that the coordinate  
Figure 2: Node Placement Positions [8]. (**a**) Single Node, (**b**) Multiple Node, (**c**) Direct Path. of this node or \(Y\) respectively, is the same as of sink's, i.e., if \(X_{k}=X_{sink}\), then the intersection point will be \((X_{k},Y_{k}+node^{\prime}s\ Tx\ range)\) if \(Y_{k}<Y_{sink}\) and \((X_{k},Y_{k}-node^{\prime}s\ Tx\ range)\) if \(Y_{k}<Y_{sink}\). If \(Y_{k}=Y_{sink}\), then the intersection point will be \((X_{k}-node^{\prime}s\ Tx\ range,Y_{k})\) if \(X_{k}>X_{sink}\) and \((X_{k}+node^{\prime}s\ Tx\ range,Y_{k})\) if \(X_{k}<X_{sink}\). For each node that has a sending rate greater than the _Additional Resources_ rate, the position of the mobile node is calculated and the algorithm checks whether there is a node closer to the sink that is not defective so as to transmit the data that it receives. **Finding the position where mobile nodes should move in order to serve more than one node. ** If there is not an available relocation position for the mobile node suitable to serve just one node, then for a number of nodes equal to \(n\) (Algorithm 1, lines 26-81), where \(n\) is a number between 2 and 6 according to [20,21], the following procedure is followed:  
Initially, the algorithm described in [22] is employed. This algorithm identifies the subset of the nodes that transmit their data to the defective node. Only the subsets that have a total sending rate greater than the _Additional Resources_ rate of the defective node are used for calculations (Algorithm 1, lines 30-47 and 48-81). For each of these subsets, the algorithm finds the common point in the transmission range of the nodes, which is closer to the sink. To achieve this, the algorithm considers, for each pair of these nodes, the cross-section of their transmitting ranges. Then, it checks whether this cross-section point is within the transmitting range of the rest of the nodes, besides the pair under reference (Algorithm 1, lines 48-65). If for a subset of nodes, more than one appropriate point is calculated, then the point that is closer to the sink is chosen (Algorithm 1, lines 66-81). This is illustrated in Figure 2b. The procedure halts when at least a common subset of nodes \(n\) is found, for \(n\in[2,6]\).