Beispiel #1
0
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)

s1 = Storage(b1, [Newspaper(None) for i in range(INIT_STORGAE_ENTITIES)])

pr3 = ActorProbe(s1)
pr3.name = 'Storage Probe'
s1.actorprobe = pr3

batchCount = 0


def generatorBatchNumberFunction(simulation):
    global batchCount
    return batchCount

Beispiel #2
0
pr2 = ActorProbe(dl2)
pr2.name = "Probe Delay 2"
dl2.actorprobe = pr2

q2 = Queue([dl2])
q2.name = "Queue 2"
q2.logs = False

pr1 = ActorProbe(q2)
pr1.name = "Probe Queue 2"
q2.actorprobe = pr1

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

branchFunction = NumberGenerator(RANDINT, a=0, b=1)
b1 = Branch([q3, q2], branchFunction.next)

b1.actorenterprobe = pr7

g1 = AutomaticGenerator(b1, Entity, None, INTERVAL_RATE.next, MAX_ENTITIES)
g1.logs = False

sim = Simulation()
sim.logs = False

sim.addactor(g1)
sim.addactor(b1)
sim.addactor(d1)
sim.addactor(q2)
sim.addactor(dl2)
sim.addactor(q3)
Beispiel #3
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)
sim.addactor(g1)

sim.start()
Beispiel #4
0

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)
sim.addactor(g1)

sim.start()