def __init__(self, withDefaultDemand=True): Scenario.__init__(self, self.NAME) self.netName = self.fullPath(self.NET_FILE) self.demandName = self.fullPath("routes.rou.xml") # network if fileNeedsRebuild(self.netName, "netconvert"): print("Network in '%s' needs to be rebuild" % self.netName) defaultEdge = Edge(numLanes=1, maxSpeed=13.89) defaultEdge.addSplit(100, 1) defaultEdge.lanes = [Lane(dirs="rs"), Lane(dirs="l")] netGen = netGenerator.cross(None, defaultEdge) # not nice, the network name should be given/returned netGen.build(self.netName) # demand if withDefaultDemand: print("Demand in '%s' needs to be rebuild" % self.demandName) self.demand = demandGenerator.Demand() # why isn't it possible to get a network and return all possible # routes or whatever - to ease the process self.demand.addStream( demandGenerator.Stream(None, 0, 3600, 1000, "2/1_to_1/1", "1/1_to_0/1", { "hdv": .2, "passenger": .8 })) if fileNeedsRebuild(self.demandName, "duarouter"): self.demand.build(0, 3600, self.netName, self.demandName)
def __init__(self, withDefaultDemand=True): Scenario.__init__(self, self.NAME) self.netName = self.fullPath(self.NET_FILE) self.demandName = self.fullPath("routes.rou.xml") # network if fileNeedsRebuild(self.netName, "netconvert"): print("Network in '%s' needs to be rebuild" % self.netName) defaultEdge = Edge(numLanes=1, maxSpeed=13.89) defaultEdge.addSplit(100, 1) defaultEdge.lanes = [Lane(dirs="rs"), Lane(dirs="l")] netGen = netGenerator.cross(None, defaultEdge) # not nice, the network name should be given/returned netGen.build(self.netName) # demand if withDefaultDemand: print("Demand in '%s' needs to be rebuild" % self.demandName) self.demand = demandGenerator.Demand() # why isn't it possible to get a network and return all possible # routes or whatever - to ease the process self.demand.addStream(demandGenerator.Stream( None, 0, 3600, 1000, "2/1_to_1/1", "1/1_to_0/1", {"hdv": .2, "passenger": .8})) if fileNeedsRebuild(self.demandName, "duarouter"): self.demand.build(0, 3600, self.netName, self.demandName)
@date 2013-10-23 @version $Id$ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ Copyright (C) 2012-2017 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. """ # import osm network import sys import os import subprocess del sys.path[0] del sys.path[0] sys.path.append(os.path.join( os.path.dirname(sys.argv[0]), '..', '..', '..', '..', '..', "tools")) import sumolib.net.generator.cross as generator from sumolib.net.generator.network import * defaultEdge = Edge(numLanes=3, maxSpeed=13.89, lanes=[ Lane(dirs="rs"), Lane(dirs="s"), Lane(dirs="l")]) net = generator.cross(None, defaultEdge) net.build()
#!/usr/bin/env python # -*- coding: utf-8 -*- # Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo # Copyright (C) 2012-2018 German Aerospace Center (DLR) and others. # This program and the accompanying materials # are made available under the terms of the Eclipse Public License v2.0 # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v20.html # @file runner.py # @author Daniel Krajzewicz # @date 2013-10-23 # @version $Id$ # import osm network import sys import os import subprocess del sys.path[0] del sys.path[0] sys.path.append( os.path.join(os.path.dirname(sys.argv[0]), '..', '..', '..', '..', '..', "tools")) import sumolib.net.generator.cross as generator net = generator.cross() net.build()
import sys import os import subprocess del sys.path[0] del sys.path[0] sys.path.append(os.path.join( os.path.dirname(sys.argv[0]), '..', '..', '..', '..', '..', "tools")) import sumolib.net.generator.cross as generator from sumolib.net.generator.network import * from sumolib.net.generator.demand import * defaultEdge = Edge(numLanes=1, maxSpeed=13.89) defaultEdge.addSplit(100, 1) defaultEdge.lanes = [Lane(dirs="rs"), Lane(dirs="l")] net = generator.cross(None, defaultEdge) net.build() flows = [ ["nm", [ ["ms", 159, 9], ["me", 59, 9], ["mw", 64, 12] ]], ["wm", [ ["me", 708, 10], ["mn", 80, 14], ["ms", 130, 2] ]],
""" @file runner.py @author Daniel Krajzewicz @date 2013-10-23 @version $Id$ SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/ Copyright (C) 2012-2016 DLR (http://www.dlr.de/) and contributors This file is part of SUMO. SUMO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. """ # import osm network import sys import os import subprocess del sys.path[0] del sys.path[0] sys.path.append(os.path.join( os.path.dirname(sys.argv[0]), '..', '..', '..', '..', '..', "tools")) import sumolib.net.generator.cross as generator net = generator.cross() net.build()