mobile advanced networks spring 2010 lab session mobile communication department eurecom 1©navid...

34
Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1 ©Navid Nikaein 2010

Upload: osborne-peters

Post on 17-Jan-2016

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Mobile Advanced NetworksSpring 2010

Lab Session

Mobile Communication DepartmentEurecom

1©Navid Nikaein 2010

Page 2: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Key points of this lab session• Simulation of topology control (TC) algorithms for

wireless sensor networks• A network simulator will be presented• You will be required to implement a TC for

wireless sensor networks • You may organize yourselves in groups of at most

3 students• You will need to provide a report of at least two

pages comparing the three TC control algorithms– Kneighbour, fixed range and the one you will

implement

©Navid Nikaein 2010 2

Page 3: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Fast review: Wireless sensor networks and Topology Control

©Navid Nikaein 2010 3

Page 4: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Wireless Sensor Networks

©Navid Nikaein 2010 4

Page 5: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Wireless Sensor Networks• No infrastructure• Multi-hop topology• Nodes communicate via wireless radio interface• Nodes have finite energy resources• Applications generate low-rate data traffic• Main aim

– prolong life span of Sensor Networks• How ?

– propose solutions that increases the capacity and promote energy conservation

• Topology Control and Clustering

©Navid Nikaein 2010 5

Page 6: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Wireless Sensor Networks

©Navid Nikaein 2010 6

Page 7: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

WSNs Challenges • High density and Large number of nodes • Low computational power

– Current mote processors run at < 10 MIPS– 4 KB of memory not enough to store significant data

• Poor communication bandwidth– Current radios achieve about 10 Kbps per mote

• Limited energy budget– 2 AA motes provide about 2850 mAh– Coin-cell Li-Ion batteries provide around 800 mAh– Solar cells can generate around 5 mA/cm2 in direct sunlight– Must use low duty cycle operation to extend lifetime beyond a

few days

©Navid Nikaein 2010 7

Page 8: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Topology Control

©Navid Nikaein 2010 8

Page 9: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Recall of Topology Control Algorithm

• Wireless sensor networks can NOT be regarded as a reliable communication system when it may partition

• Dilemma of adjusting the transmission power of individual nodes– Lowering the transmission power to increase the

capacity (throughput) due to larger spatial reuse– Increase the transmission power to avoid

network partitioning

©Navid Nikaein 2010 9

Page 10: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Topology Control Strategies• Max-degree topology:

– Adjust the number of links (neighbors) for each node in a range of [k min, k max]

– If more that k max , then reduce the P tx

– If less than k min, then raise the P tx

• K-Nearest-neighbor-topology:– Connect to at least k nearest neighbors – There is an edge iff one of the nodes to other k-nearest

neighbor• Number of neighbors could be larger that K

• Fixed Range:– Connect to all in the range

©Navid Nikaein 2010 10

Page 11: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Connectivity Graph

©Navid Nikaein 2010 11

WCDS

Nearest Neighbor (k=4)

Fixed Range (r=75)

Page 12: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Other Results and Experimentations

©Navid Nikaein 2010 12

TC Pedestrians

Avg. Degree

Pedestrians + VehicularAvg. Degree

Pedestrians

%Disconnected

Pedestrians + Vehicular%Disconnected

Pedestrians

Avg. Path Size

Pedestrians + VehicularAvg. Path Size

Pedestrians

Max. Path Size

Pedestrians + VehicularMax. Path Size

Fixed Range 100m

75.14 82.14 0.20 0.22 1.12 1.13 2.88 2.94

IDS – 1 Relay 2.90 3.38 10.22 19.25 2.23 2.13 4.18 3.97

Nearest-neighbor 3

3.25 2.29 6.78 48.03 5.32 4.4 10.51 8.85

Nearest-neighbor 4

4.27 3.01 2.03 37.62 4.16 3.86 7.91 7.56

Nearest-neighbor 6

6.09 4.66 0.41 20.77 3.23 3.36 6.13 6.43

Nearest-neighbor 8

7.97 6.49 0.22 8.64 3.08 1.12 5.33 5.89

Nearest-neighbor 10

9.74 8.21 0.21 3.84 2.89 1.13 2.88 2.94

Page 13: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Java programming over eclipse

©Navid Nikaein 2010 13

Page 14: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Java and eclipse

• Objected oriented language• An infinity of documentation, examples, tutorials,

libraries, etc…

• The simulator is built in Java• Eclipse is one IDE to program

– Independent of Java– Free and open source

©Navid Nikaein 2010 14

Page 15: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

To Start• Get the simulator from:

– /homes/camara/htdocs/files/madvnet or– http://www.eurecom.fr/~camara/files/madvnet/

• Unzip it in a directory– Normally ~/workspace/sinalgo-0.75.3_AdvancedNet

• Open Eclipse– File>New>Project>Java Project– Set Project name as

“sinalgo-0.75.3_AdvancedNet”– You can finish the project

©Navid Nikaein 2010 15

Page 16: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Java Programming (1)

• The basic unit are classes• The instantiation of a class

is called object• Packages are used to

organize the classes– In java it is represented into

distinct directories

©Navid Nikaein 2010 16

package transport.enginepowered;public class car { protected Color color ; private int nDors; public car (Color color, int dors){ this.color = color; this. nDors = nDors; }

Color getColor() { return speed; }

int getNDors() { return nDors; }}

Page 17: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Java Programming (2)• Public methods/variables may be

accessed from any other class• Private, protected and package

not– Package: any class from the same

package has access– Private: is specific of the class, but

the subclasses, children, have access

– Protected: not even the subclass classes may access

• Inheritance is an important concept, enables reuse

©Navid Nikaein 2010 17

package transport.enginepowered;public class Pickup extends car { private int capacity; public car (Color color, int capacity){ super(color, 2); this.color = color; this. nDors = nDors; }

int getCapacity() { return nDors; }}

Page 18: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Sinalgo – Network Simulator

©Navid Nikaein 2010 18

Page 19: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Sinalgo – Network Simulator

• Developed by the Distributed Computing Group of ETH Zurich

• Main Characteristics– Developed to validate network and higher layers protocols– Easy to learn– Dispose of a series of useful examples– Java

• Easy to program and extend– Intuitive graphical interface

• 2D and 3D visualization – May be used in batch

©Navid Nikaein 2010 19

Page 20: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Simulator overview

• Discreate simulator, based on rounds– The events are discrete and sinchronous

• Models, such as mobility, distribution and transmission are applied to the Nodes

• Timers are in charge of activate the nodes in specific periods of time– The timers must be created and scheduled

• Nodes send and receive messages, activated by timers or messages reception

Models Timers

Nodes

Messages

Applied

Applied

Activate

Send/receive

Page 21: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Mobile Advanced Networks project• We implemented a new project, advancednet, to help in the

implementation of topology control algorithms

©Navid Nikaein 2010 21

Page 22: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Advanced Networks project

• Two topology control methods are implemented as a title of example– Nearest k neighbor– Fixed range

• To implement a new algorithm– Extend BasicNode– If a new message is required, one should extend

Basic Message

©Navid Nikaein 2010 22

Nearest Neighbor (k=4)

Fixed Range (r=75)

Page 23: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Main components

• For each one of the modules one can use the already implemented classes, extend the existing ones or create a completely new class– Models: define the behavior of the node regarding: mobility, distribution,

connectivity... – Node: define the behavior of the node itself. E.g., what it should do

when receive a message of a defined type– Messages: transference of data from one node to the other, respecting

the connectivity model– Timer: trigered at a defined time to perform a specific task. E.g., send a

hello message

Models Timers

Nodes

Messages

Applied

Applied

Activate

Send/receive

daniel
see later
Page 24: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Step by step example (1)

• Runing the project– Open eclipse– Run class sinalgo.Run– Select the advancednet

project– Change the config

if you need to• Save config

– Press OK

Page 25: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Step by step example (2)• Add nodes

– Select the nodes characteristics– Number of Nodes: The number

of nodes of this kind will be present

– Distribution: The way nodes will be spread over the area

– Node Implementation: Which node will be used

– Connectivity Model: The kind of interface will be used

– Interference Model: The characteristic of the medium

– Mobility Model: How the nodes will move around

– Reliability Model: How trustful the communication is

• Press OK

©Navid Nikaein 2010 25

Page 26: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Step by step example (3)

• The nodes will be spread over the area with their initial state

• Run– You may choose to

run the simulation for a specific number of steps or “run forever”

• Stop

©Navid Nikaein 2010 26

Page 27: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Step by step example (4)• Classes

– projects.advancednet.nodes.nodeImplementations.BasicNode• Basic node operations: drawing, power control, basic message control

– projects.advancednet.nodes.nodeImplementations. MobileNodeNearestNeighbour

• Exteds the BasicNode class to perform the k- nearest neighbor topology control

– projects.advancednet.nodes.timers.ConnectionTimerNearesNeighbour

• Controls the periodical hello message required by the protocol

– projects.advancednet.nodes.messages.BasicMessage

• Basic message data, if you create a new message you should extend this class

©Navid Nikaein 2010 27

Page 28: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Step by step example (5)

• MobileNodeNearestNeighbour– public void init() : called just once to initialize the

node– public void preStep() : called for initializations before

a round– public void postStep() : called after a round– public void handleInputMessages(Inbox inbox) :

Called every time the node receives a message• The received messages are stored in the inbox• The reception of each kind of message should receive a

specific treatment

©Navid Nikaein 2010 28

Page 29: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Specific configuration entries• <GeometricNodeCollection rMax="250"/>• <UDG rMax="250"/>• <MessageTransmission ConstantTime="1"/>• <Node defaultSize="10"/>

