Path: blob/main/tests/complex/tutorial/manhattan/runner.py
169685 views
#!/usr/bin/env python1# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2# Copyright (C) 2008-2025 German Aerospace Center (DLR) and others.3# This program and the accompanying materials are made available under the4# terms of the Eclipse Public License 2.0 which is available at5# https://www.eclipse.org/legal/epl-2.0/6# This Source Code may also be made available under the following Secondary7# Licenses when the conditions for such availability set forth in the Eclipse8# Public License 2.0 are satisfied: GNU General Public License, version 29# or later which is available at10# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later1213# @file runner.py14# @author Daniel Krajzewicz15# @author Michael Behrisch16# @date 2007-10-251718from __future__ import absolute_import19from __future__ import print_function202122import os23from subprocess import call24import sys25try:26sys.path.append(os.path.join(os.path.dirname(27__file__), '..', '..', '..', '..', "tools")) # tutorial in tests28sys.path.append(os.path.join(os.environ.get("SUMO_HOME", os.path.join(29os.path.dirname(__file__), "..", "..", "..")), "tools")) # tutorial in docs30from sumolib import checkBinary # noqa31except ImportError:32sys.exit("please declare environment variable 'SUMO_HOME'")3334netgenBinary = checkBinary('netgenerate')35jtrrouterBinary = checkBinary('jtrrouter')36sumoBinary = checkBinary('sumo')37import randomTrips # noqa3839call([netgenBinary, '-c', 'data/manhattan.netgcfg'])40randomTrips.main(randomTrips.get_options([41'--flows', '100',42'-b', '0',43'-e', '1',44'-n', 'data/net.net.xml',45'-o', 'data/flows.xml',46'--jtrrouter',47'--trip-attributes', 'departPos="random" departSpeed="max"']))48call([jtrrouterBinary, '-c', 'data/manhattan.jtrrcfg'])49call([sumoBinary, '-c', 'data/manhattan.sumocfg', '--duration-log.statistics', '-e' '1000'])505152