B. Packet Queuing Simulator for Wi-Fi

What this workbook is

This workbook contains an implementation of a packet queuing simulator for Wi-Fi. It also contains static input data needed to simulate the effect of the various overhead bits and time intervals which are added to the standard Ethernet (IEEE-802.3) frames when transmitted on a Wi-Fi (IEEE-802.11n) link. The following overhead can be taken into account:

-- overhead from radio preamble and header as well as MAC frame header;

-- overhead due to average interframe space;

-- overhead due to signalling, such as 'hand-shaking' using RTS/CTS/ACK messages;

-- overhead due to beacon and pilot frames;

-- reduction in the average throughput of the link and its service distance (coverage) due to background interference.

The above factors are modelled though separate functions, which are based on static data tables which show the average effect of these factors. This is done for practicality as well as in order to increase the speed of the calculations and reduce the cost of the development.

This simulator is intended to be used for producing first-approximation results, which provide an idea, not an accurate estimation of the link performance. This is because the simulator models the effects of the events, not the events themselves that take place in a Wi-Fi network.

To model the actual events (as opposed to modelling their effect), and to obtain from them stats for the performance of the network, would require a true link-level simulator akin to those realised with ns-2/3 (www.nsnam.org), OMNeT++ (omnetpp.org) and NetSim (tetcos.com/netsim_gen.html). Creating such a simulator requires certain effort and may take significant time (measured in man-years). Just installing one of these simulating tools on a machine and getting it to run some simple examples may take the better part of a day (it certainly took the other that time to install and get ns-2 to run some basic examples). Compared to such real-life systems, the presented here solution is rather simple. Therefore, the reader is advised not to expect too much in terms of accuracy or faithfulness of the output from this here simulator -- miracles are not possible and cheap-and-cheerful solutions are just cheap. Nevertheless, with some understanding of the limitations, this simulator could be used as a tool for getting an idea of the bigger picture (not good for producing link-layer protocol validation worth publishing and boasting about, but certainly good for obtaining some useful insight into the limits of performance of Wi-Fi).

On a positive side, this simulator aims at producing results which are more meaningful to network planning engineers. For example, it allows service types to be defined in terms which are familiar to network engineers, and it produces statistics which show the throughput of a Wi-Fi link in categories useful to engineers, such as the number of served users and the average user experience in terms of delays and waiting. The simulator allows an arbitrary mixture of different service types and their users in any proportion.

How to use this workbook

1) Set the services and user numbers

Copy worksheet named "xService 1" and rename the copy to start with "Service", e.g. "Service 1". (The simulator automatically uses all worksheets with names that start with "Service" as service type definitions and creates the specified number of users for each such service type when running).

Repeat the above to create any desired mixture of different service types and user numbers (the number of users for each service type is specified on these worksheets).

2) Set the link conditions

The six worksheets with names "f0", "f1" ... "f5", are lookup tables used by the simulator. They contain static data, which represent the effect of different radio link conditions and protocol parameters on the performance of the radio link. For exmaple "f0" (named thus for "function zero") represents the effect of the distance between the access point (AP) and the user terminal on the possible connection bit rate. When running, the simulator does not simulate how the signal attenuation happens as the signal travels from the AP to the terminal, nor does it simulate how interference is added to the signal. The simulator merely finds the effect of the distance between the AP and the terminal and the effect of the interference on the performance of the radio link by obtaining the ready result from "f0" lookup table. Since different places may have different background interference levels, it is possible to choose a different "f0" table to reflect the effect of a different interference level. In this workbook there are several alternative "f0" worksheets with names "f0 Table A (no interference)", "f0 Table B (3dB interference)" and "f0 Table C (9dB interference)". To make the simulator use one of them instead of the current "f0" worksheet you need to delete the existing "f0" worksheet, then copy the selected worksheet, e.g. copy "f0 Table C (9dB interference)" to a new worksheet, and rename it to "f0".

3) Run the simulator

Switch to workshet named "Simulation", enter the required input parameters and click "RUN" button. You can pause the simulation and later resume from where you have left, but if you close the workbook, even if you save the workbook before closing it, you will not be able to resume the simulation when you open the workbook next time (you will have to restart the simulation from the beginning).

How to use the data in this workbook in your own simulator and other models

The data contained in the worksheets with names "f0", "f1" ... "f5", can be used outside the simulator for creating your own models of the radio link performance (my simulator is just one possible implementation of such a model). Here is a brief explanation how each of these worksheets can be used as a look-up function in modelling the respective aspect of the Wi-Fi link performance.

f0 -- models the dependence of the link bit rate on the distance between the access point (AP) and the user station (STA). The reader can choose between three different tables, each for a different level of background interference and its effect on the achivable bitrates: no interference, C/I=3dB and C/I=9dB.

f1 -- models the effect of RF and MAC headers on the total volume of transmitted bits over the Wi-Fi link. Currently only one table is supplied with data for 'greenfield' 802.11n networks with 20MHz channels and 800ns guard interval (GI).

