Skip to content

Commit

Permalink
tests for the bluelight device, refs #1967
Browse files Browse the repository at this point in the history
  • Loading branch information
lbieker committed Feb 21, 2018
1 parent 9f4b10f commit 3214a66
Show file tree
Hide file tree
Showing 8 changed files with 347 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/microsim/devices/MSDevice_Bluelight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,15 @@ MSDevice_Bluelight::notifyMove(SUMOVehicle& veh, double /* oldPos */,
//Setting the lateral alignment to build a rescue lane
if (veh2->getLane()->getIndex() == numLanes-1) {
t.setPreferredLateralAlignment(LATALIGN_LEFT);
//std::cout << "New alignment to right for vehicle: " << veh2->getID() << " " << veh2->getVehicleType().getPreferredLateralAlignment() << "\n";
//std::cout << "New alignment to left for vehicle: " << veh2->getID() << " " << veh2->getVehicleType().getPreferredLateralAlignment() << "\n";
} else {
t.setPreferredLateralAlignment(LATALIGN_RIGHT);
//std::cout << "New alignment to left for vehicle: " << veh2->getID() << " " << veh2->getVehicleType().getPreferredLateralAlignment() << "\n";
//std::cout << "New alignment to right for vehicle: " << veh2->getID() << " " << veh2->getVehicleType().getPreferredLateralAlignment() << "\n";
}
//influencedVehicles->push_back(static_cast<MSVehicle*>(veh2));
//std::cout << "Vehcile in influencedVehicleList: " << veh2->getID() << "\n";
}
//todo if vehicle is passed all vehicles which had to react should get their state back after they leave the communication range
}
}
return true; // keep the device
Expand Down
Empty file.
14 changes: 14 additions & 0 deletions tests/sumo/extended/device_bluelight/input_routes.rou.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<routes>
<vType id="left" sigma="0" /> <!-- latAlignment="left"-->
<vType id="right" sigma="0" />
<vType id="rescue" latAlignment="arbitrary" sigma="0" guiShape="emergency" vClass="emergency" speedFactor="2" width="1.2"/>

<route id="r0" edges="SC CN"/>
<vehicle id="left1" type="left" route="r0" depart="35" departLane="1" departPos="0"/>
<vehicle id="right1" type="right" route="r0" depart="35" departLane="0" departPos="0"/>
<vehicle id="left2" type="left" route="r0" depart="37" departLane="1" departPos="0"/>
<vehicle id="right2" type="right" route="r0" depart="37" departLane="0" departPos="0"/>
<vehicle id="rescue" type="rescue" route="r0" depart="38" departLane="1" departPos="0"/>


</routes>
251 changes: 251 additions & 0 deletions tests/sumo/extended/device_bluelight/net2.net.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tests/sumo/extended/device_bluelight/options.sumo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--no-step-log --no-duration-log --net-file=net2.net.xml -r input_routes.rou.xml --device.bluelight.explicit rescue --tripinfo-output tripinfos.xml --lateral-resolution 0.64
29 changes: 29 additions & 0 deletions tests/sumo/extended/device_bluelight/output.sumo
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
vehicle 'rescue' does not supply vehicle parameter 'bluelight'. Using default of -1.00
vehicle 'rescue' does not supply vType parameter 'bluelight'. Using default of -1.00
initialized device 'bluelight_rescue' with myCustomValue1=0.00, myCustomValue2=-1.00, myCustomValue3=-1.00
device 'bluelight_rescue' notifyEnter: reason=0 currentEdge=SC
device 'bluelight_rescue' notifyMove: newSpeed=2.60
device 'bluelight_rescue' notifyMove: newSpeed=5.20
device 'bluelight_rescue' notifyMove: newSpeed=7.80
device 'bluelight_rescue' notifyMove: newSpeed=10.40
device 'bluelight_rescue' notifyMove: newSpeed=13.00
device 'bluelight_rescue' notifyMove: newSpeed=15.60
device 'bluelight_rescue' notifyMove: newSpeed=11.62
device 'bluelight_rescue' notifyMove: newSpeed=7.12
device 'bluelight_rescue' notifyMove: newSpeed=2.62
device 'bluelight_rescue' notifyMove: newSpeed=5.22
device 'bluelight_rescue' notifyLeave: reason=3 currentEdge=SC
device 'bluelight_rescue' notifyEnter: reason=3 currentEdge=SC
device 'bluelight_rescue' notifyMove: newSpeed=7.82
device 'bluelight_rescue' notifyLeave: reason=1 currentEdge=SC
device 'bluelight_rescue' notifyEnter: reason=1 currentEdge=SC
device 'bluelight_rescue' notifyMove: newSpeed=10.42
device 'bluelight_rescue' notifyLeave: reason=1 currentEdge=SC
device 'bluelight_rescue' notifyEnter: reason=1 currentEdge=CN
device 'bluelight_rescue' notifyMove: newSpeed=13.02
device 'bluelight_rescue' notifyMove: newSpeed=15.62
device 'bluelight_rescue' notifyMove: newSpeed=18.22
device 'bluelight_rescue' notifyMove: newSpeed=20.82
device 'bluelight_rescue' notifyMove: newSpeed=23.42
device 'bluelight_rescue' notifyMove: newSpeed=26.02
device 'bluelight_rescue' notifyLeave: reason=6 currentEdge=CN
46 changes: 46 additions & 0 deletions tests/sumo/extended/device_bluelight/tripinfos.sumo
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- generated on Wed Feb 21 15:25:26 2018 by SUMO Version v0_32_0+0492-340f03b090
This data file and the accompanying materials
are made available under the terms of the Eclipse Public License v2.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/sumoConfiguration.xsd">
<input>
<net-file value="net2.net.xml"/>
<route-files value="input_routes.rou.xml"/>
</input>
<output>
<write-license value="true"/>
<tripinfo-output value="tripinfos.xml"/>
</output>
<processing>
<lateral-resolution value="0.64"/>
</processing>
<report>
<xml-validation value="never"/>
<duration-log.disable value="true"/>
<no-step-log value="true"/>
</report>
<bluelight_device>
<device.bluelight.explicit value="rescue"/>
</bluelight_device>
</configuration>
-->

