blob: 56880bca7cff28340808e5a1eafa38ed989bece5 [file] [log] [blame]
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Simulation &mdash; OpenPASS Documentation</title>
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />
<link rel="stylesheet" href="../../_static/tabs.css" type="text/css" />
<link rel="shortcut icon" href="../../_static/openPASS.ico"/>
<!--[if lt IE 9]>
<script src="../../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script>
<script src="../../_static/underscore.js"></script>
<script src="../../_static/doctools.js"></script>
<script src="../../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="World_OSI" href="world_osi.html" />
<link rel="prev" title="EventDetector" href="event_detector.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../../index.html" class="icon icon-home"> openPASS
<img src="../../_static/openPASS.png" class="logo" alt="Logo"/>
</a>
<div class="version">
9999.9999.9999
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Installation Guide</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../installation_guide/10_getting_started.html">Getting Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../installation_guide/20_install_prerequisites.html">Installing Prerequisites</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../installation_guide/30_install_openpass.html">Installing OpenPASS</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../installation_guide/50_further_guidance.html">Further Guidance</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../installation_guide/60_conan.html">Building with Conan</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">User Guides</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../user_guide/10_overview.html">Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../user_guide/20_tutorials.html">Tutorials</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../user_guide/30_gui_plugins.html">GUI Plugins</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../user_guide/40_configs_in_depth.html">Configs in Depth</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../user_guide/50_outputs_in_depth.html">Outputs in Depth</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../user_guide/60_scenario_simulation.html">Simulator</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Advanced topics</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="../20_simulator_advanced.html">Simulator</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="agent_components.html">Agent Components</a></li>
<li class="toctree-l2"><a class="reference internal" href="event_detector.html">EventDetector</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Simulation</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#command-line-arguments">Command Line Arguments</a></li>
<li class="toctree-l3"><a class="reference internal" href="#scheduler">Scheduler</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#executing-phases">Executing phases</a></li>
<li class="toctree-l4"><a class="reference internal" href="#task-type-description">Task type description</a></li>
<li class="toctree-l4"><a class="reference internal" href="#task-priorities">Task priorities</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="world_osi.html">World_OSI</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../30_testing.html">EndToEnd Test Framework</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Developer Information</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../developer_information/10_ide_support.html">IDE Support</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../developer_information/20_documentation.html">Documentation Concept</a></li>
</ul>
<p class="caption" role="heading"><span class="caption-text">Other Information</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../other_information/10_external_dependencies.html">External Dependencies</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../other_information/20_glossary.html">Glossary</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../other_information/30_license.html">License</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../../index.html">openPASS</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../../index.html" class="icon icon-home"></a> &raquo;</li>
<li><a href="../20_simulator_advanced.html">Simulator</a> &raquo;</li>
<li>Simulation</li>
<li class="wy-breadcrumbs-aside">
<a href="../../_sources/advanced_topics/simulator/simulation.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="simulation">
<span id="id1"></span><h1>Simulation<a class="headerlink" href="#simulation" title="Permalink to this headline"></a></h1>
<div class="section" id="command-line-arguments">
<span id="simulation-commandlinearguments"></span><h2>Command Line Arguments<a class="headerlink" href="#command-line-arguments" title="Permalink to this headline"></a></h2>
<p>The simulation can be configured by applying the following command line arguments.
Unspecified arguments will be defaulted (<em>default values in []</em>).</p>
<p>The simulation supports the following arguments:</p>
<ul class="simple">
<li><p><em>–logLevel</em> [0] :
Logging level between 0 (minimum) and 5 (maximum - debug core)</p></li>
<li><p><em>–logFile</em> [opSimulation.log]* :
Name of the log file</p></li>
<li><p><em>–lib</em> [modules] :
Path of the libraries (relative or absolute)</p></li>
<li><p><em>–configs</em> [configs] :
Path for writing outputs (relative or absolute)</p></li>
<li><p><em>–results</em> [results] :
Path for writing outputs (relative or absolute)</p></li>
</ul>
</div>
<div class="section" id="scheduler">
<span id="simulation-scheduler"></span><h2>Scheduler<a class="headerlink" href="#scheduler" title="Permalink to this headline"></a></h2>
<p>The Scheduler handles the sequence of agent based and common tasks before, during and after simulation.</p>
<div class="section" id="executing-phases">
<h3>Executing phases<a class="headerlink" href="#executing-phases" title="Permalink to this headline"></a></h3>
<p>Each simulation run splits up into 3 phases: Bootstrap tasks, Stepping and Finalize tasks.</p>
<ol class="arabic simple">
<li><p>Initial task are grouped within the bootstrap tasks and are executed first and only once.
This includes updating the Observation modules and triggering all PreRun Spawners.</p></li>
<li><p>After this Spawning, PreAgent, NonRecurring, Recurring and Syncronize Tasks are processed for each timestep.
First all Runtime Spawners are triggered.
Whenever a new agent is spawned, all its components are parsed to <em>Trigger</em> and <em>Update</em> tasks, grouped and sorted by execution time as non-recurring and recurring tasks.
Next all PreAgents task are executed, which includes publishing the world state to the DataBuffer in triggering all EventDetectors and Manipulators
Non-recurring tasks are executed just once and will be deleted afterwards (<em>init</em> flag in ComponentRepository).
Right after execution of all agent-based tasks, the Syncronize phase synchronizes all changes to the world as world state for the next timestep.</p></li>
<li><p>The last phase is finalizing task, executed when an end condition is reached, such as end of simulation duration. Within this phase all EventDetectors and Manipulators are triggered and the Observation modules are updated one last time.</p></li>
</ol>
</div>
<div class="section" id="task-type-description">
<h3>Task type description<a class="headerlink" href="#task-type-description" title="Permalink to this headline"></a></h3>
<p>The scheduler handles 8 different task types:</p>
<ul class="simple">
<li><p><strong>Spawning</strong> - triggers agent spawning</p></li>
<li><p><strong>EventDetector</strong> - execute event detector</p></li>
<li><p><strong>Manipulator</strong> - execute manipulator</p></li>
<li><p><strong>Observation</strong> - update observation modules</p></li>
<li><p><strong>Trigger</strong> - execute trigger function of connected component</p></li>
<li><p><strong>Update</strong> - execute update output of connected component and resulting input</p></li>
<li><p><strong>SyncWorld</strong> - update world</p></li>
</ul>
<p>The following table gives an overview to all phases.</p>
<table class="tight-table docutils align-default">
<colgroup>
<col style="width: 11%" />
<col style="width: 6%" />
<col style="width: 34%" />
<col style="width: 50%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Phase</p></th>
<th class="head"><p>Changeable</p></th>
<th class="head"><p>Task types</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>Bootstrap</p></td>
<td><p>no</p></td>
<td><p>Spawning (PreRun), Observation</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>Spawning</p></td>
<td><p>no</p></td>
<td><p>Spawning (Runtime), Observation</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>PreAgent</p></td>
<td><p>no</p></td>
<td><p>SyncWorld (publishing), EventDetector, Manipulator</p></td>
<td></td>
</tr>
<tr class="row-odd"><td><p>Non recurring</p></td>
<td><p>yes</p></td>
<td><p>Trigger, Update</p></td>
<td><p>Only components defined as “Init”</p></td>
</tr>
<tr class="row-even"><td><p>Recurring</p></td>
<td><p>yes</p></td>
<td><p>Trigger, Update</p></td>
<td><p>Non Init components</p></td>
</tr>
<tr class="row-odd"><td><p>Syncronize</p></td>
<td><p>no</p></td>
<td><p>SyncWorld</p></td>
<td><p>Update the state of the agents and the virtual world (e.g. due to agent movements).</p></td>
</tr>
<tr class="row-even"><td><p>Finalize</p></td>
<td><p>no</p></td>
<td><p>EventDetector, Manipulator, Observation</p></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="task-priorities">
<h3>Task priorities<a class="headerlink" href="#task-priorities" title="Permalink to this headline"></a></h3>
<p>The order of the tasks within one phase depends on component priority and task type.
All tasks for a given timestamp are ordered by the SchedulerTasks priority, and divided into the aformentioned phases.</p>
<p>The following table shows the priorities for the non-component task types:</p>
<table class="tight-table docutils align-default">
<colgroup>
<col style="width: 13%" />
<col style="width: 7%" />
<col style="width: 81%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Task type</p></th>
<th class="head"><p>Priority</p></th>
<th class="head"><p>Notes</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>Spawning</p></td>
<td><p>4</p></td>
<td><p>Highest priority, nothing can happen before any agent is instantiated.</p></td>
</tr>
<tr class="row-odd"><td><p>EventDetector</p></td>
<td><p>3</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>Manipulator</p></td>
<td><p>2</p></td>
<td><p>The manipulator task uses the event detector tasks as input. Therefore it is called afterwards.</p></td>
</tr>
<tr class="row-odd"><td><p>SyncGlobalData</p></td>
<td><p>1</p></td>
<td></td>
</tr>
<tr class="row-even"><td><p>Observation</p></td>
<td><p>0</p></td>
<td><p>Observation tasks have to be execute at the end.</p></td>
</tr>
</tbody>
</table>
<p>The priority of trigger and update tasks depend on the priority within the SystemConfig.
They are independent of non-component priorities.
Since trigger tasks prepare output signals, output tasks are right called after the corresponding trigger tasks.</p>
</div>
</div>
</div>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="event_detector.html" class="btn btn-neutral float-left" title="EventDetector" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="world_osi.html" class="btn btn-neutral float-right" title="World_OSI" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2021 OpenPASS Working Group.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>