Professional Documents
Culture Documents
6
...........................................................................................................................................................6
1.1 NS-2.....................................................................................................................................................6
1.2 OPNET................................................................................................................................................6
1.3 SensorSim...........................................................................................................................................6
1.4 EmStar................................................................................................................................................7
1.5 GloMoSim...........................................................................................................................................7
1.6 TOSSIM..............................................................................................................................................7
1.7 PowerTOSSIM...................................................................................................................................7
OMNET........................8
...........................................................................................................................................................8
2.1 OMNeT++..................................................................................................................................8
2.1.1 OMNeT++............................................................................................................................8
2.1.2 OMNeT++............................................................................................................................9
2.2 OMNeT++............................................................................................................................10
2.3 OMNeT++.................................................................................................................................11
2.3.1 NED ...................................................................................................................................11
2.3.1.1 NED ........................................................................................................................11
2.3.1.2 Ned ..................................................................................................................11
2.3.1.3 .....................................................................................................................................13
2.3.2 ....................................................................................................................................14
2.3.2.1 OMNET...................................................................................................14
2.3.2.2 .........................................................................................................................14
2.3.2.3 .....................................................................................................................15
2.3.2.4 .............................................................................................16
2.3.3 ............................................................................................................................................17
2.3.3.1 cMessage .....................................................................................................................17
2.3.3.2 .............................................................................................................................17
2.3.3.3 .........................................................................................................................17
2.3.4 ....................................................................................................18
2.3.4.1 .................................................................................................................18
2.3.4.2 .................................................................................................................19
2.3.4.3 .....................................................................................................................20
2.3.3.4 .........................................................................................................................20
2.4 ...........................................................................................................................................21
2.5 omnetpp.ini.....................................................................................................................22
2.6 ..................................................................................................................................22
2.6.1 Plove..............................................................................................................22
2.6.2 Scalar.....................................................................................................................22
2.7............................................................................................................................................23
...................24
3.1 UWB ............................................................................................................................24
3.1.1 UWB ..............................................................................................................24
3.1.2 UWB ......................................................................................................................24
3.1.3 UWB (,)......................................................................25
3.1.4 UWB ......................................................................................................................25
3.1.5 ................................................................27
3.2 OMNeT++ UWB ....................................................................................................28
3.2.1 ........................................................................................................................28
3.2.2 ........................................................................................................................30
3.2.3 ........................................................................................................................31
3.2.4 ............................................................................................................................43
3.2.5 ....................................................................................................................................43
.................................................................................................................................................44
MAC ............................44
.........................................................................................................................................................44
4.1 MAC ..........................................................................................45
4.1.1 ............................................................................................................................45
4.1.2 MAC ..................................................................................................................45
4.1.3 MAC ..................................................................................45
..............................64
.........................................................................................................................................................64
5.1 .....................................................................................................65
5.1.1 ........................................................................................................65
5.1.2 ....................................................................................................66
5.1.3 ................................................................................................67
5.1.4 OMNET ........................................................................................................69
5.2 ................................................................................76
5.3 OMNET++........................................................................77
5.3.1 OMNET++[19].....................................................77
5.3.1.1 .....................................................................................................77
5.3.1.1.1 ..................................................................................................77
5.3.1.1.2 ..........................................................................78
5.3.2 ........................................................................................79
5.3.2.1 [28].................................................................................................................79
5.3.2.1.1 ..........................................................................................................................79
5.3.2.1.2 ..........................................................................................................................79
5.3.2.1.3 ..........................................................................................................................79
5.3.2.2 [29].........................................................................................................80
5.3.3 OMNET++.............................................................................................81
5.4 .....................................................................................................81
5.4.1 (Flooding)[32]...................................................................................................................82
5.4.2 (Directed DiffusionDD)[33]......................................................................................82
5.4.3 LEACH( Energy Adaptive Clustering Hierarchy)[34]..................................................................83
5.5. OMNET++......................................................................................................................84
5.5.1 ........................................................................................................................................84
5.5.2 gossiping ............................................................................................................................88
5.6 ...........................................................................................................................................90
.................................................................................................................................................90
..............................92
6.1 ..............................................................................................................92
6.1.1 ................................................................................................................92
6.1.1.1 .................................................................................................................92
6.1.1.2 .............................................................................................................93
6.1.2 ........................................................................................................................93
6.1.2.1 .............................................................................................................................93
6.1.2.2 .....................................................................................................................94
6.1.2.3 .............................................................................................................94
6.1.2.3.1 ..................................................................................................................94
6.1.2.3.2 ..............................................................................................................95
6.1.2.3.3 ......................................................................................................................95
6.1.2.3.4 ..........................................................................................................96
6.1.2.4 [37]......................................................................................................96
6.1.3 OMNET++ DVHop ...........................................................................97
6.1.3.1 DVHop ........................................................................................97
6.1.3.2 DVHop ....................................................................................................98
6.2 .........................................................................................................................................105
6.2.1 ..........................................................................................................................................105
6.2.1.1 wsn ............................................................................................106
6.2.1.2 wsn ................................................................................................106
6.2.1.3 wsn ........................................................................................107
6.2.2 wsn ...................................................................................................................108
6.2.2.1 ...................................................................................................................108
4
6.2.2.1.1 SenOs[5].....................................................................................................................108
6.2.2.2 ...................................................................................................................109
6.2.2.2.1 TopDisc .............................................................................................................109
6.2.2.3 .......................................................................................110
6.2.2.2.1 sympathy [42].....................................................................................................111
6.2.2.2.2 Agilla [7].............................................................................................................111
6.2.3 Omnet ..........................................................................................112
6.2.3.1 Wsn ..............................................................112
6.2.4 ..........................................................................................................................................116
6.3 OMNeT++....................................................................................116
6.3.1 ..........................................................................................................................116
6.3.1.1 ...................................................................116
6.3.1.2 ...........................................................................................116
6.3.1.3 ...............................................................................117
6.3.1.4 ...........................................................................117
6.3.1.5 ...............................................................119
6.3.1.6 ...........................................................................................................121
6.3.1.6.1 [20, 23, 24, 25]...................................................................................121
6.3.1.6.2 ............................................................................................................121
6.3.2 OMNeT++ ..........................................................................................................122
6.3.3 ..........................................................................................................................................128
...............................................................................................................................................129
............................................................................... 133
.......................................................................................................................................................133
7.1 ........................................................................................................................134
7.1.1 ..........................................................................................................134
7.1.1.1 Active Badge .............................................................................................................134
7.1.1.2 RADAR ....................................................................................................................134
7.1.1.3 Cricket ......................................................................................................................134
7.1.2 ..........................................................................................................135
7.1.2.1 .......................................................................................135
7.1.2.2 ...............................................................................................................135
7.2 OMNeT++................................................................................................136
7.2.1 MCLMonte Carlo Localization................................................................136
7.2.2 MCLMonte Carlo Localization OMNeT++.........................................................138
7.2.2.1 ...................................................................................................................138
7.2.2.2 ...........................................................................................................................141
7.3.............................................................................................................................145
...............................................................................................................................................145
()
(
) NS-2, OPNET, SensorSim, EmStar, OMNet++, G1oMoSim,
TOSSIM, PowerTOSSIM
1.1 NS-2
NS-2 (Network Simulator-2)
TCP
NS-2 OSI NS-2
C Network Animator (NAM)
NS-2 NS-2
NS-2
1.2 OPNET
OPNET OPNET
OPNET TCP/IP, 802.1 1 , 3G OPNET
TinyOS NesC
OPNET QoS
1.3 SensorSim
SensorSim NS-2 DSR 802.11 SensorSim
WINS SensorWare Tel SensorSim
WINS Mote
SensorSim
1.4 EmStar
EmStar iPAQ Liunx
EmSta: Linux
EmTOS EmStar TinyOS
EmStar
1.5 GloMoSim
GloMoSim (Global Mobile Information Systems Simulation Library )
OSI
1.6 TOSSIM
TOSSIM (TinyOS mote simulator) TinyOS Motes bit
TOSSIM TinyOS NesC PC
Mote TOSSIM
TinyViz.TOSSIM
1.7 PowerTOSSIM
PowerTOSSIM TOSSIM MICA2
PowerTOSSIM
Omnet
ns-2
OMNeT++ ( Objective Modular Network Testbed in C++)
OMNeT++
NS2OPNET JavaSim OMNeT++
OMNeT++
OMNeT3.3p1
2.1 OMNeT++
2.1.1 OMNeT++
OMNeT++ simulation kernel library,
Simnetwork description compiler, nedc
graphical network description editor,GNED
TkenvCmdenvPlove Scalar Sim
Sim Sim OMNeT++
(1)NED
NED
NED
GNED NED
(2)
OMNeT++OMNeT++
OMNeT++
2.1.2 OMNeT++
(1) OMNeT++ 1 OMNeT++
1 5 5
(1) Sim
Sim main
Sim
(2)Sim
Sim
(3) Envirev Envir
ev
(4)Sim Envir Envir Envir
Envir
2.2 OMNeT++
OMNeT++:
a)
Linux
Unix
b)
c)
Win32 (NT4.0, Window 2000,XP)
windows
2.2 windows Visual C++ 7.0 Service Pack 6
Visual Studio 6.0
(1)www.omnetpp.org omnetpp-3.3-win32.exe
(2) vc vc8.0vc.7.0vc6.0
vc6.0 release gswin32c ghostscript
ps pdf
(3) vc6.0 bin
VCVARS32.BAT cmd
10
2.3 OMNeT++
OMNET++ ,
OMNET++ , OMNET++
ned(Network Discription,) C++OMNET++
NED,:
NED NED
C++ OMNET++ NEDC
.NED .cpp , C++
2.3.1 NED
2.3.1.1 NED
NED
/
.Ned .Ned
Ned C++NED
GNED
2.3.1.2 Ned
NED
(1)
D NED NED
NED
NED <path>
channel LeasedLine
delay 0.0018 // sec
error 1e-8
datarate 128000 // bit/sec
endchannel
11
(3)
simple SimpleModuleName
parameters:
//...
gates:
//...
endsimple
module CompoundModule
parameters:
//...
gates:
//...
submodules:
//...
connections:
//...
endmodule
(4)
NEDNED
12
2OMNeT
2.3.1.3
NED
(1)C<math.h>exp( ),log( ),cos( ),floor( ),ceil( )
(2)uniform, exponential, normal
const
const
genertor0
13
(3)
C++ 0 1 2 3 4
double double C++
Define_Functionmacro
#include <omnetpp.h>
double average(double a, double b)
{
return (a+b)/2;
}
Define_Function(average, 2);
2average()2average()NED
module Compound
parameter: a,b;
submodules:
proc: Processor
parameters: av = average(a,b);
endmodule
double#include
Define OMNeT++ NED
2.3.2
2.3.2.1 OMNET
OMNET
cpu cpu
OMNETcMessage
OMNET++Csimtime_t
14
2.3.2.2
(1)
N
Pnobiterror = (1 ber)length
bits/second
3
3
Token Ring FDDI
2.3.2.3
(1) CSimpleModule
(2) define_Module() define_Module_Like()
a) simple module NED
NED SimpleModule NED
SimpleModule
b) SimpleModule CompondMoudule OMNeT
15
(3)
#include <omnetpp.h>
// module class declaration:
class SlidingWindow : public cSimpleModule
{
Module_Class_Members(SlidingWindow,cSimpleModule,8192)
//
virtual void activity();
};
// module type registration:
Define_Module( SlidingWindow );
// implementation of the module class:
void SlidingWindow::activity()
{
int windowSize = par("windowSize");
...
}
NED
// file: swp.ned
simple SlidingWindow
parameters:
windowSize: numeric const;
gates:
in: fromNet, fromUser;
out: toNet, toUser;
endsimple
(4)
Module_Class_Members(classname, baseclass, stacksize);
activity()
0 handleMessage()
2.3.2.4
(1) activity()
16k
(2)handleMessage()
16
c)SimpleModule stacksize 0
sendscheduleAtcancelEvent
scheduleAt
(3)Initialize()
FES(Future Event Set)
(4)Finish()
(FES )
initialize()
2.3.3
2.3.3.1 cMessage
cMessageOMNETCMessage
cMessage
c)
d) 1(1ber)length
ber
e) FES
2.3.3.2
mypacket.msg
message MyPacket
{
fields:
int srcAddress;
int destAddress;
17
2.3.3.3
OMNeTmessage
(1)
send(cMessage *msg, const char *gateName, int index=0);
send(cMessage *msg, int gateId);
isBusy(); transmissionFinishes()
(2)
send()message
Why
(3)
a)Wait();send(msg,outgate);
b)sendDelayed(cMessage *msg, double delay, const char *gate_name, int
index);
c)sendDelayed(cMessage *msg, double delay, int gate_id);
d)
E.gsendDelayed(msg, 0.005, "outGate");
(4)
job
a)scheduleAt()
scheduleAt(absoluteTime, msg);
scheduleAt(simtime()+delta, msg);
b)
c)isSelfMessage()
timer
cMessage *timeoutEvent = new cMessage("timeout");
scheduleAt(simTime()+10.0, timeoutEvent);
18
//...
cMessage *msg = receive();
if (msg == timeoutEvent)
{
// timeout expired
}
else
{
// other message has arrived, timer can be cancelled now:
delete cancelEvent(timeoutEvent);// FES
}
2.3.4
2.3.4.1
cModule par()
cPar& delayPar = par("delay");
cPar
int numTasks = par("numTasks");
double processingDelay = par("processingDelay");
par("waitTime") = 0.12;
Or:
cPar& waitTime = par("waitTime");
waitTime = 0.12;
2.3.4.2
1
OMNET++
19
gates [ ] 0
simple NetworkInterface
parameters: //...
gates:
in: fromPort, fromHigherLayer;
out: toPort, toHigherLayer;
endsimple
simple RoutingUnit
parameters: //...
gates:
in: output[];
out: input[];
endsimple
(2)
for
for
for i=0..4 do
node1.outGate[i] --> node2[i].inGate
endfor;
4
4
20
2.3.4.3
isBusy()
transmissionFinishes()
cMessage *packet = new cMessage("DATA");
packet->setByteLength(1024); // 1K
if (gate("TxGate")->isBusy()) // if gate is busy, wait until it
{ // becomes free
wait( gate("TxGate")->transmissionFinishes() - simTime());
}
send( packet, "TxGate");
if (gate("mygate")->toGate()->isBusy())
2.3.3.4
isConnected()toGate()
fromGate()
cGate *gate = gate("somegate");
if (gate->isConnected())
{
cGate *othergate = (gate->type()==O) ?gate->toGate() : gate>fromGate();
ev << "gate is connected to: " << othergate->fullPath() << endl;
}
else
{
ev << "gate not connected" << endl;
}
21
2.4
OMNET++
omnetpp.ini
vector scalar
OMNET Plove GUI vector
OMNET Matlab
Octave OpenOffice CalcGnumeric MS Excel
nmake -f Makefile.vc
2.5 omnetpp.ini
General
, Run 2.
Run 1
22
CmdenvCmdenv
TkenvTkenv
parametersNED
OutVectors
2.6
2.6.1 Plove
Plove
PloveOMNET++
windows
,
Plove.ploverc
Plove
(.vev)
PLOT
windowsshift+ctrl+/
Options
(Plove)
2.6.2 Scalar
recordScalar()finish()
void EtherMAC::finish()
{
double t = simTime();
if (t==0) return;
recordScalar("simulated time", t);
.
}
23
(,omnetpp.sca)
run 1 "lan"
scalar "lan.hostA.mac" "simulated time" 120.249243
scalar ..
run 2 "lan"
scalar "lan.hostA.mac" "simulated time" 235.678665
[...]
recordScalar()scalar
----x-y
2.7
OMNeT++
OMNeT++
OMNeT++
OMNeT++
OMNeT++
OMNeT++
OMNeT++
OMNeT++/
C++ omnetpp.ini
3.1 UWB
3.1.1 UWB
24
UWB
3.1.2 UWB
500MHz 25
125 1
UWB
fH fL
fH fL
2
fH fL
f fL
( H
)
2
0.200.25
""""
RF
IR 10 0 1
0.1 1.5 Hz
GHz 10GHz
UWB
UWB
0 1
25
1/100UWB
IEEE802.11a
Bluetooth
UWB
54Mbps
1Mbps
500Mbps
10m-100m
10m
1 -100
10m
1
1
2 2
t2
2 2
[10],[11]
3.1.4 UWB
A UWB DSUWB
B THUWB
C
[1] TH-PPM
TH-PAM +
PPM
PPM [10][11]).
TH+PAM
26
T f N h
N h =7 Tc T f = Tc N h
N s N s =4
A T f
A TH {0 1 5 3} A
0 PAM
-1 1
5 3 +1+1 -1
A {-1 +1 +1 -1}
N i
[1]
Pi g ii
Ri ( i 2T f
P g
j 1, j i
ij
1.1
N .
T f
Ri i
g ij j i .
i i .
2 UWB
N s T f
Tb = T f N s ,
27
Ri =
. Pi
1
Tb
1.2
E m ,i
E m ,i
E E frame
t
T frame
Tf
Tf
1.3
E frame i E m ,i i
i T f
. T f N h Tc
3.1.5
MEI
ad-hoc .
UWB UWB
FCC
(MEI)
QoS
. i i
T
1.1 MEI
iT
Pi g ii
Ri ( i 2T f
P g
j 1, j i
ij
2T f M i )
1.4
i , Ri
T
M i
N ,
M i
( N+1 )
M i 1 i N . N+1 N 1
T
R N 1 ,
28
NT 1
PN 1 g N 1, N 1
R N 1 ( N 1 2T f
P g
j 1
N 1, j
1.5
Ri ,
NT 1 R N 1 ( N 1 2T f
PN 1
P g
j
j 1
N 1, j
1.6
g N 1, N 1
, N
, N+1 ,
N+1
min{
Mi
} 1 i N
g i , N 1
FCC N+1
Pmax min{PFCC , min{
Mi
}}
g i , N 1
1 i N
PN 1 Pmax
PN 1 Pmax
PN 1 Pmax
.
2
29
1
message
powerMsg
30
3.2.2
1. RX
2.
Pmax
3. RX Pmin 4
4. PminPmax
5 1
5. Popt RX
6.
1. TX
2 1
2. Pmin
TX
3. TX 4 1
4.
31
TX
RX
TX
Yes
Yes
RX
Pmin
TX
Pmax
Time out
RX
Pmin
TX
Yes
Time out
Yes
PminPmax
Yes
Popt RX
3.2.3
UWB
message powerMsg
powerMsg
32
message powerMsg
{
fields:
double txPower;
double rxWantMinpower;
double MEI;
int sourceNodeIndex;
int destintNodeIndex; // -1 .
int x; // x,y
int y;
bool wantCommWithYou=false;
bool linkSucessToCreat=false; // link true
}
msg powerMsg_m.h
powerMsg_m.cc
#include <omnetpp.h>
#include "powerMsg_m.h"
class Physic :public cSimpleModule
{
private:
double initxPower;
double commonPower; //
double deviceMaxpower;
double myMEI;
double mySIR;
double myLinkGain;
double requireRate;
double totoalInterferenc;
double backnoise;
double shapingFactor;
double tagetSIR;
double Tf;
int posX, posY;
int targetNodeIndex;
int sourceNodeIndex;
bool isBusy;
cArray txpmsgArray;
cArray rxpmsgArray;
public:
33
#include "Physic.h"
Define_Module(Physic);
void Physic::initialize()
{
//( node x,y )
posX=(int)parentModule()->par("x");
posY=(int)parentModule()->par("y");
txpmsgArray.setName("txpmsgList");
rxpmsgArray.setName("rxpmsgList");
isBusy=false;
myLinkGain=0.0;
initxPower=0.0;
//
commonPower=1.0;
deviceMaxpower=2.0;
requireRate=1.4e6;
backnoise=4.0e-18;
shapingFactor=1.99e-3;
tagetSIR=10.0;
Tf=1.0e-7;
ev<<"the node's Physic layer... is initializing....the node is "<<parentModule()>index()<<endl;
ev<<"send a msg to MAC"<<endl;
// Msg MAC
cMessage *toMacmsg=new cMessage("toMAC");
send(toMacmsg,"toMAC");
34
//
if(((parentModule()->index())%2)==0)
{
ev<<"the node "<< parentModule()->index()<<" is initializing.... and want to
send a selfMsg..."<<endl;
simtime_t waittime=(simtime_t)uniform(0.10,3.0);
cMessage *smsg=new cMessage("selfMsg");
scheduleAt(simTime()+waittime,smsg);
ev<<"self msg had send..."<<endl;
isBusy=true;
}
}
// cMessage
void Physic:: handleMessage(cMessage * msg)
{
if (msg->isSelfMessage())
{
// selfMsg
delete msg;
int a=genk_intrand(0,11);
while((a%2)==0)
{
a=genk_intrand(0,11);
}
bool aIsBusy=false;
for (int i=0;i<rxpmsgArray.items();i++)
{
powerMsg *pmsgs=(powerMsg *)rxpmsgArray[i];
if(pmsgs->getSourceNodeIndex()==a)
{
aIsBusy=true;
ev<<" the node a is now receiving ,choose a new one "<<endl;
break;
}
}
if(aIsBusy)
{
ev<<"the node "<< parentModule()->index()<<" is initializing.... and want
to send a selfMsg..."<<endl;
ev<<"but the destination node is busy...choosing aother one ....."<<endl;
35
for(int i=0;i<11;i++)
{
powerMsg *copypmsg= (powerMsg *)minpmsg->dup();
send(copypmsg,"toOutside",i);
}
bubble("I have broadcasted my MEI...");
ev<<"I am the node .."<<parentModule()->index()<<"I have
broadcasted my MEI..."<<endl;
if(isBusy)
{
// link MEI
myMEI=getmyMEI(tagetSIR);
ev<<" In my life
I am Broadcasting........my MEI
is :"<<myMEI<<endl;
powerMsg *minpmsg=new powerMsg("rxpowerMsg");
minpmsg->setSourceNodeIndex(parentModule()->index());
minpmsg->setDestintNodeIndex(-1); // MEI
minpmsg->setWantCommWithYou(false);
minpmsg->setMEI(myMEI);
minpmsg->setLinkSucessToCreat(true);
minpmsg->setX(posX);
minpmsg->setY(posY);
for(int i=0;i<11;i++)
{
powerMsg *copypmsg= (powerMsg *)minpmsg->dup();
send(copypmsg,"toOutside",i);
}
}
}
else
{
myLinkGain=getGain(pmsg);
double minipower=minPower();
ev<<"I am the node "<<parentModule()->index()<<" computing the
min power is OK!!"<<endl;
ev<<"the min power is .."<<minipower<<endl;
powerMsg *minpmsg=new powerMsg("rxpowerMsg");
minpmsg->setSourceNodeIndex(parentModule()->index());
minpmsg->setRxWantMinpower(minipower);
minpmsg->setDestintNodeIndex(pmsg->getSourceNodeIndex());
minpmsg->setWantCommWithYou(true);
minpmsg->setX(posX);
minpmsg->setY(posY);
37
for(int i=0;i<10;i++)
{
powerMsg *copypmsg= (powerMsg *)minpmsg->dup();
send(copypmsg,"toOutside",i);
}
send(minpmsg,"toOutside",10); //
}
}
}
else
if(
((pmsg->getDestintNodeIndex())!=(parentModule()>index()))&&(pmsg->getLinkSucessToCreat()))
{
bool haveOldmsg;
haveOldmsg=false;
for (int i=0;i<txpmsgArray.items();i++)
{
powerMsg *pmsgs=(powerMsg *)txpmsgArray[i];
if(pmsgs->getSourceNodeIndex()==pmsg->getSourceNodeIndex())
{
haveOldmsg=true;
delete txpmsgArray.remove(i);
int index =txpmsgArray.add(pmsg);
break;
}
}
if(!haveOldmsg)
int indexs=txpmsgArray.add(pmsg);
}
}
else
{
delete pmsg;
ev<<"I am the node "<<parentModule()->index()<<"I receive a
msg which is usefulless ....deleting it"<<endl;
}
}
else if (strcmp(msg->name(),"rxpowerMsg")==0)
{
powerMsg *pmsg=(powerMsg *)msg;
ev<<"convert to pMsg....."<<endl;
38
if
((pmsg->getWantCommWithYou())&&((pmsg>getDestintNodeIndex())==(parentModule()->index())))
{
// rx , power.
double rxminpower=pmsg->getRxWantMinpower();
ev<<"my min power is :"<<rxminpower<<endl;
double txmaxpower=maxPower();
if (rxminpower>txmaxpower)
{
isBusy=false;
while(!isBusy)
{
ev<<"the node "<< parentModule()->index()<<" re transmiting is
want to send a selfMsg..."<<endl;
simtime_t waittime=(simtime_t)uniform(0.10,3.0);
cMessage *smsg=new cMessage("selfMsg");
scheduleAt(simTime()+waittime,smsg);
ev<<"self msg had send..."<<endl;
}
}
else
{
initxPower=(txmaxpower+rxminpower)/2;
isBusy=true;
powerMsg *txpmsg=new powerMsg("txpowerMsg");
ev<<"I am the node "<<parentModule()->index()<<"sucees to
contruct a new link ..."<<endl;
ev<<"the link is :"<<parentModule()->index()<<"--->>"<<pmsg>getSourceNodeIndex()<<endl;
txpmsg->setTxPower(initxPower);
txpmsg->setSourceNodeIndex(parentModule()->index());
txpmsg->setDestintNodeIndex(pmsg->getSourceNodeIndex());
txpmsg->setX(posX);
txpmsg->setY(posY);
txpmsg->setWantCommWithYou(true);
txpmsg->setLinkSucessToCreat(true);
for(int i=0;i<10;i++)
{
powerMsg *copypmsg= (powerMsg *)txpmsg->dup();
send(copypmsg,"toOutside",i);
}
39
send(txpmsg,"toOutside",10);
bubble("I have broadcasted my ini power...");
while(isBusy)
{
powerMsg *txpmsg=new powerMsg("txpowerMsg");
txpmsg->setTxPower(initxPower);
txpmsg->setSourceNodeIndex(parentModule()->index());
txpmsg->setDestintNodeIndex(pmsg->getSourceNodeIndex());
txpmsg->setX(posX);
txpmsg->setY(posY);
txpmsg->setWantCommWithYou(true);
txpmsg->setLinkSucessToCreat(true);
for(int i=0;i<10;i++)
{
powerMsg *copypmsg= (powerMsg *)txpmsg->dup();
send(copypmsg,"toOutside",i);
}
send(txpmsg,"toOutside",10);
}
}
}
else
if((pmsg->getDestintNodeIndex()==-1)&&(pmsg>getLinkSucessToCreat()))
{
bool haveOldmsg;
haveOldmsg=false;
for (int i=0;i<rxpmsgArray.items();i++)
{
powerMsg *pmsgs=(powerMsg *)rxpmsgArray[i];
if(pmsgs->getSourceNodeIndex()==pmsg->getSourceNodeIndex())
//, msg
{
haveOldmsg=true;
delete rxpmsgArray.remove(i);
int index =rxpmsgArray.add(pmsg);
ev<<" there is an old one in the rxArray....delete it and add the new
one"<<endl;
//ev<<"the
old
one
is
from....node
..."<<pmsgs>getSourceNodeIndex();
break;
}
}
40
if(!haveOldmsg)
int index=rxpmsgArray.add(pmsg);
}
else
{
ev<<"I am the node "<<parentModule()->index()<<"I receive a msg which
is usefulless ....deleting it"<<endl;
delete pmsg;
}
}
else
{
// msg
send(msg,"toMAC");
}
}
// Msg
void Physic::sendIniPmsg(int targetindex)
{
powerMsg *pmsg=new powerMsg("txpowerMsg");
pmsg->setTxPower(commonPower);
pmsg->setX(posX);
pmsg->setY(posY);
pmsg->setWantCommWithYou(true);
pmsg->setSourceNodeIndex( parentModule()->index() );
pmsg->setDestintNodeIndex(targetindex);
for(int i=0;i<10;i++)
{
powerMsg *copypmsg= (powerMsg *)pmsg->dup();
send(copypmsg,"toOutside",i);
ev<<"broakcasting the initial msg to other node from the gate
toOuside["<<i<<"]"<<endl;
}
send(pmsg,"toOutside",10);
}
//
double Physic::getDistance(powerMsg * pmsg)
{
double distant=sqrt((posX-pmsg->getX())*(posX-pmsg->getX())+(posY-pmsg>getY())*(posY-pmsg->getY()));
41
return distant;
}
//
double Physic::getGain(powerMsg *pmsg)
{
double gain;
double dist=getDistance(pmsg);
if(dist<35)
{
gain=1;
}
gain=1225/(dist*dist);
return gain;
}
//
double Physic::getInterference()
{
double totleNiose=0.0;
for (int i=0;i<txpmsgArray.items();i++) {
powerMsg *pmsg=(powerMsg *)txpmsgArray[i];
if ((pmsg->getSourceNodeIndex() )!=(parentModule()->index()))
{
double gains=getGain(pmsg);
totleNiose+=(pmsg->getTxPower())*gains;
}
}
return totleNiose;
}
double Physic::getSIR()
{
double mylinkgain, sourcepower;
for (int i=0;i<txpmsgArray.items();i++)
{
powerMsg *apmsg=(powerMsg *)txpmsgArray[i];
if ((apmsg->getSourceNodeIndex() )==(parentModule()->index()))
{
mylinkgain=getGain(apmsg);
sourcepower=apmsg->getTxPower();
break;
}
42
}
// SIR
double interfere=getInterference();
double
theSIR=(mylinkgain*sourcepower)/
(requireRate*(backnoise+shapingFactor*Tf*interfere));
return theSIR;
}
// MEI
double Physic::getmyMEI(double tSIR)
{
double interfere=getInterference();
double xixi=tSIR*requireRate*shapingFactor*Tf;
double
myMei=(initxPower*myLinkGain-tSIR*requireRate*backnoisexixi*interfere)/(xixi);
return myMei;
}
//
double Physic::maxPower()
{
double thetxPower;
double maxpower=1000.0;
for (int i=0;i<rxpmsgArray.items();i++)
{
powerMsg *pmsgs=(powerMsg *)rxpmsgArray[i];
double gain=getGain(pmsgs);
if (((pmsgs->getMEI())/gain)<maxpower)
maxpower=(pmsgs->getMEI())/gain;
}
if(maxpower>(deviceMaxpower))
maxpower= deviceMaxpower;
return maxpower;
}
//
double Physic::minPower()
{
double intf=getInterference();
double
minpowers=(tagetSIR*requireRate*(shapingFactor*intf*Tf+backnoise))/
myLinkGain;
43
return minpowers;
}
void Physic::finish()
{
ev<<"finish..."<<endl;
}
3.2.4
UWB
UWB
UWB
3.2.5
UWB
Gbps UWB 3
480Mbps 5 80Mbps 2007
UWB
UWB
UWB
PDA
UWB
[1] Francesca Cuomo, Cristina Martello. Ultra Wide Band WLANS:A SelfConfiguring Resource Control Scheme for Accessing UWB Hot-Spots with QoS
Guarantees
[2] Michael I. Brownfield, Kaveh Mehrjoo, Almohonad S. Fayez, and Nathaniel J.
Davis IV, Wireless Sensor Network Energy-Adaptive MAC Protocol
[3] Jerey P. Monks, Vaduvur Bharghavan, and Wen-mei W. Hwu, A Power
Controlled Multiple Access Protocol for Wireless Packet Networks
[4] F. Cuomo, C. Martello, A. Baiocchi, and F. Capriotti, Radio Resource
Sharing for Ad Hoc Networking with UWB, IEEE Journal on Selected Areas in
44
MAC
MAC
Ad Hoc MAC
GSM CDMA QoS
Ad Hoc
QoS
MAC MAC
MAC
4.1 MAC
4.1.1
,,
1aA
BB
CAB
45
AB
1bABC
CBA
CBABC
4.1.2 MAC
MAC ,,
,,MAC
,MAC
,
,,
,
,
,,
,,
,,
,,,
,,
4.1.3 MAC
MAC
3MAC
MACMAC
46
4.2 MAC
4.2.1 S-MAC [12]
S-MAC [1] 802.11MAC
MAC
S-MAC /
S-MAC
1
/
SYNC
S-MAC
2
S-MAC
RTS
RTS
3
S-MAC 802.11MAC
RTS/CTS SMAC
RTS/CTS/DATA/ACK
47
4
S-MAC RTS/CTS
S-MAC
IEEE802.11MAC
RTS/CTS
S-MAC /
RTS/CTS
S-MAC
4.2.2 T-MAC
T-MACTimeout MAC[2]S-MAC S-MAC
/
T-MAC
T-MAC
S-MAC
T-MAC RTS/CTS/DATA/ACK
TA
;;RSSI ;
RTS/CTS
T-MAC
48
4.2.3 AC-MAC
AC-MAC [3] MAC T-MAC
AC-MAC S-MAC
S-MAC
AC-MAC MAC
S-MAC
AC-MAC
MAC i Ni RifNi
Ri f
'
'
T frame
TRTS / CTS Tsleep
S-MAC R RTS/CTS
R .
AC-MAC S-MC S-MAC
T-MAC
4.3 MAC
4.3.1 D-MAC
S-MAC T-MAC /
DMAC[4]
49
4.3.2 TRAMA
TRAMA[5]
TRAMA
TDMA
MAC TRAMA
4.3.3 AI-LMAC
AI-LMAC(adaptive,information centric and lightweightMAC)TDMA
MAC [6]AI-LMAC
(sink )
( time slot)
)(bit )
(controlmessageCM)(data messageDM)CM DM
AI-LMAC
/DDT (data
distribution table)
AI-LMAC
4.4 MAC
4.4.1 SMACS/EAR
SMACS/EARSelf-organizing Medium Access Control/Eavesdrop And Register
MAC
SMACSEAR
SMACS/EAR
[7]
50
//
/
/
/
CDMA MAC
CDMA
4.4.3 DCC-MAC
DCC-MAC [9]
CDMA DCC-MAC[4] PPM-TH-UWB [10]TH
MAC
IEEE 802.15.4a[11]PRP
THS UWB
MACPrivate MAC
public THS
private THS S
D D D THS S
D D THS REQ
REQ RN D
RESP, RN. S RESP
THS 2DCC-MAC
THS
2 DCC-MAC
51
MAC
Simulator
http://www.consensus.tudelft.nl/software.html
MAC Simulator Linux Windows
Windows OMNeT++
MAC Simulator S-MACT-MACTMACpL-MACCSMACSMAACK MAC
MAC
S-MAC
4.5.1 S-MAC
Windows MAC Simulator
nedtool *.ned opp_msgc *.msg opp_nmakemake f e cc nmake f
Makefile.vc S-MAC
3
52
3 S-MAC
4.5.2 S-MAC
S-MAC 4
53
4 S-MAC
4.5.3 S-MAC
S-MAC BasicMac BasicMac cSimpleModule
S-MAC S-MAC
class SMac: public BasicMac
{
//
Module_Class_Members(SMac, BasicMac, 0);
protected:
unsigned int listen_time;
54
void setIdle();
void protocolTimeout();
void navTimeout();
void schedTimeout();
void setProtocolTimeout(int t);
void setNavTimeout(int t);
void setSchedTimeout(int t);
void updateNav(ushort nav);
void txDone();
virtual void endForce();
int isSameSchedule(int time1, int time2);
virtual int mustUseCA(Packet * msg);
//virtual void incBackoff();
virtual void decBackoff();
virtual void init();
virtual void timeout(int which);
virtual void txPacket(Packet * msg);
virtual void rxFrame(Packet * msg);
virtual void transmitDone();
virtual void rxFailed();
virtual void rxStarted();
virtual int headerLength();
};
S-MAC
56
void SMac::evalState()
{
if (proto_state == PROTO_STATE_IDLE && !isReceiving())
{
//
if (nav_state == NAV_STATE_CLEAR && sched_state !=CHED_STATE_SLEEP)
{
// /
if (must_send_sync)
{
printf(PRINT_MAC, "preparing to send SYNC %s",tx_msg?"(data
pending)":"");
//
proto_next_state = PROTO_STATE_SEND_SYNC;
startContending(SYNC_CONTEND_TIME);
return;
}
if (tx_msg && sched_state == SCHED_STATE_OWN)
{
if (mustUseCA(tx_msg)) //
{
printf(PRINT_MAC, "preparing to send RTS");
//
proto_next_state = PROTO_STATE_SEND_RTS;
startContending(rts_contend_time);
}
else
{
printf(PRINT_MAC, "preparing to send data");
proto_next_state = PROTO_STATE_SEND_DATA;
startContending(RTS_CONTEND_TIME);
}
return;
}
//
printf(PRINT_MAC, "idle listening");
setRadioListen();
}
else
{
//
printf(PRINT_MAC, "idle sleeping");
if (getForce() != FORCE_NOSLEEP)
57
setRadioSleep();
}
}
}
void SMac::protocolTimeout()
{
int next_state;
switch (proto_state)
{
case PROTO_STATE_CONTEND:
assert(proto_next_state >= 0);
assert(!isReceiving());
assert(nav_state == NAV_STATE_CLEAR);
// RSSI
setRadioListen(); //
if(getRssi()>0.5) { //
printf(PRINT_MAC,
59
}
}
void SMac::sendSync()
{
printf(PRINT_MAC, "sending sync");
must_send_sync = 0;
proto_state = PROTO_STATE_SEND_SYNC;
Packet *msg = new Packet("sync");
msg->local_from = nodeId();
msg->local_to = -1; //-1
PKT_KIND(msg) = KIND_SYNC;
ushort now = currentTime();
unsigned long est = EST_SYNC_TIME;
assert(time_last_sched+(int)frame_time > now+EST_SYNC_TIME);
unsigned long stime = time_last_sched + frame_time //
- now
//
- est;
//
//- EST_SYNC_TIME;
//
//assert(now>900);
assert(stime>0);
stime &= 0xFFFF;
assert(stime < frame_time);
PKT_SYNC(msg) = stime;
msg->setLength(SYNC_SIZE);
setRadioTransmit();
reg_tx_overhead(msg);
startTransmit(msg);
}
void SMac::calcSchedState()
{
ushort t = currentTime();
unsigned in_f = (ushort) (t - time_last_sched);
assert(listen_time>0);
//
if ( /*in_f >=0 && */ in_f < listen_time)
{
sched_state = SCHED_STATE_OWN;
ushort left = listen_time + 5 - in_f;
62
setSchedTimeout(left);
return;
}
}
// .
sched_state = SCHED_STATE_SLEEP;
unsigned wake_at = frame_time;
//
for (i = 0; i < sched_count; i++)
{
if (sched_table[i] > in_f && sched_table[i] < wake_at)
wake_at = sched_table[i];
}
ushort left = wake_at - in_f;
assert(left <= sleep_time);
printf(PRINT_MAC, "calc_sched: in no frame, left = %u", (unsigned) left);
setSchedTimeout(left);
if (getForce() != FORCE_NOSLEEP)
setRadioSleep();
return;
}
4.6
MAC MAC
MAC OMNeT++ S-MAC
MAC
64
65
QOS [1]
(1)
(2)
(3)
5.1
5.1.1
WSNs sink WSNs
[2-4].
(1)
(2) ,
(3)
,
;
(4)
. WSNs
GPS
(5)
WSNs
(6)
66
WSNs
(10)
5.1.2
1 hop
1Flooding[5] Source
,
, Sink
2Gossiping[5]Gossiping Flooding
67
, Source Sink
Source ,
DD
, 5.1
B. C.
5.1 DD
[8]
6Rumor sink Directed Diffusion
Rumor
Agent
Agent Agent
Agent sink
sink flooding sink
Rumor
Agent 3 Rumor Agent Agent
.
5.1.3
clusterclusterheadcluster-member
68
Sink
Sink PEGASIS
,
(grid)
sink
flooding
sink Sink
(Agent) Directed Diffusion
sink
8 TTDD
5Estrin
()
6Younis LEACH
ID
69
5.1.4 OMNET
5.2 OMNET
OMNET 5.2
sm_application sm_cordinator
sm_layer0 sm_energy
5.3
70
1 Leach
A Leach 5.2.3
B
Sink
C
#include "application.h"
#include <math.h>
//
//
#define SELF_INITIALIZE {
71
msg->addPar("destination") = FATHER;
msg->addPar("X") = PX;
msg->addPar("Y") = PY;
send(msg,"lowergate_out");
if(OCCUPATION != 5)
SEND_DECREASE_ENERGY(820);
}
//,IDfalse
void application::initialize()
{
group_flag = false;
SELF_INITIALIZE;
WAITING_INVITATION_TIMER;
}
void application::finish()
{
}
void application::handleMessage(cMessage *msg)
{
switch(msg->kind())
{
case M_SELF:
{
if (strcmp(msg->name(),"SET_UP")==0)
{
//
//clean up the marked connection
if(OCCUPATION == 2)
{
UPDATECOLOR("white");
if (ev.isGUI())
parentModule()->gate("out",FATHER)>setDisplayString("m=m;o=lightgrey,0;");
}
//Delete father
this->parentModule()->par("FATHER")= 0;
if(OCCUPATION == 1)
{
73
//
this->parentModule()->par("OCCUPATION") = 2;
//
this->parentModule()->gate("out",MAXCONN -1)->disconnect();
this->parentModule()->gate("in",MAXCONN -1)->fromGate()->disconnect();
UPDATECOLOR("white");
}
if(OCCUPATION != 5)//Not the base
{
//
int cluster_head = rand()% (HEAD_DISTRIBUTION);
//if cluster_head = HEAD_DISTRIBUTION --> head cadidate
if(cluster_head == HEAD_DISTRIBUTION - 1)
{
//
this->parentModule()->par("OCCUPATION")= 1;
group_flag =true;
SEND_INVITATION;
//
if (ev.isGUI())
UPDATECOLOR("blue");
}
}
delete msg;
break;
}
else if(strcmp(msg->name(),"WAIT_INVITATION_TIME_OUT")==0)
{
if(group_flag == false)//
delete msg;
break;
}
else
{
ev << "unknown message received from another node.\n";
endSimulation();
}
}
case M_LOWHIGH:
{
if (strcmp(msg->name(),"SENSING_DATA")==0)
74
{
SEND_DECREASE_ENERGY(100);
forward(msg);
delete msg;
break;
}
else if (strcmp(msg->name(),"INVITATION")==0)
{
SEND_DECREASE_ENERGY(3);
//
if(FATHER == 0 && OCCUPATION == 2) //occupation = 2 means not a
cluster head or base
{
//ID,
parentModule()->par("FATHER") = msg->par("group_id");
group_flag =true; //ID
if (ev.isGUI())
parentModule()-
>gate("out",FATHER)->setDisplayString("m=a;o=blue,0;");
}
delete msg;
break;
}
else if (strcmp(msg->name(),"SENSOR_INFO")==0)
{
if(SENSOR_SWITCH)
SEND_DECREASE_ENERGY(100);
parentModule()->bubble("DETECTED")
SEND_SENSED_INFO;
}
delete msg;
break;
}
else
{
ev << "unknown message received from another node.\n";
endSimulation();
}
}
default:
75
{
ev << "unknown message received\n";
endSimulation();
}
}
}
void application::forward(cMessage *msg)
{
if((int)msg->par("destination") == ID)
{
if(OCCUPATION == 1) //
{
//Sink
cMessage *tmpmsg = new cMessage("SENSING_DATA");
tmpmsg->setKind(M_HIGHLOW);
tmpmsg->addPar("time") = msg->par("time");
tmpmsg->addPar("source") = ID; //message from cluster head
tmpmsg->addPar("destination") = FATHER;
tmpmsg->addPar("X") = msg->par("X");
tmpmsg->addPar("Y") = msg->par("Y");
send(tmpmsg,"lowergate_out");
if(DISTANCE > CRADIUS)
{
SEND_DECREASE_ENERGY(200+ 0.1*DISTANCE*DISTANCE);
else
{
SEND_DECREASE_ENERGY(920);//100 for creating + 820 for sending
}
parentModule()->bubble("FWD");
}
else if(OCCUPATION == 5) //
{
sprintf(str,"%d,%d",(int)msg->par("X"),(int)msg->par("Y"));
parentModule()->bubble(str);
}
}
}
76
5.4 Leach
Sink
Sink
5.2
WSNs
sink
,
WSNs
(1) WSNs
sink
(2)
77
(3) WSNs
(4) WSNs
.
5.3 OMNET++
5.3.1 OMNET++ [19]
[20]
[21]
[22]Ad Hoc(M0bile Ad
hoe NetworksMANET)
(1)MANET
MANET
(2)MANET
5.3.1.1
5.3.1.1.1
GPS()
()6[23-27]
SinkSink1
78
5.3.1.1.2
2
(Multi-hops)Sink
SinkSink
(
R)
RSink
kSink
79
5.3.2
5.3.2.1 [28]
()
5.3.2.1.1
Sink Sink
10 Sink
10 Sink
Sink
Sink
Sink Sink
Sink
5.3.2.1.2
Sink
Sink Sink
Sink
80
5.3.2.1.3
Sink
Sink
Sink
QOS
QOS
5.3.2.2 [29]
(
)
(proactive)(reactive)
81
5.3.3 OMNET++
OMNET++
GUI GUI
OPNET NS2 NS2
NED( NS2 TCL)
C++OMNET++
windows
Liunx OPNET OMENT++
[30]
OMNET++
OOP
1simple
simple
parameters: //.cc
gates:
//
endsimple
2
module
parameters: //
gates: //
submodules: //
connections: //gates
endmodule
3
network : //gates
parameters: //
endnetwork
4import
82
5.4
(
tabledriven)()
[31]
83
4Sink(interest
)
(interest entry)(
)
Sink
84
nPr
Gr
TDMA
15
LEACH
5.5. OMNET++
5.5.1
85
FAMMACMACFAMFA
iFA(AP)
initiate(i)
send() FAMFAMAC
deliver() FAMFAAP
FAFAM(FA)
if(receive()== true) FAM
{
deliver()FAMFAAP
send() FAMFAMAC
}
else discard()FAM
OMNET7
Node
Application
Manager
Layer0
7
3applicationlayer0managerapplication
86
layer0FAmanager
NED
//----------------------------------------------// default components:
//----------------------------------------------simple application
gates:
in: lowergate_in;
in: uppergate_in;
in: blackboard_in;
out: lowergate_out;
out: uppergate_out;
endsimple
simple layer0
gates:
in: lowergate_in[];
in: uppergate_in;
in: blackboard_in;
out: lowergate_out[];
out: uppergate_out;
endsimple
//----------------------------------------------// sensor node definition:
//----------------------------------------------module sensornode
parameters:
CNNCTVTY: numeric,
KIND: numeric,
COLOR: numeric,
PX: numeric,
PY: numeric;
gates:
in: in[];
out: out[];
submodules:
sm_layer0: layer0;
gatesizes:
lowergate_in[CNNCTVTY],
87
lowergate_out[CNNCTVTY];
display: "p=158,258;i=layer0";
sm_application: application;
display: "p=158,86;i=application";
connections nocheck:
for i=0..CNNCTVTY-1 do
in[i] --> sm_layer0.lowergate_in[i];
out[i] <-- sm_layer0.lowergate_out[i];
endfor;
sm_application.lowergate_in <-- sm_layer0.uppergate_out;
sm_application.lowergate_out --> sm_layer0.uppergate_in;
display: "b=290,485,rect;o=white";
endmodule
// the central manager
simple manager
parameters:
P_FMAP: numeric,
N_FMAP: numeric;
gates:
in: in;
out: out;
endsimple
//------------------------------------------------// the parent module
//------------------------------------------------module test
parameters:
MAXCONN: numeric,
NNODES: numeric,
SSTRENGTH: numeric;
submodules:
snode: sensornode[NNODES];
parameters:
CNNCTVTY = MAXCONN,
KIND = 2,
COLOR = 2,
PX = 0,
PY = 0;
gatesizes:
in[MAXCONN],
88
out[MAXCONN];
man: manager;
parameters:
P_FMAP = 0,
N_FMAP = 0;
connections nocheck:
display: "p=0,0;b=860,560,rect;o=white";
endmodule
//------------------------------------------------// the network
//------------------------------------------------network thetest : test
endnetwork
102
89
5.5.2 gossiping
GossipingFlooding
floodingNED
Gossiping
NEDFlooding
940
90
10
10
5.6
QoS
sensor
1
[1] Akyildiz IF, Su W, Sankarasubramaniam Y, Cayirci E. A survey on sensor
networks. IEEE Communications Magazine, 2002,40(8)
[2] Akyildiz IF, Su W, Sankarasubramaniam Y, Cayirci E. Wireless sensor
networks: A survey. Computer Networks, 2002,38
[3] Cui L, Ju HL, Miao Y, Li TP, Liu W, Zhao Z. Overview of wireless sensor
networks. Journal of Computer Research and Development, 2005,42
91
[4] Niculescu D, Americ NL. Communication paradigms for sensor networks. IEEE
Communications Magazine 2005,43(3):
[5] Haas ZJ, Halpern JY, Li L. Gossip-Based ad hoc routing. In: Proc. of the
IEEE INFOCOM. New York: IEEE Communications Society, 2002.
[6] Kulik J, Heinzelman WR, Balakrishnan H. Negotiation based protocols for
disseminating information in wireless sensor networks. Wireless Networks,
2002,8(2-3)
[7] Intanagonwiwat C, Govindan R, Estrin D, Heidemann J. Directed diffusion for
wireless sensor networking. IEEE/ACM Trans. on Networking, 2003,11(1)
[8] Braginsky D, Estrin D. Rumor routing algorithm for sensor networks. In:
Proc. of the 1st workshop on sensor networks and applications. Atlanta: ACM
Press, 2002.
[9] Heinzelman W, Chandrakasan A, Balakrishnan H. Energy-efficient
communication protocol for wireless microsensor networks. In: Proc. of the 33rd
Annual Hawaii Intl Conf. on System Sciences. Maui: IEEE Computer Society,
2000.
[10] Lindsey S, Raghavendra CS. PEGASIS: Power-efficient gathering in sensor
information systems. In: Proc. of the IEEE Aerospace Conf. Montana: IEEE
Aerospace and Electronic Systems Society, 2002.
[11] Manjeshwar A, Agrawal DP. TEEN: A protocol for enhanced efficiency in
wireless sensor networks. In: Intl Proc. of the 15th Parallel and Distributed
Processing Symp. San Francisco: IEEE Computer Society, 2001.
[12] Ye F, Luo H, Cheng J, Lu S, Zhang L. A two-tier data dissemination model
for large-scale wireless sensor networks. In: Proc. of the 8th Annual Intl
Conf. on Mobile Computing and Networking. Atlanta: ACM Press, 2002.
[13] Sohrabi K, Gao J, Ailawadhi V, Pottie GJ. Protocols for self-organization
of a wireless sensor network. IEEE Personal Communications, 2000,7(5):
[14] Chang JH, Tassiulas L. Maximum lifetime routing in wireless sensor
networks. IEEE/ACM Trans. on Networking, 2004,12(4)
[15] Karlof C, Wagner D. Secure routing in sensor networks: attacks and
countermeasures. Ad Hoc Networks, 2003,1(1)
[16] Ye F, Chen A, Lu S, Zhang L. A scalable solution to minimum cost
forwarding in large sensor networks. In: Proc. of the 10th Intl Conf. on
Computer Communications and Networks. Arizona: IEEE Communications Society,
2001.
[17] Schurgers C, Srivastava MB. Energy efficient routing in wireless sensor
networks. In: Proc. of the MILCOM on Communications for Network-Centric
Operations: Creating the Information Force. Virginia: IEEE Communications
Society, 2001.
[18] Chu M, Haussecker H, Zhao F. Scalable information-driven sensor querying
and routing for ad hoc heterogeneous sensor networks. The Intl Journal of
High Performance Computing Applications, 2002,16
[19]..2005600
92
607
[20]J Agre JClare LAn integrated mehitecture for cooperative sensing
networks[J]Computer200033(5)106108
[21][J]
200542(1)163174
[22]Sehrabi KGao JAilawadhi Vet a1Protocols for self-organization of a
wireless sensor network[J]IEEE Personal Communications20007(5)1627
[23]Akyildiz I FSu WYet a1A Survey on Sensor Networks[J]IEEE
Communications Magazine2002lO2ll4
[24]Min RBhardwaj MCho s Het a1An Architecture for a Power-Aware
Distributed Micro sensor Node[A]IEEE Workshop on Signal Processing
Systems[C]New YorkIEEE345E47THST2000581590
[25]Shen CSrizathapornphat CJaikaeo CSensor Information Networking
Architecture and Applications[J]IEEE Personal Communication200l852
59
[26]Megnerdichien SKoushanfar FQu Get a1Exposure In Wireless AdHoc
Sensor Networks[A]ACMIEEE International Conference on Mobile Computing and
Networking[C]New YorkACM Press2001139150
[27]Li QAslam JRus DHierarchical Power-aware Routing in Sensor
Networks[EBOL]httpwwwCSwmedullqunpaper
dimacspdf20015
[28]http://blog.sina.com.cn/u/490620c3010005f9
[29]...2005
[30]http://blog.chinaunix.net/u/13991/showart.php?id=229797
[31Jamal NAhmed E.KamalRouting Techniques in Wireless Sensor NetworksA
SurveySan FranciscoIEEE Computer Society200216961705
[32]S. HedemiemiALiestmanA survey of gossiping and broadcasting
in communication networksNetworks198818(4)319349
[33]C. IntanagonwiwatRGovindanDEstrinDirected diffusionA scalable
and robust communication paradigm for sensor networks in the Proceeding s of
the 6th Annual ACMIEEE International Conference on Mobile Computing and
Networking ( MobiCom00)BostonMAAugust 2O00
[34]Heinzelman W ChandrakasanABalakrishnanHAn applicationspecific
protocol architecture for wireless micro sensor networks[J]IEEE Transactions
on Wireless Communications2002(1O)660670
[35].MANET..2003.
93
6.1
6.1.1
6.1.1.1
N
G
e=(ij)rijijdij
rijPi
eGPj-Pi=dij
1
1(a)1(b)1(c)
NP-hard
1(b)1(c)
(a)
(b)
1
(c)
94
6.1.1.2
(1)
(2)
6.1.2
6.1.2.1
(1)(RSSI)RSSIRF
RSSI50
(2)/(TOA/TDOA)TOA/TDOA
CPUSavvides[21]
TOA/TDOA
(3)(AOA)AOA
NiculescuAOA
6.1.2.2
95
(1)
AOA
(2)
(3)
Savvides
Nmin-max
6.1.2.3
6.1.2.3.1
(1)
ABCAFLABC
ABC
AFLCricket[5] [6]
-
AFL
(2)
TerrainABC
525ABC
60Savarese [19]Hop-
96
TerrainTerrainGPS-Free
(1)
(2)
6.1.2.3.2
Doherty
[10] [11]
MDS-MAP[25]
MDS-MAP3-4
ABCAOA
Yi ShangMDS-MAP
[27]
6.1.2.3.3
[8]APIT[23]DV-HOP[15]
APIT
DV-HOP
97
NiculescuAOA
[16]AOA
6.1.2.3.4
CPU
6.1.2.4 [37]
(1)
(2)
(3)
10%
10
(4)
(5)
(6)
98
(7)
0 1
2 A
A
2 A
i
XiYiXjYj ij h(ij) i j
hdi i
hd hd
hd hd
99
hd hops i ,
di=hopshdi
3
6.1.3.2 DVHop
OMNET++ DVHop OMNET++
(1)
(2) 100
(3) 800500 30 3
27
DVHop
DVHop
.ned 3
.h .cc 4 nedtool *.ned
opp_nmakemake -f -e cc nmake -f Makefile.vc
100
DVHop.exe omnetpp.ini
DVHop.exe 10%
33%DVHop
DVHop
101
DVHop
OMNET++ DVHop
#include "application.h"
Define_Module( application );
void application::initialize()//
{
last_seen_id = -1;
// id -1
msgcount = 0;
// 0
TTL=0;
}
void application::finish()
{
int i;
double tmp;
ev<<"Node "<<ID<<" position, px="<<PX<<";
py="<<PY<<"\n";
for(i=0;i<NUM_ANC;i++)
{
ev<<"least hops to anchor["<<i<<"]is "<<hopto[i]<<"\n";
ev<<"len to anchor["<<i<<"] is "<<lento[i]<<"\n";
}
if(ID>=NUM_ANC)
{
commatrix();
tmp=sqrt((PX-rp.rx)*(PX-rp.rx)+(PY-rp.ry)*(PY-rp.ry));
102
py="<<PY<<"\n";
}
void application::handleMessage(cMessage *msg)
{
switch(msg->kind())
{
case M_LOWHIGH:
{
if (strcmp(msg->name(),"FLOOD")==0)
{
processFlood(msg);
return;
}
if(strcmp(msg->name(),"GGHOPS")==0)
{
processHops(msg);
return;
}
ev << "unknown message received from another node.\n";
endSimulation();
}
case M_START:
{
cMessage *msgnew = new cMessage("FLOOD");
msgnew->setKind(M_HIGHLOW);
msgnew->addPar("flood_id") = ++last_seen_id;
msgnew->addPar("source")=ID;
//set source
for the message
msgnew->addPar("hops")=0;
msgnew->addPar("spx")=PX;
msgnew->addPar("spy")=PY;
send(msgnew,"lowergate_out");
UPDATECOLOR(msgcount+2);
msgcount++;
break;
}
case M_S2:
{
103
if(strcmp(msg->name(),"GGHOPS")==0)
{
double hopsize=comhopsize();
TTL=INTTL;
cMessage *hopsmsg=new cMessage("GGHOPS");
hopsmsg->setKind(M_HIGHLOW);
hopsmsg->addPar("source")=ID;
hopsmsg->addPar("hopsize")=hopsize;
hopsmsg->addPar("ttl")=INTTL;
sendDelayed(hopsmsg,RETRANSMITDELAY,"lowergate_out");
seens[ID]=true;
UPDATECOLOR(ID+2);
break;
}
}
default:
ev << "unknown message received\n";
endSimulation();
}
}
void application::processFlood(cMessage *msg)
{
int flood_id = (int)msg->par("flood_id");
if (flood_id <= last_seen_id)
{
delete msg;
return;
}
int source =msg->par("source");
int hop=msg->par("hops");
if(seen[source]==false)
{
seen[source]=true;
ancpos[source].x=msg->par("spx");
ancpos[source].y=msg->par("spy");
hopto[source]=hop+1;
msg->par("hops")=hopto[source];
msg->setKind(M_HIGHLOW);
sendDelayed(msg,RETRANSMITDELAY,"lowergate_out");
UPDATECOLOR(flood_id+2);
}
else if(seen[source]==true)
{
104
if(hopto[source]>hop+1)
{
hopto[source] = hop+1;
msg->par("hops")=hopto[source];
msg->setKind(M_HIGHLOW);
sendDelayed(msg,RETRANSMITDELAY,"lowergate_out");
}
else
delete msg;
return;
}
msgcount++;
last_seen_id = flood_id;
}
double application::comhopsize()//PXPY
{
double len=0.0,hs=0.0;
int hop=0,i;
for(i=0;i<NUM_ANC;i++)
{
len+=sqrt((PX-ancpos[i].x)*(PX-ancpos[i].x)+(PYancpos[i].y)*(PY-ancpos[i].y));
hop+=hopto[i];
}
hs=len/hop;
return hs;
}
void application::processHops(cMessage *msg)
{
int soc,ttl;
ttl=msg->par("ttl");
ttl--;
hopsize=msg->par("hopsize");
soc=msg->par("source");
if(seens[soc]==true||ttl<0)
{
delete msg;
return ;
}
if(seens[soc]==false)
105
{
seens[soc]=true;
if(TTL<ttl)
{
TTL=ttl;
msg->setKind(M_HIGHLOW);
msg->par("ttl")=ttl;
sendDelayed(msg,GENERATIONDELAY,"lowergate_out");
UPDATECOLOR(soc+2);
}
else
{
msg->setKind(M_HIGHLOW);
msg->par("ttl")=ttl;
sendDelayed(msg,GENERATIONDELAY,"lowergate_out");
}
lento[soc]=hopto[soc]*hopsize;
}
}
void application::commatrix()
{
int sel[NUM_ANC],i,j,t;
double dt,b11,b21,a11,a12,a21,a22,ap11,ap12,ap21,ap22;
ap11=ap12=ap21=ap22=0.0;
a11=a12=a21=a22=0.0;
b11=b21=0.0;
dt=0.0;
for(i=0;i<NUM_ANC;i++)
sel[i]=i;
for(i=0;i<NUM_ANC-1;i++)
for(j=i+1;j<NUM_ANC;j++)
{
if(hopto[j]<hopto[i])
{
t=hopto[j];
hopto[j]=hopto[i];
hopto[i]=t;
t=sel[j];
sel[j]=sel[i];
sel[i]=t;
}
106
}
ap11=(double)(2*(ancpos[sel[0]].x-ancpos[sel[2]].x));
ap12=(double)(2*(ancpos[sel[0]].y-ancpos[sel[2]].y));
ap21=(double)(2*(ancpos[sel[1]].x-ancpos[sel[2]].x));
ap22=(double)(2*(ancpos[sel[1]].y-ancpos[sel[2]].y));
b11=ancpos[sel[0]].x*ancpos[sel[0]].xancpos[sel[2]].x*ancpos[sel[2]].x+ancpos[sel[0]].y*ancpos[sel[0]].yancpos[sel[2]].y*ancpos[sel[2]].y+lento[sel[2]]*lento[sel[2]]lento[sel[0]]*lento[sel[0]]
b21=ancpos[sel[1]].x*ancpos[sel[1]].xancpos[sel[2]].x*ancpos[sel[2]].x+ancpos[sel[1]].y*ancpos[sel[1]].yancpos[sel[2]].y*ancpos[sel[2]].y+lento[sel[2]]*lento[sel[2]]lento[sel[1]]*lento[sel[1]];
double test[2][4]={ap11,ap12,1.0,0.0,ap21,ap22,0.0,1.0};
dt=test[0][0];
for(i=0;i<4;i++)
test[0][i]=test[0][i]/dt;
dt=test[1][0];
for(i=0;i<4;i++)
test[1][i]=test[1][i]-dt*test[0][i];
dt=test[0][1]/test[1][1];
for(i=0;i<4;i++)
test[0][i]=test[0][i]-test[1][i]*dt;
dt=1.0/test[1][1];
for(i=0;i<4;i++)
test[1][i]=test[1][i]*dt;
a11=test[0][2];
a12=test[0][3];
a21=test[1][2];
a22=test[1][3];
rp.rx=a11*b11+a12*b21;
rp.ry=a21*b11+a22*b21;
}
6.4
(1)
(2)
(3)
107
6.2
6.2.1
1
2
3
4
5
IP
ISO
Internet IAB(Internet Architecture Board)
OSI
CMIS/CMIP(Common Management Information Services/Protocol) TCP/IP
SNMP(Simple Network Management Protocol)
WSN Internet
WSN
8.1 WSN
WSN
omnet WSN
6.2.1.1 wsn
[36]
Cisco
WSN
108
bug
wSN
wsn
wsn
flat
6.2.1.2 wsn
Wsn
WSN
,[37]:
(1) post-man
(2)
(3)
(4)
, :
(1) ,
(2). ,
(3).
.
1
1
2006
MOTE-VIEW
2005
SNMS
2005
109
AppSleep
2005
Agilla
2005
BOSS
2005
2005
2005
Siphon
2005
Sympathy
2005
[18]
RRP
2004
STREAM
2004
MANNA
2003
N/A
N/A
Sectoral Sweeper
2003
Node-Level Management
2003
SenOS
2003
TinyDB
2002
TopDisc
2001
2001
6.2.1.3 wsn
,
,
[37]:
(1)
(2)
(3) (
,)
(4) , WSN
(5) ,,,
wsn (), ,
(6)
6.2.2 wsn
WSN [38]
(1)
(2 /
(3) usage pattern
110
(4)Non-deterministic
(5)
6.2.2.1
,
,
, SPANGAFASCENTPEASNSSSCCP AppSleep SenOs
,
,[39]
SenOS
6.2.2.1.1 SenOs[5]
Sen OS
WSN
1 Sen OS
1Sen OS
ROM
SenOS
111
6.2.2.2
WSN
WSN
WSN
[6]
TopDisc[40]
6.2.2.2.1 TopDisc
TopDiscGuha
TopDisc
TopDisc
TopDisc
(1)
(2)
(3)
(4)
(5)
2TopDisc
112
TopDisc
6.2.2.3
,( tinyos)
,,
, ,
,
? ,
unreachablereachable
,
()
-
(
)
,, /
/mability"[41]
113
sympathy
- -
-
--
114
6.2.3 Omnet
6.2.3.1 Wsn
omnet WSN ,
,(),
()
omnet wsn
1
(20 80)
ID ,,ID
(,)
MAC
2
115
,,
,:
, 3, n .
:
n-1 n-1
n n
n+1
3
:
,,
:,
,
3
,
,():
,
ID ,
-------
,
,,
,
,:
,( 3)
( n+1 )
:
116
delete msg;
return ;
}
// meesage
if (IsMessageSeen[source])
// message
{
if(realhops-1>MinHops[ID])
{
if (msgtimerreply[source]!=NULL)
{
delete cancelEvent(msgtimerreply[source]); //
msgtimerreply[source] = NULL;
}
}
delete msg;
}
Else
// message
{
IsMessageSeen[source] = true;
MinHops[ID]=realhops;
if(PosOfAllNodes[ID].x==-1)
{
cModule *mod = this->parentModule();
PosOfAllNodes[ID].x=mod->par("PX");
PosOfAllNodes[ID].y=mod->par("PY");
}
if (realhops<rehops) // hop hop
{
SEND_TOPOLOGY_REQ(source,realhops);
SET_SELF_TIMER_REPLY(source);
delete msg;
}
if (realhops==rehops) // hop hop
{
ev <<"source:"<<source<< " ID"<<ID<<" rehops:"<<rehops <<"\n";
117
SEND_TOPOLOGY_REPLY_NEW(source,MinHops[ID],PosOfAllNodes[ID].x,PosOfAll
Nodes[ID].y);
delete msg;
}
if (realhops>rehops)
{
delete msg;
}
// setup timer for route reply
}
}
4
,() n ,
n+1
, n
,,
,,,,
,,,
,,
,
:
ID
ID
,
------
,,
118
0 : 1 3 15
1 : 3 15
2 : 4 13
3 : 6 7 15
4 : 5 9 11 13 18 19
5 : 8 9 11 13 18 19
6 : 7 12 15 17
7 : 8 17
8 : 9 10 17 18 19
9 : 17 18 19
10 : 17
11 : 14 18 19
12 : 16
13 : 18 19
18 : 19
6.2.4
119
6.3 OMNeT++
6.3.1
6.3.1.1
WSN
WSN
WSN
WSN
[45,46,47]
[49]
6.3.1.2
(1) MAC
(2)
WSN MAC
(3)
(4)
WSN
6.3.1.3
WSNsink.
WSN,,
(Proactive)(Reactive)
(Flooding)(Gossiping)[11]
(SAR)(Minimum Cost Field)
120
(SPIN)[12](DD)(LEACH)[8]
(TEEN)[10]PEGAGIS[9]
(GEAR)
(GPSR)[13]Ad Hoc
SPANGAF
6.3.1.4
(Relay)
(Sinkhole)(Sybil)(Wormhole)
HELLO(Acknowledgement Spoofing)[49, 50]
1
(1)
(Latency)
(2)
(Multihop)
(Black Hole)
(3)Sinkhole
Sinkhole
121
Wormhole
(4)Sybil[60]
SybilSybil
Sybil
(5)Wormhole[61]
Wormhole
Wormhole
Wormhole
SinkholeWormhole
1(a)WormholeSinkhole
1
(6)HELLO
HELLOHELLO
1(b)
(Advertisement)
HELO
(Overheard)
(7)
122
6.3.1.5
(1) (Directed Diffusion)
(Directed Difusion)Estrin
<>Sink
(interest)<>
sink
sink2
2 Directed Diffusion
Directed Difusion
sink sink sinkhole
Wormhole Svbil
01
T(n)T(n)p
rG1/p
123
sink
HELLO
Flood
Svbil
(3) GEAR(Geographic and Energy Aware Routing)[62]
GEARDirected Difusion
(
)sink
GEAR
sybil
6.3.1.6
Newsome J Sybil
[21]
Sybil
Needham-Schroeder
Wormhole
124
6.3.1.6.2
SinkholeWormholes
Brad KarpGPSR(Greedy Perimeter Stateless Routing)
[13]
Sinkhole
Wormhole
Yin Changqing
(Heuristic Secure
Routing on the DiameterSRD)[26]Ar
BB
DTokens
GPSRSRDINTRSNSLRSN
6.3.2 OMNeT++
(Directed Diffusion)
. diffusion
. node.ned node.msg
[node.msg]
message intMessage
{
fields:
int source;
int destination;
int hopCount = 0;
}
[node.ned]
simple Diffusion
gates:
in: in[];
out: out[];
endsimple
125
module Node
submodules:
node: Diffusion[7]; // we'll have 7 modules
display: "i=misc/node_s";
connections:
node[6].out++ --> delay 100ms --> node[5].in++;
node[6].in++ <-- delay 100ms <-- node[5].out++;
node[6].out++ --> delay 100ms --> node[4].in++;
node[6].in++ <-- delay 100ms <-- node[4].out++;
node[6].out++ --> delay 100ms --> node[3].in++;
node[6].in++ <-- delay 100ms <-- node[3].out++;
node[3].out++ --> delay 100ms --> node[4].in++;
node[3].in++ <-- delay 100ms <-- node[4].out++;
node[3].out++ --> delay 100ms --> node[5].in++;
node[3].in++ <-- delay 100ms <-- node[5].out++;
node[3].out++ --> delay 100ms --> node[2].in++;
node[3].in++ <-- delay 100ms <-- node[2].out++;
node[3].out++ --> delay 100ms --> node[1].in++;
node[3].in++ <-- delay 100ms <-- node[1].out++;
node[3].out++ --> delay 100ms --> node[0].in++;
node[3].in++ <-- delay 100ms <-- node[0].out++;
node[4].out++ --> delay 100ms --> node[2].in++;
node[4].in++ <-- delay 100ms <-- node[2].out++;
node[5].out++ --> delay 100ms --> node[1].in++;
node[5].in++ <-- delay 100ms <-- node[1].out++;
node[2].out++ --> delay 100ms --> node[0].in++;
node[2].in++ <-- delay 100ms <-- node[0].out++;
node[1].out++ --> delay 100ms --> node[0].in++;
node[1].in++ <-- delay 100ms <-- node[0].out++;
endmodule
network node : Node
endnetwork
. diffusion.cpp
[diffusion.cpp]
#include <stdio.h>
#include <string.h>
#include <omnetpp.h>
#include "node_m.h"
class Diffusion : public cSimpleModule {
protected:
126
// OMNeT
void Diffusion::initialize()
{
// node[0], sink interest message
if (index() == 0)
{
// self-message
intMessage *msg = genMessage();
scheduleAt(0.0, msg);
}
}
void Diffusion::handleMessage(cMessage *msg)
{
if (simTime() < 0.3)
{
ev << simTime() << " ";
intMessage *intMsg = check_and_cast<intMessage *>(msg); //
forwardMessage(intMsg); //
}
else
{
//
cTopology topo;
topo.extractByModuleType("Diffusion",NULL);
for (int i=0; i<topo.nodes(); i++)
{
cTopology::Node *node = topo.node(i);
ev << "Node i=" << i<< " is " << node->module()->fullPath()<< endl;
ev<<"It has " << node->outLinks()<<" conns to other nodes\n";
ev<< "and " << node->inLinks()<<" conns from other nodes\n";
ev << "Connections to other modules are:\n";
127
for(int j=0;j<node->outLinks();j++)
{
cTopology::Node *neighbour = node->out(j)->remoteNode();
cGate *gate = node->out(j)->localGate();
ev << "
" << neighbour->module()->fullPath()
<< " through gate " << gate->fullName() << endl;
}
}
// node(6)
cTopology::Node *targetnode = topo.node(6);
topo.unweightedSingleShortestPathsTo(targetnode);
cTopology::Node *node = topo.node(0);
if (node == NULL)
{
ev << "We(" << fullPath() << ") are not included in the topology.\n";
}
else if (node->paths() == 0)
{
ev << "No path to destination.\n";
}
else
{
while (node != topo.targetNode())
{
ev << "We are in " << node->module()->fullPath() << endl;
ev << node->distanceToTarget() << " hops to go\n";
ev << "There are " << node->paths()
<< " equally good directions, taking the first one\n";
cTopology::LinkOut *path = node->path(0);
ev << "Taking gate" << path->localGate()->fullName()
<<" we arrive in" << path->remoteNode()->module()->fullPath()
<< " on its gate" << path->remoteGate()->fullName() << endl;
node = path->remoteNode();
}
}
if(index() == 6) updateDisplay();
if(index() == 3) updateDisplay();
if(index() == 0) updateDisplay();
128
}
}
//
intMessage* Diffusion::genMessage()
{
// .
int src = index(); // ID
int n = size();
//
int dest = intuniform(0,n-1);
char msgName[20];
// .
intMessage *msg = new intMessage(msgName);
msg->setSource(src);
msg->setDestination(dest);
return msg;
}
//
void Diffusion::forwardMessage(intMessage *msg)
{
int n = gate("out")->size();
if (index() != 6)
{
for( int i=0; i<n; i++)
{
ev << "Forwarding message " << "on port out[" << i << "]\n";
intMessage *copy=(intMessage*) msg->dup();
send(copy, "out", i);
}
}
}
//
void Diffusion::updateDisplay()
{
char buf[40];
sprintf(buf, "Best Path!");
displayString().setTagArg("t", 0, buf);
}
129
. :
nedtool node.ned;
opp_nmakemake -f -e cpp;
nmake -f Makefile.vc;
diffusion.exe
. [omnetpp.ini]
[omnetpp.ini]
# Lines beginning with `#' are comments
[General]
preload-ned-files=*.ned
network=node
. diffusion.exe
130
6.3.3
(1)
(2)SPINGPSR
SRDINTRSN
(3)
131
132
Wireless Sensor
[48] Kemal Akkava and Mohamed Younis. A Survey on Routing Protocols for
Wireless Sensor Networks. November 2003.
[49] GUO Zhi-yuan,HE Qi-yuan. Study on Security of Routing Protocol in
Wireless Sensor Network.
[50] Karlof C, Wagner D. Secure Routing in Sensor Networks: Attacks and
Countermeasures. Ad Hoc Networks, 2003,1(1):293-315.
[51] C Intanagonwiwat, R Govindan and D Estrin. Direeted Diffusion: A Scalable
and Robust Communication Paradigm for Sensor Networks[C]. in the Proceedings
of the 6th Annual ACM/IEEE International Conference on Mobile Computing and
Networking(MobiComO0),Boston, MA,August 2000.
[52] Heinzelman W, Chandrakasan A, Balakrishnan H. Energy-efficient
Communication Protocol for Wireless Microsensor Networks. In: Proc. of the 33rd
Annual Hawaii Intl Conf. on System Sciences. Maui: IEEE Computer Society,
2000. 3005-3014.
[53] Lindsey S, Raghavendra CS. PEGASIS: Power-efficient gathering in sensor
information systems. In: Proc. of the IEEE Aerospace Conf. Montana: IEEE
Aerospace and Electronic Systems Society, 2002. 1125-1130.
[54] Manjeshwar A, Agrawal DP. TEEN: A protocol for enhanced efficiency in
wireless sensor networks. In: Intl Proc. of the 15th Parallel and Distributed
Processing Symp. San Francisco: IEEE Computer Society, 2001. 2009-2015.
[55] Haas ZJ, Halpern JY, Li L. Gossip-Based ad hoc Routing. In: Proc. of the
IEEE INFOCOM. New York: IEEE Communications Society, 2002. 1707-1716.
[56] Kulik J, Heinzelman WR, Balakrishnan H. Negotiation based protocols for
disseminating information in wireless sensor networks . Wireless Networks,
2002,8(2-3):169-185.
[57] Karp B, Kung H. GPSR: Greedy perimeter stateless routing for wireless
networks. In: Proc. of the 6th Annual Intl Conf. on Mobile Computing and
Networking. Boston: ACM Press, 2000. 243-254.
[58] W. Heinzelman, A. Sinha, A. Wang, A. Chandrakasan.
Energy-scalable
algorithms and protocols for wireless microsensor networks. Proc. International
Conference on Acoustics, Speech, and Signal Processing (ICASSP '00), June 2000.
[59] W. Heinzelman, A. Chandrakasan, H. Balakrishnan. An application-specific
protocol architecture for wireless microsensor networks .
in press: IEEE
Transaction on Wireless Networking.
[60] I. R. Uouceur. The Sybil Attack. In: 1st lnremotionnl Workshop on
Peer-to-Peer Syslcmr (IPTPS '0202). March 2002.
[61] Y.-C. Hu, A. Perrig, and U. B. Johnson. Wormhole detection in wireless
ad hoc networks. Depmenent of Computer Science, Rice University. Tech. Rep.
TR01-384, June 2002.
[62] Y. Yu, R. Govindan, and U. Estrin. Geographical and energy awaremuting:
135
[1]
[2][34]
[5] [6,7] [89]
136
[10] GPS
GPS
WSN
7.1
In-door(Outdoor)
7.1.1
Active Badge[11]RADAR[12]Cricket[13]
ID
()
7.1.1.2 RADAR
RADARMicrosoft2000
RADAR
137
7.1.1.3 Cricket
CricketMIT2000
Cricket
300000000m/s340m/s
7.1.2
7.1.2.1
DV-Hop[14]Amorphous[15]
DV-HopRutgers UniversityNiculescuDV
Hop 3
2
1
TTL
3
3
Amorphous[15]DV-Hop[14]
138
7.1.2.2
GPS
GPSGPSGPS
ZebraNet[16]GPSMCL(Monte Carlo
Localization)[17]GPSDL(directional localization)
[18]
2002Princeton UniversityPhilo JuangZebraNet,
GPS
3GPS
GPS
2004 Virginia Lingxuan Hu
MCL
Lingxuan Hu
N
V A
A V
50 50
2006Polytechnic UniversityAkcanDL
7.2 OMNeT++
OMNeT++
MCL OMNeT++
MCL
139
t-1 lt 1 Vmax
t lt 1 Vmax 1
Vmax
lt 1
1
S
S
2
S T
filter (l ) s S , d (l , s ) r s r d (l , s ) r 2
50 50
// N
p (lt | lt 1 ) t lt
Lt {}
Whilesize( Lt )<N do
140
= +1
<N and
<20000
meetCondition(Coord
p)>=0
//
= +1
7.2.2.1
(.ned )
:mobility,bottomlayer,position
mobility bottomlayer position
141
mobileHost.ned
simple Mobility
parameters:
minSpeed:
numeric const,
maxSpeed:
numeric const,
movKind:
numeric const,
XRange:
numeric const,
YRange:
numeric const,
pauseTime: numeric const,
moveInterval:
numeric const,
gates:
out: out;
endsimple
simple bottomLayer
parameters:
seed_r: numeric const,
node_r: numeric const,
isSeed: numeric const;
gates:
in: fromMobility;
in: fromPosition;
out: toPosition;
endsimple
//
//
//
//
//
//
//
//
//
//
simple Positioning
parameters:
isSeed:
numeric const, //
announceInterval:
numeric const,
//
updateInterval:
numeric const, //
seed_r:
numeric const,
//
node_r:
numeric const, //
max_v:
numeric const, //
142
delta:
numeric const;
gates:
in: fromBottom;
out: toBottom;
endsimple
//
module MobileHost
parameters:
isSeed: numeric const, //
numHost: numeric const, //
x: numeric, // x
y: numeric,
// y
Xbound: numeric, //
Ybound: numeric, //
seed_r: numeric const, //
node_r: numeric const, //
mobilityModel: string, //
posAlgorithm: string; //
submodules:
mobility: mobilityModel like Mobility;
parameters:
XRange = Xbound,
YRange = Ybound;
display: "p=260,64;b=24,26";
bottomlayer: bottomLayer;
parameters:
isSeed = isSeed,
seed_r = seed_r,
node_r = node_r;
display: "p=148,62;b=104,10";
position: posAlgorithm like Positioning;
parameters:
isSeed = isSeed,
seed_r = seed_r,
node_r = node_r,
max_v = input,
delta = input,
announceInterval = input,
updateInterval = input;
display: "p=148,171;b=104,10";
connections:
mobility.out --> bottomlayer.fromMobility;
position.toBottom --> bottomlayer.fromPosition;
143
mcl.ned
import "mobileHost.ned";
module MobileSensorNet
parameters:
numHost: numeric const,
anchorFraction: numeric const,
playgroundSizeX: numeric const,
playgroundSizeY: numeric const;
submodules:
seed: MobileHost[numHost * anchorFraction];
parameters:
isSeed = 1,
numHost = numHost,
Xbound = playgroundSizeX,
Ybound = playgroundSizeY,
x = intuniform(0,playgroundSizeX),
y = intuniform(0,playgroundSizeY);
node: MobileHost[numHost - numHost * anchorFraction];
parameters:
isSeed = 0,
numHost = numHost,
Xbound = playgroundSizeX,
Ybound = playgroundSizeY,
x = intuniform(0,playgroundSizeX),
y = intuniform(0,playgroundSizeY);
endmodule
network mobilesensornet : MobileSensorNet
endnetwork
144
7.2.2.2
C++ simple
MobilitybottomLayer PositioningMobility bottomLayer
Positioning MCL MCL
MCL
cMessage *annouceMsg = new cMessage("Annouce");
annouceMsg->setKind(MCL_MSG_ANNOUNCE_LOCATION);
scheduleAt(simTime()+announceInterval, annouceMsg);
message LocAnnounce
{
fields:
double x=0;
double y=0;
int hops=0;
int
id;
};
if(msg->kind() == MCL_MSG_ANNOUNCE_LOCATION)
{
LocAnnounce *locmsg = new LocAnnounce();
int x,y;
bottomlayer->getPos (x,y);
locmsg->setX(x);
locmsg->setY (y);
locmsg->setHops (0);
locmsg->setId(parentModule()->id());
locmsg->setId (MCL_MSG_SEED_LOCATION);
send(locmsg,"toBottom");
scheduleAt(simTime()+announceInterval, msg);
}
MCL_MSG_SEED_LOCATION 1 2
if(msg->kind() == MCL_MSG_SEED_LOCATION)
{
145
7.2.2.3
OMNeT++ MCL OMNeT++ 3
147
MCL 17 MCL
MCLCentroid Amorphous 4
4
4 r 1 10
r MCL 0.5r ,MCL
Centroid Amorphous
7.3.
148
OMNeT++ MCL
MCLDL
[1]Rabacy JJ, Ammer MJ, da Silva Jr. JL, Patel D, Roundy S. Picorodio supports
ad hoc ultra-low power wireless networking. Computer, 2000,33(7):4248
[3]Capkun S, Hamdi M, Hubaux J-P. GPS-Free positioning in mobile ad-hoc networks. Cluster
Computing, 2002,5(2):157167.
[4]Doherty L, Pister KSJ, Ghaoui LE. Convex position estimation in wireless
sensor networks. In: Proc. of the IEEE INFOCOM 2001. Vol.3, Anchorage: IEEE
Computer and Communications Societies, 2001. 16551663.
[10]Alberto Cerpa, Deborah Estrin. Ascent: Adaptive self-configuring sensor network topologies.
ACM SIGCOMM Computer Communication Review, 2002,32(1):6262.
[11]BAHL, P., AND PADMANABHAN, V. RADAR: An In-Building RF-based User Location
and Tracking System. InProc. IEEE INFOCOM (Tel-Aviv, Israel, Mar. 2000).
[12]WANT, R., HOPPER, A., FALCAO, V., AND GIBBONS, J.The Active Badge Location
System. ACM Transactions on Information Systems 10, 1 (January 1992), 91102.
[13]Priyantha NBChakraborty ABalakrishnan HThe cricket location-support
system In Proc of the 6th Annual Intl Conf on Mobile Computing and
149
NetworkingBostonACM Press20003243
[14]D. Niculescu and B. Nath, Ad hoc positioning system (APS), in GLOBECOM.
IEEE, November 2001.
[15]Radhika Nagpal, Howard Shrobe, and Jonathan Bachrach. Organizing a Global
Coordinate System from Local Information on an Ad Hoc Sensor Network. 2nd
International Workshop on Information Processing in Sensor Networks (IPSN).
April 2003.
[16]JUANG, P., OKI, H., WANG, Y., MARTONOSI, M., PEH, L. S., AND RUBENSTEIN, D.
Energy-efficient computing for wildlife tracking: design tradeoffs and early
experiences with zebranet. Proc. of ASPLOS '02 (October 2002), 96--107.
[17]L.Hu, D.Evans: Localization for Mobile Sensor Networks. Tenth Annual
International Conference on Mobile Computing and Networking (MobiCom 2004),
USA.2004.
[18]Hseyin Akcan,, Herv Brnnimann,Vassil Kriakov,Alex Delis, GPS Free Node
Localization in Mobile Wireless Sensor Networks. Proceedings of the 5th ACM
international workshop on Data engineering for wireless and mobile access,
USA,2006.
150