Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. def cliente(env, name, empleado):
  2. print('%s llega a las %.1f' % (name, env.now))
  3. llegada = env.now
  4.  
  5. with empleado.request() as req:
  6. yield req
  7. print('%s comienza la atención en %s' % (name, np.round(env.now,2)))
  8. tiempo_servicio()
  9. yield env.timeout(tiempoServicio)
  10. print('%s termina su atención a las %s' % (name, np.round(env.now,2)))
  11.  
  12. def llegada(env, empleado):
  13. i = 0
  14. while True:
  15. c = cliente(env, 'Cliente %d' % i, empleado)
  16. global total_clientes_atendidos
  17. total_clientes_atendidos += 1
  18. env.process(c)
  19. tiempo_llegada = np.random.exponential(media)
  20. yield env.timeout(tiempo_llegada)
  21. i += 1
  22.  
  23. env = simpy.Environment()
  24. servidor = simpy.Resource(env, capacity=1)
  25. env.process(llegada(env, servidor))
  26. env.run(until=DURACION_SIMULACION)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement