# UAV Path Optimization for Precision Agriculture Wireless Sensor Networks
## 3 Proposed Strategy
### UAV Flight Strategy  
Figure 10 shows the UAV flying over the SNs following its optimized DDNN route, BS \(\rightarrow\) SN2 \(\rightarrow\) SN4 \(\rightarrow\) SN1 \(\rightarrow\) SN3. After that it returns to SN2, starting again the discovery cycle until all SNs are properly reconfigured to their new timeslot. The UAV reaches its first target SN2 during TS1, and SN2 was not found in active mode in this timeslot. Therefore, SN2 is added to the Prohibition List for TS1. Thus, in the next round during TS1, the UAV will fly over this SN. The UAV also passes through SN4 during TS2, and adds it to its Prohibition List for that timeslot. The UAV follows its route to SN1 where it arrives at TS4, and also adds to its prohibition list. Finally, it arrives at SN3 still in TS4, does not find it in active mode, and also adds it to the list. Once the route is over, the UAV restarts its route and calculates the arrival TS for SN2. By checking its database list, it discovers that the SN is prohibited for TS1. Therefore, the UAV takes a decision and heads to its next destination, thus avoiding passing over an inactive SN at that TS. As the UAV acquires knowledge about the scenario, it starts managing its own route based on these list, making more efficient decisions in relation to which SN it should proceed next. Figure 10: Graphical representation of the UAV search strategy. Figure 9: Example of the Prohibition List managed by the UAV during the reconfiguration phase. Moreover, the UAV has the ability to calculate the arrival TS until the next SN, validating this information with its Prohibition List. Thus, it checks whether or not the next SN is classified as restricted for the calculated TS. If the destination is prohibited, the UAV continuously performs this calculation until there is an SN available for the TS. If there is no SN available, the UAV waits on its current position until next TS, performing the calculation for each pending SN in its list. The flowchart shown in Figure 11a represents the UAV strategy during the SN reconfiguration phase. Figure 11b represents the UAV strategy after the completion of the SN reconfiguration stage, where the UAV follows its route visiting only SNs in active state. In Figure 11a, steps 2, 15, and 16 represent the UAV decision points. For the dedicated TS method, there is no way that two or more SNs are active during the same TS. Thus, since the UAV locates an SN over TS2, for example, there is no longer a need to fly over searching for other SNs during that timeslot on future rounds. Therefore, the UAV waits on its current position until the next free timeslot (step 16). For scenarios with shared TSs between SNs, there is the possibility of having two or more devices active during the same TS. Thus, the UAV continues flying its route during that timeslot in which the UAV has already found one or more active SNs. Then, the UAV targets the next SN from its route (step 3) and calculates the arrival TS (step 4). The UAV checks its Prohibition List for the calculated TS, if the SN is restricted or allowed for that TS (step 5). If there is no restriction, the UAV checks its energy autonomy (step 6) and, if there is enough battery charge, it moves to its new target (step 7). Upon arriving at the SN NearestPoint/DDNN coordinates, the UAV checks if it is in hibernation mode or not (step 8). If the SN is inactive, the UAV adds the SN to its Prohibition List for current TS (steps 9 and 10), and resumes its route to the next SN (step 2). If the UAV finds the SN in active mode (step 8), then it collects the sensory data from the SN, and reconfigure it to the calculated TS according to its route (step 11). The UAV then updates its Prohibition List (steps 12 and 13) and checks if there are any pending SNs (step 14). If so, the UAV resumes its initial SN search state (step 2). Otherwise, the UAV finishes the SN reconfiguration phase (step 23) and proceeds to scheduled flight according to each SN state (step 24).