Introduction

In many sectors, Wireless Sensor Network (WSN) is a new technology for gathering information from locations where the direct intervention of users is not possible. In this case, sensor nodes will be deployed in a homogenous or heterogeneous network to collect information. The data transmission depends mainly on various resource constraints that need to be considered, like energy, bandwidth, memory, and so on, which lose their performance after continuous usage, and the network lifetime is also reduced. These problems in WSN can be minimized by employing efficient routing, clustering, load balancing, and data scheduling techniques. The sensor nodes are bidirectional, so each node can act both as a sender and receiver of data, so energy drain will be higher, which affects the network’s life span. High-density wireless sensor networks are also used in a variety of applications, including traffic management, irrigation, military, and medical. These networks are utilized for the purpose of efficiently collecting information from the sensor network through the utilization of efficient routing strategies, which in turn reduces the amount of energy that is consumed by particular nodes.

In WSN, one particularly effective clustering method is the Low-Energy Adaptive Clustering Hierarchy (LEACH). Its random CH selection procedure, on the other hand, frequently elects nodes with low energy reserves as CHs, which causes rapid energy loss. To address this problem, bio-inspired algorithms are used to identify the best configuration for extending network lifespan. Examples of these algorithms are the Bat Algorithm (BA), Moth Flame Optimization (MFO), Particle Swarm Intelligence Optimization (PSO), and Ant Colony Optimization (ACO). Furthermore, to further conserve energy and extend network lifespan, the suggested approach computes each node’s remaining energy and uses the shortest transmission path. The EEBMFO algorithm combines the Moth Flame Optimization (MFO) technique with bat optimization, creating a hybrid approach that excels in multi-objective optimization for dynamic network environments. Although MFO has proven effective in energy-efficient clustering and node deployment within WSNs, this work presents an innovative hybrid approach. By integrating MFO with bat optimization, this new method tackles multi-objective optimization challenges, particularly in dynamic network environments. In contrast, the E-FEERP approach1 utilizes a combination of fuzzy logic and Particle Swarm Optimization (PSO) to cluster nodes based on the average distance between sensor nodes and the base station. This method aims to reduce energy and overhead consumption while increasing coverage through a parallel fitness function. The E-FEERP’s use of fuzzy logic allows for more nuanced decision-making in node clustering, potentially leading to more efficient network configurations. The LEACH-LMNN hybrid2 takes a different approach by integrating the Levemberg-Marquardt Neural Network (LMNN) with energy-saving protocols such as Energy-Efficient Sensor Routing (EESR) and Low-Energy Adaptive Clustering Hierarchy (LEACH). This combination aims to extend network lifetime by leveraging the predictive capabilities of neural networks in conjunction with established energy-efficient routing protocols. When comparing these approaches, the EEBMFO stands out for its ability to handle multi-objective optimization in dynamic environments, a crucial factor in real-world WSN applications. Its improved convergence rates and scalability suggest better performance in larger and more complex networks compared to E-FEERP and LEACH-LMNN.

Following is a summary of this paper: A review of the writings by various authors that are relevant to the topic of WSN is presented in section “Related work” of the paper. The working model of the bat method and the optimization of the moth flame are covered in section “Proposed work energy efficient bat-moth flame optimization (EEBMFO)”. In section “Performance analysis and discussion”, a brief discussion is provided on the energy-efficient Bath-Moth flame optimization as well as the approach that was utilized to construct the energy model. An explanation of the effectiveness of the proposed algorithm is provided in section “Conclusion”, along with the results of a simulation that compares the proposed work’s energy consumption with the algorithm that is currently in use. With the completion of Section 6, the research study is complete.

Related work

To begin a literature survey on EEBMFO, consider the following starting points: Explore the foundational algorithms, including Moth Flame Optimization (MFO), Bat Optimization, and hybrid optimization techniques in WSNs. Investigate energy-efficient clustering and node deployment in WSNs, focusing on traditional approaches, MFO-based methods, and comparative studies of various optimization techniques.

