示例#1
0
 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)
示例#2
0
 def __init__(self, rot, withDefaultDemand=True):
     Scenario.__init__(self, self.NAME)
     self.NET_FILE = self.NET_FILE % rot
     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(50, 1)
         defaultEdge.lanes = [Lane(dirs="rs"), Lane(dirs="l")]
         netGen = netGenerator.grid(5, 5, None, defaultEdge)
         m = rot / 3.14
         for y in range(1, 6):
             for x in range(1, 6):
                 sr = math.sin(rot * y / 2. * x / 2.)
                 cr = math.cos(rot * x / 2. * y / 2.)
                 # * abs(3-x)/3.
                 netGen._nodes[
                     "%s/%s" % (x, y)].x = netGen._nodes["%s/%s" % (x, y)].x + sr * m * 250
                 # * abs(3-y)/3.
                 netGen._nodes[
                     "%s/%s" % (x, y)].y = netGen._nodes["%s/%s" % (x, y)].y + cr * m * 250
         # 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, "6/1_to_5/1", "1/1_to_0/1", {"hdv": .2, "passenger": .8}))
         if fileNeedsRebuild(self.demandName, "duarouter"):
             self.demand.build(0, 3600, self.netName, self.demandName)
示例#3
0
 def __init__(self, rot, withDefaultDemand=True):
     Scenario.__init__(self, self.NAME)
     self.NET_FILE = self.NET_FILE % rot
     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(50, 1)
         defaultEdge.lanes = [Lane(dirs="rs"), Lane(dirs="l")]
         netGen = netGenerator.grid(5, 5, None, defaultEdge)
         m = rot / 3.14
         for y in range(1, 6):
             for x in range(1, 6):
                 sr = math.sin(rot * y / 2. * x / 2.)
                 cr = math.cos(rot * x / 2. * y / 2.)
                 # * abs(3-x)/3.
                 netGen._nodes[
                     "%s/%s" % (x, y)].x = netGen._nodes["%s/%s" % (x, y)].x + sr * m * 250
                 # * abs(3-y)/3.
                 netGen._nodes[
                     "%s/%s" % (x, y)].y = netGen._nodes["%s/%s" % (x, y)].y + cr * m * 250
         # 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, "6/1_to_5/1", "1/1_to_0/1", {"hdv": .2, "passenger": .8}))
         if fileNeedsRebuild(self.demandName, "duarouter"):
             self.demand.build(0, 3600, self.netName, self.demandName)
示例#4
0
 def __init__(self, xoff, withDefaultDemand=True):
     Scenario.__init__(self, self.NAME)
     self.NET_FILE = self.NET_FILE % xoff
     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.corridor(5, None, defaultEdge)
         xpos = xoff
         for i in range(1, 6):
             netGen._nodes["%s/0" % i].x = xpos
             netGen._nodes["%s/1" % i].x = xpos
             netGen._nodes["%s/2" % i].x = xpos
             xpos = xpos + xoff
         netGen._nodes["6/1"].x = xpos
         # 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, "6/1_to_5/1", "1/1_to_0/1", {.2: "hdv", .8: "passenger"}))
         if fileNeedsRebuild(self.demandName, "duarouter"):
             self.demand.build(0, 3600, self.netName, self.demandName)
示例#5
0
 def __init__(self, xoff, withDefaultDemand=True):
     Scenario.__init__(self, self.NAME)
     self.NET_FILE = self.NET_FILE % xoff
     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.corridor(5, None, defaultEdge)
         xpos = xoff
         for i in range(1, 6):
             netGen._nodes["%s/0" % i].x = xpos
             netGen._nodes["%s/1" % i].x = xpos
             netGen._nodes["%s/2" % i].x = xpos
             xpos = xpos + xoff
         netGen._nodes["6/1"].x = xpos
         # 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, "6/1_to_5/1",
                                    "1/1_to_0/1", {
                                        .2: "hdv",
                                        .8: "passenger"
                                    }))
         if fileNeedsRebuild(self.demandName, "duarouter"):
             self.demand.build(0, 3600, self.netName, self.demandName)
示例#6
0
 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)