Link Layer; Media Access Control Y. Richard Yang 1/27/2009
Outline Admin. and recap Intro to link layer Media access control
Admin. Office hours posted on course information page Any questions on hw 1?
Recap: ISI ISI: one symbol spreads to other symbols e.g., each symbol is 1 ms delay spread is 3 ms then one symbol spreads to 3 symbols Solution techniques extract the symbols despite ISI: equalization reduce symbol rate: OFDM
Recap: Equalization Problem: given received y sequence, determine the most likely transmitted x sequence (maximum likelihood detection): Using Viterbi algorithm to identify the x sequence effectively Maximum likelihood detection is commonly used in communications and networks y[1] = x[1] h0 + w[1] y[2] = x[2]h0 + x[1] h1 + w[2] y[3] = x[3]h0 + x[2]h1 + x[3] h2 + w[3] y[4] = x[4]h0 + x[3]h1 + x[2] h2 + w[4] y[5] = x[5]h0 + x[4]h1 + x[3] h2 + w[5] … y[L] = x[L]h0 + x[L-1]h1 + x[L-2]h2 + w[L] y[L+1] = x[L]h1 + x[L-1]h2 + w[L+1] y[L+2] = x[L]h2 + w[L+2]
Recap: Orthogonal Frequency Division Multiplexing (OFDM) Uses multiple carriers modulation (MCM) each subcarrier uses a low symbol rate reduce symbol rate and reduce ISI for N parallel subcarriers, the symbol time can be N times longer spread symbols across multiple subcarriers also gains frequency diversity Uses orthogonal frequencies to avoid large guard band if frequencies are chosen so that an integral number of cycles in a symbol period, they are orthogonal
OFDM Encoding/Decoding (BPSK) During one symbol time, we transmit at N subcarriers Example: how the receiver recovers x1(t): it computes correlation between y(t) and sin(2f1t) fsymbol=1/T
OFDM Decoding fsymbol=1/T Assume f1 = 1671 fsymbol, f2 = 1672 fsymbol sin(a)sin(b) = ½(cos(a-b)-cos(a+b)) OFDM Decoding consider fsymbol=1/T Assume f1 = 1671 fsymbol, f2 = 1672 fsymbol
Example: 802.11a OFDM fsymbol = 312.5 KHz (symbol time?) N = 64 (useful N = 52) 312.5 * 64 = 20 MHz Channel 40 : [5.200 – 5.220] GHz Can 802.11a OFDM have a subcarrier at 5.200 GHz? Channel 44 : [5.220 – 5.240] GHz
OFDM Implementation: FFT channel
Outline Recap Introduction to link layer
Link Layer Services Framing: Flow control: encapsulate bits into frame, adding header, trailer multiplexing: frame header to identify source, dest example: MAC address error detection and correction Flow control: pacing between adjacent sending and receiving nodes Link access (interference and quality of service control) media access control (also called multiplexing)
Outline Recap Introduction to link layer Error detection and correction
Reed-Solomon Codes Very commonly used, send n symbols for k data symbols e.g., n = 255, k = 223 We will discuss the original version (1960) modern versions are slightly different; they use generator polynomial, but the idea is essentially the same If the data we want to send is (x0, x1,…, xk-1), where xi are data symbols, define polynomial P(t) = x0 + x1t + x2t + …xk-1tk-1 Assume is a generator of the symbol field (i.e., i not equal to j if i not equal to j) Then for the data sequence, send P(0), P(), P(2), P(n-1) to receiver
since any k equations are independent, they have a unique solution Reed-Solomon Codes Receive the message P(0), P(), P(2), P(n-1) If no error, can recover data from any k equations: since any k equations are independent, they have a unique solution
Reed-Solomon Codes: Handling Errors But, what if s errors occur during transmission? Keep a counter (vote) for each solution Enumerate all combinations of k equations, for each combination, solve it, and increase the counter of the solution Identify the solution which gets the largest # of “votes”
Reed-Solomon Codes The transmitted data is the correct solution for n-s equations, and thus gets votes (i.e., combinations of k equations) An incorrect solution can satisfy at most k-1+s equations, and the # of votes it can get is at most:
Reed-Solomon Codes If or (n-s > k – 1 + s) or (n-k > 2s – 1) or (n-k s), it can correct any s errors
Reed-Solomon Codes The voting-based decoding algorithm proposed in 1960 is inefficient 1967 - Berlekamp introduced first truly efficient algorithm for both binary and nonbinary codes. Complexity increases linearly with number of errors 1975 - Sugiyama, et al. Showed that Euclid’s algorithm can be used to decode R-S codes Below is a typical current decoder
Outline Recap Introduction to link layer Error detection and correction Media access control
Dimension for multiplexing Multiple Access Control Dimension for multiplexing Frequency Time Space Code Two transmissions cannot conflict in all dimensions !
FDMA FDMA: frequency division multiple access Channel divided into frequency bands A transmission uses a frequency band frequency bands time 5 1 4 3 2 6
TDMA TDMA: time division multiple access Time divides into frames; frame divides into slots A transmission uses a slot in a frame
Q: why not divide into infinite small cells? SDMA SDMA: space division multiple access Transmissions at different locations, if far enough, can transmit simultaneously (same freq.) Example: the cellular technique 1 2 3 4 Suppose 24 MHz spectrum, 30 K per user #user supported: = Using cell #user supported: = Q: why not divide into infinite small cells?
CDMA CDMA (Code Division Multiple Access) Unique “code” assigned to each user; i.e., code set partitioning All transmissions share the same frequency and time; each transmission uses DSSS, and has its own “chipping” sequence (i.e., code) to encode data e.g. code = -1 1 1 -1 1 -1 1 Examples: Sprint and Verizon, 3G WCDMA and CDMA2000
DSSS Revisited tb: bit period tc: chip period tb user data d(t) 1 -1 X code c(t) -1 1 1 -1 1 -1 1 -1 1 1 -1 1 -1 1 = resulting signal -1 1 1 -1 1 -1 1 1 -1 -1 1 -1 1 -1 tb: bit period tc: chip period
Illustration: CDMA/DSSS Using BPSK Assume BPSK modulation using carrier frequency f : yi(t) = A xi(t)ci(t) sin(2 ft) A: amplitude of signal f: carrier frequency xi(t): data of user i in [+1, -1] ci(t): code of i (a chipping sequence in [+1, -1]) Suppose only i transmits y(t) = yi(t) Decode at receiver i incoming signal multiplied by ci(t) sin(2 ft) since, ci(t) ci(t) = 1, yi(t)ci(t) sin(2 ft) = A xi(t) sin2(2ft)
Illustration: Multiple User CDMA Assume M users simultaneously transmit: y(t) = y1(t) + y2(t) … + yM(t) At receiver i, incoming signal y(t) multiplied by ci(t) sin(2 ft) consider the effect of j’s transmission yj(t)ci(t) sin(2 ft) = A cj(t)ci(t)xj(t) sin2(2 fct)
CDMA: Deal with Multiple-User Interference Two codes Ci and Cj are orthogonal, if , where we use “.” to denote inner product, e.g. If codes are orthogonal, multiple users can “coexist” and transmit simultaneously with minimal interference C1: 1 1 1 -1 1 -1 -1 -1 C2: 1 -1 1 1 1 -1 1 1 -------------------------------------------------- C1 . C2 = 1 +(-1) + 1 + (-1) +1 + 1+ (-1)+(-1)=0 Analogy: Speak in different languages!
Capacity of CDMA B In realistic setup, cancellation of others’ transmission is incomplete Assume the received power at base station from all nodes is the same P (how?) The power of the transmission with known code is increased to N P, where N is chipping expansion factor The others remain on the order of P Assume a total of M users Then For IS-95 CDMA, N = 1.25M/4800 = 260
Generating Orthogonal Codes The most commonly used orthogonal codes in current CDMA implementation are the Walsh Codes Property of Walsh : every row is orthogonal to every other row and the log NOT of every other row
Walsh CDMA Code Assignment 1,1,1,1,1,1,1,1 1,1,1,1 ... 1,1,1,1,-1,-1,-1,-1 1,1 1,1,-1,-1,1,1,-1,-1 ... 1,1,-1,-1 X,X 1,1,-1,-1,-1,-1,1,1 1 X 1,-1,1,-1,1,-1,1,-1 X,-X ... 1,-1,1,-1 1,-1,1,-1,-1,1,-1,1 1,-1 n 2n 1,-1,-1,1,1,-1,-1,1 ... 1,-1,-1,1 1,-1,-1,1,-1,1,1,-1 1 2 4 8 If user 1 is given code [1,1,-1,-1], what codes can we give to other users?
WCDMA Orthognal Variable Spreading Factor (OSVF) Flexible code (spreading factor) allocation up link SF: 4 – 256 down link SF: 4 - 512 1,1,1,1,1,1,1,1 1,1,1,1 ... 1,1,1,1,-1,-1,-1,-1 1,1 1,1,-1,-1,1,1,-1,-1 ... 1,1,-1,-1 X,X 1,1,-1,-1,-1,-1,1,1 1 X 1,-1,1,-1,1,-1,1,-1 X,-X ... No parent-child on the code tree 1,-1,1,-1 1,-1,1,-1,-1,1,-1,1 1,-1 SF=n SF=2n 1,-1,-1,1,1,-1,-1,1 ... 1,-1,-1,1 1,-1,-1,1,-1,1,1,-1 SF=1 SF=2 SF=4 SF=8
W-CDMA Down Link Capacity
Summary SDMA, TDMA, FDMA and CDMA are basic media partitioning techniques divide media into smaller “pieces” (space, time slots, frequencies, codes) for multiple transmissions to share A remaining question is: how does a network allocate space/time/freq/code?
General Allocation Problem Each transmission i (si->di) is specified by transmission power pi time ti frequency band fi code ci Given any two transmissions (si->di; pi, ti, fi, ci) and (sj->dj; pj, tj, fj, cj), we can determine if they conflict MAC scheduling problem: to maximize resource efficiency to allocate resource fairly to satisfy app requirements e.g. real time app (such as VoIP) need access with a bounded delay e.g. s wants to talk to d, but cannot reach d directly
MAC The general case is challenging and largely still open We start with the simplest scenario (e.g., 802.11 or cellular up links) in this class: time sharing the same frequency and code a single receiver (the Access Point)
How to do Time Sharing? Fixed allocation Centralized authority, e.g., polling Taking turns, e.g., token passing Distributed random access discussion: compare the schemes in terms of efficient utilization of resources delay to access channel quality of service (e.g., a guaranteed rate)
Pros and cons of slotted Aloha? Random Access: Slotted Aloha B Time divided into slots get a frame repeat: at each slot transmit with probability p; until no collision A B C E S Pros: simple Cons: clock sync; low efficiency Used in GSM initial access channel How big should a slot be? Pros and cons of slotted Aloha?
Pros and Cons of Slotted Aloha Pros: simple Cons: need clock sync low efficiency: utilization at ~1/e
Backup Slides
Forward Error Correction Code: Block Erasure Code Basic idea: encode k symbols to n symbols so that if the receiver receives any k symbols, it can recover the original x y
FEC/Block: Example Implementation Suppose data signal is x, and the encoded signal y = Gx, where G is the generator matrix; assume receives only a subset of y The y-symbols in yellow are received; other y-symbols are dropped by demodulator
FEC: An Example using Vandermonde Matrix Suppose gij are the entries after the identify matrix gij= aij-1, where ai are distinct numbers Suppose k=3, and n=5
An Example using Vandermonde Matrix Suppose y2 and y3 are dropped, then we have y1, y4, and y5. Given the relationship (we know they are y1, y4, y5) Since the matrix is not singular, we can recover x1, x2, and x3 from y1, y4, y5
Other Codes Many other types of codes are commonly used in networks, e.g., Reed-Solomon codes where we consider each symbol (e.g., 8 bits) as the coefficient of a polynomial, c(x) is the parity check polynomial representing the parity correction symbols, d(x) the data polynomial, and g(x) the generator polynomial in the format:
CSMA + Exponential Backoff + RTS/CTS/DATA/ACK Summary Use RTS/CTS for virtual carrier sense Use ACK to improve reliability Missing CTS/ACK triggers exponential backoff Protocol begin: while (channel busy) wait if channel idle send RTS if receive CTS send DATA wait for ACK if ACK return exponential backoff wait for the backoff period goto begin;