17
\$\begingroup\$

It's common knowledge that the further you go from a Wi-Fi network point, the slower the network over Wi-Fi gets. But why would this be the case? Radio signals propagate at essentially the speed of light, and so from signal propagation alone distance shouldn't be a factor for any reasonable range (thousands of km/miles).

My theory is that any time a network packet is sent, there's a probability that it will either not arrive at the location, will arrive with corrupted data, or will arrive in the wrong order, and this probability increases with increasing distance, forcing the TCP layer to cause packets to be sent and resent. This sending and resending process does take a quantifiable amount of time. Not enough that a single packet will provide any noticeable delay, but enough that if one in three packets needs to be resent, and then all the packets put back in the correct order at the other end, extra time will be taken. But that's just my theory. What's the real answer?

\$\endgroup\$
  • 1
    \$\begingroup\$ The problem isn't (can't and shouldn't be) solved at the TCP layer, but rather at the layer of wifi itself. It is complicated and depends on the actual wifi standard being used itself, but its a mix of retransmits at the ethernet level as well as using different physical ways to transmit data. \$\endgroup\$ – PlasmaHH Nov 24 '17 at 9:32
  • 1
    \$\begingroup\$ @PlasmaHH: You'd hope they would be using Forward Error Correction, with the amount of FEC determined dynamically. Ethernet protocols weren't designed for the bit loss you see over wireless links \$\endgroup\$ – MSalters Nov 24 '17 at 12:09
  • \$\begingroup\$ @MSalters: that would be summed up under different physical ways \$\endgroup\$ – PlasmaHH Nov 24 '17 at 12:12
  • 2
    \$\begingroup\$ @MSalters adaptive FEC choice is what Wifi does, btw. \$\endgroup\$ – Marcus Müller Nov 24 '17 at 12:51
  • \$\begingroup\$ Do you mean "slower" as in ping or "slower" as in MB/s? \$\endgroup\$ – Agent_L Nov 24 '17 at 15:13
43
\$\begingroup\$

Explanation

So, the speed of light has (practically) nothing to do with it, you're right.

WiFi chooses a transmission mode based on the quality of the link between two stations. The worse the link, the more robust the transmission needs to be. One way to get worse is to have a longer link, which means that less signal energy reaches the receiving end, which means that the ratio between noise inherent to the receiver and signal received gets worse; this is typically measured as SNR (Signal-to-Noise ratio). So, that's how distance directly comes into this.

To make a transmission more robust, there's different things that WiFi (IEEE802.11 a/g/n/ac…) does:

  1. Use a less fine modulation. If you've dealt with digital wireless communications before, you might have heard that information is transported by modulating a carrier wave with one of a set of symbols, which are basically just complex numbers. The larger that set of symbols is, the more bits you can transport with each symbol you transmit, but also, the closer these symbols are to each other. Closer means you need less noise power to accidentally end up in a different symbol. So, if your speed needs to be high, you'd typically would try to use a constellation with a lot of symbols, but then you can only tolerate very little noise compared to your received power, i.e. you need high SNR.
  2. Wireless links (generally, all non-trivial data links) employ something that we call channel coding, and especially forward error correction: It's basically adding redundancy to your data (e.g. in the shape of repeating the same data twice, or by adding a checksum, or by a lot of other means). If you're designing your channel code and your decoder cleverly, more redundancy means you can correct a lot of errors. The more redundancy, the more error correction. Downside of that, of course, is that instead of transporting more "interesting" data, you're forced to transport that redundancy. So, if you use a channel code that adds twice the amount of original data as redundancy to be able to deal with a lot of errors (see 1.), then you can only use 1/3 of your physical bit rate for actual payload bits.

Advanced Commentary

It's common knowledge that the further you go from a Wi-Fi network point, the slower the network over Wi-Fi gets.

Common knowledge, as usual, is a gross oversimplification. The general tendency is right, the further away, the less power, as explained above.

Multipath Channels means things don't go monotonically downhill with distance

But: WiFi is typically used indoors. In these settings, we have what we call a strong multipath scenario. That means that due to reflections on walls, furniture, things that happen to be in the general surroundings, you can get different kinds of signal self-interference. And that might mean that, although you're relatively close to the transmitter, your receiver might see nothing, because two paths just happen to have a way difference of half a wavelength, and cancel out each other.

