# Building Realistic Mobility Models for Mobile Ad Hoc Networks
## 5 Battlefield Simulation Model
### Producing the Battlefield Model Using Timemaps
#### 5.6.3 Conversion of Timemaps to ns-2 Movement File  
Timemaps outputs its information in an XML format. It contains some information that is not relevant to the ns-2 movement file, but it holds all the necessary data to produce the movement file. In this case (see Table 3), the class 'corps' is used to identify a single soldier. For each soldier, his/her name is set at a given time point to the node identification used by ns-2. This is the point at which the node first appears. The timestamp is taken from standard systems time, with the value before the 'G' being the number of seconds into the simulation. In this example, node 10 first appears and is named at 15 s into the simulation. The position on the node is recorded at every timestamp at which it is specifically placed when building the model. In this example, at 15 s into the simulation, the node is positioned at (220.967796, 109.528819). The clear and simple structure of the XML file makes it straightforward to extract the relevant information required by ns-2. ns-2 needs to know where each node is at the start of the simulation, so the initial position of each node is written to a file called'start_point.tcl', which is included in the TCL code for the model. The movement file only needs the timestamp, the node name, the coordinates, and the speed at each timestamp. Timemaps and ns-2 use different origins for their position grids, requiring some simple arithmetic conversion. For each position timestamp, the previous position is saved to the ns-2 movement file. The current and immediate previous positions are then used to calculate the most recent distance moved. The time taken for this move is then calculated using the current and immediate previous timestamps and the speed of the move is subsequently calculated. This speed is also written to the ns-2 file. The overall process of producing the model for ns-2 is depicted in Figure 7. The node movements are based on current military tactics for such an operation (as discussed in Section 5). These are fed into Timemaps to build the animation of the military operation. The Timemaps model is saved and exported as an XML file. Subsequently, a conversion program is run to translate the Timemaps XML file into the ns-2 start position and movement files. Finally, the movement files and communication models (in Section 5) are included into the ns-2 TCL code.  
The code for this conversion process is included in the appendix 1 in [PERSON] (2014) [2], a larger sample of the Timemaps XML file for this model is included in appendix 2 (ibid), and a sample of the ns-2 start point and movement files are shown in appendices 3 and 4 (ibid). The movement files are then included in a standard ns-2 TCL script, which allows the simulation of the MANET to use these particular models. A sample TCL script is included in appendix 5 (ibid). The simulation in ns-2 has the following parameters (which have been discussed in Section 5): operation area--48 m by 13 m; 64 nodes with teams of four men; simulation time of two minutes and 45 s (to clear the floor) plus an additional 45 s for communications to complete; and 802.11b wireless Ethernet range to about 10 m.