## 4 Partition Aware-RPL Protocol Overview
### Parent Selection Algorithm
Similarly, for temperature, the local processing algorithm has to compute and identify the minimum and maximum values then transfer them to the decision algorithm. Figure 5:4 Gain as a function of sending period. In this Algorithm 2, once a node receives a message, it checks its own status, i.e., either a Parcel Head (PH) or a Normal Node (ND). In the former case, the node applies all its local processing routines (i.e., computing and aggregation) whenever the received message is created by a node belonging to the same parcel (i.e., of the same color as the PH). However, in the latter, the node simply forwards the information to its preferred parent. In the case of PA-RPL, the created DODAG ensures that all the data will be gathered in the PH where it will be processed. Only the aggregated/processed information will be then transmitted to the sink, hence highly limiting the exploited bandwidth and energy. Recall that in standard RPL's DODAG, it is clearly not possible to apply such processing. ```
1:*This is a receive Message Callback in aggregation scenario*
2:\(\mathit{Payload}\leftarrow\mathit{getPayload}(\mathit{Msg})\)
3:if\((\mathit{isParcelHead}())\)and\((\mathit{Msg->getColor}()==myColor())\)then // This is a Parcel Head
4:\(humidity\gets getHumidity(\mathit{Payload})\)
5:\(temperature\leftarrow\mathit{getTemperature}(\mathit{Payload})\)
6:\(\mathit{UpdateMaxHumidity}(humidity)\)
7:\(\mathit{UpdateMaxTemperature}(temperature)\)
8:\(\mathit{UpdateMinTemperature}(temperature)\)
9:else
10:\(\mathit{Preferred1 pAddress}\leftarrow\mathit{getPreferred1 pAddress}()\)
11:\(\mathit{SendMsgTo(PreferredIpAddress,Payload)}\)
12:endif
```

**Algorithm 2** RcvMsgCallback(\(\mathit{Msg}\))

#### 6.3.2 PA-RPL Performance in Potato Pest Prevention Application

In the present subsection, we evaluate the performance of the proposed PA-RPL in terms of energy consumption in the context of local (parcel level) lossy in-network aggregation. To better assess the gain in efficiency that PA-RPL can bring, we simulate various scenarios where PA-RPL is applied against similar scenarios using the original RPL. For that, we consider the farmland described in Figure 8i, and assume that the potato crop is planted in parcel number \(VI\). The local processing described above, for humidity and temperature, will be executed in the Parcel Head (PH) node. In order to efficiently gather this data in PH, we implement and deploy an application level forwarding algorithm in all nodes of the parcel. In this evaluation, we are mainly interested in the gain in terms of energy consumption for different collecting/reporting periods. In Figure 15, we show that PA-RPL consumes less energy in all scenarios, compared to RPL. We also show that the gain in energy consumption rises up to 40% in high frequency scenarios, if aggregation is applied. An other interesting finding is that PA-RPL is less sensitive to the increase of the data sending period (i.e., high frequency monitoring scenarios) compared to RPL. This means a better flexibility and usability to meet different types of applications, configurations and scenarios. ## 7 Discussion

One of the main goals of our proposed routing algorithm, PA-RPL, is to enable a more efficient parcel/partition level in-network aggregation. This is achieved by mapping the created DODAG, to the sub-divisions or parcels of the farmland. In addition to the above mentioned performance results, it is important to know the other set of benefits that would be gained from this partition aware routing algorithm. In this section we expose rooms of optimization enabled by PA-RPL. Let us begin by exploring an instructive example of the different data streams in the smart farm network. For instance, in the same farm, three types of data-streams may simultaneously exist: (i) _MP2P_ data-streams collected from sensor nodes deployed into greenhouses, stables, parcels, etc.