# A High-Robust Sensor Activity Control Algorithm for Wireless Sensor Networks
## 4 Methods  
### Adjustment Procedure for the Weight Value of Sensors  
As previously mentioned, a sensor with a higher weight value, \(W_{i}\), will have a higher probability of maintaining the active state. Therefore, SACA uses the relationship between the total number of active sensors and the target value to adjust the weight of sensor \(W_{i}\). For the active sensors, the difference value \(d\) is used to determine whether the weight value \(W_{i}\) should be increased or decreased (reward or punishment), where \(d\) is the difference  
Figure 5: SACA operation flowchart, which includes the adjustment procedure for the weight value of sensors and transform procedure of the state of sensors.  
between the target value and the total number of active sensors. The total number of active sensors is counted using the base station, which records the difference value in the feedback packet and sends it to the sensor according to the relationship between the total number of packets currently counted and the target value.  
Only the active sensors receive feedback packets from the base station in the SACA. When the sensor is in the active state, the following three situations need to be considered:  
1. When \(d>0\), there are too many sensors in the active state. Because the sensor node is currently in an active state, the sensor should change to a sleep state in the next round.
2. At \(d<0\), the total number of active sensors is currently insufficient. If the sensor is currently in an active state, it should be maintained in an active state in the next round.
3. When \(d=0\), the total number of active sensors reaches the target value. Therefore, the state of the sensor does not need to be changed. These situations are shown in Figure 6.  
For the sensor in the sleep state, the weight value \(W_{i}\) automatically increases every round. The main reason for this is that the sensor in the sleep state can replace the active sensors such that the active sensors can rest. The power loss between the sensors is then averaged. The smaller the weight value \(W_{i}\), the higher the probability of the sensor remaining in the sleep state or transitioning from the active state to the sleep state. Therefore, increasing the weight of the sensor increases the probability that the sensor is in an active state. The weight value \(W_{i}\) is updated as shown in (2). The activation parameter of the weight value \(W_{i}\) is \(\sigma\), which affects the convergence time of the system. If the activation parameter is small, the weight value of the sensor needs more time to adjust, and the sensor needs to spend more time before it can be converted into an active state. In contrast, if the activation parameter is large, the probability of the sensor turning to the active state increases. The sensor in the sleep state can usually be used to supplement other sensors in the active state, for example, when a sensor in the active state is damaged or dead. Therefore, in a network environment with a high death ratio, setting the activation parameter is very important. In SACA, we set the activation parameter to 0.0001.