├── README.md └── WSN FINAL.m /README.md: -------------------------------------------------------------------------------- 1 |
4 |
5 |
8 | Welcome to the repository for our Wireless Sensor Network (WSN) research and development project. In this project, we aim to address critical issues related to WSNs, including coverage hole detection, improved node participation, energy-efficient routing, and much more. Below, you'll find a comprehensive overview of our research, objectives, scope, and future directions. 9 |
10 | 11 | ## Table of Contents 📜 12 | 13 | - [Introduction 🚀](#introduction) 14 | - [What is a Wireless Sensor Network (WSN)? 📡](#what-is-a-wireless-sensor-network-wsn) 15 | - [Random Node Distribution 🎲](#random-node-distribution) 16 | - [Delaunay Triangulation 🔺](#delaunay-triangulation) 17 | - [Clustering Protocols 🌐](#clustering-protocols) 18 | - [Proposed System 🌟](#proposed-system) 19 | - [Objectives 🎯](#objectives) 20 | - [Scope 🔍](#scope) 21 | - [Conclusion 🌈](#conclusion) 22 | - [Future Scope 🔮](#future-scope) 23 | 24 | ## Introduction 🚀 25 | 26 | In Wireless Sensor Networks (WSNs), battery life is a critical concern. As sensor nodes deplete their batteries, communication holes emerge within the network. This project aims to detect these coverage holes, improve node participation, and develop energy-efficient routing protocols to enhance the overall efficiency and lifespan of WSNs. 27 | 28 | ## What is a Wireless Sensor Network (WSN)? 📡 29 | 30 | A WSN is a wireless network comprising distributed, independent sensor devices designed to monitor physical or environmental conditions. These tiny sensor nodes communicate with each other and exchange information, collecting data on various environmental parameters and forwarding it to a base station. WSNs find applications in diverse fields, including navigation systems, quality control, business, networking, and management. 31 | 32 | ## Random Node Distribution 🎲 33 | 34 | Randomly deploying sensor nodes within a predefined network area is a common practice. This approach offers scalability, reduced deployment costs, and increased network robustness. However, it also presents challenges such as incomplete coverage, connectivity issues, and inefficient energy consumption. To address these challenges, we propose a system that detects coverage holes and improves node participation to ensure complete coverage and reduced energy consumption. 35 | 36 | ## Delaunay Triangulation 🔺 37 | 38 | Delaunay triangulation is a computational geometry technique that optimizes WSN coverage by creating a mesh of triangles covering the deployment area. This technique guarantees that every point in the network is covered by at least one sensor node, reducing the number of active nodes and overall energy consumption. Delaunay triangulation also enhances routing efficiency by defining communication paths between nodes and allows scaling of WSNs for larger coverage areas. 39 | 40 | ## Clustering Protocols 🌐 41 | 42 | Clustering protocols are crucial for organizing sensor nodes into groups based on spatial proximity, energy levels, or other factors. These protocols reduce energy consumption by minimizing the number of nodes transmitting data directly to the base station. The LEACH protocol, for example, rotates the role of cluster head among nodes to balance energy consumption and adapt to changing network topologies. 43 | 44 | ## Proposed System 🌟 45 | 46 | Our proposed system combines improved node participation by placing mobile nodes strategically within the network and an energy-efficient routing approach using the EQDC Protocol (Equi-Quadrant Division Clustering) and optimized Shortest Path Routing through minimum spanning trees. This combination minimizes distances between nodes, reducing energy consumption and enhancing network efficiency. 47 | 48 | ## Objectives 🎯 49 | 50 | - Mitigate coverage hole issues in WSNs. 51 | - Increase node participation in the sensor network. 52 | - Develop an improved energy routing clustering protocol. 53 | - Optimize the LEACH protocol. 54 | - Combine improved energy routing with clustering to enhance network efficiency. 55 | - Find the shortest path from source nodes to the base station. 56 | - Improve energy efficiency within the wireless sensor network using our proposed system. 57 | 58 | ## Scope 🔍 59 | 60 | WSNs have a wide range of applications, including: 61 | 62 | - 🗺️ **Navigation Systems:** Providing indoor positioning and navigation in GPS-challenged environments, among other uses. 63 | - 🏭 **Quality Control Systems:** Monitoring product quality, real-time process control, and predictive maintenance in various industries. 64 | - 📊 **Business:** Supporting supply chain management, inventory control, and environmental monitoring. 65 | - 🌐 **Networking:** Enabling data collection, processing, and communication, as well as network management. 66 | - 🏢 **Management:** Assisting in asset management, facility management, supply chain management, and environmental management. 67 | 68 | ## Conclusion 🌈 69 | 70 | Random node distribution in WSNs is essential in remote or challenging environments. We've explored various strategies and techniques to address the inherent challenges, including coverage holes, connectivity issues, and energy consumption. Our proposed system, which combines Delaunay triangulation, clustering protocols, and optimized routing, significantly improves network efficiency. 71 | 72 | ## Future Scope 🔮 73 | 74 | Our project opens up several avenues for future research and development, including advanced deployment strategies, dynamic node mobility, energy harvesting and power management, fault tolerance, integration with emerging technologies, and security and privacy considerations. These areas present exciting opportunities to further enhance WSNs for various applications and environments. 75 | 76 | **We invite you to explore our project and contribute to the exciting world of Wireless Sensor Networks!** 77 | 78 | 79 | -------------------------------------------------------------------------------- /WSN FINAL.m: -------------------------------------------------------------------------------- 1 | close all; 2 | clear; 3 | clc; 4 | xm=100; 5 | ym=100; 6 | x=0; % added for better display results of the plot 7 | y=0; % added for better display results of the plot 8 | p=0.1; % Probability of node transmitting data 9 | Eo=0.5; % initial energy of node 10 | ETX=50*0.000000001; % 11 | ERX=50*0.000000001; 12 | Efs=10e-12; 13 | Emp=0.0013e-12; 14 | EDA=5*0.000000001; 15 | rmax=2000; 16 | do=sqrt(Efs/Emp); 17 | Et=0; 18 | % Number of Nodes in the field % 19 | global n; 20 | n=100; 21 | global mn; 22 | mn=10; 23 | %loop variable to determine the termination of the network 24 | operatingNodes=n+mn; 25 | % Number of Dead Nodes in the beggining % 26 | dead_nodes=0; 27 | % Coordinates of the Sink (location is predetermined in this simulation) % 28 | sinkx=50; 29 | sinky=120; 30 | 31 | %energy details 32 | 33 | % Initial Energy of a Node (in Joules) % 34 | % E0=0.05; % units in Joules 35 | % ME0=0.1; 36 | % deadNodeThreshold=.000025; 37 | 38 | LeaderNodeThreshold=.03; 39 | global SN; 40 | global MN; 41 | global totalNodes; 42 | totalNodes=n+mn+1; 43 | 44 | 45 | 46 | %%% Creation of the Wireless Sensor Network %%% 47 | 48 | pts=[n,2]; 49 | pts=[rand([n,1])*xm,rand([n,1])*xm]; 50 | disp(pts); 51 | 52 | %%% randomly generating mobile node points 53 | mnpts=[mn,2]; 54 | mnpts=[rand([mn,1])*xm,rand([mn,1])*xm]; 55 | %disp(pts); 56 | 57 | 58 | 59 | 60 | 61 | % X-axis coordinates of sensor node 62 | 63 | 64 | for i=1:mn 65 | 66 | MN(i).x=mnpts(i,1); 67 | MN(i).y=mnpts(i,2); 68 | MN(i).radius=50; %assuming 20meters 69 | MN(i).sel=0; 70 | 71 | end 72 | 73 | 74 | %% Adding base station to the sensor node list 75 | 76 | 77 | %adding sink point to pts array 78 | 79 | %aading sink point to pts array 80 | sink=[sinkx,sinky]; 81 | disp('sink is..'); 82 | disp(sink); 83 | pts=[sink;pts]; 84 | % pts(end+1,1)=sinkx; 85 | % pts(end,2)=sinky; 86 | disp(pts); 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | % Plotting the WSN % 99 | for i=1:n+1 100 | 101 | 102 | SN(i).id=i; % sensor's ID number 103 | SN(i).radius=20; %assuming 20 meters 104 | SN(i).x=pts(i,1); 105 | SN(i).y=pts(i,2); 106 | % SN(i).chainID=0; 107 | % 108 | % SN(i).E=E0; % nodes energy levels (initially set to be equal to "Eo" 109 | % 110 | % SN(i).order=0; 111 | % SN(i).sel=0; % states if the node has already operated for this round or not (if 0 then no, if 1 then yes) 112 | % SN(i).rop=0; % number of rounds node was operational 113 | % SN(i).tel=0; % states how many times the node was elected as a Cluster Head 114 | % order(i)=0; 115 | % SN(i).weight=0; 116 | 117 | 118 | hold on; 119 | figure(1) 120 | plot(x,y,xm,ym,SN(i).x,SN(i).y,'ob',sinkx,sinky,'*r'); 121 | 122 | title 'Wireless Sensor Network'; 123 | xlabel '(m)'; 124 | ylabel '(m)'; 125 | 126 | end 127 | 128 | %trying to create coordinates array and y coordinates array seperately to 129 | %give coordinates in the grpah 130 | xCoord=(n+1+mn); 131 | yCoord=(n+1+mn); 132 | 133 | for i=1:n+1 134 | xCoord(i)=SN(i).x; 135 | yCoord(i)=SN(i).y; 136 | end 137 | %xCoord(end+1)=sinkx; 138 | %xCoord=[sinkx,xCoord]; 139 | %yCoord(end+1)=sinky; 140 | %yCoord=[sinky,yCoord]; 141 | % for i=1:mn 142 | % 143 | % plot(x,y,xm,ym,MN(i).x,MN(i).y,'+r'); 144 | % 145 | % 146 | % 147 | % end 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | % Calculates Euclidaean Distance Between Each Node and the Sink (Base Station) % 159 | for i=1:n+1 160 | 161 | 162 | dts(i)=sqrt((sinkx-xCoord(i))^2 + (sinky-yCoord(i))^2); 163 | % SN(i).Esink=Eelec*k + Eamp*k*(SN(i).dts)^2; 164 | T(i)=dts(i); 165 | end 166 | % disp('t of one is..'); 167 | %disp(T(1)); 168 | %sdisp('t of 21 is..') 169 | %disp(T(21)); 170 | %euclidean distance from each node to the sink node now is stored in T 171 | %array T can access by T(i) in for loop 172 | 173 | 174 | 175 | %checking operatingNodes loop 176 | 177 | 178 | %Delaunay triangulating all the sensor nodes 179 | 180 | 181 | 182 | DT = delaunayTriangulation(pts); 183 | figure(2) 184 | 185 | e=DT.edges; 186 | plot(sinkx, sinky, 'r*', 'markersize', 5); 187 | hold on 188 | 189 | pl=triplot(DT,'-ob'); 190 | hold on 191 | plot(pts(1),pts(2),'-r','LineWidth',2); 192 | 193 | %nodes to be displayed 194 | 195 | 196 | 197 | %plot(xy(:, 1), xy(:, 2), 'ro', MarkerSize=12, MarkerFaceColor='r'); 198 | title 'Delaunay Triangulation of the network with Sink and Static sensor nodes'; 199 | 200 | 201 | 202 | 203 | DT = delaunayTriangulation(pts); 204 | figure(3) 205 | hold on 206 | for i=1:mn 207 | 208 | plot(x,y,xm,ym,MN(i).x,MN(i).y,'+r'); 209 | 210 | 211 | 212 | end 213 | pl=triplot(DT,'-ob'); 214 | title 'Current positions of mobile sensor nodes' 215 | 216 | %identifying gaps 217 | 218 | %identifying edge lengths of DT 219 | 220 | edgelengths = sqrt(sum((DT.Points(e(:,1),:) - DT.Points(e(:,2),:)).^2,2)); 221 | %disp('edge lengths'); 222 | disp(edgelengths); 223 | %disp(edgelengths); 224 | noOfEdges=size(edgelengths); 225 | 226 | %disp(pts); 227 | %disp((DT.Points(e(:,1),:))); 228 | %disp((DT.Points(e(:,2),:))); 229 | 230 | 231 | mnx=(mn); 232 | mny=(mn); 233 | pending_edge=(0); 234 | %checking if it is greater than 2*radius of static node 235 | global k; 236 | k=0; 237 | in=1; 238 | selectedEdge=[]; 239 | for i=1:noOfEdges 240 | 241 | edgeX1=DT.Points(e(i,1),1); 242 | 243 | edgeY1=DT.Points(e(i,1),2); 244 | edgeX2=DT.Points(e(i,2),1); 245 | edgeY2=DT.Points(e(i,2),2); 246 | 247 | 248 | if k<=mn 249 | 250 | if edgelengths(i)> 2*SN(1).radius 251 | % disp('found a hole'); 252 | %k=k+1; 253 | 254 | %check if the found hole is patchable or not 255 | if 2*MN(1).radius>abs(edgelengths(i)-2*SN(1).radius) 256 | 257 | % disp('patchable hole found'); 258 | selectedEdge=[selectedEdge,i]; 259 | 260 | % edgeX1=DT.Points(e(i,1),1); 261 | 262 | %edgeY1=DT.Points(e(i,1),2); 263 | %edgeX2=DT.Points(e(i,2),1); 264 | %edgeY2=DT.Points(e(i,2),2); 265 | if k~=mn 266 | k=k+1; 267 | end 268 | 269 | 270 | 271 | mnx(k)=(edgeX1+edgeX2)/2; 272 | mny(k)=(edgeY1+edgeY2)/2; 273 | % newPoint=[1,2]; 274 | %newPoint(1,1)=mnx(k); 275 | %newPoint(1,2)=mny(k); 276 | 277 | %DT.Points(end+1,:)=newPoint; 278 | 279 | %if not patchable 280 | 281 | end 282 | 283 | 284 | 285 | 286 | 287 | end 288 | %disp(k); 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | end 299 | 300 | MNx=(mn); 301 | MNy=(mn); 302 | 303 | 304 | 305 | 306 | 307 | end 308 | disp(k); 309 | 310 | if k