pypdevsbbl.generic.routing.html 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <title>pypdevsbbl.generic.routing module &#8212; Python(P)DEVS-BBL documentation</title>
  8. <link rel="stylesheet" href="_static/nature.css" type="text/css" />
  9. <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  10. <link rel="stylesheet" type="text/css" href="_static/custom.css" />
  11. <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
  12. <script type="text/javascript" src="_static/jquery.js"></script>
  13. <script type="text/javascript" src="_static/underscore.js"></script>
  14. <script type="text/javascript" src="_static/doctools.js"></script>
  15. <script type="text/javascript" src="_static/language_data.js"></script>
  16. <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>
  17. <link rel="index" title="Index" href="genindex.html" />
  18. <link rel="search" title="Search" href="search.html" />
  19. <link rel="next" title="pypdevsbbl.generic.transformers module" href="pypdevsbbl.generic.transformers.html" />
  20. <link rel="prev" title="pypdevsbbl.generic.queues module" href="pypdevsbbl.generic.queues.html" />
  21. </head><body>
  22. <div class="related" role="navigation" aria-label="related navigation">
  23. <h3>Navigation</h3>
  24. <ul>
  25. <li class="right" style="margin-right: 10px">
  26. <a href="genindex.html" title="General Index"
  27. accesskey="I">index</a></li>
  28. <li class="right" >
  29. <a href="py-modindex.html" title="Python Module Index"
  30. >modules</a> |</li>
  31. <li class="right" >
  32. <a href="pypdevsbbl.generic.transformers.html" title="pypdevsbbl.generic.transformers module"
  33. accesskey="N">next</a> |</li>
  34. <li class="right" >
  35. <a href="pypdevsbbl.generic.queues.html" title="pypdevsbbl.generic.queues module"
  36. accesskey="P">previous</a> |</li>
  37. <li class="nav-item nav-item-0"><a href="index.html">Python(P)DEVS-BBL documentation</a> &#187;</li>
  38. <li class="nav-item nav-item-1"><a href="pypdevsbbl.html" >pypdevsbbl package</a> &#187;</li>
  39. <li class="nav-item nav-item-2"><a href="pypdevsbbl.generic.html" accesskey="U">pypdevsbbl.generic package</a> &#187;</li>
  40. </ul>
  41. </div>
  42. <div class="document">
  43. <div class="documentwrapper">
  44. <div class="bodywrapper">
  45. <div class="body" role="main">
  46. <div class="section" id="module-pypdevsbbl.generic.routing">
  47. <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>
  48. <p>Set of PythonPDEVS blocks for routing messages.</p>
  49. <dl class="class">
  50. <dt id="pypdevsbbl.generic.routing.Finish">
  51. <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>
  52. <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevs.DEVS.AtomicDEVS</span></code></p>
  53. <p>Destroys a message from the simulation.</p>
  54. <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
  55. data was gathered. The routing is just terminated.</p>
  56. <div class="admonition note">
  57. <p class="first admonition-title">Note</p>
  58. <p class="last">This block is only added for a better user experience.
  59. <code class="docutils literal notranslate"><span class="pre">Python</span></code> has no necessity for garbage collection within
  60. the <cite>PythonPDEVS</cite> simulator. It’s a better practice to use
  61. this block, but it is not enforced nor required.</p>
  62. </div>
  63. <div align="center" class="align-center"><img alt="_images/finish.svg" src="_images/finish.svg" /></div>
  64. <table class="docutils field-list" frame="void" rules="none">
  65. <col class="field-name" />
  66. <col class="field-body" />
  67. <tbody valign="top">
  68. <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>
  69. </tr>
  70. <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>
  71. </tr>
  72. </tbody>
  73. </table>
  74. <dl class="method">
  75. <dt id="pypdevsbbl.generic.routing.Finish.extTransition">
  76. <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>
  77. <dd></dd></dl>
  78. </dd></dl>
  79. <dl class="class">
  80. <dt id="pypdevsbbl.generic.routing.Halt">
  81. <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>
  82. <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevs.DEVS.AtomicDEVS</span></code></p>
  83. <p>Provides an end-point for the simulation.</p>
  84. <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
  85. stored instead of destroyed. It can be used to indicate the
  86. end of a simulation, or as a simple single-value collector.</p>
  87. <p class="rubric">Example</p>
  88. <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>
  89. <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>
  90. <span class="n">sim</span><span class="o">.</span><span class="n">simulate</span><span class="p">()</span>
  91. </pre></div>
  92. </div>
  93. <ol class="arabic simple">
  94. <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>
  95. <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
  96. 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>
  97. </ol>
  98. <div class="admonition note">
  99. <p class="first admonition-title">Note</p>
  100. <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
  101. condition when absolutely necessary, but know that this will decrease the overall
  102. efficieny of the simulation. More often than not, usage of this block can and should
  103. be omitted.</p>
  104. </div>
  105. <div align="center" class="align-center"><img alt="_images/halt.svg" src="_images/halt.svg" /></div>
  106. <table class="docutils field-list" frame="void" rules="none">
  107. <col class="field-name" />
  108. <col class="field-body" />
  109. <tbody valign="top">
  110. <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>
  111. </tr>
  112. <tr class="field-even field"><th class="field-name">State:</th><td class="field-body">The item that arrived.</td>
  113. </tr>
  114. <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>
  115. </tr>
  116. </tbody>
  117. </table>
  118. <dl class="method">
  119. <dt id="pypdevsbbl.generic.routing.Halt.extTransition">
  120. <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>
  121. <dd></dd></dl>
  122. <dl class="method">
  123. <dt id="pypdevsbbl.generic.routing.Halt.isHalted">
  124. <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>
  125. <dd><p>Whether or not an input was received.</p>
  126. <p>Helper function to pass to the simulator as termination condition.</p>
  127. </dd></dl>
  128. <dl class="staticmethod">
  129. <dt id="pypdevsbbl.generic.routing.Halt.anyHalted">
  130. <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>
  131. <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>
  132. <p>See the above-mentioned example on how to use this method.</p>
  133. </dd></dl>
  134. </dd></dl>
  135. <dl class="class">
  136. <dt id="pypdevsbbl.generic.routing.ChooseInput">
  137. <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>
  138. <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevs.DEVS.AtomicDEVS</span></code></p>
  139. <p>Choose a specific input to be opened.</p>
  140. <p>All other inputs will be closed and messages arrived there are
  141. discarded. This acts like a “path” that is enabled. The input
  142. ports can be indexed with an integer in [0, n).</p>
  143. <div align="center" class="align-center"><img alt="_images/choose-input.svg" src="_images/choose-input.svg" /></div>
  144. <table class="docutils field-list" frame="void" rules="none">
  145. <col class="field-name" />
  146. <col class="field-body" />
  147. <tbody valign="top">
  148. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  149. <li><strong>name</strong> (<em>str</em>) – The name of the block.</li>
  150. <li><strong>n</strong> (<em>int</em>) – The amount of input ports there are available
  151. in this block. Defaults to 2.</li>
  152. <li><strong>selected</strong> (<em>int</em>) – The initial input port that is enabled.</li>
  153. </ul>
  154. </td>
  155. </tr>
  156. <tr class="field-even field"><th class="field-name">State:</th><td class="field-body"><ul class="first simple">
  157. <li><strong>selected</strong> (<em>int</em>) – The currently selected input port to be used.</li>
  158. <li><strong>item</strong> (<em>any</em>) – The item that has arrived on this port.</li>
  159. </ul>
  160. </td>
  161. </tr>
  162. <tr class="field-odd field"><th class="field-name">Input Ports:</th><td class="field-body"><ul class="first simple">
  163. <li><strong>select</strong> (<em>int</em>) – The index of the new input port to be selected.
  164. When not in [0, n), a <cite>round robin</cite> method is
  165. applied.</li>
  166. <li><strong>inputs</strong> (<em>list</em>) – A list of the input ports to choose from. These
  167. ports are named <cite>input-N</cite>, where <cite>N</cite> represents
  168. their identifier.</li>
  169. </ul>
  170. </td>
  171. </tr>
  172. <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
  173. input port.</p>
  174. </td>
  175. </tr>
  176. </tbody>
  177. </table>
  178. <dl class="method">
  179. <dt id="pypdevsbbl.generic.routing.ChooseInput.timeAdvance">
  180. <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>
  181. <dd></dd></dl>
  182. <dl class="method">
  183. <dt id="pypdevsbbl.generic.routing.ChooseInput.outputFnc">
  184. <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>
  185. <dd></dd></dl>
  186. <dl class="method">
  187. <dt id="pypdevsbbl.generic.routing.ChooseInput.intTransition">
  188. <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>
  189. <dd></dd></dl>
  190. <dl class="method">
  191. <dt id="pypdevsbbl.generic.routing.ChooseInput.extTransition">
  192. <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>
  193. <dd></dd></dl>
  194. </dd></dl>
  195. <dl class="class">
  196. <dt id="pypdevsbbl.generic.routing.ChooseOutput">
  197. <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>
  198. <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevs.DEVS.AtomicDEVS</span></code></p>
  199. <p>Choose a specific output to be opened.</p>
  200. <p>All other outputs will be closed and messages arrived there are
  201. discarded. This acts like a “path” that is enabled. The output
  202. ports can be indexed with an integer in [0, n).</p>
  203. <div class="admonition seealso">
  204. <p class="first admonition-title">See also</p>
  205. <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>
  206. </div>
  207. <div align="center" class="align-center"><img alt="_images/choose-output.svg" src="_images/choose-output.svg" /></div>
  208. <table class="docutils field-list" frame="void" rules="none">
  209. <col class="field-name" />
  210. <col class="field-body" />
  211. <tbody valign="top">
  212. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  213. <li><strong>name</strong> (<em>str</em>) – The name of the block.</li>
  214. <li><strong>n</strong> (<em>int</em>) – The amount of output ports there are available
  215. in this block. Defaults to 2.</li>
  216. <li><strong>selected</strong> (<em>int</em>) – The initial output port that is enabled.</li>
  217. </ul>
  218. </td>
  219. </tr>
  220. <tr class="field-even field"><th class="field-name">State:</th><td class="field-body"><ul class="first simple">
  221. <li><strong>selected</strong> (<em>int</em>) – The currently selected output port to be used.</li>
  222. <li><strong>item</strong> (<em>any</em>) – The item that needs to be sent through a specific
  223. output.</li>
  224. </ul>
  225. </td>
  226. </tr>
  227. <tr class="field-odd field"><th class="field-name">Input Ports:</th><td class="field-body"><ul class="first simple">
  228. <li><strong>select</strong> (<em>int</em>) – The index of the new input port to be selected.
  229. When not in [0, n), a <cite>round robin</cite> method is
  230. applied.</li>
  231. <li><strong>input</strong> (<em>any</em>) – The item that needs to be routed to the currently
  232. enabled output port.</li>
  233. </ul>
  234. </td>
  235. </tr>
  236. <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
  237. ports are named <cite>output-N</cite>, where <cite>N</cite> represents
  238. their identifier.</p>
  239. </td>
  240. </tr>
  241. </tbody>
  242. </table>
  243. <dl class="method">
  244. <dt id="pypdevsbbl.generic.routing.ChooseOutput.timeAdvance">
  245. <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>
  246. <dd></dd></dl>
  247. <dl class="method">
  248. <dt id="pypdevsbbl.generic.routing.ChooseOutput.outputFnc">
  249. <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>
  250. <dd></dd></dl>
  251. <dl class="method">
  252. <dt id="pypdevsbbl.generic.routing.ChooseOutput.intTransition">
  253. <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>
  254. <dd></dd></dl>
  255. <dl class="method">
  256. <dt id="pypdevsbbl.generic.routing.ChooseOutput.extTransition">
  257. <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>
  258. <dd></dd></dl>
  259. </dd></dl>
  260. <dl class="class">
  261. <dt id="pypdevsbbl.generic.routing.Pick">
  262. <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=&lt;function Pick.&lt;lambda&gt;&gt;</em>, <em>fc=&lt;function Pick.&lt;lambda&gt;&gt;</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>
  263. <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevs.DEVS.AtomicDEVS</span></code></p>
  264. <p>Marks certain paths as available.</p>
  265. <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
  266. if each output of that block can be busy. Whenever such an event occurs,
  267. 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
  268. 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
  269. free.</p>
  270. <div class="admonition note">
  271. <p class="first admonition-title">Note</p>
  272. <p class="last">Whenever no free path is found, no new value is outputted and therefore,
  273. 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>
  274. </div>
  275. <div class="admonition seealso">
  276. <p class="first admonition-title">See also</p>
  277. <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>
  278. </div>
  279. <div align="center" class="align-center"><img alt="_images/pick.svg" src="_images/pick.svg" /></div>
  280. <table class="docutils field-list" frame="void" rules="none">
  281. <col class="field-name" />
  282. <col class="field-body" />
  283. <tbody valign="top">
  284. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  285. <li><strong>name</strong> (<em>str</em>) – The name of the block.</li>
  286. <li><strong>n</strong> (<em>numeric</em>) – The amount of paths to choose from.</li>
  287. <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
  288. a set of booleans. Each value corresponds to the
  289. 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>
  290. marks path 1 to be busy and paths 0 and 2 to be free.
  291. When <code class="docutils literal notranslate"><span class="pre">None</span></code>, all paths are marked as free. Defaults
  292. to <code class="docutils literal notranslate"><span class="pre">None</span></code>.</li>
  293. <li><strong>select</strong> (<em>def</em>) – Function that selects a path from a list of available
  294. paths. As an argument, a list of pairs is given in the
  295. 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
  296. available path is chosen.</li>
  297. <li><strong>fc</strong> (<em>def</em>) – Function that checks if the claim input may mark the
  298. path as busy. Defaults to always <code class="docutils literal notranslate"><span class="pre">True</span></code>.</li>
  299. <li><strong>lif</strong> (<em>bool</em>) – Indicative that the last port the fallback port is or
  300. not. This port cannot be marked busy.</li>
  301. </ul>
  302. </td>
  303. </tr>
  304. <tr class="field-even field"><th class="field-name">State:</th><td class="field-body"><ul class="first simple">
  305. <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>
  306. <li><strong>input-n</strong> (<em>numeric</em>) – The freedom of the <cite>n</cite> th input port and its idle time.</li>
  307. </ul>
  308. </td>
  309. </tr>
  310. <tr class="field-odd field"><th class="field-name">Input Ports:</th><td class="field-body"><ul class="first simple">
  311. <li><strong>claim</strong> (<em>any</em>) – Marks the currently selected path to be busy.</li>
  312. <li><strong>inputs</strong> (<em>list</em>) – A list of the input ports to choose from. These ports are
  313. named <cite>input-N</cite>, where <cite>N</cite> represents their identifier.
  314. When a message arrives, the corresponding path is marked
  315. as “free”.</li>
  316. </ul>
  317. </td>
  318. </tr>
  319. <tr class="field-even field"><th class="field-name">Output Ports:</th><td class="field-body"><ul class="first last simple">
  320. <li><strong>output</strong> (<em>int</em>) – The index of the path to select. Should be used as-is as
  321. 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>
  322. <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>
  323. </ul>
  324. </td>
  325. </tr>
  326. </tbody>
  327. </table>
  328. <dl class="method">
  329. <dt id="pypdevsbbl.generic.routing.Pick.next">
  330. <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>
  331. <dd><p>Gets the next available port.</p>
  332. </dd></dl>
  333. <dl class="method">
  334. <dt id="pypdevsbbl.generic.routing.Pick.timeAdvance">
  335. <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>
  336. <dd></dd></dl>
  337. <dl class="method">
  338. <dt id="pypdevsbbl.generic.routing.Pick.outputFnc">
  339. <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>
  340. <dd></dd></dl>
  341. <dl class="method">
  342. <dt id="pypdevsbbl.generic.routing.Pick.intTransition">
  343. <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>
  344. <dd></dd></dl>
  345. <dl class="method">
  346. <dt id="pypdevsbbl.generic.routing.Pick.extTransition">
  347. <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>
  348. <dd></dd></dl>
  349. </dd></dl>
  350. <dl class="class">
  351. <dt id="pypdevsbbl.generic.routing.Guard">
  352. <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=&lt;function Guard.&lt;lambda&gt;&gt;</em>, <em>u=&lt;function Guard.&lt;lambda&gt;&gt;</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>
  353. <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevs.DEVS.AtomicDEVS</span></code></p>
  354. <p>Shields sections to a limited amount of resources.</p>
  355. <p>Items that request access should arrive on the <cite>input</cite> port,
  356. whereas items that release their access should arrive on the
  357. <cite>leave</cite> port. When no access is granted, the message will be
  358. outputted on the <cite>blocked</cite> port and otherwise, it is passed
  359. on to the <cite>guarded</cite> port. Items that leave are also outputted
  360. on the <cite>unguarded</cite> port.</p>
  361. <div align="center" class="align-center"><img alt="_images/guard.svg" src="_images/guard.svg" /></div>
  362. <table class="docutils field-list" frame="void" rules="none">
  363. <col class="field-name" />
  364. <col class="field-body" />
  365. <tbody valign="top">
  366. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  367. <li><strong>name</strong> (<em>str</em>) – The name of the block.</li>
  368. <li><strong>n</strong> (<em>int</em>) – Amount of available resources at the start.
  369. Defaults to 0.</li>
  370. <li><strong>w</strong> (<em>def</em>) – Weight function for items that enter the block.
  371. Takes the item itself as an argument and should
  372. return an integer. It may not alter the item.</li>
  373. <li><strong>u</strong> (<em>def</em>) – Weight function for items that leave the block.
  374. Takes the item itself as an argument and should
  375. return an integer. It may not alter the item.</li>
  376. </ul>
  377. </td>
  378. </tr>
  379. <tr class="field-even field"><th class="field-name">State:</th><td class="field-body"><ul class="first simple">
  380. <li><strong>n</strong> (<em>int</em>) – Amount of available resources.</li>
  381. <li><strong>enter</strong> (<em>any</em>) – The item that requested access to the resources.</li>
  382. <li><strong>leave</strong> (<em>any</em>) – The item that releases access to resources.</li>
  383. </ul>
  384. </td>
  385. </tr>
  386. <tr class="field-odd field"><th class="field-name">Input Ports:</th><td class="field-body"><ul class="first simple">
  387. <li><strong>input</strong> (<em>any</em>) – The items that request access to resources.</li>
  388. <li><strong>leave</strong> (<em>any</em>) – The items that release access to resources.</li>
  389. </ul>
  390. </td>
  391. </tr>
  392. <tr class="field-even field"><th class="field-name">Output Ports:</th><td class="field-body"><ul class="first last simple">
  393. <li><strong>blocked</strong> (<em>any</em>) – The item that requested access will be outputted
  394. here if there are not enough resources for it.</li>
  395. <li><strong>guarded</strong> (<em>any</em>) – Items that were granted access to resources.</li>
  396. <li><strong>unguarded</strong> (<em>any</em>) – Items that released access to the resources.</li>
  397. </ul>
  398. </td>
  399. </tr>
  400. </tbody>
  401. </table>
  402. <dl class="method">
  403. <dt id="pypdevsbbl.generic.routing.Guard.timeAdvance">
  404. <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>
  405. <dd></dd></dl>
  406. <dl class="method">
  407. <dt id="pypdevsbbl.generic.routing.Guard.outputFnc">
  408. <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>
  409. <dd></dd></dl>
  410. <dl class="method">
  411. <dt id="pypdevsbbl.generic.routing.Guard.intTransition">
  412. <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>
  413. <dd></dd></dl>
  414. <dl class="method">
  415. <dt id="pypdevsbbl.generic.routing.Guard.extTransition">
  416. <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>
  417. <dd></dd></dl>
  418. </dd></dl>
  419. <dl class="class">
  420. <dt id="pypdevsbbl.generic.routing.Gate">
  421. <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>
  422. <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevs.DEVS.AtomicDEVS</span></code></p>
  423. <p>Toggleable access to a section of a model.</p>
  424. <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
  425. resources. Instead a boolean value indicates if the message
  426. receives access or not.</p>
  427. <p>When this value is <code class="docutils literal notranslate"><span class="pre">True</span></code>, all items will be outputted on the
  428. <cite>blocked</cite> output, otherwise on the <cite>out</cite> output.</p>
  429. <div align="center" class="align-center"><img alt="_images/gate.svg" src="_images/gate.svg" /></div>
  430. <table class="docutils field-list" frame="void" rules="none">
  431. <col class="field-name" />
  432. <col class="field-body" />
  433. <tbody valign="top">
  434. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  435. <li><strong>name</strong> (<em>str</em>) – The name of the block.</li>
  436. <li><strong>blocked</strong> (<em>bool</em>) – The initial state of the gate.</li>
  437. </ul>
  438. </td>
  439. </tr>
  440. <tr class="field-even field"><th class="field-name">State:</th><td class="field-body"><ul class="first simple">
  441. <li><strong>blocked</strong> (<em>bool</em>) – Indicates where the items should be outputted.</li>
  442. <li><strong>item</strong> (<em>any</em>) – The item to be outputted.</li>
  443. </ul>
  444. </td>
  445. </tr>
  446. <tr class="field-odd field"><th class="field-name">Input Ports:</th><td class="field-body"><ul class="first simple">
  447. <li><strong>input</strong> (<em>any</em>) – The items that want to gain access to the critical
  448. section.</li>
  449. <li><strong>block</strong> (<em>bool</em>) – Indicates the state of the gate.
  450. <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>
  451. </ul>
  452. </td>
  453. </tr>
  454. <tr class="field-even field"><th class="field-name">Output Ports:</th><td class="field-body"><ul class="first last simple">
  455. <li><strong>output</strong> (<em>any</em>) – All items that arrived on <cite>input</cite> if the gate is open.</li>
  456. <li><strong>blocked</strong> (<em>any</em>) – All items that arrived on <cite>input</cite> if the gate is closed.</li>
  457. </ul>
  458. </td>
  459. </tr>
  460. </tbody>
  461. </table>
  462. <dl class="method">
  463. <dt id="pypdevsbbl.generic.routing.Gate.timeAdvance">
  464. <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>
  465. <dd></dd></dl>
  466. <dl class="method">
  467. <dt id="pypdevsbbl.generic.routing.Gate.outputFnc">
  468. <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>
  469. <dd></dd></dl>
  470. <dl class="method">
  471. <dt id="pypdevsbbl.generic.routing.Gate.intTransition">
  472. <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>
  473. <dd></dd></dl>
  474. <dl class="method">
  475. <dt id="pypdevsbbl.generic.routing.Gate.extTransition">
  476. <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>
  477. <dd></dd></dl>
  478. </dd></dl>
  479. <dl class="class">
  480. <dt id="pypdevsbbl.generic.routing._DT">
  481. <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>
  482. <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevs.DEVS.AtomicDEVS</span></code></p>
  483. <p>Superclass for both the Delayer and the Timer.</p>
  484. <div class="admonition warning">
  485. <p class="first admonition-title">Warning</p>
  486. <p class="last">This class should not be used as a block by itself.</p>
  487. </div>
  488. <table class="docutils field-list" frame="void" rules="none">
  489. <col class="field-name" />
  490. <col class="field-body" />
  491. <tbody valign="top">
  492. <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>
  493. </tr>
  494. </tbody>
  495. </table>
  496. <dl class="method">
  497. <dt id="pypdevsbbl.generic.routing._DT.timeAdvance">
  498. <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>
  499. <dd></dd></dl>
  500. <dl class="method">
  501. <dt id="pypdevsbbl.generic.routing._DT.outputFnc">
  502. <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>
  503. <dd></dd></dl>
  504. <dl class="method">
  505. <dt id="pypdevsbbl.generic.routing._DT.intTransition">
  506. <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>
  507. <dd></dd></dl>
  508. <dl class="method">
  509. <dt id="pypdevsbbl.generic.routing._DT.extTransition">
  510. <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>
  511. <dd></dd></dl>
  512. </dd></dl>
  513. <dl class="class">
  514. <dt id="pypdevsbbl.generic.routing.Delayer">
  515. <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=&lt;function Delayer.&lt;lambda&gt;&gt;</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>
  516. <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>
  517. <p>Holds a message for a certain delay, as is defined by the item.</p>
  518. <div align="center" class="align-center"><img alt="_images/delayer.svg" src="_images/delayer.svg" /></div>
  519. <table class="docutils field-list" frame="void" rules="none">
  520. <col class="field-name" />
  521. <col class="field-body" />
  522. <tbody valign="top">
  523. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  524. <li><strong>name</strong> (<em>str</em>) – The name of the block.</li>
  525. <li><strong>ft</strong> (<em>def</em>) – Time delay function that takes the item as
  526. argument and returns a numeric value. When
  527. the returnvalue is less than 0, INFINITY is
  528. assumed. The function musn’t change the item.
  529. Defaults to a function that always returns 1.</li>
  530. </ul>
  531. </td>
  532. </tr>
  533. <tr class="field-even field"><th class="field-name">State:</th><td class="field-body"><ul class="first simple">
  534. <li><strong>el</strong> (<em>numeric</em>) – The elapsed time since an item is being held.</li>
  535. <li><strong>dt</strong> (<em>numeric</em>) – The time delay to hold an item for. Must be
  536. positive or 0. This is the result of <code class="xref py py-meth docutils literal notranslate"><span class="pre">ft()</span></code>.</li>
  537. <li><strong>item</strong> (<em>any</em>) – The item to hold.</li>
  538. <li><strong>other</strong> (<em>any</em>) – When an item is already being held, store the
  539. new item that arrives.</li>
  540. </ul>
  541. </td>
  542. </tr>
  543. <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>
  544. </td>
  545. </tr>
  546. <tr class="field-even field"><th class="field-name">Output Ports:</th><td class="field-body"><ul class="first last simple">
  547. <li><strong>blocked</strong> (<em>any</em>) – All items that arrive when an item is being held.</li>
  548. <li><strong>finished</strong> (<em>any</em>) – The item thet was held for time delay <cite>dt</cite>.</li>
  549. </ul>
  550. </td>
  551. </tr>
  552. </tbody>
  553. </table>
  554. <dl class="method">
  555. <dt id="pypdevsbbl.generic.routing.Delayer.extTransition">
  556. <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>
  557. <dd></dd></dl>
  558. </dd></dl>
  559. <dl class="class">
  560. <dt id="pypdevsbbl.generic.routing.Timer">
  561. <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>
  562. <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>
  563. <p>Holds a message for a predefined delay.</p>
  564. <p>Basically corresponds to a blocking queue with a capacity of 1.
  565. When there is a requirement for more items. Use a
  566. <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>
  567. with an infinite <cite>dd</cite> and a non-infinte <cite>dr</cite>.</p>
  568. <div class="admonition note">
  569. <p class="first admonition-title">Note</p>
  570. <p><cite>DEVS</cite> are evaluated at each event, not at each time instance, meaning that
  571. there can be multiple events at the same time. If some of them are external,
  572. while others are internal, they will never be displayed in the same <em>timeframe</em>.
  573. A timeframe is therefore a collection of events. Each point in time can have
  574. multiple timeframes.</p>
  575. <p class="last">Use this block (with a dt of 0) to sync up events that happen out-of-order w.r.t.
  576. these timeframes.</p>
  577. </div>
  578. <div align="center" class="align-center"><img alt="_images/timer.svg" src="_images/timer.svg" /></div>
  579. <table class="docutils field-list" frame="void" rules="none">
  580. <col class="field-name" />
  581. <col class="field-body" />
  582. <tbody valign="top">
  583. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  584. <li><strong>name</strong> (<em>str</em>) – The name of the block.</li>
  585. <li><strong>dt</strong> (<em>numeric</em>) – The initial delay to hold an item for.</li>
  586. </ul>
  587. </td>
  588. </tr>
  589. <tr class="field-even field"><th class="field-name">State:</th><td class="field-body"><ul class="first simple">
  590. <li><strong>el</strong> (<em>numeric</em>) – The elapsed time since an item is being held.</li>
  591. <li><strong>dt</strong> (<em>numeric</em>) – The time delay to hold an item for. Must be
  592. positive or 0. Defaults to 0.</li>
  593. <li><strong>item</strong> (<em>any</em>) – The item to hold.</li>
  594. <li><strong>other</strong> (<em>any</em>) – When an item is already being held, store the
  595. new item that arrives.</li>
  596. </ul>
  597. </td>
  598. </tr>
  599. <tr class="field-odd field"><th class="field-name">Input Ports:</th><td class="field-body"><ul class="first simple">
  600. <li><strong>start</strong> (<em>any</em>) – Start the timer for the item.</li>
  601. <li><strong>dt</strong> (<em>numeric</em>) – New time delay to hold an item for. Must be
  602. positive or 0. Any other value is discarded.</li>
  603. </ul>
  604. </td>
  605. </tr>
  606. <tr class="field-even field"><th class="field-name">Output Ports:</th><td class="field-body"><ul class="first last simple">
  607. <li><strong>blocked</strong> (<em>any</em>) – All items that arrive when an item is being held.</li>
  608. <li><strong>finished</strong> (<em>any</em>) – The item thet was held for time delay <cite>dt</cite>.</li>
  609. </ul>
  610. </td>
  611. </tr>
  612. </tbody>
  613. </table>
  614. <dl class="method">
  615. <dt id="pypdevsbbl.generic.routing.Timer.extTransition">
  616. <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>
  617. <dd></dd></dl>
  618. </dd></dl>
  619. <dl class="class">
  620. <dt id="pypdevsbbl.generic.routing.Sync">
  621. <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>
  622. <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevs.DEVS.AtomicDEVS</span></code></p>
  623. <p>Synchronizes a set of connections.</p>
  624. <div class="admonition note">
  625. <p class="first admonition-title">Note</p>
  626. <p class="last">This block does not enqueue the arriving messages
  627. and should thus not be used to delay messages that
  628. arrive too fast.</p>
  629. </div>
  630. <div align="center" class="align-center"><img alt="_images/sync.svg" src="_images/sync.svg" /></div>
  631. <table class="docutils field-list" frame="void" rules="none">
  632. <col class="field-name" />
  633. <col class="field-body" />
  634. <tbody valign="top">
  635. <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
  636. <li><strong>name</strong> (<em>str</em>) – The name of the block.</li>
  637. <li><strong>n</strong> (<em>int</em>) – The amount of ports to sync. Must be greater
  638. than 0.</li>
  639. </ul>
  640. </td>
  641. </tr>
  642. <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>
  643. </td>
  644. </tr>
  645. <tr class="field-odd field"><th class="field-name">Output Ports:</th><td class="field-body"><ul class="first last simple">
  646. <li><strong>input</strong> (<em>list</em>) – A list of the input ports to choose from. These
  647. ports are named <cite>input-N</cite>, where <cite>N</cite> represents
  648. their identifier.</li>
  649. <li><strong>output</strong> (<em>list</em>) – A list of the output ports to choose from. These
  650. ports are named <cite>output-N</cite>, where <cite>N</cite> represents
  651. their identifier.</li>
  652. </ul>
  653. </td>
  654. </tr>
  655. </tbody>
  656. </table>
  657. <dl class="method">
  658. <dt id="pypdevsbbl.generic.routing.Sync.timeAdvance">
  659. <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>
  660. <dd></dd></dl>
  661. <dl class="method">
  662. <dt id="pypdevsbbl.generic.routing.Sync.outputFnc">
  663. <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>
  664. <dd></dd></dl>
  665. <dl class="method">
  666. <dt id="pypdevsbbl.generic.routing.Sync.intTransition">
  667. <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>
  668. <dd></dd></dl>
  669. <dl class="method">
  670. <dt id="pypdevsbbl.generic.routing.Sync.extTransition">
  671. <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>
  672. <dd></dd></dl>
  673. </dd></dl>
  674. </div>
  675. </div>
  676. </div>
  677. </div>
  678. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  679. <div class="sphinxsidebarwrapper">
  680. <h4>Previous topic</h4>
  681. <p class="topless"><a href="pypdevsbbl.generic.queues.html"
  682. title="previous chapter">pypdevsbbl.generic.queues module</a></p>
  683. <h4>Next topic</h4>
  684. <p class="topless"><a href="pypdevsbbl.generic.transformers.html"
  685. title="next chapter">pypdevsbbl.generic.transformers module</a></p>
  686. <div id="searchbox" style="display: none" role="search">
  687. <h3>Quick search</h3>
  688. <div class="searchformwrapper">
  689. <form class="search" action="search.html" method="get">
  690. <input type="text" name="q" />
  691. <input type="submit" value="Go" />
  692. <input type="hidden" name="check_keywords" value="yes" />
  693. <input type="hidden" name="area" value="default" />
  694. </form>
  695. </div>
  696. </div>
  697. <script type="text/javascript">$('#searchbox').show(0);</script>
  698. </div>
  699. </div>
  700. <div class="clearer"></div>
  701. </div>
  702. <div class="related" role="navigation" aria-label="related navigation">
  703. <h3>Navigation</h3>
  704. <ul>
  705. <li class="right" style="margin-right: 10px">
  706. <a href="genindex.html" title="General Index"
  707. >index</a></li>
  708. <li class="right" >
  709. <a href="py-modindex.html" title="Python Module Index"
  710. >modules</a> |</li>
  711. <li class="right" >
  712. <a href="pypdevsbbl.generic.transformers.html" title="pypdevsbbl.generic.transformers module"
  713. >next</a> |</li>
  714. <li class="right" >
  715. <a href="pypdevsbbl.generic.queues.html" title="pypdevsbbl.generic.queues module"
  716. >previous</a> |</li>
  717. <li class="nav-item nav-item-0"><a href="index.html">Python(P)DEVS-BBL documentation</a> &#187;</li>
  718. <li class="nav-item nav-item-1"><a href="pypdevsbbl.html" >pypdevsbbl package</a> &#187;</li>
  719. <li class="nav-item nav-item-2"><a href="pypdevsbbl.generic.html" >pypdevsbbl.generic package</a> &#187;</li>
  720. </ul>
  721. </div>
  722. <div class="footer" role="contentinfo">
  723. &#169; Copyright 2020, Randy Paredis.
  724. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.8.5.
  725. </div>
  726. </body>
  727. </html>