| <!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+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"> |
| <routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/routes_file.xsd"> |
| <vType id="Bus" vClass="bus" length="20"/> |
| <vType id="Bike" jmIgnoreFoeProb="1.0" impatience="1.0" vClass="bicycle"/> |
| |
| <vehicle id="bus_0" type="Bus" depart="0.00"> |
| <route edges="139083727#2 370073260#0 370073258#0 24400729#1"> |
| <stop busStop="busstop" duration="60"/> |
| </route> |
| </vehicle> |
| <vehicle id="bus_1" type="Bus" depart="0.00"> |
| <route edges="139083727#1 139083727#2 370073260#0 370073258#0 24400729#1"> |
| <stop busStop="busstop" duration="60"/> |
| </route> |
| </vehicle> |
| |
| <vehicle id="vehicle_straight" depart="0.00"> |
| <route edges="139083727#1 139083727#2 370073260#0 370073258#0 -4919237#3"/> |
| </vehicle> |
| |
| <vehicle id="bike_left" type="Bike" depart="0.00" departPos="11"> |
| <route edges="gneE3 370073260#0 370073258#0 -4919237#3"/> |
| </vehicle> |
| <vehicle id="bike_right" type="Bike" depart="5.00"> |
| <route edges="624358653#1 624358654#0 624358654#1 gneE4 458455265"/> |
| </vehicle> |
| </routes> |
| </code></pre> |
| <p>You can try running the scenario using the following command:</p> |
| <pre><code class="language-plaintext">sumo -c <path-to-config>/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’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’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">{ |
| "simulation": { |
| "id": "Sievekingplatz", |
| "duration": "200s", |
| "randomSeed": 212323853, |
| "projection": { |
| "centerCoordinates": { |
| "latitude": 52.63, |
| "longitude": 13.56 |
| }, |
| "cartesianOffset": { |
| "x": -563984.16, |
| "y": -5933566.87 |
| } |
| }, |
| "network": { |
| "netMask": "255.255.0.0", |
| "vehicleNet": "10.1.0.0", |
| "rsuNet": "10.2.0.0", |
| "tlNet": "10.3.0.0", |
| "csNet": "10.4.0.0", |
| "serverNet": "10.5.0.0", |
| "tmcNet": "10.6.0.0" |
| } |
| }, |
| "federates": { |
| "application": true, |
| "cell": false, |
| "environment": false, |
| "sns": false, |
| "ns3": false, |
| "omnetpp": false, |
| "sumo": 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"> ... |
| <time> |
| <step-length value="0.1"/> |
| </time> |
| ... |
| </code></pre> |
| <p><strong><code>sumo_config.json</code></strong>:</p> |
| <pre><code class="language-json">{ |
| "updateInterval": 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’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">{ |
| "prototypes": [ |
| { |
| "name": "MappingCar" |
| }, |
| ... |
| ], |
| "vehicles": [ |
| { |
| "startingTime": 10.0, |
| "route": "3", |
| "targetFlow": 1200, |
| "maxNumberVehicles": 3, |
| "lanes": [ 1, 2 ], |
| "types": [ |
| { |
| "name": "MappingCar", |
| "applications": [ "org.eclipse.mosaic.app.tutorial.eventprocessing.sampling.HelloWorldApp" ] |
| } |
| ] |
| } |
| ] |
| } |
| </code></pre> |
| <blockquote> |
| <p>This isn’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>"vehicleClass"</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’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>"DEFAULT_VEHTYPE"</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>"weight"</code>-attribute. This controls the percentage of vehicles, that will get the apps mapped |
| to them.</li> |
| <li>The vehicle spawner defines the <code>"lanes"</code>-attribute, since lane 0 is a bus-lane.</li> |
| <li>You can’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">{ |
| "prototypes": [ |
| { |
| "name": "MappingCar" |
| }, |
| { |
| "name": "Bike", |
| "applications": [ "org.eclipse.mosaic.app.tutorial.eventprocessing.sampling.HelloWorldApp" ] |
| }, |
| { |
| "name": "DEFAULT_VEHTYPE", |
| "applications": [ "org.eclipse.mosaic.app.tutorial.eventprocessing.sampling.HelloWorldApp" ] |
| }, |
| { |
| "name": "Bus", |
| "weight": 0.4, |
| "applications": [ "org.eclipse.mosaic.app.tutorial.eventprocessing.sampling.HelloWorldApp" ] |
| } |
| ], |
| ... |
| } |
| </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’s start script.</p> |
| <pre><code>mosaic.<sh|bat> -c <path-to-scenario>/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_<number></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’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’s application and communication capabilities as you don’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 & 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 © 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">×</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> |