Used by Many US Carriers
CDMA uses chipping codes to uniquely encode the signal from one phone.
In [64]:
import random
code1 = array( (1,1,1,-1,1,-1,-1,-1) )
code2 = array( (1,-1,1,1,1,-1,1,1))
vdot(code1,code2)
Out[64]:
In practice the codes are much larger.
In [51]:
bit1 = -1 * code1
bit2 = 1 * code1
print bit1
print bit2
bar(range(8),bit1)
Out[51]:
Now, on the receivers end, we take the incoming chipping vector, and do the dot product with the code and divide by the length of the vector.
In [52]:
print vdot(bit1,code1)/8
print vdot(bit2,code1)/8
TADA!! We have our bits back. What happens if one or two of the chips get messed up?
In [53]:
flip = random.randrange(8)
print bit1
print 'flipping ', flip
bit1[flip] *= -1
print bit1
print vdot(bit1,code1)/8.0
Alright, how does this help in multiplexing multiple signals??
In [54]:
s1b1 = -1 * code1
s1b2 = 1 * code1
s2b1 = 1 * code2
s2b2 = -1 * code2
bit1 = s1b1 + s2b1
bit2 = s1b2 + s2b2
print bit1
print bit2
bar(range(8),bit1)
Out[54]:
In [55]:
print vdot(bit1,code1)/8
print vdot(bit1,code2)/8
In [65]:
code3 = array((1,-1,-1,-1,1,1,1,-1))
code4 =array((-1,1,1,1,1,1,1,-1))
vdot(code3,code4)
Out[65]:
In [68]:
bit11 = -1 * code1
bit12 = -1 * code2
bit13 = 1 * code3
bit14 = -1 * code4
signal = bit11+bit12+bit13+bit14
bar(range(8),signal)
print vdot(signal,code1)/8.0
print vdot(signal,code2)/8.0
print vdot(signal,code3)/8.0
print vdot(signal,code4)/8.0
Ad-hoc versus infrastructure
Joining a Wireless Network
802.11 MAC Protocol -- CSMA / CA
BUT -- No guarantees that this will avoid collisions.
So, we try to minimize the chance of a collision when we have a lot of data to send by using RTS / CTS -- This lets you reserve the channel for a period of time.
When a CTS is heard for another sender you must wait until you see the ACK for that data. - this fixes the hidden terminal problem by relying on the AP to send out the CTS.
$\frac{\frac{X}{11\times10^6}}{\frac{X}{11\times10^6}+789\times 10^{-6}}$
Where the 789 microseconds is the overhead for SIFS etc.
For
BUT -- This is for a single sender with NO collisions or interferece. Typical efficiency is around 30%
In [ ]: