Trace files
Trace formats are also a pluggable module! Everyone can add some new formats to the program by implementing two classes; however, it is out of this document scope. We have already implemented two trace types.
The plane text contains a parameter line, a column header line, and values sorted based on time and node number. Only have we written Time, Node number, Position, Speed, and Direction, but there are many other mobility characteristics calculated in the program. A tab character separates the columns.
tracewriter=text models=RPGM selected=RandomWalk walkingtime=20 . . .
Time Node PositionX PositionY Speed Direction Angle
1 0 276 27 9.45 1.75
1 1 263 37 10.99 1.46
1 2 262 42 7.96 1.53
1 3 270 33 11.27 1.5
1 4 305 39 9.94 2.03
1 5 289 167 6.43 1.76
1 6 292 175 5.35 1.76
1 7 305 152 7.71 2
|
a plain text mobility trace sample
As NS2 only reads next time, position, and speed, all other information have been indicated as a comment text in each line. This format is not mature now and needs feedbacks to be revised.
# models=ThreeDizer selected=Random Walk walkingtime=20
# Time Node PositionX PositionY Speed Direction Angle PositionZ
$ns_ at 1 "$node0 setdest 134 192 9.14" ;# 1.23 0
$ns_ at 1 "$node1 setdest 317 210 8.17" ;# 5.52 0
$ns_ at 1 "$node2 setdest 77 189 6.44" ;# 0.97 0
$ns_ at 1 "$node3 setdest 349 216 5.11" ;# 5.42 0
The XML format also includes the information presented in the plain text, but in another format. “Header” tag contains the parameters in “Parameters” child tag and column headers in “Attributes” one. See Figure 52

XML mobility trace sample
Power traces can be in plain text or XML format. Nevertheless, it should have two additional values: Range and Active. Active column values show if the node in that moment was active or not. Note that node’s activity impacts on some evaluators output. Figure 53 shows a plain text trace sample.

Plain text power trace
|