Esempio n. 1
0
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

pr2 = ActorProbe(dl1)
pr2.name = 'Able Probe'
dl1.actorprobe = pr2

pr3 = ActorProbe(dl2)
pr3.name = 'Baker Probe'
dl2.actorprobe = pr3

g1 = AutomaticGenerator(q1, Entity, None, INTERVAL_RATE.next, 200)
g1.logs = True

sim = Simulation()
Esempio n. 2
0
RECYCLE_PRICE = 5


class Newspaper(Entity):
    def __init__(self, data):
        Entity.__init__(self, data)
        self.status = SOLD


d1 = Disposer()
d1.name = "Bought Newspapers"

d2 = Disposer()
d2.name = "Recycled Newspapers"

pr1 = ActorProbe(d1)
pr1.name = 'Bought Newspapers Probe'
d1.actorprobe = pr1

pr2 = ActorProbe(d2)
pr2.name = 'Recycled Newspapers Probe'
d2.actorprobe = pr2


def branchFunction(entity):
    global SOLD
    if entity.status == SOLD:
        return 0
    return 1

Esempio n. 3
0
# 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


g1 = AutomaticGenerator(q1, Entity, None, INTERVAL_RATE.next, 200)
g1.logs = True

sim = Simulation()
sim.logs = True

sim.addactor(d1)
Esempio n. 4
0
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

pr2 = ActorProbe(dl1)
pr2.name = 'Able Probe'
dl1.actorprobe = pr2

pr3 = ActorProbe(dl2)
pr3.name = 'Baker Probe'
dl2.actorprobe = pr3


g1 = AutomaticGenerator(q1, Entity, None, INTERVAL_RATE.next, 200)
g1.logs = True
Esempio n. 5
0
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

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

pr2 = ActorProbe(dl1)
pr2.name = 'Delay Probe'
dl1.actorprobe = pr2



# Hot Dog Stand
dl2 = Delay(d1, DELAY_RATE_ABLE.next, None, 5)
dl2.name = 'Wait For Hot Dog Stand'
#dl2.logs = True

q2 = Queue([dl2])
Esempio n. 6
0
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"
q4.logs = False

pr5 = ActorProbe(q4)
pr5.name = "Probe Queue 4"
Esempio n. 7
0
RECYCLE_PRICE = 5


class Newspaper(Entity):
    def __init__(self, data):
        Entity.__init__(self, data)
        self.status = SOLD


d1 = Disposer()
d1.name = "Bought Newspapers"

d2 = Disposer()
d2.name = "Recycled Newspapers"

pr1 = ActorProbe(d1)
pr1.name = 'Bought Newspapers Probe'
d1.actorprobe = pr1

pr2 = ActorProbe(d2)
pr2.name = 'Recycled Newspapers Probe'
d2.actorprobe = pr2

def branchFunction(entity):
    global SOLD
    if entity.status == SOLD:
        return 0
    return 1

b1 = Branch([d1, d2], branchFunction)