Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
SimPy
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Process-based discrete-event simulation framework based on standard Python}} {{About||the [[Python (programming language)|Python]] symbolic mathematics library|SymPy|the discontinued social bookmarking service|Simpy}} {{Infobox software | name = SimPy | title = SimPy, a free discrete-event simulation package based on Python | logo = SimPy logo.svg | logo size = 200px | author = Klaus G. Müller, Tony Vignaux | developer = Ontje Lünsdorf, Stefan Scherfke | released = {{Start date and age|2002|09|17}} | latest release version = 4.1.1 | latest release date = {{Start date and age|2023|11|12}} | programming language = [[Python (programming language)|Python]] | operating system = [[Cross-platform]] | genre = [[Discrete event simulation]] | license = [[MIT]] | website = {{URL|simpy.readthedocs.org}} }} '''SimPy''' stands for '''“Simulation in Python”,''' is a process-based [[discrete-event simulation]] [[Software framework|framework]] based on standard [[Python (programming language)|Python]].<ref>{{Cite journal |last1=Iwata |first1=Curtis |last2=Mavris |first2=Dimitri |date=2013-01-01 |title=Object-Oriented Discrete Event Simulation Modeling Environment for Aerospace Vehicle Maintenance and Logistics Process |journal=Procedia Computer Science |volume=16 |pages=187–196 |doi=10.1016/j.procs.2013.01.020 |issn=1877-0509|doi-access=free }}</ref> It enables users to model active components such as customers, vehicles, or agents as simple Python [[Generator (computer programming)|generator functions]]. SimPy is released as [[Open-source software|open source]] software under the [[MIT License]]. The first version was released in December 2002.<ref>{{Cite book |last1=Xiong |first1=Xinli |last2=Ma |first2=Linru |last3=Cui |first3=Chao |chapter=Simulation Environment of Evaluation and Optimization for Moving Target Defense: A SimPy Approach |date=2020-01-13 |title=Proceedings of the 2019 9th International Conference on Communication and Network Security |chapter-url=https://doi.org/10.1145/3371676.3371692 |series=ICCNS '19 |location=New York, NY, USA |publisher=Association for Computing Machinery |pages=114–117 |doi=10.1145/3371676.3371692 |isbn=978-1-4503-7662-4}}</ref> == Overview == Its event dispatcher is based on Python's generators and can be used for asynchronous networking or to implement multi-agent systems (with both, simulated and real communication). Simulations can be performed “as fast as possible”, in real time (wall clock time) or by manually stepping through the events. Though it is theoretically possible to do continuous simulations with SimPy, it lacks features to support them. However, for simulations with a fixed step size where processes don't interact with each other or with shared resources, a simple <code>while</code> loop is sufficient.<ref>{{Cite journal |last1=Olaitan |first1=Oladipupo |last2=Geraghty |first2=John |last3=Young |first3=Paul |last4=Dagkakis |first4=Georgios |last5=Heavey |first5=Cathal |last6=Bayer |first6=Martin |last7=Perrin |first7=Jerome |last8=Robin |first8=Sebastien |date=2014-01-01 |title=Implementing ManPy, a Semantic-free Open-source Discrete Event Simulation Package, in a Job Shop |journal=Procedia CIRP |volume=25 |pages=253–260 |doi=10.1016/j.procir.2014.10.036 |issn=2212-8271|doi-access=free }}</ref> Additionally, SimPy provides different types of shared resources to simulate congestion points that have limited capacity, such as servers, checkout counters, and tunnels. In version 3.1 and above, SimPy offers monitoring capabilities to assist in collecting statistics about processes and resources. SimPy 3.0 requires Python 3.,<ref>{{Cite web |title=SimPy History & Change Log — SimPy 4.0.2.dev1+g2973dbe documentation |url=https://simpy.readthedocs.io/en/latest/about/history.html}}</ref> while SimPy 4.0 requires Python 3.6+. SimPy distribution contains tutorials,<ref>{{cite journal |last1=Zinoviev |first1=Dmitry |date=February 2018 |title=Discrete Event Simulation. It's Easy with SimPy! |journal=PragPub |issue=104 |pages=1–16}}</ref> documentation, and examples. == Example == The following is a SimPy simulation<ref>{{Cite web|url=https://stefan.sofa-rockers.org/downloads/simpy-ep14.pdf#page=5|title=Discrete-event simulation with SimPy|last=Scherfke|first=Stefan|date=July 25, 2014|website=|publisher=|page=5|format=PDF|access-date=August 10, 2016}}</ref> showing a '''clock''' process that prints the current simulation time at each step: <syntaxhighlight lang="pycon"> >>> import simpy >>> >>> def clock(env, name, tick): ... while True: ... print(name, env.now) ... yield env.timeout(tick) ... >>> env = simpy.Environment() >>> env.process(clock(env, 'fast', 0.5)) <Process(clock) object at 0x...> >>> env.process(clock(env, 'slow', 1)) <Process(clock) object at 0x...> >>> env.run(until=2) fast 0 slow 0 fast 0.5 slow 1 fast 1.0 fast 1.5 </syntaxhighlight> ==References== {{Reflist}} [[Category:Articles with example Python (programming language) code]] [[Category:Cross-platform software]] [[Category:Free science software]] [[Category:Python (programming language) libraries]] [[Category:Simulation programming languages]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:About
(
edit
)
Template:Cite book
(
edit
)
Template:Cite journal
(
edit
)
Template:Cite web
(
edit
)
Template:Infobox
(
edit
)
Template:Infobox software
(
edit
)
Template:Main other
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Template other
(
edit
)