$25
In this homework, we will use the OMNeT++ network simulator to evaluate the performance of the unslotted carrier sense medium access with collision avoidance (CSMA/CA) scheme used by the well-known IEEE 802.15.4 standard discussed during class.
Background. The IEEE 802.15.4 standard addresses the physical and medium access control (MAC) layers of the networking stack and is complemented by the ZigBee specifications, which cover higher layers (i.e., network and application layers). The standard defines a Beacon-Enabled (BE) mode and a Non-Beacon-Enabled (NBE) mode. The BE mode relies on a periodic superframe bounded by beacons, which are special synchronization frames generated by coordinator nodes. In the NBE mode, on the other hand, nodes do not use beacons and use an unslotted CSMA/CA algorithm for frame transmissions.
Below, we provide a short description of the CSMA/CA algorithm used by sensor nodes to transmit data to their coordinator node.
Algorithm. Upon receiving a data frame to be transmitted, the MAC layer at the sensor node performs the following steps.
1. A set of state variables is initialized, namely the number of backoff stages carried outfor the on-going transmission (NB = 0) and the backoff exponent (BE = macMinBE).
2. A random backoff time is generated and used to initialize a timer. The backoff time isobtained by multiplying an integer number uniformly distributed in [0, 2BE−1] by the the duration of the backoff period (Dbp). As soon as the timer expires the algorithm moves to step 3.
3. A Clear Channel Assessment (CCA) is performed to check the state of the wirelessmedium.
(a) If the medium is free (i.e., the channel is perceived as free for TCCA time, the frame is immediately transmitted.
(b) If the medium is busy, state variables are updated as follows: NB = NB+1 andBE = min(BE+1,macMaxBE). If the number of backoff stages has exceeded the maximum allowed value (i.e. NB > macMaxCSMABackoffs), the frame is dropped. Otherwise, the algorithm falls back to step 2.
In this homework, we will focus on evaluating the performance of the unslotted CSMA/CA scheme in perfect channel conditions.
First Question [50pt]
Implement a module named SensorNodeCSMACA that uses the unslotted CSMA/CA scheme of the NBE IEEE 802.15.4 summarized in the previous section to access the physical channel and transmit a data packet. In order to test your module, implement a SinkNodeCSMACA module that is connected to a SensorNodeCSMACA node and collects its data. For the sake of simplicity, you may assume that if the node finds the channel free at a particular time, the CCA is passed (i.e., TCCA = 0 for the purpose of assessing whether the channel is free). Furthermore, assume the channel as binary (i.e., busy/free). Your SensorNodeCSMACA module will obtain the CSMA/CA parameters through the par(·) command passed through the .INI file of your simulation.
Second Question [25pt]
Next, extend your simulation by implementing a network composed by a SinkNodeCSMACA node connected to n SensorNodeCSMACA nodes (i.e., star network). We will study a periodic traffic scenario where every node will try to transmit 1000 packets, where each packet is transmitted every T = 5s. Sensors are assumed to be synchronized with each other (i.e., every node will attempt to transmit a packet at k · T, k ≥ 0). Implement the following performance metrics:
• Average delivery ratio (DR): defined as the ratio between the number of packets that are correctly received by the sink node and the total number of packets generated by all nodes in the network. It characterizes the reliability of the CSMA/CA scheme.
• Average packet latency (L): defined as the average value of packet latency during the reporting of an event. It characterizes the timeliness of the CSMA/CA scheme. The packet latency during the reporting of an event is defined as the average delay of successful packet transmissions occurred during the reporting of an event. You should include the packet duration Dp in the computation of the packet latency.
You should generate the following graphs:
1. Average delivery ratio (expressed as a percentage value between 0% and 100%) as afunction of network size n ∈ {5,10,20,30,40,50}.
2. Average packet latency (expressed in ms) as a function of the network size n ∈ {5,10,20,30,40,50}.
3. Average delivery ratio (expressed as a percentage value between 0% and 100%) as afunction of macMaxCSMABackoffs ∈ {1,2,3,4}. Assume n = 30, macMinBE = 3, and macMaxBE = 4.
4. Average delivery ratio (expressed as a percentage value between 0% and 100%) as afunction of macMinBE ∈ {1,2,3,4}. Assume n = 30, macMaxCSMABackoffs = 2, and macMaxBE = 4.
To generate each point of your graphs, you should perform at least 10 independent replicas, where each replica consists of at least 1000 packet attempts. Your graphs should also show, for each simulation result, confidence intervals with 95% confidence level. (Hint: Use a common parameter that you can change dynamically at simulation time to represent the channel shared by the n nodes.)
Third Question [25pt]
Implement the following performance metric:
• Average energy consumption (E): defined as the average value of the energy consumed during the reporting of the event. The energy consumed during the reporting of an event is the average energy consumed by all nodes in the network during the reporting of the event. It characterizes the energy efficiency of the CSMA/CA scheme. You should only consider energy consumption during transmission (TX) and reception (RX) mode. Therefore, consider (i) energy spent during CCA assessment (i.e., radio is in RX mode during that time); (ii) energy spent during transmission (i.e., radio is in TX mode during packet transmission.
Generate the following graph:
1. Average energy consumption (expressed in mJ) as a function of network size n ∈ {5,10,20,30,40,50}.
Simulation Parameters
The following set of CSMA/CA parameter values should be used, unless specified otherwise: macMinBE = 3, macMaxBE = 4, macMaxCSMABackoffs = 2. To run realistic simulations, we will comply to the IEEE 802.15.4 specifications and use the radio parameters of the Texas Instrument (TI) 2.4 GHz IEEE 802.15. 4/ZigBee-ready RF Transceiver CC2420 [1]. Therefore, assume as Dbp = 0.00032s, TCCA = Dbp/20·8 = 0.000128s. For energy consumption, use PRX = 56.4mW and PTX = 49.5mW, and ignore power consumption in sleep mode. Since the CC2420 radio has a bitrate of 250 Kbit/s, and the full IEEE 802.15.4 is long 133 bytes [2], set the packet duration to Dp = 4.256ms.