ObjectivesIn this lab, we will strenghten our knowledge on Python generators and SimPy environment by creating a variable bit rate (VBR) packet generator model (these kinds of models are widely used for modeling the behaviour of video conferencing participants). We will keep the model very simple (they can get quite complex though!). ExperimentOur starting point is the example we discuss in the lectures: import random def bursty_traffic_gen(env): while True: print('%d --> Entered the idle period' % env.now) idle_duration = random.normalvariate(20.0, 2.0) yield env.timeout(idle_duration) print('%d --> Entered the active period' % env.now) active_duration = random.normalvariate(9.0, 2.0) yield env.timeout(active_duration) In the model above, we have only two states: active and idle. The idle and active periods are drawn from Gaussian distributions (provided by the Python random library). In the new model, we will split the active period into packet (transmission) and pause periods. Packet sizes will be drawn from a Poisson distribution, and pause time between the two packets will be drawn from an exponential distribution. We know the following:
Based on the above information you will need to calculate the parameters you feed into the distributions (above information is not sufficient to calculate the standard deviation parameter of the Gaussian distribution since we don't have empirical data, so you choose a suitable value based on your best guess). Don't forget to include these calculations in your report. Develop your VBR source model, by using the bursty_traffic_gen as your starting point, include the necessary lines to calculate the following to verify the results:
Run your script sufficiently long time to collect data for at least a few hundred active periods. Show the output to your lab demonstrator. Plot the following histograms in a single matplotlib figure window with a 2x2 arrangement (See matplotlib.pyplot.subplot()):
Remember to include axis labels in your plots. Do they look as expected? Show the output to your lab demonstrator. Your ReportAfter finishing your experiments, you will need to prepare a short (maximum two pages, 10 pt Times-Roman font) report summarizing the key points you have learned in this exercise. Please convert your report to PDF (no other formats will be accepted), zip your report with all the Python code you have written for the experiment, and upload all as a single zip file to the unit's Moodle site before the due date (we will post the deadlines at the unit's Moodle site). |