예제 #1
0
def main():
    options = parse_args()
    if not options.use_prefix:
        netconvert = checkBinary("netconvert", options.path)        
        options.source = create_plain(options.source, netconvert)
        options.dest = create_plain(options.dest, netconvert)
    for type in PLAIN_TYPES:
        xmldiff(options.source + type, 
                options.dest + type, 
                options.outprefix + type, 
                type)
예제 #2
0
def main():
    options = parse_args()
    if options.direct:
        type = '.xml'
        xmldiff(options.source, options.dest, options.outprefix + type, type)
    else:
        if not options.use_prefix:
            netconvert = checkBinary("netconvert", options.path)
            options.source = create_plain(options.source, netconvert)
            options.dest = create_plain(options.dest, netconvert)
        for type in PLAIN_TYPES:
            xmldiff(options.source + type, options.dest + type,
                    options.outprefix + type, type)
예제 #3
0
파일: netdiff.py 프로젝트: p1tt1/sumo
def main():
    options = parse_args()
    copy_tags = options.copy.split(',') if options.copy else []
    if options.direct:
        type = '.xml'
        xmldiff(options.source, 
                options.dest, 
                options.outprefix + type, 
                type,
                copy_tags)
    else:
        if not options.use_prefix:
            netconvert = checkBinary("netconvert", options.path)        
            options.source = create_plain(options.source, netconvert)
            options.dest = create_plain(options.dest, netconvert)
        for type in PLAIN_TYPES:
            xmldiff(options.source + type, 
                    options.dest + type, 
                    options.outprefix + type, 
                    type,
                    copy_tags)
예제 #4
0
                    default= False, help="sorts the output by departure time") 
optParser.add_option("-p", "--path", dest="path",
                     default=os.environ.get("SUMO_BINDIR", ""), help="Path to binaries")
optParser.add_option("--cost-modifier", dest="costmodifier", type="choice",
                     choices=('grohnde', 'isar', 'None'), 
                     default='None', help="Whether to modify link travel costs of the given routes")
(options, args) = optParser.parse_args()

sumo = "sumo"
if options.mesosim:
    sumo = "meso"
if options.path:    
    if os.path.isfile(options.path):
        sumoBinary = options.path
    else:
        sumoBinary = checkBinary(sumo, options.path)        
else:
    sumoBinary = checkBinary(sumo)
if options.costmodifier != 'None':
    pyPath = os.path.abspath(os.path.dirname(sys.argv[0]))
    sys.path.append(os.path.join(pyPath, "..", "..", "..", "..","..", "tools", "kkwSim"))
    from kkwCostModifier import costModifier
    print('use the cost modifier')

log = open("one_shot-log.txt", "w")
starttime = datetime.now()
for step in options.frequencies.split(","):
    step = int(step)
    print("> Running simulation with update frequency %s" % step)
    btime = datetime.now()
    print(">> Begin time %s" % btime)
예제 #5
0
# @file    runner.py
# @author  Michael Behrisch
# @date    2010-10-26
# @version $Id$

from __future__ import absolute_import

import os
import subprocess
import sys
import time

sys.path.append(
    os.path.join(os.path.dirname(sys.argv[0]), '..', '..', '..', '..', "tools",
                 "lib"))
import testUtil

guisimBinary = testUtil.checkBinary('sumo-gui')
for run in range(20):
    p = subprocess.Popen([guisimBinary, "-Q", "-N", "-c", "sumo.sumocfg"])
    time.sleep(1)
    testUtil.findAndClick(testUtil.PLAY)
    time.sleep(10)
    for step in range(3):
        testUtil.findAndClick(testUtil.STOP)
        time.sleep(1)
        testUtil.findAndClick(testUtil.PLAY)
        time.sleep(1)
    p.wait()
    subprocess.call(["diff", "v.xml", "vehroutes.xml"])
예제 #6
0
            iname = d
            index = 0
        items = item.getElementsByTagName(iname)
        item = items[index]
    if attribute:
        if newValue == "<remove>":
            item.removeAttribute(attribute)
        else:
            item.setAttribute(attribute, newValue)
    else:
        raise "?"


call = []
if sys.argv[1] == "sumo":
    call.append(checkBinary('sumo'))
    call.append("--no-step-log")
    call.append("--no-duration-log")
elif sys.argv[1] == "dfrouter":
    call.append(checkBinary('dfrouter'))
    call.append("--detector-files")
    call.append("input_additional.add.xml")
elif sys.argv[1] == "duarouter":
    call.append(checkBinary('duarouter'))
    call.append("-o")
    call.append("dummy.xml")
    call.append("-t")
    call.append("input_additional.add.xml")
elif sys.argv[1] == "jtrrouter":
    call.append(checkBinary('jtrrouter'))
    call.append("-o")
예제 #7
0
파일: runner.py 프로젝트: NeziheSozen/sumo
#!/usr/bin/env python

import os,subprocess,sys,time
sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '..', '..', '..', '..', "tools", "lib"))
import testUtil

