UNIVERSITY LIBANAISE UNIVERSITY SAINT-JOSEPH (Faculté d’Ingénierie) (Faculté de Génie) Sous l’égide de l’agence Universitaire de la Francophonie AUF Diplôme d’Etudes Approfondies Réseaux de télécommunication Etude de la gestion de la QOS (Qualité de services) Dans les réseaux locaux sans fil (WLAN) Par Pierre Abi Char Encadre’ par: M. Chafic Mokbel M. Loutfi Nuaymi Soutenance le Mardi, Décembre 23, 2003 devant le jury composé de MM. Samir Tohmé Mohamad Zoaeter Wajdi Najem Imad Moubharbel Nicolas Rouhana Mahmoud Doughan Maroun Chamoun Président Member Member Member Member Member Member i Table of contents: Table of contents: ................................................................................................................ ii List of figures: .................................................................................................................... iv Abstract: ...............................................................................................................................v Preface: .............................................................................................................................. vi Acknowledgements ........................................................................................................... vii Chapter 1 ..............................................................................................................................8 Introduction ..........................................................................................................................8 1.1 Introduction: .............................................................................................................. 8 1.2 Project Contributions ................................................................................................ 9 Chapter 2 ............................................................................................................................10 802.11 Wireless LAN (PHY and MAC layers) .................................................................10 2.1 Introduction ............................................................................................................. 10 2.2 The IEEE 802.11 wireless LAN Architecture ........................................................ 11 2.3 802.11 Topologies................................................................................................... 12 2.4 The IEEE 802.11 layers Description ...................................................................... 15 2.5 Physical Layer ......................................................................................................... 16 2.6 MAC Layer ............................................................................................................. 17 2.6.1 The Basic Access Method: CSMA/CA.............................................................18 2.6.1.1 Virtual Carrier Sense................................................................................19 2.6.1.2 MAC Level Acknowledgments ...............................................................20 2.6.1.3 Fragmentation and Reassembly ...............................................................20 2.6.2 Frame Type .......................................................................................................22 2.6.3 Distributed Coordination Function (DCF) ........................................................24 2.6.4 Point Coordination Function (PCF) ..................................................................24 2.6.5 The 802.11 Mechanism:....................................................................................24 Chapter3. ............................................................................................................................28 The IEEE 802.11e standards: .............................................................................................28 3.1 Introduction: ............................................................................................................ 28 3.2 The 802.11e HCF scheduling algorithm: ................................................................ 29 3.3 The 802.11e FHCF scheduling algorithm:.............................................................. 32 3.3.1 A queue length based scheduling scheme at the QAP: .....................................32 3.3.2 The node scheduler ...........................................................................................32 Chapter 4 ............................................................................................................................34 Integrated Scheduling Algorithm .......................................................................................34 4.1. Criterion ................................................................................................................. 34 4.1. The algorithm ......................................................................................................... 36 Chapter 5 ............................................................................................................................38 Wireless Simulation using ns .............................................................................................38 5.1 The network simulator (NS) ................................................................................... 38 5.2 Simulator Configuration ......................................................................................... 38 5.3 Topology: ................................................................................................................ 38 5.4 Simulation output format: ....................................................................................... 42 Chapter 6 ............................................................................................................................44 Experiments and Results ....................................................................................................44 ii 6.1 The simulation system and implementation ........................................................... 44 6.2 Description of the Simulations................................................................................ 44 6.3 Simulation results.................................................................................................... 45 Chapter 7 ............................................................................................................................49 Conclusions and Future Work: ..........................................................................................49 Appendix A: .......................................................................................................................50 Glossary ........................................................................................................................ 50 References: .........................................................................................................................53 iii List of figures: Figure 2.1: Independent Basic Service (IBSS)…………………………………………..13 Figure 2.2: Infrastructure Mode………………………………………………………….13 Figure 2.3: Extended Service Set (ESS)…………………………………………………15 Figure 2.4: Layers Descriptions………………………………………………………….15 Figure 2.5: IFS length comparaison……………………………………………………...21 Figure 2.6: MAC frame format…………………………………………………………..22 Figure 2.7: RTS frame format…………………………………………………………....23 Figure 2.8: CTS frame format……………………………………………………………23 Figure 2.9: ACK frame format…………………………………………………………...23 Figure 2.10: DCF Medium Access Mechanism………………………………………….24 Figure 2.11: PC to station transmission.............................................................................26 Figure 2.12: Station to Station transmission……………………………………………..27 Figure 3.1: Structure of the Superframe…………………………………………………30 Figure 4.1: Structure of the superframe used in HCF……………………………………33 Figure 5.1: Trace format…………………………………………………………………42 Figure 6.1a: Uplink-node (Flows/Bw)/EDCF……………………………………………44 Figure 6.1b: Uplink_node (Flows/Bw)/FHCF…………………………………………...45 Figure 6.1c: Uplink_node (Flows/Bw) Integrated Scheduling…………………………..45 Figure 6.2a: Uplink_node.latdist/FHCF……………….………………………………...46 Figure 6.2c: Uplink_node.latdist/Integrated Scheduler.…………………………………46 iv Abstract: In wireless systems, the bandwidth and QoS (Quality of Service) requirements for multimedia applications represent a very important topic. Handling of the QoS in IEEE 802.11 WLAN (Wireless Local Area Network) is studied in this project. We consider the transmission of application data flows with variable bit rates. In order to better support QoS, the 802.11e ([6], [16]) Medium Access Control (MAC) of IEEE 802.11 WLAN family has introduced the Hybrid Coordination Function (HCF). HCF allocates transmission time to stations in a way to guarantee the QoS requirements of the different streams. It has been shown that the simple scheduler proposed for the HCF is efficient for streams with constant bit rate (CBR). Variations in the bit rates of the streams may introduce undesired delays and latencies while bandwidth remains in the wireless channel. A fair scheduling algorithm, called FHCF, has been proposed in [13] to overcome this problem. FHCF Algorithm compensates the variations in the streams bit rates by redistributing a part of the remaining time in the Service Interval (SI) to the different wireless stations based on the estimation of the queue length of every traffic stream. This redistribution may change the length of the different Transmission Opportunities (TXOP) which introduces a variation in the delay. In this work it is proposed to extend the FHCF algorithm by considering the whole set of streams in the computation of the TXOPs. Unlike [13], the distribution of the rates of the different streams is considered in the estimation of the TXOPs. The parameters of these distributions are estimated using either a sliding or a growing window. Based on these estimates the scheduling is performed. Simulations are conducted using NS-2 (see [17], for example) in order to evaluate the efficiency of the proposed algorithm. The simulation results are provided in chapter 6 of this report. v Preface: The work of this thesis has been carried out at the Division of Computer Science and Networking at the Department of Computer Science and Computer Engineering at the University of Balamand. Since we are able to get valuable results during my work on this project, we decided to write a conference paper. This paper is going to be presented as a position paper at the VTC spring At Italy, during May 2003. I am convinced that the work I had performed during the last eight months have brought me far into the wireless networking area, Quality of service, and has prepared me well towards forthcoming studies. Pierre Abi Char vi Acknowledgements I would like to thank Dr. Chafic Mokbel and Dr. Loutfi Nuaymi for their continuous guidance and suggestions on my research. They always helped me to approach the problems from different perspectives and to define the scope of what I needed to accomplish. Their suggestions and observations were extremely helpful throughout this project. They always pointed out my mistakes and suggested solutions to the problems I encountered. Thanks to everyone at University of Balamand for their valuable comments and support. Special thanks to Mr. Riad Saba, who provided a lot of help. vii Chapter 1 Introduction 1.1 Introduction: IEEE 802.11 WLAN standard is being accepted widely and rapidly because of their simplicity and robustness against failures. Today, 802.11 WLAN can be considered as a wireless version of Ethernet. However the interest in wireless networks supporting quality of service (Q0S) has recently grown so the IEEE 802.11 working group has established an activity to enhance the current 802.11 MAC protocol in order to support applications with Q0S requirements which could open a variety of opportunities for new multimedia applications on mobile or portable devices. Wireless LAN (WLAN) devices are emerging in today’s markets and have become a widely used Internet access technology. In 1997, the IEEE released 802.11 as the first internationally standard for Wireless LANS, defining 1 and 2 Mbps speeds, (see [5], [10]). In September 1999, they ratified the 802.11b “High Rate” amendment to the standard, which added two speeds (5.5 and 11 Mbps) in 2.4GHz band to 802.11. And then 802.11a committee developed wireless standards for data rates of up to 54 Mbps in the 5GHz band. The basic architecture, features and services of 802.11b and 802.11a are defined by the original 802.11 standard, with changes made only to the physical layer. These changes result in higher data rates and more robust connectivity. Furthermore, the IEEE 802.11e committee is currently working to enhance the 802.11 MAC to expand support for applications with QoS (Quality of Service) requirements. Behind all this technological advances in Wireless standards and schemes, the bandwidth and QoS requirement of distributed multimedia applications over Wireless LAN are the powerful driving force. The Internet has been experiencing explosive growth of audio and video streaming. The performance of such applications may experience new problems due to the nature of wireless medium and certain access scheme. Therefore, studying the transmission of multimedia application over 802.11 Wireless LAN becomes critical in solving problem when designing and deploying wireless network infrastructure to fulfill the needs for those multimedia applications. 8 1.2 Project Contributions In chapter 2, I provide an overview of 802.11 standards and background knowledge of 802.11 Wireless LAN Medium Access Schemes including DCF and PCF. In chapter 3, I give an introduction for the 802.11e in addition to the 802.11e mechanism. In chapter 4, I describe our new algorithm, integrated algorithm, definition and mechanism. In chapter 5, I describe the Simulation configuration in order to present the results concerning the delay, throughput and the latency measurement which are presented in chapter 6. We conclude our work and outline future work in the chapter 7. 9 Chapter 2 802.11 Wireless LAN (PHY and MAC layers) 2.1 Introduction With the surging need for wireless local networks, many companies have developed their own technology to implement wireless LAN. In order to create a more unified and compatible wireless networking, the IEEE has developed a standard to deal with the problems involved in a wireless LAN design, which is the 802.11 standard. Currently the 802.11 family includes 802.11, 802.11a, 802.11b and 802.11e. 802.11 were released in 1997, and it defines 1 and 2 Mbps speeds. Then in 1999, 802.11b is released to support higher rates, 5.5 and 11 Mbps. Furthermore, the IEEE 802.11e committee is currently working to enhance the 802.11 MAC to expand support for applications with QoS (Quality of Service) requirements. Below is a brief guide to shows the basic features of the wireless networking standards. These standards are divided into three groups: approved, conditional approved and still in development standard. The following standards are approved: 1// IEEE 802.11: Standard for WLAN operations at data rates up to 2 Mbps. 2// IEEE 802.11a: Standard for WLAN operations at data rates up to 54 Mbps. 3// IEEE 802.11b: Standard for WLAN operations at data rates up to 11 Mbps The following standards are in draft or conditional approved stage: 1// IEEE 802.11g: High-rate extension to 802.11b allowing for data rates up to 54 Mbps. 2// IEEE 802.15.1: Wireless personal area network standard based on the Bluetooth specification. The following standards are still in development: 1// IEEE 802.11e: Enhance the 802.11 Medium Access Control (MAC) to improve and manage Quality of Service. These enhancements should provide the quality required for services such as IP telephony and video streaming. 2// IEEE 802.11f: Develop recommended practices for an Inter-access point protocol (IAAP) which provides the necessary capabilities to achieve multi-vendor Access 10 point interoperability across a distribution system supporting IEEE 802.11 wireless LAN links. 3// IEEE 802.11h: Enhance the 802.11 Medium Access control (MAC) standard and 802.11a High Speed Physical Layer (PHY) in the 5GHZ band. Objective is to make IEEE 802.11ah products compliant with European regulatory requirements. 4// IEEE 802.11i: Enhance the 802.11 Medium Access Control (MAC) to enhance security and authentication mechanisms. 5// IEEE 802.15 TG2. 6// IEEE 802.15 TG3. 7// IEEE 802.15 TG4. 2.2 The IEEE 802.11 wireless LAN Architecture The 802.11 architecture (see [5] and [10]) is comprised of several components and services that interact to provide station mobility transparent to the higher layers of the network stack. These components are: - Wireless LAN Station (WSTA) is the most basic component of the wireless network. A station is any device that contains the functionality of the 802.11 protocol, that being MAC, PHY, and a connection to the wireless media. Typically the 802.11 functions are implemented in the hardware and software of a network interface card (NIC). A station could be a laptop PC, handheld device, or an Access Point. Stations may be mobile, portable, or stationary and all stations support the 802.11 station services of authentication, de-authentication, privacy, and data delivery. - Basic Service Set (BSS) is a set of stations that communicate with one another. A BSS does not generally refer to a particular area, due to the uncertainties of electromagnetic propagation. When all of the stations in the BSS are mobile stations and there is no connection to a wired network, the BSS is called independent BSS (IBSS). IBSS is typically short-lived network, with a small number of stations that is created for a particular purpose. When a BSS includes an access point (AP), the BSS is called infrastructure BSS. 11 When there is an AP, if one mobile station in the BSS must communicate with another mobile station, the communication is sent first to the AP and then from the AP to the other mobile station. - Extended Service Set (ESS) is a set of infrastructure BSSs, where the Aps communicate among themselves to forward traffic from one BSS to another and to facilitate the movement of mobile stations from one BSS to another. The Aps perform this communication via an abstract medium called the distribution system (DS). The ESS and all of its mobile stations appears to be a single MAC-layer network where all stations are physically stationary. Thus, the ESS hides the mobility of the mobile stations from everything outside the ESS. - Distribution System: The (DS) is the mechanism by which one AP communicates with another to exchange frames for stations in their BSSs, forward frames to follow mobile stations from one BSS to another, and exchange frames with wired network. 2.3 802.11 Topologies There are two modes of WLAN topology. One is ad-hoc or IBSS (Independent Basic Service Set) mode and the other is infrastructure mode. The Ad-hoc mode is a peer-to-peer mode, in which mobile nodes communicates with each other directly. Generally, ad-hoc implementations cover a limited area and aren’t connected to any larger network. The most basic wireless LAN topology is a set of stations, which have recognized each other and are connected via the wireless media in a peer-to-peer fashion. This form of network topology is referred to as an Independent Basic Service Set (IBSS) or an Ad-hoc network. In an IBSS, see figure 2.1, the mobile stations communicate directly with each other. Every mobile station may not be able to communicate with every other station due to the range limitations. There are no relay functions in an IBSS therefore all stations need to be within range of each other and communicate directly. 12 BSS Figure 2.1: Independent Basic Service Set (IBSS). The infrastructure mode, see figure 2.2, consists of at least one access point (AP) and a number of mobile nodes connecting to the AP via wireless medium. This is called a cell, or BSS (Basic Service Set). Aps are connected to the distribution system (DS), which is similar to the backbone, usually Ethernet or wireless. A number of BSS consist of ESS (Extended Service Set). Distribution System Figure 2.2: Infrastructure Mode. The distribution system (DS) is the means by which an access point communicates with another access point to exchange frames for stations in their respective BSSs, forward frames to follow mobile stations as they move from one BSS to another, and exchange frames with a wired network As IEEE 802.11 describes it, the distribution system is not necessarily a network nor does the standard place any restrictions on how the distribution system is 13 implemented, only on the services it must provide. Thus the distribution system may be a wired network like 803.2 or a special purpose box that interconnects the access points and provides the required distribution services Extending coverage via an Extended Service Set (ESS) 802.11, see figure 2.3, extends the range of mobility to an arbitrary range through the Extended Service Set (ESS). An extended service set is a set of infrastructure BSS’s, where the access points communicate among themselves to forward traffic from one BSS to another to facilitate movement of stations between BSS’s. The access point performs this communication through the distribution system. The distribution system is the backbone of the wireless LAN and may be constructed of either a wired LAN or wireless network. Typically the distribution system is a thin layer in each access point that determines the destination for traffic received from a BSS. The distribution system determines if traffic should be relayed back to a destination in the same BSS, forwarded on the distribution system to another access point, or sent into the wired network to a destination not in the extended service set. Communications received by an access point from the distribution system are transmitted to the BSS to be received by the destination mobile station. Network equipment outside of the extended service set views the ESS and all of its mobile stations as a single MAC-layer network where all stations are physically stationary. Thus, the ESS hides the mobility of the mobile stations from everything outside the ESS. This level of indirection provided by the 802.11 architecture allows existing network protocols that have no concept of mobility to operate correctly with a wireless LAN where there is mobility. 14 Figure 2.3: Extended Service Set (ESS). 2.4 The IEEE 802.11 layers Description As any 802.x protocol, the 802.11 protocol covers the MAC and Physical Layer. The Standard currently defines a single MAC, which interacts with three PHYs (all of them running at 1 and 2 Mbit/s) as follows: Frequency Direct Hopping Spread Spectrum in the 2.4 GHz Band Sequence Spread Spectrum in the 2.4 GHz Band, and Infrared Figure 2.4: Layers Descriptions. 15 Beyond the standard functionality usually performed by MAC Layers, the 802.11 MAC performs other functions that are typically related to upper layer protocols, such as Fragmentation, Packet Retransmissions, and Acknowledges. 2.5 Physical Layer The general operations of the individual Physical layers, see [18], are very similar. To perform Physical Layer Convergence Procedure (PLCP) sub-layer functions, the 802.11 standard specify the use of state machines. Each state machine performs one of the following functions: 1. Carrier Sense: to determine the state of the medium 2. Transmit: to send individual octets of the data frame 3. Receive: to receive individual octets of the data frame Currently there are five physical techniques defined in 802.11 (see [5]): Diffused Infrared (IR), Frequency Hopping Spread Spectrum (FHSS), Direct Sequence Spread Spectrum (DSSS), High Rate Direct Sequence Spread Spectrum (HR-DSSS) and Orthogonal Frequency Division Multiplexing (OFDM). While FHSS and DSSS deliver 1Mbps and 2Mbps data rates in the 2.4GHz band (referred to as 802.11), HRDSSS extends the rate to 5.5Mbps and 11Mbps (referred to as 802.11b) in the 2.4GHz band. And OFDM provides up to 54Mbps data rates in the 5GHz band (referred to as 802.11a). Frequency-hopping Spread Spectrum: This technique represents one of the possible physical layers of the 802.11 standard. It uses 79 overlapping frequency channels where each channel has 1 MHz channel space. This allows 26 networks to be located in the same area, which make the aggregated throughput more reasonable. Although the standard specifies 79 channels, the actual numbers of channels that are used depend on the regulatory authority assignment of frequency usage in a particular country. There are also different regulatory bodies that restrict the number of hopping channels that can be used in other locations of the world. The number of hops defined for IEEE 802.11 standard operation in each country, is referred to as a hopping set. 16 Direct-sequence Spread Spectrum (DSSS): The direct-sequence spread spectrum is a second physical layer supported by 802.11. DSSS is also the only specified physical layer for the 802.11b standard, which supports data rates of 5.5 and 11Mbps. The 802.11b standard uses the same 2.4MHz bandwidth and channelization scheme as the 1 Mbps version of the 802.11 standard. They only have a different chipping method. The 802.11 standard uses an 11-bit Barker chip while the 802.11b uses an 8-bit complimentary code-keying (CCK) algorithm. Infrared: The third and last physical layer supported by the standard is infrared. It is based on the 850- to 950- nm range, which is nearly visible light. It is based on a diffuse IR transmission, which means that you don’t need a clear path between the transmitter and receiver. The transmission range is limited to 10 meters and restricted to inbuilding applications. 2.6 MAC Layer The MAC layer in 802.11 provides the following major services: 1. Accessing the wireless medium. 2. Joining a network. 3. Providing Authentication and privacy. 4. Providing integration between 802.11 and older incompatible equipments. 5. Providing support for power management. Two major MAC schemes are most popular today: Distributed Coordination Function (DCF) and Point Coordination Function (PCF). 17 2.6.1 The Basic Access Method: CSMA/CA The basic access mechanism, called the Distributed Coordination Function, is basically a Carrier Sense Multiple Access with Collision Avoidance mechanism (usually known as CSMA/CA). CSMA protocols are well known in the industry, the most popular being the Ethernet, which is a CSMA/CD protocol (CD standing for Collision Detection). A CSMA protocol works as follows: A station desiring to transmit senses the medium. If the medium is busy (i.e. some other stations are transmitting) then the station defers its transmission to a later time. If the medium is sensed free then the station is allowed to transmit. These kinds of protocols are very effective when the medium is not heavily loaded since it allows stations to transmit with minimum delay. But there is always a chance of stations simultaneously sensing the medium as being free and transmitting at the same time, causing a collision. These collision situations must be identified so the MAC layer can retransmit the packet by itself and not by upper layers, which would cause significant delay. In the Ethernet case this collision is recognized by the transmitting stations, which go into a retransmission phase based on an exponential random backoff algorithm. While these Collision Detection mechanisms are a good idea on a wired LAN, they cannot be used on a Wireless LAN environment for two main reasons: 1. Implementing a Collision Detection Mechanism would require the implementation of a Full Duplex radio capable of transmitting and receiving at once, an approach that would increase the price significantly. 2. In a Wireless environment we cannot assume that all stations hear each other (which is the basic assumption of the Collision Detection scheme), and the fact that a station wants to transmit and senses the medium as free doesn’t necessarily mean that the medium is free around the receiver area. In order to overcome these problems, the 802.11 uses a Collision Avoidance (CA) mechanism together with a Positive Acknowledge scheme as follows: 18 A station wanting to transmit senses the medium. If the medium is busy then it defers. If the medium is free for a specified time (called Distributed Inter Frame Space (DIFS) in the standard), then the station is allowed to transmit. The receiving station checks the CRC of the received packet and sends an acknowledgment packet (ACK). Receipt of the acknowledgment indicates to the transmitter that no collision occurred. If the sender does not receive the acknowledgment then it retransmits the fragment until it receives acknowledgment or is thrown away after a given number of retransmissions. 2.6.1.1 Virtual Carrier Sense In order to reduce the probability of two stations colliding because they cannot hear each other, the standard defines a Virtual Carrier Sense mechanism: A station wanting to transmit a packet first transmits a short control packet called RTS (Request To Send), which includes the source, destination, and the duration of the following transaction (i.e. the packet and the respective ACK), the destination station responds (if the medium is free) with a response control Packet called CTS (Clear to Send), which includes the same duration information. All stations receiving either the RTS and/or the CTS, set their Virtual Carrier Sense indicator (called NAV, for Network Allocation Vector), for the given duration, and use this information together with the Physical Carrier Sense when sensing the medium. This mechanism reduces the probability of a collision on the receiver area by a station that is “hidden” from the transmitter to the short duration of the RTS transmission because the station hears the CTS and “reserves” the medium as busy until the end of the transaction. The duration information on the RTS also protects the transmitter area from collisions during the ACK (from stations that are out of range of the acknowledging station). It should also be noted that, due to the fact that the RTS and CTS are short frames, the mechanism also reduces the overhead of collisions; since these are recognized faster than if the whole packet was to be transmitted. (This is true if the packet is significantly bigger than the RTS, so the standard allows for short packets to be transmitted without the RTS/CTS transaction. This is controlled per station by a parameter called RTS Threshold). 19 2.6.1.2 MAC Level Acknowledgments As mentioned earlier in this document, the MAC layer performs Collision Detection by expecting the reception of an acknowledge to any transmitted fragment (Packets that have more than one destination, such as Multicasts, are not acknowledged.) 2.6.1.3 Fragmentation and Reassembly Typical LAN protocols use packets several hundred bytes long (the longest Ethernet packet could be up to 1518 bytes long). There are several reasons why it is preferable to use smaller packets in a Wireless LAN environment: Due to the higher Bit Error Rate of a radio link, the probability of a packet getting corrupted increases with the packet size. In case of packet corruption (either due to collision or noise), the smaller the packet, and the less overhead it causes to retransmit it. On a Frequency Hopping system, the medium is interrupted periodically for hopping (in our case every 20 milliseconds), so, the smaller the packet, the smaller the chance that the transmission will be postponed. However, it doesn’t make sense to introduce a new LAN protocol that cannot deal with packets 1518 bytes long, which are used on Ethernet, so the committee decided to solve the problem by adding a simple fragmentation/reassembly mechanism at the MAC Layer. The mechanism is a simple Send-and-Wait algorithm, where the transmitting station is not allowed to transmit a new fragment until one of the following happens: 1. Receives an ACK for the said fragment. 2. Decides that the fragment was retransmitted too many times and drops the whole frame. It should be noted that the standard does allow the station to transmit to a different address between retransmissions of a given fragment. This is particularly useful when an AP has several outstanding packets to different destinations and one of them does not respond. IEEE 802.11 defines several standard Inter-Frame Space (IFS) that defer a station’s access to the medium and provides various levels of priority. They are shown in Figure 2.5. 20 1. DIFS (Distributed IFS): most general, provides lower priority than PCF based transmission. DIFS Is the Inter frame space used for a station willing to start a new transmission, which is calculated as PIFS plus one slot time. 2. SIFS (Short IFS): provides the highest priority level for some frames to access the medium before others, such as ACK, CTS frame, etc. SIFS is used to separate transmissions belonging to a single dialog (e.g. Fragment-Ack), and is the minimum Inter Frame Space. There is always at most one single station to transmit at any given time, therefore giving it priority over all other stations. This value is a fixed value per PHY and is calculated in such a way that the transmitting station will be able to switch back to receive mode and be capable of decoding the incoming packet. On the 802.11 FH PHY this value is set to 28 microseconds. 3. PIFS (PCF IFS): Is the interval of time that stations operate under PCF mode. This provides priority over frames sent by the distributed coordination function. PIFS is used by the Access Point (or Point Coordinator, as called in this case), to gain access to the medium before any other station. This value is SIFS plus a Slot Time, i.e. 78 microseconds. 4. EIFS (Extended IFS): goes beyond the time of a DIFS interval for some special cases, such as bad reception of the frame. This interval provides enough time for the receiving station to send an ACK frame. Figure 2. 5: IFS length comparison. The difficulty of physical carrier sensing is that the severe channel fading and the hidden-station problem will prevent the stations from correctly detecting the medium 21 state. Virtual carrier sensing solves this problem by sending and receiving RTS (Request to send)/CTS (Clear to send). For example, station A will send RTS packet to the intended receiver and wait for a CTS packet. The RTS packet will broadcast the intended duration of the transmission. The CTS will also contain the intended duration to reduce the possibility of hidden-station problem. Once the CTS packet is received, station A will start to transmit. However, because the use of RTS/CTS will cause extra overhead, this mechanism is not favorable when data packets are small. In fact, a RTS/CTS threshold can be defined and packets smaller than the threshold are transmitted without RTS/CTS overhead, and payloads larger than the threshold will be transmitted using RTS/CTS. 2.6.2 Frame Type There are three main types of frames: Data Frames: which are used for data transmission Control Frames: which are used to control access to the medium (e.g. RTS, CTS, and ACK). Management Frames: which are frames that are transmitted the same manner as data frames to exchange management information, but are not forwarded to upper layers (e.g. beacon frames). Each frame type is subdivided into different Subtypes, according to their specific function. The figure below shows the general MAC frame format: frame control duration /ID adress 1 address addres 2 3 sequence control address 4 frame Body crc Figure 2.6- MAC frame format This format is used to transmit information between stations. Portions of this frame in the form of several fields are used in other types of frames. The frame body field can be up to a maximum of 2312 bytes that is enough to support transportation of an Ethernet frame with maximum length (1500 bytes). RTS frame format: 22 Frame control Duration Receiver Address Transmitter Address CRC Figure 2.7 - RTS frame format From figure 2.7, the receiver address (RA) in the frame represents the address of the station on the wireless network that is the intended immediate recipient of the next Data or Management frame. The transmitter address (TA) is the address of the station transmitting the RTS frame. The duration value is the time, in microseconds, required to transmit the next Data or Management frame plus one CTS frame, one ACK frame and three SIFS intervals. CTS frame format: Frame control Duration Receiver Address Transmitter Address CRC Figure 2.8 - CTS frame format There is a relationship between certain fields in the CTS frame and the RTS frame, since the CTS is a response to the receipt of a RTS frame. The transmitter address (TA) from the RTS frame is copied to the receiver address (RA) field in the CTS frame, since this is the address it will respond to. ACK frame format: Frame control Duration Receiver Address CRC Figure 2.9 - ACK frame format The receiver address (RA) field of the ACK frame is copied from the Adress-2 field of the immediately previous frame. If the More Fragment bit was set to 0 in the Frame Control field of the previous frame, the Duration value is set to 0, otherwise the Duration value is obtained from the duration field of the previous frame, minus the time, in microseconds, required to transmit the ACK frame and its SIFS interval. 23 2.6.3 Distributed Coordination Function (DCF) DCF is the primary access protocol for wireless medium between stations and access points having compatible PHs. It is a scheme of Carrier Sense Multiple Access with Collision Avoidance (CSMA/CA). To determine the medium state, a combination of physical and virtual carrier sense mechanisms are applied. A station can decide to transmit at any time if the channel is sensed to idle after a period of DIFS (DCF Inter Frame Space) and the station’s NAV (network allocation vector) is zero. NAV operates like a timer, it starts with a value equal to the Duration field value of the last frame transmission sensed on the medium and counting down to zero. Figure 2.10 – DCF Medium Access Mechanism 2.6.4 Point Coordination Function (PCF) The optional priority-based Point Coordination Function provides contention free frame transfer for processing time-critical information data traffic. In PCF mode, there is a point coordinator residing in the access point. All stations will obey the point coordinator by setting their NAV value at the beginning of each contention-free period (CFP). 2.6.5 The 802.11 Mechanism: The basic 802.11 MAC protocol is the distributed coordination function (DCF) that works as listen-before-talk scheme. The 802.11 define collision avoidance (CA) to reduce the probability of collision whenever two stations detect the channel as free at the same time. As solution, a station performs a backoff procedure, which has to keep sensing the channel for an additional random time after detecting that the channel is being idle. This duration is called DCF Interframe space DIFS. If the channel remains 24 idle for this additional time, the station is allowed to transmit. While the short inter frame space (SIFS) is the time between two consecutive frames in the sequence of request to send (RTS), clear to send (CTS), data and ACK frame. It is important to note that SIFS is shorter than DIFS. To support time-bounded services, the IEEE 802.11 standard defines the point coordination function (PCF) in order to let stations have priority access to the wireless medium, coordinated by a station called point coordinator (PC). Time is always divided into repeated period called superframe. A contention free period (CFP) and a contention period (CP) form a superframe. A superframe starts with a so-called beacon frame. This beacon frame is for management that maintains the synchronization of the local timers in the stations. The PC is typically located at the AP, generates a beacon frames at regular beacon frame intervals. By the beginning of each contention free period (CFP) all stations on the network set the network allocation vector (NAV) parameter to the value set by the PC. After this the PC is the only station permitted to send, the PC can grant permission for another station to send by sending it a special frame called a CF_POLL frame. A station (STA) that is able to respond to CF_POLL is referred to as being CF_POLLABLE. When the PC polls the CF_POLLABLE station, this CF_POLLABLE STA may transmit only one MPDU, which can be to any destination (not just to PC) and may piggyback the ACK of the frame received from the PC using particular data frame subtypes for this transmission. If the data frame is not acknowledged, the CF_POLLABLE STA does not retransmit the frame unless the PC polls it again, or it decides to retransmit during CP. The beacon frame initiates the CFP repetition interval, where the AP transmits the beacon frame when the medium is determined to be idle for one period PIFS. After the initial beacon frame, the PC waits for at least one SIFS period and transmits one of the following: a data frame, a CF_POLL frame, a data + CF_POLL, a CF_END frame. If there is no traffic and no polls to send at the PC, a CF_END frame should be transmitted immediately after the initial beacon. At the beginning of each CFP repetition interval, all stations in the BSS update their NAV to the max length of the (CF-MAX-DURATION). 25 During the CFP, the only time the stations are permitted to transmit is in respond to a poll from the PC or for transmission of an ACK. (SIFS) after the receipt of a MPDU. If the PC receives a DATA+CF-ACK frame from a station, the PC can send a DATA+CF-POLL+CF-ACK frame to different stations. If the PC received no respond for a polled station after waiting for PIFS, it polls the next station, or ends the CFP. The PC continues polling other station until the CFP expires. A specific control frame called CF-END is transmitted by the CP as the last frame within the CFP to signal the end of the CFP. The ability to combine polling and ACK frame with data frames has been designed to improve the efficiency. Figure 2.11 – PC to station transmission Figure 2.11 shows the PC to station transmission. If the PC failed to receive an ACK for a transmitted data frame, the PC waits a PIFS and continues transmitting to the next station in the polling list. Figure 2.12 shows the transmission between two stations. 26 Figure 2.12 – station-to-station transmissions After a successful receipt of the frame, the station would wait for a SIFS and reply to the PC with a standard ACK frame. The PC may also choose to transmit a frame to a non CF-POLLABLE station. PCF has some serious limitations. First, the start of the CF period is not exactly periodic since it can only begin when the medium is sensed to be idle. As a result, the CFP may be forced to end prematurely not serving some members on the polling list. Second, all the CF-pollable STA’s have the same level of priority. Third, the CFP repetition rate is not dynamically variable. Therefore there is a trade-off between low latency applications requiring a fast repetition rate and an efficient use of the medium requiring slower repetition rate. Fourth, the PC has to poll all the STAs on its polling list, even if there is no traffic to be sent. Finally, a Transmission Opportunity (TXOP), for a STA being polled during the CFP, cannot last longer than the duration needed to transmit a single PDU. The term TXOP here refers to an instance when a given STA is allowed to initiate a bounded number and/or length of transmissions. 27 Chapter3. The IEEE 802.11e standards: 3.1 Introduction: In order to solve the problem of quality of service, [3], the Task Group E defines the 802.11e. This standard introduces both EDCF and HCF. Unlike the original 802.11 standard, stations using 802.11e are called enhanced stations and the centralized controller is called the hybrid coordinator (HC). Here we have QBSS, which is the combination of the HC and stations. The HC resides within the AP. The QOS support is realized with the introduction of traffic categories (TCs). The transmission is now delivered through multiple backoff procedures within the same station; each backoff is parameterized with TC-specific parameter. The HC may allocate TXOPs to itself to initiate MSDU deliveries whenever it wants, however, only after detecting the channel as being idle for PIFS, which is shorter than DIFS. To give the HC priority over the EDCF, AIFS must be longer than PIFS and can therefore not have a value smaller than DIFS. During CP, each TXOP begins either when the medium is determined to be available under the EDCF rules (after AIFS plus backoff time) or when the station receives a special poll frame, the QOS CF-Poll, from the HC. The QOS CF-Poll from the HC can be sent after a PIFS idle period without any backoff. Therefore the HC can issue polled TXOPs in the CP using its prioritized medium access. During the CFP, the starting time and maximum duration of each TXOP is specified by the HC, again using the QOS CF-Poll frames. Stations will not attempt to get medium access on its own during the CFP, so only the HC can grant TXOPs by sending QOS CF-Poll frames. The CFP ends after the time announced in the beacon frame or by CF-End frame from the HC. As part of 802.11e, an additional random access protocol that allows fast collision resolution is defined. The HC polls stations for MSDU delivery. For this, the HC requires information that has to be updated by the polled stations from time to time. Controlled contention is a way for the HC to learn which station needs to be polled, at which times, and for which duration. The controlled contention mechanism allows stations to request the allocation of polled TXOPs by sending 28 resource requests, without contending with other traffic. Each instance of controlled contention occurs during the controlled contention interval, which is started when the HC sends a specific control frame. This control frame forces legacy stations to set their NAV until the end of the controlled contention interval, thus they remain silent during the controlled contention interval. The control frame defines a number of controlled contention opportunities (i.e., short intervals separated by SIFS) and a filtering mask containing the TCs in which resource requests may be placed. Each station with queued traffic for a TC matching the filtering mask chooses one opportunity interval and transmits a resource request frame containing the requested TC and TXOP duration, or the queue size of the requested TC. For fast collision resolution, the HC acknowledges the reception of request by generating a control frame with a feedback field so that the requesting stations can detect collisions during controlled contention. 3.2 The 802.11e HCF scheduling algorithm: In order to enhance the quality of service (QoS) in wireless LAN, the 802.11e ([6], [16]) Medium Access Control (MAC) of IEEE 802.11 WLAN family has introduced the Hybrid Coordination Function (HCF). HCF allocates transmission time to stations in a way to guarantee the QoS requirements of the different streams. A new scheduling algorithm has been proposed in the 802.11e specification according to [13] and [15] to take QoS requirements of traffics into account. The algorithm is the following: Each QSTA that requires the HCCA mode has first to send a QoS request packet to the QoS Access Point (QAP) that contains the mean data rate of the application using this TS, the MAC Service Data Unit (MSDU) size and the maximum SI required. With the above QoS parameters, the QAP determines first the minimum value of all the SIs required by the different traffics that apply for HCCA. Then it chooses the highest sub-multiple of the superframe duration (duration between two beacons), which is less to the minimum of all the SIs. So the superframe is divided into several SIs and QSTAs are polled according to a round-robin polling algorithm during each SI. As shown in Figure 3.1, after the Contention Free Period (CFP), EDCF periods 29 and Controlled Access Periods (CAPs) are alternating during the Contention Period (CP). Figure 3.1: Structure of the superframe used in the HCF scheduling algorithm As soon as the SI is determined, the QAP calculates the different TXOPs allocated to the different TSs of all the QSTAs, which applied for HCCA. TXOP corresponds to the time to transmit the number of packets arriving during a SI in the TS queue. The number of arriving packets in TS queue j of the QSTA i during a SI is: j * SI N ij = i j Mi (3.1) Where ρ ij is the application data and M ij the MSDU size. Using equation 3.1, the different values for TXOPs (T ij ) are evaluated: T ij = N ij ( M ij /R +2*SIFS +ACK), (3.2) Where R is the physical transmission rate, SIFS is the short Inter Frames Space and ACK the time to transmit an acknowledgement packet. Two cases have been taken into consideration, empty queues at the end of the TXOP and non-empty queues at the end of the TXOP. For both cases the delay for a packet P that arrives in the TS with polling i at time t was calculated. The delay expression is the following: i 1 d i (t) =( Tj t + j 1 + (SI – t + i 1 Tj + j 1 i b i q i0 M i t + i ) X 0; T j (t) b b j 1 i (t - i Tj ))X T ; SI (t). j j 1 (3.3) 1 According to [13] the delay can be expressed as: 30 q i0 M i t di(t) =( Tj t + + i ) X 0; t d (t) b b j 1 i 1 + (SI – t + i 1 Tj + j 1 i where td = Tj - q ie M i j 1 i i b (t -td))X t d ; SI (t), (3.4) . Using the equation 3.4, the maximum delay will be: i 1 Di = SI (1+ q i0 M i Tj b Ti ) + i i SI j 1 SI (3.5) According to [13], the maximum delay can be reduced by increasing the TXOP Ti. The above algorithm can be efficient if traffic respect strictly their QoS requirements. However, some real time applications such as video conferencing may generate VBR traffics and this procedure may cause the average queue length to increase. Even if the mean sending rate of such application is lower than the rate specified in its QoS requirements, sometimes, peaks of sending rate will not be absorbed by TXOPs allocated according to the QoS requirements. A more flexible scheme, which adapts to fluctuating flows, is then needed. __________ The advantages of this scheme are the possibility to control delay of each accepted traffic given that the queue length is controlled before polling. So each traffic should have the same maximum delay linked to the SI duration chosen by the QAP without any additional cost. It has been shown, [13] that the simple scheduler proposed for the HCF is efficient for streams with constant bit rate (CBR). Variations in the bit rates of the streams may introduce undesired delays and latencies while bandwidth remains in the wireless channel. A fair scheduling algorithm, called FHCF, has been proposed in [13] and [15] to overcome this problem. 31 3.3 The 802.11e FHCF scheduling algorithm: The FHCF algorithm takes into consideration the queue length information to support both the CBR and VBR traffics. This algorithm contains two schemes, the QAP scheduler and the node scheduler. 3.3.1 A queue length based scheduling scheme at the QAP: The QAP uses the last queue length information sent by the QSTA during it’s polling, to estimate queue length at the beginning of the next SI. Then the TXOP is calculated based on the comparaison of this estimation with the ideal queue length at the beginning of the next SI. Finally the QAP modifies this TXOP by redistributing the remaining time of the CAP (or CFP) to the different QSTAs according to the variations of the different flows (sending rate and/or packet size). For more information please refer to [13]. 3.3.2 The node scheduler The node scheduler has a very important role since it has to redistribute the additional allocated time to the different TSs. It performs almost the same computations as the QAP. It computes N j , the number of packets to transmit in each TS, and the time required to transmit a packet according to its QoS requirements (packet size, data rate). Then, according to its allocated TXOP T and the number of packets the QSTA should transmit from each TS, it evaluates the remaining time T r . p Tr = T - N j 1 j (M j /R +2*SIFS + ACK). (3.6) Since each QSTA knows exactly its own TS queue sizes at the beginning of the polling, it is able to estimate more precisely its queue sizes at the end of the TXOP and consequently the required additional time per TS. With this information, the QSTA performs the same computations as the QAP (see [17], [14]). FHCF Algorithm compensates the variations in the streams bit rates by redistributing a part of the remaining time in the Service Interval (SI) to the different wireless 32 stations based on the estimation of the queue length of every traffic stream. This redistribution may change the length of the different Transmission Opportunities (TXOP), which introduces a variation in the delay. In the following it is proposed to extend the FHCF algorithm by considering the whole set of streams in the computation of the TXOPs, the distribution of the rates of the different streams is considered in the estimation of the TXOPs. 33 Chapter 4 Integrated Scheduling Algorithm 4.1. Criterion The structure of the superframe in 802.11e is given in Figure 4.1 where we can see the use of Service Intervals (SI). This figure shows that the superframe is divided into several SIs and every SI is decomposed of different TXOPs allocated to the different streams. The SI duration and the TXOP lengths are fixed for applications with constant bit rate. However, those bit rates may be time-varying for some real-life applications. Thus, the variation of TXOPs lengths is investigated in order to maximize the throughput and to minimize the delays, i.e. enhance the QoS offered by the protocol. In [13] the authors show that excessive delays may occur due to the remaining packets in the queues of the streams after the corresponding TXOP. This is generally due to variation in the bit rate of the application streams. To overcome this problem FHCF is proposed to redistribute the free time in a SI based on estimated queue lengths of the different streams. This estimation is done on each stream separately and does not take into account the whole set of streams. In this work, it is proposed to extend the FHCF by considering the whole set of streams. SI 1 B TXOP 1 TXOP 2 SI 2 ….. EDCF TXOP 1 TXOP 2 ….. EDCF B Superframe Figure 4.1: Structure of the superframe used in HCF. The TXOP i is reserved for Wireless Station i. As in [13] we propose to define TXOPs with variable lengths in order to compensate for variable streams bit rates. Assume we have n stations with instantaneous application bit rates r1, r2… rn. Let SI be the service interval, q1, …, qn define the remaining packets in the queues after the (i-1)th SI, and D1, …, Dn represent the lengths of the packets for the n stations respectively. We denote Ti the time needed for the transmission of a packet of length 34 Di on the wireless channel, i.e. Ti = Di / b where b is the channel bit rate. For the ith SI, t1(i)… tn(i) are the lengths of the TXOPs associated with the n streams respectively. Based on the Figure 4.1 and given an n-tuple (r1, r2… rn), the difference between the number of packets that can be transmitted and the number of packets to transmit for the ith SI (i being the index of (i)) is given by: (i ) t 1(i ) (SI t 1(i ) t 1(i 1) ) * r1 q1 T D 1 1 t (2i ) (SI t 1(i ) t 1(i 1) t (2i ) t (2i 1) ) * r2 q2 D2 T2 t (ni ) {SI ( t 1(i ) t 1(i 1) ) ( t (ni ) t (ni 1) )} * rn qn Dn Tn j (i ) ( i 1) ( SI t t ) * r ( i ) j l l n t j l 1 q j Dj j1 T j n (ji ) j1 (4.1) Positive (i) means that more bandwidth than needed is allocated to the traffic which reduces the possibility of accepting new stations, while negative (i) indicate less allocated bandwidth than needed which increases the latency and the delays. Every term in (i) represents the difference for the jth TXOP between the number of packets that can be transmitted if tj(i) is the time allocated to this TXOP and the number of packets to be transmitted. Making (i) close to zero will give equal weights for the packets of the different streams. However, the streams have different packets’ lengths. Thus, it is not fair to affect in the criterion the same weight for the different packets and the difference between the amount that can be transmitted and the quantity to transmit should be expressed in bits leading to: 35 t (i ) (i ) 1 D1 q1D1 (SI t 1(i ) t 1(i 1) ) * r1 T1 t (2i ) D 2 q 2 D 2 (SI t 1(i ) t 1(i 1) t (2i ) t (2i 1) ) * r2 T2 t (i ) n D n q n D n {SI ( t 1(i ) t 1(i 1) ) ( t (ni ) t (ni 1) )} * rn Tn j t (ji ) D j q j D j (SI t (li ) t (li 1) ) * r j T j1 l 1 j n n (ji ) j1 (4.2) It is possible to choose the set {tj(i)} in order to minize the expected mean square error E[(i)2] under the constraint: n t (ji) SI (4.3) j1 However, this may lead to a solution where (i) is close to zero while elementary j(i) have large positive and negative values. A better criterion would be to minimize the expectation E[j(i)2]. Therefore, we propose to minimize for every SI this expected value, expectation being considered relative to the multivariate random variable (r1, r2… rn). 4.1. The algorithm The n streams are supposed not correlated. This is a reasonable assumption in real-life applications. We also make the hypothesis that these variables are normally distributed1 with first and second order moments that are estimated on either a sliding window or a growing window. For a growing window with a forgetting factor of , the re-estimation functions are: 1 which can only be accepted if the mean is larger than the standard deviation since the rate must be positive 36 (i ) rk (i ) rk2 (i 1) rk rk2 Where rk (i ) (i 1) (1 )rˆk (4.4) (1 )rˆk2 (i ) 2 and rk are respectively the estimate of the first-order and second-order moments of the kth application bit rate at ith SI and where r̂k and rˆk2 are the instantaneous measurements of these moments. The derivative of the expected mean square difference E[j(i) 2] with respect to tk(i) can be written: n (i ) D k 2 r rl (li ) p(r1 ,, rn )dr1 drn 0 k Tk k l k 1 r1 ,...,rn (4.5) By developing: k 1 l 1 (li ) n mk n mk t (mi 1) rm2 D D k rk (ki ) k Tk Tk D Dm rm t (ki 1) k Tm Tk 2 n n n D D 2 k rk rm2 (li ) rm2 l rl Tk Tl lk 1 m l mk 2 n n D D q m D m rm q k D k k SI rm2 SI k rk Tk Tk mk mk For k= 1, n (4.6) where: (ki ) t (ki) t (ki1) n It is obvious that the set of Equations (4.6) is subject to the constraint: t k(i ) SI k 1 The whole system is a linear optimization problem that can be easily solved. The solution of Equation 4.6 delivers values for k that permit to calculate the new estimate for the TXOP durations given the past durations. It is to be noted that the matrix to be inverted in Equation 4.6 will not change unless we got new estimates of the moments that are significantly different that the known estimates. This means that not the whole linear system solving should be done for every new SI. 37 Chapter 5 Wireless Simulation using ns 5.1 The network simulator (NS) Because of the complexity of network simulation, and the problem of trying to create a program that is useable but not extreme in size and resource requirements, available network simulation software is very limited. NS was chosen for two main reasons: it is open source and free, and the tcl interface is relatively simple to use. The NS simulator program was originally developed at the University of California at Berkeley, and started life in 1989. It has since been enlarged and moved to an object-oriented structure, which has allowed different modules (including protocols, applications, physical layer technologies) to be added with ease. It is written in a combination of C++ and tcl, using otcl to interface the two. In this chapter, I will describe the use of the wireless simulation model available in the “Network Simulator” (ns) software according to [15]. 5.2 Simulator Configuration In order to utilize the latest development and support for the Network Simulator 2 (NS2), we chose ns-allinone2.1b9 as our testing version in order to test PCF, HCF, EDCF, FHCF and to implement the integrated algorithm. For more information, you can visit http://www.isi.edu/nsnam/ns/ to download the program and follow the instructions on the website to install and run it, you may also see the NS manual according [17]. We obtained the patch for PCF mode (pcf_support-2.1b8.tar.gz) from www.sm.luth.se and the patches for HCF, EDCF, and FHCF from [15]. 5.3 Topology: Just as with any other NS simulation, we begin by creating a tcl script for the wireless simulation. This file is called wireless.tcl (filename.tcl). A mobilenode consists of network components like Link Layer (LL), Interface Queue (IfQ), MAC layer. For details about these network components see section 1 of chapter 15 of [17]. At the 38 beginning of a wireless simulation, we need to define the type for each of these network components. Additionally, we need to define other parameters like the type of antenna, the radio-propagation model, the type of ad-hoc routing protocol used by mobilenodes etc. See comments in the code below for a brief description of each variable defined. The script simple-wireless.tcl begins with a list of these different parameters described above, as follows: set val(chan) set val(prop) set val(ant) set val(ll) set val(ifq) set val(ifqlen) set val(netif) set val(mac) set val(rp) set val(nn) Channel/WirelessChannel ;# channel type Propagation/TwoRayGround ;# radio-propagation model Antenna/OmniAntenna ;# Antenna type LL ;# Link layer type Queue/DropTail/PriQueue ;# Interface queue type 50 ;# max packet in ifq Phy/WirelessPhy ;# network interface type Mac/802_11 ;# MAC type DSDV ;# ad-hoc routing protocol 2 ;# number of mobilenodes Next we pass to the main part of the script that starts by creating an instance of the simulator: set ns_ [new Simulator] Then setups trace support by opening file simple.tr (filename.tr) and calls the procedure trace-all {} as follows: set tracefd [open simple.tr w] $ns_ trace-all $tracefd Also a topology object must be created to keep track of movements of mobilenodes within the topological boundary. set topo [new Topography] The mobilenodes move within a topology of 500mX500m. The topography object is provided with x and y co-ordinates of the boundary, (x=500, y=500 $topo load_flatgrid 500 500 The topography is broken up into grids and the default value of grid resolution is 1. A different value can be passed as a third parameter to load_flatgrid {} above. Next we create the object God, as follows: create-god $val(nn) 39 God (General Operations Director) is the object that is used to store global information about the state of the environment. God object stores the total number of mobilenodes and a table of shortest number of hops required to reach from one node to another. Next, we create mobilenodes. The node creation APIs has been revised and here we shall be using the new APIs to create mobilenodes. First, nodes have to be configured before creating them. Node configuration API may consist of defining the type of addressing (flat/hierarchical etc), the type of adhoc routing protocol, Link Layer, MAC layer, IfQ etc. The configuration API can be defined as follows: $ns_ node-config –addressing(Type flat or hierarchical or expanded) -adhocRouting DSDV or DSR or TORA -llType LL -macType Mac/802_11 -propType "Propagation/TwoRayGround" -ifqType "Queue/DropTail/PriQueue" -ifqLen 50 -phyType "Phy/WirelessPhy" -antType "Antenna/OmniAntenna" -channelType "Channel/WirelessChannel" -topoInstance $topo -energyModel "EnergyModel" -initialEnergy (in Joules) -rxPower (in W) -txPower (in W) -agentTrace ON or OFF -routerTrace ON or OFF -macTrace ON or OFF -movementTrace ON or OFF Next we create the mobilenodes as follows: for {set i 0} {$i < $num_nodes} {incr i} { set node_($i) [$ns_ node] $node_($i) add-ifq-send-trace $node_($i) random-motion 0 # set initial position for NAM $ns_ initial_node_pos $node_($i) 20 # Provide initial (X,Y, for now Z=0) co-ordinates set diff [expr ($i + 1) / 2] if {[expr $i % 2] == 0} { set diff [expr -$diff] 40 } $node_($i) set X_ [expr $num_nodes + $diff] $node_($i) set Y_ [expr $num_nodes + $diff] $node_($i) set Z_ 0.0 } set AP_ $node_(0) set AP_MAC [$AP_ getMacAddr] for {set i 0} {$i < $num_bss_nodes} {incr i} { $node_($i) setMac bss_id $AP_MAC $node_($i) setMac cfp $beacon_period $hcca_duration $node_($i) setMac StdHCF $std } Now that we have created mobilenodes, we need to give them a position to start with, $node_(0) set X_ 5.0 $node_(0) set Y_ 2.0 $node_(0) set Z_ 0.0 $node_(1) set X_ 390.0 $node_(1) set Y_ 385.0 $node_(1) set Z_ 0.0 From the above source code, the Node0 has a starting position of (5, 2) while Node1 starts off at location (390, 385). Next produce some node movements, #Node_(1) starts to move towards node_(0) $ns_ at 50.0 "$node_(1) setdest 25.0 20.0 15.0" $ns_ at 10.0 "$node_(0) setdest 20.0 18.0 1.0" # Node_(1) then starts to move away from node_(0) $ns_ at 100.0 "$node_(1) setdest 490.0 480.0 15.0" $ns_ at 50.0 "$node_(1) setdest 25.0 20.0 15.0" "$node_(1) setdest 25.0 20.0 15.0" means that at time 50.0s, node1 starts to move towards the destination (x=25,y=20) at a speed of 15m/s. At time $endtime, for example, the simulation shall stop. The nodes are reset at that time and the "$ns_ halt" is called at 150.0002s, a little later after resetting the nodes. The procedure stop {} is called to flush out traces and close the trace file. Below is the source code: for {set i 0} {$i < $num_nodes } {incr i} { $ns_ at $endtime "$node_($i) reset"; } $ns_ at $endtime "do_stop" 41 set delta 0.01 set endtime [expr $endtime + $delta] $ns_ at $endtime "do_halt" proc do_stop {} { global ns_ tracefd $ns_ flush-trace close $tracefd } proc do_halt {} { global ns_ puts "NS EXITING..." $ns_ halt } 5.4 Simulation output format: Generally, the output of a ns simulation is a trace file (.tr). The analysis of these trace files permits to measure several characteristics of the communication model. The figure below shows the trace format and an example trace data for a general case. Each trace line starts with an event (+, -, d, r) descriptor followed by the simulation time (in seconds) of that event, and from and to node, which identify the link on which the event occurred. The next information in the line before flags (appeared as "-----" since no flag is set) is packet type and size (in Bytes). The next field is flow id (fid) of IPv6 that a user can set for each flow at the input OTcl script. Even though fid field may not be used in a simulation, users can use this field for analysis purposes. The fid field is also used when specifying stream color for the NAM display. The next two fields are source and destination address in forms of "node.port". The next field shows the network layer protocol's packet sequence number. Note that even though UDP implementations do not use sequence number, NS keeps track of UDP packet sequence number for analysis purposes. The last field shows the unique id of the packet. Using these information simple awk or other scripting language scripts may be written in order to measure for example the average delay, the throughput etc. 42 Figure 5.1. Trace Format Example 43 Chapter 6 Experiments and Results 6.1 The simulation system and implementation The implementation in the ns of the FHCF algorithm [13] presented in the chapter 3 is described in [15]. In the current work, we have started by installing this software. Then, the integrated scheduling algorithm presented in the chapter 4 has been implemented in the FHCF package. The scheduling of FHCF has been modified to implement the integrated scheduling algorithm. The following considerations have been considered in the implementation: 1. The average of the bit rates for the different streams has been fixed to the negociated bit rate for the TC (“Traffic Category”). 2. The second order moment of the bit rates for the different streams have been fixed proportional to the square of the negotiated bit rates for the different TCs. For 64kbps voice CBR the constant factor is equal to 1.02. For the other TCs the factor is fixed equal to 1.09. 3. The duration of a TXOP cannot be negative. 4. In order to implement the constraint (Eq. 4.3), a solution of the Equation (4.6) is first found and then the set of {tk(i)} are linearly adjusted in order to satisfy that constraint. In the following, simulations are conducted to compare the three scheduling schemes: 1. EDCF 2. FHCF 3. The proposed integrated scheduling algorithm 6.2 Description of the Simulations Basically, our scheme consists of 2 different schedulers: the QAP scheduler who distributes TXOPs to the different QSTAs and the node scheduler who redistributes its allocated TXOP to the different TSs accepted in HCCA. 44 The topology used to evaluate the schedulers considers 6 nodes, each one with traffic from different priorities. This leads to a total of 7 QSTAs including the QAP with 6 QSTAs. This topology is used to evaluate the performance of the different node schedulers (uplink_node). In the conducted experiments, each QSTA is sending audio, VBR H.261 and CBR MPEG4 video traffics. This topology aims at evaluating the behavior of the different schemes in terms of fairness between the same kinds of flows and in terms of respect of QoS requirements for different HCCA loads. HCCA load has been modified by increasing the packet size of the CBR MPEG 4 traffic from 600bytes (2.4Mbps) to 1000bytes (4Mbps) using a 100byte increment and keeping the same interarrival period of 2ms. This is a time-consuming way to increase load because CBR video packets need more time to be transmitted. Another way to increase the network load is to increase the number of QSTAs in order to increase the number of collisions in EDCF. 6.3 Simulation results The experiments are conducted with the three schedulers. The results are analyzed. In the following we show the throughput versus time and the latency distribution. The Figure 6.1 shows the throughput function of time for the EDCF (Figure 6.1a), the FHCF (Figure 6.1 b) and the integrated scheduler (Figure 6.1c). Figure 6.1a: Uplink_node (Flows/Bw)/EDCF: Throughput versus time /EDCF 45 Figure 6.1b: Uplink_node (Flows/Bw)/FHCF: Throughput versus time /FHCF Figure 6.1c: Uplink_node (Flows/Bw)/Integrated scheduling: Throughput versus time / Integrated scheduling 46 The Figure 6.2 shows the latency distribution for the FHCF (Figure 6.1 a) and the integrated scheduler (Figure 6.1b). Figure 6.2a: uplink_node.latdist: Latency distribution FHCF Figure 6.2c: uplink_node.latdist: Latency distribution Integrated Scheduler 47 Looking to the Figure 6.1, it is clear that the EDCF algorithm offers a disturbed and reduced throughput, while both FHCF and the proposed algorithm offer a regular and high throughput. Actually, and comparing the global statistics over an experimental time of 19.5 seconds, the total goodput of the FHCF algorithm is 2441.62 Kbps compared to the 2442.43 Kbps for the integrated algorithm. Moreover, the FHCF algorithm delivers a maximum goodput of 3069.14 Kbps to be compared to 3084.77 Kbps for the integrated scheduler. This proves that the proposed algorithm permits to achieve the maximum throughput. Looking to the Figure 6.2, the FHCF seems to offer a reduced latency with respect to the proposed integrated scheduler. A deeper comparison shows that while the average latencies are very similar, the integrated scheduler produces higher maximum latencies. In our opinion, this is mainly due to our implementation that does not estimate precisely the first and second order moments of the TSs’ bit rates. 48 Chapter 7 Conclusions and Future Work: This document describes the work performed in the frame of the DEA project. The topic studied is the QoS in the Wireless LAN. This study is motivated by the increasing interest in wireless LANs in one hand, and the continuous development of multimedia applications in another hand. After a presentation of a bibliographical study on Wireless LAN in general and the the IEEE 802.11 in particular, the 802.11e standard is described in details as a QoS oriented wireless LAN protocol. The weakness of the EDCF scheduler in the 802.11e to cope with the variation in the traffic rates of the different applications encouraged the development of the FHCF scheduler [15]. In this work, a new scheduler is proposed and presented. This scheduler takes into consideration the fact that the dilatation of a TXOP will certainly affect the succeeding TXOPs in the SI. Therefore, an integrated consideration of all the TXOPs is needed. A theoretical derivation of the integrated scheduler is given. The Integrated scheduler is experimented and evaluated using the “Network Simulator” (ns) software. The wireless LAN simulation in ns is described. The integrated scheduler has been implemented within the ns software. This algorithm has been experimented and compared to the standard EDCF and the FHCF. While the proposed integrated scheduler provides the best throughput in general, the FHCF offers a more controlled latency deviation. The latency deviation produced by the proposed integrated scheduler is mainly due, in our opinion, to the assumptions done in the implementation. The major assumption is relative to the estimation of the moments of the bit rates which has not been done in real-time and a value is supposed available a priori. As a major perspective of this work is to integrate the bit rates’ moments estimation in the simulation. Other points must also be deepened especially the behaviour of the schedulers when the total traffic increases and to what limits it can maintain a positive effect. 49 Appendix A: Glossary CFP Contention Free Period CSMA/CA Carrier Sense Multiple Access with Collision Avoidance CW Contention Window- Used by IEEE 802.11 DCF to calculate the back off interval DCF Distributed Coordinated Function – The basic access mechanism of IEEE 802.11 DFS Distributed fair Scheduling DIFS Distributed interframe space Frame Data transmission unit in the MAC layer. Consists of a header and the data from upper layers IEEE The Institute of Electrical and Electronics Engineering IEEE 802.11 Standard for wireless LANs. Specifies medium access control (MAC) and physical (PHY) layers. IFS Interframe space ISM Industry, Science, Medical frequency band. MAC Medium Access Control PC Point Coordinator PCF Point Coordinator Function – Centralized, polling access based mechanism of IEEE 802.11 to support service differentiation. PHY Physical layer PIFS Priority interframe space AC Access Category ACK Acknowledgement AIFS Arbitration Inter Frame Spacing AP Access Point CA Collision Avoidance CAM Continuously Active Mode CAP Controlled Access Period CCI Controlled Contention Interval CCOP Controlled Contention Opportunity CDF Complementary Cumulative Distribution Function 50 CFB Contention Free Burst CFP Contention Free Period CF-Poll Contention Free - Poll CF-End Contention Free - End CP Contention Period CSMA Carrier Sense Multiple Access CW Contention Window CWmax Contention Window Maximum CWmin Contention Window Minimum DCF Distributed Coordination Function EDCF Enhanced Distributed Coordination Function FEC Forward Error Correction HC Hybrid Coordinator HCF Hybrid Coordination Function IEEE Institute of Electrical and Electronics Engineers ISM Industrial, Science, and Medical MAC Medium Access Control MSDU MAC Service Data Unit NAV Network Allocation Vector PC Point Coordinator PCF Point Coordination Function PF Persistence Factor PIFS PCF Inter Frame Space PSDU Physical (layer) Service Data Unit PSP PS-Poll QAP QoS Access Point QAPC-STA QAP-capable QSTA QBSS Quality Of Service Basic Service Set QIBSS Quality Of Service Independent Basic Service Set QoS Quality Of Service QSTA QoS station RTS/CTS Request to Send/Clear to Send SIFS Short Inter Frame Space TC Traffic Category 51 TBTT Target Beacon Transmission Time TCID Traffic Category Identifier TID Traffic Identifier TS Traffic Stream TSID Traffic Stream Identifier TSPEC Traffic Specification TXOP Transmission Opportunity WLAN Wireless Local Area Network WSTA Wireless Station 52 References: [0] Andreas Kopsel, et al, “A Performance Comparison of Point and Distributed Coordination Function of an IEEE 802.11 WLAN in the Presence of Real-Time Requirements”, Proc. Of 7th Intl. Workshop on Mobile Multimedia Communications, Oct. 23-26, 2000 [1] Anders Lindgren, et al, “Quality of Service Schemes for IEEE 802.11 A Simulation Study”, IWQoS 2001, LNCS 2092, 2001 [2] Bruce Tolley, “Ethernet in the First Mile Setting the Standard for Fast Broadband Access”, White Paper, Cisco Systems, http://www.cisco.com/warp/public/cc/so/neso/efmsol/efm_wp.htm [3] Daqing Gu and Jinyun zhang, Mitsubishi Electric Research Laboratories, "QoS Enhancement in IEEE 802.11 Wireless Local Are Networks," June 2003. [4] JVT software JM and TML, http://bs.hhi.de/~suehring/tml/download/ [5] Hayes Vic, “Tutorial on 802.11 to 802” http://grouper.ieee.org/groups/802/11/Tutorial/MAC.pdf [6] IEEE 802.11 WG, "Draft Supplement to Part 11: Wireless Medium Access Control (MAC) and Physical Layer (PHY) specifications: Medium Access Control (MAC) Enhancements for Quality of Service (QoS)," IEEE 802.11e/Draft 4.1, February 2003. [7] Imad Aad, Qiang Ni, Chadi BArakat, Thierry Turletti, "Enhancing IEEE 802.11 MAC in congested environments," in Proc. Of INSTITUT NATIONAL DE RECHERCHE EN INFORMATIQUE ET EN AUTOMTIQUE, Nº 4879. July 2003. [8] IEEE Std 802.11-1999, Part 11: Wireless LAN MAC and Physical Layer specifications, Reference number ISO/IEC 8802-11:1999(E), IEEE Std 802.11, 1999. [9] Kwang-Cheng Chen, “Medium Access Control of Wireless LANs for Mobile [10] “Overview of the IEEE802.11 Standard” http://grouper.ieee.org/groups/802/11 [11] OPNET Modular, OPNET IT Guru, http://www.opnet.com [12] P. Muhlethaler, 802.11 et les reseaux sans fil. Eyrolles, 2002 [13] Pierre Ansel, Qiang Ni, Thierry Turletti, "FHCF: a Fair Scheduling Scheme for 802.11e WLAN," in Proc. of INSTITUT NATIONAL DE RECHERCHE EN INFORMATIQUE ET EN AUTOMATIQUE, Nº 4883. July 2003. 53 [14] Priyank Garg, Rushabh Doshi, Majid Malek, Russell Greene, Maggie Cheng "HCF/EDCF NS-2 standford implementation," from http://nondot.org/~radoshi/cs444n/. [15] Pierre Ansel, Qiang Ni, Thierry Turletti, "FHCF implementation and simulations," from http://www-sop.inria.fr/planete/qni/fhcf [16] Stefand Mangold, Sunghyum choi, Ole Klein. Guide Heitz, Lothar Stibor, “IEEE 802.11e Wireless LAN for Quality of service,” in Proc. of European Wireless 2002, Feb 2003. [17] “The Network Simulator (ns-2)”, available on http://www.isi.edu/nsnam/ns. Computing”, IEEE Network, Sep/Oct 1994 [18]"Transmitting H .26L Video Traffic over 802.11 Wireless LAN –A Simulation Study,".Department of Electrical Engineering Stanford University. http://www.stanford.edu/~ponychu/ee384b/rptWangZhu.pdf 54