blob: 23b0239551df9059dbb357f6922f507254a40f11 [file] [log] [blame]
<!DOCTYPE html><html lang="en-us" >
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Source Themes Academic 4.8.0">
<meta name="author" content="Fraunhofer FOKUS">
<meta name="description" content="">
<link rel="alternate" hreflang="en-us" href="https://www.eclipse.org/mosaic/tutorials/integrate_existing_sumo_scenarios/">
<meta name="theme-color" content="#68145C">
<script src="/mosaic/js/mathjax-config.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/academicons/1.8.6/css/academicons.min.css" integrity="sha512-MCWBwPSput2UWNwyznVFLbD2iUc1e5VsdD1zahsWVzkDSUzyHhMZ4kCS3wgYSRm0mU+glwD/Q9lSJrDPwbUL2A==" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-1/css/all.min.css" integrity="sha512-ZYg+hQvLlM0W9C3P6vTpes5LmJ66G2EsroxDNzwD6qiulckldb29eD9I672HL2X+LH5nRhY1sQqZLJGB+aUUPg==" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.css" integrity="sha512-H9jrZiiopUdsLpg94A333EfumgUBpO9MdbxStdeITo+KEIMaNfHNvwyjjDJb+ERPaRS6DpyRlKbvPUasNItRyw==" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/styles/atom-one-light.min.css" crossorigin="anonymous" title="hl-light">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/styles/atom-one-light.min.css" crossorigin="anonymous" title="hl-dark" disabled>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.5.1/leaflet.css" integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/lazysizes/5.2.2/lazysizes.min.js" integrity="sha512-TmDwFLhg3UA4ZG0Eb4MIyT1O1Mb+Oww5kFG0uHqXsdbyZz9DcvYQhKpGgNkamAI6h2lGGZq2X8ftOJvF/XjTUg==" crossorigin="anonymous" async></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.1.0/es5/tex-chtml.min.js" integrity="sha512-uwL1UtpYdWra2iqJlAW8Ts0s9Os6IxWLDJDF/BnWdhDmT7DEMFba3GPsFwmV3QiTNcUyl2GB5vsgycB/MOvo9g==" crossorigin="anonymous" async></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,400i,700,700i%7CRoboto+Mono&display=swap">
<link rel="stylesheet" href="/mosaic/css/academic.css">
<link rel="alternate" href="/mosaic/tutorials/integrate_existing_sumo_scenarios/index.xml" type="application/rss+xml" title="Eclipse MOSAIC – A Multi-Domain and Multi-Scale Simulation Framework for Connected and Automated Mobility">
<link rel="manifest" href="/mosaic/index.webmanifest">
<link rel="icon" type="image/png" href="/mosaic/images/icon_hu6bdfb97c7e23190c70e41ca0e15a9fce_30436_32x32_fill_lanczos_center_2.png">
<link rel="apple-touch-icon" type="image/png" href="/mosaic/images/icon_hu6bdfb97c7e23190c70e41ca0e15a9fce_30436_192x192_fill_lanczos_center_2.png">
<link rel="canonical" href="https://www.eclipse.org/mosaic/tutorials/integrate_existing_sumo_scenarios/">
<meta property="twitter:card" content="summary">
<meta property="og:site_name" content="Eclipse MOSAIC – A Multi-Domain and Multi-Scale Simulation Framework for Connected and Automated Mobility">
<meta property="og:url" content="https://www.eclipse.org/mosaic/tutorials/integrate_existing_sumo_scenarios/">
<meta property="og:title" content="Integrate Existing SUMO Scenarios | Eclipse MOSAIC – A Multi-Domain and Multi-Scale Simulation Framework for Connected and Automated Mobility">
<meta property="og:description" content=""><meta property="og:image" content="https://www.eclipse.org/mosaic/images/logo.svg">
<meta property="twitter:image" content="https://www.eclipse.org/mosaic/images/logo.svg"><meta property="og:locale" content="en-us">
<meta property="og:updated_time" content="2021-01-02T00:00:00&#43;01:00">
<title>Integrate Existing SUMO Scenarios | Eclipse MOSAIC – A Multi-Domain and Multi-Scale Simulation Framework for Connected and Automated Mobility</title>
</head>
<body id="top" data-spy="scroll" data-offset="70" data-target="#TableOfContents" class=" page-mosaic page-tutorials page-integrate_existing_sumo_scenarios ">
<aside class="search-results" id="search">
<div class="container">
<section class="search-header">
<div class="row no-gutters justify-content-between mb-3">
<div class="col-10 col-md-3">
<div class="logo" style="background-image: url(/mosaic/img/logos/mosaic/EclipseMOSAIC-Logo-RGB-positiv.svg)"></div>
</div>
<div class="col-2 col-md-4 col-search-close">
<a class="js-search" href="#"><i class="fas fa-times-circle text-muted" aria-hidden="true"></i></a>
</div>
</div>
<div id="search-box">
<input name="q" id="search-query" placeholder="Search..." autocapitalize="off"
autocomplete="off" autocorrect="off" spellcheck="false" type="search">
</div>
</section>
<section class="section-search-results">
<div id="search-hits">
</div>
</section>
</div>
</aside>
<nav class="navbar navbar-expand-lg navbar-light compensate-for-scrollbar" id="navbar-main">
<div class="container">
<div class="d-none d-lg-inline-flex">
<a style="visibility:visible;" class="navbar-brand" href="/mosaic/"><img src="/mosaic/images/logo.svg" alt="Eclipse MOSAIC – A Multi-Domain and Multi-Scale Simulation Framework for Connected and Automated Mobility"></a>
</div>
<button type="button" class="navbar-toggler" data-bs-toggle="collapse" data-bs-target="#navbar-content-mobile" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
<span><i class="fas fa-bars"></i></span>
</button>
<div class="navbar-brand-mobile-wrapper d-inline-flex d-lg-none">
<a class="navbar-brand" href="/mosaic/"><img src="/mosaic/images/logo.svg" alt="Eclipse MOSAIC – A Multi-Domain and Multi-Scale Simulation Framework for Connected and Automated Mobility"></a>
</div>
<div id="navbar-content" class="navbar-collapse main-menu-item collapse justify-content-start">
<ul class="navbar-nav d-md-inline-flex">
<li class="nav-item">
<a class="nav-link " href="/mosaic/about/"><span>About</span></a>
</li>
<li class="nav-item">
<a class="nav-link " href="/mosaic/news/"><span>News</span></a>
</li>
<li class="nav-item">
<a class="nav-link " href="/mosaic/docs/"><span>Documentation</span></a>
</li>
<li class="nav-item">
<a class="nav-link active" href="/mosaic/tutorials/"><span>Tutorials</span></a>
</li>
<li class="nav-item">
<a class="nav-link " href="/mosaic/download/"><span>Download</span></a>
</li>
<li class="nav-item">
<a class="nav-link " href="/mosaic/community/"><span>Community</span></a>
</li>
</ul>
</div>
<ul class="nav-icons navbar-nav flex-row ml-auto d-flex pl-md-2">
<li class="nav-item">
<a class="nav-link js-search" href="#" aria-label="Search"><i class="fas fa-search" aria-hidden="true"></i></a>
</li>
<li class="nav-item ">
<a href="https://github.com/eclipse/mosaic" target="blank">
<i class="fab fa-github" aria-hidden="true"></i>
</a>
</li>
</ul>
<div id="navbar-content-mobile" class="navbar-collapse main-menu-item collapse justify-content-start d-lg-none">
<ul class="navbar-nav d-inline-flex">
<li class="nav-item">
<a class="nav-link " href="/mosaic/about/"><span>About</span></a>
</li>
<li class="nav-item">
<a class="nav-link " href="/mosaic/news/"><span>News</span></a>
</li>
<li class="nav-item">
<a class="nav-link " href="/mosaic/docs/"><span>Documentation</span></a>
</li>
<li class="nav-item">
<a class="nav-link active" href="/mosaic/tutorials/"><span>Tutorials</span></a>
</li>
<li class="nav-item">
<a class="nav-link " href="/mosaic/download/"><span>Download</span></a>
</li>
<li class="nav-item">
<a class="nav-link " href="/mosaic/community/"><span>Community</span></a>
</li>
</ul>
</div>
</div>
</nav>
<div class="universal-wrapper pt-3">
<h1>Integrate Existing SUMO Scenarios</h1>
</div>
<div class="universal-wrapper">
<div class="article-style"><div class="alert alert-note">
<div>
<p>All files you need for this tutorial are included in the Eclipse MOSAIC zip file:<br>
<strong>
<a href="/mosaic/download/">
Download Eclipse MOSAIC
</a>
</strong></p>
</div>
</div>
<div class="alert alert-learning_objectives">
<div>
<h3>Learning Objectives</h3>
This tutorial will demonstrate how to simultaneously define traffic demand from MOSAIC's mapping-file and
SUMOs route-files and introduce handling of bicycles and busses. This tutorial won't introduce the basics of traffic definitions in
MOSAIC/SUMO, so if you are not familiar with the topic check out our other tutorials. After this tutorial you will be able to:
<ul>
<li>
<p>Couple existing SUMO scenarios with MOSAIC</p>
</li>
<li>
<p>Utilize different transport modalities in MOSAIC</p>
</div>
</li>
</ul>
</div>
<h2 id="overview">Overview</h2>
<p>In this scenario several traffic participants meet at a junction (Sievekingplatz, Hamburg). The network and some of these participants
are already defined in the SUMO scenario. First we will have a look at the existing scenario and afterwards explain how we can extend
it. We will add some additional traffic and also equip vehicles with applications.</p>
<figure id="figure-overview-of-the-sievekingplatz-scenario">
<a data-fancybox="" href="images/integrate_existing_sumo_scenarios-overview.png" data-caption="Overview of the Sievekingplatz scenario">
<img src="images/integrate_existing_sumo_scenarios-overview.png" alt="" >
</a>
<figcaption data-pre="Figure " data-post=":" class="numbered">
Overview of the Sievekingplatz scenario
</figcaption>
</figure>
<h2 id="the-sumo-scenario">The SUMO scenario</h2>
<p>In the <code>sumo</code>-directory of the scenario you will find the following structure:</p>
<pre><code class="language-plaintext">└─ sumo
├─ sievekingplatz.bus.add.xml ................... Contains information about bus stops
├─ sievekingplatz.net.xml ....................... The network of the scenario
├─ sievekingplatz.rou.xml ....................... Contains traffic demand definitions
├─ sievekingplatz.sumocfg ....................... SUMOs main configuration file
└─ sumo_config.json ............................. MOSAIC configuration file for SUMO
</code></pre>
<p>The <code>sievekingplatz.sumocfg</code> is the basic configuration file for the SUMO scenario. It links to the net-file, the route-file and
can also be run without using MOSAIC.
Let us have a look at the route-file, it defines two <code>vTypes</code> and then some traffic demand. Concretely it defines 2 busses, 2 bicycles
and 1 vehicle.</p>
<pre><code class="language-xml">
&lt;routes xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;http://sumo.dlr.de/xsd/routes_file.xsd&quot;&gt;
&lt;vType id=&quot;Bus&quot; vClass=&quot;bus&quot; length=&quot;20&quot;/&gt;
&lt;vType id=&quot;Bike&quot; jmIgnoreFoeProb=&quot;1.0&quot; impatience=&quot;1.0&quot; vClass=&quot;bicycle&quot;/&gt;
&lt;vehicle id=&quot;bus_0&quot; type=&quot;Bus&quot; depart=&quot;0.00&quot;&gt;
&lt;route edges=&quot;139083727#2 370073260#0 370073258#0 24400729#1&quot;&gt;
&lt;stop busStop=&quot;busstop&quot; duration=&quot;60&quot;/&gt;
&lt;/route&gt;
&lt;/vehicle&gt;
&lt;vehicle id=&quot;bus_1&quot; type=&quot;Bus&quot; depart=&quot;0.00&quot;&gt;
&lt;route edges=&quot;139083727#1 139083727#2 370073260#0 370073258#0 24400729#1&quot;&gt;
&lt;stop busStop=&quot;busstop&quot; duration=&quot;60&quot;/&gt;
&lt;/route&gt;
&lt;/vehicle&gt;
&lt;vehicle id=&quot;vehicle_straight&quot; depart=&quot;0.00&quot;&gt;
&lt;route edges=&quot;139083727#1 139083727#2 370073260#0 370073258#0 -4919237#3&quot;/&gt;
&lt;/vehicle&gt;
&lt;vehicle id=&quot;bike_left&quot; type=&quot;Bike&quot; depart=&quot;0.00&quot; departPos=&quot;11&quot;&gt;
&lt;route edges=&quot;gneE3 370073260#0 370073258#0 -4919237#3&quot;/&gt;
&lt;/vehicle&gt;
&lt;vehicle id=&quot;bike_right&quot; type=&quot;Bike&quot; depart=&quot;5.00&quot;&gt;
&lt;route edges=&quot;624358653#1 624358654#0 624358654#1 gneE4 458455265&quot;/&gt;
&lt;/vehicle&gt;
&lt;/routes&gt;
</code></pre>
<p>You can try running the scenario using the following command:</p>
<pre><code class="language-plaintext">sumo -c &lt;path-to-config&gt;/sievenkingplatz.sumocfg
</code></pre>
<h2 id="setting-up-the-mosaic-scenario">Setting up the MOSAIC scenario</h2>
<p>Now lets set up a complete MOSAIC scenario starting from the SUMO scenario we have so far.
We will go along the following steps and explain everything in detail:</p>
<ol>
<li>Creating the scenario database.</li>
<li>(Optional) Loading the routes into the database.</li>
<li>Create the MOSAIC scenario folder structure.</li>
<li>Set up the <code>scenario_config.json</code></li>
<li>Have a look at some additional SUMO configuration.</li>
</ol>
<h3 id="1-creating-the-scenario-database">1. Creating the scenario database</h3>
<p>To create the scenario database we will use the
<a href="/mosaic/docs/building_scenarios/scenario_convert/">
scenario_convert
</a>
script, that comes bundled with the MOSAIC extended version from the
<a href="/mosaic/download/">
download section
</a>
.
Start by calling:</p>
<pre><code class="language-plaintext">java -jar scenario-convert.jar --sumo2db -i sievekingplatz.net.xml
</code></pre>
<p>This will create a database called <code>sievekingplatz.db</code> and load the network into the database.</p>
<h3 id="2-loading-the-routes-into-the-database">2. Loading the routes into the database</h3>
<p>Next we will use the same command to load the routes of the route-file into the database.
This is optional, but necessary if you want to add vehicles along the routes of your SUMO route-file.</p>
<pre><code class="language-plaintext">java -jar scenario-convert.jar --sumo2db -i sievekingplatz.rou.xml -d sievekingplatz.db
</code></pre>
<p>Note, that we also have to specify the database here.</p>
<h3 id="3-create-the-mosaic-scenario-folder-structure">3. Create the MOSAIC scenario folder structure</h3>
<p>MOSAIC requires a special folder structure to organize the configuration of different federates. If you haven&rsquo;t dealt with MOSAIC
scenarios yet have a look
<a href="/mosaic/docs/building_scenarios/scenario_configuration/">
here
</a>
.
Start by creating a following folder structure representing the most basic set-up for a MOSAIC scenario:</p>
<pre><code class="language-plaintext">└─ sievekingplatz
├─ application
├─ mapping
└─ sumo
</code></pre>
<p>Next copy the database into the <code>application</code>-directory and all SUMO files into the <code>sumo</code>-directory.
Additionally, you can create the configuration file <code>mapping_config.json</code> in the <code>mapping</code>-directory, we will fill this file later on.</p>
<h3 id="4-set-up-the-scenario_configjson">4. Set up the <code>scenario_config.json</code></h3>
<p>Create a file called <code>scenario_config.json</code> in the parent directory of you scenario, this is the main configuration for your scenario.
The folder structure should now look as following:</p>
<pre><code class="language-plaintext">└─ sievekingplatz
├─ application
| └─ sievekingplatz.db
├─ mapping
| └─ mapping_config.json
├─ sumo
| ├─ sievekingplatz.bus.add.xml
| ├─ sievekingplatz.net.xml
| ├─ sievekingplatz.rou.xml
| ├─ sievekingplatz.sumocfg
| └─ sumo_config.json
└─ scenario_config.json
</code></pre>
<p>Now it&rsquo;s time to fill out the <code>scenario_config.json</code>. For now, you can copy the following configuration:</p>
<pre><code class="language-json">{
&quot;simulation&quot;: {
&quot;id&quot;: &quot;Sievekingplatz&quot;,
&quot;duration&quot;: &quot;200s&quot;,
&quot;randomSeed&quot;: 212323853,
&quot;projection&quot;: {
&quot;centerCoordinates&quot;: {
&quot;latitude&quot;: 52.63,
&quot;longitude&quot;: 13.56
},
&quot;cartesianOffset&quot;: {
&quot;x&quot;: -563984.16,
&quot;y&quot;: -5933566.87
}
},
&quot;network&quot;: {
&quot;netMask&quot;: &quot;255.255.0.0&quot;,
&quot;vehicleNet&quot;: &quot;10.1.0.0&quot;,
&quot;rsuNet&quot;: &quot;10.2.0.0&quot;,
&quot;tlNet&quot;: &quot;10.3.0.0&quot;,
&quot;csNet&quot;: &quot;10.4.0.0&quot;,
&quot;serverNet&quot;: &quot;10.5.0.0&quot;,
&quot;tmcNet&quot;: &quot;10.6.0.0&quot;
}
},
&quot;federates&quot;: {
&quot;application&quot;: true,
&quot;cell&quot;: false,
&quot;environment&quot;: false,
&quot;sns&quot;: false,
&quot;ns3&quot;: false,
&quot;omnetpp&quot;: false,
&quot;sumo&quot;: true
}
}
</code></pre>
<blockquote>
<p>Note: The <code>cartesianOffset</code> values are taken from the net-file and can generally just be copied over.</p>
</blockquote>
<h3 id="5-additional-sumo-configuration">5. Additional SUMO configuration</h3>
<p>In the <code>sievekingplatz.sumocfg</code> the <code>step-length</code> is defined, this parameter will, by default, be ignored in MOSAIC and has to be
set in the <code>sumo_config.json</code> (located in the <code>sumo</code>-directory) to ensure the same behaviour.
(SUMO uses seconds as unit and MOSAIC milliseconds)</p>
<p><strong><code>sievekingplatz.sumocfg</code></strong>:</p>
<pre><code class="language-xml"> ...
&lt;time&gt;
&lt;step-length value=&quot;0.1&quot;/&gt;
&lt;/time&gt;
...
</code></pre>
<p><strong><code>sumo_config.json</code></strong>:</p>
<pre><code class="language-json">{
&quot;updateInterval&quot;: 100
}
</code></pre>
<h2 id="additional-traffic-demand-from-mosaic">Additional Traffic Demand from MOSAIC</h2>
<p>Now that we set up the basic scenario structure, we can continue by creating some additional traffic demand.
Let&rsquo;s try to add 3 additional vehicles using a flow definition in the <code>mapping_config.json</code>-file.
We first define the prototype <code>MappingCar</code> for our new vehicles. Afterwards we define a spawner for three additional vehicles and also
equip them with the <code>HelloWorldApp</code>, which we will have a look at next.</p>
<pre><code class="language-json">{
&quot;prototypes&quot;: [
{
&quot;name&quot;: &quot;MappingCar&quot;
},
...
],
&quot;vehicles&quot;: [
{
&quot;startingTime&quot;: 10.0,
&quot;route&quot;: &quot;3&quot;,
&quot;targetFlow&quot;: 1200,
&quot;maxNumberVehicles&quot;: 3,
&quot;lanes&quot;: [ 1, 2 ],
&quot;types&quot;: [
{
&quot;name&quot;: &quot;MappingCar&quot;,
&quot;applications&quot;: [ &quot;org.eclipse.mosaic.app.tutorial.eventprocessing.sampling.HelloWorldApp&quot; ]
}
]
}
]
}
</code></pre>
<blockquote>
<p>This isn&rsquo;t shown here, but it is also possible to define bikes and busses in the <code>mapping_config.json</code>. In order to this you have
to set the according <code>&quot;vehicleClass&quot;</code>-attribute in the prototype (see <code>org.eclipse.mosaic.lib.enums.VehicleClass</code>).</p>
</blockquote>
<p>We can now start the scenario using the MOSAIC start script and will see both the vehicles from SUMO and the ones from MOSAIC.</p>
<h2 id="equipping-the-vehicles-with-applications">Equipping the vehicles with applications</h2>
<p>We will now extend our scenario by equipping the participants with a simple application:</p>
<table>
<thead>
<tr>
<th>Application</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>org.eclipse.mosaic.app.tutorial.eventprocessing.sampling.</code><strong><code>HelloWorldApp</code></strong></td>
<td>This app gets mapped on all participants and is just used to showcase that they&rsquo;re handled properly by the <code>ApplicationAmbassador</code></td>
</tr>
</tbody>
</table>
<p>We do this by mapping the application to vTypes defined in the SUMO route-file. This functions analogously to how you would do it when
only using the mapping-file, though you cannot map apps on single vehicles but only their vTypes.
Additionally, there are some more things to consider:</p>
<ul>
<li>The <code>&quot;DEFAULT_VEHTYPE&quot;</code> prototype is the name of the default <code>vType</code> in SUMO. So all vehicle definitions, missing a <code>type</code>-parameter will
get the <code>HelloWorldApp</code> mapped to them.</li>
<li>The <code>Bus</code> prototype additionally has a <code>&quot;weight&quot;</code>-attribute. This controls the percentage of vehicles, that will get the apps mapped
to them.</li>
<li>The vehicle spawner defines the <code>&quot;lanes&quot;</code>-attribute, since lane 0 is a bus-lane.</li>
<li>You can&rsquo;t specify spawners for any of the types defined in SUMO as this would lead to MOSAIC writing the type again and thereby crashing
the simulation.</li>
<li>You can however define vehicles in the route-file using the type <code>MappingCar</code>, as this is written in a separate file beforehand.</li>
</ul>
<pre><code class="language-json">{
&quot;prototypes&quot;: [
{
&quot;name&quot;: &quot;MappingCar&quot;
},
{
&quot;name&quot;: &quot;Bike&quot;,
&quot;applications&quot;: [ &quot;org.eclipse.mosaic.app.tutorial.eventprocessing.sampling.HelloWorldApp&quot; ]
},
{
&quot;name&quot;: &quot;DEFAULT_VEHTYPE&quot;,
&quot;applications&quot;: [ &quot;org.eclipse.mosaic.app.tutorial.eventprocessing.sampling.HelloWorldApp&quot; ]
},
{
&quot;name&quot;: &quot;Bus&quot;,
&quot;weight&quot;: 0.4,
&quot;applications&quot;: [ &quot;org.eclipse.mosaic.app.tutorial.eventprocessing.sampling.HelloWorldApp&quot; ]
}
],
...
}
</code></pre>
<h2 id="simulation-and-results">Simulation and Results</h2>
<p>We are done building our scenario and can now run it using MOSAIC&rsquo;s start script.</p>
<pre><code>mosaic.&lt;sh|bat&gt; -c &lt;path-to-scenario&gt;/scenario_config.json
</code></pre>
<p>The figure below is a snapshot of the simulation showing the different types of participants. Vehicles defined in SUMO
will have the id defined in the route-file, vehicles from mapping will follow the pattern <code>veh_&lt;number&gt;</code>. In MOSAIC all
vehicles are assigned an id, which follows this pattern. This is why the number at times might seem arbitrary, in reality
it is counted upwards beginning from 0, in the order of spawning.</p>
<figure id="figure-overview-of-the-sievekingplatz-scenario-during-simulation-including-type-parameters">
<a data-fancybox="" href="images/integrate_existing_sumo_scenarios-simulation.png" data-caption="Overview of the Sievekingplatz scenario during simulation including type parameters">
<img src="images/integrate_existing_sumo_scenarios-simulation.png" alt="" >
</a>
<figcaption data-pre="Figure " data-post=":" class="numbered">
Overview of the Sievekingplatz scenario during simulation including type parameters
</figcaption>
</figure>
<h3 id="logs">Logs</h3>
<p>We&rsquo;ll have a quick look at some logs of the applications to see, that everything functions properly.</p>
<p><strong><code>veh_0/HelloWorldApp.log</code></strong>:</p>
<pre><code class="language-log">INFO - Hello World! I'm a Bus. (at simulation time 0.200,000,000 s)
INFO - I'm still here! (at simulation time 1.200,000,000 s)
...
INFO - I'm still here! (at simulation time 98.200,000,000 s)
INFO - Bye bye World (at simulation time 99.100,000,000 s)
</code></pre>
<p>This is the log of the first bus added, which can be seen in the first logged message.
One thing to note is that it will take 2 simulation steps for the <code>ApplicationAmbassador</code> to startup
apps on SUMO vehicles. This is due to how things are handled internally.</p>
<p><strong><code>veh_5/HelloWorldApp.log</code></strong>:</p>
<pre><code class="language-log">INFO - Hello World! I'm a MappingCar. (at simulation time 10.100,000,000 s)
INFO - I'm still here! (at simulation time 11.100,000,000 s)
...
INFO - I'm still here! (at simulation time 24.100,000,000 s)
INFO - Bye bye World (at simulation time 24.300,000,000 s)
</code></pre>
<p>This is the log of the first car from the <code>mapping_config.json</code>.</p>
<h2 id="summary">Summary</h2>
<p>It should be fairly simple to transfer the shown methods to an arbitrary SUMO scenario. This is especially useful if you already have
existing scenarios that you want to extend with MOSAIC&rsquo;s application and communication capabilities as you don&rsquo;t have to worry about
configuring the traffic demand again.</p>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha384-vk5WoKIaW/vJyUAd9n/wmopsmNhiy+L2Z+SBxGYnUkunIxVxAv/UtMOhba/xskxh" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/2.6.0/umd/popper.min.js" integrity="sha512-BmM0/BQlqh02wuK5Gz9yrbe7VyIVwOzD1o40yi1IsTjriX/NGF37NyXHfmFzIlMmoSIBXgqDiG1VNU6kB5dBbA==" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.imagesloaded/4.1.4/imagesloaded.pkgd.min.js" integrity="sha512-S5PZ9GxJZO16tT9r3WJp/Safn31eu8uWrzglMahDT4dsmgqWonRY9grk3j+3tfuPr9WJNsfooOR7Gi7HL5W2jw==" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.isotope/3.0.6/isotope.pkgd.min.js" integrity="sha512-Zq2BOxyhvnRFXu0+WE6ojpZLOU2jdnqbrM1hmVdGzyeCa1DgM3X5Q4A/Is9xA1IkbUeDd7755dNNI/PzSf2Pew==" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.js" integrity="sha512-uURl+ZXMBrF4AwGaWmEetzrd+J5/8NRkWAvJx5sbPSSuOb0bZLqf+tOzniObO00BjHa/dD7gub9oCGMLPQHtQA==" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mermaid/8.4.8/mermaid.min.js" integrity="sha512-1tS1YUns336Mtxl+vkaLcADPwE1CPNVy3WEf7nrI7DGMMb6/FAVBgL2IzAWVBkB6vVuK94s2zVoiXcw1QZ9S1g==" crossorigin="anonymous" title="mermaid"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/highlight.min.js" integrity="sha512-1LdB3V708w6G4QRl7NsVdTr7MDibyRXr9stQZ+EGjEE0ZPMZkA//ir7kCWmFyxdAJNIRXdR/ZeJmCV0boyiCXw==" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/languages/java.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/languages/json.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/languages/xml.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/languages/shell.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/languages/dos.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.5.1/leaflet.js" integrity="sha512-GffPMF3RvMeYyc1LWMHtK8EbPv0iNZ8/oTtHPx9/cc2ILxQ+u905qIwdpULaqDkyBKgOaB57QTMg7ztg8Jm2Og==" crossorigin="anonymous"></script>
<script>const code_highlighting = true;</script>
<script>const isSiteThemeDark = false;</script>
<script>
const search_config = {"indexURI":"/mosaic/index.json","minLength":1,"threshold":0.3};
const i18n = {"no_results":"No results found","placeholder":"Search...","results":"results found"};
const content_type = {
'post': "Posts",
'project': "Projects",
'publication' : "Publications",
'talk' : "Talks"
};
</script>
<script id="search-hit-fuse-template" type="text/x-template">
<div class="search-hit" id="summary-{{key}}">
<div class="search-hit-content">
<div class="search-hit-name">
<a href="{{relpermalink}}">{{title}}</a>
<div class="article-metadata search-hit-type">{{type}}</div>
<p class="search-hit-description">{{snippet}}</p>
</div>
</div>
</div>
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/3.2.1/fuse.min.js" integrity="sha512-o38bmzBGX+hD3JHWUFCDA09btWaqrNmoJ3RXLlrysA7PP01Kgs4UlE4MhelE1v5dJR3+cxlR4qQlotsW7jKsnw==" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.min.js" integrity="sha512-mhbv5DqBMgrWL+32MmsDOt/OAvqr/cHimk6B8y/bx/xS88MVkYGPiVv2ixKVrkywF2qHplNRUvFsAHUdxZ3Krg==" crossorigin="anonymous"></script>
<script type="application/javascript" src="/mosaic/js/academic.min.0992ad8b8d033c3858bb90b03966346a.js"></script>
<script type="application/javascript" src="/mosaic/js/mosaic-wg-cards.js"></script>
<script>
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
tooltipTriggerList.map(function (tooltipTriggerEl) {
return new window.bootstrap.Tooltip(tooltipTriggerEl)
})
</script>
<div class="footer-wrap">
<div class="container">
<footer class="site-footer">
<div class="row">
<div class="col-sm-4 mb-3 mb-md-0">
<b>Eclipse MOSAIC</b>
<ul>
<li>
<a href="/mosaic/download/" title="Download Eclipse MOSAIC" >
Download Eclipse MOSAIC
</a>
</li>
<li>
<a href="/mosaic/docs/" title="Documentation" >
Documentation
</a>
</li>
<li>
<a href="/mosaic/tutorials/" title="Tutorials" >
Tutorials
</a>
</li>
<li>
<a href="/mosaic/community/#projects" title="Projects" >
Projects
</a>
</li>
<li>
<a href="/mosaic/publications/" title="Publications" >
Publications
</a>
</li>
</ul>
</div>
<div class="col-sm-4 mb-3 mb-md-0">
<b>Community</b>
<ul>
<li>
<a href="/mosaic/community/" title="Eclipse MOSAIC Community" >
Eclipse MOSAIC Community
</a>
</li>
<li>
<a href="/mosaic/contribution/" title="How to contribute" >
How to contribute
</a>
</li>
<li>
<a href="https://github.com/eclipse/mosaic" title="Github" target="_blank" rel="noopener">
Github
</a>
</li>
<li>
<a href="/mosaic/get_in_contact/" title="Contact &amp; Mailing list" >
Contact & Mailing list
</a>
</li>
</ul>
</div>
<div class="col-sm-4 mb-3 mb-md-0">
<b>Eclipse Foundation</b>
<ul>
<li>
<a href="https://www.eclipse.org/" title="About Eclipse Foundation" target="_blank" rel="noopener">
About Eclipse Foundation
</a>
</li>
<li>
<a href="https://www.eclipse.org/legal/privacy.php" title="Privacy Policy" target="_blank" rel="noopener">
Privacy Policy
</a>
</li>
<li>
<a href="https://www.eclipse.org/legal/termsofuse.php" title="Website terms of use" target="_blank" rel="noopener">
Website terms of use
</a>
</li>
<li>
<a href="https://www.eclipse.org/legal/copyright.php" title="Copyright" target="_blank" rel="noopener">
Copyright
</a>
</li>
<li>
<a href="https://www.eclipse.org/legal" title="Legal" target="_blank" rel="noopener">
Legal
</a>
</li>
</ul>
</div>
</div>
<div class="row justify-content-center mt-3 position-relative">
<p class="powered-by text-center font-italic mb-0 pb-0">
Powered by the
<a href="https://sourcethemes.com/academic/" target="_blank" rel="noopener">Academic theme</a> for
<a href="https://gohugo.io" target="_blank" rel="noopener">Hugo</a>.
<br>
Header image &#169; fanjianhua/ iStock
</p>
<span class="position-absolute mr-3 mr-md-0" aria-hidden="true" style="right: 0;">
<a href="#" class="back-to-top">
<span class="button_icon">
<i class="fas fa-chevron-up fa-2x"></i>
</span>
</a>
</span>
</div>
</footer>
</div>
</div>
<div id="modal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Cite</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<pre><code class="tex hljs"></code></pre>
</div>
<div class="modal-footer">
<a class="btn btn-outline-primary my-1 js-copy-cite" href="#" target="_blank">
<i class="fas fa-copy"></i> Copy
</a>
<a class="btn btn-outline-primary my-1 js-download-cite" href="#" target="_blank">
<i class="fas fa-download"></i> Download
</a>
<div id="modal-error"></div>
</div>
</div>
</div>
</div>
</body>
</html>