Commit 7fa8360f authored by Ontje Lünsdorf's avatar Ontje Lünsdorf

Rework overview page in restructured text to fix the PDF output and add some...

Rework overview page in restructured text to fix the PDF output and add some more links to various parts of the documentation.
parent 42b1e6b6
{%- extends "layout.html" %}
{%- set title = 'Overview' %}
{%- block body %}
<div style="margin: 0 0 .5em 1em; float: right;">
<img src="_static/simpy-logo-small.png" style="width: 200px;">
</div>
<h1>Welcome to SimPy</h1>
<p>Event discrete simulation for Python.</p>
<p><a href="https://plus.google.com/101634625602509193865" rel="publisher">News</a> |
<a href="https://pypi.python.org/pypi/simpy">PyPI</a>
<a href="https://bitbucket.org/simpy/simpy/">Bitbucket</a> |
<a href="https://bitbucket.org/simpy/simpy/issues?status=new&status=open">Issues</a> |
<a href="https://groups.google.com/forum/#!forum/python-simpy">Mailing list</a></p>
<div style="margin: 0 0 .5em 1em; float: right;">
<div class="highlight-python"><div class="highlight"><pre style="padding-right: 2em;"><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">simpy</span>
<span class="go">&gt;&gt;&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">def</span> <span class="nf">clock</span><span class="p">(</span><span class="n">env</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">tick</span><span class="p">):</span>
<span class="gp">... </span> <span class="k">while</span> <span class="bp">True</span><span class="p">:</span>
<span class="gp">... </span> <span class="k">print</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">env</span><span class="o">.</span><span class="n">now</span><span class="p">)</span>
<span class="gp">... </span> <span class="k">yield</span> <span class="n">env</span><span class="o">.</span><span class="n">timeout</span><span class="p">(</span><span class="n">tick</span><span class="p">)</span>
<span class="gp">...</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">env</span> <span class="o">=</span> <span class="n">simpy</span><span class="o">.</span><span class="n">Environment</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">env</span><span class="o">.</span><span class="n">process</span><span class="p">(</span><span class="n">clock</span><span class="p">(</span><span class="n">env</span><span class="p">,</span> <span class="s">&#39;fast&#39;</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">))</span>
<span class="go">&lt;Process(clock) object at 0x...&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">env</span><span class="o">.</span><span class="n">process</span><span class="p">(</span><span class="n">clock</span><span class="p">(</span><span class="n">env</span><span class="p">,</span> <span class="s">&#39;slow&#39;</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span>
<span class="go">&lt;Process(clock) object at 0x...&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">env</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">until</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span>
<span class="go">fast 0</span>
<span class="go">slow 0</span>
<span class="go">fast 0.5</span>
<span class="go">slow 1</span>
<span class="go">fast 1.0</span>
<span class="go">fast 1.5</span>
</pre></div>
</div>
</div>
<p>SimPy is a process-based discrete-event simulation framework based on
standard Python. Its event dispatcher is based on Python’s <a
href="http://docs.python.org/3/glossary.html#term-generator">generators</a> and
can also be used for asynchronous networking or to implement multi-agent
systems (with both, simulated and real communication).</p>
<p>Processes in SimPy are defined by Python generator functions and can, for
example, be used to model active components like customers, vehicles or agents.
SimPy also provides various types of shared <em>resources</em> to model limited
capacity congestion points (like servers, checkout counters and tunnels).</p>
<p>Simulations can be performed “as fast as possible”, in real time (wall clock
time) or by manually stepping through the events.</p>
<p>Though it is theoretically possible to do continuous simulations with SimPy,
it has no features that help you with that. On the other hand, SimPy is
overkill for simulations with a fixed step size where your processes don’t
interact with each other or with shared resources.</p>
<p>The SimPy distribution contains tutorials, in-depth documentation, and a large
number of examples.</p>
<p>SimPy is released under the MIT License. Simulation model developers are
encouraged to share their SimPy modeling techniques with the SimPy community.
Please post a message to the <a
href="https://groups.google.com/forum/#!forum/python-simpy">SimPy mailing
list</a>.</p>
<p>There is an introductory talk that explains SimPy’s concepts and provides
some examples: <a href="https://www.youtube.com/watch?v=Bk91DoAEcjY">watch
the video</a> or <a
href="http://stefan.sofa-rockers.org/downloads/simpy-ep14.pdf">get the
slides</a>.</p>
<p>SimPy has also been reimplemented in other programming languages. See the
<a href="{{ pathto("about/ports") }}">list of ports</a> for more details.</p>
<h2 style="clear: both;">Documentation</h2>
<table class="contentstable" align="center" style="margin-left: 30px">
<tr>
<td width="50%">
<p class="biglink"><a class="biglink" href="{{ pathto("simpy_intro/index") }}">SimPy in 10 Minutes</a><br />
<span class="linkdescr">learn the basics of SimPy in just a couple of minutes</span></p>
</td>
<td width="50%">
<p class="biglink"><a class="biglink" href="{{ pathto("topical_guides/index") }}">Topical Guides</a><br />
<span class="linkdescr">guides covering various features of SimPy in-depth</span></p>
</td>
</tr>
<tr>
<td>
<p class="biglink"><a class="biglink" href="{{ pathto("examples/index") }}">Examples</a><br />
<span class="linkdescr">usage examples for SimPy</span></p>
</td>
<td>
<p class="biglink"><a class="biglink" href="{{ pathto("api_reference/index") }}">API Reference</a><br />
<span class="linkdescr">detailed description of SimPy’s API</span></p>
</td>
</tr>
<tr>
<td>
<p class="biglink"><a class="biglink" href="{{ pathto("contents") }}">Contents</a><br />
<span class="linkdescr">for a complete overview</span></p>
</td>
<td>
<p class="biglink"><a class="biglink" href="{{ pathto("about/index") }}">About</a><br />
<span class="linkdescr">non-technical stuff (history, change logs, ports, …)</span></p>
</td>
</tr>
</table>
{%- endblock %}
.. _about:
===========
About SimPy
===========
......
.. _ports:
=====
Ports
=====
......
.. _api:
=============
API Reference
=============
......
......@@ -153,7 +153,7 @@ html_static_path = ['_static']
# Additional templates that should be rendered to pages, maps page names to
# template names.
html_additional_pages = {'index': 'index.html'}
html_additional_pages = {}
# If false, no module index is generated.
# html_domain_indices = True
......@@ -187,6 +187,10 @@ htmlhelp_basename = 'SimPydoc'
# -- Options for LaTeX output -------------------------------------------------
latex_elements = {
'classoptions': ',openany,oneside',
'babel': '\\usepackage[english]{babel}'
}
# The paper size ('letter' or 'a4').
# latex_paper_size = 'letter'
......@@ -196,12 +200,13 @@ htmlhelp_basename = 'SimPydoc'
# Grouping the document tree into LaTeX files. List of tuples (source start
# file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'SimPy.tex', 'SimPy Documentation', ', '.join(authors), 'manual'),
('contents', 'SimPy.tex', 'SimPy Documentation', ', '.join(authors),
'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
# latex_logo = None
latex_logo = '_static/simpy-logo-small.png'
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
......
.. _contents:
=======================
Documentation for SimPy
=======================
Contents:
.. only:: html
Contents:
.. toctree::
:maxdepth: 2
SimPy home <index>
index
simpy_intro/index
topical_guides/index
examples/index
......
.. _examples:
========
Examples
========
......
==========
SimPy home
==========
.. only:: html
.. figure:: _static/simpy-logo-small.png
:align: center
..
_templates/index.html contains the content for this page.
Event discrete simulation for Python
`News <https://plus.google.com/101634625602509193865>`_ |
`PyPI <https://pypi.python.org/pypi/simpy>`_ |
`Bitbucket <https://bitbucket.org/simpy/simpy/>`_ |
`Issues
<https://bitbucket.org/simpy/simpy/issues?status=new&status=open>`_ |
`Mailing list <https://groups.google.com/forum/#!forum/python-simpy>`_
========
Overview
========
.. only:: html
.. sidebar:: Documentation
:ref:`Tutorial <intro>`
learn the basics of SimPy in just a couple of minutes
:ref:`Topical Guides <guides>`
guides covering various features of SimPy in-depth
:ref:`Examples <examples>`
usage examples for SimPy
:ref:`API Reference <api>`
detailed description of SimPys API
:ref:`Contents <contents>`
for a complete overview
:ref:`About <about>`
non-technical stuff (history, change logs, ports, )
SimPy is a process-based discrete-event simulation framework based on standard
Python.
Processes in SimPy are defined by Python `generator functions
<http://docs.python.org/3/glossary.html#term-generator>`_ and may, for example,
be used to model active components like customers, vehicles or agents. SimPy
also provides various types of :ref:`shared resources <shared-resources>` to
model limited capacity congestion points (like servers, checkout counters and
tunnels).
Simulations can be performed :ref:`as fast as possible <simulation-control>`,
in :ref:`real time <realtime>` (wall clock time) or by manually :ref:`stepping
<simulation-step>` through the events.
Though it is theoretically possible to do continuous simulations with SimPy, it
has no features that help you with that. On the other hand, SimPy is overkill
for simulations with a fixed step size where your processes dont interact with
each other or with shared resources.
A short example simulating two clocks ticking in different time intervals looks
like this:
>>> 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
The documentation contains a tutorial, several guides explaining key concepts, a
number of examples and the API reference.
SimPy is released under the MIT License. Simulation model developers are
encouraged to share their SimPy modeling techniques with the SimPy community.
Please post a message to the `SimPy mailing list
<https://groups.google.com/forum/#!forum/python-simpy>`_.
There is an introductory talk that explains SimPys concepts and provides some
examples: `watch the video <https://www.youtube.com/watch?v=Bk91DoAEcjY>`_ or
`get the slides <http://stefan.sofa-rockers.org/downloads/simpy-ep14.pdf>`_.
SimPy has also been reimplemented in other programming languages. See the
:ref:`list of ports <ports>` for more details.
.. _intro:
===================
SimPy in 10 Minutes
===================
......
......@@ -58,7 +58,7 @@ it to finish::
... yield self.env.timeout(duration)
Starting the simulation is straight forward again: We create an environment,
one (or more) cars and finally call meth:`~Environment.simulate()`.
one (or more) cars and finally call :meth:`~Environment.simulate()`.
::
......
......@@ -80,6 +80,7 @@ The most important method here is :meth:`Environment.run()`:
>>> env.run(until=proc)
'Monty Python’s Flying Circus'
.. _simulation-step:
To step through the simulation event by event, the environment offers
:meth:`~Environment.peek()` and :meth:`~Environment.step()`.
......
......@@ -9,7 +9,7 @@ them inherit :class:`simpy.events.Event`. The listing below shows the
hierarchy of events built into SimPy::
events.Event
|
+— events.Timeout
|
+— events.Initialize
......@@ -17,12 +17,13 @@ hierarchy of events built into SimPy::
+— events.Process
|
+— events.Condition
|
| |
| +— events.AllOf
| |
| +— events.AnyOf
+– [resource events]
.
.
.
This is the set of basic events. Events are extensible and resources, for
example, define additional events. In this guide, we'll focus on the events in
......
.. _guides:
==============
Topical Guides
==============
......
.. _realtime:
=====================
Real-time simulations
=====================
......
.. _shared-resources:
================
Shared Resources
================
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment