A Modified Particle Swarm Optimization Approach for Latency of Wireless Sensor Networks

In time-sensitive applications, such as detecting environmental and individual nuclear radiation exposure, wireless sensor networks are employed.. Such application requires timely detection of radiation levels so that appropriate emergency measures are applied to protect people and the environment from radiation hazards. In these networks, collision and interference in communication between sensor nodes cause more end-to-end delay and reduce the network's performance. A time-division multiple-access (TDMA) media access control protocol guarantees minimum latency and low power consumption. It also overcomes the problem of interference. TDMA scheduling problem determines the minimum length conflict-free assignment of slots in a TDMA frame where each node or link is activated at least once. This paper proposes a meta-heuristic centralized contention-free approach based on TDMA, a modified particle swarm optimization. This approach realizes the TDMA scheduling more efficiently compared with other existing algorithms. Extensive simulations were performed to evaluate the modified approach. The simulation results prove that the proposed scheduling algorithm has a better performance in wireless sensor networks than the interference degree leaves order algorithm and interference degree remaining leaves order algorithm. The results demonstrate also that integrating the proposed algorithm in TDMA protocols significantly optimizes the communication latency reduction and increases the network reliability. Keywords—Wireless sensor networks; media access control protocol; scheduling algorithms; meta-heuristics; particle swarm optimization

Section II of this article presents a review of related work, and it gives the problem statement. The network model is developed and provided in Section III. The proposed PSO algorithm is discussed in Section IV; also, evaluation metrics are presented in the same section. Section V illustrates the simulation and assessment of performance. Section VI discusses the results, while Section VII concludes this work and suggestions future studies.

A. TDMA Scheduling Optimization
Several scheduling algorithms for data collection in WSNs have been developed and presented solutions for the aforementioned problems. Each algorithm has one or multiobjective associated with data collection according to its application requirements [29].
Sensor nodes interact via wireless multi-hop routing because of the limited range of radio transmission. One-hop TDMA scheduling is simpler than multi-hop scheduling. There is no requirement for spatial reuse of a time-slot since in onehop TDMA scheduling, and several nodes can broadcast simultaneously if their receivers are not in conflict [30].
The scheduling algorithms use one of two interference models for evaluation; the protocol model depending on a graphing approach or the physical model depending on the Signal-to-Interference-plus-Noise-Ratio (SINR) as discussed in [25], [31].
Previous research efforts on WSN processing time have focused on a specific problem based on meta-heuristic approaches. Following [15], the authors used the PSO technique to reduce the overall transaction time. The PSO algorithm dealt with it as a graph partitioning problem and maximized the parallel operation of the network's sensors. A multi-objective optimization framework is executed as described in [32], where a genetic algorithm (GA) and PSO algorithm were combined to improve searching for a global optimum. This framework achieved a minimization in latency and a power consrvation. TRASA (traffic-aware time slot assignment) algorithm is discussed and presented in [33] to gain minimum scheduling and fair medium access. Scheduling of nodes in different time-slots depends on the node's priority (i.e., a node with a high number of offspring, so it has more data to transmit). There are two versions of TRASA; one slot and many slots. When a node possesses a time-slot, only this time-slot is for this node, and many time-slots are assigned to nodes with high priority to transmit without switching delays. M. Bakshi et al. [25] Proposed an optimum converge-cast schedule in a WSN. They used the SINR model of interference and a TDMA -MAC protocol. The PSO algorithm optimized scheduling in multi-channel and multi-time-slot assignment WSN [11], [34]. This PSO algorithm improved the latency and the length of the frame. The Cross-layer approach, CoLaNet [35], is enhanced as described in [36], as the authors proposed new TDMA scheduling algorithms related to routing to reduce communication latency. They present Rand-LO, Depth-LO, and Depth-ReLO algorithms to improve latency. In the slot scheduling approach, these algorithms demonstrate the necessity of traversing the routing tree. Reference [10] considered the interference degree of sensor nodes in the proposed scheduling methods, IDeg-LO and IDeg-ReLO, and improved the network's latency. [9] Proposed an ETDMA-GA algorithm based on a genetic algorithm and cross-layer approach to obtain optimum TDMA scheduling for minimum latency. They compared the obtained results with [10], [36] and proved that the ETDMA-GA algorithm outperforms Rand-LO, Depth-LO, Depth-ReLO, IDeg-LO, and IDeg-ReLO in terms of average latency and average schedule length.
This paper aims to find the efficient and optimum TDMA schedule for sensor nodes based on routing information. The proposed modified PSO approach schedules sensor nodes efficiently and reduces communication latency for a network. 677 | P a g e www.ijacsa.thesai.org PSO algorithm has several advantages compared with other meta-heuristic algorithms. For example, its mechanism is more straightforward (few parameters to be adjusted), the computational cost is low, the convergence speed is high, and the quality of solutions [37]. A study comparing various swarm intelligence (SI) approaches used selected thirty benchmark functions that measure these performance approaches'. This study concluded that PSO is a second-best approach next to Differential Evolution (DE); it outperforms or equally performs to the best algorithm in eighteen out of thirty functions [38].
The PSO algorithm has also been modified to solve a variety of complex optimization problems. For example, it has been used to handle large-scale, constrained, multimodal, multi-objective, and discrete optimization problems, among others [44].

