EEE413辅导、讲解Python程序、辅导Python编程、讲解Bucket Filter
- 首页 >> Python编程EEE413 DATA COMMUNICATION AND COMMUNICATIONS NETWORKS - COURSEWORK 2 1
Coursework 2: Traffic Shaping with Token Bucket Filter
Kyeong Soo (Joseph) Kim
Department of Electrical and Electronic Engineering
Xi’an Jiaotong-Liverpool University
23/11/2018
I. INTRODUCTION
In this assignment, you are to carry out a series of simulations for a token bucket filter (TBF) traffic
shaper based on token and leaky buckets with a periodic on-off traffic.
II. TOKEN BUCKET FILTER AND ON-OFF TRAFFIC
Here we discuss a TBF traffic shaper — the combined leaky bucket and token bucket discussed during
the lectures — and its design for allowing the periodic on-off traffic shown in Fig. 1 to pass through it
without shaping.
Fig. 1. A periodic on-off traffic pattern.
Below are the TBF parameters:
Token generation rate: ρ MB/s.
Token bucket capacity: C MB (full when the first burst arrives).
Peak output rate: 10 MB/s (same as the input rate).
The TBF design is done in the following three steps using a fluid model1
:
1) First, we find the minimum value of the token bucket capacity C — in terms of ρ — for the first
burst to pass through the TBF without shaping.
Because the maximum burst length S in second is given by
S =
C
10 ρ
,
the condition for C that allows the first burst with the duration of 0.001 s (i.e., 1 ms) to pass through
is
0.001 ≤ S =
C
10 ρ
0.01 0.001ρ ≤ C.
1
In a fluid model, traffic arrivals are assumed to be continuous like liquid flows rather than discrete (e.g., packets and frames).
EEE413 DATA COMMUNICATION AND COMMUNICATIONS NETWORKS - COURSEWORK 2 2
Therefore the minimum token bucket capacity is (0.01?0.001ρ) MB.
2) Second, given the minimum value of C from 1), we find the minimum (numerical) token generation
rate ρ for the second burst (and therefore all bursts) to pass through the TBF without shaping.
With the minimum value of C from 1), the token bucket becomes empty at the end of the first
burst. For the second burst to pass through it, therefore, the token bucket should be full again by the
beginning of the second burst. This means that the amount tokens generated during the off period
(i.e., 1 ms=0.001 s) should be equal to or greater than the token bucket capacity, i.e.
0.001ρ ≥ 0.01 0.001ρ
ρ ≥
0.01
0.002
= 5.
Therefore the minimum token generation rate is 5 MB s?1
.
3) Finally, from the results of 1) and 2), we obtain the minimum token bucket capacity of 5 kB
(= (0.01 ? 0.001×5) MB).
III. TASK: SIMULATION OF A TBF-BASED TRAFFIC SHAPER WITH ON-OFF TRAFFIC
1) (10 points) Based on the sample code for the object-oriented implementation of M/M/1 queueing
system, you are to implement a TBF traffic shaper and a packet generator for the periodic on-off
traffic shown in Fig. 1.
We assume the following for simulations:
There is no propagation delay.
Transmission rates are set to 10 MB s?1
for both packet generator and TBF.
The packet generator generates 1000-B packets back to back during the on period (i.e., no gap
between packets).
In the simulations, arrivals are discrete (i.e., not using the fluid model): When a packet arrives
at the TBF,
– If the amount of tokens in the token bucket is equal to or greater than the packet size, it can
pass the TBF immediately.
– Otherwise, the packet should wait until there are enough tokens generated.
TBF parameter values are set to those given by the analysis based on the fluid model in Sec. I.
During the simulation, the delay of each packet should be displayed on the screen and also recorded
at the packet sink; the average delay is calculated at the end of the simulation.
2) (5 points) If the average packet delay from the simulation in 1) is two times of the packet transmission
time (i.e., 0.2 ms=2×(1000 B/10 MB s?1
)×(1000 ms/1 s)), we can conclude that there has been no
traffic shaping at the TBF; otherwise, it must be that some packets have been delayed at the TBF
due to traffic shaping.
Answer the following based on your simulation results from 1):
What is your conclusion (i.e., the on-off traffic passing through the TBF with or without
shaping)?
If packets are shaped at the TBF, explain why. Also, find TBF parameters allowing packets to
pass through the TBF and show that they work (i.e., no shaping) through another simulation
with the newly-designed parameters.
IV. DELIVERABLES
You need to submit the following through the ICE by 9 am, Monday, 24/12/2018.
EEE413 DATA COMMUNICATION AND COMMUNICATIONS NETWORKS - COURSEWORK 2 3
A coursework report.
Source code for the simulation programs.
Scripts for plotting and post-processing, if any (e.g., Python with matplotlib, gnuplot, and MATLAB).
As part of the report, you must provide detailed instructions how to run the simulations so that TA
can reproduce your results on his computer (as in the slide #64 of “Network Simulation Based on
Python/SimPy”).