## 5 Experimental Settings of K-BCO in WSN  
Simulation of the proposed algorithm was achieved using Python version 3.12 and PyCham version 241.18 on the Windows 11 64-bit operating system. Python is a component-based simulation environment that supports the simulation of various communication networks, including wireless sensor networks [27]. It provides a flexible framework for modeling network protocols and scenarios.  
The proposed scheme considers about 250 wireless sensor nodes distributed over a field or geographical area of 400 m\({}^{2}\) randomly. Clusters are formed, and cluster heads (CHs) are selected based on their energy efficiency and transmission error rates (Bit Error Rate (BER)). Sensors locate the CHs using the optimal distance. The study also considers only five sensors as a cluster around each CH at any given time. Table 1 below shows the experimental settings.  
A random dataset on humidity and temperature was generated for each sensor within the network using the uniform distribution function in Python. A uniform distribution function is a type of probability distribution in which all outcomes are equally likely to occur [28; 29]. Thus, every value within a specified range has the same probability of occurring. To generate data for randomly distributed sensors in a field using a uniform distribution, the following steps were followed:  
Step 1: Define the Field Dimensions  
Let the dimensions of the rectangular field be defined as:  
\[\begin{array}{l}\text{Width }W\ =\ 400\ \text{m}\\ \text{Height }H\ =\ 400\ \text{m}\end{array}\]  
Step 2: Specify the Number of Sensors  
Let \(N\) be the number of temperature sensors to be deployed:  
\[N\ =\ 250\]  
Step 3: Set Constraints  
Define the minimum distance \(d\) that must be maintained between any two sensors:  
\[d\ =\ 12\ \text{m}\]  
This is to avoid long distances between sensor nodes and CHs. Long distances between sensor nodes and CHs may lead to high energy consumption during data transmission from sensor nodes to CHs. Therefore, this limits the lifespan and efficiency of the network.  
Step 4: Generate Random Coordinates  
Let \((x_{i},y_{i})\) represent the coordinates of the \(i\)-th sensor, where \(i\) = 1, 2,..., \(n\). The position coordinates of sensors are generated using Equation (19):  
\[(x_{i},y_{i})=(W\cdot u_{i},H\cdot v_{i}) \tag{19}\]  
where \(u_{i}\) and \(v_{i}\) are independent random variables uniformly distributed between 0 and 1. Thus,  
\[x_{i}=W\cdot u_{i}\]  
\[y_{i}=H\cdot v_{i} \tag{20}\]  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Software** & **Operating System** & **Area Size** & **Number of Sensors** \\ \hline Python version 3.12 & Windows 11 64-bit & 400 m\({}^{2}\) & 250 \\ PyCham version 241.18 & & & \\ \hline \hline \end{tabular}
\end{table}
Table 1: Experimental settings.  
Therefore, humidity \(h\) and temperature \(t\) are generated for each sensor within the network using Equation (18):  
\[h_{i}=100\cdot q_{i}\]  
\[t_{i}=40\cdot q_{i} \tag{21}\]  
After generating the above data for each randomly distributed sensor, the data was sent to the sink node through the respective CHs of each cluster.  
The algorithm to implement random distribution is simplified as shown in Algorithm 3:  
```
Step 1: initialize W, H, N, \(u_{i}\), \(v_{i}\), \(q_{i}\) Step 2: set \(d\) Step 3: Generate random coordinates Step 4: Output random distribution value
```  
**Algorithm 3**Simplified Random Distribution Algorithm