# On the Feasibility of Wireless Multimedia Sensor Networks over IEEE 802.15.5 Mesh Topologies
## 4 Simulation  
### Simulation Environment  
In order to carry out the simulation of multimedia transmission in an IEEE 802.15.5 mesh network, ns-2 simulator and EvalVid software are used. ns-2 [31] is a popular discrete-event network simulator, which provides support for assessing many different protocols and network technologies, including IEEE 802.15.4.  
The other component used for the simulations, EvalVid, is a tool-set for evaluating the quality of video transmitted over a real or simulated network [32]. It can be used to measure several QoS metrics of the underlying communication network such as packet loss, delay, jitter and standard video quality metrics like PSNR. Unlike other available tools, EvalVid works properly even if there are packet drops, making it suitable for unreliable networks such as WSN.  
In order to provide researchers with an integrated multimedia tool for simulating WSNs with mesh topology, a new module was added to ns-2. This new module, accessible via [33], includes the IEEE 802.15.5 SES mode and its integration with EvalVid. In order to perform the simulation experiments, the video is encoded and some information on how to fragment each video frame for its transmission in an IEEE 802.15.5 network is generated. This information is passed to ns-2, which simulates the transmission of packets. It is also used by EvalVid, in conjunction with data about the arrival of packets, to calculate the aforementioned QoS metrics of interest. Figure 6 shows the steps involved in the simulation and detailed in the next paragraph.  
Figure 5: Data transmission in SES. (**a**) Topological view; (**b**) Time structure view.  
The original file stores information using the YUV (Y luminance component, U and V chrominance components) color space as it allows for greater compression than [PERSON], Green, Blue (RGB). Since the human eye has little spatial sensitivity to color, the bandwidth of the UV chrominance channels can be considerably reduced with little impact on visual perception. The information in this file is sequentially processed by the _FFmpeg_ tool to encode the video and the _MP4 Box_ tool to create an H.264 flow with video frames and a _hint track_. This track describes how to fragment each video frame that is going to be transmitted. From the resulting file, EvalVid's _MP4 trace_ tool creates a text file, the _sender trace_, which contains the information about every frame shown in Table 3.  
The information of the _sender trace_ file is used for generating the _video1.frag_ file (Table 4) in order to adjust the file to the requirements of the ns-2 framework and to perform the simulation. This file has all the necessary information to allow a modified User Datagram Protocol (UDP) agent to transmit video fragments at the appropriate time. This agent will be in charge of passing the fragments to the IEEE 802.15.5 mesh layer for their transmission in the simulated network, where packet delays or losses are detected and computed. The agent, in addition, stores the generation time of each packet in a file known as the _sender dump_. Upon reception, another modified UDP agent generates another file, the _receiver dump_, with the arrival times of each packet.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Frame** & **Type** & **Size (bytes)** & **Packets** & **Sender Time** \\ \hline
1 & I & 2281 & 23 & 0.081 \\
2 & P & 288 & 3 & 0.158 \\
3 & P & 76 & 1 & 0.159 \\
4 & P & 238 & 3 & 0.199 \\ \(\cdots\) & \(\cdots\) & \(\cdots\) & \(\cdots\) & \(\cdots\) \\ \hline \hline \end{tabular}
\end{table}
Table 3: Sender trace file structure.  
Figure 6: Simulation workflow.  
Finally, EvalVid, by means of the ET (Evaluate Trace, _etmp4_) tool, makes use of the encoded video and the _sender trace_, _sender dump_ and _receiver dump_ files to generate reports with the most relevant metrics: latency, jitter and number of packets and video frames lost. In addition, after decoding the video with the _ffmpeg_ tool, the PSNR quality metric can also be obtained.