Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def cliente(env, name, empleado):
- print('%s llega a las %.1f' % (name, env.now))
- llegada = env.now
- with empleado.request() as req:
- yield req
- print('%s comienza la atención en %s' % (name, np.round(env.now,2)))
- tiempo_servicio()
- yield env.timeout(tiempoServicio)
- print('%s termina su atención a las %s' % (name, np.round(env.now,2)))
- def llegada(env, empleado):
- i = 0
- while True:
- c = cliente(env, 'Cliente %d' % i, empleado)
- global total_clientes_atendidos
- total_clientes_atendidos += 1
- env.process(c)
- tiempo_llegada = np.random.exponential(media)
- yield env.timeout(tiempo_llegada)
- i += 1
- env = simpy.Environment()
- servidor = simpy.Resource(env, capacity=1)
- env.process(llegada(env, servidor))
- env.run(until=DURACION_SIMULACION)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement