8/3/2019 Full Doc_m
1/54
1. SYNOPSIS
In multi hop wireless networks, designing distributed Scheduling algorithms
to achieve the maximal throughput is a challenging problem because of the
complex interference constraints among different links. Traditional maximal-
weight scheduling (MWS), although throughput-optimal, is difficult to implement
in distributed networks. On the other hand, a distributed greedy protocol similar to
IEEE 802.11 does not guarantee the maximal throughput. In this paper, we
introduce an adaptive carrier sense multiple access (CSMA) scheduling algorithm
that can achieve the maximal throughput distributively. Some of the major
advantages of the algorithm are that it applies to a very general interferencemodel and that it is simple, distributed, and asynchronous. Furthermore, the
algorithm is combined with congestion control to achieve the optimal utility and
fairness of competing flows. Simulations verify the effectiveness of the algorithm.
Also, the adaptive CSMA scheduling is a modular MAC-layer algorithm that can
be combined with various protocols in the transport layer and network layer.
Finally, the paper explores some implementation issues in the setting of 802.11
networks.
1
8/3/2019 Full Doc_m
2/54
2. PROJECT DESCRIPTION
2.1 PROBLEM DEFINITION
In the proposed system CSMA uses interference model to achieve the
data flow. It is inspired by CSMA, but may be applied to more general resource
sharing problems (i.e., not limited to wireless networks). We show that the packet
collisions are ignored (as in some of the mentioned references), the algorithm
can achieve maximal throughput. The contribution is to combine the proposed
scheduling algorithm with congestion control using a novel technique to achieve
fairness among competing flows as well as maximal throughput.
2.2 PROJECT DETAILS
2.2.1 What is CSMA?Carrier Sense Multiple Access (CSMA) is a probabilistic Media Access
Control (MAC) protocol in which a node verifies the absence of other traffic
before transmitting on a shared transmission medium, such as an electrical bus,
or a band of the electromagnetic spectrum.
"Carrier Sense" describes the fact that a transmitter uses feedback from a
receiver that detects a carrier wave before trying to send. If a carrier is sensed,
the station waits for the transmission in progress to finish before initiating its own
transmission.
"Multiple Access" describes the fact that multiple stations send and
receive on the medium. Transmissions by one node are generally received by all
other stations using the medium.
2.2.2 Adaptive CSMA
Our first contribution in this paper is to introduce a distributed adaptive
carrier sense multiple access (CSMA) algorithm for a general interference model.
It is inspired by CSMA, but may be applied to more general resource sharing
problems (i.e., not limited to wireless networks). However, it does have a few
distinct features:
Each node only uses its local information (e.g., its backlog). No explicit control
messages are required among the nodes.
It is based on CSMA random access, which is similar to the IEEE 802.11
protocol and is easy to implement.
Time is not divided into synchronous slots. Thus, no synchronization of
transmissions is needed.
2
8/3/2019 Full Doc_m
3/54
3. COMPUTATIONAL ENVIRONMENT
3.1 HARDWARE REQUIREMENTS:
Processor : Any Processor above 500 MHz.
Ram : 128MB.
Hard Disk : 10 GB.
Compact Disk : 650 MB.
Input device : Standard Keyboard and Mouse.
Output device : VGA and High Resolution Monitor.
3.2 SOFTWARE REQUIREMENTS:
Operating System : Windows Family.
Language : JDK 1.5
Front End : Java Swing
3.2 SOFTWARE DESCRIPTION
3.2.1 Java
Java is an object-oriented multithread programming languages .It is
designed to be small, simple and portable across different platforms as well as
operating systems.
3.2.2 Features of Java
Platform Independence
The Write-Once-Run-Anywhere ideal has not been achieved (tuning for
different platforms usually required), but closer than with other languages.
Object Oriented
Object oriented throughout - no coding outside of class definitions,
including main( ). An extensive class library is available in the core language
packages.
Compiler/Interpreter Combo
3
8/3/2019 Full Doc_m
4/54
8/3/2019 Full Doc_m
5/54
This differs from C++, which uses static binding. This can result in fragile
classes for cases where linked code is changed and memory pointers then point
to the wrong addresses.
Good Performance
Interpretation of byte codes slowed performance in early versions, but
advanced virtual machines with adaptive and just-in-time compilation and other
techniques now typically provide performance up to 50% to 100% the speed of
C++ programs.
Threading
o
Lightweightprocesses, called threads, can easily be spun off to performmultiprocessing.
o Can take advantage of multiprocessors where available
o Great for multimedia displays.
Built-in Networking
Java was designed with networking in mind and comes with many classes
to develop sophisticated Internet communications.
3.2.3 Swing
Swing is the primary JavaGUIwidget toolkit. It is part ofSun
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 ofGUI components than the earlierAbstract 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. It has more powerful and flexible
components than AWT. In addition to familiar components such as buttons,
check box and labels, Swing provides several advanced components such as
tabbed panel, scroll panes, trees, tables and lists.
5
http://en.wikipedia.org/wiki/Java_(programming_language)http://en.wikipedia.org/wiki/GUIhttp://en.wikipedia.org/wiki/Widget_toolkithttp://en.wikipedia.org/wiki/Sun_Microsystemshttp://en.wikipedia.org/wiki/Sun_Microsystemshttp://en.wikipedia.org/wiki/Java_Foundation_Classeshttp://en.wikipedia.org/wiki/Application_programming_interfacehttp://en.wikipedia.org/wiki/Graphical_user_interfacehttp://en.wikipedia.org/wiki/Software_componenthttp://en.wikipedia.org/wiki/Abstract_Window_Toolkithttp://en.wikipedia.org/wiki/Look_and_feelhttp://en.wikipedia.org/wiki/Pluggable_look_and_feelhttp://en.wikipedia.org/wiki/Java_(programming_language)http://en.wikipedia.org/wiki/GUIhttp://en.wikipedia.org/wiki/Widget_toolkithttp://en.wikipedia.org/wiki/Sun_Microsystemshttp://en.wikipedia.org/wiki/Sun_Microsystemshttp://en.wikipedia.org/wiki/Java_Foundation_Classeshttp://en.wikipedia.org/wiki/Application_programming_interfacehttp://en.wikipedia.org/wiki/Graphical_user_interfacehttp://en.wikipedia.org/wiki/Software_componenthttp://en.wikipedia.org/wiki/Abstract_Window_Toolkithttp://en.wikipedia.org/wiki/Look_and_feelhttp://en.wikipedia.org/wiki/Pluggable_look_and_feel8/3/2019 Full Doc_m
6/54
Unlike AWT components, Swing components are not implemented by
platform-specific code. Instead they are written entirely in Java and therefore are
platform-independent. The term "lightweight" is used to describe such an
element.
6
8/3/2019 Full Doc_m
7/54
4. FEASIBILITY STUDY
Preliminary investigation examines project feasibility; the likelihood the
system will be useful to the organization. The main objective of the feasibility
study is to test the Technical, Operational and Economical feasibility for adding
new modules and debugging old running system. All systems are feasible if they
are given unlimited resources and infinite time. There are aspects in the
feasibility study portion of the preliminary investigation:
Technical Feasibility
Operation Feasibility
Economical Feasibility
4.1 TECHNICAL FEASIBILITY:
The technical issue usually considered during the feasibility stage of the
investigation includes the following:
The necessary technology exists to do what is suggested.
The proposed equipments have the technical capacity to hold the data
required to use the new system.
The proposed system will provide adequate response to inquiries, regardless
of the number or location of users.
The system can be upgraded if developed.
There are technical guarantees of accuracy, reliability, ease of access and
data security.
4.2OPERATIONAL FEASIBILITY:
Proposed projects are beneficial only if they can be turned out into
information systems, which will meet the organizations operating requirements.
Operational feasibility aspects of the project are to be taken as an important part
of the project implementation. Some of the important issues considered for the
operational feasibility of a project include the following: -
There is sufficient support for the management from the users.
The system will be used and work properly if it is being developed and
implemented.
There will be any resistance from the user that will undermine the possible
application benefits.
7
8/3/2019 Full Doc_m
8/54
This system is targeted to be in accordance with the above-mentioned
issues. Beforehand, the management issues and user requirements have been
taken into consideration. So there is no question of resistance from the users that
can undermine the possible application benefits.
The well-planned design would ensure the optimal utilization of the computerresources and would help in the improvement of performance status.
4.3 ECONOMIC FEASIBILITY:
A system can be developed technically and that will be used if installed
must still be a good investment for the organization. In the economical feasibility,
the development cost in creating the system is evaluated against the ultimate
benefit derived from the new systems. Financial benefits must equal or exceed
the costs. The system is economically feasible. It does not require any additional
hardware or software.
8
8/3/2019 Full Doc_m
9/54
5. SYSTEM ANALYSIS
5.1 EXISTING SYSTEM:
In older days they used two types of algorithm. They are MAC layer
algorithm and LQF algorithm. MAC-layer scheduling is the bottleneck of the
problem. In particular, it is not easy to achieve the maximal throughput through
distributed scheduling, which in turn prevents full utilization of the wireless
network. Scheduling is challenging since the conflicting relationships between
different links can be complicated.
On the other hand, a number of low-complexity but suboptimal scheduling
algorithms have been proposed in the literature. By using a distributed greedy
protocol similar to IEEE 802.11, shows that only a fraction of the throughputregion can be achieved (after ignoring collisions). The fraction depends on the
network topology and interference relationships. The algorithm is related to
Maximal Scheduling, which chooses a maximal schedule among the nonempty
queues in each slot. Different from Maximal Scheduling, the Longest-Queue-First
(LQF) algorithm takes into account the queue lengths of the nonempty queues. It
shows good throughput performance in simulations.
5.1.1 Disadvantages:
In transport layer amount of flow control is decided and MAC layer is
responsible for maximal throughput but this is not achieved through
distributed scheduling.
In Maximal weight scheduling a time is slotted and the link, which as high
weight is processed but finding maximal weight is hard in the wireless
network.
In fact, LQF is proven to be throughput-optimal if the network topology
satisfies a local pooling condition or if the network is small.
In general topologies, however, LQF is not throughput-optimal, and the
achievable fraction of the capacity region can be characterized.
5.2PROPOSED SYSTEM:
Our first contribution in this paper is to introduce a distributed adaptive
carrier sense multiple access (CSMA) algorithm for a general interference model.
It is inspired by CSMA, but maybe applied to more general resource sharing
problems (i.e., not limited to wireless networks). We show that if packet collisions
9
8/3/2019 Full Doc_m
10/54
are ignored (as in some of the mentioned references), the algorithm can achieve
maximal throughput. The algorithm may not be directly comparable to those
throughput-optimal algorithms we have mentioned since it utilizes the carrier-
sensing capability.
5.2.1 Advantages: Not limited to wireless networks.
Packet Collisions ignored.
Maximum throughput achieved through CSMA Marko chain model.
5.3 ANALYSIS TOOLS
5.3.1. Data Flow diagrams:
Level 0:
Figure 5-1.Level0
Each and every nodes in the network, detects for its neighbor nodes.
Level 1:
Figure 5-2.Level 1
10
Neighbor
s
Link
Weight
Evaluation
Edge
Source
Neighbor
Detection.
8/3/2019 Full Doc_m
11/54
From neighbors, link weight for each and every link in the network can be
identified, which also represents the link weight between each and every node.
Level 2:
Figure 5-3.Level 2
After identifying the link weight, destination can be chosen. For the given source
and destination, path manipulation is done using CSMA Markov chain model.
Level 3:
11
Source
Link
Weight Edge
Link
Weight
Choose Destination
Path
Manipulate
8/3/2019 Full Doc_m
12/54
Figure 5-4.Level 3
The message transfer occurs by doing the scheduling process in edge using
markov chain model. Thus the congestion in the network can be avoided,
whereas throughput can be maximized.
5.3.2 Sequence Diagram:
12
Source
Link
PathEdge Destination
Scheduling
Process
8/3/2019 Full Doc_m
13/54
Figure 5-5.Sequence diagram
A sequence diagram emphasizes the time ordering of messages. In Fig. 5-5,
the sequence diagram has objects that participate in the interaction at the top,
across the X-axis. The object that initiates the interaction is placed at left and
increasingly more subordinate objects to the right. Next we place the messagesthat these objects send and receive along the Y-axis, in order of increasing time
from top to bottom.
5.3.3 Activity Diagram:
Figure 5-6.Activity diagram
The Fig: 5-6 represents an activity diagram. These are typically used forbusiness process modeling, for modeling the logic captured by a single use case
or usage scenario, or for modeling the detailed logic of a business rule. Although
UML activity diagrams could potentially model the internal logic of a complex
operation it would be far better to simply rewrite the operation so that it is simple
enough that you dont require an activity diagram. In many ways UML activity
diagrams are the object-oriented equivalent of flow charts and data flow diagrams
(DFDs) from structured development.
5.3.4 Collaboration Diagram:
13
8/3/2019 Full Doc_m
14/54
A collaboration diagram emphasizes the organization of the objects that
participates in an interaction. As in Fig: 5-7, we form a collaboration diagram by
first placing the objects that participate in the interaction as the vertices in a
graph. Next, we render the links that connect these objects as the arcs of this
graph. Finally, we adorn these links with the messages that objects send andreceive.
Figure 5-7.Collaboration diagram
5.3.5 Use Case Diagram:
Fig: 5-8 describes about the use case diagram. A use case is a set of
scenarios that describing an interaction between a user and a system. A use
case diagram displays the relationship among actors and use cases. The two
main components of a use case diagram are use cases and actors. An actor is
represents a user or another system that will interact with the system modeled. A
use case is an external view of the system that represents some action the user
might perform in order to complete a task.
14
8/3/2019 Full Doc_m
15/54
Figure 5-8.Use case diagram
5.3.6 Class Diagram
Figure 5-9.Class diagram
15
8/3/2019 Full Doc_m
16/54
Fig: 5-9 shows the Class diagram. Class diagrams are the mainstay of
object-oriented analysis and design. Class diagrams show the classes of the
system, their interrelationships (including inheritance, aggregation, and
association), and the operations and attributes of the classes. Class diagramsare used for a wide variety of purposes, including both conceptual/domain
modeling and detailed design modeling.
16
8/3/2019 Full Doc_m
17/54
6. SYSTEM DESIGN
6.1 SYSTEM ARCHITECTURE
Figure 6-1.System architecture
We assume there are K links in the network, where each link is an
(ordered) transmitterreceiver pair. The network is associated with a conflict
graph (or CG) G= {V, E}, where V is the set of vertices (each of them represents
a link) and E is the set of edges. Two links cannot transmit at the same time (i.e.,
conflict) if and only if there is an edge between them.
Assume that the links are always back-logged. If the transmitter of link k
senses the transmission of any conflicting link (i.e., any link m such that (k, m)
E), then it keeps silent. If none of its conflicting links is transmitting, then thetransmitter of link k waits (or backs off) for a random period of time that is
17
Edge
N
N
Links which as
high Service Rate
and Arrival Ratewill be traverse
first.
NN
N
N
N
N
Source
Source
N
N
N
Node
Destination
Destination
8/3/2019 Full Doc_m
18/54
exponentially distributed and then starts its transmission. If some conflicting link
starts transmitting during the back off, then link suspends its back off and
resumes it after the conflicting transmission is over. The transmission time of link
k is exponentially distributed with mean 1. Assuming that the sensing time is
negligible, given the continuous distribution of the back off times, the probabilityfor two conflicting links to start transmission at the same time is zero. Therefore,
in the model collisions do not occur.
.
18
8/3/2019 Full Doc_m
19/54
7. SYSTEM IMPLEMENTATION
7.1 MODULES
Neighbor Nodes detection.
Link Weight Manipulation.
Path Manipulation.
Message Transfer.
Markov Chain
7.1.1 Neighbor Nodes detection:
A wireless ad hoc network is a decentralized wireless network. The network
is ad hoc because it does not rely on a preexisting infrastructure, such
as routers in wired networks oraccess points in managed (infrastructure)
wireless networks. Instead, each node participates in routing by forwarding data
for other nodes, and so the determination of which nodes forward data is made
dynamically based on the network connectivity. Each and every node in the
network detects its neighbor node, which will be used for establish link and
identifying of routing path in future.
7.1.2 Link Weight Manipulation:
Each node shares there link weight between the neighbor nodes. While
CSMA routing defers the final route selection, the candidate forwarding nodes
should still be selected in advance.
The shortest path problem is the problem of finding a path between two
nodes such that the sum of the weights of its constituent edges is minimized. An
example is finding the quickest way to get from one location to another on a road
map; in this case, the vertices represent locations and the edges represent
segments of road and are weighted by the time needed to travel that segmentand we manipulate through link weight.
For joint scheduling and congestion control, however, directly using the
expression of service rate will lead to a non-convex problem.
7.1.3 Path Manipulation
A wireless ad hoc network consists of a collection of mobile nodes
interconnected by multihop wireless paths with wireless transmitters and
receivers. Such networks can be spontaneously created and operated in a self-
19
http://en.wikipedia.org/wiki/Wireless_networkhttp://en.wikipedia.org/wiki/Ad_hochttp://en.wikipedia.org/wiki/Routerhttp://en.wikipedia.org/wiki/Access_pointhttp://en.wikipedia.org/wiki/Wireless_networkhttp://en.wikipedia.org/wiki/Ad_hochttp://en.wikipedia.org/wiki/Routerhttp://en.wikipedia.org/wiki/Access_point8/3/2019 Full Doc_m
20/54
organized manner, because they do not rely upon any preexisting network
infrastructure.
In particular, it is not easy to achieve the maximal throughput through
distributed scheduling, which in turn prevents full utilization of the wireless
network. Scheduling is challenging since the conflicting relationships betweendifferent links can be complicated.
7.1.4 Message Transfer:
There are K links in the networks where each link is a transmitter and
receiver pair. Two links cannot transmit at the same time (i.e., conflict) if there is
an edge between them. The message transfer framework also includes the
node-exclusive model and two-hop interference model.
If the transmitter of link senses the transmission of any conflicting link, then
it keeps silent. If none of its conflicting links is transmitting, then the transmitter of
link waits (or backs off) for a random period of time and then starts its
transmission.
7.1.5 Markov chain:
Markov chain model is used for scheduling the path for data transmission.
Transitions of the transmission states are observed perfectly to form a
continuous-time Markov chain, which is called the CSMA Markov chain. If there
are two links with an edge between them, which means that they cannot transmit
together. State (0, 0) means that no link is transmitting, state (1, 0) means that
only link 1 is transmitting, and (0, 1) means that only link 2 is transmitting. The
state (1, 1) is not feasible.
Markov Property: means that the state of the system at time t+1 only
depends on the state of the system at t. A Markov chain is a random process with
the Markov property, i.e. the property that the next state depends only on the
current state and not on the past.
Congestion control with the CSMA scheduling algorithm is to achieve
fairness among competing flows as well as the maximal throughput. Here, the
input rates are distributedly adjusted by the source of each flow.
20
http://en.wikipedia.org/wiki/Stochastic_processhttp://en.wikipedia.org/wiki/Markov_propertyhttp://en.wikipedia.org/wiki/Stochastic_processhttp://en.wikipedia.org/wiki/Markov_property8/3/2019 Full Doc_m
21/54
8. TESTING
8.1 INTRODUCTION:
After finishing the development of any computer based system the next
complicated time consuming process is system testing. During the time of testing
only the development company can know that, how far the user requirements
have been met out, and so on.
Software testing is an important element of the software quality assurance
and represents the ultimate review of specification, design and coding. The
increasing feasibility of software as a system and the cost associated with the
software failures are motivated forces for well planned through testing.
8.2 TESTING OBJECTIVES
These are several rules that can save as testing objectives they are:
Testing is a process of executing program with the intent of finding an
error.
A good test case is one that has a high probability of finding an
undiscovered error.
8.3 TESTING METHODS:
Following are the some of the testing methods applied to this effective project:
8.3.1 Source Code Testing:
This examines the logic of the system. If we are getting the output that is
required by the user, then we can say that the logic is perfect.
8.3.2 Specification Testing:
We can set with, what program should do and how it should perform under
various condition. This testing is a comparative study of evolution of systemperformance and system requirements.
8.3.3 Module Level Testing:
In this the error will be found at each individual module, it encourages the
programmer to find and rectify the errors without affecting the other modules.
8.3.4 Unit Testing:
Unit testing focuses on verifying the effort on the smallest unit of software-
module. The local data structure is examined to ensure that the date stored
temporarily maintains its integrity during all steps in the algorithms execution.
21
8/3/2019 Full Doc_m
22/54
Boundary conditions are tested to ensure that the module operates properly at
boundaries established to limit or restrict processing.
8.3.5 Integration Testing:
Data can be tested across an interface. One module can have an
inadvertent, adverse effect on the other. Integration testing is a systematictechnique for constructing a program structure while conducting tests to uncover
errors associated with interring.
8.3.6 Validation Testing:
It begins after the integration testing is successfully assembled. Validation
succeeds when the software functions in a manner that can be reasonably
accepted by the client. In this the majority of the validation is done during the
data entry operation where there is a maximum possibility of entering wrong data.
Other validation will be performed in all process where correct details and data
should be entered to get the required results.
8.3.7 Recovery Testing:
Recovery Testing is a system that forces the software to fail in variety of
ways and verifies that the recovery is properly performed. If recovery is
automatic, re-initialization, and data recovery are each evaluated for correctness.
8.3.8 Security Testing:Security testing attempts to verify that protection mechanism built into
system will in fact protect it from improper penetration. The tester may attempt to
acquire password through external clerical means, may attack the system with
custom software design to break down any defenses to others, and may
purposely cause errors.
8.3.9 Performance Testing:
Performance Testing is used to test runtime performance of software
within the context of an integrated system. Performance test are often coupled
with stress testing and require both software instrumentation.
8.3.10 Black box Testing:
Black- box testing focuses on functional requirement of software. It
enables to derive input conditions that will fully exercise all functional
requirements for a program. Black box testing attempts to find error in the
following category:
22
8/3/2019 Full Doc_m
23/54
Incorrect or missing function
Interface errors
Errors in data structures or external database access
Performance errors.
8.3.11 Output Testing:
After performing the validation testing, the next step is output testing of the
proposed system since no system would be termed as useful until it does
produce the required output in the specified format. Output format is considered
in two ways, the screen format and the printer format.
8.3.12 User Acceptance Testing:
User Acceptance Testing is the key factor for the success of any system.
The system under consideration is tested for user acceptance by constantly
keeping in touch with prospective system users at the time of developing and
making changes whenever required.
23
8/3/2019 Full Doc_m
24/54
9. SCREEN SHOTS
Figure 9-1.Setting distance between nodes
Fig.9-1 shows how the distance for a node in the region1can be set.
24
8/3/2019 Full Doc_m
25/54
Figure 9-2.Placing a node in region1
Fig.9-2 shows how a region for a node can be set.
25
8/3/2019 Full Doc_m
26/54
Figure 9-3.Window for first node in region1
Fig.9-3 shows how the distance for first node in region1 can be set.
26
8/3/2019 Full Doc_m
27/54
Figure 9-4.Setting Distance between nodes in region2
Fig.9-4 shows how the distance for first node in region2 can be set.
27
8/3/2019 Full Doc_m
28/54
Figure 9-5.Placing a node in region2
Fig.9-5 shows how a region for a node can be set.
28
8/3/2019 Full Doc_m
29/54
Figure 9-6.Window for first node in region2
Fig.9-6 shows the first node which is in the region2 which was obtained by
setting the distance and the region
29
8/3/2019 Full Doc_m
30/54
Figure 9-7.Window for fourth node in region2
Fig.9-7 shows the fourth node which is in the region2 which was obtained by
setting the distance and the region.
30
8/3/2019 Full Doc_m
31/54
Figure 9-8.Two nodes in different regions
Fig.9-8 shows how the nodes (which are going to be connected) are to be
kept while setting the destination.
31
8/3/2019 Full Doc_m
32/54
Figure 9-9.Setting destinations for three nodes
Fig.9-9 shows how the destination node for any node can be set in the
destination field.
32
8/3/2019 Full Doc_m
33/54
Figure 9-10.Browsing data to be sent
Fig.9-10 shows that the data to be sent is display before sending it to the
destination node.
33
8/3/2019 Full Doc_m
34/54
Figure 9-11.Information message box1
Fig.9-11 shows how the data from a node is transferred through different
nodes while reaching the destination node.
34
8/3/2019 Full Doc_m
35/54
Figure 9-12.Information message box2
Fig.9-12 also shows how the data from a node is transferred through
different nodes while reaching the destination node.
35
8/3/2019 Full Doc_m
36/54
Figure 9-13.Information message box3
Fig.9-13 shows an information message that a message has come from a
source node.
36
8/3/2019 Full Doc_m
37/54
Figure 9-14.Showing received data
Fig.9-14 shows the data received at the destination node which was sent from
the source node.
37
8/3/2019 Full Doc_m
38/54
Figure 9-15.Information message box4
Fig.9-15 shows the message regarding the nodes through which the data is
being transmitted.
38
8/3/2019 Full Doc_m
39/54
10. SAMPLE SOURCE CODE
//Main.java
package com.Design;
import javax.swing.JOptionPane;
import com.logic.RandomData;
public class Main {
public static void main(String[] args) {
boolean ch = false;
String distance=null;
String region="default";boolean status=true;
boolean temp=true;
while (true) {
distance = JOptionPane.showInputDialog(null, "Enter the
Distance",
"Message", 0);
if (distance == null)
System.exit(0);
char[] c = distance.toCharArray();
// try
// {
for (int i = 0; i < c.length; i++) {
try {
// System.out.println((int)c[i]);
if (c[i] == 46 || c.length >= 5) {
JOptionPane.showMessageDialog(null,
"invalid");
System.exit(0);
}
if (c[i] = 48) {
ch = true;
} else {
// if(c[i]==46)
// {
//
JOptionPane.showMessageDialog(null, "invalid");// }
39
8/3/2019 Full Doc_m
40/54
// else
// {
JOptionPane.showMessageDialog(null,
"invalid");
break;
// }
}
} catch (Exception e) {
System.exit(0);
}
}
if (ch) {
break;
}
}while(status)
{
temp=true;
region= JOptionPane.showInputDialog(null, "Enter the
Region");
if(region==null)
System.exit(0);
char[] charArray=region.toCharArray();char[] charTemp=new char[charArray.length];
for (int i = 0; i < charArray.length; i++) {
try {
charTemp[i]=charArray[i];
if(charArray[i]>=33 && charArray[i]
8/3/2019 Full Doc_m
41/54
break;
}
}
else if(region.equals(""))
{
temp=false;
break;
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
if(temp==true)
{
break;
}
else
{
continue;
}
}
if(temp==true)
{
Design des = new Design();
des.DesignForm(distance, region);
}
}
}
//design.java
package com.Design;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;import java.io.ObjectOutputStream;
41
8/3/2019 Full Doc_m
42/54
import java.net.InetAddress;
import java.net.Socket;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.Vector;
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import com.logic.LinkWeight;
import com.logic.Multicst;
import com.logic.PacketsSpliting;
import com.logic.RandomData;
import com.logic.Receiver;
import com.logic.ServerReceive;
import com.serial.SerialCsma;
public class Design implements ActionListener
{
JFrame fra=new JFrame();
JLabel labfor=new JLabel(new ImageIcon("back.png"));
JFrame sf=null;
Socket socket = null;
JButton files;
PacketsSpliting packetSplit = new PacketsSpliting();
JTextField jTextFieldDest = null;
public String content = new String();
ObjectOutputStream objectOutputStream = null;
RandomData randomData = new RandomData();
JTextArea contentTex;
String nodeName = "";
JLabel titlel=new JLabel("Project Title",0);
JLabel exit=new JLabel("");
String distance = "";
String linkWeight = "";
String portNo = "";
Multicst multicst = null;
42
8/3/2019 Full Doc_m
43/54
Receiver receiver = null;
String region = "";
public static JTextArea NeighbourjTextArea = null;
JScrollPane jScrollPane = null;
JButton jButtonSend = null;
JButton jButtonPath = null;
JButton jbuttonFile = null;
public static DefaultTableModel defaultTableModelWeight = null;
public static JTable jTableWeight = null;
JLabel jLabelWeight = null;
// public static DefaultTableModel defaultTableModelPath = null;
public static JFileChooser jFileChooser = null;
public static JTextArea jTextAreaPath = null;
JLabel jLabelPath = null;
ServerReceive serverReceive = null;
JButton oks;
public void DesignForm(String distance, String region)
{
System.out.println(region);
this.region = region.toLowerCase();
this.distance = distance;
labfor.setLayout(null);
// titlel.setBounds(5,15,700-10,100);
exit.setBounds(700-15,5,10,10);
exit.setBorder(BorderFactory.createLineBorder(Color.RED,4));
//titlel.setBorder(BorderFactory.createLineBorder(Color.RED,0));
//titlel.setFont(new Font("castellar",Font.CENTER_BASELINE,20));
//titlel.setForeground(Color.cyan);
defaultTableModelWeight = new DefaultTableModel();jTableWeight = new JTable(defaultTableModelWeight);
43
8/3/2019 Full Doc_m
44/54
// defaultTableModelPath = new DefaultTableModel();
// jTablePath = new JTable(defaultTableModelPath);
jFileChooser = new JFileChooser();
jTextAreaPath = new JTextArea();
nodeName = randomData.NodeName();
portNo = randomData.portNo();
multicst = new Multicst(portNo, distance, region);
receiver = new Receiver(portNo, distance, region);
receiver.setname(nodeName);
receiver.setMul(distance);
serverReceive = new ServerReceive(portNo, receiver, nodeName);
multicst.setsys(nodeName);
linkWeight = randomData.LinkWeight();
jButtonSend = new JButton(new ImageIcon("send.png"));
jButtonSend.setBounds(450,280, 102,32);
jButtonSend.addActionListener(this);jButtonPath = new JButton(new ImageIcon("path.png"));
jButtonPath.setBounds(130, 280, 100, 30);
jButtonPath.addActionListener(this);
jbuttonFile = new JButton(new ImageIcon("browse.png"));
jbuttonFile.setBounds(450,230, 102, 32);
jbuttonFile.addActionListener(this);
JLabel jlabelNodeName = new JLabel(""+nodeName+"",0);
jlabelNodeName.setBounds(310,240,80,40);
JLabel jlabelregion= new JLabel(""+region+"",0);
jlabelregion.setBounds(310,140,80,40);
JLabel jlabelDistance = new JLabel(""+distance+"",0);
jlabelDistance.setBounds(310,290,80,40);
JLabel jlabelDestination = new JLabel();
jlabelDestination.setBounds(130,215,100,45);
jlabelDestination.setLayout(null);
jTextFieldDest = new JTextField("Destination");
jTextFieldDest.setBounds(5, 20, 90, 20);
JLabel jlabelNeighbour = new JLabel("Neighbour Node's");
jlabelNeighbour.setBounds(250,350,210,223);
NeighbourjTextArea = new JTextArea("Neighbour Node's", 30, 10);
jScrollPane = new JScrollPane(NeighbourjTextArea,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
44
8/3/2019 Full Doc_m
45/54
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
jScrollPane.setBounds(5,20, 200, 200);
jLabelWeight = new JLabel("Link Weight");
jLabelWeight.setBounds(20, 350, 210, 223);
jLabelWeight.setLayout(null);
defaultTableModelWeight.addColumn("Pair");
defaultTableModelWeight.addColumn("Link Weight");
JScrollPane jScrollPanePath = new JScrollPane(jTableWeight);
jScrollPanePath.setBounds(5, 20, 200, 200);
// defaultTableModelPath.addColumn("Path");
// defaultTableModelPath.addColumn("Total Weight");
JScrollPane jScrollPaneWeight = new JScrollPane(jTextAreaPath);
jScrollPaneWeight.setBounds(5, 20, 200, 200);
jLabelPath = new JLabel("List of Path");
jLabelPath.setBounds(480, 350, 210, 223);jLabelPath.setLayout(null);
jlabelNodeName.setForeground(Color.cyan);
jlabelNodeName.setFont(new
Font("Arial",Font.CENTER_BASELINE,12));
jlabelNodeName.setBorder(BorderFactory.createTitledBorder(BorderFactory.cre
ateLineBorder(Color.magenta,1),"Node Name",0,0,new
Font("Arial",Font.PLAIN,12),Color.yellow));
jlabelregion.setForeground(Color.cyan);
jlabelregion.setFont(new
Font("Arial",Font.CENTER_BASELINE,12));
jlabelregion.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.magenta,1),"REGION",0,0,new
Font("Arial",Font.PLAIN,12),Color.yellow));
jlabelDistance.setForeground(Color.cyan);
jlabelDistance.setFont(new
Font("Arial",Font.CENTER_BASELINE,12));
jlabelDistance.setBorder(BorderFactory.createTitledBorder(BorderFactory.create
45
8/3/2019 Full Doc_m
46/54
LineBorder(Color.magenta,1)," Distance ",0,0,new
Font("Arial",Font.PLAIN,12),Color.yellow));
jTextFieldDest.setBorder(BorderFactory.createLineBorder(Color.cyan,0));
jlabelDestination.setForeground(Color.cyan);
jlabelDestination.setFont(new
Font("Arial",Font.CENTER_BASELINE,12));
jlabelDestination.setBorder(BorderFactory.createTitledBorder(BorderFactory.crea
teLineBorder(Color.magenta,1)," Destination ",0,0,new
Font("Arial",Font.PLAIN,12),Color.yellow));
jlabelNeighbour.setForeground(Color.cyan);jlabelNeighbour.setFont(new
Font("Arial",Font.CENTER_BASELINE,12));
jlabelNeighbour.setBorder(BorderFactory.createTitledBorder(BorderFactory.creat
eLineBorder(Color.magenta,1)," Link Weight ",0,0,new
Font("Arial",Font.PLAIN,12),Color.yellow));
jLabelWeight.setForeground(Color.cyan);
jLabelWeight.setFont(new
Font("Arial",Font.CENTER_BASELINE,12));
jLabelWeight.setBorder(BorderFactory.createTitledBorder(BorderFactory.createL
ineBorder(Color.magenta,1)," Neighbour Node ",0,0,new
Font("Arial",Font.PLAIN,12),Color.yellow));
jLabelPath.setForeground(Color.cyan);
jLabelPath.setFont(new
Font("Arial",Font.CENTER_BASELINE,12));
jLabelPath.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLin
eBorder(Color.magenta,1)," List of Path ",0,0,new
Font("Arial",Font.PLAIN,12),Color.yellow));
jButtonSend.setBorder(BorderFactory.createLineBorder(Color.RED,0));
jButtonSend.setBackground(Color.BLACK);
46
8/3/2019 Full Doc_m
47/54
jbuttonFile.setBorder(BorderFactory.createLineBorder(Color.RED,0));
jbuttonFile.setBackground(Color.BLACK);
jButtonPath.setBorder(BorderFactory.createLineBorder(Color.RED,0));
jButtonPath.setBackground(Color.BLACK);
labfor.setBorder(BorderFactory.createLineBorder(Color.black,5));
jlabelDestination.add(jTextFieldDest);
jLabelPath.add(jScrollPaneWeight);
jLabelWeight.add(jScrollPanePath);
jlabelNeighbour.add(jScrollPane);
labfor.add(jbuttonFile);labfor.add(jLabelPath);
//labfor.add(jScrollPaneWeight);
labfor.add(jLabelWeight);
//labfor.add(jScrollPanePath);
labfor.add(jButtonSend);
labfor.add(jButtonPath);
//labfor.add(jTextFieldDest);
labfor.add(jlabelDestination);
labfor.add(jlabelDistance);labfor.add(jlabelNodeName);
labfor.add(jlabelregion);
labfor.add(jlabelNeighbour);
labfor.add(titlel);
labfor.add(exit);
//labfor.add(jScrollPane);
fra.add(labfor);
fra.setTitle(nodeName);
fra.setUndecorated(false);
fra.setResizable(false);
fra.setLocation(100,100);
fra.setSize(700, 600);
fra.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == jButtonPath) {
47
8/3/2019 Full Doc_m
48/54
try {
//
linkWeightObj.calculateWeight(nodeName,NeighbourjTextArea.getText());
int size=receiver.nei_tree.size();
if(size>3)
{
JOptionPane.showMessageDialog(null,
jTextFieldDest.getText());
int port = Integer.parseInt(portNo);
String sysInfo =
receiver.curd.get(nodeName).toString();
String[] info = sysInfo.split(":");
ObjectOutputStream objectOutputStream =
SocketSend(info[1],
info[0]);objectOutputStream.writeObject("Neighbour-"
+ jTextFieldDest.getText().trim());
}
else
{
JOptionPane.showMessageDialog(null,
"Neighbour Nodes should be more than 4");
}
// System.out.println("qqqqq" + serverReceive.edge);} catch (Exception ex) {
ex.printStackTrace();
}
}
if (e.getSource() == jbuttonFile) {
CallB();
/*byte[] byt;
int returnVal = jFileChooser.showOpenDialog(fra);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = jFileChooser.getSelectedFile();
// content=packetSplit.Split(file.getAbsolutePath());
try {
FileInputStream fileInputStream=new
FileInputStream(file);
try {
byt = newbyte[fileInputStream.available()];
48
8/3/2019 Full Doc_m
49/54
fileInputStream.read(byt);
content=new String(byt);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// System.out.println("content...."+content);
}*/
}
if (e.getSource() == jButtonSend) {
int count = 1;
String path = serverReceive.linkPath;
String edge = serverReceive.edge;
String dest = jTextFieldDest.getText().toString();
System.out.println("path.." + path);
String[] split = path.split("-");
// TreeMap dataPath=new TreeMap();
String sysInfo = receiver.curd.get(split[1].trim()).toString();String[] info = sysInfo.split(":");
ObjectOutputStream objectOutputStream =
SocketSend(info[1], info[0]);
System.out.println("content........"+content);
int arrivalRate=ArrrivalRate();
try {
Thread.sleep(arrivalRate);
} catch (InterruptedException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
SerialCsma serialCsma = new SerialCsma(nodeName,
edge, dest, path,
content.toString().trim(),arrivalRate);
try {
objectOutputStream.writeObject(serialCsma);
} catch (IOException e1) {
// TODO Auto-generated catch blocke1.printStackTrace();
49
8/3/2019 Full Doc_m
50/54
}
}
if (e.getSource() == oks)
{
content=contentTex.getText().trim();
sf.setVisible(false);
}
if(e.getSource()==files)
{
byte[] byt;
int returnVal = jFileChooser.showOpenDialog(fra);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = jFileChooser.getSelectedFile();
// content=packetSplit.Split(file.getAbsolutePath());
try {FileInputStream fileInputStream=new
FileInputStream(file);
try {
byt = new
byte[fileInputStream.available()];
fileInputStream.read(byt);
content=new String(byt);
} catch (IOException e1) {// TODO Auto-generated catch block
e1.printStackTrace();
}
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// System.out.println("content...."+content);
contentTex.setText(content.trim());
}
}
}
public ObjectOutputStream SocketSend(String sysname, String port) {
try {
socket = new Socket(sysname, Integer.parseInt(port));
objectOutputStream = new ObjectOutputStream(socket
.getOutputStream());
50
8/3/2019 Full Doc_m
51/54
} catch (Exception e) {
e.printStackTrace();
}
return objectOutputStream;
}
public static void main(String args[])
{
new Design().DesignForm("78","s");
}
public static int ArrrivalRate()
{
Random random=new Random();
String value=String.valueOf(random.nextInt(10))
+String.valueOf(random.nextInt(10))+String.valueOf(random.nextInt(10))
+String.valueOf(random.nextInt(10));return Integer.parseInt(value);
}
public void CallB()
{
sf=new JFrame();
sf.setTitle("Input");
JLabel sfl=new JLabel(new ImageIcon("back.png"));
contentTex=new JTextArea();JScrollPane sp = new JScrollPane(contentTex);
sp.setBounds(6,6,200,205);
sfl.setBorder(BorderFactory.createLineBorder(Color.cyan,5));
oks=new JButton(new ImageIcon("ok.png"));
oks.setBounds(21,215,80,25);
oks.setBorder(BorderFactory.createLineBorder(Color.RED,0));
oks.setBackground(Color.BLACK);
sfl.add(oks);
oks.addActionListener(this);
files=new JButton(new ImageIcon("file.png"));
files.addActionListener(this);
files.setBounds(111,215,80,25);
files.setBorder(BorderFactory.createLineBorder(Color.RED,0));
files.setBackground(Color.BLACK);
sfl.add(files);
sfl.add(sp);
sf.add(sfl);
sf.setUndecorated(true);sf.setResizable(false);
51
8/3/2019 Full Doc_m
52/54
sf.setLocation(200,200);
sf.setSize(212,250);
sf.setVisible(true);
}
11. CONCLUSION AND FUTURE ENHANCEMENT
11.1 CONCLUSION
This work is the first approach towards distributed maxi-mum throughput
algorithms for wireless networks. Although we have made a theoretical
contribution and have taken implementation constraints into account, much work
is required in order to develop truly implement able algorithms. Some of the key
issues in that context are: (i) how should the control messages is transmitted in anode-exclusive spectrum sharing model, (ii) what are the tradeoffs between
throughput, delay, and decentralization costs, and (iii) how the algorithms deal
with an asynchronous network.
11.2 FUTURE ENHANCEMENTS
Current performance analysis of Algorithms is based on a separation of
time scales, i.e., the vector is adapted slowly to allow the CSMA Markov chain to
closely track the stationary distribution . The results however, indicate that such
slow adaptations are not always necessary. In the future enhancements, more
about the case without time-scale separation can be performed.
52
8/3/2019 Full Doc_m
53/54
12. BIBLIOGRAPHY
REFERENCES:
[1] X. Lin, N. B. Shroff, and R. Srikant, A tutorial on cross-layer optimization in
wireless networks, IEEE J. Sel. Areas Commun., vol. 24, no. 8, pp. 14521463,
Aug. 2006.
[2] L. Jiang and J. Walrand, A distributed CSMA algorithm for throughput and
utility maximization in wireless networks, in Proc. 46th Annu. Allerton Conf.
Commun., Control, Comput., Sep. 2326, 2008, pp. 15111519.
[3] A. Eryilmaz, A. Ozdaglar, and E. Modiano, Polynomial complexity algorithms
for full utilization of multi-hop wireless networks, in Proc. IEEE INFOCOM,
Anchorage, AK, May 2007, pp. 499507.
[4] E. Modiano, D. Shah, and G. Zussman, Maximizing throughput in wireless
networks via gossiping, ACM SIGMETRICS Perform. Eval. Rev., vol. 34, no. 1,
pp. 2738, Jun. 2006.
[5] S. Sanghavi, L. Bui, and R. Srikant, Distributed link scheduling with constantoverhead, in Proc. ACM SIGMETRICS, Jun. 2007, pp. 313324.
[6] J. W. Lee, M. Chiang, and R. A. Calderbank, Utility-optimal random-access
control, IEEE Trans. Wireless Commun., vol. 6, no. 7, pp. 27412751, Jul. 2007.
[7] P. Gupta and A. L. Stolyar, Optimal throughput allocation in general random
access networks, in Proc. Conf. Inf. Sci. Syst., Princeton, NJ, Mar. 2006, pp.
12541259.
[8] X. Wu and R. Srikant, Scheduling efficiency of distributed greedy scheduling
algorithms in wireless networks, in Proc. IEEE INFOCOM, Barcelona, Spain,
Apr. 2006, pp. 112.
[9] P. Chaporkar, K. Kar, and S. Sarkar, Throughput guarantees in maximal
scheduling in wireless networks, in Proc. 43rd Annu. Allerton Conf. Commun.,
Control, Comput., Sep. 2005, pp. 15571567.
[10] A. Dimakis and J. Walrand, Sufficient conditions for stability of longest-
queue-first scheduling: Second-order properties using fluid limits, Adv. Appl.
Probab., vol. 38, no. 2, pp. 505521, 2006.
53
8/3/2019 Full Doc_m
54/54
[11] C. Joo, X. Lin, and N. Shroff, Understanding the capacity region of the
greedy maximal scheduling algorithm in multi-hop wireless networks, in Proc.
IEEE INFOCOM, Phoenix, AZ, Apr. 2008, pp. 11031111.