## 3 Methodology
### Tests Description  
The goal of our tests is to show that the proposed behavior-based algorithm: (i) provides good adaptation to the environment; and (ii) provides good performance according to the quality parameters proposed in Section 3.1. Since the proposed algorithm is fit for geographic and hierarchical routing, a secondary goal is to compare the resulting MSWN for both routing strategies in terms of coverage and network life for deployment and self-healing. Hence, in this work, we run four kinds of tests:  
Figure 5: Node hardware structure. Figure 6: Power consumption vs. distance for CC2500 per packed transmitted. * Geographic routing without obstacles
* Geographic routing with obstacles
* Hierarchical routing without obstacles
* Hierarchical routing with obstacles  
In all of the tests, we follow the same procedure:  
1. Let nodes move until balance, i.e., nodes stop moving (see Section 2). 2. Obtain all relevant quality parameters (see Section 3.1). 3. Determine which nodes would fail first (depending on routed traffic), and move time forwards in the simulation until the most loaded nodes run out of battery (typically, nodes do not fail continuously, but in small groups, depending on how many packets they were routing/rerouting). At this point, forces are not balanced anymore, and remaining living nodes start to move again. 4. Go back to Step 1 until the number of living nodes is lower than 70% of the original number of nodes. In order to determine in which time instant a given node dies under simulation, its power consumption (current drained from the battery) during network operation has to be estimated. This consumption does not depend only on the transceiver features specified in the datasheet, it is also highly influenced by the medium access control (MAC) strategy, which determines how much time the transceiver spends in each possible state (transmission, reception or sleep) during its operation. In battery-powered wireless sensor networks, a duty-cycling MAC strategy is typically used to allow the transceiver to remain in a low power state most of the time [45]. Our simulation model considers such a strategy. There are two main sources of power consumption: (i) a constant background consumption due to the duty-cycling operation, which is equal for every node in the network; and (ii) the consumption caused by packet transmissions, which depends on how many packets each node is transmitting and how much power is required per packet. If MAC parameters are properly tuned, current drained during duty-cycling operation can be as low as 1% of the current drained when in the receiving state [46]. On the other hand, duty-cycling strategies require each packet to be repeatedly transmitted over a period of time. Hence, transmission becomes more costly and the main source of consumption. Current drained from the battery when transmitting depends on transmission power, which in turn determines transmission range (Figure 6). In geographic routing scenarios, we configure all nodes to transmit their packets at \(-\)12 dBm to cover a prefixed range (25 m radius). In hierarchical networks, L0 nodes transmit to L1 nodes, and L1 nodes retransmit to the sink node. In this scenario, we consider that the transmission range is adapted depending on the relative distances among the source and destination nodes, to guarantee that the signal received by the destination is above its sensitivity level. Thus, the current drained from the battery is estimated following the linear regression depicted in Figure 6. In our simulations, we assume an ideal battery with a capacity of 3000 mA\(\cdot\)h and a wake-up frequency of 20 Hz for the duty-cycling protocol. To compute the amount of packets routed by each node, we consider a simple data-gathering traffic model, where each node sends a packet to the sink node approximately every 10 s once the network is deployed. We have added a simplified motor consumption model to the transmission one for our simulations.