B. Problem Statement
As discussed above in Sections I and II, communication latency is a significant issue in WSN, which imposes challenges in alarm-driven WSN applications such as environmental radiation monitoring networks (ERMNs). This communication latency can be due to transmission interference, network topology, the half-duplex transceiver of the sensor node, duty cycle mechanism, and overhearing. Minimizing the converge-cost is an NP-complete problem, which could be addressed using meta-heuristic optimization algorithms to find a near-optimal off-line solution, which is then used by the sink node in real-time. Compared with other meta-heuristic algorithms, the PSO algorithm has several advantages, including its more straightforward mechanism, higher quality, lower computational cost, and higher conversion speed. The problem that is addressed by this work is the need to minimize the communication latency in ERMNs through optimization of the TDMA scheduling using a modified PSO algorithm.

A. Network Model and Scheduling Model
The WSN employs static sensor nodes supplied with Omnidirectional antennas and single half-duplex transceivers. It has one sink node that contains all information about synchronization between sensor nodes, topology, interference relationships, and determination of each node is parent or child.
A WSN is a graph of vertices (V) and edges (E), G = (V, E) where V represents the sensor nodes and E corresponding to links between nodes. The connectivity model describes the way that the links are connecting nodes. The classical connectivity model based on the unit disk graph (UDG) is adopted. In UDG, any two nodes are considered adjacent if their Euclidean distance is the most [35]. The Euclidean distance ij d between nodes i and j, denoted by ( ) j i d . , is the least number of hops required to send data from one point to another. The communication range of all nodes is assumed to be the same, and therefore the links in the modeled graph are symmetric. Two matrices describe the topology of the WSN; the symmetric connectivity matrix N N C * , which describes connectivity relations between neighbours as in (1), and the interference matrix N N I * , which represents conflicts between neighbour nodes in the network as in (2) ( ) (1) According to these two matrices, the sink node determines the TDMA scheduling, and each node recognizes the time slot assigned to it for transmitting and receiving without interference.
Some constraints restrict the parallel operation of some WSN sensors. Interference between sensor nodes in the WSN forms the primary constraint that decreases successful transmissions. The scheduling algorithm proposed by this paper aims to maximize parallel instead of sequential operation of data transmission. An optimization problem for this solution was modeled.
The normal TDMA scheduling method is used for time-slot allocation for all nodes in the initial phase. For a randomly deployed WSN, the sink node applies a depth-first search [45] algorithm. The sink node constructs a shortest-path routing tree. Then the sink node determines the TDMA schedule and broadcasts it to all sensor nodes in the network. The scheduling technique depends mainly on searching for a first free time-slot for a node; a time-slot is free or suitable for a node if it is not busy with any one-hop or two-hop neighbour nodes. A traversal list, depending on the searching algorithm, orders the sensor nodes in the routing tree.
For each node's traversal list, based on the connectivity and interference matrices, a TDMA scheduling can be deduced as presented in the following slot allocation algorithm [9], [10]: 1) The frame length initializes with a size equal to the maximum node interference degree in the network.
2) The first time-slot is allocated to the first node in the traversal list for data transmission and all connected nodes for data receiving.
3) The sink node schedules the rest traversal list's nodes Similarly. The node's time-slot is for transmission and receiving data.

