Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/tests/complex/netconvert/left_turn_noblocking_double_intersection/runner.py
169686 views
1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
4
# Copyright (C) 2008-2025 German Aerospace Center (DLR) and others.
5
# This program and the accompanying materials are made available under the
6
# terms of the Eclipse Public License 2.0 which is available at
7
# https://www.eclipse.org/legal/epl-2.0/
8
# This Source Code may also be made available under the following Secondary
9
# Licenses when the conditions for such availability set forth in the Eclipse
10
# Public License 2.0 are satisfied: GNU General Public License, version 2
11
# or later which is available at
12
# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
13
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
14
15
# @file runner.py
16
# @author Jakob Erdmann
17
# @author Michael Behrisch
18
# @date 2011-05-23
19
20
from __future__ import absolute_import
21
from __future__ import print_function
22
23
import sys
24
import os
25
import subprocess
26
sys.path.append(
27
os.path.join(os.path.dirname(sys.argv[0]), '..', '..', '..', '..', "tools"))
28
from sumolib import checkBinary # noqa
29
30
net_output = 'joined.net.xml'
31
trips_output = 'trips.log'
32
33
args_netc = [checkBinary('netconvert'),
34
'--node-files', 'input_nodes.nod.xml',
35
'--edge-files', 'input_edges.edg.xml',
36
'--output', net_output,
37
'--offset.disable-normalization']
38
39
args_sumo = [checkBinary('sumo'),
40
'--net-file', net_output,
41
'--route-files', 'input_routes.rou.xml',
42
'--end', '50',
43
'--no-step-log',
44
'--no-duration-log',
45
'--tripinfo-output', trips_output]
46
47
subprocess.call(args_netc)
48
subprocess.call(args_sumo)
49
50
# vehicles should have completed their trips
51
complete = False
52
with open(trips_output) as to:
53
for line in to:
54
if 'veh0' in line:
55
complete = True
56
57
if complete:
58
print('test passed. no blocking occured')
59
else:
60
print('test failed. vehicles were blocked')
61
62