AgentTraces are marked with AGT,
RouterTrace with RTR and
MacTrace with MAC.
AGT 表示 agent,也就是业务层
RTR 表示 route,也就是路由层
MAC 表示 mac, 也就是接入层
一些分析总结贴出来:
Trace文件含义解析:
1、仅仅打开-movementTrace ON
a.格式定义
**** Mobile Node Movement:
M %.5f %d (%.2f, %.2f, %.2f), (%.2f, %.2f), %.2f
double Time
int Address (Node ID?)
double X Coordinate
double Y Coordinate
double Z Coordinate
double Destination X Coordinate
double Destination Y Coordinate
double Movement Speed
**** Mobile Node Energy:
N -t %f -n %d -e %f
double Time
int Address (Node ID?)
double Energy
b.实际Trace记录和分析
M 0.01000 0 (1.00, 1.00, 0.00), (300.00, 300.00), 150.00
M 0.01000 1 (399.00, 399.00, 0.00), (399.00, 399.00), 50.00
M 0.01000 2 (360.00, 300.00, 0.00), (360.00, 300.00), 50.00
N -t 1.000000 -n 1 -e 0.500000
N -t 1.000000 -n 1 -e 0.500000
N -t 1.000000 -n 2 -e 0.500000
M 3.50000 2 (360.00, 300.00, 0.00), (100.00, 100.00), 200.00
M 4.00000 1 (399.00, 399.00, 0.00), (1.00, 1.00), 200.00
对应的NS语句为:
$ns_ at 0.01 "$node_(0) setdest 300.0 300.0 150.0"
$ns_ at 0.01 "$node_(1) setdest 399.0 399.0 50.0"
$ns_ at 0.01 "$node_(2) setdest 360.0 300.0 50.0"
$ns_ at 4.0 "$node_(1) setdest 1.0 1.0 200.0"
$ns_ at 3.5 "$node_(2) setdest 100.0 100.0 200.0"
能量初值为0.5j.
2、仅仅打开-agentTrace ON
a.格式定义
N: Node Property
I: IP Level Packet Information
H: Next Hop Information
M: MAC Level Packet Information
P: Packet Specific Information
Flag Type Value
s(r,d,f) s(r,d,f) r Send;r: Receive;d: Drop;f: Forward
-t double Time (* For Global Setting)
-Ni int Node ID
-Nx double Node X Coordinate
-Ny double Node Y Coordinate
-Nz double Node Z Coordinate
-Ne double Node Energy Level
-Nl string Network trace Level (AGT, RTR, MAC, etc.)
-Nw string Drop Reason
-Hs int Hop source node ID
-Hd int Hop destination Node ID, -1, -2
-Ma hexadecimal Duration
-Ms hexadecimal Source Ethernet Address
-Md hexadecimal Destination Ethernet Address
-Mt hexadecimal Ethernet Type
-P string Packet Type (arp, dsr, imep, tora, etc.)
-Pn string Packet Type (cbr, tcp)
必须要注意的是-Hd的值经常为-1 or -2.
-1意味着该分组是广播分组。
-2意味着该分组的目的节点还没有被设置,在应用代理层和路由代理层的交互中较常用。
Between (-Nl AGT) and routing (-Nl RTR) levels.
依据分组的类型,可能会有下述标志被使用:
CBR Trace
Flag Type Value
-Pi int Sequence Number
-Pf int Number Of Times Packet Was Forwarded
-Po int Optimal Number Of Forwards
IP Trace
Flag Type Value
-Is int.int Source Address And Port
-Id int.int Destination Address And Port
-It string Packet Type
-Il int Packet Size
-If int Flow ID
-Ii int Unique ID
-Iv int TTL Value
AODV Trace
Flag Type Value
-Pt hexadecimal Type
-Ph int Hop Count
-Pb int Broadcast ID
-Pd int Destination
-Pds int Destination Sequence Number
-Ps int Source
-Pss int Source Sequence Number
-Pl double Lifetime
-Pc string Operation (REQUEST, REPLY, ERROR, HELLO)
ARP Trace
Flag Type Value
-Po string Request or Reply
-Pms int Source MAC Address
-Ps int Source Address
-Pmd int Destination MAC Address
-Pd int Destination Address
b.实际Trace文件和分析
s -t 5.000000000 -Hs 1 -Hd -2 -Ni 1 -Nx 257.58 -Ny 257.58 -Nz 0.00 -Ne 0.500000 -Nl AGT -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 1.1 -Id 2.0 -It cbr -Il 210 -If 0 -Ii 0 -Iv 32 -Pn cbr -Pi 0 -Pf 0 -Po 24
r -t 5.009237153 -Hs 2 -Hd 2 -Ni 2 -Nx 120.75 -Ny 115.96 -Nz 0.00 -Ne 0.498603 -Nl AGT -Nw --- -Ma 13a -Md 2 -Ms 1 -Mt 800 -Is 1.1 -Id 2.0 -It cbr -Il 230 -If 0 -Ii 0 -Iv 30 -Pn cbr -Pi 0 -Pf 1 -Po 24
s -t 5.016800000 -Hs 1 -Hd -2 -Ni 1 -Nx 255.20 -Ny 255.20 -Nz 0.00 -Ne 0.498603 -Nl AGT -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 1.1 -Id 2.0 -It cbr -Il 210 -If 0 -Ii 1 -Iv 32 -Pn cbr -Pi 1 -Pf 0 -Po 24
r -t 5.020233951 -Hs 2 -Hd 2 -Ni 2 -Nx 119.01 -Ny 114.62 -Nz 0.00 -Ne 0.498040 -Nl AGT -Nw --- -Ma 13a -Md 2 -Ms 1 -Mt 800 -Is 1.1 -Id 2.0 -It cbr -Il 230 -If 0 -Ii 1 -Iv 30 -Pn cbr -Pi 1 -Pf 1 -Po 24
s -t 5.033600000 -Hs 1 -Hd -2 -Ni 1 -Nx 252.83 -Ny 252.83 -Nz 0.00 -Ne 0.498040 -Nl AGT -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 1.1 -Id 2.0 -It cbr -Il 210 -If 0 -Ii 2 -Iv 32 -Pn cbr -Pi 2 -Pf 0 -Po 24
r -t 5.037213950 -Hs 2 -Hd 2 -Ni 2 -Nx 116.31 -Ny 112.55 -Nz 0.00 -Ne 0.497477 -Nl AGT -Nw --- -Ma 13a -Md 2 -Ms 1 -Mt 800 -Is 1.1 -Id 2.0 -It cbr -Il 230 -If 0 -Ii 2 -Iv 30 -Pn cbr -Pi 2 -Pf 1 -Po 24
在应用层,CBR分组是一发一收。
2、仅仅打开-agentTrace ON
a.同上
b.实际Trace文件和分析
r -t 5.000000000 -Hs 1 -Hd -2 -Ni 1 -Nx 257.58 -Ny 257.58 -Nz 0.00 -Ne 0.500000 -Nl RTR -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 1.1 -Id 2.0 -It cbr -Il 210 -If 0 -Ii 0 -Iv 32 -Pn cbr -Pi 0 -Pf 0 -Po 0
s -t 5.000000000 -Hs 1 -Hd -2 -Ni 1 -Nx 257.58 -Ny 257.58 -Nz 0.00 -Ne 0.500000 -Nl RTR -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 1.255 -Id -1.255 -It AODV -Il 48 -If 0 -Ii 0 -Iv 30 -P aodv -Pt 0x2 -Ph 1 -Pb 1 -Pd 2 -Pds 0 -Ps 1 -Pss 4 -Pc REQUEST
r -t 5.000940650 -Hs 2 -Hd -2 -Ni 2 -Nx 122.06 -Ny 116.97 -Nz 0.00 -Ne 0.499860 -Nl RTR -Nw --- -Ma 0 -Md ffffffff -Ms 1 -Mt 800 -Is 1.255 -Id -1.255 -It AODV -Il 48 -If 0 -Ii 0 -Iv 30 -P aodv -Pt 0x2 -Ph 1 -Pb 1 -Pd 2 -Pds 0 -Ps 1 -Pss 4 -Pc REQUEST
s -t 5.000940650 -Hs 2 -Hd 1 -Ni 2 -Nx 122.06 -Ny 116.97 -Nz 0.00 -Ne 0.499860 -Nl RTR -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 2.255 -Id 1.255 -It AODV -Il 44 -If 0 -Ii 0 -Iv 30 -P aodv -Pt 0x4 -Ph 1 -Pd 2 -Pds 4 -Pl 10.000000 -Pc REPLY
r -t 5.005599202 -Hs 1 -Hd 1 -Ni 1 -Nx 256.79 -Ny 256.79 -Nz 0.00 -Ne 0.499166 -Nl RTR -Nw --- -Ma 13a -Md 1 -Ms 2 -Mt 800 -Is 2.255 -Id 1.255 -It AODV -Il 44 -If 0 -Ii 0 -Iv 30 -P aodv -Pt 0x4 -Ph 1 -Pd 2 -Pds 4 -Pl 10.000000 -Pc REPLY
s -t 5.005599202 -Hs 1 -Hd 2 -Ni 1 -Nx 256.79 -Ny 256.79 -Nz 0.00 -Ne 0.499166 -Nl RTR -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 1.1 -Id 2.0 -It cbr -Il 230 -If 0 -Ii 0 -Iv 30 -Pn cbr -Pi 0 -Pf 0 -Po 0
步骤1:1号节点根据应用层需求,首先收到(产生)本节点的CBR RTR;
步骤2: 1号紧接着发出一个寻找1--〉2号的路由请求;(下一跳未设定-Hd -2)
步骤3:2号节点收到该广播包后,给与应答;
步骤4:1号收到后,给2号发送CBR RTR。
r -t 5.016800000 -Hs 1 -Hd -2 -Ni 1 -Nx 255.20 -Ny 255.20 -Nz 0.00 -Ne 0.498603 -Nl RTR -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 1.1 -Id 2.0 -It cbr -Il 210 -If 0 -Ii 1 -Iv 32 -Pn cbr -Pi 1 -Pf 0 -Po 0
s -t 5.016800000 -Hs 1 -Hd 2 -Ni 1 -Nx 255.20 -Ny 255.20 -Nz 0.00 -Ne 0.498603 -Nl RTR -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 1.1 -Id 2.0 -It cbr -Il 230 -If 0 -Ii 1 -Iv 30 -Pn cbr -Pi 1 -Pf 0 -Po 0
至此,不再有路由寻找请求,直接进行步骤1和4。
r -t 5.033600000 -Hs 1 -Hd -2 -Ni 1 -Nx 252.83 -Ny 252.83 -Nz 0.00 -Ne 0.498040 -Nl RTR -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 1.1 -Id 2.0 -It cbr -Il 210 -If 0 -Ii 2 -Iv 32 -Pn cbr -Pi 2 -Pf 0 -Po 0
s -t 5.033600000 -Hs 1 -Hd 2 -Ni 1 -Nx 252.83 -Ny 252.83 -Nz 0.00 -Ne 0.498040 -Nl RTR -Nw --- -Ma 0 -Md 0 -Ms 0 -Mt 0 -Is 1.1 -Id 2.0 -It cbr -Il 230 -If 0 -Ii 2 -Iv 30 -Pn cbr -Pi 2 -Pf 0 -Po 0
3、仅仅打开-macTrace ON
a.同上
b.实际Trace文件和分析
s -t 5.000115000 -Hs 1 -Hd -2 -Ni 1 -Nx 257.56 -Ny 257.56 -Nz 0.00 -Ne 0.500000 -Nl MAC -Nw --- -Ma 0 -Md ffffffff -Ms 1 -Mt 800 -Is 1.255 -Id -1.255 -It AODV -Il 100 -If 0 -Ii 0 -Iv 30 -P aodv -Pt 0x2 -Ph 1 -Pb 1 -Pd 2 -Pds 0 -Ps 1 -Pss 4 -Pc REQUEST
r -t 5.000915650 -Hs 2 -Hd -2 -Ni 2 -Nx 122.07 -Ny 116.98 -Nz 0.00 -Ne 0.499860 -Nl MAC -Nw --- -Ma 0 -Md ffffffff -Ms 1 -Mt 800 -Is 1.255 -Id -1.255 -It AODV -Il 48 -If 0 -Ii 0 -Iv 30 -P aodv -Pt 0x2 -Ph 1 -Pb 1 -Pd 2 -Pds 0 -Ps 1 -Pss 4 -Pc REQUEST
以上在步骤2之间;发送路由请求
s -t 5.001035650 -Hs 2 -Hd -2 -Ni 2 -Nx 122.05 -Ny 116.96 -Nz 0.00 -Ne 0.499860 -Nl MAC -Nw --- -Ma 0 -Md ffffffff -Ms 2 -Mt 806 -P arp -Po REQUEST -Pms 2 -Ps 2 -Pmd 0 -Pd 1
r -t 5.001676301 -Hs 1 -Hd -2 -Ni 1 -Nx 257.34 -Ny 257.34 -Nz 0.00 -Ne 0.499748 -Nl MAC -Nw --- -Ma 0 -Md ffffffff -Ms 2 -Mt 806 -P arp -Po REQUEST -Pms 2 -Ps 2 -Pmd 0 -Pd 1
s -t 5.002066301 -Hs 1 -Hd -2 -Ni 1 -Nx 257.29 -Ny 257.29 -Nz 0.00 -Ne 0.499748 -Nl MAC -Nw --- -Ma 4fe -Md 2 -Ms 1 -Mt 0
r -t 5.002418951 -Hs 2 -Hd -2 -Ni 2 -Nx 121.83 -Ny 116.79 -Nz 0.00 -Ne 0.499686 -Nl MAC -Nw --- -Ma 4fe -Md 2 -Ms 1 -Mt 0
s -t 5.002428951 -Hs 2 -Hd -2 -Ni 2 -Nx 121.83 -Ny 116.79 -Nz 0.00 -Ne 0.499686 -Nl MAC -Nw --- -Ma 3c4 -Md 1 -Ms 0 -Mt 0
r -t 5.002733601 -Hs 1 -Hd -2 -Ni 1 -Nx 257.19 -Ny 257.19 -Nz 0.00 -Ne 0.499633 -Nl MAC -Nw --- -Ma 3c4 -Md 1 -Ms 0 -Mt 0
s -t 5.002743601 -Hs 1 -Hd -2 -Ni 1 -Nx 257.19 -Ny 257.19 -Nz 0.00 -Ne 0.499633 -Nl MAC -Nw --- -Ma 13a -Md 2 -Ms 1 -Mt 806 -P arp -Po REPLY -Pms 1 -Ps 1 -Pmd 2 -Pd 2
r -t 5.003384252 -Hs 2 -Hd -2 -Ni 2 -Nx 121.68 -Ny 116.67 -Nz 0.00 -Ne 0.499521 -Nl MAC -Nw --- -Ma 13a -Md 2 -Ms 1 -Mt 806 -P arp -Po REPLY -Pms 1 -Ps 1 -Pmd 2 -Pd 2
s -t 5.003394252 -Hs 2 -Hd -2 -Ni 2 -Nx 121.67 -Ny 116.67 -Nz 0.00 -Ne 0.499521 -Nl MAC -Nw --- -Ma 0 -Md 1 -Ms 0 -Mt 0
r -t 5.003698902 -Hs 1 -Hd -2 -Ni 1 -Nx 257.06 -Ny 257.06 -Nz 0.00 -Ne 0.499468 -Nl MAC -Nw --- -Ma 0 -Md 1 -Ms 0 -Mt 0
s -t 5.004128252 -Hs 2 -Hd -2 -Ni 2 -Nx 121.56 -Ny 116.58 -Nz 0.00 -Ne 0.499468 -Nl MAC -Nw --- -Ma 57e -Md 1 -Ms 2 -Mt 0
r -t 5.004480902 -Hs 1 -Hd -2 -Ni 1 -Nx 256.94 -Ny 256.94 -Nz 0.00 -Ne 0.499406 -Nl MAC -Nw --- -Ma 57e -Md 1 -Ms 2 -Mt 0
s -t 5.004490902 -Hs 1 -Hd -2 -Ni 1 -Nx 256.94 -Ny 256.94 -Nz 0.00 -Ne 0.499406 -Nl MAC -Nw --- -Ma 444 -Md 2 -Ms 0 -Mt 0
r -t 5.004795552 -Hs 2 -Hd -2 -Ni 2 -Nx 121.45 -Ny 116.50 -Nz 0.00 -Ne 0.499353 -Nl MAC -Nw --- -Ma 444 -Md 2 -Ms 0 -Mt 0
s -t 5.004805552 -Hs 2 -Hd 1 -Ni 2 -Nx 121.45 -Ny 116.50 -Nz 0.00 -Ne 0.499353 -Nl MAC -Nw --- -Ma 13a -Md 1 -Ms 2 -Mt 800 -Is 2.255 -Id 1.255 -It AODV -Il 96 -If 0 -Ii 0 -Iv 30 -P aodv -Pt 0x4 -Ph 1 -Pd 2 -Pds 4 -Pl 10.000000 -Pc REPLY
r -t 5.005574202 -Hs 1 -Hd 1 -Ni 1 -Nx 256.79 -Ny 256.79 -Nz 0.00 -Ne 0.499219 -Nl MAC -Nw --- -Ma 13a -Md 1 -Ms 2 -Mt 800 -Is 2.255 -Id 1.255 -It AODV -Il 44 -If 0 -Ii 0 -Iv 30 -P aodv -Pt 0x4 -Ph 1 -Pd 2 -Pds 4 -Pl 10.000000 -Pc REPLY
s -t 5.005584202 -Hs 1 -Hd -2 -Ni 1 -Nx 256.79 -Ny 256.79 -Nz 0.00 -Ne 0.499219 -Nl MAC -Nw --- -Ma 0 -Md 2 -Ms 0 -Mt 0
以上步骤3之间,包括路由请求,地址解析请求,和应答。
r -t 5.005888853 -Hs 2 -Hd -2 -Ni 2 -Nx 121.28 -Ny 116.37 -Nz 0.00 -Ne 0.499166 -Nl MAC -Nw --- -Ma 0 -Md 2 -Ms 0 -Mt 0
s -t 5.006278202 -Hs 1 -Hd -2 -Ni 1 -Nx 256.69 -Ny 256.69 -Nz 0.00 -Ne 0.499166 -Nl MAC -Nw --- -Ma b4e -Md 2 -Ms 1 -Mt 0
r -t 5.006630853 -Hs 2 -Hd -2 -Ni 2 -Nx 121.16 -Ny 116.28 -Nz 0.00 -Ne 0.499104 -Nl MAC -Nw --- -Ma b4e -Md 2 -Ms 1 -Mt 0
s -t 5.006640853 -Hs 2 -Hd -2 -Ni 2 -Nx 121.16 -Ny 116.28 -Nz 0.00 -Ne 0.499104 -Nl MAC -Nw --- -Ma a14 -Md 1 -Ms 0 -Mt 0
r -t 5.006945503 -Hs 1 -Hd -2 -Ni 1 -Nx 256.60 -Ny 256.60 -Nz 0.00 -Ne 0.499051 -Nl MAC -Nw --- -Ma a14 -Md 1 -Ms 0 -Mt 0
s -t 5.006955503 -Hs 1 -Hd 2 -Ni 1 -Nx 256.59 -Ny 256.59 -Nz 0.00 -Ne 0.499051 -Nl MAC -Nw --- -Ma 13a -Md 2 -Ms 1 -Mt 800 -Is 1.1 -Id 2.0 -It cbr -Il 282 -If 0 -Ii 0 -Iv 30 -Pn cbr -Pi 0 -Pf 0 -Po 0
r -t 5.009212153 -Hs 2 -Hd 2 -Ni 2 -Nx 120.75 -Ny 115.96 -Nz 0.00 -Ne 0.498656 -Nl MAC -Nw --- -Ma 13a -Md 2 -Ms 1 -Mt 800 -Is 1.1 -Id 2.0 -It cbr -Il 230 -If 0 -Ii 0 -Iv 30 -Pn cbr -Pi 0 -Pf 1 -Po 0
s -t 5.009222153 -Hs 2 -Hd -2 -Ni 2 -Nx 120.75 -Ny 115.96 -Nz 0.00 -Ne 0.498656 -Nl MAC -Nw --- -Ma 0 -Md 1 -Ms 0 -Mt 0
以上步骤4之间,给与应答。此处插入2号节点收到第一个AGT包
r -t 5.009526803 -Hs 1 -Hd -2 -Ni 1 -Nx 256.23 -Ny 256.23 -Nz 0.00 -Ne 0.498603 -Nl MAC -Nw --- -Ma 0 -Md 1 -Ms 0 -Mt 0
以上完成全部第一个过程。以下重复。
s -t 5.017275000 -Hs 1 -Hd -2 -Ni 1 -Nx 255.14 -Ny 255.14 -Nz 0.00 -Ne 0.498603 -Nl MAC -Nw --- -Ma b4e -Md 2 -Ms 1 -Mt 0
r -t 5.017627650 -Hs 2 -Hd -2 -Ni 2 -Nx 119.42 -Ny 114.94 -Nz 0.00 -Ne 0.498541 -Nl MAC -Nw --- -Ma b4e -Md 2 -Ms 1 -Mt 0
s -t 5.017637650 -Hs 2 -Hd -2 -Ni 2 -Nx 119.42 -Ny 114.94 -Nz 0.00 -Ne 0.498541 -Nl MAC -Nw --- -Ma a14 -Md 1 -Ms 0 -Mt 0
r -t 5.017942300 -Hs 1 -Hd -2 -Ni 1 -Nx 255.04 -Ny 255.04 -Nz 0.00 -Ne 0.498488 -Nl MAC -Nw --- -Ma a14 -Md 1 -Ms 0 -Mt 0
s -t 5.017952300 -Hs 1 -Hd 2 -Ni 1 -Nx 255.04 -Ny 255.04 -Nz 0.00 -Ne 0.498488 -Nl MAC -Nw --- -Ma 13a -Md 2 -Ms 1 -Mt 800 -Is 1.1 -Id 2.0 -It cbr -Il 282 -If 0 -Ii 1 -Iv 30 -Pn cbr -Pi 1 -Pf 0 -Po 0
r -t 5.020208951 -Hs 2 -Hd 2 -Ni 2 -Nx 119.01 -Ny 114.62 -Nz 0.00 -Ne 0.498093 -Nl MAC -Nw --- -Ma 13a -Md 2 -Ms 1 -Mt 800 -Is 1.1 -Id 2.0 -It cbr -Il 230 -If 0 -Ii 1 -Iv 30 -Pn cbr -Pi 1 -Pf 1 -Po 0
s -t 5.020218951 -Hs 2 -Hd -2 -Ni 2 -Nx 119.01 -Ny 114.62 -Nz 0.00 -Ne 0.498093 -Nl MAC -Nw --- -Ma 0 -Md 1 -Ms 0 -Mt 0
此处插入2号节点收到第2个AGT包
r -t 5.020523601 -Hs 1 -Hd -2 -Ni 1 -Nx 254.68 -Ny 254.68 -Nz 0.00 -Ne 0.498040 -Nl MAC -Nw --- -Ma 0 -Md 1 -Ms 0 -Mt 0