| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592 |
- <!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.math 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.queues module" href="pypdevsbbl.generic.queues.html" />
- <link rel="prev" title="pypdevsbbl.generic.io module" href="pypdevsbbl.generic.io.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.queues.html" title="pypdevsbbl.generic.queues module"
- accesskey="N">next</a> |</li>
- <li class="right" >
- <a href="pypdevsbbl.generic.io.html" title="pypdevsbbl.generic.io 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.math">
- <span id="pypdevsbbl-generic-math-module"></span><h1>pypdevsbbl.generic.math module<a class="headerlink" href="#module-pypdevsbbl.generic.math" title="Permalink to this headline">¶</a></h1>
- <p>Set of PythonPDEVS building blocks for doing math.</p>
- <p>The core of this module is the <a class="reference internal" href="#pypdevsbbl.generic.math.Equation" title="pypdevsbbl.generic.math.Equation"><code class="xref py py-class docutils literal notranslate"><span class="pre">Equation</span></code></a> block,
- which allows a user to execute a function on a set of
- inputs.</p>
- <p>Additionally, some few blocks with a variable set of inputs
- (like the sum and the product) will provide the remaining
- functionality.</p>
- <dl class="class">
- <dt id="pypdevsbbl.generic.math._SP">
- <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.math.</code><code class="descname">_SP</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/math.html#_SP"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math._SP" title="Permalink to this definition">¶</a></dt>
- <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevs.DEVS.AtomicDEVS</span></code></p>
- <p>Superclass for the <a class="reference internal" href="#pypdevsbbl.generic.math.Adder" title="pypdevsbbl.generic.math.Adder"><code class="xref py py-class docutils literal notranslate"><span class="pre">Adder</span></code></a> and <a class="reference internal" href="#pypdevsbbl.generic.math.Multiplier" title="pypdevsbbl.generic.math.Multiplier"><code class="xref py py-class docutils literal notranslate"><span class="pre">Multiplier</span></code></a> blocks.</p>
- <div class="admonition warning">
- <p class="first admonition-title">Warning</p>
- <p class="last">This class should not be used as a block by itself.</p>
- </div>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>name</strong> (<em>str</em>) – The name of the block.</li>
- <li><strong>n</strong> (<em>int</em>) – The amount of input ports the block must have.
- These ports are accessible from the <code class="xref py py-attr docutils literal notranslate"><span class="pre">inputs</span></code>
- list, using a 0-based index.</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>result</strong> (<em>numeric</em>) – The computed result of the block.</li>
- <li><strong>input-n</strong> (<em>numeric</em>) – The value of the <cite>n</cite> th input port.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Input Ports:</th><td class="field-body"><p class="first"><strong>inputs</strong> (<em>list</em>) – The list of all the input ports.</p>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Output Ports:</th><td class="field-body"><p class="first last"><strong>result</strong> (<em>numeric</em>) – The result of the computation.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math._SP.operation">
- <code class="descname">operation</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/math.html#_SP.operation"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math._SP.operation" title="Permalink to this definition">¶</a></dt>
- <dd><p>The operation that needs to be computed upon arrival of any value.</p>
- </dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math._SP.timeAdvance">
- <code class="descname">timeAdvance</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/math.html#_SP.timeAdvance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math._SP.timeAdvance" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math._SP.outputFnc">
- <code class="descname">outputFnc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/math.html#_SP.outputFnc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math._SP.outputFnc" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math._SP.intTransition">
- <code class="descname">intTransition</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/math.html#_SP.intTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math._SP.intTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math._SP.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/math.html#_SP.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math._SP.extTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- </dd></dl>
- <dl class="class">
- <dt id="pypdevsbbl.generic.math.Adder">
- <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.math.</code><code class="descname">Adder</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/math.html#Adder"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math.Adder" title="Permalink to this definition">¶</a></dt>
- <dd><p>Bases: <a class="reference internal" href="#pypdevsbbl.generic.math._SP" title="pypdevsbbl.generic.math._SP"><code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevsbbl.generic.math._SP</span></code></a></p>
- <p>Computes the sum of a set of inputs.</p>
- <div align="center" class="align-center"><img alt="_images/adder.svg" src="_images/adder.svg" /></div>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>name</strong> (<em>str</em>) – The name of the block.</li>
- <li><strong>n</strong> (<em>int</em>) – The amount of input ports the block must have.
- These ports are accessible from the <code class="xref py py-attr docutils literal notranslate"><span class="pre">inputs</span></code>
- list, using a 0-based index.</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>result</strong> (<em>numeric</em>) – The computed result of the block.</li>
- <li><strong>input-n</strong> (<em>numeric</em>) – The value of the <cite>n</cite> th input port.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Input Ports:</th><td class="field-body"><p class="first"><strong>inputs</strong> (<em>list</em>) – The list of all the input ports.</p>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Output Ports:</th><td class="field-body"><p class="first last"><strong>result</strong> (<em>numeric</em>) – The result of the computation.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math.Adder.operation">
- <code class="descname">operation</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/math.html#Adder.operation"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math.Adder.operation" title="Permalink to this definition">¶</a></dt>
- <dd><p>The actual sum operation.</p>
- </dd></dl>
- </dd></dl>
- <dl class="class">
- <dt id="pypdevsbbl.generic.math.Multiplier">
- <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.math.</code><code class="descname">Multiplier</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/math.html#Multiplier"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math.Multiplier" title="Permalink to this definition">¶</a></dt>
- <dd><p>Bases: <a class="reference internal" href="#pypdevsbbl.generic.math._SP" title="pypdevsbbl.generic.math._SP"><code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevsbbl.generic.math._SP</span></code></a></p>
- <p>Computes the product of a set of inputs.</p>
- <div align="center" class="align-center"><img alt="_images/multiplier.svg" src="_images/multiplier.svg" /></div>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>name</strong> (<em>str</em>) – The name of the block.</li>
- <li><strong>n</strong> (<em>int</em>) – The amount of input ports the block must have.
- These ports are accessible from the <code class="xref py py-attr docutils literal notranslate"><span class="pre">inputs</span></code>
- list, using a 0-based index.</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>result</strong> (<em>numeric</em>) – The computed result of the block.</li>
- <li><strong>input-n</strong> (<em>numeric</em>) – The value of the <cite>n</cite> th input port.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Input Ports:</th><td class="field-body"><p class="first"><strong>inputs</strong> (<em>list</em>) – The list of all the input ports.</p>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Output Ports:</th><td class="field-body"><p class="first last"><strong>result</strong> (<em>numeric</em>) – The result of the computation.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math.Multiplier.operation">
- <code class="descname">operation</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/math.html#Multiplier.operation"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math.Multiplier.operation" title="Permalink to this definition">¶</a></dt>
- <dd><p>The actual product operation.</p>
- </dd></dl>
- </dd></dl>
- <dl class="class">
- <dt id="pypdevsbbl.generic.math.Equation">
- <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.math.</code><code class="descname">Equation</code><span class="sig-paren">(</span><em>name</em>, <em>function</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/math.html#Equation"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math.Equation" 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>Execute an equation on a set of inputs.</p>
- <p>The input ports of this block are determined by the arguments of
- the passed <code class="xref py py-attr docutils literal notranslate"><span class="pre">function</span></code>. Whenever a change happens on these
- ports and both have values, their result is outputted on the
- <cite>result</cite> port.</p>
- <div class="admonition warning">
- <p class="first admonition-title">Warning</p>
- <ul class="last simple">
- <li>The <code class="xref py py-attr docutils literal notranslate"><span class="pre">function</span></code> cannot have a <code class="docutils literal notranslate"><span class="pre">result</span></code> parameter to
- prevent ambiguity with the output port.</li>
- <li>The <code class="xref py py-attr docutils literal notranslate"><span class="pre">function</span></code> <strong>must not</strong> change the values of the
- inputs.</li>
- <li>This block is optimized for numerical equations, yet it is
- (because of <em>Python</em>) perfectly possible to use some other
- attributes.</li>
- </ul>
- </div>
- <div class="admonition seealso">
- <p class="first admonition-title">See also</p>
- <p class="last"><a class="reference internal" href="pypdevsbbl.extra.equations.html#module-pypdevsbbl.extra.equations" title="pypdevsbbl.extra.equations"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pypdevsbbl.extra.equations</span></code></a> for a set of predefined equations which
- can be used as a function without too much thought.</p>
- </div>
- <div align="center" class="align-center"><img alt="_images/equation.svg" src="_images/equation.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>function</strong> (<em>def</em>) – The function that needs to be executed. Note that
- defaults can be used, but the <code class="docutils literal notranslate"><span class="pre">*args</span></code> and
- <code class="docutils literal notranslate"><span class="pre">**kwargs</span></code> information will be ignored.</li>
- </ul>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Input Ports:</th><td class="field-body"><p class="first">Depends on the <code class="xref py py-attr docutils literal notranslate"><span class="pre">function</span></code> that was passed.
- Say the <code class="xref py py-attr docutils literal notranslate"><span class="pre">function</span></code> has two arguments: <code class="docutils literal notranslate"><span class="pre">a</span></code>
- and <code class="docutils literal notranslate"><span class="pre">b</span></code>, the input ports are also <cite>a</cite> and <cite>b</cite>.</p>
- </td>
- </tr>
- <tr class="field-odd field"><th class="field-name">Output Ports:</th><td class="field-body"><p class="first last"><strong>result</strong> (<em>any</em>) – The output of the provided equation.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math.Equation.timeAdvance">
- <code class="descname">timeAdvance</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/math.html#Equation.timeAdvance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math.Equation.timeAdvance" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math.Equation.outputFnc">
- <code class="descname">outputFnc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/math.html#Equation.outputFnc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math.Equation.outputFnc" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math.Equation.intTransition">
- <code class="descname">intTransition</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/math.html#Equation.intTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math.Equation.intTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math.Equation.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/math.html#Equation.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math.Equation.extTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- </dd></dl>
- <dl class="class">
- <dt id="pypdevsbbl.generic.math._DI">
- <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.math.</code><code class="descname">_DI</code><span class="sig-paren">(</span><em>name</em>, <em>ic=0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/math.html#_DI"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math._DI" title="Permalink to this definition">¶</a></dt>
- <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevs.DEVS.AtomicDEVS</span></code></p>
- <p>Superclass of the <a class="reference internal" href="#pypdevsbbl.generic.math.Differentiator" title="pypdevsbbl.generic.math.Differentiator"><code class="xref py py-class docutils literal notranslate"><span class="pre">Differentiator</span></code></a> and <a class="reference internal" href="#pypdevsbbl.generic.math.Integrator" title="pypdevsbbl.generic.math.Integrator"><code class="xref py py-class docutils literal notranslate"><span class="pre">Integrator</span></code></a> blocks.</p>
- <div class="admonition warning">
- <p class="first admonition-title">Warning</p>
- <p class="last">This class should not be used as a block by itself.</p>
- </div>
- <table class="docutils field-list" frame="void" rules="none">
- <col class="field-name" />
- <col class="field-body" />
- <tbody valign="top">
- <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
- <li><strong>name</strong> (<em>str</em>) – The name of the block.</li>
- <li><strong>ic</strong> (<em>numeric</em>) – The initial condition of the block. Defaults to 0.</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>prev</strong> (<em>numeric</em>) – The previous value. Defaults to the initial condition.</li>
- <li><strong>v</strong> (<em>numeric</em>) – The current value.</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>numeric</em>) – The new value.</p>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Output Ports:</th><td class="field-body"><p class="first last"><strong>result</strong> (<em>numeric</em>) – The differential.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math._DI.timeAdvance">
- <code class="descname">timeAdvance</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/math.html#_DI.timeAdvance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math._DI.timeAdvance" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math._DI.outputFnc">
- <code class="descname">outputFnc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/math.html#_DI.outputFnc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math._DI.outputFnc" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math._DI.intTransition">
- <code class="descname">intTransition</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/math.html#_DI.intTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math._DI.intTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math._DI.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/math.html#_DI.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math._DI.extTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- </dd></dl>
- <dl class="class">
- <dt id="pypdevsbbl.generic.math.Differentiator">
- <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.math.</code><code class="descname">Differentiator</code><span class="sig-paren">(</span><em>name</em>, <em>ic=0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/math.html#Differentiator"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math.Differentiator" title="Permalink to this definition">¶</a></dt>
- <dd><p>Bases: <a class="reference internal" href="#pypdevsbbl.generic.math._DI" title="pypdevsbbl.generic.math._DI"><code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevsbbl.generic.math._DI</span></code></a></p>
- <p>Differentiates the input over time.</p>
- <p>This block will make use of the backwards difference:</p>
- <p><span class="math notranslate nohighlight">\(\dfrac{d}{dt}f(t) = \lim_{\Delta t\to 0}\dfrac{f(t) - f(t - \Delta t)}{\Delta t} = \dfrac{x_i - x_{i-1}}{\Delta t}\)</span></p>
- <div align="center" class="align-center"><img alt="_images/differentiator.svg" src="_images/differentiator.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>ic</strong> (<em>numeric</em>) – The initial condition of the block. Defaults to 0.</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>prev</strong> (<em>numeric</em>) – The previous value of the differential. Defaults to the initial condition.</li>
- <li><strong>v</strong> (<em>numeric</em>) – The current differential.</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>numeric</em>) – The new value.</p>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Output Ports:</th><td class="field-body"><p class="first last"><strong>result</strong> (<em>numeric</em>) – The differential.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math.Differentiator.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/math.html#Differentiator.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math.Differentiator.extTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- </dd></dl>
- <dl class="class">
- <dt id="pypdevsbbl.generic.math.Integrator">
- <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.math.</code><code class="descname">Integrator</code><span class="sig-paren">(</span><em>name</em>, <em>ic=0</em>, <em>method=<function Integrator.INTEGRAL_TRAPEZOID></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/math.html#Integrator"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math.Integrator" title="Permalink to this definition">¶</a></dt>
- <dd><p>Bases: <a class="reference internal" href="#pypdevsbbl.generic.math._DI" title="pypdevsbbl.generic.math._DI"><code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevsbbl.generic.math._DI</span></code></a></p>
- <p>Integrates the input over time.</p>
- <p><span class="math notranslate nohighlight">\(v(t) = {\displaystyle \int} f(\tau)\ d\tau = ic + {\displaystyle \int_0^t} f(\tau)\ d\tau = v(t - \Delta t) + {\displaystyle \int_{t - \Delta t}^t} f(\tau)\ d\tau\)</span></p>
- <div align="center" class="align-center"><img alt="_images/integrator.svg" src="_images/integrator.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>ic</strong> (<em>numeric</em>) – The initial condition of the block. Defaults to 0.</li>
- <li><strong>method</strong> (<em>def</em>) – A function to determine the computation of the integral.
- It’s preferrably one of <a class="reference internal" href="#pypdevsbbl.generic.math.Integrator.INTEGRAL_LOWER" title="pypdevsbbl.generic.math.Integrator.INTEGRAL_LOWER"><code class="xref py py-meth docutils literal notranslate"><span class="pre">INTEGRAL_LOWER()</span></code></a>, <a class="reference internal" href="#pypdevsbbl.generic.math.Integrator.INTEGRAL_UPPER" title="pypdevsbbl.generic.math.Integrator.INTEGRAL_UPPER"><code class="xref py py-meth docutils literal notranslate"><span class="pre">INTEGRAL_UPPER()</span></code></a> or
- <a class="reference internal" href="#pypdevsbbl.generic.math.Integrator.INTEGRAL_TRAPEZOID" title="pypdevsbbl.generic.math.Integrator.INTEGRAL_TRAPEZOID"><code class="xref py py-meth docutils literal notranslate"><span class="pre">INTEGRAL_TRAPEZOID()</span></code></a>. Defaults to <a class="reference internal" href="#pypdevsbbl.generic.math.Integrator.INTEGRAL_TRAPEZOID" title="pypdevsbbl.generic.math.Integrator.INTEGRAL_TRAPEZOID"><code class="xref py py-meth docutils literal notranslate"><span class="pre">INTEGRAL_TRAPEZOID()</span></code></a>.</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>prev</strong> (<em>numeric</em>) – The previous value of the integral. Defaults to the initial condition.</li>
- <li><strong>v</strong> (<em>numeric</em>) – The current integral.</li>
- <li><strong>fprev</strong> (<em>numeric</em>) – The previous value of the function. When <code class="docutils literal notranslate"><span class="pre">None</span></code>, the <code class="xref py py-attr docutils literal notranslate"><span class="pre">method</span></code> is
- ignored.</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>numeric</em>) – The new value.</p>
- </td>
- </tr>
- <tr class="field-even field"><th class="field-name">Output Ports:</th><td class="field-body"><p class="first last"><strong>result</strong> (<em>numeric</em>) – The differential.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math.Integrator.INTEGRAL_LOWER">
- <code class="descname">INTEGRAL_LOWER</code><span class="sig-paren">(</span><em>curr</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/math.html#Integrator.INTEGRAL_LOWER"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math.Integrator.INTEGRAL_LOWER" title="Permalink to this definition">¶</a></dt>
- <dd><p>Computes the integral from the lower-bound.</p>
- <p><span class="math notranslate nohighlight">\({\displaystyle \int_{t - \Delta t}^t} f(\tau)\ d\tau = \Delta t\cdot f(t - \Delta t)\)</span></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"><strong>curr</strong> (<em>numeric</em>) – Current input value.</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math.Integrator.INTEGRAL_UPPER">
- <code class="descname">INTEGRAL_UPPER</code><span class="sig-paren">(</span><em>curr</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/math.html#Integrator.INTEGRAL_UPPER"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math.Integrator.INTEGRAL_UPPER" title="Permalink to this definition">¶</a></dt>
- <dd><p>Computes the integral from the upper-bound.</p>
- <p><span class="math notranslate nohighlight">\({\displaystyle \int_{t - \Delta t}^t} f(\tau)\ d\tau = \Delta t\cdot f(t)\)</span></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"><strong>curr</strong> (<em>numeric</em>) – Current input value.</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math.Integrator.INTEGRAL_TRAPEZOID">
- <code class="descname">INTEGRAL_TRAPEZOID</code><span class="sig-paren">(</span><em>curr</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/math.html#Integrator.INTEGRAL_TRAPEZOID"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math.Integrator.INTEGRAL_TRAPEZOID" title="Permalink to this definition">¶</a></dt>
- <dd><p>Computes the integral with the trapezoidal rule.</p>
- <p><span class="math notranslate nohighlight">\({\displaystyle \int_{t - \Delta t}^t} f(\tau)\ d\tau = \dfrac{\Delta t\cdot\left(f(t - \Delta t) + f(t)\right)}{2}\)</span></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"><strong>curr</strong> (<em>numeric</em>) – Current input value.</td>
- </tr>
- </tbody>
- </table>
- </dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math.Integrator.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/math.html#Integrator.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math.Integrator.extTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- </dd></dl>
- <dl class="class">
- <dt id="pypdevsbbl.generic.math.Random">
- <em class="property">class </em><code class="descclassname">pypdevsbbl.generic.math.</code><code class="descname">Random</code><span class="sig-paren">(</span><em>name: str</em>, <em>seed=None</em>, <em>dist=<function Random.<lambda>></em>, <em>args=()</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/math.html#Random"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math.Random" 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><code class="xref py py-class docutils literal notranslate"><span class="pre">AtomicDEVS</span></code> that generates a random number every time a message arrives.</p>
- <p>It makes use of the RngStreams random number generator i.i.d. (0, 1).
- Using the <code class="docutils literal notranslate"><span class="pre">dist</span></code> argument, one can simply change the distribution over which
- numbers need to be generated. The <code class="xref py py-mod docutils literal notranslate"><span class="pre">pypdevsbbl.extra.rngstreams.distributions</span></code>
- module provides an extensive implementation of a lot of distributions.</p>
- <div class="admonition seealso">
- <p class="first admonition-title">See also</p>
- <ul class="last simple">
- <li><a class="reference internal" href="pypdevsbbl.generic.generators.html#pypdevsbbl.generic.generators.RandomNumberGenerator" title="pypdevsbbl.generic.generators.RandomNumberGenerator"><code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevsbbl.generic.generators.RandomNumberGenerator</span></code></a></li>
- <li><a class="reference internal" href="pypdevsbbl.generic.generators.html#pypdevsbbl.generic.generators.RandomDelayGenerator" title="pypdevsbbl.generic.generators.RandomDelayGenerator"><code class="xref py py-class docutils literal notranslate"><span class="pre">pypdevsbbl.generic.generators.RandomDelayGenerator</span></code></a></li>
- <li><a class="reference internal" href="pypdevsbbl.extra.rngstreams.html#module-pypdevsbbl.extra.rngstreams" title="pypdevsbbl.extra.rngstreams"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pypdevsbbl.extra.rngstreams</span></code></a></li>
- <li><code class="xref py py-mod docutils literal notranslate"><span class="pre">pypdevsbbl.extra.rngstreams.distributions</span></code></li>
- </ul>
- </div>
- <div align="center" class="align-center"><img alt="_images/random.svg" src="_images/random.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 and the RNG.</li>
- <li><strong>seed</strong> (<em>numeric</em>) – The seed for the generator. When <code class="docutils literal notranslate"><span class="pre">None</span></code>, no seed will be
- set. Defaults to <code class="docutils literal notranslate"><span class="pre">None</span></code>.</li>
- <li><strong>dist</strong> (<em>def</em>) – A stateless function that implements an inversive cumulative
- distribution function. It takes at least a single argument,
- which falls in (0, 1).
- Defaults to a uniform distribution over (0, 1).</li>
- <li><strong>args</strong> (<em>tuple</em>) – Optional additional arguments to add to the distribution.</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>num</strong> (<em>numeric</em>) – The random number that’s being/needs to be outputted.</li>
- <li><strong>item</strong> (<em>any</em>) – The item that’s passing through.</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>) – A new input, indicative of an random number request.</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>random</strong> (<em>numeric</em>) – The random number.</li>
- <li><strong>value</strong> (<em>any</em>) – Outputs the input once more.</li>
- </ul>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math.Random.timeAdvance">
- <code class="descname">timeAdvance</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/math.html#Random.timeAdvance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math.Random.timeAdvance" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math.Random.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/math.html#Random.extTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math.Random.extTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math.Random.intTransition">
- <code class="descname">intTransition</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/math.html#Random.intTransition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math.Random.intTransition" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math.Random.outputFnc">
- <code class="descname">outputFnc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/math.html#Random.outputFnc"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math.Random.outputFnc" title="Permalink to this definition">¶</a></dt>
- <dd></dd></dl>
- <dl class="method">
- <dt id="pypdevsbbl.generic.math.Random.next">
- <code class="descname">next</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pypdevsbbl/generic/math.html#Random.next"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pypdevsbbl.generic.math.Random.next" title="Permalink to this definition">¶</a></dt>
- <dd><p>Obtains a random variable w.r.t. this block’s config.</p>
- <p>Do note that this updates the gen object, meaning it must only be called
- in functions that may update the state.</p>
- </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.io.html"
- title="previous chapter">pypdevsbbl.generic.io module</a></p>
- <h4>Next topic</h4>
- <p class="topless"><a href="pypdevsbbl.generic.queues.html"
- title="next chapter">pypdevsbbl.generic.queues 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.queues.html" title="pypdevsbbl.generic.queues module"
- >next</a> |</li>
- <li class="right" >
- <a href="pypdevsbbl.generic.io.html" title="pypdevsbbl.generic.io 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>
|