Beispiel #1
0
# Entity Generation Random
# INTERVAL_RATE = NumberGenerator(NORMAL, mu=1, sigma=3)
INTERVAL_RATE = NumberGenerator(UNIFORM, a=3, b=6)

# Delay Random
DELAY_RATE_BAKER = NumberGenerator(UNIFORM, a=1, b=2)
DELAY_RATE_ABLE = NumberGenerator(TRIANGULAR, low=2, high=3, mode=6)

# DELAY_RATE_BAKER = NumberGenerator(RANDINT, a=1, b=7)
# DELAY_RATE_ABLE = NumberGenerator(RANDINT, a=1, b=5)

d1 = Disposer()
d1.logs = True

# 1 is Able's maximum simultanious clients
dl1 = Delay(d1, DELAY_RATE_ABLE.next, None, 1)
dl1.name = 'Delay'
dl1.logs = True


q1 = Queue([dl1])
q1.logs = True

pr1 = ActorProbe(q1)
pr1.name = 'Queue Probe'
q1.actorprobe = pr1

pr2 = ActorProbe(dl1)
pr2.name = 'Delay Probe'
dl1.actorprobe = pr2
Beispiel #2
0
# Entity Generation Random
# INTERVAL_RATE = NumberGenerator(NORMAL, mu=1, sigma=3)
INTERVAL_RATE = NumberGenerator(UNIFORM, a=3, b=6)

# Delay Random
DELAY_RATE_BAKER = NumberGenerator(UNIFORM, a=1, b=2)
DELAY_RATE_ABLE = NumberGenerator(TRIANGULAR, low=5, high=15, mode=10)

# DELAY_RATE_BAKER = NumberGenerator(RANDINT, a=1, b=7)
# DELAY_RATE_ABLE = NumberGenerator(RANDINT, a=1, b=5)

d1 = Disposer()
d1.logs = True

# 1 is Able's maximum simultanious clients
dl1 = Delay(d1, DELAY_RATE_ABLE.next, None, 1)
dl1.name = 'Able'
dl1.logs = True

# 1 is Baker's maximum simultanious clients
dl2 = Delay(d1, DELAY_RATE_BAKER.next, None, 1)
dl2.name = 'Baker'
dl2.logs = True

q1 = Queue([dl1, dl2])
q1.logs = True

pr1 = ActorProbe(q1)
pr1.name = 'Queue Probe'
q1.actorprobe = pr1
Beispiel #3
0
# Entity Generation Random
# INTERVAL_RATE = NumberGenerator(NORMAL, mu=1, sigma=3)
INTERVAL_RATE = NumberGenerator(UNIFORM, a=3, b=6)

# Delay Random
DELAY_RATE_BAKER = NumberGenerator(UNIFORM, a=1, b=2)
DELAY_RATE_ABLE = NumberGenerator(TRIANGULAR, low=5, high=15, mode=10)

# DELAY_RATE_BAKER = NumberGenerator(RANDINT, a=1, b=7)
# DELAY_RATE_ABLE = NumberGenerator(RANDINT, a=1, b=5)

d1 = Disposer()
d1.logs = True

# 1 is Able's maximum simultanious clients
dl1 = Delay(d1, DELAY_RATE_ABLE.next, None, 1)
dl1.name = 'Able'
dl1.logs = True

# 1 is Baker's maximum simultanious clients
dl2 = Delay(d1, DELAY_RATE_BAKER.next, None, 1)
dl2.name = 'Baker'
dl2.logs = True

q1 = Queue([dl1, dl2])
q1.logs = True

pr1 = ActorProbe(q1)
pr1.name = 'Queue Probe'
q1.actorprobe = pr1
Beispiel #4
0
# Entity Generation Random
# INTERVAL_RATE = NumberGenerator(NORMAL, mu=1, sigma=3)
INTERVAL_RATE = NumberGenerator(UNIFORM, a=1, b=2)

# Delay Random
DELAY_RATE_BAKER = NumberGenerator(UNIFORM, a=1, b=2)
DELAY_RATE_ABLE = NumberGenerator(TRIANGULAR, low=2, high=8, mode=6)
DELAY_EAT = NumberGenerator(TRIANGULAR, low=10, high=20, mode=17)
DELAY_RATE_BAKER = NumberGenerator(UNIFORM, a=1, b=2)

# DELAY_RATE_BAKER = NumberGenerator(RANDINT, a=1, b=7)
# DELAY_RATE_ABLE = NumberGenerator(RANDINT, a=1, b=5)

s1 = Slot()

d1 = Delay(s1, DELAY_EAT.next, None)
d1.name = 'Eat'
#d1.logs = True

# Fast Food
dl1 = Delay(d1, DELAY_RATE_ABLE.next, None, 5)
dl1.name = 'Wait For Fast Food'
#dl1.logs = True

q1 = Queue([dl1])
q1.name = 'Fast Food Queue'
q1.metadata = {'quality': NumberGenerator(UNIFORM, a=3, b=6),
               'cost': NumberGenerator(UNIFORM, a=2, b=7)
               }
#q1.logs = True
Beispiel #5
0
def randomInterval():
    return random.randint(1,2)

def branchFunction(data):
    return random.randrange(0,2)

def delayFunction(data):
    return random.randrange(2,5)

d1 = Disposer()
d1.name = "Disposer1"
d1.logs = True
d2 = Disposer()
d2.name = "Disposer2"
d2.logs = True
dl1 = Delay(d2, delayFunction)
dl1.name = "Delay1"
dl1.logs = True
b1 = Branch([d1, dl1], branchFunction)
b1.name = "Branch1"
b1.logs = True
g1 = Generator(b1, Entity, None, randomInterval, 20)
g1.name = "MyGenerator"
g1.logs = True
sim = Simulation()
sim.logs = True

sim.addactor(d1)
sim.addactor(d2)
sim.addactor(dl1)
sim.addactor(b1)
Beispiel #6
0
from convergance_statistic import drawProbs, drawLeaveEnter

INTERVAL_RATE = NumberGenerator(UNIFORM, a=1, b=4)
DELAY_RATE_3 = NumberGenerator(TRIANGULAR, low=6, high=16, mode=10)
DELAY_RATE_2 = NumberGenerator(UNIFORM, a=2, b=4)
DELAY_RATE_1 = NumberGenerator(UNIFORM, a=0, b=4)

MAX_ENTITIES = 100000

d1 = Disposer()
d1.logs = False
d1.deleteentityfrommemory = False

########################################################

dl4 = Delay(d1, DELAY_RATE_1.next, None, 1)
dl4.name = "Delay 4"
dl4.logs = False

pr6 = ActorProbe(dl4)
pr6.name = "Probe Delay 4"
dl4.actorprobe = pr6

pr7 = ActorProbe(dl4)
pr7.name = "Global Probe"
pr7.calculatenumentities = True
dl4.actorleaveprobe = pr7


q4 = Queue([dl4])
q4.name = "Queue 4"
Beispiel #7
0
def branchFunction(data):
    return random.randrange(0, 2)


def delayFunction(data):
    return random.randrange(2, 5)


d1 = Disposer()
d1.name = "Disposer1"
d1.logs = True
d2 = Disposer()
d2.name = "Disposer2"
d2.logs = True
dl1 = Delay(d2, delayFunction)
dl1.name = "Delay1"
dl1.logs = True
b1 = Branch([d1, dl1], branchFunction)
b1.name = "Branch1"
b1.logs = True
g1 = Generator(b1, Entity, None, randomInterval, 20)
g1.name = "MyGenerator"
g1.logs = True
sim = Simulation()
sim.logs = True

sim.addactor(d1)
sim.addactor(d2)
sim.addactor(dl1)
sim.addactor(b1)