Path: blob/main/tests/complex/traci/bugs/ticket1010/runner.py
169776 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 Jakob Erdmann15# @author Laura Bieker16# @date 2013-10-071718from __future__ import absolute_import1920import os21import sys2223if 'SUMO_HOME' in os.environ:24sys.path.append(os.path.join(os.environ["SUMO_HOME"], "tools"))25import sumolib # noqa26import traci # noqa272829cmd = [sumolib.checkBinary('sumo'),30"-n", "input_net.net.xml",31"-r", "input_routes.rou.xml",32"-a", "input_additional.add.xml",33"--no-step-log", "-S", "-Q"] + sys.argv[1:]343536def run():37"""execute the TraCI control loop"""38traci.start(cmd)39step = 040while traci.simulation.getMinExpectedNumber() > 0 and step < 100:41traci.simulationStep()42step += 143if step == 4:44traci.trafficlight.setProgram("center", "0")45traci.close()46sys.stdout.flush()474849run()505152