So, for the typical indoor multipath, you can't generally say "the further, the worse"; it's usually far less easy. We call that phenomenon fading (and in this case, probably small-scale fading).

Channel Diversity for Robustness gains

Then: The more modern WiFi standards support MIMO (Multiple input, multiple output), which basically means you have multiple antennas on each end of a link. The idea is that from transmit antenna 1 to receive antenna 1 (let's call that 1->1) there will (with a high probability) be a different channel realization (channels are random!) than from transmit antenna 2 to receive antenna 1 (2->1), and 1->2, and 2->2, and so on.

These physically different channels can help with the fading problem mentioned above. Though the multipath channel 1->1 might, randomly, be badly hurt by cancelling itself, 1->2 might still be OK. Your average "badness probability" goes down with the number of antennas. Nice! That means the more our channels are uncorrelated (i.e. the less likely failure of one channel means that the others will also be bad), the better our transmission can be.

That also means that "very close" isn't inherently "very good", because that also means that, probably, the different antennas see pretty much the same channel realization, so you don't get that "security" of "nah, it's unlikely that all channels are bad at the same time".

Employing MIMO for fun & profit (and higher rates)

Furthermore, if you're being mathematically clever about this, you can find a mathematical description for a channel between transmit antenna \$i\$ and receive antenna \$j\$, let's call that represenation \$\mathbf h_{i,j}\$, and then simply build a matrix \$\mathbf H\$ out of these channel representations, with the row number saying which transmit antenna we're talking about, and the column number saying which receive antenna.

To see what we receive on our receive antennas when we send different signals on the different transmit antennas, we'd just go ahead and multiply a row vector \$\mathbf s\$ containing all these signals with the channel matrix \$\mathbf H\$:

$$\mathbf r = \mathbf s \mathbf H\text.\tag 1$$

Problem is that we'd probably like to have a lot of totally independent channels between transmit and receive, i.e. so that what we send on one antenna to one antenna has no effect on all the other antenna pairs. Then, we can send multiple streams of data in parallel. That will give us a serious increase in transmission speed!

Sadly, that equation above says that we somehow have to weigh and add up all the transmit signals to get each antenna's receive signal. Hm, sad.

Now, armed with that equation, the inner mathematician in us tells us that, hm, if we could could make it so that we transform \$\mathbf H\$ to some other matrix \$\mathbf \Lambda\$, we might be having actually independent channels.

That's possible if \$\mathbf \Lambda\$ is of diagonal shape, i.e. it's all zeros, but for its diagonal entries. Happy fact is that we can actually do that! There's a mathematical method that gives us

$$ \mathbf H = \mathbf{U\Lambda V^*}\tag 2$$

with \$\mathbf \Lambda\$ being diagonal; it's the singular value decomposition (SVD). So, we can rewrite \$(1)\$ to

$$ \mathbf r = \mathbf{sU\Lambda V^*}\text.\tag 3$$

Now, that's not really helping us, because although we have now just found another way of denoting our channel matrix, this formula still (replaced by some other way of writing it down) the original \$\mathbf H\$, which said that all antennas interfere with each other. But look at this magic trick: Let's multiply with \$\mathbf V\$ from the right. Since \$\mathbf V\$ is a *unitary matrix, \$\mathbf {V^*V}=\mathbf I\$:

$$\begin{align} \mathbf {rV} &= \mathbf{sHV}\tag 4\\ &=\mathbf{sU\Lambda V^*V}\tag 5\\ &=\mathbf{sU\Lambda I}\tag 6\\ &=\mathbf{sU\Lambda}\tag 7\\ \end{align}$$

Niiiiice. Read \$(7)\$ again, aloud:

If if we multiply the receive signal with \$\mathbf V\$, our channel effect is actually reduced to a diagonal matrix, and we can send arbitrary \$\mathbf s\$ over that channel, if we just first multiply them with \$\mathbf U\$. Diagonal matrix means we just get as many independent channels as there's diagonal entries, i.e. \$\min(\$receive antennas, transmit antennas\$)\$).

So, the algorithm becomes pretty easy:

  1. Measure \$\mathbf H\$, i.e. the channel matrix containing all channels on all antenna parts. This is actually the hardest part.
  2. Do the SVD on \$\mathbf H\$, giving us \$\mathbf{U\Lambda V^*}\$.
  3. On the transmitter side, multiply our intended transmit signal \$\mathbf s\$ with \$\mathbf U\$.
  4. On the receiver side, multiply our receive signal \$\mathbf r\$ with \$\mathbf V\$.

This all only works if the SVD gives good results, and that only happens when the physical antenna pair channels are independent enough. That means that for MIMO, close proximity means you can actually potentially transmit even less than for a medium distance, because distance means that there's more different, random reflectors on the way. (After some distance, the path loss effects dominate, and you always get worse.)

\$\endgroup\$
2
\$\begingroup\$

The problem is not the time it takes to go from the emitter (router) to the receiver (your laptop) that as you say is negligible with a few meters, but the power that arrives with distance.

Take a look into Friis formula.

enter image description here

Network throughput is the rate of successful message delivery over a communication channel. With less power received, the chances that a message is not correctly received are higher.

Noise is something to take into account here.

\$\endgroup\$
  • \$\begingroup\$ I can clearly see that this relates to a time delay. \$\endgroup\$ – Harry Svensson Nov 24 '17 at 14:05
  • 3
    \$\begingroup\$ Why should lower power make the connection slower? \$\endgroup\$ – Finbarr Nov 24 '17 at 14:09
  • \$\begingroup\$ network throughput is the rate of successful message delivery over a communication channel. With less power received, the chances that a message is not correctly received are higher. Noise is something to take into account here. \$\endgroup\$ – Daniel Viaño Nov 24 '17 at 14:47
  • 3
    \$\begingroup\$ This answer needs link to en.wikipedia.org/wiki/Shannon%E2%80%93Hartley_theorem , which gets the channel capacity (bits per second) from the signal power (calculated in this answer) divided by noise power (assumed constant). \$\endgroup\$ – jpa Nov 24 '17 at 19:18
  • 1
    \$\begingroup\$ Lower power means less chance that the signal power will exceed the noise power. \$\endgroup\$ – user6030 Dec 5 '17 at 23:25
2
\$\begingroup\$

The fundamental loss with distance vs frequency is mainly the aperture area size of the carrier f proportional to the square of the wavelngth. Hence path loss is less for lower frequencies which is the dominant term in Friis Loss.

The 2nd most common problem is the orientation of both antenna and losses in radiation pattern but this is less frequency dependent but the torroidal pattern of 1/4 wave resonators and dipoles. The minimum signal or null pattern is looking down the end of the antenna.

The conductive and dielectrics in some building materials allow signals to be reflected all over the place. However this is also a problem for Rice Fading losses in fringe signal levels < -80dBm for class B signals and starts to be a problem above this. Line of sight without ground reflections from water is the optimal transmission path for microwave. However for VHF and lower , a large body of water and the ionosphere act as reflectors to boost range of a signal. But for higher frequencies , the reflections lead to more distorted signals and cause Ricean Fading errors.

Each band has it's own error threshold and wider band high speed WiFi using 20MHz or 40MHz has a higher threshold due to Shannon's Laws on SNR vs noise bandwidth vs BER. The best threshold is usually the lowest data rate but depends on the design. I always lock my WiFi chip options to 11Mbps in Windows to get higher thruput in fringe signal levels than auto mode because even human motion around the paths can cause packet loss and hidden retries at the higher data rates like 54MBps and up. Again Shannon's laws apply here from Ricean Fading effects and fundamental Friis Loss effects.

In auto mode a WiFi chip will always try to lower the data rate automatically by the mobile modem when the packet loss is too high. First it may try to retrain the receiver for group delay equalization. Then negotiate a lower data rate if the error rate is too high. This follows from Shannon's law. But remember that these echos and Rice Fading affects this group delay equalization and moving the Wifi Antenna forces retraining where there are a lot of echoes in a building at low signal levels. The result of changes in carrier echo strength is to distort the eye pattern in demodulated signals.

My experience tells me that the farther your endpoints are between mobile and WiFi Router, the more chance there is for reflections and more chance for reflections to cancel and more drop-outs. This is called Rice Fading and is the most common cause from my test results for packet loss in fringe field levels below -75dBm.

The signals below for net and dlink-guest are from my PC upstairs with a WiFi dongle on a tower and a high power Dlink router downstairs put into a drawer. Moving the antenna in the router caused it to change signal levels and switch channels and from net to guest without user awareness of momentary loss of connectivity. enter image description here

\$\endgroup\$

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.