Linking Simpy simulation time to Python Calendar for week day specific actions -


i want build simulation model of production network simpy comprising following features regard time:

  • plants work monday friday (with 2 shifts of 8 hours)
  • heavy trucks drive on days of week except sunday
  • light trucks drive on days of week, including sunday

to purpose, want construct broadcastpipe given in docs combined timeouts make objects wait during days not working (for plants additional logic required model shifts). broadcastpipe count days (assuming 24*60 minutes each day) , "it's monday, everybody". objects (plant, light , heavy trucks) process information individually , act accordingly.

now, wonder whether there elegant method link simulation time regular python calender objects in order access days of week. useful clarity , enhancements bank holidays , varying starting days. have advise how this? (or general advice on how model better?). in advance!

i set start date , define equal simulation time (environment.now) 0. since simpy’s simulation time has no inherent unit, define in seconds. using arrow, can calculate actual date , time current simulation time:

import arrow import simpy  start = arrow.get('2015-01-01t00:00:00') env = simpy.environment()  # simulation ...  current_date = start.replace(seconds=env.now) print('curret weekday:', current_date.weekday()) 

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -