# Enhancing Tactile Internet Reliability: AI-Driven Resilience in NG-EPON Networks
## 4 Proposed Architecture
### Resilience Dynamic Bandwidth Allocation  
The Resilience Dynamic Bandwidth Allocation (RDBA) uses an offline scheduler approach, where the OLT waits for report messages from all ONUs before performing dynamic bandwidth allocation (DBA). In this way, the OLT will have a holistic view of all ONU demands, ensuring fairness [36]. In the normal condition where no fault is detected, the OLT will assign the bandwidth allocation to ONUs based on the following Formula (1):  
\[B_{available}=\frac{R_{N}(T_{max}-N\cdot G)}{N.512} \tag{1}\]  
where \(R_{N}\) is the EPON line rate (in bits per second), \(T_{max}\) is maximum cycle time (in milliseconds), \(N\) is the total number of ONUs, \(G\) is the guard time, and 512 bits is the control message length. The minimum guaranteed bandwidth (\(B_{min}\)) of the ONU is calculated with the following Formula (2):  
\[B_{min}=\frac{W_{max}\cdot W_{report}}{T_{max}}, \tag{2}\]  
where \(W_{max}\) is the maximum timeslot of an ONU, \(W_{report}\) is the reserved window size of the report message (in bits). We limit each ONU timeslot to prevent upstream channel monopolization by heavily loaded ONUs. However, the \(W_{max}\) can also be set according to the SLA.  
When the proposed ML identifies faults or anomalies in the ODN by analyzing data from OTDR traces and the BER analyzer, the NEM will inform the OLT using the SDN controller to switch from normal DBA to RDBA. Once the RDBA is activated, the OLT dynamically adjusts the bandwidth allocation to prioritize the backup ONU, ensuring it can handle the data from both its traffic and the affected ONU (i.e., the faulty ONU). The backup ONU receives additional bandwidth, scaled based on predefined factors, to maintain service continuity for both ONUs. This process ensures minimal service disruption even during fault conditions, as the RFoG link facilitates the rerouting of traffic from the affected ONU to the backup ONU.  
Figure 9 shows the pseudocode of the proposed RDBA. In the normal condition, the OLT calculates the available bandwidth (\(B_{available}\)) and the guaranteed bandwidth (\(B_{min}\)) in each cycle. Under normal conditions in each cycle, the ONU gets the guaranteed bandwidth. If the guaranteed bandwidth (\(B_{min}\)) is greater than the reported bandwidth from the queue, the granted bandwidth (\(GRANT\_ONUli\)) is set to the queue's requested bandwidth. Otherwise, the granted bandwidth is set to the remaining \(B_{min}\). The remaining \(B_{min}\) is then updated by subtracting the granted bandwidth. In the restoration plan, when a fault occurs, the OLT will adjust for the backup ONU. If the current ONU is a backup ONU, the OLT sets the protection VLAN tag for the affected ONU. The \(B_{min}\) is then calculated for the backup ONU, but it will be multiplied by alpha (\(\alpha\)). Here, \(\alpha\) represents the additional bandwidth allocated to the backup ONU to ensure it can handle the increased traffic, as the affected ONU now routes all data through the backup ONU via RFoG. If the current ONU is not a backup ONU, the normal condition function is applied. Moreover, to verify that  
the total requested bandwidth from ONUs does not exceed \(B_{available}\) due to the addition of variable \(\alpha\), the total_requested_bandwidth is calculated as follows (3):  
\[\sum_{i\inactiveONU}GRANT\_ONU_{i}+\sum_{i\in backupONU}GRANT\_ONU_{i}. \tag{3}\]