## 2 DARP Overview  
The goal of this paper is the development of a fine-tuning configuration method for the DARP protocol [15]. Figure 1 shows this third layer protocol on top of the IEEE 802.15.4 standard (MAC and PHY layers). This section describes the main insights of this protocol. DARP has been specifically developed for Smart Cities, a large-size scenario type under low-/medium-density conditions, considering only the infrastructure for public services. DARP is based on a pair of algorithms, the Dynamical and Adaptive Routing Algorithm (DARAL), which carries out the routing metrics and the transport of the packets, and the Dynamical Role Selection Process (DRSP) one, which selects the cluster-head and forms the cluster itself. Before entering into a detailed description, it is necessary to define some general concepts about DARP and DARAL, like the sub-network concept and the different types of role. The sub-network concept comes from the clustering techniques and the idea of Smart Cities' organization. In Smart City approaches, nodes usually communicate in their neighborhood. Thus, if clustering is applied, traffic  
Figure 1: DARP Layer Structure. can be contained in a determined area, allowing the reduction of interference with other nodes and also minimizing the necessity for looking for a node among the complete network topology. In order to improve the clustering concept, the virtual sub-network concept extends this idea, applying it in routing tasks. Each virtual sub-network is identified with a virtual identification (vID), which is used to route messages among the network tree. Figure 2 shows a global Personal Area Network (PAN) with its own identifier, but internally sub-divided into three different sub-networks. The first one is where the network root is located, while the other two group different nodes. Another general concept about DARAL is the node role, considering that every node should be similar in terms of hardware. DARAL runs a dynamical role selection process (DRSP) at the start-up of every node, which allows it to select the role to be played by a node in the network. Figure 2 shows the two available roles in DARAL, end node (EN) and virtual coordinator (VC). ENs are nodes that only communicate with the VC of its sub-network. VCs have the same functionality that ENs, but also manage virtual sub-networks and store routing tables. Figure 3 shows the application of clustering through the use of parallel and independent virtual sub-networks, with their own network identification (vID). DARP uses the same standard-type of node (IEEE 802.15.4 FFD), creating roles and changing between them in a software-based method. The main role is the virtual coordinator (VC), which carries out the function of cluster-head, managing its own virtual sub-network and delivering inter-/intra-cluster packet sending. The other role is end node (EN), which executes non-cluster-head routines. Thus, it is a node type that only communicates with the VC in the same virtual network, in an intra-cluster communication type. This is a mechanism to reduce the energy used, via reducing the duty cycle. These roles are managed through a state machine, which relies on three different states as shown by Figure 4. DARP shows its better performance during the set-up phase, thus based on its design, it reduces the energy consumption, the convergence time and the number of control messages sent. The set-up phase is a very important stage that has not been deeply studied due to different factors, but it is indeed a very important phase because it is the moment when a node is characterized and adopts a role. Not only from a node perspective, it is important the set-up phase, but also from a cluster perspective, because the sub-networks are created and the nodes join the different sub-networks. Figure 2: Example of PAN network based on DARAL. In the DARP protocol, DRSP performs the action of creating the sub-networks.