<tripinfos xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/tripinfo_file.xsd">
<tripinfo id="rescue" depart="40.00" departLane="SC_1" departPos="0.00" departPosLat="0.00" departSpeed="0.00" departDelay="2.00" arrival="58.00" arrivalLane="CN_0" arrivalPos="91.95" arrivalPosLat="1.56" arrivalSpeed="26.02" duration="18.00" routeLength="200.00" waitingTime="0.00" waitingCount="0" stopTime="0.00" timeLoss="10.21" rerouteNo="0" devices="tripinfo_rescue bluelight_rescue" vType="rescue" speedFactor="2.00" vaporized="">
<example_device customValue1="0.00" customValue2="-1.00"/>
</tripinfo>
<tripinfo id="left1" depart="35.00" departLane="SC_1" departPos="0.00" departPosLat="0.00" departSpeed="0.00" departDelay="0.00" arrival="100.00" arrivalLane="CN_1" arrivalPos="91.95" arrivalPosLat="0.70" arrivalSpeed="13.89" duration="65.00" routeLength="200.00" waitingTime="44.00" waitingCount="1" stopTime="0.00" timeLoss="49.64" rerouteNo="0" devices="tripinfo_left1" vType="left@left1" speedFactor="1.00" vaporized=""/>
<tripinfo id="right1" depart="35.00" departLane="SC_0" departPos="0.00" departPosLat="0.00" departSpeed="0.00" departDelay="0.00" arrival="100.00" arrivalLane="CN_0" arrivalPos="91.95" arrivalPosLat="-0.70" arrivalSpeed="13.89" duration="65.00" routeLength="200.00" waitingTime="44.00" waitingCount="1" stopTime="0.00" timeLoss="49.64" rerouteNo="0" devices="tripinfo_right1" vType="right@right1" speedFactor="1.00" vaporized=""/>
<tripinfo id="left2" depart="37.00" departLane="SC_1" departPos="0.00" departPosLat="0.00" departSpeed="0.00" departDelay="0.00" arrival="101.00" arrivalLane="CN_1" arrivalPos="91.95" arrivalPosLat="0.70" arrivalSpeed="13.89" duration="64.00" routeLength="200.00" waitingTime="43.00" waitingCount="1" stopTime="0.00" timeLoss="49.18" rerouteNo="0" devices="tripinfo_left2" vType="left@left2" speedFactor="1.00" vaporized=""/>
<tripinfo id="right2" depart="37.00" departLane="SC_0" departPos="0.00" departPosLat="0.00" departSpeed="0.00" departDelay="0.00" arrival="101.00" arrivalLane="CN_0" arrivalPos="91.95" arrivalPosLat="-0.70" arrivalSpeed="13.89" duration="64.00" routeLength="200.00" waitingTime="43.00" waitingCount="1" stopTime="0.00" timeLoss="49.18" rerouteNo="0" devices="tripinfo_right2" vType="right@right2" speedFactor="1.00" vaporized=""/>
</tripinfos>
3 changes: 3 additions & 0 deletions tests/sumo/extended/testsuite.sumo
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ shapes
# tests functions of the example device
device_example

# tests functions of the bluelight device
device_bluelight

# saving and loading simulation state
state

Expand Down

0 comments on commit 3214a66

Please sign in to comment.