Path: blob/main/tests/complex/traci/vehicle/cfmodel/setParameter/runner.py
169781 views
#!/usr/bin/env python1# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2# Copyright (C) 2009-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 Lena Kalleske15# @author Daniel Krajzewicz16# @author Michael Behrisch17# @author Jakob Erdmann18# @author Leonhard Luecken19# @date 2009-03-262021# @author Robert Alms22# @date 2023-02.232324from __future__ import absolute_import25from __future__ import print_function2627import os28import sys2930# we need to import python modules from the $SUMO_HOME/tools directory31try:32sys.path.append(os.path.join(os.environ.get("SUMO_HOME", os.path.join(33os.path.dirname(__file__), "..", "..", "..", "..")), "tools"))34except ImportError:35sys.exit("please declare environment variable 'SUMO_HOME'")36import traci37from sumolib import checkBinary3839sumoBinary = checkBinary('sumo')40traci.start([sumoBinary,41"-n", "input_net.net.xml",42"--no-step-log"])4344traci.vehicle.add("ego", "")45try:46traci.vehicle.setParameter("ego", "carFollowModel.foobar", "42")47except traci.TraCIException:48pass49traci.close()505152