Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/tests/complex/traci/vehicle/cfmodel/setParameter/runner.py
169781 views
1
#!/usr/bin/env python
2
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
# Copyright (C) 2009-2025 German Aerospace Center (DLR) and others.
4
# This program and the accompanying materials are made available under the
5
# terms of the Eclipse Public License 2.0 which is available at
6
# https://www.eclipse.org/legal/epl-2.0/
7
# This Source Code may also be made available under the following Secondary
8
# Licenses when the conditions for such availability set forth in the Eclipse
9
# Public License 2.0 are satisfied: GNU General Public License, version 2
10
# or later which is available at
11
# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
14
# @file runner.py
15
# @author Lena Kalleske
16
# @author Daniel Krajzewicz
17
# @author Michael Behrisch
18
# @author Jakob Erdmann
19
# @author Leonhard Luecken
20
# @date 2009-03-26
21
22
# @author Robert Alms
23
# @date 2023-02.23
24
25
from __future__ import absolute_import
26
from __future__ import print_function
27
28
import os
29
import sys
30
31
# we need to import python modules from the $SUMO_HOME/tools directory
32
try:
33
sys.path.append(os.path.join(os.environ.get("SUMO_HOME", os.path.join(
34
os.path.dirname(__file__), "..", "..", "..", "..")), "tools"))
35
except ImportError:
36
sys.exit("please declare environment variable 'SUMO_HOME'")
37
import traci
38
from sumolib import checkBinary
39
40
sumoBinary = checkBinary('sumo')
41
traci.start([sumoBinary,
42
"-n", "input_net.net.xml",
43
"--no-step-log"])
44
45
traci.vehicle.add("ego", "")
46
try:
47
traci.vehicle.setParameter("ego", "carFollowModel.foobar", "42")
48
except traci.TraCIException:
49
pass
50
traci.close()
51
52