In this paper, a balance between local and global search is maintained by the researchers’ modified moth-flame optimization approach3, which incorporates a Levy flight-based update mechanism for moth placements. The optimization issues will be resolved, and the mechanical issue will also be resolved, via an improved moth-flame optimisation method with a successful stagnation finding and replacing approach (MFO-SFR)4. The spiral path can take the role of the routing distance thanks to the SFR’s distance-based approach. This article5 does a review of the literature on several MFO algorithms and discusses how they might be used to address issues in the design of automobiles, energy systems, and other real-world issues, as well as those in the medical and agricultural fields In this study6,7, the optimal selection of cluster heads is accomplished by combining the LEACH protocol and the Dragonfly algorithm. This allows for the most effective selection of cluster heads. In order to improve both the number of live nodes and the packet transmission ratio, swarm intelligence is applied to aggregate sensor nodes and find the ideal routing path. This results in an increase in both of these metrics.

The paper8 uses the K-Mean approach to determine the ideal packet size depending on the transceiver channel condition as well as how wireless sensor networks cluster data. When more clusters were added to the simulation, which was done in Python, less energy was used overall. Although a WSN with many nodes won’t experience data loss, doing so will result in increased energy use. This can be prevented by using efficient Machine Learning-based routing strategies. There are two processes involved in the Softmax-Regressed-Tanimoto-Reweight-Boost-Classification approach, which are route path creation and congestion-aware MIMO routing9. It is recommended that this method be utilized whenever possible. The network’s congestion is avoided, and the nodes with the highest energy are chosen for data transmission. This is done in order to reduce the amount of time that is wasted and the amount of data that is lost.

In High-Density Wireless Sensor Networks (HDWSNs), data will be collected from randomly positioned, battery-powered nodes, causing a significant energy drain. One option to lessen that is to use the adaptive elite ant colony optimization10,11, which boosted network lifetime and decreased energy consumption by 22.5% with particle swarm optimization and 30.7% with genetic algorithm. This research proposes a novel Bat algorithm with an Integration strategy (IBA) that improves the global search using a linear combination of Gaussian functions12. By applying different variants of stochastic algorithms to analyze the benchmark function, the local optimum is found.

To prolong the lifespan of the network, this study13 utilized three approaches: (i) sleep scheduling techniques; (ii) reinforcement learning to reduce path lengths; and (iii) limiting data transmission based on changes in received data rates. The rise of Internet of Things (IoT) networks that rely on Wireless Sensor Networks (WSN) has garnered significant interest in using deep neural networks based on whale optimization to enhance spectral and energy efficiency14,15. The multi-hop network is subjected to optimal resource allocation to enhance energy efficiency and quality of service (QoS).

The Priority-Mobility-Aware Clustering Routing Algorithm (p-MACRON) is proposed in this paper16 to ensure an efficient scheduling strategy with a reinforcement learning technique. A fair weighting for all packets and nodes connected to one-hop distance with cluster and scheduled data transmission will be determined using the priority value assigned to each node in the dynamic WSN. Using a hybrid clustering and routing algorithm17,18 on homogeneous and heterogeneous deployed nodes, unnecessary data transmission is eliminated and network stability is attained under threshold-based settings. The proposed model also performs well at load balancing and end-to-end delay when compared to earlier heterogeneous WSN routing algorithms. Moth Flame optimization employing several spiral techniques is used, according to the systems operating limitations, to minimize the utilization of solar sources for power generation. The system’s power loss can be examined using distribution load flow analysis that is based on backward-forward techniques19.