4)
If there is no free time-slot for allocation, then an extra time-slot to the frame is added.

B. Optimization Algorithm
PSO algorithm initializes particles randomly and converges to the optimal solution by iterations. Each particle modified its velocity and then updates its position. It depends on its expertise (cognitive) and the expertise of other particles (social) [46]. Every particle has two vectors in the PSO algorithm: position and velocity. The position vector describes the value and the direction of a particle at all iterations. The position function of a particle changes to a best in each iteration of the PSO algorithm by using (3): means the position of a particle (i) at iteration t and ( ) presents the velocity of the particle (i) at iteration (t+1). Equation (3) determines the update in a particle's position, which depends mainly on its velocity vector. The velocity vector of the particle (i) at iteration (t+1) is as in (4): The coefficient ω , known as inertial weight, describes the individual coefficient known as the social coefficient and random numbers [0, 1]. In velocity (2), the equation of velocity (4) contains three parts.
The first part keeps the orientation the same as the current velocity of the particle. It tunes exploration and exploitation, which are essential to achieve the exact estimation of a global optimum.
The second part: describes the single-particle intelligence by saving in its memory and using the obtained best cost to evaluate and update the particle position. The vector ( ) t p i  is the personal best value of the particle (i) at iteration (t), and it is updated each new iteration if the particle (i) finds a better solution. It affects the final value of the velocity is adjusted using 1 c . The second part keeps a direction in the direction of the personal Best value obtained by a particle.
The last part: describes the population's social intelligence and saves the optimum value obtained by all particles in it. The vector ( ) t g  means considering the particles' best solution in search space attracts all particles in the global best solution's direction. The impact of this component can be adjusted using 2 c . These components help in updating the position of a particle in search space. The optimization algorithm evaluates the suitability of population particles depending on a fitness function. The chosen fitness function is related mainly to the aim of optimization. The PSO algorithm structure includes the following steps: 1) Initialization: An initial population of particles is generated randomly in the search space with random velocities and positions.
2) The algorithm determines each particle's position and velocity as in (3) and (4). Then, according to an evaluation process, it calculates the fitness value for each particle.
3) Updating the personal Best and the global Best values, if the fitness value is better than the best fitness value, then change the current value to the new value.
4) If it is achieved, the stopping condition will go to step 5; otherwise, go back to step 2.
5) Termination of the algorithm and illustration of the global optimum value is done.

IV. PROPOSED PSO ALGORITHM
The PSO algorithm presented here is modified to suit the time-sensitive application addressed by this wok (transmission of data on radiation levels). The flow chart of the modified PSO is illustrated in Fig. 1. After WSN nodes' deployment in a specified area to be monitored, a depth-first search algorithm is applied to the deployed WSN to form a shortest path routing tree. It is possible to produce traversal lists associated with all nodes in this tree and corresponding TDMA schedules considering interference and connectivity between nodes.

A. The Modified PSO Model
The modified PSO re-orders allocated time-slots in the TDMA schedule randomly until optimum scheduling, which reduces the average latency value. The algorithm is as follows: 1) Initialization: An initial population of 100 particles (normal TDMA schedules) is generated randomly in the search space with random initial positions.
2) The modified PSO algorithm swaps between two random indices of TDMA slots.
3) The algorithm determines each particle's position. Then, according to an evaluation process, it calculates the average latency value for each TDMA schedule. 4) Keeping personal and global Best values up to date, if the fitness value is better than the best fitness value, then change the current value to the new value.

5)
If the stopping condition is met, go to step 5; otherwise, go back to step 2.
6) Termination of the algorithm and illustration of the optimum value of average latency and its TDMA schedule is done.
The particles in the proposed algorithm are the WSN's TDMA schedules, and their values are optimized by swapping randomly between any two slots, with the children's parent wakes up after it, not before it. As a result, the particle's position is independent of its velocity. Following each TDMA schedule's slot swap, an evaluation is performed to determine the best particle, the TDMA schedule, which has the minimum delay.

