Clever Geek Handbook
📜 ⬆️ ⬇️

Simpy

SimPy is a Python framework for a process-oriented discrete-event simulation system. Its event dispatchers are based on Python generator functions.

Sympy
SimPy logo.svg
Type offramework , process-oriented discrete-event modeling system
AuthorKlaus G. Müller, Tony Vignaux
DevelopersOntje Lünsdorf, Stefan Scherfke
Written onPython
operating systemCross platform
First editionSeptember 17, 2002
Latest version3.0.7 ( March 1, 2015 )
LicenseMIT
Sitesimpy.readthedocs.org

They can also be used to create asynchronous networks or to implement multi-agent systems (with both simulated and real interaction).

Processes in SimPy are simply Python generators that are used to model active components, such as customers, vehicles, or agents. SimPy also provides various types of shared resources for modeling points with limited bandwidth (for example, servers, cash desks, tunnels). Starting with version 3.1, SimPy will also provide monitoring capabilities to help gather statistics on resources and processes.

Simulation can be performed in “as fast as possible” mode, in real time (wall clock time) or in the mode of manual execution of events.

Theoretically, in SimPy you can do continuous simulation, but in fact this is not feasible. However, in the case of modeling with a fixed-size step, where processes do not interact with each other or with shared resources, a simple while loop can be used.

SimPy is distributed with tutorials, detailed documentation, and lots of examples.

SimPy was released as an open source project under the MIT license . The first version was released in December 2002.

Example

One of SimPy’s main goals is ease of use. Here is an example of a simple SimPy simulation: [1] a clock process that displays the current model time at each step:

  1 >>> import simpy
 2 >>>
 3 >>> def clock ( env , name , tick ):
 4 ... while True :
 5 ... print ( name , env . Now )
 6 ... yield env .  timeout ( tick )
 7 ...
 8 >>> env = simpy .  Environment ()
 9 >>> env .  process ( clock ( env , 'fast' , 0.5 ))
 10 < Process ( clock ) object at 0 x ...>
 11 >>> env .  process ( clock ( env , 'slow' , 1 ))
 12 < Process ( clock ) object at 0 x ...>
 13 >>> env .  run ( until = 2 )
 14 fast 0
 15 slow 0
 16 fast 0.5
 17 slow 1
 18 fast 1.0
 19 fast 1.5

Links

  1. ↑ Scherfke, Stefan (July 25, 2014).


Source - https://ru.wikipedia.org/w/index.php?title=SimPy&oldid=101938171


More articles:

  • Agricultural University of Iceland
  • Malm, Robert
  • Sterlitamak Petrochemical Plant
  • Worst Witch (TV series, 2017)
  • Keyes, Wade
  • Bowersok, Glen
  • Aklonifen
  • Goncharov, Vladimir Maksimovich
  • Kozhevnikov, Boris Mikhailovich
  • UATV

All articles

Clever Geek | 2019