Skip to content

Commit

Permalink
added test refs #9891, #21
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed May 17, 2024
1 parent cc39136 commit a1d96d8
Show file tree
Hide file tree
Showing 8 changed files with 143 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/complex/traci/vehicle/keepAfterArrival/errors.complex
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Error: Answered with error to command 0xa4: Vehicle 'v' is not known.
Error: Answered with error to command 0xa4: Vehicle 'v' is not known.
Error: Answered with error to command 0xa4: Vehicle 'v' is not known.
Error: Answered with error to command 0xa4: Vehicle 'v' is not known.
Error: Answered with error to command 0xa4: Vehicle 'v' is not known.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/routes_file.xsd">
<vType id="car" sigma="0"/>
<trip id="v" type="car" depart="0" departSpeed="avg" from="A1B1" to="C1D1">
<stop edge="B2C2" duration="5"/>
</trip>
</routes>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tests/complex/traci/vehicle/keepAfterArrival/runner.py
6 changes: 6 additions & 0 deletions tests/complex/traci/vehicle/keepAfterArrival/output.complex
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Retrying in 1 seconds
0 steps after arrival: active=() loaded=()
1 steps after arrival: active=() loaded=()
2 steps after arrival: active=() loaded=()
3 steps after arrival: active=() loaded=()
4 steps after arrival: active=() loaded=()
60 changes: 60 additions & 0 deletions tests/complex/traci/vehicle/keepAfterArrival/runner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
# Copyright (C) 2008-2024 German Aerospace Center (DLR) and others.
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.eclipse.org/legal/epl-2.0/
# This Source Code may also be made available under the following Secondary
# Licenses when the conditions for such availability set forth in the Eclipse
# Public License 2.0 are satisfied: GNU General Public License, version 2
# or later which is available at
# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later

# @file runner.py
# @author Mirko Barthauer (Technische Universitaet Braunschweig)
# @date 2018-09-27

from __future__ import print_function
import os
import sys

if "SUMO_HOME" in os.environ:
sys.path.append(os.path.join(os.environ["SUMO_HOME"], "tools"))

import traci # noqa
import sumolib # noqa
import traci.constants as tc # noqa

sumoBinary = sumolib.checkBinary('sumo')
traci.start([sumoBinary,
"-n", "input_net4.net.xml",
"-r", "input_routes.rou.xml",
"--no-step-log",
"--stop-output", "stopinfos.xml",
"--vehroute-output", "vehroutes.xml",
"--keep-after-arrival", "3"
"--no-step-log",
] + sys.argv[1:])


vehID = "v"
while traci.simulation.getMinExpectedNumber() > 0:
traci.simulationStep()
for i in range(5):
traci.simulationStep()
try:
print("%s steps after arrival: active=%s loaded=%s" % (
i,
traci.vehicle.getIDList(),
traci.vehicle.getLoadedIDList()))
print(" vehData: speed=%s pos=%s lane=%s edge=%s" % (
traci.vehicle.getSpeed(vehID),
traci.vehicle.getPosition(vehID),
traci.vehicle.getLane(vehID),
traci.vehicle.getRoadID(vehID)))
except traci.TraCIException:
pass

traci.close()
29 changes: 29 additions & 0 deletions tests/complex/traci/vehicle/keepAfterArrival/stopinfos.complex
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- generated on 2024-04-29 09:40:22 by Eclipse SUMO sumo Version v1_19_0+1963-1b04aafd9e3
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/sumoConfiguration.xsd">
<input>
<net-file value="input_net4.net.xml"/>
<route-files value="input_routes.rou.xml"/>
</input>
<output>
<vehroute-output value="vehroutes.xml"/>
<stop-output value="stopinfos.xml"/>
</output>
<report>
<no-step-log value="true"/>
</report>
<traci_server>
<remote-port value="46181"/>
</traci_server>
</configuration>
-->

<stops xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/stopinfo_file.xsd">
<stopinfo id="v" type="car" lane="B2C2_0" pos="90.60" parking="0" started="23.00" ended="28.00" initialPersons="0" loadedPersons="0" unloadedPersons="0" initialContainers="0" loadedContainers="0" unloadedContainers="0"/>
</stops>
33 changes: 33 additions & 0 deletions tests/complex/traci/vehicle/keepAfterArrival/vehroutes.complex
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- generated on 2024-05-17 08:58:30 by Eclipse SUMO sumo Version v1_20_0+0092-c7bc6f6422a
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/sumoConfiguration.xsd">
<input>
<net-file value="input_net4.net.xml"/>
<route-files value="input_routes.rou.xml"/>
</input>
<output>
<vehroute-output value="vehroutes.xml"/>
<stop-output value="stopinfos.xml"/>
</output>
<processing>
<keep-after-arrival value="3&#45;&#45;no-step-log"/>
</processing>
<traci_server>
<remote-port value="57783"/>
</traci_server>
</configuration>
-->

<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/routes_file.xsd">
<vehicle id="v" type="car" depart="0.00" departSpeed="13.89" speedFactor="1.0600" arrival="46.00">
<route edges="A1B1 B1B2 B2C2 C2C1 C1D1"/>
<stop edge="B2C2" duration="5.00"/>
</vehicle>

</routes>
3 changes: 3 additions & 0 deletions tests/complex/traci/vehicle/testsuite.complex
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,6 @@ alightingPersons

# check handling of stops (#14789)
changeTarget

# retrieve vehicle information after arrival
keepAfterArrival

0 comments on commit a1d96d8

Please sign in to comment.