The MFO is embedded in the IEEE-30 bus in order to restrict the amount of reactive power that is dispatched20. This is done in order to regulate the system network. It is necessary to maintain constant surveillance because every node is outfitted with a solar panel and a small windmill in order for it to be able to generate electricity on its own. For the purpose of monitoring the voltage level of the sensor, the reinforcement learning-based energy management method (RL-EM)21 is described. While the nodes that make up a wireless sensor network (WSN) are powered by batteries, the majority of the more complicated activities, such as load balancing, intrusion detection, localization, and so on, need to be developed using mathematical models in an efficient manner22.

The K-Means clustering method23 is used with a hierarchical routing system known as Low Energy Adaptive Clustering Hierarchy (LEACH) in order to obtain a 48.85% improvement in routing in wireless sensor networks (WSN). In addition to the traditional strategy, the dominating node has been implemented in order to increase the longevity of the network as well as the throughput in both homogeneous and heterogeneous networks24,25. It has been suggested that the MFO with historical flame archive (MFO-HFA) is the most effective way for solving engineering challenges26. It is proposed that a top flame randomly matching approach, which primarily protects against intrusion detection on the network, be used in order to improve convergence. It is advised in this study27 that QEnergy and SARSAEnergy be utilized in order to extend the lifetime of the network. The Erdos-Renyi random network model is used to deploy the nodes, and incentives are distributed to each node in accordance with the optimal routing path that is achievable. In these papers28,29, a survey of different clustering algorithms is being examined based on the energy depletion problem. Additionally, a comparison table is being presented for existing techniques with regard to CH selection, network longevity, and algorithm complexity.

From the literature survey of various papers, we can observe that management of energy seems to be a challenging task in WSN. The energy level of sensor nodes is getting depleted by various reasons like overloading, intrusion detection, and congestion in the network. So, in our proposed work, we are identifying CH based on residual energy and routing data through shortest path with the Bat and Moth-Flame optimization thereby minimizing the energy depletion in the nodes.

Proposed work energy efficient bat-moth flame optimization (EEBMFO)

WSN is utilized in a variety of applications to collect data, and its primary challenge is energy depletion due to the battery-powered terminals. In WSN, numerous algorithms are implemented to circumvent this issue; however, precision is not achieved. The model of a WSN network with cluster construction and data transmission from CH to receiver is depicted in Fig. 1. There are numerous bio-inspired optimization techniques available to address the multidimensional challenges in WSN, with sensor node energy depletion being the most significant. As the network system expands, there is a corresponding increase in transmission time and distance. Consequently, nodes experience a greater power loss in proportion to the magnitude of the data. The bat algorithm and MFO optimization are explained below with the general working model, which is further modified in the proposed work. EEBMFO will involve three steps:

  1. (i)

    Identifying cluster heads (CH);

  2. (ii)

    Cluster formation; and.

  3. (iii)

    Routing data through the shortest path.

Fig. 1
figure 1

System architecture of EEBMFO.

In order to attain more accuracy, an Energy Efficient Bat-Moth Flame Optimization (EEBMFO) is implemented in NS2 and the simulated result shows that proposed protocol have improved the network lifetime.

Identifying cluster head

Every sensor node will have a unique residual energy, and the node’s state of activity will depend on this energy. After calculating each node’s residual energy, the threshold energy (Tenergy) is also determined based on these figures. The node whose energy above Tenergy is designated as the CH. The threshold is compared to each node’s residual energy. Here is an illustration of the algorithm:

figure a

After identifying the CH each node will get connected to CH for data transmission to the sink. The cluster formation was is by considering the Bat algorithm parameters like feqmin and feqmax.

Cluster formation with bat algorithm

In the bat optimization, initialize the position, velocity, and other parameters to generate the route to travel with any obstacle or identify any prey in the path. While a bat travels, it produces an echolocation signal to travel forward, and each time the signal strength varies depending on its position and velocity. Based on each moment, the fitness value is calculated to find the best position with respect to the strength of the signal. The bat optimization can be illustrated as follows:

figure b