f2 -- models the effect of interframe space and backoff time. Currently the reader can choose between three different tables, each for 5, 10 and 20 slots of average interframe space. (Important: please note that this time is not the backoff time, which a given STA waits for the other STA(s) to stop communicating with the AP. This is the average time of silence on the radio link between two consecutive frames).

f3 -- models the combined effect of the hand-shaking procedure for sending a single frame, which includes RTS, CTS and ACK frames.

f4 and f5 -- model the effect of beacons and measurement pilots transmitted on the Wi-Fi link.

Here are step-by-step instructions on how to use the above data for building a packet queuing simulator akin to the one implemented in this workbook:

1) Inside the simulator create users with traffic profiles and distances to the AP, etc.

2) Assuming that the users have authenticted and associated with a given AP, inside the simulator generate a stream of packets to be received by the AP from the distribution system (DS) -- the DS is the proper term used in Wi-Fi to denote the 'wired network'.

3) Start feeding the packets from the DS to the AP. As the first packet arrives to the AP:

3.1) Find the user's bit rate from f0 (choose between the case of no interference or with interference C/I=3dB or C/I=9dB) and convert the number of bytes in the user's packet into time t0 needed to transmit them over the radio link using the formula:

t0 = Bytes * 8 / f0, where t0 is in microseconds (us) and f0 is in Mbit/s.

3.2) Find time t1 needed to transmit the frame on the radio link (due to radio and MAC overheads this time will be longer than t0) using the formula:

t1 = t0 * f1, where t0 and t1 are in microseconds and f1 is in percent.

3.3) Find duration t2 of the average 'silence' after transmitting a frame, using the formula:

t2 = t0 * f2, where t0 and t2 are in microseconds and f2 is in percent.

3.4) Find the additional time t3 needed to do handshaking, using the formula:

t3 = t0 * f3, where t0 and t3 are in microseconds and f3 is in percent.

Note that in the above the handshaking process includes sending one of each: RTS, CTS and ACK. If inside the simulator it is needed to model only the RTS/CTS without an ACK then use t3 = t0 * (2/3) * f3. Respectively, to model only a single ACK without any RTS/CTS use: t3 = t0 * (1/3) * f3.

3.5) Find the total time T needed for the transmission of the current packet:

T = t0 + t1 + t2 + t3, where T, t0, t1, t2 and t3 are in microseconds.

3.6) Find the sum S of times needed to transmit all packets received so-far from the DS, using the formula:

S = S + T, where S and T are in microseconds.

3.7) Update the stats for the recepient of the packet (such as volume of data received, bit rate stats, user data rate stats, etc.).

This is an internal function of the simulator, so no formulae or stats are suggested here -- these are left to the developers of the simulator to choose and implement.

3.8) Check whether it is time to send a measurement pilot or a beacon and then add their duration to the sum of times needed for the transmission of all packets received so-far from the DS:

IF t - t_last_beacon >= TBTT THEN

S = S + f4

t_last_beacon = t

ELSE IF t - t_last_pilot >= TMPTT THEN

S = S + f5

t_last_pilot = t

END IF

In the above all times, time periods and their sums are in microseconds. t is the current time inside the simulator, TBTT is targeted beacon transmission time and TMPTT is targeted measurement pilot transmission time. Usually TBTT=100ms (i.e. 1e5 microseconds) and TMPTT=25ms or 50ms (i.e. 2.5e4 or 5e4 microseconds).

3.9) Feed the next packet from the DS to the AP. Check its arrival time Ta at the AP, if Ta >= S then the newly-arrived packet will be transmitted immediately if the transmission medium is available and ready, but if Ta < S the the newly-arived packet will be queued at the AP for the duration of S - Ta while it is waiting for the transmission of the previous packets to finish. For this reason update any queuing-time and queue-size stats in the simulator.

3.10) Check whether it is time to finish the simulation, if not then got to point (3.1) above.

4) Calculate any performance stats and display them to the user.

This concludes the simulation. In the above we have not described how the simulator should operate and how it should model or simulate the use of the transmission medium -- this is left to the developers of the simulator. It is noted here that the above-described procedure can be used for finding the time needed to transmit a given number of data bytes both on the downlink and on the uplink. In the latter case there will be no need for beacons and pilots and the point which deals with them in the above procedure should be skipped.

The Workbook

Here is one screenshot of the main simulator display (click on the image to see in true scale).

The workbook is attached below and available for download. It contain VBA code, which is required for it to perform the simulation. The Excel spreadsheet contains barely any calculations, so if VBA code (also known as 'macros') is disabled, then the workbook will be static and of little use. Please make sure that you do not disable macros when you open the workbook.

The latest edition of the workbook (attached below) has a feature which will not show the simulation worksheets if macros are disabled. So, if after opening the simulation workbook you only see a single sheet with a warning that macros are disabled, then please follow the instructions on that worksheet and enable running macros in order to see the simulation and play with it.

E. How to Download a Workbook or Leave a Comment

You can download the workbook by clicking on the small arrow icon on the far right end in each line [].

You are also very welcome to leave a comment. To do so you need to sign in to your Google Account (or create one): Sign in

Thanks for looking here and eventually downloading a simulation workbook. I hope you find something useful in it. Enjoy!