Turn Taking CSMA Protocol

18 views
Skip to first unread message

Osman Malik

unread,
Jan 12, 2017, 4:40:22 PM1/12/17
to ns-3-users
I am trying to implement a simple turn taking (TTP) MAC protocol based upon the csma-net-device.cc. Each node takes turns to transmit data. Turn order is pre-determined and a station only transmits when it receives(hears) a packet from its predecessor in that order list. However, when I compare my TTP flowmon results to the example csma flowmon results, there is no significant difference between the two protocols in throughput or average delay. I have tried many simulations with a range of nodes (2, 5, 10,15, 20, 30). Is my implementation correct?


The topology is:

-------------------------------------------------------
    |         |          |          |          |
    n1      n2       n3        n4       n5

Assumptions are that the network is fully connected (all stations can hear each other's transmissions, whether they are intended destination or not) and equidistant from each other (propagation delay is the same for all paths).

For simplicity, I have assigned n1 to n5 IP addresses 10.0.0.1 to 10.0.0.5 respectively. I also assume that the MAC address of these nodes will be 00:00:00:00:00:01 to 00:00:00:00:00:05 respectively.

The protocol (for 5 nodes) is such that:
10.0.0.1 transmits a queued packet to 10.0.0.2;
Once 10.0.0.2 receives from 10.0.0.1, it transmits a queued packet to 10.0.0.3
Once 10.0.0.3 receives from 10.0.0.2, it transmits a queued packet to 10.0.0.4
...
Once 10.0.0.5 receives from 10.0.0.4, it transmits queued packets to 10.0.0.1

If a station does not have a queued packet and its turn arrives, a dummy packet based on the last queued packet is sent instead to the correct MAC address to continue the circle.

The question is, is my pseudocode implementation correct?

SendFrom()
    ...
    enqueue packet passed by ipv4 interface    
    
    if (first packet in simulation)
           ...
           TransmitStart()
return;

TransmitStart() etc. unchanged. Only TransmitReadyEvent() changed. Removed code that retrieves next packet in queue and transmits.

Receive()
    ...
    if (current device address == destination address on header)
           if (queue is empty)
                    create dummy packet with suitable header
                    send dummy packet
           else
                    dequeue next packet and transmit (just like the TransmitReady Event)
return;


I will upload the source code and results later. Any insight would be helpful. Thanks.

Tommaso Pecorella

unread,
Jan 14, 2017, 8:23:15 PM1/14/17
to ns-3-users
Hi,

the pseudocode seems to be right (but I could be wrong). Of course there could be any type of implementation error.

About the difference in the results, instead of changing the number of nodes, try increasing the data rate of the applications. A token passing system should be able to carry more data close to the saturation case, while a contention system like csma should suffer a bit more.

T.

pdbarnes

unread,
Jan 15, 2017, 3:49:51 PM1/15/17
to ns-3-users
Does ns-3 CSMA have contention and backoff? Or just CA collision avoidance? If it's just CA shouldn't it produce the same throughput as token passing?

P

Reply all
Reply to author
Forward
0 new messages