# Connection-Aware Digital Twin for Mobile Adhoc Networks in the 5G Era
## 3 Connection-Aware DT for 5G-MANETs
### Connection-Aware Synchronization of the DT  
The dynamic nature of the nodes in MANETs leads to a potential scenario where some nodes lack 5G access. This context prevents the transmission of the latest updated local report entries, resulting in a decoherence that affects the accuracy and fidelity of the DT. Since variable coverage is assumed to be an inherent challenge of 5G-MANETs, it is important to address these contexts to minimize their impact on the digital representation. To this end, the proposal includes a connection-aware strategy to opportunistically synchronize the information. As Figure 3 illustrates, two main potential topologies can be found: full online and partially online. A full-online topology defines the ideal case: all nodes in the 5G-MANET are connected to the Internet, providing the DT with new events in real time. In this case, it is not necessary to apply routing mechanisms to avoid disconnections, as nodes can individually provide their data. In the case of a partially-online topology, the accuracy of the DT may be affected because some nodes in the MANET are unable to transmit their local events to the centralized MQTT interface. As a result, some nodes in the network remain connected to 5G, while others face disconnections. For these situations, a distance-based routing strategy is proposed, using online nodes as gateways for the local reports from offline devices, aiming to transmit the information to the nearest online node. This process is carried out in two phases: recognition of the optimal path and the transmission of the local records to the connected node. \begin{table}
\begin{tabular}{p{142.3 pt} p{284.5 pt}} \hline
**Variable Name** & **Description** \\ \hline Topology & The topology can be adapted by modifying the number of nodes involved and adding or reducing the number of integrated devices. Connections between nodes can also be configured by specifying particular mobility models. \\ \hline Applied routing algorithm & The routing strategy applied by nodes can be modified to analyze its performance. \\ \hline
5G connection availability & To analyze the capability of the network under challenging conditions, it is possible to configure the 5G availability in the nodes, enabling the application of connection-aware routing strategies. \\ \hline Contextual variables & Additional variables such as battery level, storage availability, or the local interface range can be configured. \\ \hline \end{tabular}
\end{table} 
Table 2: Customized variables to configure scenarios in the DT. * Recognition of the optimal path. Algorithm 1 proposes a routing strategy to transmit network data from offline nodes to connected devices, based on proximity. Figure 4 illustrates a potential scenario for this approach: four nodes (Gateway and Offline Nodes 1, 2, and 3) are distributed in a context, forming a local topology. In this case, only one of the devices has a 5G connection, while the others are not connected to the Internet. To address this situation, the Gateway node communicates with connected devices to notify them of its online status (step 1). The message includes the distance to the destination, which is zero in this case. As nearby devices receive the notification, they broadcast the message to their connections, incrementing the distance by one unit (step 2). As a result, second-level nodes receive the message, identifying the connection with the shortest distance as optimal. Hence, when Offline Nodes 2 and 3 receive their mutual distances (a distance of 3), their connection with Offline Node 1 is identified as optimal (a distance of 2). Using this strategy, it is possible to define an optimal path to communicate the reports generated by offline nodes to connected devices. Figure 4: Connection-aware strategy for partially-offline topology. Figure 3: Topologies of MANETs and the applied strategy according to the presence of online nodes in the network. * Transmission of the local records.