>>> import simpy >>> >>> def clock(env): ... while True: ... print(env.now) ... yield env.timeout(1) ... >>> env = simpy.Environment() >>> env.start(clock(env)) Process(clock) >>> simpy.simulate(env, until=3) 0 1 2
Note: Simpy 3 is currently in development. Everything we promise below may or may not yet exist, may dramatically change or even explode! Nevertheless, we encourage you to try out the development version and tell us what you think.
SimPy is a process-based discrete-event simulation framework based on standard Python. Its event dispatcher is based on Python’s generators and can also be used for asynchronous networking or to implement multi-agent systems (with both, simulated and real communication).
Processes in SimPy are simple Python generator functions and are used to model active components like customers, vehicles or agents. SimPy also provides various types of shared resources to model limited capacity congestion points (like servers, checkout counters and tunnels). It also provides monitoring capabilities to aid in gathering statistics about resources and processes.
Simulations can be performed “as fast as possible”, in real time (wall clock time) or by manually stepping through the events.
The distribution contains in-depth documentation, tutorials, and a large number of examples.
Simpy is released under the GNU LGPL. Simulation model developers are encouraged to share their SimPy modeling techniques with the SimPy community. Please post a message to the SimPy-Users mailing list.