Path: blob/main/tests/complex/emissionsMap/energy_custom/runner.py
169685 views
#!/usr/bin/env python1# -*- coding: utf-8 -*-2# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo3# Copyright (C) 2013-2025 German Aerospace Center (DLR) and others.4# This program and the accompanying materials are made available under the5# terms of the Eclipse Public License 2.0 which is available at6# https://www.eclipse.org/legal/epl-2.0/7# This Source Code may also be made available under the following Secondary8# Licenses when the conditions for such availability set forth in the Eclipse9# Public License 2.0 are satisfied: GNU General Public License, version 210# or later which is available at11# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html12# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later1314# @file runner.py15# @author Daniel Krajzewicz16# @author Michael Behrisch17# @date 2013-01-141819from __future__ import absolute_import20from __future__ import print_function2122import sys23import os24import subprocess25sys.path.append(os.path.join(os.environ["SUMO_HOME"], "tools"))26from sumolib import checkBinary # noqa2728EDC = checkBinary("emissionsMap", os.path.join(29os.path.dirname(sys.argv[0]), '..', '..', '..', "bin"))3031fdo = open("results.csv", "w")32ec = sys.argv[1].strip()33print("Running '%s'" % ec)34sys.stdout.flush()35sys.stderr.flush()36call = [EDC, "-e", ec, "-o", "tmp.csv",37"--v-max", "30",38"--v-step", "5",39"--a-step", "1",40"--s-min", "0",41"--s-max", "0",42]43call += sys.argv[2:]44retCode = subprocess.call(call)45sys.stdout.flush()46sys.stderr.flush()47if retCode != 0:48print("Error on building PHEMlight measurements")49sys.exit(1)50fdo.write("%s\n" % ec)51with open("tmp.csv") as fd:52fdo.write(fd.read())53fdo.write("-----\n\n")54fdo.close()555657