0 оценок0% нашли этот документ полезным (0 голосов)
27 просмотров3 страницы
This document discusses installing and running the OMNET++ discrete event simulator and a wireless sensor network MAC simulator. It describes downloading and installing OMNET++, replacing the Lib directory, downloading the MAC simulator zip file and running simulations. Example commands are provided to run a simulation of a CSMA/CA MAC protocol and process the output to obtain statistics on packet transmissions, radio states, and energy consumption. The document also describes the traffic pattern and parameters defined in the test.scen file and configuring simulation parameters in the omnetpp.ini file. It provides an exercise to simulate a 16x16 grid topology with a specific bit error rate and traffic pattern, and decrease the radio range.
This document discusses installing and running the OMNET++ discrete event simulator and a wireless sensor network MAC simulator. It describes downloading and installing OMNET++, replacing the Lib directory, downloading the MAC simulator zip file and running simulations. Example commands are provided to run a simulation of a CSMA/CA MAC protocol and process the output to obtain statistics on packet transmissions, radio states, and energy consumption. The document also describes the traffic pattern and parameters defined in the test.scen file and configuring simulation parameters in the omnetpp.ini file. It provides an exercise to simulate a 16x16 grid topology with a specific bit error rate and traffic pattern, and decrease the radio range.
This document discusses installing and running the OMNET++ discrete event simulator and a wireless sensor network MAC simulator. It describes downloading and installing OMNET++, replacing the Lib directory, downloading the MAC simulator zip file and running simulations. Example commands are provided to run a simulation of a CSMA/CA MAC protocol and process the output to obtain statistics on packet transmissions, radio states, and energy consumption. The document also describes the traffic pattern and parameters defined in the test.scen file and configuring simulation parameters in the omnetpp.ini file. It provides an exercise to simulate a 16x16 grid topology with a specific bit error rate and traffic pattern, and decrease the radio range.
IST Wireless Sensor Networks Homework 1 07/08 Exercise 1: Installing and Running OMNET++ OMNET++ is a public-source, component-based, modular and open-architecture discrete event simu- lation environment implemented in C++ language, which counts with the support of a huge community of users. It can be downloaded from the OMNET++ community site at http://www.omnetpp.org. The OMNET++ package only offers general tools to setup a simulator. In order to simulate a specic system or environment, the user must implement all the required logic and interactions employing those tools. A specic MAC Simulator was developed by people from the TU Delft and Univ.of Twente (Netherlands) within the framework of the Consensus project 1 . This simulator will be used in future homeworks to evaluate the performance of different WSN MAC protocols. In Homework 1 we will only install and do some preliminary testing of an adapted version of the MAC Simulator model. Software Requirements MS Windows 2000 or XP Microsoft Visual Studio 2005 or later Installation Procedure 1. Download and install the OMNET++ v. 3.2p1 binary release, which is available at: http://www.omnetpp.org/lemgmt/viewcat.php?cid=5. The remaining steps will assume OM- NET++ installation in directory C:\OMNET++\. 2. Replace the C:\OMNET++\Lib directory with the Lib directory provided at the course website. 3. Download and install a Perl interpreter in case you still dont have one. You will need the Perl scripts to interpret the statistics provided by the simulation output. We recommend the Active Perl package freely available at http://www.activestate.com/Products/ActivePerl/. 4. Download the zipped MAC Simulator package from the course website and unzip it (please allow no more than two directory levels, otherwise compilation problems may be experienced). 5. In order to open the MS Visual Studio project, please double-click on top of le omneteyes.sln. 6. Try to rebuild the project selecting the Rebuild Solution option from the Build menu located above the toolbar. Alternatively you can use the shortcut keys Ctrl+Alt+F7. The simplest way to test the MAC Simulator is to open the command prompt window and change to the directory where you installed the MAC Simulator. In order to simulate the CSMA/CA MAC protocol using the default scenario (specied in the test.scen le) and parameters, run the following command: omneteyes -f omnetpp.ini -f csmaca.ini -f nolpl.ini 1 http://www.consensus.tudelft.nl/index.html. Wireless Sensor Networks, 07/08 Homework 1 1 You will see the debug messages passing rapidly on the screen until the simulation is over and the statistics are presented. In order to store the output for future access, just redirect the output of the execution to a le, e.g. for output le out.txt: omneteyes -f omnetpp.ini -f csmaca.ini -f nolpl.ini > out.txt In order to process the output le and obtain some meaningful statistics, you can use the Perl scripts provided in the scripts directory within your MAC Simulator installation directory. Packet transmission and reception statistics, as well as radio state statistics can be obtained with the collectstats.pl script. Assuming that you have a Perl interpreter installed and an output le called out.txt, just run the following command: perl scripts\collectstats.pl out.txt The default scenario should lead to the following results: time=30.034497 nodes=16 app_tx=0 app_rx=460 app_delay=0.014694 max_delay=0.077072 rt_tx=460 rt_rx=460 rt_tx_drop=0 mac_tx=460 mac_rx=478 radio_sleep=62.5317 radio_tx=4.9035 radio_rx=413.1167 radio_collision=0 in_queue=0 mac_rx_data=1.9087 mac_rx_overhead=2.3319 mac_rx_overhear=12.9065 mac_tx_data=2.3597 mac_tx_overhead=2.4417 own_sched=0 mac= msglen=-1 msginterval=-1 mac1= mac2= mac3= mac4= Several useful statistics spanning several protocol layers can be easily identied, such as number of trans- mitted and received packets, length and inter-arrival time of messages, the MAC protocol and respective parameters dened in the csmaca.ini le, the time spent in each radio state, etc. Radio state statistics are very useful to compute the energy consumed by the communications compo- nent. The esouce.pl script makes some computations that are useful to calculate the energy spent in each state, as well as the total energy. Assuming that the output of collectstats.pl was redirected to the stats.txt le, esource.pl can be used as follows: perl scripts\esource.pl stats.txt For CSMA/CA under the default scenario and parameters the output of esource.pl should show the following total consumption statistics in the end: ek=total e=3.54120179289169 time=30.034497 nodes=16 app_tx=0 app_rx=460 app_delay=0.014694 max_delay=0.077072 rt_tx=460 rt_rx=460 rt_tx_drop=0 mac_tx=460 mac_rx=478 radio_sleep=62.5317 radio_tx=4.9035 radio_rx=413.1167 radio_collision=0 in_queue=0 mac_rx_data=1.9087 mac_rx_overhead=2.3319 mac_rx_overhear=12.9065 mac_tx_data=2.3597 mac_tx_overhead=2.4417 own_sched=0 mac= msglen=-1 msginterval=-1 mac1= mac2= mac3= mac4= The ek entries indicate the state(s) where energy is spent, while the e entry indicates the mean current consumption in mA/node 2 . The other entries were already present in the output of collectstats.pl. So far, we have overlooked the trafc pattern dened for the scenario in the test.scen le. Open this le with a text editor. You will notice several lines staring with #, which are comments. These show how different trafc patterns can be selected. The only line that is not commented is: idle ToSink 20 1 sinknode=0 ttl=15 aggmode=0 aggdelay=0 aggmax=0 2 Question: How can you calculate the energy consumption based on this gure? Wireless Sensor Networks, 07/08 Homework 1 2 ToSink is a convergecast trafc pattern where nodes generate trafc directed to the sink, following an exponential distribution for packet inter-arrival times. Each node forwards multihop trafc randomly selecting the next hop as one of its neighbors that stays closer to the sink. The general format for the parameterization of trafc patterns is provided in one of the comments: #active/idle class msglength msg/s p=x p2=x2 ... In the beginning you must employ one of the keywords idle or active. These indicate whether the trafc pattern is static (idle), or if it only applies to periods of area activation due to some event occurrence (active). Then comes the name of the pattern, followed by the message length and average message gen- eration frequency. Then come the pattern-dependent parameters. For ToSink, these are related with the identication of the sink node, message time-to-live (maximum number of hops the message is allowed to be forwarded before reaching the sink) and data aggregation parameters. Other simulation parameters are dened in le omnetpp.ini 3 . Among other things you can cong- ure the simulation length and number of runs, as well as the network topology. The MAC Simulator only allows grid topologies. Two parameters allow you to dene the number of nodes in the horizontal (net.grid_cx) and vertical (net.grid_cy) axes. You can also dene a constant bit-error-rate (BER) that applies to all links using parameter net.ber. Exercise 2: OMNET++ Parameterization Try to simulate a grid topology of 1616 nodes during 200 seconds, with BER=0.0005. Use the ToSink trafc pattern with 60-byte messages and average inter-packet interval of 2 seconds. Try decreasing the radio range square in le propagation.h to allow direct communication with the closest geographical neighbors only (you will have to rebuild the project). 3 Please refer to the OMNET++ manual to nd the meaning of some parameters, as well as the way simulation parameters can be dened in general. Wireless Sensor Networks, 07/08 Homework 1 3