Jobs (e.g messages) arrive randomly at rate $1.0$ per minute at a
2-server system. Mean service time is $0.75$ minutes and the
service-time distribution is (1) exponential, (2) Erlang-5, or (3)
hyperexponential with $p=1/8$,$m1=2.0$, and $m2=4/7$. However no
queue is allowed; a job arriving when all the servers are busy is
rejected. Develop and run a simulation program to estimate the probability of
rejection (which, in steady-state, is the same as $p(c)$) Measure
and compare the probability for each service time distribution.
Though you should test the program with a trace, running just a few
jobs, the final runs should be of 10000 jobs without a trace. Stop
the simulation when 10000 jobs have been generated. Use the random
number stream 1 for all runs.
Imported modules
|
|
from SimPy.Simulation import *
from __future__ import generators
from random import Random, expovariate, uniform
|
Functions
|
|
ErlangVariate
HyperVariate
bcc
erlangB
main
testHyperVariate
|
|
ErlangVariate
|
ErlangVariate (
mean,
K,
g,
)
Erlang random variate
mean = mean
K = shape parameter
g = rv to be used
|
|
HyperVariate
|
HyperVariate (
p,
m1,
m2,
g,
)
Hyperexponential random variate
p = prob of branch 1
m1 = mean of exponential, branch 1
m2 = mean of exponential, branch 2
g = rv to be used
|
|
bcc
|
bcc (
lam,
mu,
s,
)
bcc - blocked customers cleared model
returns p[i], i = 0,1,..s.
- ps = p[s] = prob of blocking
- lameff = effective arrival rate = lam*(1-ps)
See Winston 22.11 for Blocked Customers Cleared Model (Erlang B formula)
|
|
erlangB
|
erlangB ( rho, c )
Erlang's B formula for probabilities in no-queue
Returns p[n] list
see also SPlus and R version in que.q mmcK
que.py has bcc.
use bcc instead!!
|
|
main
|
main ()
|
|
testHyperVariate
|
testHyperVariate ()
tests the HyerVariate rv generator
|
Classes
|
|
Job |
Jobs that are either accepted or rejected
|
JobGen |
generates a sequence of Jobs
|
|
|