在無線模擬的Trace文件中的該字段:
-Nl string Network trace Level (AGT, RTR, MAC, etc.)
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