# Fault-Tolerant Topology of Agricultural Wireless Sensor Networks Based on a Double Price Function
## 4 Hybrid WSN Topology
### Two-Connected Fault-Tolerant Topology between Clusters  
In agricultural WSN, affected by changeable climate and obstacles such as crops and soil, the communication link is easily disconnected. When a sensor node fails or a communication link is disconnected, it may lead to network partition and affect the mutual communication between nodes. There is an urgent need to establish a fault-tolerant network and ensure a reliable connection between nodes. In addition, there may be redundant links in the initial network topology, resulting in high energy consumption. As shown in Figure 2, we further optimized the inter-cluster topology based on the initial topology and cut vertex theory to ensure the reliable transmission of important data and reduce network energy consumption. Firstly, the adjacency table of 2-hop local topology of CH \(I\) is constructed as \(A\). If the number of nodes connected to node \(i\) is greater than 2, two neighbor nodes are selected based on the residual energy and the distance to construct the 2-hop local topology of node \(i\). \[weight=\eta\frac{Er_{j}}{E^{\max}}+v\frac{d_{j}}{d^{\max}} \tag{16}\]  
where, \(\eta\) and \(v\) represents the weight factor. Node \(j\) is the adjacent node of node \(i\). \(d_{i}\) is the distance between node \(j\) itself and sink node, and \(d^{\max}\) is the minimum distance from the network node to sink. The nodes farther away from sink should have greater residual energy, which is conducive to the stability of the topology. So, in this paper, let \(\eta\) = 0.5, \(v\) = 0.5. Then, cut vertex in the topology are detected. The specific step of inter-cluster topology optimization algorithm is as follows (Algorithm 2):
```
Input: Initial inter-cluster topology Output: Optimized inter-cluster topology
```
1. for loop = 1: \(N\)
2. if node loop is the CH
3. while the number of inter-cluster neighbor nodes of node \(loop\) is less than 2 and \(p_{loop}<p_{max}\)
4. Adjust node \(loop\) transmit power and update the topology
5. end
6. end
7. end
8. for loop = 1 to \(N\)
9. Initialize flag\({}_{\text{loop}}\)= 0
10. if node \(loop\) is the CH
11. while flag\({}_{\text{loop}}\) = 0 and \(p_{loop}<p_{max}\)
12. According to Equation (16), select an inter-cluster neighbor of the node \(loop\) as the root node \(r\)
13. The set of nodes other than loop in the 2-hop topology of node loop is \(A\)  
Figure 2: Construction method of 2-connected inter-cluster network. 14. The reachable nodes of the root node \(r\) are added to the Breadth First Search (BFS) tree set \(R\)
15. Starting from the root node \(r\), each of \(r\)'s unvisited neighbors is accessed, and then starting from the neighbor nodes, each of their unvisited neighbors is visited in turn
16. Repeat the above steps until all nodes in the block where \(R\) is located are accessed, and finally get the BFS tree set \(R\)
17. if \(A=R\)
18. The transmit power is adjusted according to the farthest neighbor node in 2-hop topology and \(flag_{loop}=1\)
19. else
20. Select a higher transmit power
21. end
22. end
23. end
24. end
```

**Algorithm 1** BFS tree search

## 5 Experimental Results and Analysis

It is assumed that the sink node is located in the center of the monitoring area, and the nodes are randomly distributed with fixed positions. As mentioned in the Introduction, the agricultural environment is highly variable and requires densely deployed sensors for environment sensing. Therefore, in this paper, the size of the monitoring area was set to 100 \(\times\) 100 m\({}^{2}\), and the number of nodes was between 50 and 150, so as to simulate a monitoring scenario with dense sensor deployment. Assuming that under the influence of field crops (path loss \(r=3.5\)), the studied topology control method is used for soil moisture sensor, temperature, and humidity sensors to monitor field soil and climate. Each node has the same initial energy \(E_{\max}\) and the same maximum transmit power \(p_{\max}\).