コード例 #1
0
ファイル: netdiff.py プロジェクト: smendez-hi/SUMO-hib
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
ファイル: one-shot.py プロジェクト: cathyyul/sumo-0.18
                    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")