## 5 Energy Optimization Approach Based on MAC/Routing Cross-Layer (EOAMRCL)
### Clusters Formation Phase (Network Layer)
Within each iteration, for each wolf vector, fitness calculations, alpha, beta, gamma updates, and position updates are performed, leading to an overall complexity of O(\(W\cdot n\));

Figure 6: Example of wolf vectors update. Output: The final step outputs the best set of CHs, which is O(1). Considering the main loop iterates \(t_{max}\) times and includes operations proportional to the number of nodes \(n\), the overall complexity of the algorithm can be approximated as O(\(W\cdot n\cdot t_{max}\)). This linear complexity in terms of the number of nodes ensures that our algorithm remains scalable and efficient for larger networks, making it suitable for real-time applications in WSN. ### Transmission Phase (MAC and Network Layer)

Upon being chosen as the CH, the node broadcasts a message across the network. Only nodes in active mode can hear these messages sent out by various CHs. These active nodes then choose their CHs based on the Received Signal Strength Indication (RSSI). During their NAV time slots, active mode nodes transmit their detected data to the CH. Nodes in sleep mode conserve energy by switching off their transceivers and do not transmit any data. After receiving data from its members, each CH aggregates and combines these data with its own. According to their allocated NAV time slots, each cluster node forwards the gathered data directly to the BS. Data aggregation and compression are essential data processing tasks carried out by CHs after receiving data from every cluster member. These processes maximize energy usage efficiency and extend the network's lifetime. In the next iteration, each node adjusts or maintains its mode (active or sleep) based on its state (paired or isolated), residual energy, and the residual energy of neighboring nodes. The flowchart shown in Figure 7 illustrates the node mode configuration for the upcoming iteration. When a node becomes a CH, it uses its broadcast capability to inform the entire network of its status. This broadcast is a critical step, as it ensures that all active mode nodes are aware of their new CH and can make informed decisions about which CH to connect to based on the strength of the RSSI. The active nodes then engage in data transmission during their assigned NAV time slots, ensuring that their data is efficiently communicated to the CH. The role of the MAC layer cannot be overstated in this process. It ensures that nodes operate in a synchronized manner, with precise timing for data transmission and reception. This coordination prevents data collisions and optimizes the use of the network's limited energy resources. By carefully managing the active and sleep modes of nodes, the MAC layer helps to prolong the operational lifespan of the network. Once the CH collects data from its cluster members, it performs data aggregation and compression, which are vital for reducing the volume of data that needs to be transmitted to the BS. These tasks help in conserving energy, as smaller data packets require less power to transmit. The efficiency of this process directly impacts the network's overall energy consumption and longevity. In each new iteration, nodes reassess their modes based on several factors, including their own residual energy and that of their neighbors. This dynamic adjustment is crucial for maintaining a balanced energy consumption across the network, ensuring that no single node depletes its energy resources too quickly. By constantly adapting to the network's state, the nodes can optimize their energy usage and contribute to the network's sustainability. ### Impact of Clustering on Routing Efficiency in Our Cross-Layer Design

The cross-layer design in our EOAMRCL protocol tightly integrates clustering and routing to optimize energy efficiency and network performance. Clustering impacts routing efficiency by organizing sensor nodes into manageable groups, reducing the number of direct transmissions to the base station, and balancing the network load.