B. Evaluation Matrices
The design aim of this paper is to minimize the entire time required to complete a series of tasks based on an optimal timeslot assignment for the TDMA schedule. This objective can be achieved by reducing scheduling length and minimizing average latency. Discussion of these parameters is provided as follows:

1) Average latency and average normalized latency:
The sum of latencies associated all the WSN's nodes defined the average latency, in according to (5) Where ( i n ) is the sum of hops along the routing path from a source node (i) to the sink node.
2) Schedule length: The number of time-slots in the derived TDMA frame is used to calculate the schedule length. A minimum TDMA schedule length reduces energy consumption as the sleep period for nodes increases. Increasing the usage of the time slots can decrease the size of the schedule. Most algorithms work to maximize frequent synchronous transmissions and allow spatial reuse by development.
3) Duty cycle: The ratio between the active mode interval and the whole frame defined the sensor node's duty cycle. Its minimum value results in more power conservation in the sensor node [7]. The duty-cycle is calculated for the TDMA-MAC protocol as the ratio between the total numbers of timeslots engaged with communication to the schedule length.

A. Simulation Setup
A randomly deployed WSN of a hundred sensor nodes on a square area, and each sensor has the same communication range. This work uses randomly generated WSNs of varying densities achieved by adjusting the scale of the deployment area of the network. Fig. 2(a-d) presents examples of randomly generated WSNs with different densities. The density ( δ ) describes the average number of neighbours per node in the network as in (7)    WSN was simulated using numerical simulation of MATLAB in the 1.6 GHz laptop with 4 GB RAM to evaluate the performance of the proposed modified PSO algorithm. Table I presents the simulation setting parameters for the network and the PSO algorithm. The maximum number of particles equals the WSN's TDMA schedules. And these schedules provides using the WSN's traversal lists which equals the WSN's nodes.

B. Simulation Results and Evaluation
The best TDMA schedule depends on the initial routing tree generated using the DSF-algorithm, and then the sink node broadcasts this best TDMA schedule in the network. So, the problem of collision is overcome. The proposed modified PSO is a centralized contention-free approach that is achieved by the sink node. Experiments were carried out to compare the proposed algorithm's performance to that of other algorithms.

1) Convergence time and stopping criterion:
The proposed modified PSO algorithm consists of a swarm of particles exploring the search space for searching for a globally optimum solution. The global optimum solution is challenging to determine, so it is essential to decide on the stopping condition and the convergence for the proposed algorithm. These two coefficients are related to the PSO algorithm [28]. The primary requirement for a convergence of PSO is the stability of the state of its particles. A stable condition means that the distance between the current and the particle's previous position is never more significant than a given threshold value (ε>0), or the difference between fitness functions is minimal. The particle convergence time is the minimum number of steps necessary for the particle to reach its stable state. Its value depends on PSO parameters and the convergence level of the fitness function. The value of the convergence time (t) can be calculated theoretically using (8): As shown in (8), the relationship between the convergence time and the convergence level of PSO is linear. The convergence time can also be computed experimentally by a hundred experiments on the WSN with a particular density and observe the stable state of the fitness function [48]. Simulations for the modified PSO algorithm are performed using various maximum iteration parameters and monitor the fitness function's stability for each WSN density.
The average latency becomes converged as shown in Fig. 3 at iterations 30, 40, 60, 80 for WSN densities 5, 10, 15, 20, respectively, which are the values to them the proposed modified PSO converged. Fig. 3 shows that the maximum iteration number is proportional to the network density; with the increase in the network density, more iterations are needed to fulfil the process optimization.
The elapsed time for execution of the proposed algorithm and give a result is presented in Table II for the WSN with a sink node at the center. 681 | P a g e www.ijacsa.thesai.org 2) Average latency and average normalized latency: The next experiment compared the outcomes of the normal (initial), IDeg-LO, and IDeg-ReLO algorithms to the optimal value of average latency and average normalized latency. Fig. 4(a-c) and Fig. 5(a-c)    In every situation of network density or sink node placement, the proposed PSO algorithm maximizes the value of average latency and average normalized latency and outperforms existing methods, as shown in Fig. 4 and 5. The gain in average latency reduction of the modified PSO approach compared with Normal, Ideg-LO, and Ideg-ReLO at different densities is averaged and tabulated in Table III. The modified PSO from Table III improves the average latency up to 31% better than Ideg-LO and up to 23% compared with Ideg-ReLO.

