代写COMP4336 / 9336 Mobile Data Networking Lab 3调试Matlab程序
- 首页 >> Python编程COMP4336 / 9336 Mobile Data Networking
Lab 3: Experimental Study of Basic WiFi
Objective
The aim of this lab is to give you hands-on experience with fundamental WiFi MAC layer mechanisms. You will use MATLAB simulations to explore how inter-frame. spaces determine channel access priority and how the Distributed Coordination Function (DCF) resolves collisions through contention window backoff. A MATLAB base file will be supplied to help you complete the tasks.
By the end of the lab, you should be able to:
- Identify and compute key WiFi MAC timing parameters (SIFS, PIFS, DIFS).
- Demonstrate how inter-frame spacing prioritises different types of transmissions.
- Implement and analyse a simplified DCF simulation to observe collisions and backoff behaviour.
- Compare performance across different WiFi standards and critically evaluate the trade-offs in contention window sizes.
Task 1: Parameter Setup (0.5 marks)
Fill in the missing MAC timing parameters (SIFS, SlotTime, CWmin, CWmax) for the chosen WiFi standard (assume 2.4 GHz if multiple options are given). Then derive PIFS and DIFS using the formulas taught in lecture (express all values in seconds).
- Use the larger value ifa standard specifies two possible values.
- After filling in, run the provided MATLAB code to display the results.
Task 2: Event-Based Priority Simulation (0.5 marks)
Simulate a scenario where three transmitters attempt to access the channel immediately after a frame finishes (example: 802.11a):
- STA A: wants to send an ACK
- AP: wants to start a PCF poll
- STA B: wants to send a new data frame.
Match the correct inter-frame. space with each transmission type and observe which transmission gains channel access.
Task 3: Simplified DCF Simulation (2 marks)
Implement a simplified DCF function to simulate how stations resolve contention:
- N stations, each with NumPkts packets.
- Time divided into slots of length SlotTime.
- Backoff counters randomly chosen from [0, CW].
- Success when exactly one station transmits; collision when more than one transmits.
- Collisions trigger binary exponential backoff, doubling CW up to CWmax.
Your tasks:
- Simulate backoff and collisions for 3 stations.
- Plot the evolution of each station’s backoff counter over time.
Task 4: Comparing Standards (0.5 marks)
Run your DCF simulation for 802.11b and 802.11a, using NumPkts = 100.
- Compare completion times (slot when each station finishes).
- Record and compare the number of collisions observed.
Task 5: Short Answer - Is a Larger CW Always Better? (0.5 mark)
Based on your results from Task 4, discuss whether a larger contention window always leads to better performance. Support your answer with observations on total collisions and overall completion time.
Submission Instructions
• Submit a single PDF file containing your answers, code snippets, plots, and discussion.
• Additionally, submit your MATLAB live script. (.mlx) file used for simulations.
• Name your files as Lab3_<zID>.pdf and Lab3_<zID>.mlx (replace <zID> with your UNSW student ID).
• Submit via Moodle → Lab 3 submission link.
• Ensure that your submission includes:
- Completed parameter values and calculations for Task 1.
- Simulation code and outputs for Tasks 2–4.
- A written answer for Task 5.
• The deadline is announced on Moodle. Late submissions will incur penalties at a rate of 5% per day.