# Self-Configuring IoT Service QoS Guarantee Using QBAIoT
## 3 QoS Guarantee within Internet of Things Environment
### Self-Configuring QBAIoT  
The existence of traffic on the network influences the chosen values for BO, SO and the slots configurations of the QoS CAPs as mentioned in Section 3.4. The characteristics of the underlying IoT environment in terms of traffics types' existence have an impact on the configurations of the different QoS CAPs. We specify in Table 1 different scenarios of traffic existence along with the corresponding slots configuration and BO/SO values. Table 1 represents a part of the knowledge base of our self-configuring QBAIoT method (see Figure 12). In this context, we consider that QoS CAP1 is allocated to the QoS class with the highest priority in the IoT infrastructure, whereas QoS CAP4 is allocated to the QoS class with the lowest priority if there are four QoS classes in the considered IoT environment. real-time class (RTC) includes the traffic of RTMC and RTNMC classes, whereas non-real-time class (NRTC) includes the traffic of streaming and NRT classes. The priority of the different available IoT traffics in descendant order is as follows: RTMC, RTNMC, Streaming, NRT. For example, let us consider the existence of two traffics belonging to two QoS classes: 1 RTC and 1 NRTC. According to Table 1, QoS CAP1 is allocated 12 slots and corresponds to the highest priority (i.e., RTC traffic) and QoS CAP2 is allocated four slots and corresponds to the NRTC traffic. Based on the different gSLAs stored on the HL-Gw, the number of QoS classes within a LL-Gw can be deducted. Therefore, the corresponding slots configuration of the Superframe is retrieved by the HL-Gw thanks to the knowledge base of QBAIoT that considers different available scenarios. The different available configurations in the knowledge base are the initial configurations to be set on the LL-Gw. These initial configurations could be adapted according to QoS CAPs usage by IoT objects \begin{table}
\begin{tabular}{c c c c c c c} \hline
**Traffic Existence** & **BO/SO** & **Slot Duration** & **QoS CAP1** & **QoS CAP2** & **QoS CAP3** & **QoS CAP4** \\ \hline
1 RTC or 1 NRTC & 14 & 15.72 s & 16 & N/A & N/A & N/A \\
2 NRTC & 3 & 7.68 ms & 13 & 3 & N/A & N/A \\
2 RTC & 2 & 3.84 ms & 9 & 7 & N/A & N/A \\
1 RTC and 1 NRTC & 2 & 3.84 ms & 12 & 4 & N/A & N/A \\
1 RTC and 2 NRTC & 2 & 3.84 ms & 8 & 5 & 3 & N/A \\
2 RTC and 1 NRTC & 2 & 3.84 ms & 7 & 6 & 3 & N/A \\
2 RTC and 2 NRTC & 2 & 3.84 ms & 6 & 5 & 3 & 2 \\ \hline \end{tabular}
\end{table} 
Table 1: Available configurations in the knowledge base. Figure 11: Algorithm schema of the adapted CSMA/CA process for QBAIoT nodes. through a self-optimizing function. If the slots allocated to a specific QoS class are not used efficiently, the self-optimizing function allows reallocating unused slots to another QoS CAP in need of slots while serving the higher priority classes first. In case of changes occurrence concerning the existence of QoS classes (iSLAs removal or addition), an update of BO and SO values as well as slots configuration should be performed. The updated values of BO, SO, and slots configuration are communicated to the LL-Gw that sends an updated beacon at the BI to all IoT nodes. Considering the IoT environment changes in an autonomic manner through the detection of iSLAs evolution on the HL-Gw in order to adapt the beacon configurations corresponds to the QBAIoT self-configuring capability. QBAIoT self-configuring process (i.e., MAPE-K control loop) is implemented on the HL-Gw and the LL-Gw of our proposed IoT architecture (see Figure 12). The HL-Gw corresponds to the AM (autonomic manager) that enables four functionalities (i.e., monitor, analyze, plan, and execute) along with the knowledge base. The LL-Gw contains an effector interface that receives the configurations sent by the HL-Gw in order to update beacon's information. The LL-Gw sensor interface is not used for the self-configuring capability but for a self-optimizing capability enabling slots usage optimization.