3) Schedule length:
The modified algorithm's schedule length was calculated and compared to other algorithms' results. The outcomes are as follows in Fig. 6.    Fig. 6 shows that the modified algorithm's schedule length is the longest one in approximately all cases of the sink node locations and different network densities. It is more than that of IDeg-ReLO by one time-slot, by two time-slots in the case of IDeg-LO, and by four time-slots over these two algorithms for WSN of density 20 and sink node at MiddleEdge.

4) Duty cycle:
The duty cycle of the modified algorithm was evaluated and compared with that of the IDeg-LO and IDeg-ReLO. Fig. 7 shows the experiment results in all cases of the sink node locations.   Fig. 7 shows that the modified PSO has a lower duty cycle value than that for the IDeg-LO and IDeg-ReLO, reaching up to a 14.2% reduction value. This value is acceptable in the WSNs' time-sensitive applications.

VI. DISCUSSION
The TDMA schedule has been optimized to remove all possible transmission interferences, which are the leading cause of communication latency in the network. A modified PSO algorithm was developed to provide near optimum interference-free TDMA scheduling, resulting in minimum WSN latency.
The results of simulation and evaluation show that the modified-PSO algorithm outperforms the competition. The modified PSO outperforms IDeg-LO and IDeg-ReLO in minimizing the WSN average latency, respectively, by 31 and 23%. The results show also that the scheduling length of TDMA is the largest in most cases of the WSN. Using the modified PSO, the scheduling length reaches up to 8% over IDeg-LO and IDeg-ReLO addition of time-slots to overcome interference. The value of the duty-cycle using the modified PSO is lower than that of IDeg-LO and IDeg-ReLO at all densities. In middleaged sink node WSN, it scores a reduction of 14.28%. While in a Center sink node WSN, IDeg-ReLO results in a decrease in the duty-cycle value except at a WSN density of 10. The modified PSO is more effective than IDeg-LO and IDeg-ReLO when the sink node is at the corner of the WSN. This efficiency is demonstrated by achieving a reduction in the duty cycle of up to 9%.
The results show also that the value of the duty-cycle depends on the schedule length. The increase in the schedule length results in minimizing the duty-cycle, resulting in more power conservation.
It is also important to note that the results of this work contribute towards a more precise understanding of the relation between the schedule length and the duty cycle as the effect of the sink node location, which is an essential parameter in minimizing latency.
This work confirmed that the simplicity of execution of the algorithm and the fast convergence of the PSO meta-heuristic for optimization of the TDMA-scheduling for WSN communication latency problem; are significant advantages when using WSN in time-sensitive applications. The modified PSO algorithm is executed in the sink node, which has sufficient memory for algorithm implementation. The obtained results are beneficial for the effective design of WSNs for timesensitive applications. This approach may be used to acquire data from the surrounding environment with minimal latency in a WSN with static sensors. It has applications in the military, climate monitoring, and the supervision and management of nuclear power facilities. This modified PSO may be used in a variety of ways, including adding mobile sensors and underwater, subterranean sensors.

VII. CONCLUSION AND FUTURE WORK
This study proposed a centralized contention-free TDMA scheduling algorithm. It is a meta-heuristic, a modified PSO algorithm that optimizes the latency reduction and the The modified PSO algorithm improves the average latency by 31% compared with IDeg-LO and by 23% compared with IDeg-ReLO depending on the routing tree. Additionally, it improves the duty cycle by 14.2% compared with that of IDeg-LO and IDeg-ReLO algorithms. Therefore, the modified PSO approach results in the most acceptable WSN applications because of its simplicity and low computational cost. It is also more suitable for time-sensitive applications as it offers the expected speed of convergence with high quality of solutions.
Future work could be performed to study optimization techniques for calibrating the power consumption to the lowest possible level while ensuring the connectivity and reliability of the transmitted data.