Skip to content

Commit

Permalink
Making openGap params accessbile via setParameters in ToC device (#14583
Browse files Browse the repository at this point in the history
)

* Add og-parameters to setParameter-function #14582

* adding tests for og-params in ToC device #21 #14582

* fix for new test #21 #14582
  • Loading branch information
robertalms committed Mar 22, 2024
1 parent d9b7d4b commit 7041ee3
Show file tree
Hide file tree
Showing 22 changed files with 10,589 additions and 3 deletions.
16 changes: 16 additions & 0 deletions src/microsim/devices/MSDevice_ToC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,22 @@ MSDevice_ToC::setParameter(const std::string& key, const std::string& value) {
} else {
myMaxPreparationAccel = newValue;
}
} else if (key == "ogNewTimeHeadway") {
const double newValue = StringUtils::toDouble(value);
myOpenGapParams.newTimeHeadway = newValue;
myOpenGapParams.active = true;
} else if (key == "ogNewSpaceHeadway") {
const double newValue = StringUtils::toDouble(value);
myOpenGapParams.newSpaceHeadway = newValue;
myOpenGapParams.active = true;
} else if (key == "ogChangeRate") {
const double newValue = StringUtils::toDouble(value);
myOpenGapParams.changeRate = newValue;
myOpenGapParams.active = true;
} else if (key == "ogMaxDecel") {
const double newValue = StringUtils::toDouble(value);
myOpenGapParams.maxDecel = newValue;
myOpenGapParams.active = true;
} else {
throw InvalidArgument("Parameter '" + key + "' is not supported for device of type '" + deviceName() + "'");
}
Expand Down
Empty file.
2,537 changes: 2,537 additions & 0 deletions tests/complex/sumo/ToCDevice/CF_situation4/fcd.complex

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions tests/complex/sumo/ToCDevice/CF_situation4/input_routes.rou.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/routes_file.xsd">
<vType id="automated" sigma="0." speedFactor="1"/>
<vType id="manual" sigma="0.5" speedFactor="normc(0.8,0.1,0.5,1.5)" guiShape="passenger/van" />
<vehicle id="leader" type="automated" depart="0" departPos="last" departLane="0">
<route edges="1/1to2/1 2/1to3/1 3/1to4/1 4/1to5/1 5/1to6/1"/>
</vehicle>
<vehicle id="ToC_veh" type="automated" depart="0" departPos="last" departLane="0">
<route edges="1/1to2/1 2/1to3/1 3/1to4/1 4/1to5/1 5/1to6/1"/>
<param key="has.toc.device" value="true"/>
<param key="device.toc.manualType" value="manual"/>
<param key="device.toc.automatedType" value="automated"/>
<param key="device.toc.responseTime" value="50.0"/>
<param key="device.toc.recoveryRate" value="0.1"/>
<param key="device.toc.initialAwareness" value="0.25"/>
<param key="device.toc.mrmDecel" value="3.0"/>
<param key="device.toc.ogNewSpaceHeadway" value="10"/>
<param key="device.toc.ogNewTimeHeadway" value="5"/>
<param key="device.toc.ogChangeRate" value="1.0"/>
<param key="device.toc.ogMaxDecel" value="1.0"/>
<param key="device.toc.file" value="tocs.xml"/>
</vehicle>
<vehicle id="follower" type="automated" depart="0" departPos="last" departLane="0">
<route edges="1/1to2/1 2/1to3/1 3/1to4/1 4/1to5/1 5/1to6/1"/>
</vehicle>
</routes>
1 change: 1 addition & 0 deletions tests/complex/sumo/ToCDevice/CF_situation4/options.complex
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tests/complex/sumo/ToCDevice/CF_situation4/runner.py

0 comments on commit 7041ee3

Please sign in to comment.