alt text 

Experiment II: A Compressed Video Source Model

Ahmet Sekercioglu and Leon Seng

Objectives

In 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!).

Experiment

Our 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 transmission time 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:

  • On average a video client generates 800 kb/s.

  • On average the sum of one active and one idle period is 1/20 s, and active period is half of the idle period.

  • On average each packet size is 300 bytes (2400 b).

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:

  • Is your model generating 800 kb/s on average?

  • Is the average packet size 300 bytes?

  • Is the idle/active period ratio close to what you expect?

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()):

  • idle periods

  • active periods

  • number of packets generated in an active period

  • pause periods

Remember to include axis labels in your plots. Do they look as expected?

Show the output to your lab demonstrator.

Your Report

After 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).


Ahmet's Home