| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539 |
- <!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.queues 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.routing module" href="pypdevsbbl.generic.routing.html" />
- <link rel="prev" title="pypdevsbbl.generic.math module" href="pypdevsbbl.generic.math.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.routing.html" title="pypdevsbbl.generic.routing module"
- accesskey="N">next</a> |</li>
- <li class="right" >
- <a href="pypdevsbbl.generic.math.html" title="pypdevsbbl.generic.math 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.queues">
- <span id="pypdevsbbl-generic-queues-module"></span><h1>pypdevsbbl.generic.queues module<a class="headerlink" href="#module-pypdevsbbl.generic.queues" title="Permalink to this headline">¶</a></h1>
- <p>PythonPDEVS Queue for storing items that are waiting to be processed.</p>
- <dl class="class">
- <dt id="pypdevsbbl.generic.queues.SimpleQueue">
- <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.queues.</code><code class="descname">SimpleQueue</code><span class="sig-paren">(</span><em>name: str</em>, <em>fc=<function <lambda>></em>, <em>K=inf</em>, <em>dr=inf</em>, <em>contents=()</em>, <em>req_am=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/queues.html#SimpleQueue"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.queues.SimpleQueue" 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>Queue with reneging that allows items to wait for storage.</p>
- <p>Items can only be dequeued when a requestdequeue input is obtained. This
- makes it so the queue don’t have to handle the complexities concerning
- automatic dequeueing. See the <a class="reference internal" href="#pypdevsbbl.generic.queues.Queue" title="pypdevsbbl.generic.queues.Queue"><code class="xref py py-class docutils literal notranslate"><span class="pre">Queue</span></code></a> for more details on automatic
- dequeueing.</p>
- <p>Reneging will happen automatically if needs be. The requestrenege will
- renege the last item in the queue.</p>
- <p>The enqueue will send the outputs to the overflow output if capacity >= K.</p>
- <div class="admonition note">
- <p class="first admonition-title">Note</p>
- <p class="last">We will be using a maxheap in this queue.</p>
- </div>
- <div align="center" class="align-center"><img alt="../paper/images/blocks/queue/simple-queue.svg" src="../paper/images/blocks/queue/simple-queue.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 Queue.</li>
- <li><strong>fc</strong> (<em>def</em>) – Queueing Discipline. I.e. the priority assigning
- function. Takes the current time, the value and a
- unique index as arguments. Defaults to
- <a class="reference internal" href="pypdevsbbl.extra.queues.html#pypdevsbbl.extra.queues.FIFO" title="pypdevsbbl.extra.queues.FIFO"><code class="xref py py-meth docutils literal notranslate"><span class="pre">pypdevsbbl.extra.queues.FIFO()</span></code></a>.</li>
- <li><strong>K</strong> (<em>int</em>) – The maximal capacity of the Queue.
- Defaults to INFINITY (= no maximal capacity).</li>
- <li><strong>dr</strong> (<em>numeric</em>) – Standard reneging time delay. Cannot be negative.
- Defaults to INFINITY (= no reneging).</li>
- <li><strong>contents</strong> (<em>iter</em>) – A list of contents to be inserted into the queue on
- startup. Defaults to an empty tuple.</li>
- <li><strong>req_am</strong> (<em>bool</em>) – When <code class="docutils literal notranslate"><span class="pre">True</span></code>, the message in a dequeue/renege
- request indicates the amount that should be released.
- When <code class="docutils literal notranslate"><span class="pre">False</span></code>, no matter which message arrives on
- these ports, only a single item is released. Defaults
- to <code class="docutils literal notranslate"><span class="pre">False</span></code>.</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>queue</strong> (<em>heap</em>) – The internal heap for this priority queue.</li>
- <li><strong>dr</strong> (<em>numeric</em>) – The renege time delay.</li>
- <li><strong>T</strong> (<em>numeric</em>) – Current absolute time.</li>
- <li><strong>rd</strong> (<em>bool</em>) – If a dequeue operation was requested.</li>
- <li><strong>rr</strong> (<em>bool</em>) – If a renege operation was requested.</li>
- <li><strong>ovf</strong> (<em>any</em>) – The overflowing items.</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>enqueue</strong> (<em>any</em>) – Obtains values and queues them.</li>
- <li><strong>dr</strong> (<em>numeric</em>) – A new minimal time in the system value. Cannot be
- negative.</li>
- <li><strong>requestdequeue</strong> – Indicates that items must dequeue. When <code class="xref py py-attr docutils literal notranslate"><span class="pre">req_am</span></code>
- is <code class="docutils literal notranslate"><span class="pre">True</span></code>, it expects a natural number. Otherwise,
- any arriving value is accepted and a single item will
- be dequeued.</li>
- <li><strong>requestrenege</strong> – Indicates that the last item in the queue must depart on
- the <cite>renege</cite> port. When <code class="xref py py-attr docutils literal notranslate"><span class="pre">req_am</span></code> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, it
- expects a natural number. Otherwise, any arriving value is
- accepted and a single item will be reneged.</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>dequeue</strong> (<em>any</em>) – Outputs the next item if it exists.</li>
- <li><strong>renege</strong> (<em>any</em>) – Outputs reneged items.</li>
- <li><strong>overflow</strong> (<em>any</em>) – Outputs overflowing items.</li>
- </ul>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="pypdevsbbl.generic.queues.SimpleQueue.minRen">
- <code class="descname">minRen</code><span class="sig-paren">(</span><em>init=inf</em>, <em>it=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/queues.html#SimpleQueue.minRen"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.queues.SimpleQueue.minRen" title="Permalink to this definition">¶</a></dt>
- <dd><p>Obtain the item that has a minimal reneging time.</p>
- <p>Also compare it to the given item.</p>
- <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>init</strong> (<em>numeric</em>) – The initial value to compare it to.</li>
- <li><strong>it</strong> (<em>any</em>) – The item that is linked to the <code class="docutils literal notranslate"><span class="pre">init</span></code>
- value.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">Tuple in the shape of <code class="docutils literal notranslate"><span class="pre">(time,</span> <span class="pre">item)</span></code> where <code class="docutils literal notranslate"><span class="pre">time</span></code> is
- the time delay until next renege and <code class="docutils literal notranslate"><span class="pre">item</span></code> the item that
- must be reneged.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.queues.SimpleQueue.maxRen">
- <code class="descname">maxRen</code><span class="sig-paren">(</span><em>init=-inf</em>, <em>it=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/queues.html#SimpleQueue.maxRen"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.queues.SimpleQueue.maxRen" title="Permalink to this definition">¶</a></dt>
- <dd><p>Obtain the item that has a maximal reneging time.</p>
- <p>Also compare it to the given item.</p>
- <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>init</strong> (<em>numeric</em>) – The initial value to compare it to.</li>
- <li><strong>it</strong> (<em>any</em>) – The item that is linked to the <code class="docutils literal notranslate"><span class="pre">init</span></code>
- value.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">Tuple in the shape of <code class="docutils literal notranslate"><span class="pre">(time,</span> <span class="pre">item)</span></code> where <code class="docutils literal notranslate"><span class="pre">time</span></code> is
- the time delay until the last renege and <code class="docutils literal notranslate"><span class="pre">item</span></code> the item
- that must be reneged last.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.queues.SimpleQueue.timeAdvance">
- <code class="descname">timeAdvance</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/queues.html#SimpleQueue.timeAdvance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.queues.SimpleQueue.timeAdvance" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.queues.SimpleQueue.intTransition">
- <code class="descname">intTransition</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/queues.html#SimpleQueue.intTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.queues.SimpleQueue.intTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.queues.SimpleQueue.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/queues.html#SimpleQueue.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.queues.SimpleQueue.extTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.queues.SimpleQueue.outputFnc">
- <code class="descname">outputFnc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/queues.html#SimpleQueue.outputFnc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.queues.SimpleQueue.outputFnc" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- </dd></dl>
- <dl class="class">
- <dt id="pypdevsbbl.generic.queues.QueueTracker">
- <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.queues.</code><code class="descname">QueueTracker</code><span class="sig-paren">(</span><em>name: str</em>, <em>dt=inf</em>, <em>size=0</em>, <em>value=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/queues.html#QueueTracker"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.queues.QueueTracker" 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>Helper block for the <a class="reference internal" href="#pypdevsbbl.generic.queues.SimpleQueue" title="pypdevsbbl.generic.queues.SimpleQueue"><code class="xref py py-class docutils literal notranslate"><span class="pre">SimpleQueue</span></code></a> to be linked in the <a class="reference internal" href="#pypdevsbbl.generic.queues.Queue" title="pypdevsbbl.generic.queues.Queue"><code class="xref py py-class docutils literal notranslate"><span class="pre">Queue</span></code></a>.</p>
- <p>Instead of using a <code class="xref py py-class docutils literal notranslate"><span class="pre">ConstantGenerator</span></code>, this block will be used to
- periodically request dequeues. It also keeps track of the current queue
- size, meaning that, whenever the queue is empty, it can pause until the
- next input.</p>
- <div align="center" class="align-center"><img alt="../paper/images/blocks/queue/queue-tracker.svg" src="../paper/images/blocks/queue/queue-tracker.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 for the block.</li>
- <li><strong>dt</strong> (<em>numeric</em>) – Standard time delay between messages.
- Defaults to INFINITY. Cannot be zero or negative.</li>
- <li><strong>size</strong> (<em>int</em>) – The queue size to start from. Must be positive or
- zero. Defaults to 0.</li>
- <li><strong>value</strong> (<em>any</em>) – The value to output instead of the queue size.
- When <code class="docutils literal notranslate"><span class="pre">None</span></code>, the queue size is used. Defaults to
- <code class="docutils literal notranslate"><span class="pre">None</span></code>.</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>dt</strong> (<em>numeric</em>) – The time delay between messages.</li>
- <li><strong>el</strong> (<em>numeric</em>) – The elapsed time since the last event.</li>
- <li><strong>size</strong> (<em>int</em>) – The current queue size.</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>dt</strong> (<em>numeric</em>) – Updates the time delay.</li>
- <li><strong>enter</strong> (<em>any</em>) – An item entered the queue.</li>
- <li><strong>leave</strong> (<em>any</em>) – An item left the queue.</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>size</strong> (<em>int</em>) – The queue size or a predefined value.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="pypdevsbbl.generic.queues.QueueTracker.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/queues.html#QueueTracker.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.queues.QueueTracker.extTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.queues.QueueTracker.intTransition">
- <code class="descname">intTransition</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/queues.html#QueueTracker.intTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.queues.QueueTracker.intTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.queues.QueueTracker.timeAdvance">
- <code class="descname">timeAdvance</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/queues.html#QueueTracker.timeAdvance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.queues.QueueTracker.timeAdvance" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.queues.QueueTracker.outputFnc">
- <code class="descname">outputFnc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/queues.html#QueueTracker.outputFnc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.queues.QueueTracker.outputFnc" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- </dd></dl>
- <dl class="class">
- <dt id="pypdevsbbl.generic.queues.Queue">
- <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.queues.</code><code class="descname">Queue</code><span class="sig-paren">(</span><em>name: str</em>, <em>fc=<function <lambda>></em>, <em>K=inf</em>, <em>dd=inf</em>, <em>dr=inf</em>, <em>contents=()</em>, <em>req_am=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/queues.html#Queue"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.queues.Queue" title="Permalink to this definition">¶</a></dt>
- <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevs.DEVS.CoupledDEVS</span></code></p>
- <p>Queue with reneging that allows items to wait for storage.</p>
- <p>This queue will be a wrapper around the <a class="reference internal" href="#pypdevsbbl.generic.queues.SimpleQueue" title="pypdevsbbl.generic.queues.SimpleQueue"><code class="xref py py-class docutils literal notranslate"><span class="pre">SimpleQueue</span></code></a> and
- allows for automatic dequeueing by continuously sending messages
- to the <cite>requestdequeue</cite> input.</p>
- <p>The names of the internal <a class="reference internal" href="#pypdevsbbl.generic.queues.SimpleQueue" title="pypdevsbbl.generic.queues.SimpleQueue"><code class="xref py py-class docutils literal notranslate"><span class="pre">SimpleQueue</span></code></a> and <a class="reference internal" href="#pypdevsbbl.generic.queues.QueueTracker" title="pypdevsbbl.generic.queues.QueueTracker"><code class="xref py py-class docutils literal notranslate"><span class="pre">QueueTracker</span></code></a>
- will be made up of this Queue’s name, appended with <code class="docutils literal notranslate"><span class="pre">-queue</span></code> and
- <code class="docutils literal notranslate"><span class="pre">-tracker</span></code> respectively.</p>
- <div class="admonition note">
- <p class="first admonition-title">Note</p>
- <p class="last">If you don’t want to use automatic dequeueing, it’s more
- efficient to make use of the <a class="reference internal" href="#pypdevsbbl.generic.queues.SimpleQueue" title="pypdevsbbl.generic.queues.SimpleQueue"><code class="xref py py-class docutils literal notranslate"><span class="pre">SimpleQueue</span></code></a> instead.</p>
- </div>
- <div class="admonition note">
- <p class="first admonition-title">Note</p>
- <p class="last">We will be using a maxheap in this queue.</p>
- </div>
- <div align="center" class="align-center"><img alt="../paper/images/blocks/queue/queue.svg" src="../paper/images/blocks/queue/queue.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 Queue.</li>
- <li><strong>fc</strong> (<em>def</em>) – Queueing Discipline. I.e. the priority assigning function.
- Takes the current time, the value and a unique index as
- arguments. Defaults to <a class="reference internal" href="pypdevsbbl.extra.queues.html#pypdevsbbl.extra.queues.FIFO" title="pypdevsbbl.extra.queues.FIFO"><code class="xref py py-meth docutils literal notranslate"><span class="pre">pypdevsbbl.extra.queues.FIFO()</span></code></a>.</li>
- <li><strong>K</strong> (<em>int</em>) – The maximal capacity of the Queue.
- Defaults to INFINITY (= no maximal capacity).</li>
- <li><strong>dd</strong> (<em>numeric</em>) – Standard dequeueing time delay. Cannot be zero or negative.
- Defaults to INFINITY (= no automatic dequeueing).</li>
- <li><strong>dr</strong> (<em>numeric</em>) – Standard reneging time delay. Cannot be negative.
- Defaults to INFINITY (= no reneging).</li>
- <li><strong>contents</strong> (<em>iter</em>) – A list of contents to be inserted into the queue on startup.
- Defaults to an empty tuple.</li>
- <li><strong>req_am</strong> (<em>bool</em>) – When <code class="docutils literal notranslate"><span class="pre">True</span></code>, the message in a dequeue/renege request
- indicates the amount that should be released. When <code class="docutils literal notranslate"><span class="pre">False</span></code>,
- no matter which message arrives on these ports, only a single
- item is released. Defaults to <code class="docutils literal notranslate"><span class="pre">False</span></code>.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Input Ports:</th><td class="field-body"><ul class="first simple">
- <li><strong>enqueue</strong> (<em>any</em>) – Obtains values and queues them.</li>
- <li><strong>dd</strong> (<em>numeric</em>) – A new minimal time until dequeue. Cannot be zero or negative.</li>
- <li><strong>dr</strong> (<em>numeric</em>) – A new minimal time in the system value. Cannot be negative.</li>
- <li><strong>requestdequeue</strong> – Indicates that items must dequeue. When <code class="xref py py-attr docutils literal notranslate"><span class="pre">req_am</span></code> is
- <code class="docutils literal notranslate"><span class="pre">True</span></code>, it expects a natural number. Otherwise, any arriving
- value is accepted and a single item will be dequeued.</li>
- <li><strong>requestrenege</strong> – Indicates that the last item in the queue must depart on the
- <cite>renege</cite> port. When <code class="xref py py-attr docutils literal notranslate"><span class="pre">req_am</span></code> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, it expects a
- natural number. Otherwise, any arriving value is accepted and
- a single item will be reneged.</li>
- </ul>
- </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>dequeue</strong> (<em>any</em>) – Outputs the next item if it exists.</li>
- <li><strong>renege</strong> (<em>any</em>) – Outputs reneged items.</li>
- <li><strong>overflow</strong> (<em>any</em>) – Outputs overflowing items.</li>
- <li><strong>count</strong> (<em>int</em>) – Current queue size.</li>
- </ul>
- </td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="class">
- <dt id="pypdevsbbl.generic.queues.Retain">
- <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.queues.</code><code class="descname">Retain</code><span class="sig-paren">(</span><em>name: str</em>, <em>ind: bool = True</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/queues.html#Retain"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.queues.Retain" 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>Retains an item until the next arrival or next time instance.</p>
- <dl class="docutils">
- <dt>There are two modes:</dt>
- <dd><ul class="first last simple">
- <li><em>individual</em>: Will only output the previous item.</li>
- <li><em>collection</em>: Will collect all arrived items in the same time
- instance and will output a list of all these items.</li>
- </ul>
- </dd>
- </dl>
- <div align="center" class="align-center"><img alt="../paper/images/blocks/queue/retain.svg" src="../paper/images/blocks/queue/retain.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>ind</strong> (<em>bool</em>) – When true, this block uses the “individual” mode.
- Otherwise, the “collection” mode is used.</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>old</strong> (<em>any</em>) – The previous item (or a list thereof).</li>
- <li><strong>cur</strong> (<em>any</em>) – The current item.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Input Ports:</th><td class="field-body"><p class="first"><strong>input</strong> (<em>any</em>) – An item that needs to be remembered.</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>previous</strong> (<em>any</em>) – The previous item (or a list thereof).</li>
- <li><strong>current</strong> (<em>any</em>) – The current item.</li>
- </ul>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="pypdevsbbl.generic.queues.Retain.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/queues.html#Retain.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.queues.Retain.extTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.queues.Retain.intTransition">
- <code class="descname">intTransition</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/queues.html#Retain.intTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.queues.Retain.intTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.queues.Retain.timeAdvance">
- <code class="descname">timeAdvance</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/queues.html#Retain.timeAdvance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.queues.Retain.timeAdvance" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.queues.Retain.outputFnc">
- <code class="descname">outputFnc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/queues.html#Retain.outputFnc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.queues.Retain.outputFnc" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- </dd></dl>
- <dl class="class">
- <dt id="pypdevsbbl.generic.queues.Advance">
- <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.queues.</code><code class="descname">Advance</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/queues.html#Advance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.queues.Advance" 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>Reneging queue where each item holds their own delay.</p>
- <p>This block is inspired by the <code class="docutils literal notranslate"><span class="pre">ADVANCE</span></code> block from GPSS.</p>
- <div class="admonition note">
- <p class="first admonition-title">Note</p>
- <p class="last">The input and the delay must arrive at exactly the same time.
- When in doubt, use the <a class="reference internal" href="pypdevsbbl.generic.routing.html#pypdevsbbl.generic.routing.Sync" title="pypdevsbbl.generic.routing.Sync"><code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevsbbl.generic.routing.Sync</span></code></a>
- block to ensure this happens.</p>
- </div>
- <div class="admonition warning">
- <p class="first admonition-title">Warning</p>
- <p class="last">The items traveling through must be unique!</p>
- </div>
- <div class="admonition warning">
- <p class="first admonition-title">Warning</p>
- <p class="last">When using pausing, it is pertinent that the items traveling
- through the block are hashable.</p>
- </div>
- <div align="center" class="align-center"><img alt="../paper/images/blocks/queue/advance.svg" src="../paper/images/blocks/queue/advance.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"><p class="first"><strong>name</strong> (<em>str</em>) – The name of the block.</p>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">State:</th><td class="field-body"><ul class="first simple">
- <li><strong>items</strong> (<em>dict</em>) – All the scheduled items in the “queue”, with
- their expected delay.</li>
- <li><strong>least</strong> (<em>tuple</em>) – The item to leave the block first, in the form
- of <code class="docutils literal notranslate"><span class="pre">(item,</span> <span class="pre">time)</span></code>.</li>
- <li><strong>paused</strong> (<em>set</em>) – Set of items that are currently paused. Note
- that the items must be hashable.</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 item to schedule. Must arrive at the same
- time as the <cite>delay</cite> input.</li>
- <li><strong>delay</strong> (<em>numeric</em>) – The delay of the item. Must arrive at the same
- time as the <cite>input</cite> message.</li>
- <li><strong>pause</strong> (<em>list</em>) – A list of tuples <code class="docutils literal notranslate"><span class="pre">(item,</span> <span class="pre">bool)</span></code> indicative of
- whether or not the item must pause.</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, at the pre-scheduled delay.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="pypdevsbbl.generic.queues.Advance.least">
- <code class="descname">least</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/queues.html#Advance.least"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.queues.Advance.least" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.queues.Advance.timeAdvance">
- <code class="descname">timeAdvance</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/queues.html#Advance.timeAdvance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.queues.Advance.timeAdvance" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.queues.Advance.outputFnc">
- <code class="descname">outputFnc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/queues.html#Advance.outputFnc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.queues.Advance.outputFnc" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.queues.Advance.intTransition">
- <code class="descname">intTransition</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/queues.html#Advance.intTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.queues.Advance.intTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.queues.Advance.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/queues.html#Advance.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.queues.Advance.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.math.html"
- title="previous chapter">pypdevsbbl.generic.math module</a></p>
- <h4>Next topic</h4>
- <p class="topless"><a href="pypdevsbbl.generic.routing.html"
- title="next chapter">pypdevsbbl.generic.routing 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.routing.html" title="pypdevsbbl.generic.routing module"
- >next</a> |</li>
- <li class="right" >
- <a href="pypdevsbbl.generic.math.html" title="pypdevsbbl.generic.math 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>
|