# Dynamic-RPL: Enhancing RPL-Based IoT Networks with Effective Support of Dynamic Topology Management
## 5 Design
### Example Dynamic-RPL Scenarios
Figure 7 demonstrates how the dynamic multi-DODAG algorithm operates and shows the dynamic adjustments to the topology during adverse conditions of the network. It is assumed that LD1, LD2, LD3, LD5, and LD6 are performing well while the other local  
Figure 6: An example scenario of a multi-DODAG Dynamic-RPL network (before running the dynamic multi-DODAG algorithm). DODAGs are not. Therefore, S2 and S3 need to individually decide whether to merge with S1. As the algorithm concludes that no performance risks or scaling issues are expected with the _Merge_ decision, S3 merges with S1 into a single local-DODAG. However, the algorithm restrains S2 as it finds out that merging S2 and its global-child (S5) together would yield a better outcome. Once it is run using S5, the algorithm then decides to merge S5 with S2 to form a better aggregated-local-DODAG. It estimates that the load and stability performance would be higher compared to the case of the possible S2-S1 aggregation. In addition, the aggregated-local-DODAG can also be later considered for further aggregation with S1. Note that this would not be possible if S2 has already merged with S1. The S5-S2 global attachment would then be a local-sink-to-potential-sink attachment, which would stop the algorithm from performing the _Merge_ operation. Later, the decision is also made for N13 to merge with S2 to address the ongoing load and stability issues in LD7. In the case of LD4, the LSOF measures indicate an unstable local-DODAG and the need for dynamic topological adjustment. Since it has a global attachment with its local-sink, N8 performs the _Split_ operation and initiates a separate local-DODAG. As a result, the situation in LD4 is rectified and steady network performance is restored. This later drives the algorithm to decide for merging S4 with S2 as the network conditions become better. This topological adjustment is effectively made after confirming that LD2 would still not be oversized and the overall performance would be well maintained. Let us now consider that the adverse network conditions later fade out in LD7 as a result of the early dynamic topological adjustment. Then, the challenging network situation in LD8 makes the algorithm to decide for merging N16 with N15. Although they have an external potential-sink-to-potential-sink attachment, this movement is eligible since N16 is a global-leaf node. Once the aggregation is accomplished, S8 is now freed to perform the _Merge_ operation as it has no local-child maintaining external global attachment. After confirming that no potential performance risk exists, the decision is made to merge S8 with S6. After a while, a further _Merge_ operation is performed using S6 to merge with N8,  
Figure 7: An example scenario of a multi-DODAG Dynamic-RPL network (after running the dynamic multi-DODAG algorithm). which now acts as a local-sink. This is decided using the algorithm as both respective local-DODAGs perform very well and the aggregated-local-DODAG would not unacceptably scale up. Up to this stage, the algorithm has succeeded in addressing performance degradation in the struggling local-DODAGs and realizing better multi-DODAG topology. Only limited adjustments were made to rectify the situations in LD4, LD7, and LD8 and enhance the overall performance of the network. It can also be seen that the entire network topology was optimized with fewer local-DODAGs. Instead of having eight separate local-DODAGs, the network now contains only four that are performing well. Yet, the topology is flexible to address any future performance issue and make necessary topological changes. For example, S4 would perform the _Split_ operation and initiate its local-DODAG again if LD2 is experiencing degraded overall performance. This may also result in N8 deciding to merge back with S4 when the algorithm confirms no risk of an over-sized local-DODAG or unacceptable overall performance. Another example scenario is presented in Figure 8 with a single large-scale local-DODAG setup.