| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>pypdevsbbl.generic.routing module — Python(P)DEVS-BBL documentation</title>
- <link rel="stylesheet" href="_static/nature.css" type="text/css" />
- <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
- <link rel="stylesheet" type="text/css" href="_static/custom.css" />
- <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
- <script type="text/javascript" src="_static/jquery.js"></script>
- <script type="text/javascript" src="_static/underscore.js"></script>
- <script type="text/javascript" src="_static/doctools.js"></script>
- <script type="text/javascript" src="_static/language_data.js"></script>
- <script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
- <link rel="index" title="Index" href="genindex.html" />
- <link rel="search" title="Search" href="search.html" />
- <link rel="next" title="pypdevsbbl.generic.transformers module" href="pypdevsbbl.generic.transformers.html" />
- <link rel="prev" title="pypdevsbbl.generic.queues module" href="pypdevsbbl.generic.queues.html" />
- </head><body>
- <div class="related" role="navigation" aria-label="related navigation">
- <h3>Navigation</h3>
- <ul>
- <li class="right" style="margin-right: 10px">
- <a href="genindex.html" title="General Index"
- accesskey="I">index</a></li>
- <li class="right" >
- <a href="py-modindex.html" title="Python Module Index"
- >modules</a> |</li>
- <li class="right" >
- <a href="pypdevsbbl.generic.transformers.html" title="pypdevsbbl.generic.transformers module"
- accesskey="N">next</a> |</li>
- <li class="right" >
- <a href="pypdevsbbl.generic.queues.html" title="pypdevsbbl.generic.queues module"
- accesskey="P">previous</a> |</li>
- <li class="nav-item nav-item-0"><a href="index.html">Python(P)DEVS-BBL documentation</a> »</li>
- <li class="nav-item nav-item-1"><a href="pypdevsbbl.html" >pypdevsbbl package</a> »</li>
- <li class="nav-item nav-item-2"><a href="pypdevsbbl.generic.html" accesskey="U">pypdevsbbl.generic package</a> »</li>
- </ul>
- </div>
- <div class="document">
- <div class="documentwrapper">
- <div class="bodywrapper">
- <div class="body" role="main">
-
- <div class="section" id="module-pypdevsbbl.generic.routing">
- <span id="pypdevsbbl-generic-routing-module"></span><h1>pypdevsbbl.generic.routing module<a class="headerlink" href="#module-pypdevsbbl.generic.routing" title="Permalink to this headline">¶</a></h1>
- <p>Set of PythonPDEVS blocks for routing messages.</p>
- <dl class="class">
- <dt id="pypdevsbbl.generic.routing.Finish">
- <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.routing.</code><code class="descname">Finish</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Finish"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Finish" title="Permalink to this definition">¶</a></dt>
- <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevs.DEVS.AtomicDEVS</span></code></p>
- <p>Destroys a message from the simulation.</p>
- <p>Same as a collector (<a class="reference internal" href="pypdevsbbl.generic.collectors.html#module-pypdevsbbl.generic.collectors" title="pypdevsbbl.generic.collectors"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pypdevsbbl.generic.collectors</span></code></a>), only no
- data was gathered. The routing is just terminated.</p>
- <div class="admonition note">
- <p class="first admonition-title">Note</p>
- <p class="last">This block is only added for a better user experience.
- <code class="docutils literal notranslate"><span class="pre">Python</span></code> has no necessity for garbage collection within
- the <cite>PythonPDEVS</cite> simulator. It’s a better practice to use
- this block, but it is not enforced nor required.</p>
- </div>
- <div align="center" class="align-center"><img alt="_images/finish.svg" src="_images/finish.svg" /></div>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<em>str</em>) – The name of the block.</td>
- </tr>
- <tr class="field-even field"><th class="field-name">Input Ports:</th><td class="field-body"><strong>input</strong> (<em>any</em>) – The message to be destroyed.</td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.Finish.extTransition">
- <code class="descname">extTransition</code><span class="sig-paren">(</span><em>inputs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Finish.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Finish.extTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- </dd></dl>
- <dl class="class">
- <dt id="pypdevsbbl.generic.routing.Halt">
- <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.routing.</code><code class="descname">Halt</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Halt"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Halt" title="Permalink to this definition">¶</a></dt>
- <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevs.DEVS.AtomicDEVS</span></code></p>
- <p>Provides an end-point for the simulation.</p>
- <p>Similar to a <a class="reference internal" href="#pypdevsbbl.generic.routing.Finish" title="pypdevsbbl.generic.routing.Finish"><code class="xref py py-class docutils literal notranslate"><span class="pre">Finish</span></code></a> block, but the value will be
- stored instead of destroyed. It can be used to indicate the
- end of a simulation, or as a simple single-value collector.</p>
- <p class="rubric">Example</p>
- <div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">sim</span> <span class="o">=</span> <span class="n">Simulator</span><span class="p">(</span><span class="n">model</span><span class="p">)</span> <span class="c1"># -- [1]</span>
- <span class="n">sim</span><span class="o">.</span><span class="n">setTerminationCondition</span><span class="p">(</span><span class="n">Halt</span><span class="o">.</span><span class="n">anyHalted</span><span class="p">)</span> <span class="c1"># -- [2]</span>
- <span class="n">sim</span><span class="o">.</span><span class="n">simulate</span><span class="p">()</span>
- </pre></div>
- </div>
- <ol class="arabic simple">
- <li><code class="xref py py-attr docutils literal notranslate"><span class="pre">model</span></code> is a <code class="xref py py-class docutils literal notranslate"><span class="pre">CoupledDEVS</span></code> which may contain a <a class="reference internal" href="#pypdevsbbl.generic.routing.Halt" title="pypdevsbbl.generic.routing.Halt"><code class="xref py py-class docutils literal notranslate"><span class="pre">Halt</span></code></a> block.</li>
- <li>Let’s set a termination condition on any <a class="reference internal" href="#pypdevsbbl.generic.routing.Halt" title="pypdevsbbl.generic.routing.Halt"><code class="xref py py-class docutils literal notranslate"><span class="pre">Halt</span></code></a> block. Note that this is
- decreases the efficiency, as mentioned in the <a class="reference external" href="https://msdl.uantwerpen.be/documentation/PythonPDEVS/examples_classic.html#termination">PythonPDEVS documentation</a>.</li>
- </ol>
- <div class="admonition note">
- <p class="first admonition-title">Note</p>
- <p class="last">It is preferred only to use a <a class="reference internal" href="#pypdevsbbl.generic.routing.Halt" title="pypdevsbbl.generic.routing.Halt"><code class="xref py py-class docutils literal notranslate"><span class="pre">Halt</span></code></a> block and its corresponding termination
- condition when absolutely necessary, but know that this will decrease the overall
- efficieny of the simulation. More often than not, usage of this block can and should
- be omitted.</p>
- </div>
- <div align="center" class="align-center"><img alt="_images/halt.svg" src="_images/halt.svg" /></div>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<em>str</em>) – The name of the block.</td>
- </tr>
- <tr class="field-even field"><th class="field-name">State:</th><td class="field-body">The item that arrived.</td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Input Ports:</th><td class="field-body"><strong>input</strong> (<em>any</em>) – The item to store.</td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.Halt.extTransition">
- <code class="descname">extTransition</code><span class="sig-paren">(</span><em>inputs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Halt.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Halt.extTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.Halt.isHalted">
- <code class="descname">isHalted</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Halt.isHalted"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Halt.isHalted" title="Permalink to this definition">¶</a></dt>
- <dd><p>Whether or not an input was received.</p>
- <p>Helper function to pass to the simulator as termination condition.</p>
- </dd></dl>
- <dl class="staticmethod">
- <dt id="pypdevsbbl.generic.routing.Halt.anyHalted">
- <em class="property">static </em><code class="descname">anyHalted</code><span class="sig-paren">(</span><em>time</em>, <em>model</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Halt.anyHalted"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Halt.anyHalted" title="Permalink to this definition">¶</a></dt>
- <dd><p>Helper function to check that there is at least one <a class="reference internal" href="#pypdevsbbl.generic.routing.Halt" title="pypdevsbbl.generic.routing.Halt"><code class="xref py py-class docutils literal notranslate"><span class="pre">Halt</span></code></a> block halted.</p>
- <p>See the above-mentioned example on how to use this method.</p>
- </dd></dl>
- </dd></dl>
- <dl class="class">
- <dt id="pypdevsbbl.generic.routing.ChooseInput">
- <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.routing.</code><code class="descname">ChooseInput</code><span class="sig-paren">(</span><em>name: str</em>, <em>n: int = 2</em>, <em>selected: int = 0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#ChooseInput"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.ChooseInput" title="Permalink to this definition">¶</a></dt>
- <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevs.DEVS.AtomicDEVS</span></code></p>
- <p>Choose a specific input to be opened.</p>
- <p>All other inputs will be closed and messages arrived there are
- discarded. This acts like a “path” that is enabled. The input
- ports can be indexed with an integer in [0, n).</p>
- <div align="center" class="align-center"><img alt="_images/choose-input.svg" src="_images/choose-input.svg" /></div>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>name</strong> (<em>str</em>) – The name of the block.</li>
- <li><strong>n</strong> (<em>int</em>) – The amount of input ports there are available
- in this block. Defaults to 2.</li>
- <li><strong>selected</strong> (<em>int</em>) – The initial input port that is enabled.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">State:</th><td class="field-body"><ul class="first simple">
- <li><strong>selected</strong> (<em>int</em>) – The currently selected input port to be used.</li>
- <li><strong>item</strong> (<em>any</em>) – The item that has arrived on this port.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Input Ports:</th><td class="field-body"><ul class="first simple">
- <li><strong>select</strong> (<em>int</em>) – The index of the new input port to be selected.
- When not in [0, n), a <cite>round robin</cite> method is
- applied.</li>
- <li><strong>inputs</strong> (<em>list</em>) – A list of the input ports to choose from. These
- ports are named <cite>input-N</cite>, where <cite>N</cite> represents
- their identifier.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Output Ports:</th><td class="field-body"><p class="first last"><strong>output</strong> (<em>any</em>) – The item that arrived on the currently enabled
- input port.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.ChooseInput.timeAdvance">
- <code class="descname">timeAdvance</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#ChooseInput.timeAdvance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.ChooseInput.timeAdvance" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.ChooseInput.outputFnc">
- <code class="descname">outputFnc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#ChooseInput.outputFnc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.ChooseInput.outputFnc" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.ChooseInput.intTransition">
- <code class="descname">intTransition</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#ChooseInput.intTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.ChooseInput.intTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.ChooseInput.extTransition">
- <code class="descname">extTransition</code><span class="sig-paren">(</span><em>inputs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#ChooseInput.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.ChooseInput.extTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- </dd></dl>
- <dl class="class">
- <dt id="pypdevsbbl.generic.routing.ChooseOutput">
- <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.routing.</code><code class="descname">ChooseOutput</code><span class="sig-paren">(</span><em>name: str</em>, <em>n: int = 2</em>, <em>selected: int = 0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#ChooseOutput"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.ChooseOutput" title="Permalink to this definition">¶</a></dt>
- <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevs.DEVS.AtomicDEVS</span></code></p>
- <p>Choose a specific output to be opened.</p>
- <p>All other outputs will be closed and messages arrived there are
- discarded. This acts like a “path” that is enabled. The output
- ports can be indexed with an integer in [0, n).</p>
- <div class="admonition seealso">
- <p class="first admonition-title">See also</p>
- <p class="last"><a class="reference internal" href="#pypdevsbbl.generic.routing.Pick" title="pypdevsbbl.generic.routing.Pick"><code class="xref py py-class docutils literal notranslate"><span class="pre">Pick</span></code></a></p>
- </div>
- <div align="center" class="align-center"><img alt="_images/choose-output.svg" src="_images/choose-output.svg" /></div>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>name</strong> (<em>str</em>) – The name of the block.</li>
- <li><strong>n</strong> (<em>int</em>) – The amount of output ports there are available
- in this block. Defaults to 2.</li>
- <li><strong>selected</strong> (<em>int</em>) – The initial output port that is enabled.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">State:</th><td class="field-body"><ul class="first simple">
- <li><strong>selected</strong> (<em>int</em>) – The currently selected output port to be used.</li>
- <li><strong>item</strong> (<em>any</em>) – The item that needs to be sent through a specific
- output.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Input Ports:</th><td class="field-body"><ul class="first simple">
- <li><strong>select</strong> (<em>int</em>) – The index of the new input port to be selected.
- When not in [0, n), a <cite>round robin</cite> method is
- applied.</li>
- <li><strong>input</strong> (<em>any</em>) – The item that needs to be routed to the currently
- enabled output port.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Output Ports:</th><td class="field-body"><p class="first last"><strong>outputs</strong> (<em>list</em>) – A list of the output ports to choose from. These
- ports are named <cite>output-N</cite>, where <cite>N</cite> represents
- their identifier.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.ChooseOutput.timeAdvance">
- <code class="descname">timeAdvance</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#ChooseOutput.timeAdvance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.ChooseOutput.timeAdvance" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.ChooseOutput.outputFnc">
- <code class="descname">outputFnc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#ChooseOutput.outputFnc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.ChooseOutput.outputFnc" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.ChooseOutput.intTransition">
- <code class="descname">intTransition</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#ChooseOutput.intTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.ChooseOutput.intTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.ChooseOutput.extTransition">
- <code class="descname">extTransition</code><span class="sig-paren">(</span><em>inputs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#ChooseOutput.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.ChooseOutput.extTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- </dd></dl>
- <dl class="class">
- <dt id="pypdevsbbl.generic.routing.Pick">
- <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.routing.</code><code class="descname">Pick</code><span class="sig-paren">(</span><em>name</em>, <em>n</em>, <em>contents=None</em>, <em>select=<function Pick.<lambda>></em>, <em>fc=<function Pick.<lambda>></em>, <em>lif=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Pick"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Pick" title="Permalink to this definition">¶</a></dt>
- <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevs.DEVS.AtomicDEVS</span></code></p>
- <p>Marks certain paths as available.</p>
- <p>This block helps the <a class="reference internal" href="#pypdevsbbl.generic.routing.ChooseOutput" title="pypdevsbbl.generic.routing.ChooseOutput"><code class="xref py py-class docutils literal notranslate"><span class="pre">ChooseOutput</span></code></a> block to balance the load
- if each output of that block can be busy. Whenever such an event occurs,
- any free output is chosen with the <a class="reference internal" href="#pypdevsbbl.generic.routing.Pick" title="pypdevsbbl.generic.routing.Pick"><code class="xref py py-class docutils literal notranslate"><span class="pre">Pick</span></code></a> block. It is up to the
- user to prevent access to the <a class="reference internal" href="#pypdevsbbl.generic.routing.ChooseOutput" title="pypdevsbbl.generic.routing.ChooseOutput"><code class="xref py py-class docutils literal notranslate"><span class="pre">ChooseOutput</span></code></a> block if no path is
- free.</p>
- <div class="admonition note">
- <p class="first admonition-title">Note</p>
- <p class="last">Whenever no free path is found, no new value is outputted and therefore,
- the <a class="reference internal" href="#pypdevsbbl.generic.routing.ChooseOutput" title="pypdevsbbl.generic.routing.ChooseOutput"><code class="xref py py-class docutils literal notranslate"><span class="pre">ChooseOutput</span></code></a> will select the last chosen path.</p>
- </div>
- <div class="admonition seealso">
- <p class="first admonition-title">See also</p>
- <p class="last"><a class="reference internal" href="#pypdevsbbl.generic.routing.ChooseOutput" title="pypdevsbbl.generic.routing.ChooseOutput"><code class="xref py py-class docutils literal notranslate"><span class="pre">ChooseOutput</span></code></a></p>
- </div>
- <div align="center" class="align-center"><img alt="_images/pick.svg" src="_images/pick.svg" /></div>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>name</strong> (<em>str</em>) – The name of the block.</li>
- <li><strong>n</strong> (<em>numeric</em>) – The amount of paths to choose from.</li>
- <li><strong>contents</strong> (<em>iter</em>) – A sorted iterable of size <code class="xref py py-attr docutils literal notranslate"><span class="pre">n</span></code>, consisting of
- a set of booleans. Each value corresponds to the
- freedom of the path. E.g. <code class="docutils literal notranslate"><span class="pre">[True,</span> <span class="pre">False,</span> <span class="pre">True]</span></code>
- marks path 1 to be busy and paths 0 and 2 to be free.
- When <code class="docutils literal notranslate"><span class="pre">None</span></code>, all paths are marked as free. Defaults
- to <code class="docutils literal notranslate"><span class="pre">None</span></code>.</li>
- <li><strong>select</strong> (<em>def</em>) – Function that selects a path from a list of available
- paths. As an argument, a list of pairs is given in the
- form of <code class="docutils literal notranslate"><span class="pre">(port,</span> <span class="pre">idle</span> <span class="pre">time)</span></code>. By default, the first
- available path is chosen.</li>
- <li><strong>fc</strong> (<em>def</em>) – Function that checks if the claim input may mark the
- path as busy. Defaults to always <code class="docutils literal notranslate"><span class="pre">True</span></code>.</li>
- <li><strong>lif</strong> (<em>bool</em>) – Indicative that the last port the fallback port is or
- not. This port cannot be marked busy.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">State:</th><td class="field-body"><ul class="first simple">
- <li><strong>claim</strong> (<em>bool</em>) – When <code class="docutils literal notranslate"><span class="pre">True</span></code>, the last selected path was marked as busy.</li>
- <li><strong>input-n</strong> (<em>numeric</em>) – The freedom of the <cite>n</cite> th input port and its idle time.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Input Ports:</th><td class="field-body"><ul class="first simple">
- <li><strong>claim</strong> (<em>any</em>) – Marks the currently selected path to be busy.</li>
- <li><strong>inputs</strong> (<em>list</em>) – A list of the input ports to choose from. These ports are
- named <cite>input-N</cite>, where <cite>N</cite> represents their identifier.
- When a message arrives, the corresponding path is marked
- as “free”.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Output Ports:</th><td class="field-body"><ul class="first last simple">
- <li><strong>output</strong> (<em>int</em>) – The index of the path to select. Should be used as-is as
- an input to the corresponding <a class="reference internal" href="#pypdevsbbl.generic.routing.ChooseOutput" title="pypdevsbbl.generic.routing.ChooseOutput"><code class="xref py py-class docutils literal notranslate"><span class="pre">ChooseOutput</span></code></a> block.</li>
- <li><strong>free</strong> (<em>bool</em>) – Outputs <code class="docutils literal notranslate"><span class="pre">True</span></code> when there is at least one free path.</li>
- </ul>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.Pick.next">
- <code class="descname">next</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Pick.next"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Pick.next" title="Permalink to this definition">¶</a></dt>
- <dd><p>Gets the next available port.</p>
- </dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.Pick.timeAdvance">
- <code class="descname">timeAdvance</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Pick.timeAdvance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Pick.timeAdvance" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.Pick.outputFnc">
- <code class="descname">outputFnc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Pick.outputFnc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Pick.outputFnc" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.Pick.intTransition">
- <code class="descname">intTransition</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Pick.intTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Pick.intTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.Pick.extTransition">
- <code class="descname">extTransition</code><span class="sig-paren">(</span><em>inputs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Pick.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Pick.extTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- </dd></dl>
- <dl class="class">
- <dt id="pypdevsbbl.generic.routing.Guard">
- <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.routing.</code><code class="descname">Guard</code><span class="sig-paren">(</span><em>name: str</em>, <em>n: int = 0</em>, <em>w=<function Guard.<lambda>></em>, <em>u=<function Guard.<lambda>></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Guard"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Guard" title="Permalink to this definition">¶</a></dt>
- <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevs.DEVS.AtomicDEVS</span></code></p>
- <p>Shields sections to a limited amount of resources.</p>
- <p>Items that request access should arrive on the <cite>input</cite> port,
- whereas items that release their access should arrive on the
- <cite>leave</cite> port. When no access is granted, the message will be
- outputted on the <cite>blocked</cite> port and otherwise, it is passed
- on to the <cite>guarded</cite> port. Items that leave are also outputted
- on the <cite>unguarded</cite> port.</p>
- <div align="center" class="align-center"><img alt="_images/guard.svg" src="_images/guard.svg" /></div>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>name</strong> (<em>str</em>) – The name of the block.</li>
- <li><strong>n</strong> (<em>int</em>) – Amount of available resources at the start.
- Defaults to 0.</li>
- <li><strong>w</strong> (<em>def</em>) – Weight function for items that enter the block.
- Takes the item itself as an argument and should
- return an integer. It may not alter the item.</li>
- <li><strong>u</strong> (<em>def</em>) – Weight function for items that leave the block.
- Takes the item itself as an argument and should
- return an integer. It may not alter the item.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">State:</th><td class="field-body"><ul class="first simple">
- <li><strong>n</strong> (<em>int</em>) – Amount of available resources.</li>
- <li><strong>enter</strong> (<em>any</em>) – The item that requested access to the resources.</li>
- <li><strong>leave</strong> (<em>any</em>) – The item that releases access to resources.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Input Ports:</th><td class="field-body"><ul class="first simple">
- <li><strong>input</strong> (<em>any</em>) – The items that request access to resources.</li>
- <li><strong>leave</strong> (<em>any</em>) – The items that release access to resources.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Output Ports:</th><td class="field-body"><ul class="first last simple">
- <li><strong>blocked</strong> (<em>any</em>) – The item that requested access will be outputted
- here if there are not enough resources for it.</li>
- <li><strong>guarded</strong> (<em>any</em>) – Items that were granted access to resources.</li>
- <li><strong>unguarded</strong> (<em>any</em>) – Items that released access to the resources.</li>
- </ul>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.Guard.timeAdvance">
- <code class="descname">timeAdvance</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Guard.timeAdvance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Guard.timeAdvance" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.Guard.outputFnc">
- <code class="descname">outputFnc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Guard.outputFnc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Guard.outputFnc" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.Guard.intTransition">
- <code class="descname">intTransition</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Guard.intTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Guard.intTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.Guard.extTransition">
- <code class="descname">extTransition</code><span class="sig-paren">(</span><em>inputs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Guard.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Guard.extTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- </dd></dl>
- <dl class="class">
- <dt id="pypdevsbbl.generic.routing.Gate">
- <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.routing.</code><code class="descname">Gate</code><span class="sig-paren">(</span><em>name: str</em>, <em>blocked: bool = True</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Gate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Gate" title="Permalink to this definition">¶</a></dt>
- <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevs.DEVS.AtomicDEVS</span></code></p>
- <p>Toggleable access to a section of a model.</p>
- <p>Works similar to the <a class="reference internal" href="#pypdevsbbl.generic.routing.Guard" title="pypdevsbbl.generic.routing.Guard"><code class="xref py py-class docutils literal notranslate"><span class="pre">Guard</span></code></a>, but does not make use of
- resources. Instead a boolean value indicates if the message
- receives access or not.</p>
- <p>When this value is <code class="docutils literal notranslate"><span class="pre">True</span></code>, all items will be outputted on the
- <cite>blocked</cite> output, otherwise on the <cite>out</cite> output.</p>
- <div align="center" class="align-center"><img alt="_images/gate.svg" src="_images/gate.svg" /></div>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>name</strong> (<em>str</em>) – The name of the block.</li>
- <li><strong>blocked</strong> (<em>bool</em>) – The initial state of the gate.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">State:</th><td class="field-body"><ul class="first simple">
- <li><strong>blocked</strong> (<em>bool</em>) – Indicates where the items should be outputted.</li>
- <li><strong>item</strong> (<em>any</em>) – The item to be outputted.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Input Ports:</th><td class="field-body"><ul class="first simple">
- <li><strong>input</strong> (<em>any</em>) – The items that want to gain access to the critical
- section.</li>
- <li><strong>block</strong> (<em>bool</em>) – Indicates the state of the gate.
- <code class="docutils literal notranslate"><span class="pre">True</span></code> == closed; <code class="docutils literal notranslate"><span class="pre">False</span></code> == open</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Output Ports:</th><td class="field-body"><ul class="first last simple">
- <li><strong>output</strong> (<em>any</em>) – All items that arrived on <cite>input</cite> if the gate is open.</li>
- <li><strong>blocked</strong> (<em>any</em>) – All items that arrived on <cite>input</cite> if the gate is closed.</li>
- </ul>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.Gate.timeAdvance">
- <code class="descname">timeAdvance</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Gate.timeAdvance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Gate.timeAdvance" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.Gate.outputFnc">
- <code class="descname">outputFnc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Gate.outputFnc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Gate.outputFnc" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.Gate.intTransition">
- <code class="descname">intTransition</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Gate.intTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Gate.intTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.Gate.extTransition">
- <code class="descname">extTransition</code><span class="sig-paren">(</span><em>inputs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Gate.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Gate.extTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- </dd></dl>
- <dl class="class">
- <dt id="pypdevsbbl.generic.routing._DT">
- <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.routing.</code><code class="descname">_DT</code><span class="sig-paren">(</span><em>name: str</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#_DT"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing._DT" title="Permalink to this definition">¶</a></dt>
- <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevs.DEVS.AtomicDEVS</span></code></p>
- <p>Superclass for both the Delayer and the Timer.</p>
- <div class="admonition warning">
- <p class="first admonition-title">Warning</p>
- <p class="last">This class should not be used as a block by itself.</p>
- </div>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> (<em>str</em>) – The name of the block.</td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing._DT.timeAdvance">
- <code class="descname">timeAdvance</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#_DT.timeAdvance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing._DT.timeAdvance" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing._DT.outputFnc">
- <code class="descname">outputFnc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#_DT.outputFnc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing._DT.outputFnc" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing._DT.intTransition">
- <code class="descname">intTransition</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#_DT.intTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing._DT.intTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing._DT.extTransition">
- <code class="descname">extTransition</code><span class="sig-paren">(</span><em>inputs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#_DT.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing._DT.extTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- </dd></dl>
- <dl class="class">
- <dt id="pypdevsbbl.generic.routing.Delayer">
- <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.routing.</code><code class="descname">Delayer</code><span class="sig-paren">(</span><em>name: str</em>, <em>ft=<function Delayer.<lambda>></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Delayer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Delayer" title="Permalink to this definition">¶</a></dt>
- <dd><p>Bases: <a class="reference internal" href="#pypdevsbbl.generic.routing._DT" title="pypdevsbbl.generic.routing._DT"><code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevsbbl.generic.routing._DT</span></code></a></p>
- <p>Holds a message for a certain delay, as is defined by the item.</p>
- <div align="center" class="align-center"><img alt="_images/delayer.svg" src="_images/delayer.svg" /></div>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>name</strong> (<em>str</em>) – The name of the block.</li>
- <li><strong>ft</strong> (<em>def</em>) – Time delay function that takes the item as
- argument and returns a numeric value. When
- the returnvalue is less than 0, INFINITY is
- assumed. The function musn’t change the item.
- Defaults to a function that always returns 1.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">State:</th><td class="field-body"><ul class="first simple">
- <li><strong>el</strong> (<em>numeric</em>) – The elapsed time since an item is being held.</li>
- <li><strong>dt</strong> (<em>numeric</em>) – The time delay to hold an item for. Must be
- positive or 0. This is the result of <code class="xref py py-meth docutils literal notranslate"><span class="pre">ft()</span></code>.</li>
- <li><strong>item</strong> (<em>any</em>) – The item to hold.</li>
- <li><strong>other</strong> (<em>any</em>) – When an item is already being held, store the
- new item that arrives.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Input Ports:</th><td class="field-body"><p class="first"><strong>start</strong> (<em>any</em>) – Start the timer for the item.</p>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Output Ports:</th><td class="field-body"><ul class="first last simple">
- <li><strong>blocked</strong> (<em>any</em>) – All items that arrive when an item is being held.</li>
- <li><strong>finished</strong> (<em>any</em>) – The item thet was held for time delay <cite>dt</cite>.</li>
- </ul>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.Delayer.extTransition">
- <code class="descname">extTransition</code><span class="sig-paren">(</span><em>inputs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Delayer.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Delayer.extTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- </dd></dl>
- <dl class="class">
- <dt id="pypdevsbbl.generic.routing.Timer">
- <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.routing.</code><code class="descname">Timer</code><span class="sig-paren">(</span><em>name: str</em>, <em>dt=0.0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Timer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Timer" title="Permalink to this definition">¶</a></dt>
- <dd><p>Bases: <a class="reference internal" href="#pypdevsbbl.generic.routing._DT" title="pypdevsbbl.generic.routing._DT"><code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevsbbl.generic.routing._DT</span></code></a></p>
- <p>Holds a message for a predefined delay.</p>
- <p>Basically corresponds to a blocking queue with a capacity of 1.
- When there is a requirement for more items. Use a
- <a class="reference internal" href="pypdevsbbl.generic.queues.html#pypdevsbbl.generic.queues.Queue" title="pypdevsbbl.generic.queues.Queue"><code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevsbbl.generic.queues.Queue</span></code></a> or a <a class="reference internal" href="pypdevsbbl.generic.queues.html#pypdevsbbl.generic.queues.SimpleQueue" title="pypdevsbbl.generic.queues.SimpleQueue"><code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevsbbl.generic.queues.SimpleQueue</span></code></a>
- with an infinite <cite>dd</cite> and a non-infinte <cite>dr</cite>.</p>
- <div class="admonition note">
- <p class="first admonition-title">Note</p>
- <p><cite>DEVS</cite> are evaluated at each event, not at each time instance, meaning that
- there can be multiple events at the same time. If some of them are external,
- while others are internal, they will never be displayed in the same <em>timeframe</em>.
- A timeframe is therefore a collection of events. Each point in time can have
- multiple timeframes.</p>
- <p class="last">Use this block (with a dt of 0) to sync up events that happen out-of-order w.r.t.
- these timeframes.</p>
- </div>
- <div align="center" class="align-center"><img alt="_images/timer.svg" src="_images/timer.svg" /></div>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>name</strong> (<em>str</em>) – The name of the block.</li>
- <li><strong>dt</strong> (<em>numeric</em>) – The initial delay to hold an item for.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">State:</th><td class="field-body"><ul class="first simple">
- <li><strong>el</strong> (<em>numeric</em>) – The elapsed time since an item is being held.</li>
- <li><strong>dt</strong> (<em>numeric</em>) – The time delay to hold an item for. Must be
- positive or 0. Defaults to 0.</li>
- <li><strong>item</strong> (<em>any</em>) – The item to hold.</li>
- <li><strong>other</strong> (<em>any</em>) – When an item is already being held, store the
- new item that arrives.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Input Ports:</th><td class="field-body"><ul class="first simple">
- <li><strong>start</strong> (<em>any</em>) – Start the timer for the item.</li>
- <li><strong>dt</strong> (<em>numeric</em>) – New time delay to hold an item for. Must be
- positive or 0. Any other value is discarded.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Output Ports:</th><td class="field-body"><ul class="first last simple">
- <li><strong>blocked</strong> (<em>any</em>) – All items that arrive when an item is being held.</li>
- <li><strong>finished</strong> (<em>any</em>) – The item thet was held for time delay <cite>dt</cite>.</li>
- </ul>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.Timer.extTransition">
- <code class="descname">extTransition</code><span class="sig-paren">(</span><em>inputs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Timer.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Timer.extTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- </dd></dl>
- <dl class="class">
- <dt id="pypdevsbbl.generic.routing.Sync">
- <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.routing.</code><code class="descname">Sync</code><span class="sig-paren">(</span><em>name</em>, <em>n</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Sync"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Sync" title="Permalink to this definition">¶</a></dt>
- <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevs.DEVS.AtomicDEVS</span></code></p>
- <p>Synchronizes a set of connections.</p>
- <div class="admonition note">
- <p class="first admonition-title">Note</p>
- <p class="last">This block does not enqueue the arriving messages
- and should thus not be used to delay messages that
- arrive too fast.</p>
- </div>
- <div align="center" class="align-center"><img alt="_images/sync.svg" src="_images/sync.svg" /></div>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>name</strong> (<em>str</em>) – The name of the block.</li>
- <li><strong>n</strong> (<em>int</em>) – The amount of ports to sync. Must be greater
- than 0.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">State:</th><td class="field-body"><p class="first">A list of all currently arrived messages.</p>
- </td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Output Ports:</th><td class="field-body"><ul class="first last simple">
- <li><strong>input</strong> (<em>list</em>) – A list of the input ports to choose from. These
- ports are named <cite>input-N</cite>, where <cite>N</cite> represents
- their identifier.</li>
- <li><strong>output</strong> (<em>list</em>) – A list of the output ports to choose from. These
- ports are named <cite>output-N</cite>, where <cite>N</cite> represents
- their identifier.</li>
- </ul>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.Sync.timeAdvance">
- <code class="descname">timeAdvance</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Sync.timeAdvance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Sync.timeAdvance" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.Sync.outputFnc">
- <code class="descname">outputFnc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Sync.outputFnc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Sync.outputFnc" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.Sync.intTransition">
- <code class="descname">intTransition</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Sync.intTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Sync.intTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.routing.Sync.extTransition">
- <code class="descname">extTransition</code><span class="sig-paren">(</span><em>inputs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/routing.html#Sync.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.routing.Sync.extTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- </dd></dl>
- </div>
- </div>
- </div>
- </div>
- <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
- <div class="sphinxsidebarwrapper">
- <h4>Previous topic</h4>
- <p class="topless"><a href="pypdevsbbl.generic.queues.html"
- title="previous chapter">pypdevsbbl.generic.queues module</a></p>
- <h4>Next topic</h4>
- <p class="topless"><a href="pypdevsbbl.generic.transformers.html"
- title="next chapter">pypdevsbbl.generic.transformers module</a></p>
- <div id="searchbox" style="display: none" role="search">
- <h3>Quick search</h3>
- <div class="searchformwrapper">
- <form class="search" action="search.html" method="get">
- <input type="text" name="q" />
- <input type="submit" value="Go" />
- <input type="hidden" name="check_keywords" value="yes" />
- <input type="hidden" name="area" value="default" />
- </form>
- </div>
- </div>
- <script type="text/javascript">$('#searchbox').show(0);</script>
- </div>
- </div>
- <div class="clearer"></div>
- </div>
- <div class="related" role="navigation" aria-label="related navigation">
- <h3>Navigation</h3>
- <ul>
- <li class="right" style="margin-right: 10px">
- <a href="genindex.html" title="General Index"
- >index</a></li>
- <li class="right" >
- <a href="py-modindex.html" title="Python Module Index"
- >modules</a> |</li>
- <li class="right" >
- <a href="pypdevsbbl.generic.transformers.html" title="pypdevsbbl.generic.transformers module"
- >next</a> |</li>
- <li class="right" >
- <a href="pypdevsbbl.generic.queues.html" title="pypdevsbbl.generic.queues module"
- >previous</a> |</li>
- <li class="nav-item nav-item-0"><a href="index.html">Python(P)DEVS-BBL documentation</a> »</li>
- <li class="nav-item nav-item-1"><a href="pypdevsbbl.html" >pypdevsbbl package</a> »</li>
- <li class="nav-item nav-item-2"><a href="pypdevsbbl.generic.html" >pypdevsbbl.generic package</a> »</li>
- </ul>
- </div>
- <div class="footer" role="contentinfo">
- © Copyright 2020, Randy Paredis.
- Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.8.5.
- </div>
- </body>
- </html>
|