20-05-2012, 03:21 PM
hi i am akshay tikoo pursuin b.e from a reputed college...i wanted a ppt on this particular topic...i have made the report as shown below...akshaytikoo573[at]gmail.com" class="mycode_email
CHAPTER-1 .
INTRODUCTION
Sensor networks have become popular recently due to their application in unattended tracking and detection of undesirable objects, hazard detection, data gathering, environment monitoring, and so on. Further, due to their low cost and small size, it is easy to deploy them in large numbers. However, these sensors are resource constrained. Specifically, sensors are constrained by limited power and limited communication distance. Hence, they need to collaborate with each other to perform the task at hand. One of the important problems in sensor networks is message collision. More specifically, if a sensor receives two messages simultaneously then they collide and both messages become incomprehensible. Also, it is difficult for a sensor to know whether a given message reached all its neighbors as a message sent by a sensor may collide at one sensor and be correctly received at another sensor.
To deal with the problem of message collision, approaches like collision-avoidance and collision-freedom protocols are proposed. Collision-avoidance protocols like carrier sense multiple access (CSMA) try to avoid collisions by sensing the medium before transmitting a message. Another example of collision-avoidance protocol is carrier sense multiple access and collision detection (CSMA/CD). CSMA/CD is difficult to use in the context of sensor networks as the collisions are often detected at some receivers whereas other receivers and sender(s) may not detect the collision. Collision-freedom protocols like frequency division multiple access (FDMA), code division multiple access (CDMA), and time division multiple access (TDMA) ensure that collisions do not occur while the sensors communicate. New TDMA algorithms service for sensor networks is proposed in this project. Our service ensures collision-freedom and fair bandwidth allocation among different sensors. Moreover, since it does not require any expensive operations, it is more applicable to sensor networks. Our TDMA service lets one customize the assignment of time slots to different sensors by considering the common communication patterns that occur in the application. Specifically, we consider three commonly occurring communication patterns: broadcast, converge cast, and local gossip. In broadcast, a message is sent to all the sensors in the network. Broadcast is useful when a base station wants to transmit some information (e.g., program capsules for reprogramming the sensors) to all the sensors in the network.
1.1 Introduction to Time Division Multiple Access
Time division multiple access (TDMA) is a channel access method for shared medium networks. It allows several users to share the same frequency channel by dividing the signal into different time slots. The users transmit in rapid succession, one after the other, each using its own time slot. This allows multiple stations to share the same transmission medium (e.g. radio frequency channel) while using only a part of its channel capacity. TDMA is used in the digital 2G cellular systems such as Global System for Mobile Communications (GSM), IS-136, Personal Digital Cellular (PDC) and iDEN, and in the Digital Enhanced Cordless Telecommunications (DECT) standard for portable phones. It is also used extensively in satellite systems, combat-net radio systems, and PON networks for upstream traffic from premises to the operator. For usage of Dynamic TDMA packet mode communication
TDMA is a type of Time-division multiplexing, with the special point that instead of having one transmitter connected to one receiver, there are multiple transmitters. In the case of the uplink from a mobile phone to a base station this becomes particularly difficult because the mobile phone can move around and vary the timing advance required to make its transmission match the gap in transmission from its peers. Time division multiple access (TDMA) and carrier sensing multiple access (CSMA) are two major medium access approaches in WSNs. This work will only focus on the TDMA approach because the scenario specification of our research is a static network in which TDMA is said to be more effective than CSMA, especially under medium to high traffic load. In this paper, we aim at deriving TDMA schedules with optimized power consumption and minimum latency in clustered WSNs. Energy efficiency is a major concern in WSNs, since the batteries are often impossible to be replaced or recharged in many cases in TDMA, a node can be active only if it is scheduled to send or receive data, which give it advantages in power efficiency.
1.2 Problem Statement
The medium access control (MAC) protocol of many WSN and ad hoc network proposals is TDMA based cross-layer design is further adopted to achieve least energy consumption in TDMA based WSNs, as summarized in addition to energy efficiency, quality of service (QoS) metrics such as end-to-end delay needs to be taken into account in some applications or under certain scenarios, for instance, delivering real-time data in radio harsh environments. To achieve these objectives, we propose a two-step approach to derive TDMA schedules supporting both high energy efficiency and minimum delay in WSNs. In the first step, we formulate the problem via cross-layer optimization, aiming at deriving the most energy-efficient flows on every link. Based on the calculated per-link flows, in the second step, we propose an algorithm to obtain a TDMA schedule with the least frame length. From the analysis, the least frame length guarantees minimum delay for the derived TDMA schedules. We consider the application of the proposed two-step approach in clustered WSNs. It is widely known that clustering technique can provide scalability for large-size WSNs, since most of the operations can be accomplished at cluster heads (CHs) and gateways (if present), whose number is much less than the number of sensing nodes. Instead of only addressing intra cluster slot assignment, we focus on the more challenging inter cluster slot assignment.
1.3. The main aims of this project
The main aims of this project are twofold. First, we build a cross-layer nonlinear optimization model to achieve energy efficiency with specified link reliability and bandwidth constraints. Instead of solving this nonlinear optimization problem directly by heuristic algorithms, we transform the problem into two simpler sub problems at less complexity, which facilitates the application of our approach in large-size WSNs. Second, we propose a scheduling algorithm for slot assignment in clustered WSNs. This scheduling algorithm incorporates the slot reuse concept (from cellular networks) in calculating the schedules based on the optimal flows derived from the proposed optimization model.
1.4. Applications of TDMA
• The plesiochronous digital hierarchy (PDH) system, also known as the PCM system, for digital transmission of several telephone calls over the same four-wire copper cable (T-carrier or E-carrier) or fiber cable in the circuit switched digital telephone network.
• The synchronous digital hierarchy (SDH)/synchronous optical networking (SONET) network transmission standards that have replaced PDH.
• Used in Wireless sensor networks for a wide range of monitoring applications such as traffic and seismic monitoring, and fire detection [1]. Such networks consist of a group of nodes, with sensing, signal processing and wireless communication capabilities and limited battery energy. The nodes must quickly report the results to a data collection node or access point.
1.5 Applications of Wireless Sensor Networks
The applications for WSNs are varied, typically involving some kind of monitoring, tracking, or controlling. Specific applications include habitat monitoring, object tracking, fire detection, land slide detection and traffic monitoring. In a typical application, a WSN is scattered in a region where it is meant to collect data through its sensor nodes.
1.5.1 Area monitoring
Area monitoring is a common application of WSNs. In area monitoring, the WSN is deployed over a region where some phenomenon is to be monitored. For example, a large quantity of sensor nodes could be deployed over a battlefield to detect enemy intrusion[23]. When the sensors detect the event being monitored (heat, pressure, sound, light, electro-magnetic field, vibration, etc.), the event is reported to one of the base stations, which then takes appropriate action (e.g., send a message on the internet or to a satellite). Similarly, wireless sensor networks can use a range of sensors to detect the presence of vehicles ranging from motorcycles to train cars.
1.5.2 Greenhouse Monitoring
Wireless sensor networks are also used to control the temperature and humidity levels inside commercial greenhouses. When the temperature and humidity drops below specific levels, the greenhouse manager must be notified via e-mail or cell phone text message, or host systems can trigger misting systems, open vents, turn on fans, or control a wide variety of system responses.
1.5.3 Landslide detection
A landslide detection system, make use of a wireless sensor network to detect the slight movements of soil that may occur during a landslide. And through the data gathered it is possible to know the occurrence of landslides long before it actually happens.
1.5.4 Machine Health Monitoring
Wireless sensor networks have been developed for machinery condition-based maintenance (CBM) as they offer significant cost savings and enable new functionalities. In wired systems, the installation of enough sensors is often limited by the cost of wiring, which runs between $10–$1000 per foot. Previously inaccessible locations, rotating machinery, hazardous or restricted areas, and mobile assets can now be reached with wireless sensors. Often, companies use manual techniques to calibrate, measure, and maintain equipment. This labor-intensive method not only increases the cost of maintenance but also makes the system prone to human errors. Especially in US Navy shipboard systems, reduced manning levels make it imperative to install automated maintenance monitoring systems. Wireless sensor networks play an important role in providing this capability[25]
1.5.5 Water/Wastewater Monitoring
There are many opportunities for using wireless sensor networks within the water/wastewater industries. Facilities not wired for power or data transmission can be monitored using industrial wireless I/O devices and sensors powered using solar panels or battery packs.
1.5.6 Landfill Ground Well Level Monitoring and Pump Counter
Wireless sensor networks can be used to measure and monitor the water levels within all ground wells in the landfill site and monitor leachate accumulation and removal. A wireless device and submersible pressure transmitter monitors the leachate level. The sensor information is wirelessly transmitted to a central data logging system to store the level data, perform calculations, or notify personnel when a service vehicle is needed at a specific well.
1.5.7 Water Tower Level Monitoring
Water towers are used to add water and create water pressure to small communities or neighborhoods during peak use times to ensure water pressure is available to all users. Maintaining the water levels in these towers is important and requires constant monitoring and control. A wireless sensor network that includes submersible pressure sensors and float switches monitors the water levels in the tower and wirelessly transmits this data back to a control location. When tower water levels fall, pumps to move more water from the reservoir to the tower are turned on.
1.5.8 Agriculture
Using wireless sensor networks within the agricultural industry are increasingly common. Gravity fed water systems can be monitored using pressure transmitters to monitor water tank levels, pumps can be controlled using wireless I/O devices, and water use can be measured and wirelessly transmitted back to a central control center for billing. Irrigation automation enables more efficient water use and reduces waste.
1.5. Organization of the Report
• Chapter-1: Introduction: This chapter tells about the introduction to wireless sensor networks and its applications, Introduction to simulation model , problem statement, Aim of the project and motivation factors, Organizational Profile.
• Chapter-2: Literature Survey- This chapter majorly deals with existing system and proposed system, About IDS in WSN, and related research works.
• Chapter-3: Tools and Technologies Used - This chapter tells about tools and technologies used in Simulation model for Intrusion Detection in Wireless Sensor Network project
• Chapter-4: Software Requirement Specification- This chapter speaks about the product perspective, user characteristics, its assumptions and dependencies, specific requirements, non- functional requirements and functional requirements.
• Chapter-5: System Design- This chapter deals with the advance software engineering where the entire flow of the project is represented by professional data flow diagram starting from level 0 till 3, it also highlight the context level diagram of the application. This chapter mainly deals with class diagram as well as structure chart for the project representation
• Chapter-6: Implementation- This chapter deals with the steps involved in the creation of the project work. It is defined with the assistant of code explanation for the ease of reader.
• Chapter-7: Testing- This chapter mainly deals with the various types of the test cases to prove the validity of the project.
• Chapter-8: Snapshots- This chapter mainly deals with the graphical user interface of the project to show the output of the application.
• Chapter-9: Conclusion and Future Work- This chapter is mainly the summary of the entire project development and it also suggest some of the enhancement idea which couldn’t be covered up due to constraint of time and resources.
• References - This section mainly highlights all the journal and IEEE papers being referred for the development of the dissertation.
CHAPTER- 2
LITERATURE SURVEY
In this chapter, we discuss the related work on TDMA-based MAC protocols in sensor networks. TDMA protocols can be classified as randomized (e.g., [1, 2]) and deterministic protocols (e.g,[4]). In [1], whenever a collision occurs during startup (synchronization phase), exponential back off is used for determining the time to transmit next. One of the important assumptions in [1] is that each node has a unique message length. In [2, 3], initially, nodes are in random-access mode and TDMA slots are assigned to the nodes during the process of network organization.
Earlier works on TDMA scheduling for WSNs mainly focus on obtaining the shortest schedules [10], [11] or distributed implementation [5], [6], [7], [10]. In [10], non conflicted schedules are obtained first, and a following algorithm then goes through all nodes and slots, in turn, to produce maximal broadcasting sets, thus reducing the schedule length. The authors of [11] further take into account the number of packets being sent at every node, and provide the shortest schedules by eliminating the nodes without packets to send at each loop of the proposed algorithm. Both of the algorithms in [10] and [11] need global topology information, which may not be scalable for very large-size networks. To overcome the difficulty of obtaining global topology information in very large-size networks, many distributed slot assignment schemes have been proposed, such as DRAND [3], PACT [4], TRAMA [5], and the depth first search (DFS) scheme used in [10]. These approaches obtain local topology and interference information at each node, and compose schedules by exchanging messages between local nodes within a certain range (i.e., the interference range).
Compared to the approaches demanding global topology information, distributed scheduling is more flexible, but at a cost of increased schedule length. The focus of the works in [5], [6], [7], [10], [11] is at the MAC layer. Working on a single layer only may lead to inefficiency in utilizing the network resources. Recently, cross-layer design approach is combined with TDMA scheduling in order to obtain prolonged network lifetime. In [12], joint routing, link scheduling, and power control are considered to support high data rate for broadband wireless multihop networks. A framework for cross-layer design toward energy-efficient communication is presented in [13]. The authors address joint link scheduling and power control with the objective of energy efficiency subject to QoS guarantees in terms of bandwidth and bit error rate (BER). A heuristic solution is proposed. Interference-free TDMA schedules are calculated in [8] for a small-scale network by joint optimization of the physical, MAC, and network layers. The authors use convex optimization to solve the cross-layer-based network lifetime optimization problem, employing the interior point method [14]. A single frame without slot reuse for the whole network guarantees no interference. However, this also leads to significant end-to-end delay, which makes this approach unsuitable for large-size WSNs. In [9], the authors consider both joint layer optimization and slot reuse to derive energy-efficient schedules. A convex cross-layer optimization model is proposed and solved iteratively to maximize the network lifetime. The link schedules evolve at each iteration until a specific energy consumption goal is reached or no more optimal solution can be found.
The main task in designing a TDMA schedule is to allocate time slots depending on the topology and the node packet generation rates. A good schedule not only avoids collisions by silencing the interferers of every receiver node in each time slot but also minimizes the number of time slots hence the latency: The larger latency may require a higher data rate (and hence higher energy consumption) to satisfy a deadline [15]. We therefore try to find a TDMA schedule that minimizes the number of time slots. TDMA algorithms consider either one-hop or multi-hop scheduling. The former are for networks in which the nodes are one hop away from the base station [15, 16], and allocate time slots in the reverse channel depending on allocation request and deadline of the nodes. Because the base station is the common receiver of the transmissions, only one node can transmit in a slot. In some sensor networks however direct transmission from all sensor nodes to the base station may not be feasible nor power efficient [17].
Multi-hop TDMA scheduling is more challenging than one-hop scheduling because spatial reuse of a time slot may be possible: More than one node can transmit at the same time slot if their receivers are in non-conflicting parts of the network. There are two types of conflicts, namely, primary conflict and secondary conflict. A primary conflict occurs when a node transmits and receives at the same time slot or receives more than one transmission destined to it at the same time slot. A secondary conflict occurs when a node, an intended receiver of a particular transmission, is also within the transmission range of another transmission intended for other nodes. In the context of TDMA, the problem is to determine the smallest length conflict-free assignment of slots where each link or node is activated at least once [18]. Previous work on scheduling algorithms focus on either decreasing the length of schedules [18, 19, 20, 21, 22, 24 ] or distributed implementation [25, 26, 27].
Previous scheduling algorithms activating each link or node at least once during a TDMA frame are based on the assumption that there are many independent point-to-point flows in the network. In sensor networks however often data are transferred from the sensor nodes to a few central data collectors. In traffic monitoring [26], for example, the nodes sense the passage of vehicles at several freeway locations or at an intersection, and transmit the data to the access point on the side of the freeway or intersection. The packets are transferred to the access point over the routing tree in multiple hops. The problem therefore is to determine the smallest length conflict-free assignment of slots during which the packets generated at each node reach the access point over the routing tree. The many-to-one scheduling has been addressed previously by [27, 28, 31]. Reference [29] proposes an evolutionary algorithm where genetic algorithm and particle swarm optimization are hybridized to enhance the searching ability however does not provide any guarantees on the performance. References [30] and [31] on the other hand propose heuristic algorithms that schedule as many independent segments as possible to increase the degree of parallel transmission but does not consider the specific
2.1 Existing System
Existing method formulate the problem via cross-layer optimization, aiming at deriving the most energy-efficient flows on every link. This implies that an optimal transmission power exists for a link to achieve power efficiency. We can say that the optimization model achieves more power efficiency in such a WSN (for example, if assuming that a backup CH near nodes exist in this scenario), since there are more choices of selecting optimal paths toward the sink even if some nodes run out of energy. CSMA especially under medium to high traffic load the main contributions of this paper are twofold. First, we build a cross-layer nonlinear optimization model to achieve energy efficiency with specified link reliability and bandwidth constraints. Instead of solving this nonlinear optimization problem directly by heuristic algorithms, we transform the problem into two simpler sub problems at less complexity, which facilitates the application of our approach in large-size WSNs. Second, we propose a scheduling algorithm for slot assignment in clustered WSNs.
2.2 Proposed System
We propose a solution to the scheduling problem in clustered wireless sensor networks (WSNs). The objective is to provide network-wide optimized time division multiple access (TDMA) schedules that can achieve high power efficiency, zero conflict, and reduced end-to-end delay. To achieve this objective, we first build a nonlinear cross-layer optimization model involving the network, medium access control (MAC), and physical layers, which aims at reducing the overall energy consumption. We solve this problem by transforming the model into two simpler sub problems. Based on the network-wide flow distribution calculated from the optimization model and transmission power on every link, we then propose an algorithm for deriving the TDMA schedules. We aim at deriving TDMA schedules with optimized power consumption and minimum latency in clustered WSNs. Energy efficiency is a major concern in WSNs.
To achieve the project objective, we propose a two-step approach to derive TDMA schedules supporting both high energy efficiency and minimum delay in WSNs. In the first step, we formulate the problem via cross-layer optimization, aiming at deriving the most energy-efficient flows on every link. Based on the calculated per-link flows, in the second step, we propose an algorithm to obtain a TDMA schedule with the least frame length. From the analysis presented least frame length guarantees minimum delay for the derived TDMA schedules. TDMA scheduling transmission power and retransmissions on a link determining the optimal transmission power, we build a cross-layer design-based nonlinear optimization model which aims at minimizing the network-wide energy consumption. We solve this problem by transforming it into two sub problems with less complexity.
CHAPTER-3
Tools and technologies used in the project
3.1 Introduction to Java language
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities. Java applications are typically compiled to byte code that can run on any Java virtual machine (JVM) regardless of computer architecture. The original and reference implementation Java compilers, virtual machines, and class libraries were developed by Sun from 1995. As of May 2007, in compliance with the specifications of the Java Community Process, Sun made available most of their Java technologies as free software under the GNU General Public License. Others have also developed alternative implementations of these Sun technologies, such as the GNU Compiler for Java and GNU Class path. One characteristic of Java is portability, which means that computer programs written in the Java language must run similarly on any supported hardware/operating-system platform. One should be able to write a program once, compile it once, and run it anywhere.
This is achieved by compiling the Java language code, not to machine code but to Java byte code – instructions analogous to machine code but intended to be interpreted by a virtual machine (VM) written specifically for the host hardware. End-users commonly use a Java Runtime Environment (JRE) installed on their own machine for standalone Java applications, or in a Web browser for Java applets. Standardized libraries provide a generic way to access host specific features such as graphics, threading and networking. In some JVM versions, byte code can be compiled to native code, either before or during program execution, resulting in faster execution.
3.1.1 Java Development Kit
The Java Development Kit (JDK) is a Sun Microsystems product aimed at Java developers. Since the introduction of Java, it has been by far the most widely used Java SDK. On 17 November 2006, Sun announced that it would be released under the GNU General Public License (GPL), thus making it free software. This happened in large part on 8 May 2007 and the source code was contributed to the OpenJDK. The JDK has as its primary components a selection of programming tools, including:
Java – The loader for Java applications. This tool is an interpreter and can interpret the class files generated by the javac compiler. Now a single launcher is used for both development and deployment. The old deployment launcher, jre, no longer comes with Sun JDK.
javac – The compiler, which converts source code into Java byte code
jar – The archiver, which packages related class libraries into a single JAR file. This tool also helps manage JAR files. The JDK also comes with a complete Java Runtime Environment, usually called a private runtime. It consists of a Java Virtual Machine and all of the class libraries present in the production environment, as well as additional libraries only useful to developers, such as the internationalization libraries and the IDL libraries.
Java is also unusual in that each Java program is both compiled and interpreted. With a compiler, you translate a Java program into an intermediate language called Java byte codes--the platform-independent codes interpreted by the Java interpreter. With an interpreter, each Java byte code instruction is parsed and run on the computer. Compilation happens just once; interpretation occurs each time the program is executed. This figure illustrates how this works.
Figure 2.1Working of Java Program.
Java byte codes can be considered as the machine code instructions for the Java Virtual Machine (Java VM). Every Java interpreter, whether it's a Java development tool or a Web browser that can run Java applets, is an implementation of the Java VM. The Java VM can also be implemented in hardware. Java byte codes help make "write once, run anywhere" possible. The Java program can be compiled into byte codes on any platform that has a Java compiler. The byte codes can then be run on any implementation of the Java VM. For example, the same Java program can run on Windows NT, Solaris, and Macintosh.
3.2 The Java Platform
A platform is the hardware or software environment in which a program runs. The Java platform differs from most other platforms in that it's a software-only platform that runs on top of other, hardware-based platforms. Most other platforms are described as a combination of hardware and operating system.
The Java platform has two components:
The Java Virtual Machine (Java VM)
The Java Application Programming Interface (Java API)
The Java API is a large collection of ready-made software components that provide many useful capabilities, such as graphical user interface (GUI) widgets. The Java API is grouped into libraries (packages) of related components. The following figure depicts a Java program, such as an application or applet, that's running on the Java platform. As the figure shows, the Java API and Virtual Machine insulates the Java program from hardware dependencies.
As a platform-independent environment, Java can be a bit slower than native code. However, smart compilers, well-tuned interpreters, and just-in-time byte code compilers can bring Java's performance close to that of native code without threatening portability.
3.3 Networking Basics
Ken Thompson and Dennis Ritchie developed UNIX in concert with the C language at Bell Telephone Laboratories, Murray Hill, New Jersey, in 1969. In 1978, Bill Joy was leading a project at Cal Berkeley to add many new features to UNIX, such as virtual memory and full-screen display capabilities. By early 1984, just as Bill was leaving to found Sun Microsystems, he shipped 4.2BSD, commonly known as Berkeley UNIX.4.2BSD came with a fast file system, reliable signals, interprocess communication, and, most important, networking. The networking support first found in 4.2 eventually became the de facto standard for the Internet. Berkeley’s implementation of TCP/IP remains the primary standard for communications with the Internet. The socket paradigm for inter process and network communication has also been widely adopted outside of Berkeley.
3.3.1 Socket Overview
A network socket is a lot like an electrical socket. Various plugs around the network have a standard way of delivering their payload. Anything that understands the standard protocol can “plug in” to the socket and communicate. Internet protocol (IP) is a low-level routing protocol that breaks data into small packets and sends them to an address across a network, which does not guarantee to deliver said packets to the destination. Transmission Control Protocol (TCP) is a higher-level protocol that manages to reliably transmit data. A third protocol, User Datagram Protocol (UDP), sits next to TCP and can be used directly to support fast, connectionless, unreliable transport of packets.
3.3.2 Client/Server
A server is anything that has some resource that can be shared. There are compute servers, which provide computing power. Print servers, which manage a collection of printers, Disk servers, which provide networked disk space and web servers, which store web pages. A client is simply any other entity that wants to gain access to a particular server. In Berkeley sockets, the notion of a socket allows as single computer to serve many different clients at once, as well as serving many different types of information. A server process is said to “listen” to a port until a client connects to it. A server is allowed to accept multiple clients connected to the same port number, although each session is unique. To manage multiple client connections, a server process must be multithreaded or have some other means of multiplexing the simultaneous I/O.
3.3.3 Reserved Sockets
Once connected, a higher-level protocol ensues, which is dependent on which port you are using. TCP/IP reserves the lower, 1,024 ports for specific protocols. Port number 21 is for FTP, 23 is for Telnet, 25 is for e-mail, 79 is for finger, 80 is for HTTP, 119 is for Netnews-and the list goes on. It is up to each protocol to determine how a client should interact with the port.
3.3.4 Inetaddress
The InetAddress class is used to encapsulate both the numerical IP address and the domain name for that address. We interact with this class by using the name of an IP host, which is more convenient and understandable than its IP address.
The InetAddress class hides the number inside. As of Java 2, version 1.4, InetAddress can handle both IPv4 and IPv6 addresses.
3.3.5 TCP/IP Client Sockets
TCP/IP sockets are used to implement reliable, bidirectional, persistent, point-to-point, stream-based connections between hosts on the Internet. A socket can be used to connect Java’s I/O system to other programs that may reside either on the local machine or on any other machine on the Internet. There are two kinds of TCP sockets in Java. One is for servers, and the other is for clients. The ServerSocket class is designed to be a “listener,” which waits for clients to connect before doing anything. The Socket class is designed to connect to server sockets and initiate protocol exchanges. The creation of a Socket object implicitly establishes a connection between the client and server. There are no methods or constructors that explicitly expose the details of establishing that connection. Here are two constructors used to create client sockets:
Socket(String hostName, int port)Creates a socket connecting the local host to the named host and port; can throw an UnknownHostException or anIOException.
Socket(InetAddress ipAddress, int port)Creates a socket using a preexisting InetAddress object and a port; can throw an IOException.
A socket can be examined at any time for the address and port information associated with it, by use of the following methods:
InetAddress getInetAddress( )- Returns the InetAddress associated with the Socket object.
int getPort( ) Returns the remote port to which this Socket object is connected.
int getLocalPort( ) Returns the local port to which this Socket object is connected.
Once the Socket object has been created, it can also be examined to gain access to the input and output streams associated with it. Each of these methods can throw an IOException if the sockets have been invalidated by a loss of connection on the Net.
InputStream getInputStream( )Returns the InputStream associated with the invoking socket.
OutputStream getOutputStream( ) Returns the OutputStream associated with the invoking socket.
3.3.6 TCP/IP Server Sockets
Java has a different socket class that must be used for creating server applications. The ServerSocket class is used to create servers that listen for either local or remote client programs to connect to them on published ports. ServerSockets are quite different form normal Sockets. When we create a ServerSocket, it will register itself with the system as having an interest in client connections. The constructors for ServerSocket reflect the port number that we wish to accept connection on and, optionally, how long we want the queue for said port to be. The queue length tells the system how many client connection it can leave pending before it should simply refuse connections. The default is 50. The constructors might throw an IOException under adverse conditions. Here are the constructors:ServerSocket(int port) Creates server socket on the specified port with a queue length of 50.
Serversocket(int port, int maxQueue)-Creates a server socket on the specified port with a maximum queue length of maxQueue.
ServerSocket(int port, int maxQueue, InetAddress localAddress)-Creates a server socket on the specified port with a maximum queue length of maxQueue. On a multihomed host, localAddress specifies the IP address to which this socket binds.
ServerSocket has a method called accept( ), which is a blocking call that will wait for a client to initiate communications, and then return with a normal Socket that is then used for communication with the client.
3.4 Java Swing
Swing is a widget toolkit for Java. It is part of Sun Microsystems' Java Foundation Classes (JFC) — an API for providing a graphical user interface (GUI) for Java programs. Swing was developed to provide a more sophisticated set of GUI components than the earlier Abstract Window Toolkit. Swing provides a native look and feel that emulates the look and feel of several platforms, and also supports a pluggable look and feel that allows applications to have a look and feel unrelated to the underlying platform.
The overall goal for the Swing project was:
To build a set of extensible GUI components to enable developers to more rapidly develop powerful Java front ends for commercial applications.
To this end, the Swing team established a set of design goals early in the project that drove the resulting architecture. These guidelines mandated that Swing would:
1. Be implemented entirely in Java to promote cross-platform consistency and easier maintenance.
2. Provide a single API capable of supporting multiple look-and-feels so that developers and end-users would not be locked into a single look-and-feel.
3. Enable the power of model-driven programming without requiring it in the highest-level API.
4. Adhere to JavaBeans design principles to ensure that components behave well in IDEs and builder tools.
5. Provide compatibility with AWT APIs where there is overlapping, to leverage the AWT knowledge base and ease porting.
3.5 SQL
SQL is a relational database management system (RDBMS) which has more than 6 million installations. The program runs as a server providing multi-user access to a number of databases. The project's source code is available under terms of the GNU General Public License, as well as under a variety of proprietary agreements. SQL is owned and sponsored by a single for-profit firm, the Swedish company SQL AB, now a subsidiary of Sun Microsystems, which holds the copyright to most of the codebase. On April 20th, 2009 Oracle Corp., which develops and sells the proprietary Oracle database, announced a deal to acquire Sun Microsystems.
3.5.1 Java Database Connectivity (JDBC)
JDBC is an API for the Java programming language that defines how a client may access a database. It provides methods for querying and updating data in a database. JDBC is oriented towards relational databases. The Java 2 Platform, Standard Edition, version 1.4 (J2SE) includes the JDBC 3.0 API together with a reference implementation JDBC-to-ODBC bridge, enabling connections to any ODBC-accessible data source in the JVM host environment. This bridge is native code (not Java), closed source, and only appropriate for experimental use and for situations in which no other driver is available, not least because it provides only a limited subset of the JDBC 3.0 API, as it was originally built and shipped with JDBC 1.0 for use with old ODBC v2.0 drivers (ODBC v3.0 was released in 1996).
3.6 Edit Plus 3.0
Edit Plus 3.0 refers to both a platform for the development of applications for the network (using Java, JavaScript, PHP, Python, Ruby, Groovy, C, and C++), and an integrated development environment (IDE) developed using the Edit Plus 3.0 Platform. The Edit Plus 3.0 Platform allows applications to be developed from a set of modular software components called modules. A module is a Java archive file that contains Java classes written to interact with the Edit Plus 3.0 Open APIs and a manifest file that identifies it as a module. Applications built on modules can be extended by adding new modules. Since modules can be developed independently, applications based on the Edit Plus 3.0 platform can be extended by third party developers.
3.6.1 Edit Plus IDE
The Edit Plus IDE is an open-source integrated development environment written entirely in Java using the Edit Plus Platform. Edit Plus IDE supports development of all Java application types (Java SE, web, EJB and mobile applications) out of the box. Among other features are an Ant-based project system, version control and refactoring.
Modularity: All the functions of the IDE are provided by modules. Each module provides a well defined function, such as support for the Java language, editing, or support for the CVS versioning system, and SVN. Edit Plus contains all the modules needed for Java development in a single download, allowing the user to start working immediately. Modules also allow Edit Plus to be extended. New features, such as support for other programming languages, can be added by installing additional modules. For instance, Sun Studio, Sun Java Studio Enterprise, and Sun Java Studio Creator from Sun Microsystems are all based on the Edit Plus IDE. These modules are part of the core Edit Plus IDE:
CHAPTER- 4
SOFTWARE REQUIREMENT SPECIFICATION
A software requirement specification (SRS) is a comprehensive description of the intended purpose and environment for software under development. The SRS fully describes what the software will do and how it will be expected to perform. An SRS minimizes the time and effort required by developers to achieve desired goals and also minimizes the development cost. A good SRS defines how an application will interact with the system hardware, other programs and human users in a wide variety of real-world situations. Parameters such as operating speed, response time, availability, portability, maintainability, foot print, security and speed of recovery from adverse events are evaluated.
4.1 Purpose
Time Division Multiplexed Access (TDMA) eliminates mediated access by assigning each station in the network a time slice during which it may transmit. No arbitration is required once a slot is assigned to a station. TDMA is a good way to handle media access in long distance networks but it does potentially increase packet latency and waste bandwidth because stations can transmit only during their time slot. To mitigate the latency problem one can use short time slots. It is possible to reduce unused bandwidth by dynamically assigning slots and/or changing their size but this can significantly increase complexity and overhead. In general the balance between latency and throughput means the time slot configuration in a TDMA network should be chosen according to the needs of applications (e.g. latency must be low enough for packetized voice data).
4.2 Scope
In sensor networks however often data are transferred from the sensor nodes to a few central data collectors. The scheduling problem is therefore to determine the smallest length conflict-free assignment of slots during which the packets generated at each node reach their destination.
4.3 Functional Requirements
• In this project the image retrieval accuracy should be high and efficient.
• The user interface should be user friendly, it must be developed using java.swing and java.awt packages
• For Database connectivity java.sql package should be used and exception should be handled properly in order to avoid abnormal termination while execution of the application.
• It should provide a button to start the service. If user not clicked on start button the error message should be displayed.
• Sink node must be created to collect the weather, pressure and temperature data.
• Cluster header node should be created to send the data.
• To send the data the shortest path should be found.
4.4 Non Functional Requirements
1. Usability
The system is designed with completely automated process hence there is no or less user intervention.
2. Reliability
The system is more reliable because of the qualities that are inherited from the chosen platform java. The code built by using java is more reliable.
3. Supportability
The system is designed to be the cross platform supportable. The system is supported on a wide range of hardware and any software platform, which is having JVM, built into the system.
4. Interface
The user interface is should be based on Java Swings
3.4. Assumptions and dependencies
The following assumptions have been made in the development of our project:
• One sink node and six other cluster node is considered, also assumption is cluster header node collected the data from other nodes.
• The project work also assumes for all sensors have the same availability probability.
Dependencies:
• The project work is basically the framework application which requires proper Java environment installation.
• Proper configuration of the network has to be done before executing the application.
4.5 System Requirements
4.5.1 Hardware Requirements
• Pentium 4 2.66 Ghz/AMD Athlon 2800+ processor.
• 256MB RAM (Minimum)/512MB RAM (Recommended).
• 40 GB+ Hard Disk.
• Color Monitor.
4.5.2 Software Requirements
• JDK 1.5 and above version
• MS-Access 2003 or above version
4.5.3 Operating System
• The operating system used is Windows XP to develop and to run the application we have developed.
4.6 Feasibility Study
During this study an estimate is made whether the identified user needs can be satisfied using current software and hardware technologies.
4.6.1 Technical Feasibility
The software and hardware requirements of this project can be easily satisfied also the user interface is simple, hence it is technically feasible.
4.6.2 Economical Feasibility
Economical Feasibility considers the facts such as whether the benefits will exceed its costs, and whether the resources are cost effective. This project was also considered economically feasible as the software and hardware components can easily be developed within the existing budgetary constraints.
CHAPTER 5
SYSTEM DESIGN
5.1 High Level Design
The purpose of the design phase is to plan a solution of the problem specified by the requirement document. This phase is the first step in moving from the problem domain to the solution domain. The design of the system is perhaps the most critical factor affecting the quality of the software. Here we build the System Block Diagram that will be helpful to understand the behavior of the system. Here we divide problem into modules. Data flow Diagrams show flow of data between/among modules.
This chapter presents the following
• Design Considerations: - This section describes many issues, which need to be addressed or resolved before attempting to device a complete design solution.
• General Constraints
• Development Methods
• System Architecture: - This section describes the DFDs, which are the root part for any design
5.2 Design Considerations
The purpose of the design is to plan the solution of a problem specified by the requirements document. This phase is the first step in moving from problem to the solution domain. In other words, starting with what is needed design takes us to work how to satisfy the needs. The design of the system is perhaps the most critical factor affecting the quality of the software and has a major impact on the later phases, particularly testing and maintenance. System design aims to identify the modules that should be in the system, the specifications of these modules and to interact with each other to produce the desired results. At the end of the system design all the major data structures, file formats, output formats as well as major modules in the system and their specifications are decided.
Development Methods
The project work is using the Waterfall lifecycle model for the development of the project. The Waterfall model is an activity centered lifecycle model first developed by Royce. The approach of the Waterfall model is in a step-by-step way where all the requirements of one activity are completed before the design of the activity is started. The entire project design is broken down into several small tasks in order of precedence and these tasks are designed one by one making sure they work perfectly. Once one of these small tasks is completed another task, which is dependent on the completed task, can be started. Each step after being completed is verified to ensure the task is working, error-free and meeting all the requirements.
The project work chose this lifecycle model for the project primarily for two reasons. First reason being simplicity, by using the Waterfall model the entire project can be broken down into smaller activities which can be converted relatively easily into code and once the entire thing is combined the code for the project can be derived. The second reason is because of the verification step required by the Waterfall model it would be ensured that a task is error free before other tasks that are dependent on it are developed. Thus chances of an error remaining somewhere high up in the task hierarchy are relatively low.
5.3 Data flow diagrams
Data flow models are an intuitive way of showing how data is processed by a system. At the analysis level, they should be used to model the way in which data is processed in the existing system. The notations used in these models represents functional processing, data stores and data movements between functions. Data flow models are used to show how data flows through a sequence of processing steps. The data is transferred at each step before moving on to the next stage. These processing steps or transformations are program functions when data flow diagrams are used to explain a software design.
Data Flow Diagram:
use case Diagram:
Sequence Diagram:
A sequence diagram in Unified Modeling Language (UML) is a kind of interaction diagram that shows how processes operate with one another and in what order. It is a construct of a Message Sequence Chart. Sequence diagrams are sometimes called Event-trace diagrams, event scenarios, and timing diagrams. A sequence diagram shows, as parallel vertical lines (lifelines), different processes or objects that live simultaneously, and, as horizontal arrows, the messages exchanged between them, in the order in which they occur. This allows the specification of simple runtime scenarios in a graphical manner.
CHAPTER- 6
IMPLEMENTATION
Implementation is the stage of the project when the theoretical design is turned out into a working system. Thus it can be considered to be the most critical stage in achieving a successful new system and in giving the user, confidence that the new system will work and be effective. The implementation stage involves careful planning, investigation of the existing system and it’s constraints on implementation, designing of methods to achieve changeover and evaluation of changeover methods.
Implementation of any software is always preceded by important decisions regarding selection of the platform, the language used, etc. these decisions are often influenced by several factors such as real environment in which the system works, the speed that is required, the security concerns, and other implementation specific details. There are three major implementation decisions that have been made before the implementation of this project. They are as follows:
1. Selection of the platform (Operating System).
2. Selection of the programming language for development of the application.
3. Coding guideline to be followed.
6.1 Selection of the platform
Windows® XP provides the most dependable version of Windows ever—with the best security and privacy features Windows has ever provided. Overall, security has been improved in Windows XP to help you have a safe, secure, and private computing experience. Windows XP is available in two editions—Windows XP Home Edition for home use, and Windows XP Professional for businesses of all sizes. Security features in Windows XP Home Edition make it even safer for you to shop and browse on the Internet. Windows XP Home Edition comes with built-in Internet Connection Firewall software that provides you with a resilient defense to security threats when you're connected to the Internet—particularly if you use always-on connections such as cable modems and DSL. Windows XP Professional includes all of the security capabilities of Windows XP Home Edition, plus other security management features. These important new security features will reduce your IT costs and enhance the security of your business systems. Windows XP Home Edition security services have been designed to be flexible, and take into account a wide variety of security and privacy situations that you'll face as a home user. If you are already familiar with the security model in Microsoft® Windows NT® version 4.0 and Microsoft® Windows® 2000, you will recognize many of the security features in Windows XP Home Edition. At the same time, you will also find a number of familiar features that have changed significantly, along with new features that will improve your ability to manage system security. For example, if you use the Internet to chat online or to send and receive e-mail, you may be vulnerable to hacker attacks.
Each of the Windows XP security features, ACLS, security groups, and Group Policy, have default settings that can be modified to suit a particular organization. Businesses can also make use of relevant tools to implement and modify access control. Many of these tools, such as the Microsoft Management Console snap-ins, are components of Windows XP Professional. Other tools are included with the Windows XP Professional Resource Kit. Working with Wireless Sensor Network requires to be working on platform which is quite easy as well as user friendly. This is the reason why windows XP is selected as a preferred platform for designing this project work.
6.2 Selection of Language
For the implementation of our project we need flexible systems implementation language. Compilation should be relatively straightforward compiler, provide low-level access to memory, provide language constructs that map efficiently to machine instructions, and require minimal run-time support. Program should be compiled for a very wide variety of computer platforms and operating systems with minimal change to its source code. For Graphical User Interface programming, language chosen must be simple to uses, secure, architecture neutral and portable. Additional requirements of GUI are: 1) User interface management: Windows, menus, toolbars and other presentation components be supported by the language.2) Data and presentation management: language must contains a rich toolset for presenting data to the user and manipulating that data. 3) The Editor: The language should have a editor, a powerful and extensible toolset for building custom editors. 4) The Wizard framework: A toolset for easily building extensible, user-friendly Wizards to guide users through more complex tasks. 5) Configuration management: Rather than tediously write code to access remote data and manage and save user-configurable settings, etc., all of this is can be well handled by NetBeans in Java Swing Programming Language. Therefore Java Swing is chosen for the GUI development.
6.3 Coding guidelines
The following are the guidelines followed during the implementation of the project.
• Initialize all member data and local variables. All pointers should be initialized to appropriate values or NULL.
• A counter variable which is used only in for loop should be initialized in that loop, rather than at the top of the function, whereas, variables declared inside nested loops will be repeatedly constructed and destructed. In cases where construction or destruction is expensive, it may be preferable to declare the variable outside the loop.
• Use tracing statements at critical points in the code.
• For all the data types type definitions are used.
• All the message formats are stored in header file.
• All the functions should not exceed more than 100 lines.
• Function pointers are not used.
• All the code should be properly indented
• Use conditional compilation statements wherever required.
Module Description:
1. Networking Module:
Server- Client computing or networking is a distributed application architecture that partitions tasks or workloads between service providers (servers) and service requesters, called clients. Often clients and servers operate over a computer network on separate hardware. A server machine is a high-performance host that is running one or more server programs which share its resources with clients. A client also shares any of its resources; Clients therefore initiate communication sessions with servers which await (listen to) incoming requests.
public void fun1()
{
String ip, req = "req";
int port;
DataOutputStream obop1=null,obop3=null,obop4=null,obop5=null,obop6=null,obop7=null;
try{
System.out.println("inside search action");
PreparedStatement pst=conn.prepareStatement("select * from nodeinfo where node=?");
pst.setString(1,"node1");
ResultSet rs=pst.executeQuery();
while(rs.next())
{
port=rs.getInt(2);
ip = rs.getString(3);
try{
soc1=new Socket(ip,port);
obop1=new DataOutputStream(soc1.getOutputStream());
//System.out.println("server accepted and communicating with the server");
//System.out.println("requesting header node");
obop1.writeUTF("Connecthon established");
System.out.println("request sent "+req);
}
catch(Exception ee)
{
System.out.println(ee);
}
}
}
catch(Exception e)
{
}
try{
System.out.println("inside search action");
PreparedStatement pst=conn.prepareStatement("select * from nodeinfo where node=?");
pst.setString(1,"node3");
ResultSet rs=pst.executeQuery();
while(rs.next())
{
port=rs.getInt(2);
ip = rs.getString(3);
try{
soc3=new Socket(ip,1234);
obop3=new DataOutputStream(soc3.getOutputStream());
//System.out.println("server accepted and communicating with the server");
//System.out.println("requesting header node");
obop3.writeUTF("Connecthon established");
System.out.println("request sent "+req);
}
catch(Exception ee)
{
System.out.println(ee);
}
}
}
catch(Exception e)
{
}
Tdma module
String token[]= new String[8];
for(int i=1;i<=7;i++)
token[i]="false";
int time[]=new int[8];
for(int i=1;i<=7;i++)
time[i]=10000;
int i=1;
for(;
{
try
{
token[i]="true";
obop1.writeUTF(token[1]);
obop3.writeUTF(token[3]);
obop4.writeUTF(token[4]);
obop5.writeUTF(token[5]);
obop6.writeUTF(token[6]);
obop7.writeUTF(token[7]);
Thread.sleep(time[i]);
token[i]="false";
if(clusterstatus[i]!=1)
{
if(time[i]!=0)
{
time[i]=time[i]-10;
}
}
for(int i1=0;i1<=7;i1++)
clusterstatus[i1]=0;
i++;
if(i==2)
i++;
if(i>7)
i=1;
System.out.println("the status of the time array\n");
for(int i1=0;i1<=7;i1++){
System.out.println("the amout of time left for cluster head "+i1 +time[i1]);
}
// System.out.println(time[i1]+" ");
this.setVisible(true);
}
catch (Exception e)
{
}
2. Service Module:
In the literature, time division multiple access (TDMA) and carrier sensing multiple access (CSMA) are two major medium access approaches in WSNs. This work will only focus on the TDMA approach because the scenario specification of our research is a static network in which TDMA is said to be more effective than CSMA, especially under medium to high traffic load. TDMA schedules with optimized power consumption and minimum latency in clustered WSNs. Energy efficiency is a major concern in WSNs, since the batteries are often impossible to be replaced or recharged in many cases. In TDMA, a node can be active only if it is scheduled to send or receive data, which give it advantages in power efficiency. In the literature, the medium access control (MAC) protocol of many WSN and ad hoc network proposals is TDMA based cross-layer design is further adopted to achieve least energy consumption in WSNs.
Node1()
{
this.setTitle("Cluster Head 1");
c=this.getContentPane();
c.setLayout(null);
source=curnode;
label1 = new JLabel();
jb4=new JButton(" Search ");
jb5=new JButton(" Clear ");
jb6=new JButton(" Exit ");
jc1=new JComboBox();
jc1.addItem("select an option");
jc1.addItem("wheather");
jc1.addItem("presure");
jc1.addItem("Temperature");
jta1=new JTextArea();
label1.setText(" Select the Type ");
text1 = new JTextField(15);
label2 = new JLabel();
label2.setText("Search Word");
jsp1=new JScrollPane(jta1);
label3 = new JLabel();
label3.setText("searching for events");
label1.reshape(35,30,150,25);
jc1.reshape(200,30,120,25);
label2.reshape(35,70,150,25);
text1.reshape(200,70,120,25);
jb1.reshape(30,150,170,35);
jb2.reshape(280,150,170,35);
jb3.reshape(30,200,170,35);
jb4.reshape(280,200,170,35);
label3.reshape(30,270,150,20);
jsp1.reshape(20,300,450,200);
jb5.reshape(40,520,170,35);
jb6.reshape(270,520,170,35);
jb1.setEnabled(true);
jb4.setEnabled(true);
jb2.setEnabled(true);
this.addWindowListener( new WindowAdapter() {
public void windowClosing( WindowEvent we ) {
System.out.println("window is closing");
dispose();
System.exit( 0 );
}
} );
c.add(label1);
c.add(label3);
c.add(jsp1);
c.add(jb5);
c.add(jb6);
c.add(jc1);
this.setSize(500,600);
this.setVisible(true);
jb1.addActionListener(this);
jb2.addActionListener(this);
jb3.addActionListener(this);
jb4.addActionListener(this);
jb5.addActionListener(this);
jb6.addActionListener(this);
jc1.addActionListener(this);
thread1();
}
To achieve the paper’s objective, we propose a two-step approach to derive TDMA schedules supporting both high energy efficiency and minimum delay in WSNs. In the first step, we formulate the problem via cross-layer optimization, aiming at deriving the most energy-efficient flows on every link. Based on the calculated per-link flows, in the second step, we propose an algorithm to obtain a TDMA schedule with the least frame length guarantees minimum delay for the derived TDMA schedules.
3. System Model:
MAC Layer: TDMA scheme is the MAC layer protocol employed during the data relay phase. A TDMA frame consists of a number of slots, each with fixed length assume that NACKs and retransmissions are used at the MAC layer. However, to simplify the analysis and the scheduling algorithm, we neglect the cost of NACKs by assuming that a NACK is only generated once in each fixed feedback period to inform the source nodes of packets not correctly received in the last period. By properly setting the feedback period, energy cost of NACKs is negligible compared to that of data packets loss rate, the per-hop average number of total transmissions for a packet to be successfully received.
Cross-Layer Optimization: A cross layer Optimization model is the per bit average transmission energy consumed at node when transmitting to node using Transmission power is the packet loss rate on link is the data flow rate (in bits per second) from node. Which is composed of transmission and receiving mode energy consumption at all backbone nodes excluding the sink (the energy consumed at the sink is neglected because its power source is replaceable), and the energy consumed by each active sensor node (cluster member) in sensing and transmitting the data to its CH. Note that retransmissions are ignored for the intra cluster. The optimization model depicted by is cross-layer based because it jointly combines network layer traffic loads, MAC layer retransmission scheme, and physical layer modulation scheme and bit error rate together, in order to derive appropriate transmission power and flow rate at every link.
4. Graphical Module:
We have formulated the optimization problem, and developed the algorithm that solves it by the dual optimization techniques. It is shown that the proposed algorithm meets well its design goal and outperforms MAC in terms of the packet drop rate of the CSMA users and the throughput of the TDMA users.
Sink()
{
this.setTitle("Sink Node");
c=this.getContentPane();
c.setLayout(null);
source=curnode;
for(int i=0;i<=7;i++)
clusterstatus[i]=0;
label1 = new JLabel();
jb4=new JButton(" Start ");
jb5=new JButton(" Clear ");
jb6=new JButton(" Exit ");
jta1=new JTextArea();
label1.setText(" Select the Header Node ");
text1 = new JTextField(15);
label2 = new JLabel();
label2.setText("Search Word");
jsp1=new JScrollPane(jta1);
label3 = new JLabel();
label3.setText(" Monitor&Result window ");
label1.reshape(35,30,150,25);
jc1.reshape(200,30,