After the CH has been identified, the nodes will be joined in the EEMFO method according to their transmission range. The bat flies at random and fluctuates in speed to find its food. In a similar fashion, the CH will connect the nodes within the transmission range. The cluster head is picked based on the range of signal strength, with each node connected to it being chosen. The node with the highest residual energy is designated as the cluster head. Provided that the sensor node is within the range for transmitting data, the CH will establish a connection with it. In this situation, certain nodes may be distributed throughout multiple signal ranges of the CH (channel hopping) system. The nodes are connected based on the strongest signal intensity and shortest distance inside the CH region.

$$\:{freq}_{i}={freq}_{min}+\left({freq}_{max}-{freq}_{min}\right)\beta\:$$
(1)
$$\:{Vel}_{i}^{t+1}={Vel}_{i}^{t}+\left({X}_{i}^{t}+{X}^{*}\right){freq}_{i}$$
(2)
$$\:{X}_{t}^{t+1}={X}_{i}^{t}+{Vel}_{i}^{t}$$
(3)

Where, β [0,1].

Xit → position of the current individuals.

Routing with moth-flame optimization (MFO)

The moth may fly by switching its location vectors in 1, 2, 3, or hyperdimensional space and the moth’s spiral motion towards the light and how it updates its location in relation to local stability. Moths approach the flame at a set angle while the light source remains stationary. Following is a summary of the general steps in the MFO algorithm:

figure c

The MFO is applied for routing the data through shortest path from one node to another. In this source data is considered as moth and its moving towards the CH through multi-hop is termed as flame. The spiral moment of data from source to CH can be calculated as follows:

$$\:S\left({Mo}_{i},{Fl}_{i}\right)={Dist}_{i}{e}^{bt}\text{cos}\left(2\pi\:t\right)+{Fl}_{j}$$
(4)

where,

Disti → distance between the ith moth for the jth flame.

b → constant for specifying the logarithmic spiral’s form.

t → choose the random number [-1,1].

S (Moi, Fli) → Spiral flying path of moth is simulated.

In this random number t = -1, implies the closest position to the flame and t = 1 implies the farthest position to the flame.

Distance of ith moth for the jth flame is calculated as follows:

$$\:{Dist}_{i}=\left|{Fl}_{j}-{Mo}_{i}\right|$$
(5)

Where,

Moi → ith moth.

Flj → jth flame.

The current CH can be calculated with current flame number as follows:

$$\:{FN}_{curr}=rand\:\left(N\_flame-l*\frac{N\_flame-l}{Max\_iteration}\right)$$
(6)

l → currently active iterations.

N_flame → most possible flames.

Max_iteration → No. of iterations allowed maximum.

Each node will have its own velocity and alignment of node depend on neighboring individuals and it is calculated as follows:

$$\:{A}_{i}=\frac{\sum\:_{j=1}^{N}{Vel}_{j}}{N}$$
(7)

Velj → velocity of jth neighbouring individuals.

For all angles, the time taken to travel will be the same. Data travels in a spiral path until it reaches the CH. The data travels from source to destination spirally at a constant angle. The moth flame will move spirally towards the light; the same principle can be applied to WSN to take the shortest path to transmit data. Suppose the data is moving in the network with constant velocity v and direction towards the centre; it moves spirally to the CH with time t. As the distance gets shorter when the node is nearing the CH, the amount of energy required for transmission will also be reduced.

Energy model in WSN

Each node in the WSN has an energy consumption that is computed based on how much data is transferred and how long the node is operational. While sending and receiving data across a distance (dist), the transmitter and receiver will use some energy. If a single hop is used to transport a single bit of data, the energy of a specific node can be computed as follows:

