Skip to content

Commit

Permalink
adding test refs #21, #14552
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed Mar 20, 2024
1 parent 0d3a636 commit 487fb82
Show file tree
Hide file tree
Showing 8 changed files with 186 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/complex/traci/edge/setMaxSpeed/errors.complex
@@ -0,0 +1,7 @@
Warning: Network contains internal links which are ignored. Vehicles will 'jump' across junctions and thus underestimate route lengths and travel times.
Warning: Teleporting vehicle 'v.17'; waited too long, from edge 'A0A1':0, time=476.63.
Warning: Vehicle 'v.17' ends teleporting on edge 'A2A3':0, time=483.26.
Warning: Teleporting vehicle 'v.18'; waited too long, from edge 'A0A1':0, time=778.30.
Warning: Vehicle 'v.18' ends teleporting on edge 'A2A3':0, time=784.93.
Warning: Teleporting vehicle 'v.19'; waited too long, from edge 'A0A1':0, time=1078.30.
Warning: Vehicle 'v.19' ends teleporting on edge 'A2A3':0, time=1084.93.
6 changes: 6 additions & 0 deletions tests/complex/traci/edge/setMaxSpeed/input_routes.rou.xml
@@ -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="DEFAULT_VEHTYPE" speedDev="0"/>
<flow id="v" begin="0" number="20" period="10">
<route edges="A0A1 A1A2 A2A3"/>
</flow>
</routes>
1 change: 1 addition & 0 deletions tests/complex/traci/edge/setMaxSpeed/options.complex
@@ -0,0 +1 @@
tests/complex/traci/edge/setMaxSpeed/runner.py
71 changes: 71 additions & 0 deletions tests/complex/traci/edge/setMaxSpeed/output.complex
@@ -0,0 +1,71 @@
step 0
step 1
step 2
edges ('1fi', '1o', '1si', '2fi', '2o', '2si', '3fi', '3o', '3si', '4fi', '4o', '4si', 'taz12-sink', 'taz12-source', 'taz34-sink', 'taz34-source')
edge count 16
examining 2fi
laneNumber 1
streetName exampleStreetName1
adaptedTraveltime -1.0
effort -1.0
CO2 4962.098029013955
CO 148.4043943117062
HC 0.793287746205698
PMx 0.10689025015863887
NOx 2.197042560996833
Fuel 1582.7018914848818
Noise 68.96613013111516
Elec 0.0
meanSpeed 4.033343723951839
occupancy 0.02012072434607646
lastLength 5.0
traveltime 61.61141152545303
numVeh 1
haltVeh 0
vehIds ('horiz',)
personIds ('p0',)
waiting time 0.0
angle (with default relative position) 270.0
angle (with some relative position) 270.0
checking occupancy with unicode id 0.02012072434607646
traveltime after adaption 61.61141152545303
adaptedTraveltime after adaption 42.0
adaptedTraveltime after adaption in interval (check time 0) 42.0
adaptedTraveltime after adaption in interval (check time 15) 24.0
adaptedTraveltime after adaption in interval (check time 25) 42.0
effort after adaption 1234.0
effort after adaption in interval (check time 0) 1234.0
effort after adaption in interval (check time 15) 2468.0
effort after adaption in interval (check time 25) 1234.0
max speed after adaption 23.0
{16: 1}
step 3
{16: 1}
step 4
{16: 1}
step 5
{16: 1}
{'2fi': {16: 1}}
3si count=1 meanSpeed=10.26 travelTime=23.114035087719298
pending ('veh3',)
3si count=1 meanSpeed=10.26 travelTime=23.114035087719298
pending ('veh3',)
3si count=1 meanSpeed=10.26 travelTime=23.114035087719298
pending ('veh3',)
3si count=2 meanSpeed=8.06975 travelTime=29.387527494655966
pending ()
3si count=2 meanSpeed=8.06975 travelTime=29.387527494655966
pending ()
3si count=2 meanSpeed=8.445 travelTime=28.08170515097691
pending ()
3si count=2 meanSpeed=8.445 travelTime=28.08170515097691
pending ()
3si count=2 meanSpeed=8.445 travelTime=28.08170515097691
pending ()
3si count=2 meanSpeed=8.445 travelTime=28.08170515097691
pending ()
3si count=2 meanSpeed=8.445 travelTime=28.08170515097691
pending ()
allow_0 ()
allow_1 ('bicycle',)
allow_2 ('pedestrian', 'bicycle')
1 change: 1 addition & 0 deletions tests/complex/traci/edge/setMaxSpeed/output.complex.meso
@@ -0,0 +1 @@
Retrying in 1 seconds
45 changes: 45 additions & 0 deletions tests/complex/traci/edge/setMaxSpeed/runner.py
@@ -0,0 +1,45 @@
#!/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 Michael Behrisch
# @author Daniel Krajzewicz
# @date 2011-03-04


