A Distributed Optimal Framework For Mobile Data
A Distributed Optimal Framework For Mobile Data
Abstract
We look at mobile data acquisition in wireless sensor networks (WSN) from a mobile
collector with multiple antennas. By considering the elastic nature of wireless link capacity, and
the power control for each sensor, data uploading, which is forced to by flow saving, energy
consumption, connection capacity, compatibility among sensors and the total residence time of
the bound mobile collector at all anchor points. We propose a polling-based mobile gathering
approach and formulate it into an optimization problem, named bounded relay hop mobile data
gathering (BRH-MDG). Centralized and Decentralized algorithms for selecting polling points
that buffer locally aggregated data and upload the data to the mobile collector when it arrives.
One of the main features of this framework is that it simultaneously enables data upload of
shorten sensors to the mobile collector to focus data collection latency and significantly reduce
the use of energy. Each sensor will be referred directly to the drain single-hop relay. It requires
large transmission power and can be feasible in large geographical areas. Sensors, which act as
relay for other sensor nodes are known as multi-hop routing in wireless sensor networks. Data
packets are forwarded to data sink through multi-hop relay between sensors. power consumption
is, while the data packets in multihop routing. To achieve this, the uniform energy consumption,
the single will hop data collection problem used (SHDGP). The Mobile data acquisition used
algorithm to find the minimal set of points in the sensor network. We also enter the part
algorithm for find the optimum residence the mobile collector at different anchor points. Finally
we have Provide numerical results show the convergence of the proposed algorithm and its
advantages over the algorithm without Simultaneous data uploading and power control in regard
to the data collecting latency and energy consumption.
Introduction:
WIRELESS sensor networks (WSNs) play an increasingly important role in a wide range of
applications, e.g., wildlife tracking, habitat monitoring and battlefield intelligence. These
applications usually involve hundreds or even thousands of sensor nodes powered by batteries
with limited energy over a large field. During the operation, sensors organize themselves into a
network and report sensing data to the sink(s) periodically. How to aggregate data from sensors
largely determines the energy consumptions of the network. WIRELESS sensor networks
(WSNs) play an increasingly important role in a wide range of applications, e.g., wildlife
tracking, habitat monitoring and battlefield intelligence. These applications usually involve
hundreds or even thousands of sensor nodes powered by batteries with limited energy over a
large field. WSNs with mobile elements (MES) for mobile data acquisition with concurrent data
upload in Wireless Sensor Networks. We specifically focus on data collection, that is, the
process that makes communication feasible between the sensor nodes and the sink. In fact, there
are many other problems that Wireless sensor nodes limited energy and efficient technologies
must be used during data collection network to maximize service life. It can be addressed by
taking advantage of mobility in WSNs.
EXISTING SYSTEM
In existing system, data gathering cost minimization framework for mobile data
gathering in wireless sensor networks by considering dynamic wireless link capacity and power
control jointly. Our new framework not only allows concurrent data uploading from sensors to
the mobile collector, but also determines transmission power under elastic link capacities. We
study the problem under constraints of flow conservation, energy consumption, elastic link
capacity, transmission compatibility, and sojourn time. We employ the subgradient iteration
algorithm to solve the minimization problem. We first relax the problem with Lagrangian
dualization, then decompose the original problem into several subproblems, and present
distributed algorithms to derive data rate, link flow and routing, power control, and transmission
compatibility. For the mobile collector, subalgorithm to determine sojourn time at different
stopping locations is used.
DISADVANTAGES
The cost function used may not completely reflect the overall pricing structure in the
network.
PROPOSED SYSTEM
We have proposed a WSNs with mobile elements (MES) for mobile data acquisition with
concurrent data upload in Wireless Sensor Networks. We specifically focus on data collection,
that is, the process that makes communication feasible between the sensor nodes and the sink. In
fact, there are many other problems that can be addressed by taking advantage of mobility in
WSNs. Wireless sensor nodes limited energy and efficient technologies must be used during data
collection network to maximize service life. One of the main features of the framework is that it
is simultaneous data upload of sensors to the mobile collector allows sharp data acquisition
latency and significantly reduce energy consumption through the use of multiple antennas and
space-division multiple access technique to shorten. We also give the sub-algorithm for fi the
optimal timing of the mobile collector at different anchor points ends. Finally, we provide
numerical results, the convergence of the proposed Da GCM algorithm and its advantages over
the algorithm without simultaneous data upload and power control with respect to the data
collection to demonstrate latency and power consumption.
Advantages
1. Sparse WSN – Since the nodes are mobile we can manage with fewer nodes. So sparse WSN
becomes a feasible option.
2. Less Cost – Since fewer nodes can be deployed, the network cost reduces. We can make use
of mobile elements already present like moving vehicles, public transport etc. to transport data,
3. More Reliable – Data loss is reduced as the mobile elements visit the nodes to collect data
directly through single- hop transmission as opposed to multi-hop transmissions. Interferences
and collisions are avoided.
4. Funneling effect avoided – In traditional networks, the nodes near the sink are overloaded as
they have to relay the data to the sink node. By making use of mobile collectors we can ensure
that energy consumption is more uniform, since the mobile element collects the information by
visiting the node.
5. Improved Coverage – Since the data collector is mobile it has improved coverage and it also
has the additional advantage of connecting disconnected networks.
LIST OF MODULES
1. Re-locatable node
2. Data transfer follows discovery
3. Mobile Data Collectors (MDCs)
3.1. Mobile Sinks
3.2. Mobile Relays
4 Mobile peers
MODULES DESCRIPTION
Re-locatable node
These nodes change their location to forward data to the destination. They do not carry
any information in contrast to mobile nodes. They change the topology of the network.
Predefined Intelligent Lightweight tOpology managemenT (PILOT) nodes are used during link
failure to re-establish connectivity in network. They act as bridges when nodes are unstable.
Algorithms for placement of re-locatable nodes in order to improve the network connectivity.
Data transfer follows discovery
The goal of the data transfer protocols is to maximize the throughput in terms of
messages successfully transferred per contact – while minimizing the energy consumption. After
the presence of an ME has been detected, actual data transfer has to be accomplished by using a
data collection protocol. By data transfer, we mean the communication process between an ME
and its one-hop neighbors. As a consequence, data transfer protocols have to be aware of the
issues which result from mobility. In fact, the communication process is influenced, not only by
the conditions prevalent in the channel, but also by the distance between the source and the
receiver, which changes based on their speed.
Mobile Data Collectors (MDCs)
They visit each node and gather data. They can be mobile sinks or mobile relays.
1. Mobile Sinks
These mobile nodes are the destination and have high energy. They move around and collect
data. The collected data can be made available to users using wireless internet connection. The
path between the sink and node is not fixed and changes with time. Path between node and sink
is multi–hop.
2. Mobile Relays
The MULEs pass through the network collect the data from the sensor nodes and when
they to near the sink they pass the collected data to the sink. The MULEs move in straight line
and to reduce delay the data can be relayed by other nodes to reach the sink. If obstacles are
present then the MULE will not be able to move along a straight line. When there are only a few
MULEs and when all sensors are not connected, data MULEs may not cover all sensors by
navigating along a straight line. A message ferrying scheme provide the relaying of messages in
sparse and mobile networks. Message ferries move through the field and get data from nodes.
Message ferries can be thought of as a moving communication infrastructure which allows data
communication in wireless networks that are sparse. Mobile Data Collectors called M-Collectors
were proposed. Here M-Collector will move through the network and gather information. This is
called as M-Collector tour and it is based on the optimal path as found out by a variant of the
spanning tree algorithm called spanning tree covering algorithm.
Mobile peers
Mobile peers are ordinary mobile sensor nodes in WSN-MEs. They can be the source or
they can be used to relay the messages in the network. Mobile peers are depicted Their
interactions are symmetrical because the sink itself might also be mobile. When a peer node is in
communication range, it can transfer its own data and it can gather data from the other peer
nodes while moving in the sensing area. Mobile peers have been successfully employed in the
context of wildlife monitoring applications, such as tracking of zebras . Sensor nodes are
attached to animals and act as peers, so they generate data and also carry and forward all data
coming from other nodes which they have been in contact with earlier. When mobile peers get
near a base station, they push all the gathered data. Redundant data are discarded by peers in
order to save storage. The problem with using animals to collect the data is that the movement is
unpredictable. This can be avoided by using a predictable robot or vehicle as suggested in the
Mobile peers can also be used for data collection in urban sensing scenarios.
System Configuration
Software Specification
Hardware Specification
Processor : Pentium IV
RAM : 512 MB
Software Environment
Java Technology
Simple
Architecture neutral
Object oriented
Portable
Distributed
High performance
Interpreted
Multithreaded
Robust
Dynamic
Secure
With most programming languages, you either compile or interpret a program so that you
can run it on your computer. The Java programming language is unusual in that a program is
both compiled and interpreted. With the compiler, first you translate a program into an
intermediate language called Java byte codes —the platform-independent codes interpreted by
the interpreter on the Java platform. The interpreter parses and runs each Java byte code
instruction on the computer. Compilation happens just once; interpretation occurs each time the
program is executed. The following figure illustrates how this works.
You can think of Java byte codes as the machine code instructions for the Java Virtual
Machine (Java VM). Every Java interpreter, whether it’s a development tool or a Web browser
that can run applets, is an implementation of the Java VM. Java byte codes help make “write
once, run anywhere” possible. You can compile your program 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.
That means that as long as a computer has a Java VM, the same program written in the Java
programming language can run on Windows 2000, a Solaris workstation, or on an iMac.
Native code is code that after you compile it, the compiled code runs on a specific
hardware platform. As a platform-independent environment, the Java platform can be a
bit slower than native code. However, smart compilers, well-tuned interpreters, and just-
in-time byte code compilers can bring performance close to that of native code without
threatening portability.
What Can Java Technology Do?
The most common types of programs written in the Java programming language are
applets and applications. If you’ve surfed the Web, you’re probably already familiar with
applets. An applet is a program that adheres to certain conventions that allow it to run
within a Java-enabled browser.
However, the Java programming language is not just for writing cute, entertaining applets
for the Web. The general-purpose, high-level Java programming language is also a
powerful software platform. Using the generous API, you can write many types of
programs.
An application is a standalone program that runs directly on the Java platform. A special
kind of application known as a server serves and supports clients on a network. Examples
of servers are Web servers, proxy servers, mail servers, and print servers. Another
specialized program is a servlet. A servlet can almost be thought of as an applet that runs
on the server side. Java Servlets are a popular choice for building interactive web
applications, replacing the use of CGI scripts. Servlets are similar to applets in that they
are runtime extensions of applications. Instead of working in browsers, though, servlets
run within Java Web servers, configuring or tailoring the server.
How does the API support all these kinds of programs? It does so with packages of
software components that provides a wide range of functionality. Every full
implementation of the Java platform gives you the following features:
The essentials: Objects, strings, threads, numbers, input and output, data
structures, system properties, date and time, and so on.
Applets: The set of conventions used by applets.
Networking: URLs, TCP (Transmission Control Protocol), UDP (User Data gram
Protocol) sockets, and IP (Internet Protocol) addresses.
Internationalization: Help for writing programs that can be localized for users
worldwide. Programs can automatically adapt to specific locales and be displayed
in the appropriate language.
Security: Both low level and high level, including electronic signatures, public
and private key management, access control, and certificates.
Software components: Known as JavaBeansTM, can plug into existing component
architectures.
Object serialization: Allows lightweight persistence and communication via
Remote Method Invocation (RMI).
Java Database Connectivity (JDBCTM): Provides uniform access to a wide
range of relational databases.
The Java platform also has APIs for 2D and 3D graphics, accessibility, servers,
collaboration, telephony, speech, animation, and more. The following figure depicts what
is included in the Java 2 SDK.
How Will Java Technology Change My Life?
We can’t promise you fame, fortune, or even a job if you learn the Java programming
language. Still, it is likely to make your programs better and requires less effort than
other languages. We believe that Java technology will help you do the following:
Get started quickly: Although the Java programming language is a powerful
object-oriented language, it’s easy to learn, especially for programmers already
familiar with C or C++.
Write less code: Comparisons of program metrics (class counts, method counts,
and so on) suggest that a program written in the Java programming language can
be four times smaller than the same program in C++.
Write better code: The Java programming language encourages good coding
practices, and its garbage collection helps you avoid memory leaks. Its object
orientation, its JavaBeans component architecture, and its wide-ranging, easily
extendible API let you reuse other people’s tested code and introduce fewer bugs.
Develop programs more quickly: Your development time may be as much as
twice as fast versus writing the same program in C++. Why? You write fewer
lines of code and it is a simpler programming language than C++.
Avoid platform dependencies with 100% Pure Java: You can keep your
program portable by avoiding the use of libraries written in other languages. The
100% Pure JavaTM Product Certification Program has a repository of historical
process manuals, white papers, brochures, and similar materials online.
Write once, run anywhere: Because 100% Pure Java programs are compiled into
machine-independent byte codes, they run consistently on any Java platform.
Distribute software more easily: You can upgrade applets easily from a central
server. Applets take advantage of the feature of allowing new classes to be loaded
“on the fly,” without recompiling the entire program.
ODBC
Microsoft Open Database Connectivity (ODBC) is a standard programming interface for
application developers and database systems providers. Before ODBC became a de facto
standard for Windows programs to interface with database systems, programmers had to use
proprietary languages for each database they wanted to connect to. Now, ODBC has made the
choice of the database system almost irrelevant from a coding perspective, which is as it should
be. Application developers have much more important things to worry about than the syntax that
is needed to port their program from one database to another when business needs suddenly
change.
Through the ODBC Administrator in Control Panel, you can specify the particular
database that is associated with a data source that an ODBC application program is written to
use. Think of an ODBC data source as a door with a name on it. Each door will lead you to a
particular database. For example, the data source named Sales Figures might be a SQL Server
database, whereas the Accounts Payable data source could refer to an Access database. The
physical database referred to by a data source can reside anywhere on the LAN.
The ODBC system files are not installed on your system by Windows 95. Rather, they
are installed when you setup a separate database application, such as SQL Server Client or
Visual Basic 4.0. When the ODBC icon is installed in Control Panel, it uses a file called
ODBCINST.DLL. It is also possible to administer your ODBC data sources through a stand-
alone program called ODBCADM.EXE. There is a 16-bit and a 32-bit version of this program
and each maintains a separate list of ODBC data sources.
From a programming perspective, the beauty of ODBC is that the application can be
written to use the same set of function calls to interface with any data source, regardless of the
database vendor. The source code of the application doesn’t change whether it talks to Oracle or
SQL Server. We only mention these two as an example. There are ODBC drivers available for
several dozen popular database systems. Even Excel spreadsheets and plain text files can be
turned into data sources. The operating system uses the Registry information written by ODBC
Administrator to determine which low-level ODBC drivers are needed to talk to the data source
(such as the interface to Oracle or SQL Server). The loading of the ODBC drivers is transparent
to the ODBC application program. In a client/server environment, the ODBC API even handles
many of the network issues for the application programmer.
The advantages of this scheme are so numerous that you are probably thinking there must
be some catch. The only disadvantage of ODBC is that it isn’t as efficient as talking directly to
the native database interface. ODBC has had many detractors make the charge that it is too slow.
Microsoft has always claimed that the critical factor in performance is the quality of the driver
software that is used. In our humble opinion, this is true. The availability of good ODBC drivers
has improved a great deal recently. And anyway, the criticism about performance is somewhat
analogous to those who said that compilers would never match the speed of pure assembly
language. Maybe not, but the compiler (or ODBC) gives you the opportunity to write cleaner
programs, which means you finish sooner. Meanwhile, computers get faster every year.
JDBC
In an effort to set an independent database standard API for Java; Sun Microsystems
developed Java Database Connectivity, or JDBC. JDBC offers a generic SQL database access
mechanism that provides a consistent interface to a variety of RDBMSs. This consistent interface
is achieved through the use of “plug-in” database connectivity modules, or drivers. If a database
vendor wishes to have JDBC support, he or she must provide the driver for each platform that the
database and Java run on.
To gain a wider acceptance of JDBC, Sun based JDBC’s framework on ODBC. As you
discovered earlier in this chapter, ODBC has widespread support on a variety of platforms.
Basing JDBC on ODBC will allow vendors to bring JDBC drivers to market much faster than
developing a completely new connectivity solution.
JDBC was announced in March of 1996. It was released for a 90 day public review that
ended June 8, 1996. Because of user input, the final JDBC v1.0 specification was released soon
after.
The remainder of this section will cover enough information about JDBC for you to know what it
is about and how to use it effectively. This is by no means a complete overview of JDBC. That
would fill an entire book.
JDBC Goals
Few software packages are designed without goals in mind. JDBC is one that, because of
its many goals, drove the development of the API. These goals, in conjunction with early
reviewer feedback, have finalized the JDBC class library into a solid framework for building
database applications in Java.
The goals that were set for JDBC are important. They will give you some insight as to why
certain classes and functionalities behave the way they do. The eight design goals for JDBC are
as follows:
2. SQL Conformance
SQL syntax varies as you move from database vendor to database vendor. In an effort to
support a wide variety of vendors, JDBC will allow any query statement to be passed through
it to the underlying database driver. This allows the connectivity module to handle non-
standard functionality in a manner that is suitable for its users.
5. Keep it simple
This goal probably appears in all software design goal listings. JDBC is no exception.
Sun felt that the design of JDBC should be very simple, allowing for only one method of
completing a task per mechanism. Allowing duplicate functionality only serves to confuse
the users of the API.
And for dynamically updating the cache table we go for MS Access database.
Simple Architecture-neutral
Object-oriented Portable
Distributed High-performance
Interpreted multithreaded
Robust Dynamic
Secure
Java is also unusual in that each Java program is both compiled and interpreted.
With a compile you translate a Java program into an intermediate language called Java
byte codes the platform-independent code instruction is passed and run on the
computer.
Compilation happens just once; interpretation occurs each time the program is
executed. The figure illustrates how this works.
Compilers My Program
You can think of Java byte codes 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. You can compile
your Java program into byte codes on my platform that has a Java compiler. The byte
codes can then be run any implementation of the Java VM. For example, the same
Java program can run Windows NT, Solaris, and Macintosh.
Networking
TCP/IP stack
IP datagram’s
UDP
UDP is also connectionless and unreliable. What it adds to IP is a checksum for the
contents of the datagram and port numbers. These are used to give a client/server model
- see later.
TCP
Internet addresses
In order to use a service, you must be able to find it. The Internet uses an address
scheme for machines so that they can be located. The address is a 32 bit integer which
gives the IP address. This encodes a network ID and more addressing. The network ID
falls into various classes according to the size of the network address.
Network address
Class A uses 8 bits for the network address with 24 bits left over for other
addressing. Class B uses 16 bit network addressing. Class C uses 24 bit network
addressing and class D uses all 32.
Subnet address
Internally, the UNIX network is divided into sub networks. Building 11 is currently
on one sub network and uses 10-bit addressing, allowing 1024 different hosts.
Host address
8 bits are finally used for host addresses within our subnet. This places a limit of
256 machines that can be on the subnet.
Total address
The 32 bit address is usually written as 4 integers separated by dots.
Port addresses
A service exists on a host, and is identified by its port. This is a 16 bit number. To
send a message to a server, you send it to the port for that service of the host that it is
running on. This is not location transparency! Certain of these ports are "well known".
Sockets
#include <sys/types.h>
#include <sys/socket.h>
int socket(int family, int type, int protocol);
Here "family" will be AF_INET for IP communications, protocol will be zero, and
type will depend on whether TCP or UDP is used. Two processes wishing to
communicate over a network create a socket each. These are similar to two ends of a
pipe - but the actual pipe does not yet exist.
JFree Chart
JFreeChart is a free 100% Java chart library that makes it easy for developers to
display professional quality charts in their applications. JFreeChart's extensive feature set
includes:
A flexible design that is easy to extend, and targets both server-side and client-
side applications;
Support for many output types, including Swing components, image files
(including PNG and JPEG), and vector graphics file formats (including PDF, EPS and
SVG);
1. Map Visualizations
Charts showing values that relate to geographical areas. Some examples include:
(a) population density in each state of the United States, (b) income per capita for each
country in Europe, (c) life expectancy in each country of the world. The tasks in this
project include:
Sourcing freely redistributable vector outlines for the countries of the world,
states/provinces in particular countries (USA in particular, but also other areas);
Implement a new (to JFreeChart) feature for interactive time series charts --- to display a
separate control that shows a small version of ALL the time series data, with a sliding "view"
rectangle that allows you to select the subset of the time series data to display in the main
chart.
3. Dashboards
4. Property Editors
The property editor mechanism in JFreeChart only handles a small subset of the
properties that can be set for charts. Extend (or reimplement) this mechanism to provide
greater end-user control over the appearance of the charts.
Sun Microsystems defines J2ME as "a highly optimized Java run-time environment targeting a
wide range of consumer products, including pagers, cellular phones, screen-phones, digital set-
top boxes and car navigation systems." Announced in June 1999 at the JavaOne Developer
Conference, J2ME brings the cross-platform functionality of the Java language to smaller
devices, allowing mobile wireless devices to share applications. With J2ME, Sun has adapted the
Java platform for consumer products that incorporate or are based on small computing devices.
Introduction In this section, we will go over some considerations you need to keep in mind when
developing applications for smaller devices. We'll take a look at the way the compiler is invoked
when using J2SE to compile J2ME applications. Finally, we'll explore packaging and
deployment and the role preverification plays in this process.
* Keep it simple. Remove unnecessary features, possibly making those features a separate,
secondary application.
* Smaller is better. This consideration should be a "no brainer" for all developers. Smaller
applications use less memory on the device and require shorter installation times. Consider
packaging your Java applications as compressed Java Archive (jar) files.
* Minimize run-time memory use. To minimize the amount of memory used at run time, use
scalar types in place of object types. Also, do not depend on the garbage collector. You should
manage the memory efficiently yourself by setting object references to null when you are
finished with them. Another way to reduce run-time memory is to use lazy instantiation, only
allocating objects on an as-needed basis. Other ways of reducing overall and peak memory use
on small devices are to release resources quickly, reuse objects, and avoid exceptions.
4.Configurations overview
The configuration defines the basic run-time environment as a set of core classes and a specific
JVM that run on specific types of devices. Currently, two configurations exist for J2ME, though
others may be defined in the future:
* Connected Limited Device Configuration (CLDC) is used specifically with the KVM for
16-bit or 32-bit devices with limited amounts of memory. This is the configuration (and the
virtual machine) used for developing small J2ME applications. Its size limitations make CLDC
more interesting and challenging (from a development point of view) than CDC. CLDC is also
the configuration that we will use for developing our drawing tool application. An example of a
small wireless device running small applications is a Palm hand-held computer.
* Connected Device Configuration (CDC) is used with the C virtual machine (CVM) and is
used for 32-bit architectures requiring more than 2 MB of memory. An example of such a device
is a Net TV box.
5.J2ME profiles
As we mentioned earlier in this tutorial, a profile defines the type of device supported. The
Mobile Information Device Profile (MIDP), for example, defines classes for cellular phones. It
adds domain-specific classes to the J2ME configuration to define uses for similar devices. Two
profiles have been defined for J2ME and are built upon CLDC: KJava and MIDP. Both KJava
and MIDP are associated with CLDC and smaller devices. Profiles are built on top of
configurations. Because profiles are specific to the size of the device (amount of memory) on
which an application runs, certain profiles are associated with certain configurations.
A skeleton profile upon which you can create your own profile, the Foundation Profile, is
available for CDC.
Profile 1: KJava
KJava is Sun's proprietary profile and contains the KJava API. The KJava profile is built on top
of the CLDC configuration. The KJava virtual machine, KVM, accepts the same byte codes and
class file format as the classic J2SE virtual machine. KJava contains a Sun-specific API that runs
on the Palm OS. The KJava API has a great deal in common with the J2SE Abstract Windowing
Toolkit (AWT). However, because it is not a standard J2ME package, its main package is
com.sun.kjava. We'll learn more about the KJava API later in this tutorial when we develop some
sample applications.
Profile 2: MIDP
MIDP is geared toward mobile devices such as cellular phones and pagers. The MIDP, like
KJava, is built upon CLDC and provides a standard run-time environment that allows new
applications and services to be deployed dynamically on end user devices. MIDP is a common,
industry-standard profile for mobile devices that is not dependent on a specific vendor. It is a
complete and supported foundation for mobile application
development. MIDP contains the following packages, the first three of which are core CLDC
packages, plus three MIDP-specific packages.
* java.lang
* java.io
* java.util
* javax.microedition.io
* javax.microedition.lcdui
* javax.microedition.midlet
* javax.microedition.rms
SYSTEM TESTING
The purpose of testing is to discover errors. Testing is the process of trying to discover every
conceivable fault or weakness in a work product. It provides a way to check the functionality of
components, sub assemblies, assemblies and/or a finished product It is the process of exercising
software with the intent of ensuring that the software system meets its requirements and user
expectations and does not fail in an unacceptable manner. There are various types of test. Each
test type addresses a specific testing requirement.
TYPES OF TESTS
Unit testing
Unit testing involves the design of test cases that validate that the internal program logic is
functioning properly, and that program inputs produce valid outputs. All decision branches and
internal code flow should be validated. It is the testing of individual software units of the
application .it is done after the completion of an individual unit before integration. This is a
structural testing, that relies on knowledge of its construction and is invasive. Unit tests perform
basic tests at component level and test a specific business process, application, and/or system
configuration. Unit tests ensure that each unique path of a business process performs accurately
to the documented specifications and contains clearly defined inputs and expected results.
Integration testing
Integration tests are designed to test integrated software components to determine if they
actually run as one program. Testing is event driven and is more concerned with the basic
outcome of screens or fields. Integration tests demonstrate that although the components were
individually satisfaction, as shown by successfully unit testing, the combination of components is
correct and consistent. Integration testing is specifically aimed at exposing the problems that
arise from the combination of components.
Functional test
Functional tests provide systematic demonstrations that functions tested are available as
specified by the business and technical requirements, system documentation, and user manuals.
System Testing
System testing ensures that the entire integrated software system meets requirements. It tests a
configuration to ensure known and predictable results. An example of system testing is the
configuration oriented system integration test. System testing is based on process descriptions
and flows, emphasizing pre-driven process links and integration points.
Unit Testing:
Unit testing is usually conducted as part of a combined code and unit test phase of the
software lifecycle, although it is not uncommon for coding and unit testing to be conducted as
two distinct phases.
Test objectives
All field entries must work properly.
Pages must be activated from the identified link.
The entry screen, messages and responses must not be delayed.
Features to be tested
Verify that the entries are of the correct format
No duplicate entries should be allowed
All links should take the user to the correct page.
Integration Testing
Software integration testing is the incremental integration testing of two or more
integrated software components on a single platform to produce failures caused by interface
defects.
The task of the integration test is to check that components or software applications, e.g.
components in a software system or – one step up – software applications at the company level –
interact without error.
Test Results: All the test cases mentioned above passed successfully. No defects encountered.
Acceptance Testing
User Acceptance Testing is a critical phase of any project and requires significant
participation by the end user. It also ensures that the system meets the functional requirements.
Test Results: All the test cases mentioned above passed successfully. No defects encountered.
SYSTEM STUDY
FEASIBILITY STUDY
The feasibility of the project is analyzed in this phase and business proposal is put forth
with a very general plan for the project and some cost estimates. During system analysis the
feasibility study of the proposed system is to be carried out. This is to ensure that the proposed
system is not a burden to the company. For feasibility analysis, some understanding of the major
requirements for the system is essential.
Three key considerations involved in the feasibility analysis are
ECONOMICAL FEASIBILITY
TECHNICAL FEASIBILITY
SOCIAL FEASIBILITY
ECONOMICAL FEASIBILITY
This study is carried out to check the economic impact that the system will have on the
organization. The amount of fund that the company can pour into the research and development
of the system is limited. The expenditures must be justified. Thus the developed system as well
within the budget and this was achieved because most of the technologies used are freely
available. Only the customized products had to be purchased.
TECHNICAL FEASIBILITY
This study is carried out to check the technical feasibility, that is, the technical requirements
of the system. Any system developed must not have a high demand on the available technical
resources. This will lead to high demands on the available technical resources. This will lead to
high demands being placed on the client. The developed system must have a modest
requirement, as only minimal or null changes are required for implementing this system.
SOCIAL FEASIBILITY
The aspect of study is to check the level of acceptance of the system by the user. This
includes the process of training the user to use the system efficiently. The user must not feel
threatened by the system, instead must accept it as a necessity. The level of acceptance by the
users solely depends on the methods that are employed to educate the user about the system and
to make him familiar with it. His level of confidence must be raised so that he is also able to
make some constructive criticism, which is welcomed, as he is the final user of the system.
IMPLEMENTATION
It making the new system available to a prepared set of users (the deployment), and
positioning on-going support and maintenance of the system within the Performing Organization
(the transition). At a finer level of detail, deploying the system consists of executing all steps
necessary to educate the Consumers on the use of the new system, placing the newly developed
system into production, confirming that all data required at the start of operations is available and
accurate, and validating that business functions that interact with the system are functioning
properly. Transitioning the system support responsibilities involves changing from a system
development to a system support and maintenance mode of operation, with ownership of the new
system moving from the Project Team to the Performing Organization.
System implementation is the important stage of project when the theoretical design is
tuned into practical system. The main stages in the implementation are as follows
Planning
Training
System testing and
Changeover Planning
Planning is the first task in the system implementation. Planning means deciding on the
method and the time scale to be adopted. At the time of implementation of any system people
from different departments and system analysis involve. They are confirmed to practical problem
of controlling various activities of people outside their own data processing departments. The
line managers controlled through an implementation coordinating committee. The committee
considers ideas, problems and complaints of user department, it must also consider;
The purpose of Prepare for System Implementation is to take all possible steps to ensure
that the upcoming system deployment and transition occurs smoothly, efficiently, and flawlessly.
In the implementation of any new system, it is necessary to ensure that the Consumer community
is best positioned to utilize the system once deployment efforts have been validated. Therefore,
all necessary training activities must be scheduled and coordinated. As this training is often the
first exposure to the system for many individuals, it should be conducted as professionally and
competently as possible. A positive training experience is a great first step towards Customer
acceptance of the system.
Consumers may experience a period of time in which the systems that they depend on to
perform their jobs are temporarily unavailable to them. They may be asked to maintain detailed
manual records or logs of business functions that they perform to be entered into the new system
once it is operational.
Because of these and other impacts, the communication of planned deployment activities
to all parties involved in the project is critical. A smooth deployment requires strong leadership,
planning, and communications. By this point in the project lifecycle, the team will have spent
countless hours devising and refining the steps to be followed.
During this preparation process the Project Manager must verify that all conditions that
must be met prior to initiating deployment activities have been met, and that the final ‘green
light’ is on for the team to proceed. The final process within the System Development Lifecycle
is to transition ownership of the system support responsibilities tothe Performing Organization.
In order for there to be an efficient and effective transition, the Project Manager should make
sure that all involved parties are aware of the transition plan, the timing of the various transition
activities, and their role in its execution.
Due to the number of project participants in this phase of the SDLC, many of the
necessary conditions and activities may be beyond the direct control of the Project Manager.
Consequently, all Project Team members with roles in the implementation efforts must
understand the plan, acknowledge their responsibilities, recognize the extent to which other
implementation efforts are dependent upon them, and confirm their commitment.
INPUT DESIGN
The input design is the link between the information system and the user. It comprises the
developing specification and procedures for data preparation and those steps are necessary to put
transaction data in to a usable form for processing can be achieved by inspecting the computer to
read data from a written or printed document or it can occur by having people keying the data
directly into the system. The design of input focuses on controlling the amount of input required,
controlling the errors, avoiding delay, avoiding extra steps and keeping the process simple. The
input is designed in such a way so that it provides security and ease of use with retaining the
privacy. Input Design considered the following things:
OBJECTIVES
1. Input Design is the process of converting a user-oriented description of the input into a
computer-based system. This design is important to avoid errors in the data input process and
show the correct direction to the management for getting correct information from the
computerized system.
2. It is achieved by creating user-friendly screens for the data entry to handle large volume of
data. The goal of designing input is to make data entry easier and to be free from errors. The data
entry screen is designed in such a way that all the data manipulates can be performed. It also
provides record viewing facilities.
3. When the data is entered it will check for its validity. Data can be entered with the help of
screens. Appropriate messages are provided as when needed so that the user
will not be in maize of instant. Thus the objective of input design is to create an input layout that
is easy to follow
OUTPUT DESIGN
A quality output is one, which meets the requirements of the end user and presents the
information clearly. In any system results of processing are communicated to the users and to
other system through outputs. In output design it is determined how the information is to be
displaced for immediate need and also the hard copy output. It is the most important and direct
source information to the user. Efficient and intelligent output design improves the system’s
relationship to help user decision-making.
1. Designing computer output should proceed in an organized, well thought out manner; the right
output must be developed while ensuring that each output element is designed so that people will
find the system can use easily and effectively. When analysis design computer output, they
should Identify the specific output that is needed to meet the requirements.
3.Create document, report, or other formats that contain information produced by the system.
The output form of an information system should accomplish one or more of the following
objectives.
Table Design
Login Table:
User Varchar
pass Varchar
Predic Table:
Header Varchar
Member Varchar
Prediction Varchar
Propose Table:
Userid Varchar
data Varchar
No_of_packet Varchar
Date_and_time Varchar
Sens_nodes Varchar
System Architecture Diagram
Sink
Data Gathering
Transmission to
Sink Cluster Head
Data Flow Diagram:
Level 0:
Node Allocation
Relocating Node
Data Gathering
Data Transfer
Level 1:
Node Allocation
Relocating Node
Data Gathering
Data Transfer
Node Allocation
Relocating Node
Data Gathering
Data Transfer
Mobile Peers
Receive Node
Conclusion:
A WSNs with mobile elements (MES) for mobile data acquisition with concurrent data
upload in Wireless Sensor Networks. We specifically focus on data collection, that is, the
process that makes communication feasible between the sensor nodes and the sink. In fact, there
are many other problems that can be addressed by taking advantage of mobility in WSNs.
Wireless sensor nodes limited energy and efficient technologies must be used during data
collection network to maximize service life. One of the main features of the framework is that it
is simultaneous data upload of sensors to the mobile collector allows sharp data acquisition
latency and significantly reduce energy consumption through the use of multiple antennas and
space-division multiple access technique to shorten. We also give the sub-algorithm for fi the
optimal timing of the mobile collector at different anchor points ends. Finally, we provide
numerical results, the convergence of the proposed DaGCM algorithm and its advantages over
the algorithm without simultaneous data upload and power control with respect to the data
collection to demonstrate latency and power consumption.
Future Work:
We would like to point out that there are some interesting problems that may be studied in our
future work. The problem is how to find polling points and compatible pairs for each cluster. A
discretization scheme should be developed to partition the continuous space to locate the optimal
polling point for each cluster. Then finding the compatible pairs becomes a matching problem to
achieve optimal overall spatial diversity.
References
[1] B. Krishnamachari, Networking Wireless Sensors. Cambridge, U.K.: Cambridge Univ. Press,
Dec. 2005.
[2] R. Shorey, A. Ananda, M. C. Chan, and W. T. Ooi, Mobile, Wireless, Sensor Networks.
Piscataway, NJ, USA: IEEE Press, Mar. 2006.
[3] I. F. Akyildiz, W. Su, Y. Sankarasubramaniam, and E. Cayirci, “A survey on sensor
networks,” IEEE Commun. Mag., vol. 40, no. 8, pp. 102–114, Aug. 2002.
[4] W. C. Cheng, C. Chou, L. Golubchik, S. Khuller, and Y. C. Wan, “A coordinated data
collection approach: Design, evaluation, and comparison,” IEEE J. Sel. Areas Commun., vol. 22,
no. 10, pp. 2004– 2018, Dec. 2004.
[5] K. Xu, H. Hassanein, G. Takahara, and Q. Wang, “Relay node deployment strategies in
heterogeneous wireless sensor networks,” IEEE Trans. Mobile Comput., vol. 9, no. 2, pp. 145–
159, Feb. 2010.
[6] O. Gnawali, R. Fonseca, K. Jamieson, D. Moss, and P. Levis, “Collection tree protocol,” in
Proc. 7th ACM Conf. Embedded Netw. Sensor Syst., 2009, pp. 1–14.
[7] E. Lee, S. Park, F. Yu, and S.-H. Kim, “Data gathering mechanism with local sink in
geographic routing for wireless sensor networks,” IEEE Trans. Consum. Electron., vol. 56, no. 3,
pp. 1433– 1441, Aug. 2010.
[8] Y. Wu, Z. Mao, S. Fahmy, and N. Shroff, “Constructing maximum-lifetime data-gathering
forests in sensor networks,” IEEE/ ACM Trans. Netw., vol. 18, no. 5, pp. 1571–1584, Oct. 2010.
[9] X. Tang and J. Xu, “Adaptive data collection strategies for lifetime-constrained wireless
sensor networks,” IEEE Trans. Parallel Distrib. Syst., vol. 19, no. 6, pp. 721–7314, Jun. 2008.
[10] W. R. Heinzelman, A. Chandrakasan, and H. Balakrishnan, “An application-specific
protocol architecture for wireless microsensor networks,” IEEE Trans. Wireless Commun., vol.
1, no. 4, pp. 660– 660, Oct. 2002.
[11] O. Younis and S. Fahmy, “Distributed clustering in ad-hoc sensor networks: A hybrid,
energy-efficient approach,” in IEEE Conf. Comput. Commun., pp. 366–379, 2004.
[12] D. Gong, Y. Yang, and Z. Pan, “Energy-efficient clustering in lossy wireless sensor
networks,” J. Parallel Distrib. Comput., vol. 73, no. 9, pp. 1323–1336, Sep. 2013.
[13] A. Amis, R. Prakash, D. Huynh, and T. Vuong, “Max-min d-cluster formation in wireless ad
hoc networks,” in Proc. IEEE Conf. Comput. Commun., Mar. 2000, pp. 32–41.
[14] A. Manjeshwar and D. P. Agrawal, “Teen: A routing protocol for enhanced efficiency in
wireless sensor networks,” in Proc. 15th Int. IEEE Parallel Distrib. Process. Symp., Apr. 2001,
pp. 2009–2015.
Screen shot
SOURCE CODE
Login.java
package mobiledata;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.io.*;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.sql.*;
/**
* @author Admin
*/
Socket s;
DataInputStream din;
String s1;
public Login()
initComponents();
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
setName("RECEIVER"); // NOI18N
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jButton1.setText("CANCEL");
jButton1.addActionListener(new java.awt.event.ActionListener() {
jButton1ActionPerformed(evt);
});
jButton2.setText("LOGIN");
jButton2.addActionListener(new java.awt.event.ActionListener() {
jButton2ActionPerformed(evt);
});
jLabel1.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/greendata/images/ig.png"))); // NOI18N
jLabel1.setToolTipText("");
getAccessibleContext().setAccessibleParent(this);
pack();
}// </editor-fold>
System.exit(0);
try {
String user1=jTextField1.getText();
String pass1=jPasswordField1.getText();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection c = DriverManager.getConnection("jdbc:odbc:sensor");
Statement st = c.createStatement();
if(user.equals(user1)&&pass.equals(pass1))
{ hide();
new mainform().setVisible(true);
rs.close();
c.close();
/**
*/
java.awt.EventQueue.invokeLater(new Runnable() {
});
Main.java
package mobiledata;
import java.awt.Color;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
/**
*
* @author Admin
*/
public mainform() {
initComponents();
*/
@SuppressWarnings("unchecked")
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel3.setText("Welcome to....");
//jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/sensornetwork/image/
ig.png"))); // NOI18N
jMenu1.setText("File");
jMenuItem1.setText("Logout");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
});
jMenu1.add(jMenuItem1);
//
jMenuItem3.setText("Report");
jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
jMenuItem3ActionPerformed(evt);
});
jMenu1.add(jMenuItem3);
// jMenuItem4.setText("Start Agregation");
// jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
// jMenuItem4ActionPerformed(evt);
// }
// });
// jMenu1.add(jMenuItem4);
jMenuBar1.add(jMenu1);
jMenu2.setText("Edit");
jMenuBar1.add(jMenu2);
setJMenuBar(jMenuBar1);
pack();
}// </editor-fold>//GEN-END:initComponents
this.setVisible(false);
dispose();
new Login().setVisible(true);
}//GEN-LAST:event_jMenuItem1ActionPerformed
new reports().setVisible(true);}
}//GEN-LAST:event_jMenuItem2ActionPerformed
/**
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
java.util.logging.Logger.getLogger(mainform.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
java.util.logging.Logger.getLogger(mainform.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
java.util.logging.Logger.getLogger(mainform.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
java.util.logging.Logger.getLogger(mainform.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new mainform().setVisible(true);
});
Sensordatapridiction.java
package mobiledata;
//AdaptiveDataFusion.java
import java.io.*;
import java.util.*;
import java.util.Date;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.*;
import jist.runtime.JistAPI;
import jist.runtime.Node;
import jist.runtime.guilog.GuiLog;
import java.io.IOException;
import jist.runtime.JistAPI;
import jist.swans.Constants;
import jist.swans.misc.Util;
import jist.swans.misc.Mapper;
import jist.swans.net.NetAddress;
import jist.swans.net.NetIp;
import jist.swans.net.PacketLoss;
import jist.swans.trans.TransUdp;
import jist.swans.app.AppJava;
import java.net.InetAddress;
import java.net.DatagramSocket;
import java.net.DatagramPacket;
import java.util.logging.Level;
import java.util.logging.Logger;
//import jist.minisim.block;
//import jist.swans.misc.Node;
import java.sql.*;
import javax.imageio.ImageIO;
//ui
//ui parameters
int frmLeft=60,frmTop=60;
int frmWidth=900,frmHeight=640;
int mapWidth=frmWidth-260,mapHeight=frmHeight-100;
//system parameters
int CurrentSensor=-1,CurrentSensor1=-1,cpw,cph;
int nSensorsPerRegion=5;
int TransmissionRange=100;
int SensorRadius=10;
int SourceSensor=100;
int DestSensor=-1;
int cloakedarea=0,port1,port2;
Region[] MapRegions=map.getMapRegions();
Graphics g;
//constructor
SensorDataprediction()
//get user-paramters
//nSensorsPerRegion=Integer.parseInt(JOptionPane.showInputDialog("Enter
SensorNodeCount per Cluster: ",""+nSensorsPerRegion));
//setup frmMain
frmMain.setResizable(false);
//"D:/uis
staff/veeramani/slm/sec/sensornetwork/src/sensornetwork/images/cbe_district_map.gif") ;
//frmMain.setIconImage(img);
//setIconImage("Lake.jpg");
frmMain.setBounds(frmLeft,frmTop,frmWidth,frmHeight);
frmMain.getContentPane().setLayout(null);
frmMain.addMouseMotionListener(this);
frmMain.addMouseListener(this);
lblSensorCount.setBounds(30,frmHeight-65,150,20);
frmMain.getContentPane().add(lblSensorCount);
lblXY.setBounds(30,10,100,20);
frmMain.getContentPane().add(lblXY);
lblCurrentSensor.setBounds(frmWidth-330,frmHeight-65,150,20);
frmMain.getContentPane().add(lblCurrentSensor);
lblMovements.setBounds(frmWidth-330,frmHeight-65,150,20);
frmMain.getContentPane().add(lblMovements);
frmMain.getContentPane().setBackground(Color.gray);
txtSensorList.setEditable(false);
spSensorList.setBounds(frmWidth-180-40,30,200,120);
frmMain.getContentPane().add(spSensorList);
sensor.setBounds(frmWidth-180-40,160,200,22);
sensor.addActionListener(this);
// sensor.setForeground(Color.white);
// //sensor.setBackground(Color.BLACK);
//
frmMain.getContentPane().add(sensor);
//
//
btExisting.setBounds(frmWidth-180-40,190,200,22);
btExisting.addActionListener(this);
frmMain.getContentPane().add(btExisting);
// jc.addItem("Predict Enable");
// jc.addItem("Predict Disable");
//
// jc.setBounds(frmWidth-180-40,220,200,22);
// jc.addActionListener(this);
// frmMain.getContentPane().add(jc);
// //add(jc);
lblUnitDataSize.setBounds(frmWidth-180-40,220,100,22);
frmMain.getContentPane().add(lblUnitDataSize);
txtUnitDataSize.setBounds(frmWidth-180-40+90,220,100,22);
frmMain.getContentPane().add(txtUnitDataSize);
//
btDataTransfer.setBounds(frmWidth-180-40,250,200,22);
btDataTransfer.addActionListener(this);
frmMain.getContentPane().add(btDataTransfer);
btExisting1.setBounds(frmWidth-180-40,330,200,22);
btExisting1.addActionListener(this);
frmMain.getContentPane().add(btExisting1);
// //setup frmQueryTable
// proposed.setBounds(frmWidth-180-40,360,200,22);
// proposed.addActionListener(this);
// frmMain.getContentPane().add(proposed);
txtdata.setEditable(false);
spSensorList1.setBounds(frmWidth-180-40,360,200,120);
frmMain.getContentPane().add(spSensorList1);
frmMain.setVisible(true);
Globals.wait(1000);
g=frmMain.getGraphics();
Graphics2D g2d=(Graphics2D)g;
g2d.setStroke(new BasicStroke(4.0f));
g2d.drawRect(30,60,mapWidth,mapHeight);
up.main1();
//events
if(evt.getSource()==btDataTransfer)
up.main(txtUnitDataSize.getText());
else if(evt.getSource()==sensor)
map.draw(g);
map.drawSensorsLabel(g);
else if(evt.getSource()==btExisting)
{
addSensors();
txtSensorList.setText(map.getSensorListString());
else if(evt.getSource()==btExisting1)
cloackeareas();
else if(evt.getSource()==proposed)
// proposed();
//
int xposition=me.getX();
int yposition=me.getY();
lblXY.setText("("+xposition+","+yposition+")");
int n=map.findTotalSensorsCount();
int trad=SensorRadius-2;
boolean flag=false;
for(int i=0;i<map.getRegionCount();i++)
for(int j=0;j<MapRegions[i].getSensorCount();j++)
int x1=MapRegions[i].getSensorX(j)-trad+2;
int x2=MapRegions[i].getSensorX(j)+trad+2;
int y1=MapRegions[i].getSensorY(j)-trad+2;
int y2=MapRegions[i].getSensorY(j)+trad+2;
if(between(xposition,yposition,x1,y1,x2,y2)==true)
flag=true;
CurrentSensor=MapRegions[i].getSensorID(j);
}
//make sure sensorid is displayed only when mouse is over it
if(flag==false)
CurrentSensor=-1;
displayStatus();
//mouselistener events
if(CurrentSensor>=0)
if(SourceSensor==-1)
SourceSensor=CurrentSensor;
else
if(CurrentSensor!=SourceSensor)
DestSensor=CurrentSensor;
displayStatus();
}
}
//
//
//
//
//display functions
tstr+="\nDestination: BS";
//txtInput.setText(tstr);
void displayQueryTable()
String tstr="";
for(int t=0;t<map.RegionCount;t++)
int x1=MapRegions[t].getX();
int y1=MapRegions[t].getY();
int x2=x1+Globals.RegionWidth;
int y2=y1+Globals.RegionHeight;
tstr+="R"+t+": ("+x1+","+y1+")"+"-("+x2+","+y2+")"+"\n";
void displaySensorTable()
String tstr="";
for(int t=0;t<map.findTotalSensorsCount();t++)
int tx=findSensorX(t);
int ty=findSensorY(t);
tstr+="O"+t+": ("+tx+","+ty+")"+"\n";
//internal methods
boolean flag=false;
flag=true;
return(flag);
//methods
void addSensors()
for(int t=0;t<map.getRegionCount();t++)
{
int tcount=nSensorsPerRegion;
if(t==map.getRegionCount()-1) tcount=nSensorsPerRegion-1;
for(int i=0;i<tcount;i++)
try
// frmMain.repaint();
int no=t;
double random1=java.lang.Math.random();
int no1=(int)(((double)Globals.RegionWidth-5.0)*random1);
double random2=java.lang.Math.random();
int no2=(int)(((double)Globals.RegionHeight-5.0)*random2);
int tx=MapRegions[no].getX()+no1;
int ty=MapRegions[no].getY()+no2;
//draw sensor
Graphics2D g2d=(Graphics2D)g;
g2d.setStroke(new BasicStroke(4.0f));
g.setColor(new Color(255,0,0));
g.drawOval(tx,ty,SensorRadius,SensorRadius);
// g.drawOval(tx+5*t,ty-5,SensorRadius,SensorRadius);
}else if(i==2)
g.setColor(new Color(200,23,253));
g.drawOval(tx,ty,SensorRadius,SensorRadius);
g.setColor(Color.WHITE);
else
g.setColor(Color.RED);
g.drawOval(tx,ty,SensorRadius,SensorRadius);
MapRegions[no].addSensor(tx,ty);
Thread.sleep(200);
catch(Exception ex)
System.out.println("Error: "+ex.getMessage());
}
int tx=MapRegions[map.getRegionCount()-1].getX()+Globals.RegionWidth-10;
int ty=MapRegions[map.getRegionCount()-1].getY()+Globals.RegionHeight-12;
g.drawOval(tx,ty,SensorRadius,SensorRadius);
MapRegions[map.getRegionCount()-1].addSensor(tx,ty);
//add basestation
tx=MapRegions[map.getRegionCount()-1].getX()+Globals.RegionWidth+10;
ty=MapRegions[map.getRegionCount()-1].getY()+Globals.RegionHeight+5;
//draw basestation
Graphics2D g2d=(Graphics2D)g;
g2d.setStroke(new BasicStroke(2.0f));
g.setColor(new Color(255,0,0));
g.drawRect(tx,ty,SensorRadius,SensorRadius);
g.setColor(new Color(0,0,128));
g.drawString("BS",tx-6,ty+20);
MapRegions[map.getRegionCount()-1].addSensor(tx,ty);
DestSensor=map.findTotalSensorsCount()-1;
int
tX=MapRegions[map.findRegionNoOfSensor(tSensorID)].getSensorX(map.findSensorIndexInRegion(tS
ensorID));
return(tX);
}
int
tY=MapRegions[map.findRegionNoOfSensor(tSensorID)].getSensorY(map.findSensorIndexInRegion(tS
ensorID));
return(tY);
//path functions
int
tx=MapRegions[map.findRegionNoOfSensor(tSensorID)].getSensorX(map.findSensorIndexInRegion(tSe
nsorID));
return(tx);
int
ty=MapRegions[map.findRegionNoOfSensor(tSensorID)].getSensorY(map.findSensorIndexInRegion(tSe
nsorID));
return(ty);
{
double d=Math.sqrt(Math.pow((double)(x2-x1),2.0)+Math.pow((double)(y2-y1),2.0));
return((int)d);
int x1=getSensorX(tSensorID1);
int y1=getSensorY(tSensorID1);
int x2=getSensorX(tSensorID2);
int y2=getSensorY(tSensorID2);
double tdistance=findDistance(x1,y1,x2,y2);
return((int)tdistance);
int x=findSensorX(tindex1);
int y=findSensorY(tindex1);
int x1=findSensorX(tindex2);
int y1=findSensorY(tindex2);
port1=x1;
port2=y1;
cloakedarea++;
//g.setColor(new Color(0,0,255));
try {
Graphics2D g2d=(Graphics2D)g;
g2d.setStroke(new BasicStroke(4.0f));
BufferedImage originalImage =
Hacker="Hacker Attacked";
Thread.sleep(4000);
//JOptionPane.showMessageDialog(null, "sgsdegds");
g.drawLine(x,y,x1,y1);
}
private Path findPath(int tsourcesensor,int tdestsensor)
if(tsourcesensor==tdestsensor) return(tpath);
int x[],y[],distances[][];
int n=map.findTotalSensorsCount();
x=new int[n];
y=new int[n];
distances=new int[n][n];
int x1,x2,y1,y2;
for(int i=0;i<n;i++)
x[i]=findSensorX(i);
y[i]=findSensorY(i);
//find euclidean distance between each sensor and every other sensor (routing table)
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
{
x1=x[i]; x2=x[j];
y1=y[i]; y2=y[j];
distances[i][j]=findDistance(x1,y1,x2,y2);
int tsource=tsourcesensor;
int tdestination=tdestsensor;
int neighborCount=0;
boolean destReached=false;
while(destReached==false)
neighborCount=0;
for(int i=0;i<n;i++)
if(distances[tsource][i]<=TransmissionRange)
{
//find if this neighbor is already in path
boolean found=false;
for(int k=0;k<tpath.size();k++)
if(tpath.getSensor(k)==i)
found=true;
break;
if(found==false)
neighbors[neighborCount]=i;
neighborCount++;
if(neighborCount>0)
for(int i=0;i<neighborCount;i++)
if(neighbors[i]==tdestsensor)
{
tpath.addSensor(tdestsensor);
destReached=true;
break;
if(destReached==true)
break;
int nextSensor=-1;
int tnext=0,tdist,shortestDist=0;
for(int i=0;i<neighborCount;i++)
int tsensor=neighbors[i];
x1=x[tsensor]; x2=x[tdestsensor];
y1=y[tsensor]; y2=y[tdestsensor];
tdist=findDistance(x1,y1,x2,y2);
if(i==0)
shortestDist=tdist;
tnext=tsensor;
}
else if(shortestDist>tdist)
shortestDist=tdist;
tnext=tsensor;
nextSensor=tnext;
tpath.addSensor(nextSensor);
tsource=nextSensor;
else
break;
double tdistance=0.0;
for(int t=0;t<tpath.size();t++)
if(t>0)
int sensor1=tpath.getSensor(t-1);
int sensor2=tpath.getSensor(t);
tdistance+=findSensorDistance(sensor1,sensor2);
tpath.setDistance(tdistance);
return(tpath);
for(int t=0;t<tpath.size();t++)
tstr+=tpath.getSensor(t)+"-";
if(t>0)
int sensor1=tpath.getSensor(t-1);
int sensor2=tpath.getSensor(t);
System.out.println(sensor2);
drawLine(sensor1,sensor2);
Globals.wait(Globals.PathDrawingDelay);
}
//g.setColor(Color.pink);
tstr=tstr.substring(0,tstr.length()-1);
tstr+="(BS)\r\n\r\n";
displayStatus();
return(tColor);
for(int t=0;t<MapRegions.length;t++)
Sensor aggregate=MapRegions[t].getSensor(0);
pt1.setx(aggregate.getX());
pt1.sety(aggregate.getY());
pt1.setid(aggregate.getID());
pc1.addPoint(pt1);
int groupcount=Integer.parseInt(txtGroupCount.getText());
grouping1.set_nGroups(groupcount);
grouping1.setPoints(pc1);
grouping1.FindCorrelation();
for(int t=0;t<groupcount;t++)
Color tcolor=getUniqueColor(t+1);
PointCollection tgroup=grouping1.getGroup(t);
for(int j=0;j<tgroup.get_nPoints();j++)
int tid=tgroup.getPoint(j).getid();
int tx=getSensorX(tid);
int ty=getSensorY(tid);
g.setColor(tcolor);
g.drawRect(tx,ty,SensorRadius,SensorRadius);
g.setFont(new Font("Verdana",Font.BOLD,10));
g.drawString(""+(t+1),tx+SensorRadius,ty);
Point pt1=tgroup.getPointNearestToCentroid();
int tsensorid=pt1.getid();
HeaderAggregates.add(new Integer(tsensorid));
return(grouping1.toString());
}
g.setColor(Color.yellow);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection c = DriverManager.getConnection("jdbc:odbc:sensor");
Statement st = c.createStatement();
st1.close();
g.drawLine(55,75,67,75);
g.setColor(new Color(128,0,0));
g.drawLine(250,75,260,75);
//g.drawLine(x1,y1,x2,y2);
long tstart=System.currentTimeMillis();
long cond=tstart+2;
int totaldata=0,unitdatasize=Integer.parseInt(txtUnitDataSize.getText());
for(int t=0;t<MapRegions.length;t++)
Sensor aggregate=MapRegions[t].getSensor(0);
System.out.println(t);
for(int j=1;j<MapRegions[t].getSensorCount();j++)
if(JistAPI.getTime()<cond){
Sensor member=MapRegions[t].getSensor(j);
//System.out.println(member.getID());
//nd.getHost();
//System.out.println(nd);
if(member.getID()!=DestSensor)
totaldata+=unitdatasize;
int x1=aggregate.getX(),y1=aggregate.getY();
int x2=member.getX(),y2=member.getY();
if(JistAPI.getTime()<cond&&x1<x2&&y1<y2){
if(j!=2){
g.setColor(new Color(128,0,0));
g.drawLine(x1,y1,x2,y2);
predict="Predict Disable";
}
else{
if(j!=2){
g.setColor(Color.yellow);
g.drawLine(x1,y1,x2,y2);
predict="Predict Enable";
JistAPI.sleep(1000);
Globals.wait(200);
st.close();
tresult.method=0;
tresult.TotalDataSize=totaldata;
long tend=System.currentTimeMillis();
double tseconds=((double)(tend-tstart))/(double)1000;
tresult.TimeTaken=tseconds;
return(tresult);
}
private void proposed(String recive,String nopacket)
ResultSet res;
//String dest=String.valueOf(DestSensor);
String data=txtUnitDataSize.getText();
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection c = DriverManager.getConnection("jdbc:odbc:sensor");
Statement st = c.createStatement();
String sens="";
st.close();
c.close();
//g.drawLine(x1,y1,x2,y2);
//txtResult.append(tstr);
//main
new SensorDataprediction();
int num_of_sensnode=cloakedarea;
int cloackarea_with=num_of_sensnode*3;
int cloackarea_height=num_of_sensnode*3;
cpw=cloackarea_with;
cph=cloackarea_height;
Graphics2D g2d=(Graphics2D)g;
g2d.setStroke(new BasicStroke(4.0f));
g.setColor(Color.white);
histogram();
try {
System.out.println(no_of_sensnode);
for(int p1=port2;p1<(port2+cph);p1=p1+18){
for(int p2=port1;p2<(port1+cpw);p2=p2+18){
System.out.println(p1+" "+p2);
// System.out.println(port2+cph+" "+port1+cpw);
int xposition=p2;
int yposition=p1;
int n=map.findTotalSensorsCount();
int trad=SensorRadius-2;
boolean flag=false;
for(int i=0;i<map.getRegionCount();i++)
for(int j=0;j<MapRegions[i].getSensorCount();j++)
int x1=MapRegions[i].getSensorX(j)-trad+2;
int x2=MapRegions[i].getSensorX(j)+trad+2;
int y1=MapRegions[i].getSensorY(j)-trad+2;
int y2=MapRegions[i].getSensorY(j)+trad+2;
if(between(xposition,yposition,x1,y1,x2,y2)==true)
flag=true;
CurrentSensor1=MapRegions[i].getSensorID(j);
no_of_sensnode+=CurrentSensor1+",";
if(flag==false)
CurrentSensor=-1;
displayStatus();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection c = DriverManager.getConnection("jdbc:odbc:sensor");
Statement st = c.createStatement();
st.close();
c.close();
/**
/**
* UDP server entry point: open UDP socket and wait for single packet from
* client.
*/
try
int received = 0;
int r1=250,g1=150,b1=0;
String data="";
do
socket.receive(packet);
received++;
System.out.println("received at t="+System.currentTimeMillis()/1000+
txtdata.append("\n");
txtdata.append("received at t="+System.currentTimeMillis()/1000+
" ("+packet.getLength()+" bytes) "
// long tstart=System.currentTimeMillis();
Path tpath=findPath(SourceSensor,DestSensor);
drawPath(tpath);
// long tend=System.currentTimeMillis();
// double tseconds=((double)(tend-tstart))/(double)1000;
// g.setColor(new Color(i*10));
r1=r1-40;
b1=b1+40;
g1=g1-25;
while(packet.getLength()>0);
socket.close();
proposed(data,received+" Packets");
catch(Exception e)
e.printStackTrace();
}
// class: Server
/**
*/
/**
* UDP client entry point: open UDP socket and send off single packet to
* server.
*/
String dat=a;
String dat1;
String dat2,dat3,dat4,dat5;
dat1=dat.substring(0, 4);
dat2=dat.substring(4, 10);
dat3=dat.substring(10, 15);
dat4=dat.substring(15, 20);
dat5=dat.substring(20, 25);
// for(int i=0;i<dat.length();i++){
// if(i<4){
// dat1=
// }
// }
try {
System.out.println("sent at t="+JistAPI.getTime());
System.out.flush();
if(i==0){
try {
socket.send(packet);
else if(i==1){
try {
socket.send(packet1);
else if(i==2){
try {
socket.send(packet2);
else if(i==3){
try {
socket.send(packet3);
} catch (IOException ex) {
} else if(i==4){
try {
socket.send(packet4);
// Thread.sleep(2000);
System.out.flush();
socket.send(packet);
socket.close();
catch(Exception e)
e.printStackTrace();
// class: Client
/**
*/
try
// protocol mapper
protMap.mapToNext(Constants.NET_PROTOCOL_UDP);
// net
// hookup
net.setProtocolHandler(Constants.NET_PROTOCOL_UDP, udp.getProxy());
udp.setNetEntity(net.getProxy());
// applications
server.setUdpEntity(udp.getProxy());
client.setUdpEntity(udp.getProxy());
// run apps
server.getProxy().run(null);
JistAPI.sleep(1);
client.getProxy().run(null);
catch(Exception e)
e.printStackTrace();
} // class: udp
Report.java
package mobiledata;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.io.*;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.sql.*;
Socket s;
DataInputStream din;
String s1;
public reports()
initComponents();
proposed1();
@SuppressWarnings("unchecked")
int cut=0;
//String user=(String) jc.getSelectedItem();
Connection c=null;
int i=0;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
c = DriverManager.getConnection("jdbc:odbc:sensor");
//st=c.createStatement();
System.out.println("dFadf");
ResultSet rs=stt.executeQuery();
while (rs.next()) {
cut++;
int j=0;
jTable1.setValueAt(userid, i, j);
jTable1.setValueAt(data, i, j+1);
jTable1.setValueAt(no_of_packet, i, j+2);
jTable1.setValueAt(data_and_time, i, j+3);
jTable1.setValueAt(sens_nodes, i, j+4);
i++;
}stt.close();
c.close();
}}
java.awt.EventQueue.invokeLater(new Runnable() {
new reports().setVisible(true);
} }); }
Sens.java
package mobiledata;
/**
*
* @author Admin
*/
public sens() {
initComponents();
*/
@SuppressWarnings("unchecked")
jFrame1.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jFrame1.getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel2.setFont(new java.awt.Font("Algerian", 3, 24));
pack();
}// </editor-fold>
/**
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(sens.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
java.util.logging.Logger.getLogger(sens.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
java.util.logging.Logger.getLogger(sens.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
java.util.logging.Logger.getLogger(sens.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
new sens().setVisible(true);
});