$$\:{E}_{trans}\left(data,\:dist\right)=\left\{\begin{array}{c}data\:\left({E}_{trans\_power}+{E}_{free\_space}*{dist}^{2}\right)\:,\:if\:dist<{dist}_{0}\\\:data\:\left(\:{E}_{trans\_power}+\:{E}_{mul\_path}*\:{dist}^{4}\right),\:if\:dist\:\ge\:\:{dist}_{0}\end{array}\right.$$
(8)

Where,

Etrans_power →transmitter power.

Efree_space → energy consumed while transmitting in free space.

Emulti_hop → energy consumed while propagating in multiple path.

data → number of bits transmitted.

The energy consumed while receiving data can be calculated as:

$$\:{E}_{rec}\left(data\right)=data*\:{E}_{rec\_power}$$
(9)

Erec_power →receiver power.

The total energy required for a transmission can be estimated as follows:

$$\:{T}_{energy}=\:{E}_{trans}\left(data,\:dist\right)+\:{E}_{rec}\left(data\right)$$
(10)

The above-mentioned formula is used to calculate how much energy is needed in the WSN for data transmission and reception. With the use of shortest paths and regular CH node changes based on the remaining energy, the energy will be reduced.

Performance analysis and discussion

In NS2, the suggested task is simulated. A network space measuring 1000 × 1000 square meters has been taken into consideration, and randomly placed nodes ranging in size from 50 to 500 are dispersed around the area. Each node sends and receives energy at a rate of 50 × 10− 9 J/bit, depending on the amount of bits sent and the duration of the active time. Depending on how long it has been in operation, each node will release a certain amount of leftover energy during data transmission. Based on criteria like energy consumption, packet delivery ratio, throughput, dependability, and network stabilization time, the performance metrics for the proposed work EEBMFO and the existing works E-FEERP1 and LEACH-LMNN2 protocols are assessed for varied numbers of nodes. The simulation’s necessary parameters are shown in Table 1.

Table 1 WSN simulation parameters.

Energy consumption

The quantity of energy used during data transmission or reception is measured as energy consumption. Tenergy is the mathematical value for the total energy consumption, and Etrans(data, dist) and Erec(data, dist) are the values for the transmission and receiving energy of a single node, respectively (Eqs. (8)–(9)). With a transmit packet size of 256–512 bytes, the number of sensor nodes can range from 50 to 500. Node energy usage is displayed in Fig. 2, with a reduction of 3 to 8% observed for data transmission as the number of nodes grows. As the number of nodes increases, all methods show a proportional increase in values; however, EEBMFO demonstrates superior scalability, making it an ideal choice for energy-sensitive wireless sensor networks.

Fig. 2
figure 2

Analysis of energy consumption.

Packet delivery ratio

The ratio of data packets sent to data received is known as the packet delivery ratio. The packet delivery ratio performance of EEBMFO, current E-FEERP, and LEACH-LMNN are shown in Fig. 3. From source to sink, the MFO will select the shortest angle path for data transmission. The packet delivery ratio can be expressed mathematically as follows:

$$\:{PD}_{ratio}=\frac{{data}_{rec}}{{data}_{trans}}*100$$
(11)

Where PDratio → Packet Delivery ratio.

datarec → Received data packets.

datatrans → Transmitted data packet.

Fig. 3
figure 3

Analysis of packet delivery ratio.

As the number of nodes increases, the network’s energy loss is minimal since transmissions include multiple hops and a shorter active time for each node, and EEBMFO will take the shortest spiral path to the CH. The PDratio increases from 91 to 92% and attain higher security. EEBMFO consistently delivers the best performance across all packet sizes, demonstrating exceptional efficiency in data handling. E-FEERP performs moderately well, slightly lagging behind EEBMFO, while LEACH-LMNN shows the lowest performance, indicating reduced efficiency.

Reliability

The packet drop rate or reliability can be measured as ratio of the number of packet loss to total packet sent from source to the sink. The reliability can be calculated as given below:

$$\:Reliability=\:\frac{{data}_{drop}}{{data}_{trans}}*100$$
(12)

where,

datadrop → dropped data packets.

datatrans → Transmitted data packet.

From Fig. 4 shows the packet drop rate in terms of percentage. The performance of the network depends on the impact of data packet drop. This was improved in the proposed work by calculating the residual energy and considering node with highest energy as CH, in order to packet drop occurred due multipath fading. The comparative analysis illustrate that the proposed model is having lowest drop rate of approximately 8% while the reference model ranges 9 to 12% drop rate. EEBMFO sustains its reliability by optimizing energy usage, even with increasing data packet sizes, ensuring consistent performance. For instance, at 1000 bits, EEBMFO consumes just 8.69 units, compared to 9.78 for E-FEERP and 12.78 for LEACH-LMNN. This efficiency establishes EEBMFO as a highly dependable and energy-efficient solution for wireless sensor networks, particularly in energy-sensitive scenarios.

Fig. 4
figure 4

Analysis of reliability.

Throughput

It is defined as the ratio of number of data packet received per unit time. The throughput is mathematically formulated as:

$$\:Throughput=\:\frac{{data}_{rec}}{Time}$$

where,

datarec → Received data packets.

Time → Time taken per second.

To compare the performance of the proposed and existing models, packets ranging from 20 to 200 kB are transmitted over the network; the results are shown in Fig. 5. The suggested approach achieves improved throughput by forwarding data over the best path with nodes of higher residual energy, which is 17–34% higher than E-FEERP and LEACH-LMNN, respectively. At 200 kB, EEBMFO achieves a throughput of 1462 BPS, surpassing E-FEERP (1283) and LEACH-LMNN (1162). This demonstrates EEBMFO’s ability to maximize throughput while conserving energy, ensuring efficient and reliable performance in energy-sensitive wireless sensor networks.

Fig. 5
figure 5

Analysis of throughput.

Network stabilization time

The network stabilization time is mainly due to fast convergence. When the topology changes, the convergence time for routing data will also change. Figure 6 indicates that increasing network size was improving the network lifetime with efficient clustering and routing in proposed model was having less energy depletion. The network stabilization time was ranging from 1000 to 1900 rounds for network size of 50–500 nodes and was observed that EEBMFO having stability of 11–16% higher than reference models. In contrast, E-FEERP and LEACH-LMNN demonstrate shorter network lifetimes, achieving 1850 and 1725 rounds respectively for 500 nodes. These findings highlight EEBMFO as a highly efficient solution for energy-sensitive wireless sensor networks, extending operational longevity and optimizing resource usage.

Fig. 6
figure 6

Analysis of network stabilization time.

Conclusion

In this research paper, we have introduced the EEMFO technique as a means to reduce energy consumption in WSNs and extend the duration of active nodes. EEMFO integrates moth and bat flame optimization approaches, considering factors such as residual energy of each node, optimal paths for data transmission, and cluster formation to maximize energy utilization and minimize consumption. Comparative analysis with existing algorithms like E-FEERP and LEACH-LMNN demonstrates the superior efficiency of EEMFO. With scalability ranging from 50 to 500 nodes, this technique proves to be highly adaptable. By employing a multi-hop spiral path and creating cluster heads based on residual energy, the approach mitigates the overuse of specific nodes, resulting in reduced energy consumption and increased network lifespan. Moreover, the algorithm’s bio-inspired nature allows for parameter refinement, enabling the identification of energy-draining anonymous network nodes and potential extensions to the network’s lifetime. This adaptability enhances the practicality and versatility of the EEMFO technique in various WSN scenarios. In conclusion, the EEMFO technique presents a promising solution for addressing energy consumption challenges in WSNs. Through comprehensive simulations and analysis, we have demonstrated its effectiveness in prolonging network lifetime and optimizing energy usage. Future research can focus on further refining EEMFO’s parameters and exploring its application in real-world WSN deployments to validate its performance and scalability. Moreover could investigate how the EEMFO technique can be combined with secure routing protocols to prevent energy depletion due to security breaches or malicious attacks.