guisimBinary = testUtil.checkBinary('sumo-gui')
for run in range(20):
    p = subprocess.Popen([guisimBinary, "-Q", "-N", "-c", "sumo.sumo.cfg"])
    time.sleep(1)
    testUtil.findAndClick(testUtil.PLAY)
    time.sleep(10)
    for step in range(3):
        testUtil.findAndClick(testUtil.STOP)
        time.sleep(1)
        testUtil.findAndClick(testUtil.PLAY)
        time.sleep(1)
    p.wait()
    subprocess.call(["diff", "v.xml", "vehroutes.xml"])
예제 #8
0
    "--cost-modifier",
    dest="costmodifier",
    type="choice",
    choices=('grohnde', 'isar', 'None'),
    default='None',
    help="Whether to modify link travel costs of the given routes")
(options, args) = optParser.parse_args()

sumo = "sumo"
if options.mesosim:
    sumo = "meso"
if options.path:
    if os.path.isfile(options.path):
        sumoBinary = options.path
    else:
        sumoBinary = checkBinary(sumo, options.path)
else:
    sumoBinary = checkBinary(sumo)
if options.costmodifier != 'None':
    pyPath = os.path.abspath(os.path.dirname(sys.argv[0]))
    sys.path.append(
        os.path.join(pyPath, "..", "..", "..", "..", "..", "tools", "kkwSim"))
    from kkwCostModifier import costModifier
    print('use the cost modifier')

log = open("one_shot-log.txt", "w")
starttime = datetime.now()
for step in options.frequencies.split(","):
    step = int(step)
    print("> Running simulation with update frequency %s" % step)
    btime = datetime.now()
예제 #9
0
파일: runner.py 프로젝트: tianyixin98/sumo
#!/usr/bin/env python

import os, subprocess, sys, time
sys.path.append(
    os.path.join(os.path.dirname(sys.argv[0]), '..', '..', '..', '..', "tools",
                 "lib"))
sys.path.append(
    os.path.join(os.path.dirname(sys.argv[0]), '..', '..', '..', '..', "tools",
                 "traci"))
import traciControl, testUtil

PORT = 8813
DELTA_T = 1000

netconvertBinary = testUtil.checkBinary('netconvert')
sumoBinary = testUtil.checkBinary('sumo')


def runSingle(addOption):
    step = 0
    timeline = []
    sumoProcess = subprocess.Popen("%s -c %s %s" %
                                   (sumoBinary, "sumo.sumo.cfg", addOption),
                                   shell=True,
                                   stdout=sys.stdout)
    traciControl.initTraCI(PORT)
    while not step > 10000:
        try:
            traciControl.cmdSimulationStep2(DELTA_T)
            vehs = traciControl.cmdGetVehicleVariable_idList()
            timeline.append({})
예제 #10
0
파일: runner.py 프로젝트: NeziheSozen/sumo
#!/usr/bin/env python

import os,subprocess,sys,time
sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '..', '..', '..', '..', "tools", "lib"))
sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '..', '..', '..', '..', "tools", "traci"))
import traciControl, testUtil


PORT = 8813
DELTA_T = 1000

netconvertBinary = testUtil.checkBinary('netconvert')
sumoBinary = testUtil.checkBinary('sumo')


def runSingle(addOption):
    step = 0
    timeline = []
    sumoProcess = subprocess.Popen("%s -c %s %s" % (sumoBinary, "sumo.sumo.cfg", addOption), shell=True, stdout=sys.stdout)
    traciControl.initTraCI(PORT)
    while not step>10000:
        try:
            traciControl.cmdSimulationStep2(DELTA_T)
            vehs = traciControl.cmdGetVehicleVariable_idList()
            timeline.append({})
            for v in vehs:
                timeline[-1][v] = traciControl.cmdGetVehicleVariable_speed(v)
            step += 1
        except traciControl.FatalTraCIError:
            print "Closed by SUMO"
            break
예제 #11
0
파일: runner.py 프로젝트: NeziheSozen/sumo
        else:
            iname = d
            index = 0
        items = item.getElementsByTagName(iname)
        item = items[index]
    if attribute:
        if newValue=="<remove>":
            item.removeAttribute(attribute)
        else:
            item.setAttribute(attribute, newValue)
    else:
        raise "?"

call = []
if sys.argv[1]=="sumo":
    call.append(checkBinary('sumo'))
    call.append("--no-step-log")
    call.append("--no-duration-log")
elif sys.argv[1]=="dfrouter":
    call.append(checkBinary('dfrouter'))
    call.append("--detector-files")
    call.append("input_additional.add.xml")
elif sys.argv[1]=="duarouter":
    call.append(checkBinary('duarouter'))
    call.append("-o")
    call.append("dummy.xml")
    call.append("-t")
    call.append("input_additional.add.xml")
elif sys.argv[1]=="jtrrouter":
    call.append(checkBinary('jtrrouter'))
    call.append("-o")