You are on page 1of 28

1utor|a|

Lva|uanon of Veh|cu|ar Ad noc Network


(VANL1) protoco|s and app||canons through
s|mu|anons.

17
th
November 2011
Nlcbolos loollooJes
v-5eose ltoject (bup.//vseose.cs.ocy.oc.cy)
uept. of compotet 5cleoce, uolvetslty of cyptos (bup.//www.cs.ocy.oc.cy)
Cverv|ew
Slmulauon Workow for vAnL1s
MoblllLy Slmulauon uslng SuMC
vehlcular Ad Poc neLwork Slmulauon uslng ns-3
C&A
Ceneral ulscusslon
Nicholas Loulloudes (V-Sense Project) 2
S|mu|anon Workow for VANL1s
neLwork
Slmulauon
1opology CuLpuL
Nicholas Loulloudes (V-Sense Project) 3
S|mu|anon Workow for VANL1s
MoblllLy
SlmulaLor
8oad
1opology
MoblllLy
uemand
MoblllLy
Models
M
o
b
l
l
l
L
y

1
r
a
c
e
s

1opo|ogy
Nicholas Loulloudes (V-Sense Project) 4
S|mu|anon Workow for VANL1s
M
o
b
l
l
l
L
y

1
r
a
c
e
s

1ransporL
Appllcauons
neLwork
P? & MAC
Network S|mu|anon
Nicholas Loulloudes (V-Sense Project) 5
S|mu|anon Workow for VANL1s
noLe - lor Lhls LuLorlal we use:
o SuMC (Slmulauon for urban MoblllLy) for MoblllLy Slmulauon
hup://sumo.sourceforge.neL/
o ns-3 for neLwork Slmulauon
hup://www.nsnam.org/
Nicholas Loulloudes (V-Sense Project) 6
Mob|||ty S|mu|anon
koad 1opo|ogy Dehn|non
1wo opuons avallable:
1. lmporL a real (publlcly avallable) road neLwork
l.e. CpenSLreeLMap (hup://www.opensLreeLmap.org)
ros: lncreased 8eallsm
Cons: A loL of lnfo mlsslng (speeds, Lurnlng regulauons, Lramc llghL sLaLes)
2. Manually bulld your own road neLwork
ros: Slmple Lopologles, beuer conLrol
Cons: very ume consumlng, error prone
8oad Lopology ln SuMC ls a dlrecLed graph
o nodes represenL [uncuons and Ldges represenL sLreeLs.
o Lvery sLreeL (edge) as a collecuon of lanes. Lach lane has a posluon, shape and speed llmlL
o 8lghL of way regulauon
o Connecuons beLween lanes aL [uncuons (nodes)
o osluon and loglc of Lhe Lramc llghLs.
o 1opology ls dened uslng xML Lags
Nicholas Loulloudes (V-Sense Project) 7
Mob|||ty S|mu|anon
Demand Mode||ng Dehn|non
uemand Modellng denes Lhe vehlcle moblllLy on Lhe road Lopology
o koutes:
uene for a slngle vehlcle lLs movemenL from a sLarung edge Lo a desunauon edge, lncludlng
also all Lhe lnLermedlary edges Lhe vehlcle wlll pass.
o 1r|ps:
uene for a slngle vehlcle lLs movemenL from a sLarung edge (sLreeL), Lo Lhe desunauon edge,
and Lhe deparLure ume.
lnLermedlary edges Lhe vehlcle wlll Lraverse (rouLes) are compuLed elLher:
o uslng Lhe shorLesL-paLh algorlLhm by ul[ksLra (uuA8Cu1L8)
o uslng Lurnlng percenLages aL [uncuons (!18Cu1L8)
o I|ows:
Same as Lrlps, buL for muluple vehlcles wlLh same sLarL-end.
o Acnv|ty-8ased:
uenes demand from a descrlpuon of Lhe populauon ln Lhe neLwork. lL uses acuvlLy-based
Lramc model for acuvlues such as school, work, free ume.
used for real clLy maps, and requlres sLausucs for a clLy.
More lnfo:
hup://sumo.sourceforge.neL/doc/currenL/docs/uemand/
lnLroducuon_Lo_demand_modelllng_ln_SuMC.hLml
Nicholas Loulloudes (V-Sense Project) 8
Mob|||ty S|mu|anon
Veh|c|e ropernes Dehn|non
SuMC allows Lo speclfy vehlcle properues such as:
o hyslcal roperues
LengLh
Max. Accelerauon / uecelerauon
Max. veloclLy
o Car-lollowlng roperues
Max. Accelerauon / uecelerauon
urlver lmperfecuon
urlver reacuon ume
Peadway,
Mln gap
SupporLed Car-lollowlng models:
krauss
lnLelllgenL urlver Model
kerner
Wagner
More lnfo on car-followlng models:
hup://www.cs.odu.edu/~mwelgle/courses/cs793-s08/papers/harrl-mar07.pdf

Nicholas Loulloudes (V-Sense Project) 9
Mob|||ty S|mu|anon
Cutput
SuMC provldes exLenslve ouLpuL opuons
o Ldge/Lane SLausucs (lor a glven ume lnLerval)
1ravel 1lmes
uenslLy
Mean Speeds
Arrlval and ueparLure volumes
o vehlcle osluon (lor a glven ume lnLerval)
osluon and Speeds of all vehlcles or a glven Lype of vehlcle
o 1rlp and 8ouLe lnformauon
o 1ramc LlghL SLaLes
hase changes
uurauons
o .
o More lnfo: hup://sumo.sourceforge.neL/doc/currenL/docs/Slmulauon/CuLpuL.hLml
Nicholas Loulloudes (V-Sense Project) 10
Mob|||ty S|mu|anon
S|mp|e Lxamp|e
2000m x 2000m recLangular area
9 [uncuons
24 bl-dlrecuonal sLreeLs
o 1 lane each dlrecuon
no Lramc llghLs
Max. Speed 18 m/s (60km/h)
300s slmulauon ume
8andom Lrlps
234 vehlcles ln[ecLed Lo neLwork
0
20
40
60
80
100
120
140
160
0 50 100 150 200 250 300
N
u
m
b
e
r

o
f

N
o
d
e
s
Time (s)
"nodesPerSecond.txt" using 1:2
Nicholas Loulloudes (V-Sense Project) 11
VANL1 S|mu|anon
ns-3 Cverv|ew
ulscreLe - LvenL neLwork SlmulaLor
Allows enure slmulauon workow, from slmulauon
congurauon Lo Lrace collecuon and analysls.
Wrluen ln C++
Plgh-Level Al
o uescrlbe Models and rogram llow uslng C++ or yLhon
Core deslgn LhaL enables lnLeracuon wlLh real world
lnLerfaces (real-ume neLwork emulaLor)
SupporL l and non-l neLworks
Scalable (memory emclenL)
Can run ln dlsLrlbuLed mode Lhrough Ml
Nicholas Loulloudes (V-Sense Project) 12
VANL1 S|mu|anon
ns-3 Cverv|ew
!"#$
%&'( &!*+ ,-!.+/ '-0+ 1232
34
A software organization view
heIper
Routing Internet stack Devices
mobiIity node
simuIator common
core
High-IeveI wrappers
for everything eIse
No smart pointers
Aimed at scripting
Events
ScheduIer
Time arithmetic
MobiIity modeIs
(static, random
waIk, etc)
Packets
Packet Tags
Packet Headers
Pcap/ascii fiIe writing
Smart pointers
Dynamic type system
Attributes
CaIIbacks, Tracing
Logging
Random VariabIes
Node cIass
NetDevice ABC
Address types
(Ipv4, MAC, etc.)
Queues
Socket ABC
Ipv4 ABCs
Packet sockets
* Source: ns-3 LuLorlal aL CLnl (hup://www.nsnam.org/LuLorlals/genl-LuLorlal-parL1.pdf)
Nicholas Loulloudes (V-Sense Project) 13
VANL1 S|mu|anon
ns-3 Cverv|ew
Llnk Layer Models
o Wlll - 802.11 llnks
lnfrasLrucLure and Ad Poc modes
Mesh (802.11s)
o 802.16 - WlMax
o llnks
o CSMA - LLherneL llnks
o 802.11d - Learnlng 8rldge
o L1L
8ouung Models
o Ad Poc (ACuv, CLS8, uSuv) - supporLs lv4
o nlx-vecLor 8ouung - supporLs lv4
o SLauc 8ouung (unlcasL & mulucasL) - supporLs lv4 and lv6
o LlsL 8ouung ([olns muluple rouung proLocols aL a node) - supporLs lv4 and lv6
Nicholas Loulloudes (V-Sense Project) 14
VANL1 S|mu|anon
S|mp|e Lxamp|e
use moblllLy Lraces from SuMC example above.
vehlcles have a uS8C enabled C8u (1x range ~ 300m)
vehlcles 8roadcasL 8eacon (Pello) messages every 1 seconds.
o PLLLC conLalns (node lu, osluon, ulrecuon, Speed)
1wo sLauonary 8Sus
vehlcles lnluaLe a uu C88 sesslon
Lo boLh 8Sus (1pkL/sec)
for Lhe durauon ln Lhe slmulauon.
8Su 1
8Su 2
Nicholas Loulloudes (V-Sense Project) 15
VANL1 S|mu|anon
S|mp|e Lxamp|e (cont.)
Mlcroscoplc locus for Lxample
Pello Messages are sLored as rouung Lable enLrles ln each
vehlcle and have an explrauon ume
4
2
3
S
node osluon ulrecuon Speed Lxp|re
3 x,? n 12m/s +3
2 x,? n 10m/s +4
1
node 3
rouung Lable
node 3
1x range
Nicholas Loulloudes (V-Sense Project) 16
VANL1 S|mu|anon
S|mp|e Lxamp|e (cont.)
node 3 wanLs Lo send some packeLs Lo Lhe sLauonary 8Su (l.e.
parklng reservauon.) - [C88 uu sesslon, wlLh no reply].
use geographlc forwardlng (send packeL Lo my nelghbor
whlch ls closesL Lo desunauon -> l.e. node 2)
4
2
3
S
1
Data acket
8Su
Nicholas Loulloudes (V-Sense Project) 17
VANL1 S|mu|anon
S|mp|e Lxamp|e (cont.)
node 2 does noL have a nelghbor closer Lo desunauon (local
maxlmum) ! Cueue packeL unul a new node ls found (Cnl).
When a PLLLC message from a new node ls 8x, check queue
for packeLs Lo be send ! lf found, send Lhen, and clear queue

4
2
3
S
node osluon ulrecuon Speed Lxp|re
3 x,? n 12m/s +3
3 x,? n 8m/s +2
1
node 2
rouung Lable

8Su
ackeL lrom 1o Lxplre
3 8Su +10
node 2
queue
Nicholas Loulloudes (V-Sense Project) 18
VANL1 S|mu|anon
S|mp|e Lxamp|e (cont.)
node 2 sees node 4 ! Checks queue ! Sends Lo node 4
node 4 queues packeL slnce no nelghbor ls closer Lo 8Su

4
2
3
S
node osluon ulrecuon Speed Lxp|re
3 x,? n 12m/s +3
3 x,? n 8m/s +2
1
node 2
rouung Lable
8Su
Nicholas Loulloudes (V-Sense Project) 19
VANL1 S|mu|anon
S|mp|e Lxamp|e (cont.)
upon enLerlng 8Su range, node 4 checks queue
8Su ls desunauon ! node 4 hands Lo 8Su packeL
8Su consumes (makes parklng reservauon)
4
2
3
S
1
8Su
Nicholas Loulloudes (V-Sense Project) 20
VANL1 S|mu|anon
S|mp|e Lxamp|e (cont.)
n|gh||ghted Words Ns-3 Modu|es
MoblllLy, 8Sus nS2MoblllLyPelper
uS8C enabled C8u neLuevlce
Pello messages
ackeL (and Peader)
uaLa ackeL
8ouung 1able enLrles 8ouung 1able
Ceographlc lorwardlng 8ouung roLocol
C88 uu Sesslon Cn/C Appllcauon (uu
Sesslon)
Cueue Cueue
Consumes uu Slnk Appllcauon
Nicholas Loulloudes (V-Sense Project) 21
Mob||e Nodes
vo|d
ubSubLxamp|e::CreateMob||eNodes ()
[
nS_LCC_lunC1lCn (th|s),

sLd::couL << "Creaung " << (uns|gned)s|ze << " mob||e nodes.\n",
nodes.CreaLe (slze),

// name moblle nodes
for (u|nt32_t | = 0, | < s|ze, ++|)
[
sLd::osLrlngsLream os,
os << "node-" << l,
names::AJJ (os.stt (), ooJes.Cet (l)),
}

// CreaLe ns2MoblllLyPelper wlLh Lhe specled Lrace log le as parameLer
ns2MoblllLyPelper ns2 (Lracellle),
ns2.lnsLall (), // congure movemenLs for each node, whlle readlng Lrace le
}
Nicholas Loulloudes (V-Sense Project) 22
Stanc Nodes (kSU)
vo|d
ubSubLxamp|e::CreateStancNodes ()
[
nS_LCC_lunC1lCn (th|s),

sLd::couL << "Creaung " << (uns|gned)stancNodes << " stanc nodes.\n",
nodes.CreaLe (sLaucnodes),

// CreaLe Lwo sLauc nodes, wlLh xed coordlnaLes.
MoblllLyPelper moblllLy,
Lr<LlsLosluonAllocaLor> posluonAlloc = CreaLeCb[ecL<LlsLosluonAllocaLor> (),
posluonAlloc->Add (vecLor (2010.0, 1300.0, 0.0)), // SLauc node 1 (x:2010, y:1300)
posluonAlloc->Add (vecLor (10.0, 300.0, 0.0)), // SLauc node 2 (x:10, y:300)
moblllLy.SeLosluonAllocaLor (posluonAlloc),
moblllLy.SeLMoblllLyModel ("ns3::ConsLanLosluonMoblllLyModel"),

// name sLauc nodes
for (u|nt32_t | = s|ze, | < s|ze + stancNodes, ++|)
[
sLd::osLrlngsLream os,
os << "node-" << l,
names::AJJ (os.stt (), ooJes.Cet (l)),

moblllLy.lnsLall (nodes.CeL (l)),
}

}
Nicholas Loulloudes (V-Sense Project) 23
Create Net Dev|ces
vo|d
ubSubLxamp|e::CreateDev|ces (std::str|ng tr_name)
[
nS_LCC_lunC1lCn(th|s),

// CreaLe Lhe P? and MAC layers for uS8C - Maybe needs some pollshlng.
sLd::couL<<"Creaung uevlces.." <<sLd::end|,

WlPelper m_wlPelper = WlPelper::uefoolt(),
m_wlPelper.SeLSLandard (wlll_ln_51ANuAku_80211p_ccn), // 5et 802.11p wlll
nqosWlMacPelper m_wlMacPelper = nqosWlMacPelper::uefoolt(),
?ansWlhyPelper m_wlhyPelper = ?ansWlhyPelper::uefoolt(),
?ansWlChannelPelper m_wlChannelPelper = ?ansWlChannelPelper::uefoolt (),
m_wlMacPelper.SeL1ype ("ns3::AdhocWlMac"), // Ad-Poc Mac
sLd::sLrlng phyMode ("Cfdm8aLe6Mbps8W10MPz"), //CluM hy mode
m_wlPelper.SeL8emoLeSLauonManager("ns3::ConsLanL8aLeWlManager",
"uaLaMode", SLrlngvalue(phyMode), "ConLrolMode", SLrlngvalue(phyMode)),

// use Lhe nakagaml ropagauon Loss Model
m_wlChannelPelper.AddropagauonLoss ("ns3::nakagamlropagauonLossModel"),
m_wlhyPelper.SeLChannel (m_wlChannelPelper.CreaLe ()),
m_wlhyPelper.SeL ("1xowerSLarL",uoublevalue (21.3)), // 230-300 meLer Lransmlsslon range
m_wlhyPelper.SeL ("1xowerLnd",uoublevalue (21.3)), // 230-300 meLer Lransmlsslon range
m_wlhyPelper.SeL ("1xowerLevels",ulnLegervalue (1)),
m_wlhyPelper.SeL ("1xCaln",uoublevalue (0)),
m_wlhyPelper.SeL ("8xCaln",uoublevalue (0)),
m_wlhyPelper.SeL ("LnergyueLecuon1hreshold", uoublevalue (-101.0)),
devlces = m_wlPelper.lnsLall (m_wlhyPelper, m_wlMacPelper, nodes),

Ascll1racePelper ascll,
m_wlhyPelper.LnableAscllAll (ascll.CreaLellleSLream (Lr_name + ".Lr")),
}
Nicholas Loulloudes (V-Sense Project) 24
Internet Stack (Address|ng)
vo|d
ubSubLxamp|e::Insta||InternetStack (std::str|ng tr_name)
[
nS_LCC_lunC1lCn(th|s),

sLd::couL << "lnsLalllng lnLerneL SLack..."<<sLd::end|,

// Pelper for Lhe ubSub rouung proLocol.
ubSubPelper pubsub,
// Congure ubSub aurlbuLes here uslng ubSub.SeL (name, value)
lnLerneLSLackPelper sLack,
sLack.SeL8ouungPelper (pubsub), // has eecL on Lhe nexL lnsLall ()
sLack.lnsLall (nodes),

// SeL Addresslng lnformauon
lpv4AddressPelper address,
address.SeL8ase ("10.0.0.0", "233.0.0.0"),
lnLerfaces = address.Asslgn (devlces),
}
Nicholas Loulloudes (V-Sense Project) 25
C8k App||canon
vo|d
ubSubLxamp|e::Insta||App||canons ()
[
nS_LCC_lunC1lCn(th|s),
// SeLup packeL slnks aL each sLauc node (8Su)
for (u|nt32_t | = s|ze, | < s|ze + stancNodes, |++ )
[
Lr<node> node = nodeLlsL::CetNoJe (l),
sLd::couL << "Semng packeL slnk on node " << l << sLd::end|,
lpv4Address nodeAddress = node->CeLCb[ecL<lpv4> ()->CeLAddress (1, 0).CeLLocal (),
Lr<SockeL> slnk = SeLupackeL8ecelve (nodeAddress, node),
}

// SeLup uaLa sendlng raLe

/*packeL slze ln byLes > converL raLe Lo blLs/s by muluply * 8*/
raLe = packeLSlze * pkLserSecond * 8,

for (u|nt32_t c||entNode = 0, c||entNode < s|ze, c||entNode++ )
[
for (u|nt32_t [ = s|ze, [ < s|ze + stancNodes, [++ )
[

//CreaLe a C88 connecuon from each vehlcle Lo each sLauc node (8Su).
ubSubAppllcauonPelper pubsubPelper ("ns3::udpSockeLlacLory", Address (lneLSockeLAddress (lnLerfaces.CeLAddress ([), porL))),
pubsubPelper.SeLAurlbuLe ("Cn1lme", 8andomvarlablevalue (ConsLanLvarlable (1))),
pubsubPelper.SeLAurlbuLe ("C1lme", 8andomvarlablevalue (ConsLanLvarlable (0))),
pubsubPelper.SeLAurlbuLe ("Local", Addressvalue (lnLerfaces.CeLAddress (cllenLnode))),
pubsubPelper.SeLAurlbuLe ("uaLa8aLe", uaLa8aLevalue (uaLa8aLe (raLe))),
pubsubPelper.SeLAurlbuLe ("ackeLSlze", ulnLegervalue (packeLSlze)),


Nicholas Loulloudes (V-Sense Project) 26
C8k App||canon (cont.)
// Lach packeL send from Lhe C88 daLa generaLor should lnclude Lhe
// geographlc posluon of Lhe respecuve 8Su
vecLor [osluon = nodeLlsL::CetNoJe (j)->CetObject<MobllltyMoJel> ()->Cetlosluoo (),
pubsubPelper.SeLAurlbuLe ("uesLosluon", vecLorvalue ([osluon)),

|f ([ != c||entNode)
[
AppllcauonConLalner apps1 = pubsubPelper.lnsLall (nodes.CeL (cllenLnode)),
unlformvarlable var,

// SLarL Lhe C88 only aer Lhe node enLers Lhe slmulauon, Lherefore
// geL Lhe acuvlLy lnformauon.
Lr<nodeAcuvlLy1able> na = nodeLlsL::CetNoJe (clleotNoJe)->CetObject<NoJeAcuvlty1oble> (),
nodeAcuvlLyLnLry ne,

boo| ex|sts = na->LookupAcnv|ty (NodeL|st::!"#$%&" ()*+",#$%&"-. ,"-/

|f (ex|sts)
[
doub|e start = ne.GetStart ().GetSeconds (),
doub|e stop = ne.GetStop ().GetSeconds (),
apps1.SLarL (Seconds (var.CeLvalue (sLarL, sLarL + 1))),
apps1.SLop (Seconds (sLop - 1)),
}
}
}
}
}

Nicholas Loulloudes (V-Sense Project) 27
&A - D|scuss|on
Nicholas Loulloudes (V-Sense Project) 28

You might also like