sumolib.scenario.scenarios.real_world

 1# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
 2# Copyright (C) 2012-2026 German Aerospace Center (DLR) and others.
 3# This program and the accompanying materials are made available under the
 4# terms of the Eclipse Public License 2.0 which is available at
 5# https://www.eclipse.org/legal/epl-2.0/
 6# This Source Code may also be made available under the following Secondary
 7# Licenses when the conditions for such availability set forth in the Eclipse
 8# Public License 2.0 are satisfied: GNU General Public License, version 2
 9# or later which is available at
10# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
11# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
12
13# @file    real_world.py
14# @author  Daniel Krajzewicz
15# @date    2014-09-01
16
17
18from __future__ import absolute_import
19from __future__ import print_function
20
21from . import fileNeedsRebuild, Scenario
22import os
23import sumolib.net.generator.cross as netGenerator  # noqa
24import sumolib.net.generator.demand as demandGenerator  # noqa
25
26
27class Scenario_RealWorld(Scenario):
28    NAME = "RealWorld"
29    THIS_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), NAME)
30
31    def __init__(self, which, withDefaultDemand=True):
32        Scenario.__init__(self, self.NAME + "/" + which)
33        self.THIS_DIR = os.path.join(self.THIS_DIR, which)
34        self.NAME = os.path.join(self.NAME, which)
35        self.params = {}
36        fd = open(os.path.join(self.THIS_DIR, "meta.txt"))
37        for line in fd:
38            line = line.strip()
39            if len(line) == 0:
40                continue
41            (key, value) = line.split(":")
42            self.params[key] = value
43        fd.close()
44        self.NET_FILE = os.path.join(self.THIS_DIR, self.params["net"])
45        self.TLS_FILE = os.path.join(self.THIS_DIR, self.params["tls"])
46        self.netName = self.fullPath(self.NET_FILE)
47        self.demandName = os.path.join(self.THIS_DIR, self.params["rou"])
48        for add in self.params["add"].split(","):
49            self.addAdditionalFile(os.path.join(self.THIS_DIR, add))
50        # network
51        if fileNeedsRebuild(self.netName, "netconvert"):
52            pass
53        # demand
54        print(withDefaultDemand)
55        if not withDefaultDemand:
56            print("Not supported")
class Scenario_RealWorld(sumolib.scenario.scenarios.Scenario):
28class Scenario_RealWorld(Scenario):
29    NAME = "RealWorld"
30    THIS_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), NAME)
31
32    def __init__(self, which, withDefaultDemand=True):
33        Scenario.__init__(self, self.NAME + "/" + which)
34        self.THIS_DIR = os.path.join(self.THIS_DIR, which)
35        self.NAME = os.path.join(self.NAME, which)
36        self.params = {}
37        fd = open(os.path.join(self.THIS_DIR, "meta.txt"))
38        for line in fd:
39            line = line.strip()
40            if len(line) == 0:
41                continue
42            (key, value) = line.split(":")
43            self.params[key] = value
44        fd.close()
45        self.NET_FILE = os.path.join(self.THIS_DIR, self.params["net"])
46        self.TLS_FILE = os.path.join(self.THIS_DIR, self.params["tls"])
47        self.netName = self.fullPath(self.NET_FILE)
48        self.demandName = os.path.join(self.THIS_DIR, self.params["rou"])
49        for add in self.params["add"].split(","):
50            self.addAdditionalFile(os.path.join(self.THIS_DIR, add))
51        # network
52        if fileNeedsRebuild(self.netName, "netconvert"):
53            pass
54        # demand
55        print(withDefaultDemand)
56        if not withDefaultDemand:
57            print("Not supported")
Scenario_RealWorld(which, withDefaultDemand=True)
32    def __init__(self, which, withDefaultDemand=True):
33        Scenario.__init__(self, self.NAME + "/" + which)
34        self.THIS_DIR = os.path.join(self.THIS_DIR, which)
35        self.NAME = os.path.join(self.NAME, which)
36        self.params = {}
37        fd = open(os.path.join(self.THIS_DIR, "meta.txt"))
38        for line in fd:
39            line = line.strip()
40            if len(line) == 0:
41                continue
42            (key, value) = line.split(":")
43            self.params[key] = value
44        fd.close()
45        self.NET_FILE = os.path.join(self.THIS_DIR, self.params["net"])
46        self.TLS_FILE = os.path.join(self.THIS_DIR, self.params["tls"])
47        self.netName = self.fullPath(self.NET_FILE)
48        self.demandName = os.path.join(self.THIS_DIR, self.params["rou"])
49        for add in self.params["add"].split(","):
50            self.addAdditionalFile(os.path.join(self.THIS_DIR, add))
51        # network
52        if fileNeedsRebuild(self.netName, "netconvert"):
53            pass
54        # demand
55        print(withDefaultDemand)
56        if not withDefaultDemand:
57            print("Not supported")
NAME = 'RealWorld'
THIS_DIR = '/home/delphi/gcc/sumo/tools/sumolib/scenario/scenarios/RealWorld'
params
NET_FILE
TLS_FILE
netName
demandName