Path: blob/main/tests/complex/traci/connection/closingOutput/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 Daniel Krajzewicz15# @author Michael Behrisch16# @date 2011-07-011718from __future__ import absolute_import19from __future__ import print_function2021import os22import sys23import time2425if "SUMO_HOME" in os.environ:26sys.path.append(os.path.join(os.environ["SUMO_HOME"], "tools"))27import sumolib # noqa28import traci # noqa2930sumoBinary = sumolib.checkBinary(sys.argv[1])31if sys.argv[1] == "sumo":32addOption = []33else:34addOption = ["-S", "-Q"]3536traci.start([sumoBinary, "-c", "sumo.sumocfg"] + addOption, stdout=sys.stdout)37time.sleep(10)38step = 039while step <= 100:40traci.simulationStep()41vehs = traci.vehicle.getIDList()42if vehs.index("horiz") < 0 or len(vehs) > 1:43print("Something is false")44step += 145traci.simulationStep()46traci.close()47sys.stdout.flush()484950