if len(sys.argv) > 1: buildEvaSite(sys.argv[1], siteFile) else: buildEvaSite("inputLocations.poi.xml", siteFile) print("osm Get") osmGet.get(["-x", siteFile]) print("osm Build") osmOptions = ['-f', 'osm_bbox.osm.xml', '-p', prefix, '--vehicle-classes', 'road', '-m', os.path.join(SUMO_HOME, 'data', 'typemap', 'osmPolyconvert.typ.xml')] osmBuild.build(osmOptions) print("polyconvert") sys.stdout.flush() subprocess.call([sumolib.checkBinary('polyconvert'), '-n', '%s.net.xml' % prefix, '--xml-files', siteFile, '-o', mappedSiteFile]) print("merging") mergePopulationData("population.csv", 'regions.poly.xml', mergedPopulationFile) print("extracting population data") extract(mergedPopulationFile, mappedSiteFile, intersectionFile) print("generating traffic") generateTraffic.generate( '%s.net.xml' % prefix, mappedSiteFile, intersectionFile, '%s.rou.xml' % prefix) print("calling sumo") sys.stdout.flush() sumo = sumolib.checkBinary('sumo') sumoOptions = [sumo, '-n', "%s.net.xml" % prefix, '-a', "%s.poly.xml,inputLocations.poi.xml,%s" % (prefix, mappedSiteFile), '-r', '%s.rou.xml' % prefix, '--ignore-route-errors', '--no-step-log', '--save-configuration', '%s.sumocfg' % prefix] subprocess.call(sumoOptions) subprocess.call([sumo, '%s.sumocfg' % prefix]) # subprocess.call([sumolib.checkBinary('sumo-gui'), '%s.sumocfg' % prefix]) print("done")
else: buildEvaSite("inputLocations.poi.xml", siteFile) print("osm Get") osmGet.get(["-x", siteFile]) print("osm Build") osmOptions = ['-f', 'osm_bbox.osm.xml', '-p', prefix, '--vehicle-classes', 'road', '-m', os.path.join(SUMO_HOME, 'data', 'typemap', 'osmPolyconvert.typ.xml')] osmBuild.build(osmOptions) print("polyconvert") sys.stdout.flush() subprocess.call([sumolib.checkBinary('polyconvert'), '-n', '%s.net.xml' % prefix, '--xml-files', siteFile, '-o', mappedSiteFile]) print("merging") mergePopulationData("population.csv", 'regions.poly.xml', mergedPopulationFile) print("extracting population data") extract(mergedPopulationFile, mappedSiteFile, intersectionFile) print("generating traffic") generateTraffic.generate( '%s.net.xml' % prefix, mappedSiteFile, intersectionFile, '%s.rou.xml' % prefix) print("calling sumo") sys.stdout.flush() sumo = sumolib.checkBinary('sumo') sumoOptions = [sumo, '-n', "%s.net.xml" % prefix, '-a', "%s.poly.xml,inputLocations.poi.xml,%s" % (prefix, mappedSiteFile), '-r', '%s.rou.xml' % prefix, '--ignore-route-errors', '--no-step-log', '--save-configuration', '%s.sumocfg' % prefix] subprocess.call(sumoOptions) subprocess.call([sumo, '%s.sumocfg' % prefix]) # subprocess.call([sumolib.checkBinary('sumo-gui'), '%s.sumocfg' % prefix]) print("done")