from __future__ import print_function
from __future__ import absolute_import
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

traci.start([sumolib.checkBinary('sumo'),
"--no-step-log",
"-n", "input_net4.net.xml",
'-r', 'input_routes.rou.xml',
'--tripinfo-output', 'tripinfo.xml'
] + sys.argv[1:])

while traci.simulation.getMinExpectedNumber() > 0:
traci.simulationStep()
if traci.simulation.getTime() == 50:
traci.edge.setMaxSpeed("A1A2", 0)
elif traci.simulation.getTime() == 150:
traci.edge.setMaxSpeed("A1A2", 13.89)

traci.close()
52 changes: 52 additions & 0 deletions tests/complex/traci/edge/setMaxSpeed/tripinfo.complex
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- generated on 2024-03-20 07:54:29 by Eclipse SUMO sumo Version v1_19_0+1407-235325c8145
<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>
<tripinfo-output value="tripinfo.xml"/>
</output>
<report>
<no-step-log value="true"/>
</report>
<traci_server>
<remote-port value="58681"/>
</traci_server>
<mesoscopic>
<mesosim value="true"/>
<meso-junction-control value="true"/>
</mesoscopic>
</configuration>
-->

<tripinfos xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/tripinfo_file.xsd">
<tripinfo id="v.0" depart="0.00" departLane="" departPos="0.00" departSpeed="13.89" departDelay="0.00" arrival="20.00" arrivalLane="" arrivalPos="92.10" arrivalSpeed="13.89" duration="20.00" routeLength="274.80" waitingTime="0.00" waitingCount="0" stopTime="0.00" timeLoss="0.00" rerouteNo="0" devices="tripinfo_v.0" vType="DEFAULT_VEHTYPE" speedFactor="1.00" vaporized=""/>
<tripinfo id="v.1" depart="10.00" departLane="" departPos="0.00" departSpeed="13.89" departDelay="0.00" arrival="30.00" arrivalLane="" arrivalPos="92.10" arrivalSpeed="13.89" duration="20.00" routeLength="274.80" waitingTime="0.00" waitingCount="0" stopTime="0.00" timeLoss="0.00" rerouteNo="0" devices="tripinfo_v.1" vType="DEFAULT_VEHTYPE" speedFactor="1.00" vaporized=""/>
<tripinfo id="v.2" depart="20.00" departLane="" departPos="0.00" departSpeed="13.89" departDelay="0.00" arrival="40.00" arrivalLane="" arrivalPos="92.10" arrivalSpeed="13.89" duration="20.00" routeLength="274.80" waitingTime="0.00" waitingCount="0" stopTime="0.00" timeLoss="0.00" rerouteNo="0" devices="tripinfo_v.2" vType="DEFAULT_VEHTYPE" speedFactor="1.00" vaporized=""/>
<tripinfo id="v.3" depart="30.00" departLane="" departPos="0.00" departSpeed="13.89" departDelay="0.00" arrival="50.00" arrivalLane="" arrivalPos="92.10" arrivalSpeed="13.89" duration="20.00" routeLength="274.80" waitingTime="0.00" waitingCount="0" stopTime="0.00" timeLoss="0.00" rerouteNo="0" devices="tripinfo_v.3" vType="DEFAULT_VEHTYPE" speedFactor="1.00" vaporized=""/>
<tripinfo id="v.4" depart="40.00" departLane="" departPos="0.00" departSpeed="13.89" departDelay="0.00" arrival="60.00" arrivalLane="" arrivalPos="92.10" arrivalSpeed="13.89" duration="20.00" routeLength="274.80" waitingTime="0.00" waitingCount="0" stopTime="0.00" timeLoss="0.00" rerouteNo="0" devices="tripinfo_v.4" vType="DEFAULT_VEHTYPE" speedFactor="1.00" vaporized=""/>
<tripinfo id="v.17" depart="170.00" departLane="" departPos="0.00" departSpeed="13.89" departDelay="0.00" arrival="490.00" arrivalLane="" arrivalPos="92.10" arrivalSpeed="13.89" duration="320.00" routeLength="274.80" waitingTime="300.00" waitingCount="0" stopTime="0.00" timeLoss="300.00" rerouteNo="0" devices="tripinfo_v.17" vType="DEFAULT_VEHTYPE" speedFactor="1.00" vaporized=""/>
<tripinfo id="v.18" depart="180.00" departLane="" departPos="0.00" departSpeed="0.31" departDelay="0.00" arrival="792.00" arrivalLane="" arrivalPos="92.10" arrivalSpeed="13.89" duration="612.00" routeLength="274.80" waitingTime="300.00" waitingCount="0" stopTime="0.00" timeLoss="591.67" rerouteNo="0" devices="tripinfo_v.18" vType="DEFAULT_VEHTYPE" speedFactor="1.00" vaporized=""/>
<tripinfo id="v.19" depart="190.00" departLane="" departPos="0.00" departSpeed="0.32" departDelay="0.00" arrival="1092.00" arrivalLane="" arrivalPos="92.10" arrivalSpeed="13.89" duration="902.00" routeLength="274.80" waitingTime="300.00" waitingCount="0" stopTime="0.00" timeLoss="881.67" rerouteNo="0" devices="tripinfo_v.19" vType="DEFAULT_VEHTYPE" speedFactor="1.00" vaporized=""/>
<tripinfo id="v.5" depart="50.00" departLane="" departPos="0.00" departSpeed="13.89" departDelay="0.00" arrival="1876.00" arrivalLane="" arrivalPos="92.10" arrivalSpeed="13.89" duration="1826.00" routeLength="274.80" waitingTime="0.00" waitingCount="0" stopTime="0.00" timeLoss="1805.48" rerouteNo="0" devices="tripinfo_v.5" vType="DEFAULT_VEHTYPE" speedFactor="1.00" vaporized=""/>
<tripinfo id="v.6" depart="60.00" departLane="" departPos="0.00" departSpeed="13.89" departDelay="0.00" arrival="1886.00" arrivalLane="" arrivalPos="92.10" arrivalSpeed="13.89" duration="1826.00" routeLength="274.80" waitingTime="0.00" waitingCount="0" stopTime="0.00" timeLoss="1805.48" rerouteNo="0" devices="tripinfo_v.6" vType="DEFAULT_VEHTYPE" speedFactor="1.00" vaporized=""/>
<tripinfo id="v.7" depart="70.00" departLane="" departPos="0.00" departSpeed="13.89" departDelay="0.00" arrival="1896.00" arrivalLane="" arrivalPos="92.10" arrivalSpeed="13.89" duration="1826.00" routeLength="274.80" waitingTime="0.00" waitingCount="0" stopTime="0.00" timeLoss="1805.48" rerouteNo="0" devices="tripinfo_v.7" vType="DEFAULT_VEHTYPE" speedFactor="1.00" vaporized=""/>
<tripinfo id="v.8" depart="80.00" departLane="" departPos="0.00" departSpeed="13.89" departDelay="0.00" arrival="1906.00" arrivalLane="" arrivalPos="92.10" arrivalSpeed="13.89" duration="1826.00" routeLength="274.80" waitingTime="0.00" waitingCount="0" stopTime="0.00" timeLoss="1805.48" rerouteNo="0" devices="tripinfo_v.8" vType="DEFAULT_VEHTYPE" speedFactor="1.00" vaporized=""/>
<tripinfo id="v.9" depart="90.00" departLane="" departPos="0.00" departSpeed="13.89" departDelay="0.00" arrival="1916.00" arrivalLane="" arrivalPos="92.10" arrivalSpeed="13.89" duration="1826.00" routeLength="274.80" waitingTime="0.00" waitingCount="0" stopTime="0.00" timeLoss="1805.48" rerouteNo="0" devices="tripinfo_v.9" vType="DEFAULT_VEHTYPE" speedFactor="1.00" vaporized=""/>
<tripinfo id="v.10" depart="100.00" departLane="" departPos="0.00" departSpeed="13.89" departDelay="0.00" arrival="1926.00" arrivalLane="" arrivalPos="92.10" arrivalSpeed="13.89" duration="1826.00" routeLength="274.80" waitingTime="0.00" waitingCount="0" stopTime="0.00" timeLoss="1805.48" rerouteNo="0" devices="tripinfo_v.10" vType="DEFAULT_VEHTYPE" speedFactor="1.00" vaporized=""/>
<tripinfo id="v.11" depart="110.00" departLane="" departPos="0.00" departSpeed="13.89" departDelay="0.00" arrival="1936.00" arrivalLane="" arrivalPos="92.10" arrivalSpeed="13.89" duration="1826.00" routeLength="274.80" waitingTime="0.00" waitingCount="0" stopTime="0.00" timeLoss="1805.48" rerouteNo="0" devices="tripinfo_v.11" vType="DEFAULT_VEHTYPE" speedFactor="1.00" vaporized=""/>
<tripinfo id="v.12" depart="120.00" departLane="" departPos="0.00" departSpeed="13.89" departDelay="0.00" arrival="1946.00" arrivalLane="" arrivalPos="92.10" arrivalSpeed="13.89" duration="1826.00" routeLength="274.80" waitingTime="0.00" waitingCount="0" stopTime="0.00" timeLoss="1805.48" rerouteNo="0" devices="tripinfo_v.12" vType="DEFAULT_VEHTYPE" speedFactor="1.00" vaporized=""/>
<tripinfo id="v.13" depart="130.00" departLane="" departPos="0.00" departSpeed="13.89" departDelay="0.00" arrival="1956.00" arrivalLane="" arrivalPos="92.10" arrivalSpeed="13.89" duration="1826.00" routeLength="274.80" waitingTime="0.00" waitingCount="0" stopTime="0.00" timeLoss="1805.48" rerouteNo="0" devices="tripinfo_v.13" vType="DEFAULT_VEHTYPE" speedFactor="1.00" vaporized=""/>
<tripinfo id="v.14" depart="140.00" departLane="" departPos="0.00" departSpeed="13.89" departDelay="0.00" arrival="1966.00" arrivalLane="" arrivalPos="92.10" arrivalSpeed="13.89" duration="1826.00" routeLength="274.80" waitingTime="0.00" waitingCount="0" stopTime="0.00" timeLoss="1805.48" rerouteNo="0" devices="tripinfo_v.14" vType="DEFAULT_VEHTYPE" speedFactor="1.00" vaporized=""/>
<tripinfo id="v.15" depart="150.00" departLane="" departPos="0.00" departSpeed="13.89" departDelay="0.00" arrival="1967.00" arrivalLane="" arrivalPos="92.10" arrivalSpeed="13.89" duration="1817.00" routeLength="274.80" waitingTime="0.00" waitingCount="0" stopTime="0.00" timeLoss="1797.15" rerouteNo="0" devices="tripinfo_v.15" vType="DEFAULT_VEHTYPE" speedFactor="1.00" vaporized=""/>
<tripinfo id="v.16" depart="160.00" departLane="" departPos="0.00" departSpeed="13.89" departDelay="0.00" arrival="1969.00" arrivalLane="" arrivalPos="92.10" arrivalSpeed="13.89" duration="1809.00" routeLength="274.80" waitingTime="0.00" waitingCount="0" stopTime="0.00" timeLoss="1788.82" rerouteNo="0" devices="tripinfo_v.16" vType="DEFAULT_VEHTYPE" speedFactor="1.00" vaporized=""/>
</tripinfos>
3 changes: 3 additions & 0 deletions tests/complex/traci/edge/testsuite.complex
@@ -1,2 +1,5 @@
# Tests the edge API
edge

# see #14552
setMaxSpeed

0 comments on commit 487fb82

Please sign in to comment.