• <Connection>• <StartIntervall distribution="Uniform" min="1" max="5"/><!-- How often a node sends an update msg-->• <RefreshRate value="5"/> <!-- How often the node sends updates -->• <Size value="15"/> • </Connection>

• <MobileNode> • <Size value="4"/>• <SlowEntrance value="false"/> <!-- Nodes should randomly enter through the simulation time or start all at once -->• <enableLog value="true"/> <!-- The node should generate a log or not -->• <drawRange value="false"/> <!-- The range of the node should appear in the interface -->• </MobileNode>

• <LossyDelivery DropRate="0.01"/> <!-- if using unreliable transm. The drop rate used-->• <StopWhenNoChange value="false"/> <!-- if there is no changes perceived the simulation should stop or not -->• <GennerateMap value="false"/> <!-- The map , histogram, with the nodes distribution should be gennerated -->

• <Kneighbourhood k="3"/> <!-- Size of the K for the k-neighborhood algorithm -->

• <RandomDirection> <!-- if using the random direction mobility model, the controling parameters -->• <NodeSpeed distribution="Gaussian" mean="2" variance="4" />• <WaitingTime distribution="Poisson" lambda="10" />• <MoveTime distribution="Uniform" min="5" max="20" />• </RandomDirection>

• <Presentation delayPresentation="false" delayTimeMS="200"/> <!-- If the results should be presented with a delay between steps and, of how much -->

• <Energy> • <ControlEnergy value="true"/> <!-- if the node should control its energy, true means that of the energy is 0 no message will be sent/ received by this node -->• <Random value="true" /><!-- Random initialization of the energy levels, if false the Max amount will be set to all nodes-->• <DecrementTx value ="0.02" /> <!-- How much should be decreased in a message transmission -->• <DecrementRx value="0.01" /> <!-- How much should be decreased in a message reception-->• <Max value="100" /> <!-- Max and min energy amount at each node, for the random initialization the nodes energy will be set between these values -->• <Min value="10"/> • </Energy>•

©Navid Nikaein 2010 29

Page 30: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Running the simulations and evaluating the results

• runExperiments.sh– Shell script to run the experiments in batch– It is prepared to run for the k-Neighbour algorithm

• For the report you should change/add your own implementation• LogAnalysis.sh

– Gets the results of the log directory, compile, threats and generate gnuplot programs

– The logs will be generated in “logs/advancedNet”• If you need any modification you should change

projects.advancednet.LogAnalysis class• To generate the images

– cd logs/advancedNet– chmod 755 generatePlots.sh– ./generatePlots.sh

©Navid Nikaein 2010 30

Page 31: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Log file • A condensed log is generated by

projects.advancednet.CustomGlobal• Format

• projects.advancednet.LogAnalysis– Grabs the logs, from the specified directory and generates the

data files and gnuplot programs• If you want to grab more information or analyze your own If you want to grab more information or analyze your own

algorithm these files should be modified accordinglyalgorithm these files should be modified accordingly©Navid Nikaein 2010 31

DumpNetworkEndStatus;100;200.0;6390;true;18600;406741;2;2;92;6.804347826086956;4.14;6.235;5.745;11.54;0.69;-0.0199999999995982732;1;3;92;6.108695652173913;2.795;6.94;5.425;10.075;0.0;9.4800000000002883;1;3;92;6.032608695652174;2.835;6.235;6.44;12.175;0.0;1.7200000000004034;1;3;92;7.619565217391305;2.975;6.94;7.2;12.045;0.095;6.58000000000035

DumpNetworkEndStatus; #nodes; #rounds;realtime;used fixed seed; seed;# of sent messagesnodeId;state;connectedNodes;pathSize;nodeDegree;pathSize;maxPath;oneConnections;remainingEnergy

Page 32: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Available primitives for new TC implementations

• double energy =getEnergy();– Returns the available energy at the node

• Position p = getPosition();– Returns the present position of the node

• setRange(double range);– Sets a new communication range, if using the

VariableRange connectivity model• send(Message m, Node target);

– Sends a message to a defined node, if the connectivity model allows it, I.e. if it is in the range

• broadcast(Message m);– Sends a message to all the nodes in the region

©Navid Nikaein 2010 32

Page 33: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

Sinalgo – Step by step exampleFixed Range implementation

©Navid Nikaein 2010 33

Page 34: Mobile Advanced Networks Spring 2010 Lab Session Mobile Communication Department Eurecom 1©Navid Nikaein 2010

More information

• Eclipse tutorial– http://eclipsetutorial.sourceforge.net/workbench.html

• Java tutorial– http://java.sun.com/docs/books/tutorial/

• Sinalgo tutorial– http://disco.ethz.ch/projects/sinalgo/tutorial/tuti.html

• Bash scripting– http://www.linuxconfig.org/Bash_scripting_Tutorial

• Gnuplot– http://www.linuxconfig.org/Bash_scripting_Tutorial

©Navid Nikaein 2010 34