# Cluster-Based Transmission Diversity Optimization in Ultra Reliable Low Latency Communication
## 3 System Architecture
### Packet Transmission Structure
```
1:Input: N \(\leftarrow\) Number of subcarrier channels \(T_{g}\) \(\leftarrow\) Total number of general sensor \(\text{Dup}\) \(\leftarrow\) Packet duplication \(C_{n}\) \(\leftarrow\) Number of cluster \(\triangleright\) Using K-means clustering \(S_{x}\) \(\leftarrow\) Number of Sensor in each cluster
```  
**Output:**  
\(Min_{channel}\)\(\leftarrow\)Number of minimum channel to Satisfy the reliability 99.999%  
```
1:Reliability \(\gets\) 0
2:Avg_Reliability \(\leftarrow\) 99.99899%
3:\(f_{c}\)\(\leftarrow\) Frequency channel
4:a[] \(\leftarrow\) starting position of a cluster frequency bandwidth
5:b[] \(\leftarrow\) ending position of a cluster frequency bandwidth
6:\(T_{packet}\)\(\leftarrow\) Number of total transmitted packet
7:\(R_{packet}\)\(\leftarrow\) Number of total received packet
8: increment \(\leftarrow\) Increasing the number
9:while Reliability \(<\) Avg_Reliability do
10: N \(\leftarrow\) N+increment
11:\(T_{packet}\)\(\leftarrow\) Dup \(\times\)\(T_{g}\)
12:for i \(\gets\) 1 to \(C_{n}\)do
13: b[i] \(\leftarrow\) b[i-1] + (N/\(T_{g}\)) \(\times\)\(S_{x}\)
14: a[i] \(\leftarrow\) b[i-1] +1
15:for j \(\gets\) 1 to \(S_{x}\)do
16:\(f_{c}\)\(\leftarrow\) random(\(f_{a[i]}\), \(f_{b[i]}\)) \(\triangleright\) Randomly select subcarrier within selected cluster frequency bandwidth
17:endfor
18:for k \(\leftarrow\)\(f_{a[i]}\) to \(f_{b[i]}\)do
19:\(R_{packet}\)\(\leftarrow\) Count number of successful transmitted packet
20:\(\triangleright\) Using Collision Detection Algorithm from [11]
21:endfor
22:endfor
23: Reliability \(\leftarrow\) (\(R_{packet}\) / \(T_{packet}\)) \(\times\) 100
24:endwhile
25:\(Min_{channel}\)\(\leftarrow\) N
```  
**Algorithm 1** Minimum subcarrier channel detection algorithm for The C-OFSMA brings more efficiency than OFSMA. However, there is one caution to mention: as the number of clusters increases, the outcome may differ. Therefore, a precise cluster deployment is calculated in Algorithm 2 to achieve the highest reliability. From BPSK modulation, we know:  
Figure 4: Collision scenario of proposed C-OFSMA. Figure 5: Collision analysis. \[Total\ Packet=\frac{successfully\ transmitted\ packet}{total\ transmitted\ packet}+Collided\ packet \tag{11}\]  
\[Reliability=\frac{successfully\ transmitted\ packet}{total\ transmitted\ packet} \tag{12}\]  
\[Reliability=Total\ packet-Collided\ packet \tag{13}\]  
For higher sensors, awake from \(Z_{x}\) cluster using different \(f_{set}\) with the use of different clusters, the transmission is exponentially increased. \[Total\ Packet=\left(\frac{T_{g}}{T_{g}-f_{set}}\right)^{e^{(2Z-Z^{2})}} \tag{14}\]  
Here, \(T_{g}\) is the total number of general sensors. The overall collision creation scenario is defined in packet transmission structure Section 3.1 based on the Collision Detection Algorithm adopted from [11]. \[P_{single-slot}=d\times Z_{x} \tag{9}\]0  
\[P_{single-slot}=d\times Z_{x} \tag{9}\]1  
```
1:Input:\(\text{N}\leftarrow\text{Number of subcarrier channels}\)\(T_{g}\leftarrow\text{Total number of general sensor}\) M \(\leftarrow\text{Maximum Number of clusters}\) Output: Optimal-Cluster\(\leftarrow\)Number of optimal clusters
2:reliability-array[] \(\leftarrow\) 0
3:for i \(\leftarrow\) 1 to M do
4:reliability-array[] \(\leftarrow\) Calculate the reliability using Algorithm 1 where \(C_{n}=i\)
5:endfor
6:for j \(\leftarrow\) 1 to length of reliability-array do
7: max-reliability[] \(\leftarrow\) find maximum value index{reliability-array]
8: Optimal-Cluster \(\leftarrow\) j(index of max-reliability)
9:endfor
```  
**Algorithm 2** Optimal number of Cluster allocation algorithm