|
SECAN-Lab Home News Projects SECAN-LAB Mesh Sequencer U-2010 NARTUS EFIPSANS IRMA SECRICOM The Group Members Publications Theses Teaching Presentations Topics Mobile Computing Ad-Hoc Networks Ad-Hoc Protocols Mesh Computing Trust Related Stuff L-101 Laboratory Systems AS28 Systems 802.11 Network Simulator Internships Conferences Publications Standards Projects Links Partners OSTN Miscellaneous Contact About Job Opportunities Search |
802.11 (WiFi) Simulator for Ad-Hoc networks
This is a java event based simulator for 802.11 networks. It implements the DCF function, which is used in WiFi networks.
Hence, it is useful to do some performance simulations for WLAN Ad-Hoc networks. The simulator may be regarded as a timeline. Within this timeline one can add some events. If a point of time for an event is reached it will be executed. The simulation will proceed as long as events are stored within the timeline. Of course, events may be inserted prior the simulation as well as during the simulation process. Maybe some events may imply the insertion of new events. Some further features are:
The Sources are available here:
To get a first impression how this simulator works please read the following Tutorial Tutorial 1In this example 2 devices are installed. One of them sends a packet to the other device First of all we need a Packet implementation, which means we have to implement the abstract class simulator.linklayer.interfaces.APacket. This abstract class forces a method getSize, which returns the size of one packet in bytes. This is needed to calculate transmission times of packets.Now that we have packets we may proceed to implement the behaviour of Devices within the network. Don't fear. Most of the code below are comments. The Device implements an interface called ILinkLayerCaller. This interface is used to tell the link layer implementation that received packets should be forwarded to this Device object. If this Device receives a new packet, the function handlePacketReceive(ILinkLayerDevice device, APacket packet) will be called by the link layer. So there, we can define what to do with the packet. Maybe we want to forward it, or it might be processed on upper layers or anything else. In this example we simply print out, that we received a packet.Further on, this class stores an object, which is interfaced by ILinkLayerDevice. This object represents the link layer implementation, and provides all the methods which might become useful. Here we only use the functionality to send a unicast (see method public void sendPacket(Packet packet,long target)).Last but not least there is some work done in the constructor. The first command creates an instance of the link layer implementation. The second command tells the link layer implementation, that this object is the instance, which needs to be informed, if packets are received. The last class of this example implements the main function and sets up the network. All the work is done in the constructor. First a link layer network instance is created and stored in network. To devices (of our implementation above are created and a bidirectional link is established between them. Then, we insert a send event into the beginning of our event queue by calling the sendPacket(...) method implemented above. Finally we start the simulation.If you execute this sample it will generate the output: The first value in each line is the time in microseconds. Afterwards the MAC address of the device, which prints the output is shown. As you can see, by sending a packet the (RTS/CTS/MPDU/ACK) sequence of 802.11 is executed. This output is diplayed, because we told the simulator to be verbose (in the code above). Tutorial 2The second tutorial will introduce the event mechanism in more detail. Here, we will repeat the tutorial above, but we will add another device which disturbs the communication above. As you can see in the output, above, the packet is transmitted between time 190 and 1020. We will just tell the third device that it should start to send a packet to device 2 at time 300. So the transmission is interrupted and the backoff procedures of 802.11 are enrolled. This will only work, if the third device is not locked by the RTS or CTS frames exchanged before. To avoid this, we will also add the link between device 2 and 3 at time 300, not before. So, we have to tell the simulator, that something happens at time 300 (in microseconds). Therefore we will insert an event into the Queue at time 300. But first we have to define the event. This is done by extending the abstract class simulator.event.Event. It provides a method invoke(), which will be called, if the event occures. As you can see there, we tell the simulator to add a link between device 2 and 3. Afterwards a packet is send by 2 to device 3.Finally we have to modify our main class. Here we add a third device to our network and insert our event into the queue. First we generate a SendEvent Object. Afterwards we put it into the event queue by calling insertEvent. The boolean true tells the simulator, that 300 is an absolute time value.Imagine you would like to insert another event during the simulation. Maybe one event, which is invoked at the moment, wants to add a new event 200 microseconds later. Then the flag in insertEvent would be false to indicate, that 200 is a period.The generated output will be: Hope, this was a helpful introduction. Anyway, if you have questions don't hesitate to ask me .
"802.11 Network Simulator" is mentioned on: News |