예제 #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

예제 #2
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()