Skip to content

Commit

Permalink
now applying tls penalty to crossings. refs #14653
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed Apr 3, 2024
1 parent e37f38f commit d0ff75d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/router/RONetHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ RONetHandler::parseConnection(const SUMOSAXAttributes& attrs) {
const int toLane = attrs.get<int>(SUMO_ATTR_TO_LANE, nullptr, ok);
std::string dir = attrs.get<std::string>(SUMO_ATTR_DIR, nullptr, ok);
std::string viaID = attrs.getOpt<std::string>(SUMO_ATTR_VIA, nullptr, ok, "");
std::string tlID = attrs.getOpt<std::string>(SUMO_ATTR_TLID, nullptr, ok, "");
ROEdge* from = myNet.getEdge(fromID);
ROEdge* to = myNet.getEdge(toID);
if (from == nullptr) {
Expand All @@ -311,6 +312,9 @@ RONetHandler::parseConnection(const SUMOSAXAttributes& attrs) {
if (myIgnoreInternal || viaID == "") {
from->getLanes()[fromLane]->addOutgoingLane(to->getLanes()[toLane]);
from->addSuccessor(to, nullptr, dir);
if (to->isCrossing()) {
to->setTimePenalty(myTLSPenalty);
}
} else {
ROEdge* const via = myNet.getEdge(SUMOXMLDefinitions::getEdgeIDFromLane(viaID));
if (via == nullptr) {
Expand All @@ -323,6 +327,12 @@ RONetHandler::parseConnection(const SUMOSAXAttributes& attrs) {
if (state == LINKSTATE_MINOR || state == LINKSTATE_EQUAL || state == LINKSTATE_STOP || state == LINKSTATE_ALLWAY_STOP) {
via->setTimePenalty(myMinorPenalty);
}
if (tlID != "") {
via->setTimePenalty(myTLSPenalty);
if (to->isCrossing()) {
to->setTimePenalty(myTLSPenalty);
}
}
}
}

Expand Down

0 comments on commit d0ff75d

Please sign in to comment.