Step 5. Taking interference into account¶
In this step, we make our model of the physical layer a little bit more realistic. First, we turn on interference modeling in the unit disc radio. By interference, we mean that if two signals collide (arrive at the receiver at the same time), they will become garbled and the reception will fail. (Remember that so far we were essentially modeling pairwise duplex communication.)
Second, we’ll set the interference range of the unit disc radio to be 500m, twice as much as the communication range. The interference range parameter acknowledges the fact that radio signals become weaker with distance, and there is a range where they can no longer be received correctly, but they are still strong enough to interfere with other signals, that is, can cause the reception to fail. (For completeness, there is a third range called detection range, where signals are too weak to cause interference, but can still be detected by the receiver.)
Of course, this change reduces the throughput of the communication channel, so we expect the number of packets that go through to drop.
To turn on interference modeling, we set the
parameter in the receiver part of UnitDiskRadio to
Interference range is the
interferenceRange parameter of
UnitDiskRadio’s transmitter part, so we set that to 500m.
We expect that although host B will not be able to receive host A’s transmissions, those transmissions will still cause interference with other (e.g. R1’s) transmissions at host B.
Regarding visualization, we turn off the arrows indicating successful data link layer receptions, because in our case, it does not add much value above displaying the network routes.
[Config Wireless05] description = Taking interference into account extends = Wireless04 *.host*.wlan.radio.receiver.ignoreInterference = false *.host*.wlan.radio.transmitter.interferenceRange = 500m *.hostA.wlan.radio.displayInterferenceRange = true *.visualizer.dataLinkVisualizer.packetFilter = ""
Host A is transmitting packets generated by its UDP Application module. R1 is at the right position to act as a relay between A and B, and it retransmits A’s packets to B as soon as it receives them. Most of the time, A and R1 are transmitting simultaneously, causing two signals to be present at the receiver of host B, which results in collisions. When the gap between host A’s two successive transmissions is large enough, R1 can transmit a packet without collision at B.
When the packet UDPData-54 of host A arrives at host R1, it gets routed towards host B, so host R1 immediately starts transmitting it. Unfortunately, at the same time, host A already transmits the next packet (UDPData-55) back-to-back with the previous one. Thus, the reception of UDPData-54 from host R1 at host B fails due to a collision. The colliding packets are the UDPData-55 from host A and UDPData-54 from host R1. This is indicated by the lack of appearance of a blue polyline arrow between host A and host B.
Luckily, the next packet (UDPData-56) of host A is not part of a back-to-back transmission. When it gets routed and retransmitted at host R1, there’s no other transmission from host A to collide with at host B. Interestingly, the first bit of the transmission of host R1 is just after the last bit of the transmission of host A. This happens because the processing, including the routing decision, at host R1 takes zero amount of time. The successful transmission is indicated by the appearance of the blue polyline arrow between host A and host B.
This is shown in the animation below:
As we expected, the number of packets received by host B is low. The following sequence chart illustrates packet traffic between hosts A’s, R1’s and B’s network layer. The image indicates that host B only occasionally receives packets successfully; most packets sent by R1 do not make it to host B’s IP layer.
The sequence chart below shows host R1’s and host A’s signals overlapping at host B.
NOTE: On this and all other sequence charts in this tutorial, grey vertical strips are constant-time zones: all events within the same grey area have the same simulation time. Also, time is mapped to the horizontal axis using a nonlinear transformation, so that both small and large time intervals can be depicted on the same chart. A larger distance along the horizontal axis does not necessarily correspond a larger simulation time interval, because the more events there are in an interval, the more it is inflated to make the events visible and discernible on the chart.
To minimize interference, some kind of media access protocol is needed to govern which host can transmit and when.
Number of packets received by host B: 183