# Multi-Agent Modeling and Jamming-Aware Routing Protocols for Movable-Jammer-Affected WSNs
## 3 Methodology
### Simulation Process  
Our simulation process consists of the following nine steps (see Figure 4):  
The first step is to deploy a WSN within a specified area. We randomly place a certain number of sensor nodes in a square scene and deploy a base station at the center of the scene. The second step is to initialize the network depth and jamming. The depth broadcast is initiated by the base station with a depth value of 0, and the sensor nodes receive the broadcast information and relay it. Finally, the initial value of the depth of all sensor nodes is assigned, and the initial default jamming value of all sensor nodes is set to 1. The third step is to calculate the target value and broadcast it locally. All sensor nodes calculate their own target value based on their depth and jamming value and then initiate a local broadcast to inform other sensor nodes within their surrounding communication range about their target value. The target value of the base station is set to 100, ensuring that any sensor node that can directly communicate with the base station will connect with the base station without selecting other sensor nodes as relays. The fourth step is to initialize the network. All sensor nodes select the node with the largest target value within their communication range as their successor node, enabling all sensor nodes to connect with the base station and complete the ad hoc network. Figure 4: Simulation process. In the fifth step, the jammer enters the area, and the sensor nodes update the target value. One or more jammers are deployed randomly in the scene, and they affect the jamming values of sensor nodes within a certain range. The affected sensor nodes recalculate their target value and initiate a local broadcast to inform the surrounding nodes that their target value has been updated, indicating that they are affected by jamming. The sixth step is local maintenance. After receiving the target value update message sent by other sensor nodes, the sensor node reselects the node with the largest target value as their successor node within their surrounding communication range to avoid the jamming affected area. The seventh step involves the jammer moving to a new location and affecting sensor nodes within the surrounding range, updating their jamming values. These interfered nodes also need to update their own target values and broadcast them locally. Local maintenance follows closely. The seventh step is similar to the iterative cycle of steps five and six. The eighth step is global maintenance. After running for a period of time, the structure of the WSN may have changed significantly due to jammers and local maintenance. The communication path between the remote sensor node and the base station may no longer be the shortest path, resulting in an increased delay in information transmission. To reduce the average path length from each sensor node to the base station, the base station periodically initiates the depth broadcast. The sensor node receives the depth broadcast information, relays it, updates its own depth value and the target value, and sends the information to the surrounding sensor nodes within the communication range broadcast. All sensor nodes that receive the depth broadcast information must reselect the node with the largest target value from the surrounding nodes as their successor node. Note, that at this point, the communication function of the sensor node deeply affected by the jammers is invalid, so it will not update its own depth information or initiate a local broadcast of the target value. The ninth step involves recording the simulation results; the first to the fourth step. After the initialization phase (from the first step to the fourth step), the WSN starts to run and undergoes jammer entry/movement and local maintenance during each time slice, which is followed by updating the current network metrics and recording the results. Additionally, after every fixed period, global maintenance is performed along with jammer entry/movement and local maintenance.