# Adaptive Jamming Mitigation for Clustered Energy-Efficient LoRa-BLE Hybrid Wireless Sensor Networks
## 3 Materials and Methods
### Energy Model  
The proposed energy model evaluates energy consumption for WSNs by analyzing key tasks performed by a node during its active operation. These tasks include turning on/off, switching between transmission and reception modes, executing the CSMA/CA algorithm, transmitting and receiving packets, and microcontroller operation. The model provides insights into energy consumption based on packet-dependent and independent activities, enabling optimization of routing protocols [47]. The utilization of this energy model is essential for programming sensor nodes to compute the most representative energy values associated with their primary operational tasks during active mode. By estimating both the total energy consumption and the energy required for specific activities, the model provides a comprehensive understanding of the node's energy profile. This enables precise monitoring and control of energy variations, particularly during transitions to passive mode or under potential attacks causing abnormal energy drainage. Such insights are invaluable for optimizing energy efficiency, ensuring network stability, and identifying vulnerabilities in real time, thereby enhancing the resilience and reliability of the sensor network. The threshold metrics in the algorithm are established based on empirical energy consumption patterns observed in real-world sensor deployments over time with training from a previous week. These thresholds define critical decision points for adaptive network behavior, such as triggering retransmissions, switching communication protocols, or electing new cluster heads in response to interference. Specifically, the energy thresholds for transmission \(E_{TX}\), reception \(E_{RX}\), and CSMA/CA retries energy \(E_{CSMA}\) are dynamically adjusted according to historical network performance data, ensuring that nodes optimize energy efficiency while maintaining resilience against jamming attacks. The pseudocode implements these thresholds by continuously monitoring parameters such as packet loss rates, retransmission attempts, and RSSI variations. When a metric exceeds its predefined threshold, the algorithm dynamically reconfigures the network by selecting alternative communication paths or adjusting transmission power. These realistic thresholds are calibrated through experimental validation, ensuring that the model accurately reflects network conditions while balancing energy conservation and communication reliability. The total energy consumed by a node during its operation is defined as:  
\[E_{\text{Total}}=E_{\text{MC}}+E_{\text{ON}}+E_{\text{OFF}}+E_{CSMA}+E_{ \text{Switching}}+E_{TX}+E_{RX}\]  
Each energy component is calculated as follows:  
* Microcontroller energy: \[E_{\text{MC}}=T_{\text{MC}}\cdot I_{\text{MC}}\cdot V_{\text{MC}}\]
* \(E_{\text{MC}}\): Total energy consumed by the microcontroller. * \(T_{\text{MC}}\): Time (in seconds) the microcontroller remains active. * \(I_{\text{MC}}\): Current (in amperes) used by the microcontroller during active operation. * \(V_{\text{MC}}\): Voltage (in volts) supplied to the microcontroller. * Startup energy: \[E_{\text{ON}}=T_{\text{ON}}\cdot I_{\text{ON}}\cdot V_{\text{ON}}\]\(E_{\text{ON}}\): Energy required to turn the node on. * \(T_{\text{ON}}\): Time (in seconds) taken to turn the node on. * \(I_{\text{ON}}\): Current (in amperes) consumed during the startup phase. * \(V_{\text{ON}}\): Voltage (in volts) supplied during the startup phase. * Shutdown energy: \[E_{\text{OFF}}=T_{\text{OFF}}\cdot I_{\text{OFF}}\cdot V_{\text{OFF}}\]
* \(E_{\text{OFF}}\): Energy consumed to turn the node off. * \(T_{\text{OFF}}\): Time (in seconds) required to turn the node off. * \(I_{\text{OFF}}\): Current (in amperes) used during the shutdown phase. * \(V_{\text{OFF}}\): Voltage (in volts) applied during the shutdown phase. * Switching energy: \[E_{\text{Switching}}=T_{\text{Switching}}\cdot I_{\text{Switching}}\cdot V _{\text{Switching}}\]
* \(E_{\text{Switching}}\): Energy used to switch between transmission and reception modes (or vice versa).