CS计算机代考程序代写 scheme chain algorithm First Homework

First Homework
EECE 5155 – Wireless Sensor Networks and the Internet of Things
Due Date: March 10, 2021, 9AM EST
In this homework, we will use the OMNeT++ network simulator to evaluate the perfor- mance 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 specifica- tions, 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 re- lies 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 out for 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 is obtained 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 wireless medium.
(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 and BE = 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.
1

In this homework, we will focus on evaluating the performance of the unslotted CSMA/CA scheme in perfect channel conditions.
First Question [60pt]
By starting from the TicToc example, 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 [40pt]
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 a
function 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 a function of macMaxCSMABackoffs ∈ {1,2,3,4}. Assume n = 30, macMinBE = 3, and macMaxBE = 4.
2

4. Average delivery ratio (expressed as a percentage value between 0% and 100%) as a function 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 (Optional) [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.
Important Remarks and Grading Policy
The primary target of this homework is to elicit your creativity in writing network simula- tions. Therefore, some of the specific implementation details have been omitted on purpose, and left for you to decide as you are writing your own simulation code. Furthermore, as explained in class, simulations depend on a lot of factors (i.e., choice of initial seeds, number of runs, etc). Your homework will be evaluated by following these criteria, listed in order of importance:
3

1. Functionality (i.e., does your simulation code compile and run?)
2. Correctness of implementation (i.e., is your implementation of the IEEE 802.15.4
CSMA/CA algorithm correct?)
3. Correctness of results (i.e., did you get reasonable results in terms of delivery ratio, latency, and energy consumption, as compared to the research paper indicated by the instructor? Do your graphs have confidence intervals? Are those intervals reasonable in terms of span?)
4. Modularity of implementation (i.e, is your code understandable, modular, and clean? Did you write enough comments in the code?)
For point 3 (correctness of results), we will use the results obtained in [3] as reference (see Figures 7-9 and 15-16). Although a perfect match is not (and should not) be expected, your simulation results should be close to the ones obtained in [3]. In particular, we will consider point 3 fully accomplished if the results are within 15% of the results in [3]. For example, if in [3] the delivery ratio value in a particular configuration is 0.80, your results should be in the range [0.68, 0.92].
Submission Instructions
Please submit your assignment using Canvas. You should upload the following files: (i) Two (or three, if addressing the third question) .ZIP files containing your simulation code (including every .INI and .NED files) for each homework question; (ii) A .PDF file containing (a) your simulation results, including confidence intervals, both in graphical and tabular form; and (b) a short description of your simulation results and your interpretation of the results you obtained. Late submissions will not be accepted.
References
[1] Texas Instruments, “CC2420: 2.4 GHz IEEE 802.15. 4/ZigBee-ready RF Transceiver,” Available at http://www.ti.com/lit/ds/symlink/cc2420.pdf, 2006.
[2] G. Shi and K. Li, “Fundamentals of ZigBee and WiFi,” in Signal Interference in WiFi and ZigBee Networks, pp. 9–27, Springer, 2017.
[3] D. De Guglielmo, F. Restuccia, G. Anastasi, M. Conti, and S. K. Das, “Accurate and Ef- ficient Modeling of 802.15.4 Unslotted CSMA/CA through Event Chains Computation,” IEEE Transactions on Mobile Computing, vol. 15, pp. 2954–2968, Dec 2016.
4