From 11bf5463e5661925e7fc0bf0042ba74df5bcfc5e Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 5 Jun 2024 11:28:29 +0200 Subject: [PATCH 001/334] refreshing prior commit to old branch #7578 (4b4d7c33354c5a9406290c66ed3177d3020dedc0) --- src/microsim/MSMoveReminder.h | 19 +++++ src/microsim/MSVehicle.cpp | 30 +++++++ src/microsim/MSVehicle.h | 4 + src/microsim/traffic_lights/CMakeLists.txt | 2 + src/microsim/traffic_lights/MSDriveWay.cpp | 98 ++++++++++++++++++++++ src/microsim/traffic_lights/MSDriveWay.h | 56 +++++++++++++ 6 files changed, 209 insertions(+) create mode 100644 src/microsim/traffic_lights/MSDriveWay.cpp create mode 100644 src/microsim/traffic_lights/MSDriveWay.h diff --git a/src/microsim/MSMoveReminder.h b/src/microsim/MSMoveReminder.h index 14ad993cf470..d69c05468199 100644 --- a/src/microsim/MSMoveReminder.h +++ b/src/microsim/MSMoveReminder.h @@ -212,6 +212,25 @@ class MSMoveReminder { return true; } + /** @brief Called if the vehicle's back leaves the reminder's lane + * + * Informs if vehicle back leaves reminder lane (due to lane change, removal + * from the network, or leaving to the next lane). + * The default is to do nothing. + * + * @param[in] veh The leaving vehicle. + * @param[in] reason how the vehicle leaves the lane + * @param[in] leftLane The lane that the vehicle's back left + * @see Notification + * + * @return True if the reminder wants to receive further info. + */ + virtual bool notifyLeaveBack(SUMOTrafficObject& veh, Notification reason, const MSLane* leftLane) { + UNUSED_PARAMETER(&veh); + UNUSED_PARAMETER(reason); + UNUSED_PARAMETER(leftLane); + return true; + } // TODO: Documentation void updateDetector(SUMOTrafficObject& veh, double entryPos, double leavePos, diff --git a/src/microsim/MSVehicle.cpp b/src/microsim/MSVehicle.cpp index 6a12261f30d1..bd3532b71c39 100644 --- a/src/microsim/MSVehicle.cpp +++ b/src/microsim/MSVehicle.cpp @@ -4622,6 +4622,14 @@ MSVehicle::executeMove() { } #endif myState.myBackPos = updateFurtherLanes(myFurtherLanes, myFurtherLanesPosLat, passedLanes); + if (passedLanes.size() > 1 && isRailway(getVClass())) { + for (auto pi = passedLanes.rbegin(); pi != passedLanes.rend(); ++pi) { + MSLane* pLane = *pi; + if (pLane != myLane && std::find(myFurtherLanes.begin(), myFurtherLanes.end(), pLane) == myFurtherLanes.end()) { + leaveLaneBack(MSMoveReminder::NOTIFICATION_JUNCTION, *pi); + } + } + } // bestLanes need to be updated before lane changing starts. NOTE: This call is also a presumption for updateDriveItems() updateBestLanes(); if (myLane != oldLane || oldBackLane != getBackLane()) { @@ -5745,6 +5753,28 @@ MSVehicle::leaveLane(const MSMoveReminder::Notification reason, const MSLane* ap } +void +MSVehicle::leaveLaneBack(const MSMoveReminder::Notification reason, const MSLane* leftLane) { + for (MoveReminderCont::iterator rem = myMoveReminders.begin(); rem != myMoveReminders.end();) { + if (rem->first->notifyLeaveBack(*this, reason, leftLane)) { +#ifdef _DEBUG + if (myTraceMoveReminders) { + traceMoveReminder("notifyLeaveBack", rem->first, rem->second, true); + } +#endif + ++rem; + } else { +#ifdef _DEBUG + if (myTraceMoveReminders) { + traceMoveReminder("notifyLeaveBack", rem->first, rem->second, false); + } +#endif + rem = myMoveReminders.erase(rem); + } + } +} + + MSAbstractLaneChangeModel& MSVehicle::getLaneChangeModel() { return *myLaneChangeModel; diff --git a/src/microsim/MSVehicle.h b/src/microsim/MSVehicle.h index bb45b33b09aa..af797ce21240 100644 --- a/src/microsim/MSVehicle.h +++ b/src/microsim/MSVehicle.h @@ -821,6 +821,10 @@ class MSVehicle : public MSBaseVehicle { /** @brief Update of members if vehicle leaves a new lane in the lane change step or at arrival. */ void leaveLane(const MSMoveReminder::Notification reason, const MSLane* approachedLane = 0); + /** @brief Update of reminders if vehicle back leaves a lane during (during + * forward movement */ + void leaveLaneBack(const MSMoveReminder::Notification reason, const MSLane* leftLane); + /** @brief Check whether the drive items (myLFLinkLanes) are up to date, * and update them if required. * @note This is the case if a lane change was completed. diff --git a/src/microsim/traffic_lights/CMakeLists.txt b/src/microsim/traffic_lights/CMakeLists.txt index 06f65f745f4b..6f619acaab68 100644 --- a/src/microsim/traffic_lights/CMakeLists.txt +++ b/src/microsim/traffic_lights/CMakeLists.txt @@ -11,6 +11,8 @@ set(microsim_traffic_lights_STAT_SRCS MSRailSignalConstraint.h MSRailSignalControl.cpp MSRailSignalControl.h + MSDriveWay.cpp + MSDriveWay.h MSPhaseDefinition.h MSPushButton.cpp MSPushButton.h diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp new file mode 100644 index 000000000000..452f4974381c --- /dev/null +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -0,0 +1,98 @@ +/****************************************************************************/ +// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo +// Copyright (C) 2001-2021 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 MSDriveWay.h +/// @author Jakob Erdmann +/// @date December 2021 +/// +// A sequende of rail tracks (lanes) that may be used as a "set route" (Fahrstraße) +/****************************************************************************/ +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include "MSRailSignal.h" +#include "MSDriveWay.h" +#include "MSRailSignalControl.h" + +//#define DEBUG_PASSED +//#define DEBUG_LANE + +// =========================================================================== +// static value definitions +// =========================================================================== + +// =========================================================================== +// MSDriveWay method definitions +// =========================================================================== + + +MSDriveWay::MSDriveWay(const std::vector lanes) : + MSMoveReminder(lanes.front()->getEdge().getFromJunction()->getID() + "_" + lanes.back()->getEdge().getToJunction()->getID()), + myLanes(lanes) +{ + for (MSLane* lane : myLanes) { + lane->addMoveReminder(this); + } +} + +bool +MSDriveWay::notifyEnter(SUMOTrafficObject& veh, Notification /*reason*/, const MSLane* /*enteredLane*/) { + if (veh.isVehicle()) { + myTrains.insert(&dynamic_cast(veh)); + return true; + } else { + return false; + } +} + + +bool +MSDriveWay::notifyLeave(SUMOTrafficObject& veh, double /*lastPos*/, Notification reason, const MSLane* /*enteredLane*/) { + if (veh.isVehicle()) { + if (reason != MSMoveReminder::NOTIFICATION_JUNCTION) { + myTrains.erase(&dynamic_cast(veh)); + return false; + } else { + return true; + } + } else { + return false; + } +} + + +bool +MSDriveWay::notifyLeaveBack(SUMOTrafficObject& veh, Notification /*reason*/, const MSLane* leftLane) { + if (veh.isVehicle()) { + // leaving network with departure, teleport etc + if (leftLane == myLanes.back()) { + myTrains.erase(&dynamic_cast(veh)); + return false; + } else { + return true; + } + } else { + return false; + } +} + + +/****************************************************************************/ diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h new file mode 100644 index 000000000000..fcae22ad749a --- /dev/null +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -0,0 +1,56 @@ +/****************************************************************************/ +// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo +// Copyright (C) 2002-2021 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 MSDriveWay.h +/// @author Jakob Erdmann +/// @date December 2021 +/// +// A sequende of rail tracks (lanes) that may be used as a "set route" (Fahrstraße) +/****************************************************************************/ +#pragma once +#include + +#include + +// =========================================================================== +// class declarations +// =========================================================================== +class MSRailSignal; + + +// =========================================================================== +// class definitions +// =========================================================================== +/** + * @class MSDriveWay + */ +class MSDriveWay : public MSMoveReminder { +public: + /** @brief Constructor + */ + MSDriveWay(const std::vector lanes); + + /// @brief Destructor + virtual ~MSDriveWay() {}; + + bool notifyEnter(SUMOTrafficObject& veh, Notification reason, const MSLane* enteredLane); + bool notifyLeave(SUMOTrafficObject& veh, double lastPos, Notification reason, const MSLane* enteredLane = 0); + bool notifyLeaveBack(SUMOTrafficObject& veh, Notification reason, const MSLane* leftLane); + +private: + + std::vector myLanes; + std::set myTrains; +}; + + From af31d0316668c4a182859d586014d3e2761baac5 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 5 Jun 2024 18:12:23 +0200 Subject: [PATCH 002/334] first successful compile after refactoring. 7 out of 136 rail tests fail (#7578) --- src/microsim/MSLink.cpp | 29 + src/microsim/MSLink.h | 4 + src/microsim/traffic_lights/MSDriveWay.cpp | 867 +++++++++++++++- src/microsim/traffic_lights/MSDriveWay.h | 192 +++- src/microsim/traffic_lights/MSRailSignal.cpp | 976 +----------------- src/microsim/traffic_lights/MSRailSignal.h | 198 +--- .../traffic_lights/MSRailSignalControl.cpp | 11 +- 7 files changed, 1168 insertions(+), 1109 deletions(-) diff --git a/src/microsim/MSLink.cpp b/src/microsim/MSLink.cpp index d688c608758f..c8205225ddb9 100644 --- a/src/microsim/MSLink.cpp +++ b/src/microsim/MSLink.cpp @@ -2162,4 +2162,33 @@ MSLink::updateDistToFoePedCrossing(double dist) { myDistToFoePedCrossing = MIN2(myDistToFoePedCrossing, dist); } + +std::pair +MSLink::getClosest() const { + assert(getApproaching().size() > 0); + double minDist = std::numeric_limits::max(); + auto closestIt = getApproaching().begin(); + for (auto apprIt = getApproaching().begin(); apprIt != getApproaching().end(); apprIt++) { + if (apprIt->second.dist < minDist) { + minDist = apprIt->second.dist; + closestIt = apprIt; + } + } + // maybe a parallel link has a closer vehicle + /* + for (MSLink* link2 : link->getLaneBefore()->getLinkCont()) { + if (link2 != link) { + for (auto apprIt2 = link2->getApproaching().begin(); apprIt2 != link2->getApproaching().end(); apprIt2++) { + if (apprIt2->second.dist < minDist) { + minDist = apprIt2->second.dist; + closestIt = apprIt2; + } + } + } + } + */ + return *closestIt; +} + + /****************************************************************************/ diff --git a/src/microsim/MSLink.h b/src/microsim/MSLink.h index 1a031b5f99ce..2effa8ff7289 100644 --- a/src/microsim/MSLink.h +++ b/src/microsim/MSLink.h @@ -683,6 +683,10 @@ class MSLink { /// @brief get string description for this link std::string getDescription() const; + /// @brief get the closest vehicle approaching this link + std::pair getClosest() const; + + /// @brief post-processing for legacy networks static void recheckSetRequestInformation(); diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 452f4974381c..03b98d063b2f 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -28,30 +28,46 @@ #include #include #include +#include #include "MSRailSignal.h" #include "MSDriveWay.h" #include "MSRailSignalControl.h" -//#define DEBUG_PASSED -//#define DEBUG_LANE +// typical block length in germany on main lines is 3-5km on branch lines up to 7km +// special branches that are used by one train exclusively could also be up to 20km in length +// minimum block size in germany is 37.5m (LZB) +// larger countries (USA, Russia) might see blocks beyond 20km) +#define MAX_BLOCK_LENGTH 20000 +#define MAX_SIGNAL_WARNINGS 10 + +//#define DEBUG_BUILD_DRIVEWAY +//#define DEBUG_DRIVEWAY_BUILDROUTE +//#define DEBUG_CHECK_FLANKS +//#define DEBUG_SIGNALSTATE_PRIORITY +//#define DEBUG_FIND_PROTECTION // =========================================================================== // static value definitions // =========================================================================== +int MSDriveWay::myDriveWayIndex(0); +int MSDriveWay::myNumWarnings(0); + // =========================================================================== // MSDriveWay method definitions // =========================================================================== -MSDriveWay::MSDriveWay(const std::vector lanes) : - MSMoveReminder(lanes.front()->getEdge().getFromJunction()->getID() + "_" + lanes.back()->getEdge().getToJunction()->getID()), - myLanes(lanes) -{ - for (MSLane* lane : myLanes) { - lane->addMoveReminder(this); - } -} +MSDriveWay::MSDriveWay(bool temporary) : + MSMoveReminder("DriveWay_" + (temporary ? "tmp" : toString(myDriveWayIndex))), + myNumericalID(temporary ? -1 : myDriveWayIndex++), + myMaxFlankLength(0), + myActive(nullptr), + myProtectedBidi(nullptr), + myCoreSize(0), + myFoundSignal(false), + myFoundReversal(false) +{} bool MSDriveWay::notifyEnter(SUMOTrafficObject& veh, Notification /*reason*/, const MSLane* /*enteredLane*/) { @@ -83,7 +99,7 @@ bool MSDriveWay::notifyLeaveBack(SUMOTrafficObject& veh, Notification /*reason*/, const MSLane* leftLane) { if (veh.isVehicle()) { // leaving network with departure, teleport etc - if (leftLane == myLanes.back()) { + if (leftLane == myForward.back()) { myTrains.erase(&dynamic_cast(veh)); return false; } else { @@ -94,5 +110,834 @@ MSDriveWay::notifyLeaveBack(SUMOTrafficObject& veh, Notification /*reason*/, con } } +bool +MSDriveWay::reserve(const Approaching& closest, MSEdgeVector& occupied) { + std::string joinVehicle = ""; + if (!MSGlobals::gUseMesoSim) { + const SUMOVehicleParameter::Stop* stop = closest.first->getNextStopParameter(); + if (stop != nullptr) { + joinVehicle = stop->join; + } + } + if (conflictLaneOccupied(joinVehicle, true, closest.first)) { + for (const MSLane* bidi : myBidi) { + if (!bidi->empty() && bidi->getBidiLane() != nullptr) { + occupied.push_back(&bidi->getBidiLane()->getEdge()); + } + } +#ifdef DEBUG_SIGNALSTATE + if (gDebugFlag4) { + std::cout << " conflictLaneOccupied by=" << toString(MSRailSignal::blockingVehicles()) << " ego=" << Named::getIDSecure(closest.first) << "\n"; + } +#endif + return false; + } + for (MSLink* link : myProtectingSwitches) { + if (!findProtection(closest, link)) { +#ifdef DEBUG_SIGNALSTATE + if (gDebugFlag4) { + std::cout << " no protection at switch " << link->getDescription() << "\n"; + } +#endif + return false; + } + } + for (MSLink* foeLink : myConflictLinks) { + if (hasLinkConflict(closest, foeLink)) { +#ifdef DEBUG_SIGNALSTATE + if (gDebugFlag4) { + std::cout << " linkConflict with " << getTLLinkID(foeLink) << "\n"; + } +#endif + return false; + } + } + if (deadlockLaneOccupied()) { + return false; + } + myActive = closest.first; + return true; +} + + +bool +MSDriveWay::conflictLinkApproached() const { + for (MSLink* foeLink : myConflictLinks) { + if (foeLink->getApproaching().size() > 0) { +#ifdef DEBUG_SIGNALSTATE + if (gDebugFlag4) { + std::cout << SIMTIME << " foeLink=" << foeLink->getDescription() << " approachedBy=" << foeLink->getApproaching().begin()->first->getID() << "\n"; + } +#endif + return true; + } + } + return false; +} + + +bool +MSDriveWay::hasLinkConflict(const Approaching& veh, MSLink* foeLink) const { +#ifdef DEBUG_SIGNALSTATE_PRIORITY + if (gDebugFlag4) { + std::cout << " checkLinkConflict foeLink=" << getTLLinkID(foeLink) << "\n"; + } +#endif + if (foeLink->getApproaching().size() > 0) { + Approaching foe = foeLink->getClosest(); +#ifdef DEBUG_SIGNALSTATE_PRIORITY + if (gDebugFlag4) { + std::cout << " approaching foe=" << foe.first->getID() << "\n"; + } +#endif + const MSTrafficLightLogic* foeTLL = foeLink->getTLLogic(); + assert(foeTLL != nullptr); + const MSRailSignal* constFoeRS = dynamic_cast(foeTLL); + MSRailSignal* foeRS = const_cast(constFoeRS); + if (foeRS != nullptr) { + const MSDriveWay& foeDriveWay = foeRS->retrieveDriveWayForVeh(foeLink->getTLIndex(), foe.first); + if (foeDriveWay.conflictLaneOccupied("", false, foe.first) || + foeDriveWay.deadlockLaneOccupied(false) || + !foeRS->constraintsAllow(foe.first) || + !overlap(foeDriveWay)) { +#ifdef DEBUG_SIGNALSTATE_PRIORITY + if (gDebugFlag4) { + if (foeDriveWay.conflictLaneOccupied("", false, foe.first)) { + std::cout << " foe blocked\n"; + } else if (!foeRS->constraintsAllow(foe.first)) { + std::cout << " foe constrained\n"; + } else { + std::cout << " no overlap\n"; + } + } +#endif + return false; + } +#ifdef DEBUG_SIGNALSTATE_PRIORITY + if (gDebugFlag4) { + std::cout + << " aSB=" << veh.second.arrivalSpeedBraking << " foeASB=" << foe.second.arrivalSpeedBraking + << " aT=" << veh.second.arrivalTime << " foeAT=" << foe.second.arrivalTime + << " aS=" << veh.first->getSpeed() << " foeS=" << foe.first->getSpeed() + << " aD=" << veh.second.dist << " foeD=" << foe.second.dist + << " aW=" << veh.first->getWaitingTime() << " foeW=" << foe.first->getWaitingTime() + << " aN=" << veh.first->getNumericalID() << " foeN=" << foe.first->getNumericalID() + << "\n"; + } +#endif + const bool yield = mustYield(veh, foe); + if (MSRailSignal::storeVehicles()) { + MSRailSignal::rivalVehicles().push_back(foe.first); + if (yield) { + MSRailSignal::priorityVehicles().push_back(foe.first); + } + } + return yield; + } + } + return false; +} + + +bool +MSDriveWay::mustYield(const Approaching& veh, const Approaching& foe) { + if (foe.second.arrivalSpeedBraking == veh.second.arrivalSpeedBraking) { + if (foe.second.arrivalTime == veh.second.arrivalTime) { + if (foe.first->getSpeed() == veh.first->getSpeed()) { + if (foe.second.dist == veh.second.dist) { + if (foe.first->getWaitingTime() == veh.first->getWaitingTime()) { + return foe.first->getNumericalID() < veh.first->getNumericalID(); + } else { + return foe.first->getWaitingTime() > veh.first->getWaitingTime(); + } + } else { + return foe.second.dist < veh.second.dist; + } + } else { + return foe.first->getSpeed() > veh.first->getSpeed(); + } + } else { + return foe.second.arrivalTime < veh.second.arrivalTime; + } + } else { + return foe.second.arrivalSpeedBraking > veh.second.arrivalSpeedBraking; + } +} + + +bool +MSDriveWay::conflictLaneOccupied(const std::string& joinVehicle, bool store, const SUMOVehicle* ego) const { + for (const MSLane* lane : myConflictLanes) { + if (!lane->isEmpty()) { +#ifdef DEBUG_SIGNALSTATE + if (gDebugFlag4) { + std::cout << SIMTIME << " conflictLane " << lane->getID() << " occupied ego=" << Named::getIDSecure(ego) << " vehNumber=" << lane->getVehicleNumber() << "\n"; + if (joinVehicle != "") { + std::cout << " joinVehicle=" << joinVehicle << " occupant=" << toString(lane->getVehiclesSecure()) << "\n"; + lane->releaseVehicles(); + } + } +#endif + if (lane->getVehicleNumberWithPartials() == 1) { + MSVehicle* foe = lane->getLastAnyVehicle(); + if (joinVehicle != "") { + if (foe->getID() == joinVehicle && foe->isStopped()) { +#ifdef DEBUG_SIGNALSTATE + if (gDebugFlag4) { + std::cout << " ignore join-target '" << joinVehicle << "\n"; + } +#endif + continue; + } + } + if (ego != nullptr) { + if (foe == ego && std::find(myBidi.begin(), myBidi.end(), lane) != myBidi.end()) { +#ifdef DEBUG_SIGNALSTATE + if (gDebugFlag4) { + std::cout << " ignore ego as oncoming '" << ego->getID() << "\n"; + } +#endif + continue; + } + if (foe->isStopped() && foe->getNextStopParameter()->join == ego->getID()) { +#ifdef DEBUG_SIGNALSTATE + if (gDebugFlag4) { + std::cout << " ignore " << foe->getID() << " for which ego is join-target\n"; + } +#endif + continue; + } + } + } + if (MSRailSignal::storeVehicles() && store) { + MSRailSignal::blockingVehicles().push_back(lane->getLastAnyVehicle()); + } + return true; + } + } + return false; +} + +bool +MSDriveWay::deadlockLaneOccupied(bool store) const { + for (const MSLane* lane : myBidiExtended) { + if (!lane->empty()) { + assert(myBidi.size() != 0); + const MSEdge* lastBidi = myBidi.back()->getNextNormal(); + MSVehicle* foe = lane->getVehiclesSecure().front(); +#ifdef DEBUG_SIGNALSTATE + if (gDebugFlag4) { + std::cout << " check for deadlock with " << foe->getID() << "\n"; + } +#endif + // check of foe will enter myBidi (need to check at most + // myBidiExtended.size edges) + const int minEdges = (int)myBidiExtended.size(); + auto foeIt = foe->getCurrentRouteEdge() + 1; + auto foeEnd = foe->getRoute().end(); + bool conflict = false; + for (int i = 0; i < minEdges && foeIt != foeEnd; i++) { + if ((*foeIt) == lastBidi) { +#ifdef DEBUG_SIGNALSTATE + if (gDebugFlag4) { + std::cout << " vehicle will enter " << lastBidi->getID() << "\n"; + } +#endif + conflict = true; + break; + } + foeIt++; + } + lane->releaseVehicles(); + if (conflict) { + if (MSRailSignal::storeVehicles() && store) { + MSRailSignal::blockingVehicles().push_back(foe); + } + return true; + } + } + } + return false; +} + + +bool +MSDriveWay::findProtection(const Approaching& veh, MSLink* link) const { + double flankApproachingDist = std::numeric_limits::max(); + if (link->getApproaching().size() > 0) { + Approaching closest = link->getClosest(); + flankApproachingDist = closest.second.dist; + } +#ifdef DEBUG_FIND_PROTECTION + if (gDebugFlag4) { + std::cout << SIMTIME << " findProtection for link=" << link->getDescription() << " flankApproachingDist=" << flankApproachingDist << "\n"; + } +#endif + for (MSLink* l2 : link->getLaneBefore()->getLinkCont()) { + if (l2->getLane() != link->getLane()) { +#ifdef DEBUG_FIND_PROTECTION + if (gDebugFlag4) { + std::cout << " protectionCandidate=" << l2->getDescription() << " l2Via=" << Named::getIDSecure(l2->getViaLane()) + << " occupied=" << (l2->getViaLane() != nullptr && !l2->getViaLane()->isEmpty()) << "\n"; + } +#endif + if (l2->getViaLane() != nullptr && !l2->getViaLane()->isEmpty()) { +#ifdef DEBUG_FIND_PROTECTION + if (gDebugFlag4) { + std::cout << " protection from internal=" << l2->getViaLane()->getID() << "\n"; + } +#endif + return true; + } + if (l2->getApproaching().size() > 0) { + Approaching closest2 = l2->getClosest(); + if (closest2.second.dist < flankApproachingDist) { +#ifdef DEBUG_FIND_PROTECTION + if (gDebugFlag4) { + std::cout << " protection from veh=" << closest2.first->getID() << "\n"; + } +#endif + return true; + } + } + } + } + if (link->getApproaching().size() == 0) { + return true; + } else { + // find protection further upstream + MSDriveWay tmp(true); + const MSLane* before = link->getLaneBefore(); + tmp.myFlank.push_back(before); + LaneVisitedMap visited; + for (auto ili : before->getIncomingLanes()) { + tmp.findFlankProtection(ili.viaLink, myMaxFlankLength, visited, ili.viaLink, tmp.myFlank); + } + tmp.myConflictLanes = tmp.myFlank; + tmp.myRoute = myRoute; + tmp.myCoreSize = myCoreSize; + MSEdgeVector occupied; + if (gDebugFlag4) std::cout << SIMTIME << " tmpDW flank=" << toString(tmp.myFlank) + << " protSwitch=" << MSRailSignal::describeLinks(tmp.myProtectingSwitches) + << " cLinks=" << MSRailSignal::describeLinks(tmp.myConflictLinks) << "\n"; + return tmp.reserve(veh, occupied); + } +} + + +bool +MSDriveWay::overlap(const MSDriveWay& other) const { + for (int i = 0; i < myCoreSize; i++) { + for (int j = 0; j < other.myCoreSize; j++) { + const MSEdge* edge = myRoute[i]; + const MSEdge* edge2 = other.myRoute[j]; + if (edge->getToJunction() == edge2->getToJunction() + || edge->getToJunction() == edge2->getFromJunction()) { + // XXX might be rail_crossing with parallel tracks + return true; + } + } + } + return false; +} + +bool +MSDriveWay::flankConflict(const MSDriveWay& other) const { + for (const MSLane* lane : myForward) { + for (const MSLane* lane2 : other.myForward) { + if (lane == lane2) { + return true; + } + } + for (const MSLane* lane2 : other.myBidi) { + if (lane == lane2) { + return true; + } + } + } + return false; +} + +void +MSDriveWay::writeBlocks(OutputDevice& od) const { + od.openTag("driveWay"); + od.writeAttr(SUMO_ATTR_EDGES, toString(myRoute)); + if (myCoreSize != (int)myRoute.size()) { + od.writeAttr("core", myCoreSize); + } + od.openTag("forward"); + od.writeAttr(SUMO_ATTR_LANES, toString(myForward)); + od.closeTag(); + od.openTag("bidi"); + od.writeAttr(SUMO_ATTR_LANES, toString(myBidi)); + if (myBidiExtended.size() > 0) { + od.lf(); + od << " "; + od.writeAttr("deadlockCheck", toString(myBidiExtended)); + } + od.closeTag(); + od.openTag("flank"); + od.writeAttr(SUMO_ATTR_LANES, toString(myFlank)); + od.closeTag(); + + od.openTag("protectingSwitches"); + std::vector links; + for (MSLink* link : myProtectingSwitches) { + links.push_back(getJunctionLinkID(link)); + } + od.writeAttr("links", joinToString(links, " ")); + od.closeTag(); + + od.openTag("conflictLinks"); + std::vector signals; + for (MSLink* link : myConflictLinks) { + signals.push_back(getTLLinkID(link)); + } + od.writeAttr("signals", joinToString(signals, " ")); + od.closeTag(); + od.closeTag(); // driveWay +} + + +void +MSDriveWay::buildRoute(const MSLink* origin, double length, + MSRouteIterator next, MSRouteIterator end, + LaneVisitedMap& visited) { + bool seekForwardSignal = true; + bool seekBidiSwitch = true; + bool foundUnsafeSwitch = false; + MSLane* toLane = origin->getViaLaneOrLane(); +#ifdef DEBUG_DRIVEWAY_BUILDROUTE + gDebugFlag4 = DEBUG_HELPER(origin->getTLLogic()); + if (gDebugFlag4) std::cout << "buildRoute origin=" << getTLLinkID(origin) << " vehRoute=" << toString(ConstMSEdgeVector(next, end)) + << " visited=" << formatVisitedMap(visited) << "\n"; +#endif + while ((seekForwardSignal || seekBidiSwitch)) { + if (length > MAX_BLOCK_LENGTH) { + if (myNumWarnings < MAX_SIGNAL_WARNINGS) { + WRITE_WARNING("Block after rail signal " + getClickableTLLinkID(origin) + + " exceeds maximum length (stopped searching after edge '" + toLane->getEdge().getID() + "' (length=" + toString(length) + "m)."); + } + myNumWarnings++; + // length exceeded + return; + } +#ifdef DEBUG_DRIVEWAY_BUILDROUTE + if (gDebugFlag4) { + std::cout << " toLane=" << toLane->getID() << " visited=" << formatVisitedMap(visited) << "\n"; + } +#endif + if (visited.count(toLane) != 0) { + WRITE_WARNINGF(TL("Found circular block after railSignal % (% edges, length %)"), getClickableTLLinkID(origin), toString(myRoute.size()), toString(length)); + //std::cout << getClickableTLLinkID(origin) << " circularBlock1=" << toString(myRoute) << " visited=" << formatVisitedMap(visited) << "\n"; + return; + } + if (toLane->getEdge().isNormal()) { + myRoute.push_back(&toLane->getEdge()); + if (next != end) { + next++; + } + } + appendMapIndex(visited, toLane); + length += toLane->getLength(); + MSLane* bidi = toLane->getBidiLane(); + if (seekForwardSignal) { + if (!foundUnsafeSwitch) { + myForward.push_back(toLane); + toLane->addMoveReminder(this); + } + } else if (bidi == nullptr) { + seekBidiSwitch = false; +#ifdef DEBUG_DRIVEWAY_BUILDROUTE + if (gDebugFlag4) { + std::cout << " noBidi, abort search for bidiSwitch\n"; + } +#endif + } + if (bidi != nullptr) { + if (foundUnsafeSwitch) { + myBidiExtended.push_back(bidi); + } else { + myBidi.push_back(bidi); + } + appendMapIndex(visited, bidi); + if (!seekForwardSignal) { + // look for switch that could protect from oncoming vehicles + for (const auto& ili : bidi->getIncomingLanes()) { + if (ili.viaLink->getDirection() == LinkDirection::TURN) { + continue; + } + for (const MSLink* const link : ili.lane->getLinkCont()) { + if (link->getDirection() == LinkDirection::TURN) { + continue; + } + if (link->getViaLaneOrLane() != bidi) { + // this switch is special beause it still lies on the current route + //myProtectingSwitches.push_back(ili.viaLink); + const MSEdge* const bidiNext = bidi->getNextNormal(); + myCoreSize = (int)myRoute.size(); + if (MSRailSignalControl::getInstance().getUsedEdges().count(bidiNext) == 0) { +#ifdef DEBUG_DRIVEWAY_BUILDROUTE + if (gDebugFlag4) { + std::cout << " abort: found protecting switch " << ili.viaLink->getDescription() << "\n"; + } +#endif + // if bidi is actually used by a train (rather than + // the other route) we must later adapt this driveway for additional checks (myBidiExtended) + myProtectedBidi = bidiNext; + std::set visitedEdges; + for (auto item : visited) { + visitedEdges.insert(&item.first->getEdge()); + } + while (next != end && visitedEdges.count(*next) == 0) { + // the driveway is route specific but only but stop recording if it loops back on itself + visitedEdges.insert(*next); + const MSEdge* nextBidi = (*next)->getBidiEdge(); + if (nextBidi != nullptr) { + visitedEdges.insert(nextBidi); + } + myRoute.push_back(*next); + next++; + } + return; + } else { +#ifdef DEBUG_DRIVEWAY_BUILDROUTE + if (gDebugFlag4) { + std::cout << " found unsafe switch " << ili.viaLink->getDescription() << " (used=" << bidiNext->getID() << ")\n"; + } +#endif + // trains along our route beyond this switch + // might create deadlock + foundUnsafeSwitch = true; + // the switch itself must still be guarded to ensure safety + for (const auto& ili2 : bidi->getIncomingLanes()) { + if (ili2.viaLink->getDirection() != LinkDirection::TURN) { + myFlankSwitches.push_back(ili.viaLink); + } + } + } + } + } + } + } + } + const std::vector& links = toLane->getLinkCont(); + const MSEdge* current = &toLane->getEdge(); + toLane = nullptr; + for (const MSLink* const link : links) { + if ((next != end && &link->getLane()->getEdge() == *next) + && isRailway(link->getViaLaneOrLane()->getPermissions())) { + toLane = link->getViaLaneOrLane(); + if (link->getLane()->getBidiLane() != nullptr && &link->getLane()->getEdge() == current->getBidiEdge()) { + // do not follow turn-arounds even if the route contains a reversal +#ifdef DEBUG_DRIVEWAY_BUILDROUTE + if (gDebugFlag4) { + std::cout << " abort: turn-around\n"; + } +#endif + myFoundReversal = true; + return; + } + if (link->getTLLogic() != nullptr) { + if (link->getTLLogic() == origin->getTLLogic()) { + WRITE_WARNINGF(TL("Found circular block at railSignal % (% edges, length %)"), getClickableTLLinkID(origin), toString(myRoute.size()), toString(length)); + //std::cout << getClickableTLLinkID(origin) << " circularBlock2=" << toString(myRoute) << "\n"; + return; + } + seekForwardSignal = false; + myFoundSignal = true; + seekBidiSwitch = bidi != nullptr; +#ifdef DEBUG_DRIVEWAY_BUILDROUTE + if (gDebugFlag4) { + std::cout << " found forwardSignal " << link->getTLLogic()->getID() << " seekBidiSwitch=" << seekBidiSwitch << "\n"; + } +#endif + } + break; + } + } + if (toLane == nullptr) { + if (next != end) { + // no connection found, jump to next route edge + toLane = (*next)->getLanes()[0]; +#ifdef DEBUG_DRIVEWAY_BUILDROUTE + if (gDebugFlag4) { + std::cout << " abort: turn-around or jump\n"; + } +#endif + myFoundReversal = true; + return; + } else { +#ifdef DEBUG_DRIVEWAY_BUILDROUTE + if (gDebugFlag4) { + std::cout << " abort: no next lane available\n"; + } +#endif + return; + } + } + } +} + + +void +MSDriveWay::checkFlanks(const MSLink* originLink, const std::vector& lanes, const LaneVisitedMap& visited, bool allFoes, std::vector& flankSwitches) const { +#ifdef DEBUG_CHECK_FLANKS + std::cout << " checkFlanks lanes=" << toString(lanes) << "\n visited=" << formatVisitedMap(visited) << " allFoes=" << allFoes << "\n"; +#endif + const MSLink* reverseOriginLink = originLink->getLane()->getBidiLane() != nullptr && originLink->getLaneBefore()->getBidiLane() != nullptr + ? originLink->getLane()->getBidiLane()->getLinkTo(originLink->getLaneBefore()->getBidiLane()) + : nullptr; + //std::cout << " originLink=" << originLink->getDescription() << "\n"; + if (reverseOriginLink != nullptr) { + reverseOriginLink = reverseOriginLink->getCorrespondingExitLink(); + //std::cout << " reverseOriginLink=" << reverseOriginLink->getDescription() << "\n"; + } + for (int i = 0; i < (int)lanes.size(); i++) { + const MSLane* lane = lanes[i]; + const MSLane* prev = i > 0 ? lanes[i - 1] : nullptr; + const MSLane* next = i + 1 < (int)lanes.size() ? lanes[i + 1] : nullptr; + if (lane->isInternal()) { + continue; + } + for (auto ili : lane->getIncomingLanes()) { + if (ili.viaLink == originLink + || ili.viaLink == reverseOriginLink + || ili.viaLink->getDirection() == LinkDirection::TURN + || ili.viaLink->getDirection() == LinkDirection::TURN_LEFTHAND) { + continue; + } + if (ili.lane != prev && ili.lane != next) { +#ifdef DEBUG_CHECK_FLANKS + std::cout << " add flankSwitch junction=" << ili.viaLink->getJunction()->getID() << " index=" << ili.viaLink->getIndex() << " iLane=" << ili.lane->getID() << " prev=" << Named::getIDSecure(prev) << " targetLane=" << lane->getID() << " next=" << Named::getIDSecure(next) << "\n"; +#endif + flankSwitches.push_back(ili.viaLink); + } else if (allFoes) { + // link is part of the driveway, find foes that cross the driveway without entering + checkCrossingFlanks(ili.viaLink, visited, flankSwitches); + } + } + } +} + + +void +MSDriveWay::checkCrossingFlanks(MSLink* dwLink, const LaneVisitedMap& visited, std::vector& flankSwitches) const { +#ifdef DEBUG_CHECK_FLANKS + std::cout << " checkCrossingFlanks dwLink=" << dwLink->getDescription() << " visited=" << formatVisitedMap(visited) << "\n"; +#endif + const MSJunction* junction = dwLink->getJunction(); + if (junction == nullptr) { + return; // unregulated junction; + } + const MSJunctionLogic* logic = junction->getLogic(); + if (logic == nullptr) { + return; // unregulated junction; + } + for (const MSEdge* in : junction->getIncoming()) { + if (in->isInternal()) { + continue; + } + for (MSLane* inLane : in->getLanes()) { + if (isRailway(inLane->getPermissions()) && visited.count(inLane) == 0) { + for (MSLink* link : inLane->getLinkCont()) { + if (link->getIndex() >= 0 && logic->getFoesFor(dwLink->getIndex()).test(link->getIndex()) + && visited.count(link->getLane()) == 0) { +#ifdef DEBUG_CHECK_FLANKS + std::cout << " add crossing flankSwitch junction=" << junction->getID() << " index=" << link->getIndex() << "\n"; +#endif + if (link->getViaLane() == nullptr) { + flankSwitches.push_back(link); + } else { + flankSwitches.push_back(link->getViaLane()->getLinkCont().front()); + } + } + } + } + } + } +} + +void +MSDriveWay::findFlankProtection(MSLink* link, double length, LaneVisitedMap& visited, MSLink* origLink, std::vector& flank) { +#ifdef DEBUG_CHECK_FLANKS + std::cout << " findFlankProtection link=" << link->getDescription() << " length=" << length << " origLink=" << origLink->getDescription() << "\n"; +#endif + if (link->getTLLogic() != nullptr) { + // guarded by signal +#ifdef DEBUG_CHECK_FLANKS + std::cout << " flank guarded by " << link->getTLLogic()->getID() << "\n"; +#endif + myConflictLinks.push_back(link); + } else if (length > MAX_BLOCK_LENGTH) { + // length exceeded + if (myNumWarnings < MAX_SIGNAL_WARNINGS) { + WRITE_WARNING("Incoming block at junction '" + origLink->getJunction()->getID() + "', link " + toString(origLink->getIndex()) + " exceeds maximum length (stopped searching after lane '" + link->getLane()->getID() + "' (length=" + toString(length) + "m)."); + } + myNumWarnings++; + } else { + // find normal lane before this link + const MSLane* lane = link->getLaneBefore(); + const bool isNew = visited.count(lane) == 0; + if (isNew || (visited[lane] > visited[origLink->getLane()] && std::find(myForward.begin(), myForward.end(), lane) == myForward.end())) { + if (isNew) { + appendMapIndex(visited, lane); + } + length += lane->getLength(); + if (lane->isInternal()) { + flank.push_back(lane); + findFlankProtection(lane->getIncomingLanes().front().viaLink, length, visited, origLink, flank); + } else { + bool foundPSwitch = false; + for (MSLink* l2 : lane->getLinkCont()) { +#ifdef DEBUG_CHECK_FLANKS + std::cout << " lane=" << lane->getID() << " visitedIndex=" << visited[lane] << " origIndex=" << visited[origLink->getLane()] << " cand=" << l2->getDescription() << "\n"; +#endif + if (l2->getDirection() != LinkDirection::TURN && l2->getLane() != link->getLane()) { + foundPSwitch = true; + // found potential protection +#ifdef DEBUG_CHECK_FLANKS + std::cout << " protectingSwitch=" << l2->getDescription() << " for flank=" << link->getDescription() << "\n"; +#endif + myProtectingSwitches.push_back(link); + if (std::find(myBidi.begin(), myBidi.end(), origLink->getLane()) != myBidi.end()) { +#ifdef DEBUG_CHECK_FLANKS + std::cout << " (is bidi-switch)\n"; +#endif + myProtectingSwitchesBidi.push_back(link); + } + } + } + if (!foundPSwitch) { + flank.push_back(lane); + // continue search for protection upstream recursively + for (auto ili : lane->getIncomingLanes()) { + if (ili.viaLink->getDirection() != LinkDirection::TURN) { + findFlankProtection(ili.viaLink, length, visited, origLink, flank); + } + } + } + } + } else { +#ifdef DEBUG_CHECK_FLANKS + std::cout << " laneBefore=" << lane->getID() << " already visited. index=" << visited[lane] << " origAfter=" << origLink->getLane()->getID() << " origIndex=" << visited[origLink->getLane()] << "\n"; +#endif + } + } + myMaxFlankLength = MAX2(myMaxFlankLength, length); +} + + +MSDriveWay* +MSDriveWay::buildDriveWay(const MSLink* link, MSRouteIterator first, MSRouteIterator end) { + // collect lanes and links that are relevant for setting this signal for the current driveWay + // For each driveway we collect + // - conflictLanes (signal must be red if any conflict lane is occupied) + // - conflictLinks (signal must be red if any conflict link is approached by a vehicle + // - that cannot break in time (arrivalSpeedBraking > 0) + // - approached by a vehicle with higher switching priority (see #3941) + // These objects are construct in steps: + // + // forwardBlock + // - search forward recursive from outgoing lane until controlled railSignal link found + // -> add all found lanes to conflictLanes + // + // bidiBlock (if any forwardBlock edge has bidi edge) + // - search bidi backward recursive until first switch + // - from switch search backward recursive all other incoming until controlled rail signal link + // -> add final links to conflictLinks + // + // flanks + // - search backward recursive from flanking switches + // until controlled railSignal link or protecting switch is found + // -> add all found lanes to conflictLanes + // -> add final links to conflictLinks + + MSDriveWay* dw = new MSDriveWay(); + LaneVisitedMap visited; + std::vector before; + appendMapIndex(visited, link->getLaneBefore()); + MSLane* fromBidi = link->getLaneBefore()->getBidiLane(); + if (fromBidi != nullptr) { + // do not extend to forward block beyond the entering track (in case of a loop) + appendMapIndex(visited, fromBidi); + before.push_back(fromBidi); + } + dw->buildRoute(link, 0., first, end, visited); + if (dw->myProtectedBidi == nullptr) { + dw->myCoreSize = (int)dw->myRoute.size(); + } + dw->checkFlanks(link, dw->myForward, visited, true, dw->myFlankSwitches); + dw->checkFlanks(link, dw->myBidi, visited, false, dw->myFlankSwitches); + dw->checkFlanks(link, before, visited, true, dw->myFlankSwitches); + for (MSLink* link : dw->myFlankSwitches) { + //std::cout << getID() << " flankSwitch=" << link->getDescription() << "\n"; + dw->findFlankProtection(link, 0, visited, link, dw->myFlank); + } + std::vector flankSwitchesBidiExtended; + dw->checkFlanks(link, dw->myBidiExtended, visited, false, flankSwitchesBidiExtended); + for (MSLink* link : flankSwitchesBidiExtended) { + //std::cout << getID() << " flankSwitchBEx=" << link->getDescription() << "\n"; + dw->findFlankProtection(link, 0, visited, link, dw->myBidiExtended); + } + +#ifdef DEBUG_BUILD_DRIVEWAY + if (DEBUG_COND_LINKINFO) { + std::cout << " buildDriveWay railSignal=" << getID() + << "\n route=" << toString(dw->myRoute) + << "\n forward=" << toString(dw->myForward) + << "\n bidi=" << toString(dw->myBidi) + << "\n flank=" << toString(dw->myFlank) + << "\n flankSwitch=" << MSRailSignal::describeLinks(dw->myFlankSwitches) + << "\n protSwitch=" << MSRailSignal::describeLinks(dw->myProtectingSwitches) + << "\n coreSize=" << dw->myCoreSize + << "\n"; + } +#endif + MSRailSignal* rs = const_cast(static_cast(link->getTLLogic())); + if (!rs->isMovingBlock()) { + dw->myConflictLanes.insert(dw->myConflictLanes.end(), dw->myForward.begin(), dw->myForward.end()); + } + dw->myConflictLanes.insert(dw->myConflictLanes.end(), dw->myBidi.begin(), dw->myBidi.end()); + dw->myConflictLanes.insert(dw->myConflictLanes.end(), dw->myFlank.begin(), dw->myFlank.end()); + if (dw->myProtectedBidi != nullptr) { + MSRailSignalControl::getInstance().registerProtectedDriveway(rs, dw->myNumericalID, dw->myProtectedBidi); + } + + return dw; +} + +std::string +MSDriveWay::getTLLinkID(const MSLink* link) { + return link->getTLLogic()->getID() + "_" + toString(link->getTLIndex()); +} + +std::string +MSDriveWay::getJunctionLinkID(const MSLink* link) { + return link->getJunction()->getID() + "_" + toString(link->getIndex()); +} + +std::string +MSDriveWay::getClickableTLLinkID(const MSLink* link) { + return "junction '" + link->getTLLogic()->getID() + "', link " + toString(link->getTLIndex()); +} + +std::string +MSDriveWay::formatVisitedMap(const LaneVisitedMap& visited) { + std::vector lanes(visited.size(), nullptr); + for (auto item : visited) { + lanes[item.second] = item.first; + } + return toString(lanes); +} + + +void +MSDriveWay::appendMapIndex(LaneVisitedMap& map, const MSLane* lane) { + // avoid undefined behavior from evaluation order + const int tmp = (int)map.size(); + map[lane] = tmp; +} + /****************************************************************************/ diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h index fcae22ad749a..078e9b48f977 100644 --- a/src/microsim/traffic_lights/MSDriveWay.h +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -20,13 +20,15 @@ #pragma once #include +#include #include // =========================================================================== // class declarations // =========================================================================== -class MSRailSignal; - +class SUMOVehicle; +class MSLane; +class MSLink; // =========================================================================== // class definitions @@ -36,9 +38,18 @@ class MSRailSignal; */ class MSDriveWay : public MSMoveReminder { public: - /** @brief Constructor + typedef std::pair Approaching; + typedef std::set LaneSet; + typedef std::map LaneVisitedMap; + + /* The driveways (Fahrstrassen) for each link index of MSRailSignal + * Each link index has at least one driveway + * A driveway describes one possible route that passes the signal up to + * the next secure point + * When a signal guards a switch (indirect guard) that signal stores two + * or more driveways */ - MSDriveWay(const std::vector lanes); + MSDriveWay(bool temporary = false); /// @brief Destructor virtual ~MSDriveWay() {}; @@ -47,10 +58,181 @@ class MSDriveWay : public MSMoveReminder { bool notifyLeave(SUMOTrafficObject& veh, double lastPos, Notification reason, const MSLane* enteredLane = 0); bool notifyLeaveBack(SUMOTrafficObject& veh, Notification reason, const MSLane* leftLane); + /// @brief Wether there is a flank conflict with the given driveway + bool flankConflict(const MSDriveWay& other) const; + + /// @brief whether any of myConflictLanes is occupied (vehicles that are the target of a join must be ignored) + bool conflictLaneOccupied(const std::string& joinVehicle = "", bool store = true, const SUMOVehicle* ego = nullptr) const; + + /// @brief Whether any of the conflict links have approaching vehicles + bool conflictLinkApproached() const; + + /// @brief attempt reserve this driveway for the given vehicle + bool reserve(const Approaching& closest, MSEdgeVector& occupied); + + /// @brief find protection for the given vehicle starting at a switch + bool findProtection(const Approaching& veh, MSLink* link) const; + + /// @brief Write block items for this driveway + void writeBlocks(OutputDevice& od) const; + + const std::vector& getRoute() const { + return myRoute; + } + + const std::vector& getFlank() const { + return myFlank; + } + + const std::vector& getBidi() const { + return myBidi; + } + + const std::vector& getConflictLinks() const { + return myConflictLinks; + } + + const std::vector& getProtectingSwitchesBidi() const { + return myProtectingSwitchesBidi; + } + + int getNumericalID() const { + return myNumericalID; + } + + bool foundSignal() const { + return myFoundSignal; + } + + bool foundReversal() const { + return myFoundReversal; + } + + /// @brief Whether veh must yield to the foe train + static bool mustYield(const Approaching& veh, const Approaching& foe); + + /// @brief construct a new driveway by searching along the given route until all block structures are found + static MSDriveWay* buildDriveWay(const MSLink* link, MSRouteIterator first, MSRouteIterator end); + + /// @brief return logicID_linkIndex in a way that allows clicking in sumo-gui + static std::string getClickableTLLinkID(const MSLink* link); + +protected: + + /// @brief global driveway index + int myNumericalID; + + /// @brief the maximum flank length searched while building this driveway + double myMaxFlankLength; + + /// @brief whether the current signal is switched green for a train approaching this block + const SUMOVehicle* myActive; + + /// @brief switch assumed safe from bidi-traffic + const MSEdge* myProtectedBidi; + + /// @brief list of edges for matching against train routes + std::vector myRoute; + + /// @brief number of edges in myRoute where overlap with other driveways is forbidden + int myCoreSize; + + /// @brief whether this driveway ends its forward section with a rail signal (and thus comprises a full block) + bool myFoundSignal; + bool myFoundReversal; + + /* @brief the actual driveway part up to the next railsignal (halting position) + * This must be free of other trains */ + std::vector myForward; + + /* @brief the list of bidirectional edges that can enter the forward + * section and which must also be free of traffic + * (up to the first element that could give protection) */ + std::vector myBidi; + + /* @brief the list of bidirectional edges that can enter the forward + * section and which might contain deadlock-relevant traffic */ + std::vector myBidiExtended; + + /* @brief the list of edges that merge with the forward section + * (found via backward search, up to the first element that could give protection) */ + std::vector myFlank; + + /// @brief the lanes that must be clear of trains before this signal can switch to green + std::vector myConflictLanes; + + /* @brief the list of switches that threaten the driveway and for which protection must be found + */ + std::vector myFlankSwitches; + + /* @brief the list of (first) switches that could give protection from oncoming/flanking vehicles + * if any of them fails to do so, upstream search must be performed + * until protection or conflict is found + */ + std::vector myProtectingSwitches; + /// @brief subset of myProtectingSwitches that protects from oncoming trains + std::vector myProtectingSwitchesBidi; + + /* The conflict links for this block + * Conflict resolution must be performed if vehicles are approaching the + * current link and any of the conflict links */ + std::vector myConflictLinks; + + /// @brief whether any of myBidiExtended is occupied by a vehicle that targets myBidi + bool deadlockLaneOccupied(bool store = true) const; + + /// @brief Whether the approaching vehicle is prevent from driving by another vehicle approaching the given link + bool hasLinkConflict(const Approaching& closest, MSLink* foeLink) const; + + /// @brief Wether this driveway (route) overlaps with the given one + bool overlap(const MSDriveWay& other) const; + + /* @brief determine route that identifies this driveway (a subset of the + * vehicle route) + * collects: + * myRoute + * myForward + * myBidi + * myProtectedBidi + * + * returns edge that is assumed to safe from oncoming-deadlock or nullptr + */ + void buildRoute(const MSLink* origin, double length, MSRouteIterator next, MSRouteIterator end, LaneVisitedMap& visited); + + /* @brief find switches that threaten this driveway + * @param[out] flankSwitches collect the switches + */ + void checkFlanks(const MSLink* originLink, const std::vector& lanes, const LaneVisitedMap& visited, bool allFoes, std::vector& flankSwitches) const; + + /* @brief find links that cross the driveway without entering it + * @param[out] flankSwitches collect the switches + */ + void checkCrossingFlanks(MSLink* dwLink, const LaneVisitedMap& visited, std::vector& flankSwitches) const; + + /* @brief find upstream protection from the given link + * @param[out] flank: the stored flank lanes + */ + void findFlankProtection(MSLink* link, double length, LaneVisitedMap& visited, MSLink* origLink, std::vector& flank); + + /// @brief return logicID_linkIndex + static std::string getTLLinkID(const MSLink* link); + + /// @brief return junctionID_junctionLinkIndex + static std::string getJunctionLinkID(const MSLink* link); + + /// @brief print link descriptions + static std::string formatVisitedMap(const LaneVisitedMap& visited); + + /// @brief append to map by map index and avoid undefined behavior + static void appendMapIndex(LaneVisitedMap& map, const MSLane* lane); + private: - std::vector myLanes; std::set myTrains; + static int myDriveWayIndex; + static int myNumWarnings; + + }; diff --git a/src/microsim/traffic_lights/MSRailSignal.cpp b/src/microsim/traffic_lights/MSRailSignal.cpp index 54c49d90040b..884cadddfbf9 100644 --- a/src/microsim/traffic_lights/MSRailSignal.cpp +++ b/src/microsim/traffic_lights/MSRailSignal.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -47,24 +46,12 @@ #include "MSTLLogicControl.h" #include "MSRailSignalConstraint.h" #include "MSRailSignalControl.h" +#include "MSDriveWay.h" #include "MSRailSignal.h" -// typical block length in germany on main lines is 3-5km on branch lines up to 7km -// special branches that are used by one train exclusively could also be up to 20km in length -// minimum block size in germany is 37.5m (LZB) -// larger countries (USA, Russia) might see blocks beyond 20km) -#define MAX_BLOCK_LENGTH 20000 -#define MAX_SIGNAL_WARNINGS 10 - //#define DEBUG_SELECT_DRIVEWAY -//#define DEBUG_BUILD_DRIVEWAY //#define DEBUG_DRIVEWAY_UPDATE -//#define DEBUG_DRIVEWAY_BUILDROUTE -//#define DEBUG_CHECK_FLANKS - //#define DEBUG_SIGNALSTATE -//#define DEBUG_SIGNALSTATE_PRIORITY -//#define DEBUG_FIND_PROTECTION //#define DEBUG_REROUTE #define DEBUG_COND DEBUG_HELPER(this) @@ -76,9 +63,6 @@ // =========================================================================== // static value definitions // =========================================================================== -int MSRailSignal::myNumWarnings(0); - -int MSRailSignal::myDriveWayIndex(0); bool MSRailSignal::myStoreVehicles(false); MSRailSignal::VehicleVector MSRailSignal::myBlockingVehicles; @@ -149,8 +133,8 @@ MSRailSignal::updateCurrentPhase() { std::string state(myLinks.size(), 'G'); for (LinkInfo& li : myLinkInfos) { if (li.myLink->getApproaching().size() > 0) { - Approaching closest = getClosest(li.myLink); - DriveWay& driveway = li.getDriveWay(closest.first); + Approaching closest = li.myLink->getClosest(); + MSDriveWay& driveway = li.getDriveWay(closest.first); //std::cout << SIMTIME << " signal=" << getTLLinkID(li.myLink) << " veh=" << closest.first->getID() << " dw:\n"; //driveway.writeBlocks(*OutputDevice_COUT::getDevice()); const bool mustWait = !constraintsAllow(closest.first); @@ -167,9 +151,9 @@ MSRailSignal::updateCurrentPhase() { #endif } else { state[li.myLink->getTLIndex()] = 'G'; - if (driveway.myFlank.size() > 0 && myCurrentPhase.getState()[li.myLink->getTLIndex()] != 'G') { + if (driveway.getFlank().size() > 0 && myCurrentPhase.getState()[li.myLink->getTLIndex()] != 'G') { // schedule recheck - MSRailSignalControl::getInstance().addGreenFlankSwitch(li.myLink, driveway.myNumericalID); + MSRailSignalControl::getInstance().addGreenFlankSwitch(li.myLink, driveway.getNumericalID()); } #ifdef DEBUG_SIGNALSTATE if (gDebugFlag4) { @@ -186,18 +170,18 @@ MSRailSignal::updateCurrentPhase() { #endif state[li.myLink->getTLIndex()] = 'r'; } else { - DriveWay& driveway = li.myDriveways.front(); + const MSDriveWay& driveway = *li.myDriveways.front(); if (driveway.conflictLaneOccupied() || driveway.conflictLinkApproached()) { #ifdef DEBUG_SIGNALSTATE if (gDebugFlag4) { - std::cout << SIMTIME << " rsl=" << li.getID() << " red for default driveway (" << toString(driveway.myRoute) << ")\n"; + std::cout << SIMTIME << " rsl=" << li.getID() << " red for default driveway (" << toString(driveway.getRoute()) << ")\n"; } #endif state[li.myLink->getTLIndex()] = 'r'; } else { #ifdef DEBUG_SIGNALSTATE if (gDebugFlag4) { - std::cout << SIMTIME << " rsl=" << li.getID() << " green for default driveway (" << toString(driveway.myRoute) << ")\n"; + std::cout << SIMTIME << " rsl=" << li.getID() << " green for default driveway (" << toString(driveway.getRoute()) << ")\n"; } #endif } @@ -325,21 +309,6 @@ MSRailSignal::addLink(MSLink* link, MSLane* lane, int pos) { } -std::string -MSRailSignal::getTLLinkID(MSLink* link) { - return link->getTLLogic()->getID() + "_" + toString(link->getTLIndex()); -} - -std::string -MSRailSignal::getJunctionLinkID(MSLink* link) { - return link->getJunction()->getID() + "_" + toString(link->getIndex()); -} - -std::string -MSRailSignal::getClickableTLLinkID(MSLink* link) { - return "junction '" + link->getTLLogic()->getID() + "', link " + toString(link->getTLIndex()); -} - std::string MSRailSignal::describeLinks(std::vector links) { std::string result; @@ -349,51 +318,6 @@ MSRailSignal::describeLinks(std::vector links) { return result; } -std::string -MSRailSignal::formatVisitedMap(const LaneVisitedMap& visited) { - std::vector lanes(visited.size(), nullptr); - for (auto item : visited) { - lanes[item.second] = item.first; - } - return toString(lanes); -} - - -void -MSRailSignal::appendMapIndex(LaneVisitedMap& map, const MSLane* lane) { - // avoid undefined behavior from evaluation order - const int tmp = (int)map.size(); - map[lane] = tmp; -} - - -MSRailSignal::Approaching -MSRailSignal::getClosest(MSLink* link) { - assert(link->getApproaching().size() > 0); - double minDist = std::numeric_limits::max(); - auto closestIt = link->getApproaching().begin(); - for (auto apprIt = link->getApproaching().begin(); apprIt != link->getApproaching().end(); apprIt++) { - if (apprIt->second.dist < minDist) { - minDist = apprIt->second.dist; - closestIt = apprIt; - } - } - // maybe a parallel link has a closer vehicle - /* - for (MSLink* link2 : link->getLaneBefore()->getLinkCont()) { - if (link2 != link) { - for (auto apprIt2 = link2->getApproaching().begin(); apprIt2 != link2->getApproaching().end(); apprIt2++) { - if (apprIt2->second.dist < minDist) { - minDist = apprIt2->second.dist; - closestIt = apprIt2; - } - } - } - } - */ - return *closestIt; -} - void MSRailSignal::writeBlocks(OutputDevice& od) const { @@ -405,8 +329,8 @@ MSRailSignal::writeBlocks(OutputDevice& od) const { od.writeAttr(SUMO_ATTR_TLLINKINDEX, link->getTLIndex()); od.writeAttr(SUMO_ATTR_FROM, link->getLaneBefore()->getID()); od.writeAttr(SUMO_ATTR_TO, link->getViaLaneOrLane()->getID()); - for (const DriveWay& dw : li.myDriveways) { - dw.writeBlocks(od); + for (const MSDriveWay* dw : li.myDriveways) { + dw->writeBlocks(od); } od.closeTag(); // link } @@ -466,9 +390,9 @@ MSRailSignal::hasOncomingRailTraffic(MSLink* link, const MSVehicle* ego, bool& b const MSRailSignal* rs = dynamic_cast(link->getTLLogic()); if (rs != nullptr) { const LinkInfo& li = rs->myLinkInfos[link->getTLIndex()]; - for (const DriveWay& dw : li.myDriveways) { - //std::cout << SIMTIME << " hasOncomingRailTraffic link=" << getTLLinkID(link) << " dwRoute=" << toString(dw.myRoute) << " bidi=" << toString(dw.myBidi) << "\n"; - for (const MSLane* lane : dw.myBidi) { + for (const MSDriveWay* dw : li.myDriveways) { + //std::cout << SIMTIME << " hasOncomingRailTraffic link=" << getTLLinkID(link) << " dwRoute=" << toString(dw->getRoute()) << " bidi=" << toString(dw->myBidi) << "\n"; + for (const MSLane* lane : dw->getBidi()) { if (!lane->isEmpty()) { MSVehicle* veh = lane->getFirstAnyVehicle(); if (std::find(veh->getCurrentRouteEdge(), veh->getRoute().end(), bidi) != veh->getRoute().end()) { @@ -481,7 +405,7 @@ MSRailSignal::hasOncomingRailTraffic(MSLink* link, const MSVehicle* ego, bool& b } } } - for (const MSLane* lane : dw.myFlank) { + for (const MSLane* lane : dw->getFlank()) { if (!lane->isEmpty()) { MSVehicle* veh = lane->getFirstAnyVehicle(); if (std::find(veh->getCurrentRouteEdge(), veh->getRoute().end(), bidi) != veh->getRoute().end()) { @@ -494,20 +418,20 @@ MSRailSignal::hasOncomingRailTraffic(MSLink* link, const MSVehicle* ego, bool& b } } } - if (dw.myProtectingSwitchesBidi.size() > 0) { + if (dw->getProtectingSwitchesBidi().size() > 0) { #ifdef DEBUG_SIGNALSTATE gDebugFlag4 = DEBUG_HELPER(rs); #endif // yield to all foeLinks beyond switch Approaching approaching(ego, MSLink::ApproachingVehicleInformation(SIMSTEP, 0, 0, 0, false, 0, 0, std::numeric_limits::max(), 0, 0)); - for (MSLink* const switchLink : dw.myProtectingSwitchesBidi) { + for (MSLink* const switchLink : dw->getProtectingSwitchesBidi()) { myBlockingVehicles.clear(); myRivalVehicles.clear(); myPriorityVehicles.clear(); myConstraintInfo = ""; myStoreVehicles = true; - const bool hasProtection = dw.findProtection(approaching, switchLink); + const bool hasProtection = dw->findProtection(approaching, switchLink); myStoreVehicles = false; if (!hasProtection) { for (const SUMOVehicle* veh : myBlockingVehicles) { @@ -540,9 +464,9 @@ MSRailSignal::hasOncomingRailTraffic(MSLink* link, const MSVehicle* ego, bool& b gDebugFlag4 = false; #endif } - for (MSLink* foeLink : dw.myConflictLinks) { + for (MSLink* foeLink : dw->getConflictLinks()) { if (foeLink->getApproaching().size() != 0) { - Approaching closest = getClosest(foeLink); + Approaching closest = foeLink->getClosest(); const SUMOVehicle* veh = closest.first; if (veh->getSpeed() > 0 && closest.second.arrivalSpeedBraking > 0 && std::find(veh->getCurrentRouteEdge(), veh->getRoute().end(), bidi) != veh->getRoute().end()) { @@ -597,6 +521,12 @@ MSRailSignal::LinkInfo::LinkInfo(MSLink* link): reset(); } +MSRailSignal::LinkInfo::~LinkInfo() { + for (MSDriveWay* dw : myDriveways) { + delete dw; + } + myDriveways.clear(); +} void MSRailSignal::LinkInfo::reset() { @@ -612,7 +542,7 @@ MSRailSignal::LinkInfo::getID() const { } -MSRailSignal::DriveWay& +MSDriveWay& MSRailSignal::LinkInfo::getDriveWay(const SUMOVehicle* veh) { MSEdge* first = &myLink->getLane()->getEdge(); MSRouteIterator firstIt = std::find(veh->getCurrentRouteEdge(), veh->getRoute().end(), first); @@ -634,23 +564,23 @@ MSRailSignal::LinkInfo::getDriveWay(const SUMOVehicle* veh) { } } if (firstIt == veh->getRoute().end()) { - WRITE_WARNING("Invalid approach information to rail signal '" + getClickableTLLinkID(myLink) + "' after rerouting for vehicle '" + veh->getID() + WRITE_WARNING("Invalid approach information to rail signal '" + MSDriveWay::getClickableTLLinkID(myLink) + "' after rerouting for vehicle '" + veh->getID() + "' first driveway edge '" + first->getID() + "' time=" + time2string(MSNet::getInstance()->getCurrentTimeStep()) + "."); if (myDriveways.empty()) { ConstMSEdgeVector dummyRoute; dummyRoute.push_back(&myLink->getLane()->getEdge()); - DriveWay dw = buildDriveWay(dummyRoute.begin(), dummyRoute.end()); + MSDriveWay* dw = MSDriveWay::buildDriveWay(myLink, dummyRoute.begin(), dummyRoute.end()); myDriveways.push_back(dw); } - return myDriveways.front(); + return *myDriveways.front(); } //std::cout << SIMTIME << " veh=" << veh->getID() << " rsl=" << getID() << " dws=" << myDriveways.size() << "\n"; - for (DriveWay& dw : myDriveways) { + for (MSDriveWay* dw : myDriveways) { // @todo optimize: it is sufficient to check for specific edges (after each switch) auto itRoute = firstIt; - auto itDwRoute = dw.myRoute.begin(); + auto itDwRoute = dw->getRoute().begin(); bool match = true; - while (itRoute != veh->getRoute().end() && itDwRoute != dw.myRoute.end()) { + while (itRoute != veh->getRoute().end() && itDwRoute != dw->getRoute().end()) { if (*itRoute != *itDwRoute) { match = false; //std::cout << " check dw=" << " match failed at vehEdge=" << (*itRoute)->getID() << " dwEdge=" << (*itDwRoute)->getID() << "\n"; @@ -661,101 +591,21 @@ MSRailSignal::LinkInfo::getDriveWay(const SUMOVehicle* veh) { } // if the vehicle arrives before the end of this driveway, // we'd rather build a new driveway to avoid superfluous restrictions - if (match && itDwRoute == dw.myRoute.end() - && (itRoute == veh->getRoute().end() || dw.myFoundSignal || dw.myFoundReversal)) { + if (match && itDwRoute == dw->getRoute().end() + && (itRoute == veh->getRoute().end() || dw->foundSignal() || dw->foundReversal())) { //std::cout << " using dw=" << "\n"; - return dw; + return *dw; } #ifdef DEBUG_SELECT_DRIVEWAY - std::cout << SIMTIME << " rs=" << getID() << " veh=" << veh->getID() << " other dwSignal=" << dw.myFoundSignal << " dwRoute=" << toString(dw.myRoute) << " route=" << toString(veh->getRoute().getEdges()) << "\n"; + std::cout << SIMTIME << " rs=" << getID() << " veh=" << veh->getID() << " other dwSignal=" << dw->foundSignal() << " dwRoute=" << toString(dw->getRoute()) << " route=" << toString(veh->getRoute().getEdges()) << "\n"; #endif } - DriveWay dw = buildDriveWay(firstIt, veh->getRoute().end()); + MSDriveWay* dw = MSDriveWay::buildDriveWay(myLink, firstIt, veh->getRoute().end()); #ifdef DEBUG_SELECT_DRIVEWAY - std::cout << SIMTIME << " rs=" << getID() << " veh=" << veh->getID() << " new dwSignal=" << dw.myFoundSignal << " dwRoute=" << toString(dw.myRoute) << " route=" << toString(veh->getRoute().getEdges()) << "\n"; + std::cout << SIMTIME << " rs=" << getID() << " veh=" << veh->getID() << " new dwSignal=" << dw->foundSignal() << " dwRoute=" << toString(dw->getRoute()) << " route=" << toString(veh->getRoute().getEdges()) << "\n"; #endif myDriveways.push_back(dw); - return myDriveways.back(); -} - - -MSRailSignal::DriveWay -MSRailSignal::LinkInfo::buildDriveWay(MSRouteIterator first, MSRouteIterator end) { - // collect lanes and links that are relevant for setting this signal for the current driveWay - // For each driveway we collect - // - conflictLanes (signal must be red if any conflict lane is occupied) - // - conflictLinks (signal must be red if any conflict link is approached by a vehicle - // - that cannot break in time (arrivalSpeedBraking > 0) - // - approached by a vehicle with higher switching priority (see #3941) - // These objects are construct in steps: - // - // forwardBlock - // - search forward recursive from outgoing lane until controlled railSignal link found - // -> add all found lanes to conflictLanes - // - // bidiBlock (if any forwardBlock edge has bidi edge) - // - search bidi backward recursive until first switch - // - from switch search backward recursive all other incoming until controlled rail signal link - // -> add final links to conflictLinks - // - // flanks - // - search backward recursive from flanking switches - // until controlled railSignal link or protecting switch is found - // -> add all found lanes to conflictLanes - // -> add final links to conflictLinks - - DriveWay dw; - LaneVisitedMap visited; - std::vector before; - appendMapIndex(visited, myLink->getLaneBefore()); - MSLane* fromBidi = myLink->getLaneBefore()->getBidiLane(); - if (fromBidi != nullptr) { - // do not extend to forward block beyond the entering track (in case of a loop) - appendMapIndex(visited, fromBidi); - before.push_back(fromBidi); - } - dw.buildRoute(myLink, 0., first, end, visited); - if (dw.myProtectedBidi == nullptr) { - dw.myCoreSize = (int)dw.myRoute.size(); - } - dw.checkFlanks(myLink, dw.myForward, visited, true, dw.myFlankSwitches); - dw.checkFlanks(myLink, dw.myBidi, visited, false, dw.myFlankSwitches); - dw.checkFlanks(myLink, before, visited, true, dw.myFlankSwitches); - for (MSLink* link : dw.myFlankSwitches) { - //std::cout << getID() << " flankSwitch=" << link->getDescription() << "\n"; - dw.findFlankProtection(link, 0, visited, link, dw.myFlank); - } - std::vector flankSwitchesBidiExtended; - dw.checkFlanks(myLink, dw.myBidiExtended, visited, false, flankSwitchesBidiExtended); - for (MSLink* link : flankSwitchesBidiExtended) { - //std::cout << getID() << " flankSwitchBEx=" << link->getDescription() << "\n"; - dw.findFlankProtection(link, 0, visited, link, dw.myBidiExtended); - } - -#ifdef DEBUG_BUILD_DRIVEWAY - if (DEBUG_COND_LINKINFO) { - std::cout << " buildDriveWay railSignal=" << getID() - << "\n route=" << toString(dw.myRoute) - << "\n forward=" << toString(dw.myForward) - << "\n bidi=" << toString(dw.myBidi) - << "\n flank=" << toString(dw.myFlank) - << "\n flankSwitch=" << describeLinks(dw.myFlankSwitches) - << "\n protSwitch=" << describeLinks(dw.myProtectingSwitches) - << "\n coreSize=" << dw.myCoreSize - << "\n"; - } -#endif - MSRailSignal* rs = const_cast(static_cast(myLink->getTLLogic())); - if (!rs->myMovingBlock) { - dw.myConflictLanes.insert(dw.myConflictLanes.end(), dw.myForward.begin(), dw.myForward.end()); - } - dw.myConflictLanes.insert(dw.myConflictLanes.end(), dw.myBidi.begin(), dw.myBidi.end()); - dw.myConflictLanes.insert(dw.myConflictLanes.end(), dw.myFlank.begin(), dw.myFlank.end()); - if (dw.myProtectedBidi != nullptr) { - MSRailSignalControl::getInstance().registerProtectedDriveway(rs, dw.myNumericalID, dw.myProtectedBidi); - } - - return dw; + return *myDriveways.back(); } @@ -791,725 +641,6 @@ MSRailSignal::LinkInfo::reroute(SUMOVehicle* veh, const MSEdgeVector& occupied) } -// =========================================================================== -// DriveWay method definitions -// =========================================================================== - -bool -MSRailSignal::DriveWay::reserve(const Approaching& closest, MSEdgeVector& occupied) { - std::string joinVehicle = ""; - if (!MSGlobals::gUseMesoSim) { - const SUMOVehicleParameter::Stop* stop = closest.first->getNextStopParameter(); - if (stop != nullptr) { - joinVehicle = stop->join; - } - } - if (conflictLaneOccupied(joinVehicle, true, closest.first)) { - for (const MSLane* bidi : myBidi) { - if (!bidi->empty() && bidi->getBidiLane() != nullptr) { - occupied.push_back(&bidi->getBidiLane()->getEdge()); - } - } -#ifdef DEBUG_SIGNALSTATE - if (gDebugFlag4) { - std::cout << " conflictLaneOccupied by=" << toString(myBlockingVehicles) << " ego=" << Named::getIDSecure(closest.first) << "\n"; - } -#endif - return false; - } - for (MSLink* link : myProtectingSwitches) { - if (!findProtection(closest, link)) { -#ifdef DEBUG_SIGNALSTATE - if (gDebugFlag4) { - std::cout << " no protection at switch " << link->getDescription() << "\n"; - } -#endif - return false; - } - } - for (MSLink* foeLink : myConflictLinks) { - if (hasLinkConflict(closest, foeLink)) { -#ifdef DEBUG_SIGNALSTATE - if (gDebugFlag4) { - std::cout << " linkConflict with " << getTLLinkID(foeLink) << "\n"; - } -#endif - return false; - } - } - if (deadlockLaneOccupied()) { - return false; - } - myActive = closest.first; - return true; -} - - -bool -MSRailSignal::DriveWay::conflictLinkApproached() const { - for (MSLink* foeLink : myConflictLinks) { - if (foeLink->getApproaching().size() > 0) { -#ifdef DEBUG_SIGNALSTATE - if (gDebugFlag4) { - std::cout << SIMTIME << " foeLink=" << foeLink->getDescription() << " approachedBy=" << foeLink->getApproaching().begin()->first->getID() << "\n"; - } -#endif - return true; - } - } - return false; -} - - -bool -MSRailSignal::DriveWay::hasLinkConflict(const Approaching& veh, MSLink* foeLink) const { -#ifdef DEBUG_SIGNALSTATE_PRIORITY - if (gDebugFlag4) { - std::cout << " checkLinkConflict foeLink=" << getTLLinkID(foeLink) << "\n"; - } -#endif - if (foeLink->getApproaching().size() > 0) { - Approaching foe = getClosest(foeLink); -#ifdef DEBUG_SIGNALSTATE_PRIORITY - if (gDebugFlag4) { - std::cout << " approaching foe=" << foe.first->getID() << "\n"; - } -#endif - const MSTrafficLightLogic* foeTLL = foeLink->getTLLogic(); - assert(foeTLL != nullptr); - const MSRailSignal* constFoeRS = dynamic_cast(foeTLL); - MSRailSignal* foeRS = const_cast(constFoeRS); - if (foeRS != nullptr) { - const DriveWay& foeDriveWay = foeRS->myLinkInfos[foeLink->getTLIndex()].getDriveWay(foe.first); - if (foeDriveWay.conflictLaneOccupied("", false, foe.first) || - foeDriveWay.deadlockLaneOccupied(false) || - !foeRS->constraintsAllow(foe.first) || - !overlap(foeDriveWay)) { -#ifdef DEBUG_SIGNALSTATE_PRIORITY - if (gDebugFlag4) { - if (foeDriveWay.conflictLaneOccupied("", false, foe.first)) { - std::cout << " foe blocked\n"; - } else if (!foeRS->constraintsAllow(foe.first)) { - std::cout << " foe constrained\n"; - } else { - std::cout << " no overlap\n"; - } - } -#endif - return false; - } -#ifdef DEBUG_SIGNALSTATE_PRIORITY - if (gDebugFlag4) { - std::cout - << " aSB=" << veh.second.arrivalSpeedBraking << " foeASB=" << foe.second.arrivalSpeedBraking - << " aT=" << veh.second.arrivalTime << " foeAT=" << foe.second.arrivalTime - << " aS=" << veh.first->getSpeed() << " foeS=" << foe.first->getSpeed() - << " aD=" << veh.second.dist << " foeD=" << foe.second.dist - << " aW=" << veh.first->getWaitingTime() << " foeW=" << foe.first->getWaitingTime() - << " aN=" << veh.first->getNumericalID() << " foeN=" << foe.first->getNumericalID() - << "\n"; - } -#endif - const bool yield = mustYield(veh, foe); - if (myStoreVehicles) { - myRivalVehicles.push_back(foe.first); - if (yield) { - myPriorityVehicles.push_back(foe.first); - } - } - return yield; - } - } - return false; -} - - -bool -MSRailSignal::DriveWay::mustYield(const Approaching& veh, const Approaching& foe) { - if (foe.second.arrivalSpeedBraking == veh.second.arrivalSpeedBraking) { - if (foe.second.arrivalTime == veh.second.arrivalTime) { - if (foe.first->getSpeed() == veh.first->getSpeed()) { - if (foe.second.dist == veh.second.dist) { - if (foe.first->getWaitingTime() == veh.first->getWaitingTime()) { - return foe.first->getNumericalID() < veh.first->getNumericalID(); - } else { - return foe.first->getWaitingTime() > veh.first->getWaitingTime(); - } - } else { - return foe.second.dist < veh.second.dist; - } - } else { - return foe.first->getSpeed() > veh.first->getSpeed(); - } - } else { - return foe.second.arrivalTime < veh.second.arrivalTime; - } - } else { - return foe.second.arrivalSpeedBraking > veh.second.arrivalSpeedBraking; - } -} - - -bool -MSRailSignal::DriveWay::conflictLaneOccupied(const std::string& joinVehicle, bool store, const SUMOVehicle* ego) const { - for (const MSLane* lane : myConflictLanes) { - if (!lane->isEmpty()) { -#ifdef DEBUG_SIGNALSTATE - if (gDebugFlag4) { - std::cout << SIMTIME << " conflictLane " << lane->getID() << " occupied ego=" << Named::getIDSecure(ego) << " vehNumber=" << lane->getVehicleNumber() << "\n"; - if (joinVehicle != "") { - std::cout << " joinVehicle=" << joinVehicle << " occupant=" << toString(lane->getVehiclesSecure()) << "\n"; - lane->releaseVehicles(); - } - } -#endif - if (lane->getVehicleNumberWithPartials() == 1) { - MSVehicle* foe = lane->getLastAnyVehicle(); - if (joinVehicle != "") { - if (foe->getID() == joinVehicle && foe->isStopped()) { -#ifdef DEBUG_SIGNALSTATE - if (gDebugFlag4) { - std::cout << " ignore join-target '" << joinVehicle << "\n"; - } -#endif - continue; - } - } - if (ego != nullptr) { - if (foe == ego && std::find(myBidi.begin(), myBidi.end(), lane) != myBidi.end()) { -#ifdef DEBUG_SIGNALSTATE - if (gDebugFlag4) { - std::cout << " ignore ego as oncoming '" << ego->getID() << "\n"; - } -#endif - continue; - } - if (foe->isStopped() && foe->getNextStopParameter()->join == ego->getID()) { -#ifdef DEBUG_SIGNALSTATE - if (gDebugFlag4) { - std::cout << " ignore " << foe->getID() << " for which ego is join-target\n"; - } -#endif - continue; - } - } - } - if (myStoreVehicles && store) { - myBlockingVehicles.push_back(lane->getLastAnyVehicle()); - } - return true; - } - } - return false; -} - -bool -MSRailSignal::DriveWay::deadlockLaneOccupied(bool store) const { - for (const MSLane* lane : myBidiExtended) { - if (!lane->empty()) { - assert(myBidi.size() != 0); - const MSEdge* lastBidi = myBidi.back()->getNextNormal(); - MSVehicle* foe = lane->getVehiclesSecure().front(); -#ifdef DEBUG_SIGNALSTATE - if (gDebugFlag4) { - std::cout << " check for deadlock with " << foe->getID() << "\n"; - } -#endif - // check of foe will enter myBidi (need to check at most - // myBidiExtended.size edges) - const int minEdges = (int)myBidiExtended.size(); - auto foeIt = foe->getCurrentRouteEdge() + 1; - auto foeEnd = foe->getRoute().end(); - bool conflict = false; - for (int i = 0; i < minEdges && foeIt != foeEnd; i++) { - if ((*foeIt) == lastBidi) { -#ifdef DEBUG_SIGNALSTATE - if (gDebugFlag4) { - std::cout << " vehicle will enter " << lastBidi->getID() << "\n"; - } -#endif - conflict = true; - break; - } - foeIt++; - } - lane->releaseVehicles(); - if (conflict) { - if (myStoreVehicles && store) { - myBlockingVehicles.push_back(foe); - } - return true; - } - } - } - return false; -} - - -bool -MSRailSignal::DriveWay::findProtection(const Approaching& veh, MSLink* link) const { - double flankApproachingDist = std::numeric_limits::max(); - if (link->getApproaching().size() > 0) { - Approaching closest = getClosest(link); - flankApproachingDist = closest.second.dist; - } -#ifdef DEBUG_FIND_PROTECTION - if (gDebugFlag4) { - std::cout << SIMTIME << " findProtection for link=" << link->getDescription() << " flankApproachingDist=" << flankApproachingDist << "\n"; - } -#endif - for (MSLink* l2 : link->getLaneBefore()->getLinkCont()) { - if (l2->getLane() != link->getLane()) { -#ifdef DEBUG_FIND_PROTECTION - if (gDebugFlag4) { - std::cout << " protectionCandidate=" << l2->getDescription() << " l2Via=" << Named::getIDSecure(l2->getViaLane()) - << " occupied=" << (l2->getViaLane() != nullptr && !l2->getViaLane()->isEmpty()) << "\n"; - } -#endif - if (l2->getViaLane() != nullptr && !l2->getViaLane()->isEmpty()) { -#ifdef DEBUG_FIND_PROTECTION - if (gDebugFlag4) { - std::cout << " protection from internal=" << l2->getViaLane()->getID() << "\n"; - } -#endif - return true; - } - if (l2->getApproaching().size() > 0) { - Approaching closest2 = getClosest(l2); - if (closest2.second.dist < flankApproachingDist) { -#ifdef DEBUG_FIND_PROTECTION - if (gDebugFlag4) { - std::cout << " protection from veh=" << closest2.first->getID() << "\n"; - } -#endif - return true; - } - } - } - } - if (link->getApproaching().size() == 0) { - return true; - } else { - // find protection further upstream - DriveWay tmp(true); - const MSLane* before = link->getLaneBefore(); - tmp.myFlank.push_back(before); - LaneVisitedMap visited; - for (auto ili : before->getIncomingLanes()) { - tmp.findFlankProtection(ili.viaLink, myMaxFlankLength, visited, ili.viaLink, tmp.myFlank); - } - tmp.myConflictLanes = tmp.myFlank; - tmp.myRoute = myRoute; - tmp.myCoreSize = myCoreSize; - MSEdgeVector occupied; - if (gDebugFlag4) std::cout << SIMTIME << " tmpDW flank=" << toString(tmp.myFlank) - << " protSwitch=" << describeLinks(tmp.myProtectingSwitches) << " cLinks=" << describeLinks(tmp.myConflictLinks) << "\n"; - return tmp.reserve(veh, occupied); - } -} - - -bool -MSRailSignal::DriveWay::overlap(const DriveWay& other) const { - for (int i = 0; i < myCoreSize; i++) { - for (int j = 0; j < other.myCoreSize; j++) { - const MSEdge* edge = myRoute[i]; - const MSEdge* edge2 = other.myRoute[j]; - if (edge->getToJunction() == edge2->getToJunction() - || edge->getToJunction() == edge2->getFromJunction()) { - // XXX might be rail_crossing with parallel tracks - return true; - } - } - } - return false; -} - -bool -MSRailSignal::DriveWay::flankConflict(const DriveWay& other) const { - for (const MSLane* lane : myForward) { - for (const MSLane* lane2 : other.myForward) { - if (lane == lane2) { - return true; - } - } - for (const MSLane* lane2 : other.myBidi) { - if (lane == lane2) { - return true; - } - } - } - return false; -} - -void -MSRailSignal::DriveWay::writeBlocks(OutputDevice& od) const { - od.openTag("driveWay"); - od.writeAttr(SUMO_ATTR_EDGES, toString(myRoute)); - if (myCoreSize != (int)myRoute.size()) { - od.writeAttr("core", myCoreSize); - } - od.openTag("forward"); - od.writeAttr(SUMO_ATTR_LANES, toString(myForward)); - od.closeTag(); - od.openTag("bidi"); - od.writeAttr(SUMO_ATTR_LANES, toString(myBidi)); - if (myBidiExtended.size() > 0) { - od.lf(); - od << " "; - od.writeAttr("deadlockCheck", toString(myBidiExtended)); - } - od.closeTag(); - od.openTag("flank"); - od.writeAttr(SUMO_ATTR_LANES, toString(myFlank)); - od.closeTag(); - - od.openTag("protectingSwitches"); - std::vector links; - for (MSLink* link : myProtectingSwitches) { - links.push_back(getJunctionLinkID(link)); - } - od.writeAttr("links", joinToString(links, " ")); - od.closeTag(); - - od.openTag("conflictLinks"); - std::vector signals; - for (MSLink* link : myConflictLinks) { - signals.push_back(getTLLinkID(link)); - } - od.writeAttr("signals", joinToString(signals, " ")); - od.closeTag(); - od.closeTag(); // driveWay -} - - -void -MSRailSignal::DriveWay::buildRoute(MSLink* origin, double length, - MSRouteIterator next, MSRouteIterator end, - LaneVisitedMap& visited) { - bool seekForwardSignal = true; - bool seekBidiSwitch = true; - bool foundUnsafeSwitch = false; - MSLane* toLane = origin->getViaLaneOrLane(); -#ifdef DEBUG_DRIVEWAY_BUILDROUTE - gDebugFlag4 = DEBUG_HELPER(origin->getTLLogic()); - if (gDebugFlag4) std::cout << "buildRoute origin=" << getTLLinkID(origin) << " vehRoute=" << toString(ConstMSEdgeVector(next, end)) - << " visited=" << formatVisitedMap(visited) << "\n"; -#endif - while ((seekForwardSignal || seekBidiSwitch)) { - if (length > MAX_BLOCK_LENGTH) { - if (myNumWarnings < MAX_SIGNAL_WARNINGS) { - WRITE_WARNING("Block after rail signal " + getClickableTLLinkID(origin) + - " exceeds maximum length (stopped searching after edge '" + toLane->getEdge().getID() + "' (length=" + toString(length) + "m)."); - } - myNumWarnings++; - // length exceeded - return; - } -#ifdef DEBUG_DRIVEWAY_BUILDROUTE - if (gDebugFlag4) { - std::cout << " toLane=" << toLane->getID() << " visited=" << formatVisitedMap(visited) << "\n"; - } -#endif - if (visited.count(toLane) != 0) { - WRITE_WARNINGF(TL("Found circular block after railSignal % (% edges, length %)"), getClickableTLLinkID(origin), toString(myRoute.size()), toString(length)); - //std::cout << getClickableTLLinkID(origin) << " circularBlock1=" << toString(myRoute) << " visited=" << formatVisitedMap(visited) << "\n"; - return; - } - if (toLane->getEdge().isNormal()) { - myRoute.push_back(&toLane->getEdge()); - if (next != end) { - next++; - } - } - appendMapIndex(visited, toLane); - length += toLane->getLength(); - MSLane* bidi = toLane->getBidiLane(); - if (seekForwardSignal) { - if (!foundUnsafeSwitch) { - myForward.push_back(toLane); - } - } else if (bidi == nullptr) { - seekBidiSwitch = false; -#ifdef DEBUG_DRIVEWAY_BUILDROUTE - if (gDebugFlag4) { - std::cout << " noBidi, abort search for bidiSwitch\n"; - } -#endif - } - if (bidi != nullptr) { - if (foundUnsafeSwitch) { - myBidiExtended.push_back(bidi); - } else { - myBidi.push_back(bidi); - } - appendMapIndex(visited, bidi); - if (!seekForwardSignal) { - // look for switch that could protect from oncoming vehicles - for (const auto& ili : bidi->getIncomingLanes()) { - if (ili.viaLink->getDirection() == LinkDirection::TURN) { - continue; - } - for (const MSLink* const link : ili.lane->getLinkCont()) { - if (link->getDirection() == LinkDirection::TURN) { - continue; - } - if (link->getViaLaneOrLane() != bidi) { - // this switch is special beause it still lies on the current route - //myProtectingSwitches.push_back(ili.viaLink); - const MSEdge* const bidiNext = bidi->getNextNormal(); - myCoreSize = (int)myRoute.size(); - if (MSRailSignalControl::getInstance().getUsedEdges().count(bidiNext) == 0) { -#ifdef DEBUG_DRIVEWAY_BUILDROUTE - if (gDebugFlag4) { - std::cout << " abort: found protecting switch " << ili.viaLink->getDescription() << "\n"; - } -#endif - // if bidi is actually used by a train (rather than - // the other route) we must later adapt this driveway for additional checks (myBidiExtended) - myProtectedBidi = bidiNext; - std::set visitedEdges; - for (auto item : visited) { - visitedEdges.insert(&item.first->getEdge()); - } - while (next != end && visitedEdges.count(*next) == 0) { - // the driveway is route specific but only but stop recording if it loops back on itself - visitedEdges.insert(*next); - const MSEdge* nextBidi = (*next)->getBidiEdge(); - if (nextBidi != nullptr) { - visitedEdges.insert(nextBidi); - } - myRoute.push_back(*next); - next++; - } - return; - } else { -#ifdef DEBUG_DRIVEWAY_BUILDROUTE - if (gDebugFlag4) { - std::cout << " found unsafe switch " << ili.viaLink->getDescription() << " (used=" << bidiNext->getID() << ")\n"; - } -#endif - // trains along our route beyond this switch - // might create deadlock - foundUnsafeSwitch = true; - // the switch itself must still be guarded to ensure safety - for (const auto& ili2 : bidi->getIncomingLanes()) { - if (ili2.viaLink->getDirection() != LinkDirection::TURN) { - myFlankSwitches.push_back(ili.viaLink); - } - } - } - } - } - } - } - } - const std::vector& links = toLane->getLinkCont(); - const MSEdge* current = &toLane->getEdge(); - toLane = nullptr; - for (const MSLink* const link : links) { - if ((next != end && &link->getLane()->getEdge() == *next) - && isRailway(link->getViaLaneOrLane()->getPermissions())) { - toLane = link->getViaLaneOrLane(); - if (link->getLane()->getBidiLane() != nullptr && &link->getLane()->getEdge() == current->getBidiEdge()) { - // do not follow turn-arounds even if the route contains a reversal -#ifdef DEBUG_DRIVEWAY_BUILDROUTE - if (gDebugFlag4) { - std::cout << " abort: turn-around\n"; - } -#endif - myFoundReversal = true; - return; - } - if (link->getTLLogic() != nullptr) { - if (link->getTLLogic() == origin->getTLLogic()) { - WRITE_WARNINGF(TL("Found circular block at railSignal % (% edges, length %)"), getClickableTLLinkID(origin), toString(myRoute.size()), toString(length)); - //std::cout << getClickableTLLinkID(origin) << " circularBlock2=" << toString(myRoute) << "\n"; - return; - } - seekForwardSignal = false; - myFoundSignal = true; - seekBidiSwitch = bidi != nullptr; -#ifdef DEBUG_DRIVEWAY_BUILDROUTE - if (gDebugFlag4) { - std::cout << " found forwardSignal " << link->getTLLogic()->getID() << " seekBidiSwitch=" << seekBidiSwitch << "\n"; - } -#endif - } - break; - } - } - if (toLane == nullptr) { - if (next != end) { - // no connection found, jump to next route edge - toLane = (*next)->getLanes()[0]; -#ifdef DEBUG_DRIVEWAY_BUILDROUTE - if (gDebugFlag4) { - std::cout << " abort: turn-around or jump\n"; - } -#endif - myFoundReversal = true; - return; - } else { -#ifdef DEBUG_DRIVEWAY_BUILDROUTE - if (gDebugFlag4) { - std::cout << " abort: no next lane available\n"; - } -#endif - return; - } - } - } -} - - -void -MSRailSignal::DriveWay::checkFlanks(const MSLink* originLink, const std::vector& lanes, const LaneVisitedMap& visited, bool allFoes, std::vector& flankSwitches) const { -#ifdef DEBUG_CHECK_FLANKS - std::cout << " checkFlanks lanes=" << toString(lanes) << "\n visited=" << formatVisitedMap(visited) << " allFoes=" << allFoes << "\n"; -#endif - const MSLink* reverseOriginLink = originLink->getLane()->getBidiLane() != nullptr && originLink->getLaneBefore()->getBidiLane() != nullptr - ? originLink->getLane()->getBidiLane()->getLinkTo(originLink->getLaneBefore()->getBidiLane()) - : nullptr; - //std::cout << " originLink=" << originLink->getDescription() << "\n"; - if (reverseOriginLink != nullptr) { - reverseOriginLink = reverseOriginLink->getCorrespondingExitLink(); - //std::cout << " reverseOriginLink=" << reverseOriginLink->getDescription() << "\n"; - } - for (int i = 0; i < (int)lanes.size(); i++) { - const MSLane* lane = lanes[i]; - const MSLane* prev = i > 0 ? lanes[i - 1] : nullptr; - const MSLane* next = i + 1 < (int)lanes.size() ? lanes[i + 1] : nullptr; - if (lane->isInternal()) { - continue; - } - for (auto ili : lane->getIncomingLanes()) { - if (ili.viaLink == originLink - || ili.viaLink == reverseOriginLink - || ili.viaLink->getDirection() == LinkDirection::TURN - || ili.viaLink->getDirection() == LinkDirection::TURN_LEFTHAND) { - continue; - } - if (ili.lane != prev && ili.lane != next) { -#ifdef DEBUG_CHECK_FLANKS - std::cout << " add flankSwitch junction=" << ili.viaLink->getJunction()->getID() << " index=" << ili.viaLink->getIndex() << " iLane=" << ili.lane->getID() << " prev=" << Named::getIDSecure(prev) << " targetLane=" << lane->getID() << " next=" << Named::getIDSecure(next) << "\n"; -#endif - flankSwitches.push_back(ili.viaLink); - } else if (allFoes) { - // link is part of the driveway, find foes that cross the driveway without entering - checkCrossingFlanks(ili.viaLink, visited, flankSwitches); - } - } - } -} - - -void -MSRailSignal::DriveWay::checkCrossingFlanks(MSLink* dwLink, const LaneVisitedMap& visited, std::vector& flankSwitches) const { -#ifdef DEBUG_CHECK_FLANKS - std::cout << " checkCrossingFlanks dwLink=" << dwLink->getDescription() << " visited=" << formatVisitedMap(visited) << "\n"; -#endif - const MSJunction* junction = dwLink->getJunction(); - if (junction == nullptr) { - return; // unregulated junction; - } - const MSJunctionLogic* logic = junction->getLogic(); - if (logic == nullptr) { - return; // unregulated junction; - } - for (const MSEdge* in : junction->getIncoming()) { - if (in->isInternal()) { - continue; - } - for (MSLane* inLane : in->getLanes()) { - if (isRailway(inLane->getPermissions()) && visited.count(inLane) == 0) { - for (MSLink* link : inLane->getLinkCont()) { - if (link->getIndex() >= 0 && logic->getFoesFor(dwLink->getIndex()).test(link->getIndex()) - && visited.count(link->getLane()) == 0) { -#ifdef DEBUG_CHECK_FLANKS - std::cout << " add crossing flankSwitch junction=" << junction->getID() << " index=" << link->getIndex() << "\n"; -#endif - if (link->getViaLane() == nullptr) { - flankSwitches.push_back(link); - } else { - flankSwitches.push_back(link->getViaLane()->getLinkCont().front()); - } - } - } - } - } - } -} - -void -MSRailSignal::DriveWay::findFlankProtection(MSLink* link, double length, LaneVisitedMap& visited, MSLink* origLink, std::vector& flank) { -#ifdef DEBUG_CHECK_FLANKS - std::cout << " findFlankProtection link=" << link->getDescription() << " length=" << length << " origLink=" << origLink->getDescription() << "\n"; -#endif - if (link->getTLLogic() != nullptr) { - // guarded by signal -#ifdef DEBUG_CHECK_FLANKS - std::cout << " flank guarded by " << link->getTLLogic()->getID() << "\n"; -#endif - myConflictLinks.push_back(link); - } else if (length > MAX_BLOCK_LENGTH) { - // length exceeded - if (myNumWarnings < MAX_SIGNAL_WARNINGS) { - WRITE_WARNING("Incoming block at junction '" + origLink->getJunction()->getID() + "', link " + toString(origLink->getIndex()) + " exceeds maximum length (stopped searching after lane '" + link->getLane()->getID() + "' (length=" + toString(length) + "m)."); - } - myNumWarnings++; - } else { - // find normal lane before this link - const MSLane* lane = link->getLaneBefore(); - const bool isNew = visited.count(lane) == 0; - if (isNew || (visited[lane] > visited[origLink->getLane()] && std::find(myForward.begin(), myForward.end(), lane) == myForward.end())) { - if (isNew) { - appendMapIndex(visited, lane); - } - length += lane->getLength(); - if (lane->isInternal()) { - flank.push_back(lane); - findFlankProtection(lane->getIncomingLanes().front().viaLink, length, visited, origLink, flank); - } else { - bool foundPSwitch = false; - for (MSLink* l2 : lane->getLinkCont()) { -#ifdef DEBUG_CHECK_FLANKS - std::cout << " lane=" << lane->getID() << " visitedIndex=" << visited[lane] << " origIndex=" << visited[origLink->getLane()] << " cand=" << l2->getDescription() << "\n"; -#endif - if (l2->getDirection() != LinkDirection::TURN && l2->getLane() != link->getLane()) { - foundPSwitch = true; - // found potential protection -#ifdef DEBUG_CHECK_FLANKS - std::cout << " protectingSwitch=" << l2->getDescription() << " for flank=" << link->getDescription() << "\n"; -#endif - myProtectingSwitches.push_back(link); - if (std::find(myBidi.begin(), myBidi.end(), origLink->getLane()) != myBidi.end()) { -#ifdef DEBUG_CHECK_FLANKS - std::cout << " (is bidi-switch)\n"; -#endif - myProtectingSwitchesBidi.push_back(link); - } - } - } - if (!foundPSwitch) { - flank.push_back(lane); - // continue search for protection upstream recursively - for (auto ili : lane->getIncomingLanes()) { - if (ili.viaLink->getDirection() != LinkDirection::TURN) { - findFlankProtection(ili.viaLink, length, visited, origLink, flank); - } - } - } - } - } else { -#ifdef DEBUG_CHECK_FLANKS - std::cout << " laneBefore=" << lane->getID() << " already visited. index=" << visited[lane] << " origAfter=" << origLink->getLane()->getID() << " origIndex=" << visited[origLink->getLane()] << "\n"; -#endif - } - } - myMaxFlankLength = MAX2(myMaxFlankLength, length); -} - void MSRailSignal::storeTraCIVehicles(int linkIndex) { myBlockingVehicles.clear(); @@ -1519,15 +650,15 @@ MSRailSignal::storeTraCIVehicles(int linkIndex) { myStoreVehicles = true; LinkInfo& li = myLinkInfos[linkIndex]; if (li.myLink->getApproaching().size() > 0) { - Approaching closest = getClosest(li.myLink); - DriveWay& driveway = li.getDriveWay(closest.first); + Approaching closest = li.myLink->getClosest(); + MSDriveWay& driveway = li.getDriveWay(closest.first); MSEdgeVector occupied; // call for side effects driveway.reserve(closest, occupied); constraintsAllow(closest.first); } else if (li.myDriveways.size() > 0) { - li.myDriveways.front().conflictLaneOccupied(); - li.myDriveways.front().conflictLinkApproached(); + li.myDriveways.front()->conflictLaneOccupied(); + li.myDriveways.front()->conflictLinkApproached(); } myStoreVehicles = false; } @@ -1556,33 +687,38 @@ MSRailSignal::getConstraintInfo(int linkIndex) { return myConstraintInfo; } -const MSRailSignal::DriveWay& +const MSDriveWay& MSRailSignal::retrieveDriveWay(int numericalID) const { for (const LinkInfo& li : myLinkInfos) { - for (const DriveWay& dw : li.myDriveways) { - if (dw.myNumericalID == numericalID) { - return dw; + for (const MSDriveWay* dw : li.myDriveways) { + if (dw->getNumericalID() == numericalID) { + return *dw; } } } throw ProcessError("Invalid driveway id " + toString(numericalID) + " at railSignal '" + getID() + "'"); } +const MSDriveWay& +MSRailSignal::retrieveDriveWayForVeh(int tlIndex, const SUMOVehicle* veh) { + return myLinkInfos[tlIndex].getDriveWay(veh); +} void MSRailSignal::updateDriveway(int numericalID) { for (LinkInfo& li : myLinkInfos) { for (auto it = li.myDriveways.begin(); it != li.myDriveways.end(); it++) { - const DriveWay& dw = *it; - if (dw.myNumericalID == numericalID) { + const MSDriveWay& dw = *it; + if (dw.getNumericalID() == numericalID) { #ifdef DEBUG_DRIVEWAY_UPDATE std::cout << SIMTIME << " rail signal junction '" << getID() << "' requires update for driveway " << numericalID << "\n"; #endif - std::vector route = dw.myRoute; + std::vector route = dw.getRoute(); + delete *it; li.myDriveways.erase(it); if (li.myDriveways.size() == 0) { // rebuild default driveway - li.myDriveways.push_back(li.buildDriveWay(route.begin(), route.end())); + li.myDriveways.push_back(MSDriveWay::buildDriveWay(li.myLink, route.begin(), route.end())); } return; } diff --git a/src/microsim/traffic_lights/MSRailSignal.h b/src/microsim/traffic_lights/MSRailSignal.h index 699228dcc5bf..43cb0914ec99 100644 --- a/src/microsim/traffic_lights/MSRailSignal.h +++ b/src/microsim/traffic_lights/MSRailSignal.h @@ -34,6 +34,7 @@ class MSLink; class MSPhaseDefinition; class MSRailSignalConstraint; +class MSDriveWay; // =========================================================================== @@ -252,156 +253,39 @@ class MSRailSignal : public MSTrafficLightLogic { static void initDriveWays(const SUMOVehicle* ego, bool update); typedef std::pair Approaching; - typedef std::set LaneSet; typedef std::map LaneVisitedMap; - /* The driveways (Fahrstrassen) for each link index - * Each link index has at least one driveway - * A driveway describes one possible route that passes the signal up - * the next secure point - * When a signal guards a switch (indirect guard) that signal stores two - * or more driveways - */ - struct DriveWay { + /* @brief retrieve driveway with the given numerical id + * @note: throws exception if the driveway does not exist at this rail signal */ + const MSDriveWay& retrieveDriveWay(int numericalID) const; - /// @brief Constructor - DriveWay(bool temporary = false) : - myNumericalID(temporary ? -1 : myDriveWayIndex++), - myMaxFlankLength(0), - myActive(nullptr), - myProtectedBidi(nullptr), - myCoreSize(0), - myFoundSignal(false), - myFoundReversal(false) - {} - - /// @brief global driveway index - int myNumericalID; - - /// @brief the maximum flank length searched while building this driveway - double myMaxFlankLength; + const MSDriveWay& retrieveDriveWayForVeh(int tlIndex, const SUMOVehicle* veh); - /// @brief whether the current signal is switched green for a train approaching this block - const SUMOVehicle* myActive; - - /// @brief switch assumed safe from bidi-traffic - const MSEdge* myProtectedBidi; - - /// @brief list of edges for matching against train routes - std::vector myRoute; - - /// @brief number of edges in myRoute where overlap with other driveways is forbidden - int myCoreSize; - - /// @brief whether this driveway ends its forward section with a rail signal (and thus comprises a full block) - bool myFoundSignal; - bool myFoundReversal; - - /* @brief the actual driveway part up to the next railsignal (halting position) - * This must be free of other trains */ - std::vector myForward; - - /* @brief the list of bidirectional edges that can enter the forward - * section and which must also be free of traffic - * (up to the first element that could give protection) */ - std::vector myBidi; - - /* @brief the list of bidirectional edges that can enter the forward - * section and which might contain deadlock-relevant traffic */ - std::vector myBidiExtended; - - /* @brief the list of edges that merge with the forward section - * (found via backward search, up to the first element that could give protection) */ - std::vector myFlank; - - /// @brief the lanes that must be clear of trains before this signal can switch to green - std::vector myConflictLanes; - - /* @brief the list of switches that threaten the driveway and for which protection must be found - */ - std::vector myFlankSwitches; - - /* @brief the list of (first) switches that could give protection from oncoming/flanking vehicles - * if any of them fails to do so, upstream search must be performed - * until protection or conflict is found - */ - std::vector myProtectingSwitches; - /// @brief subset of myProtectingSwitches that protects from oncoming trains - std::vector myProtectingSwitchesBidi; - - /* The conflict links for this block - * Conflict resolution must be performed if vehicles are approaching the - * current link and any of the conflict links */ - std::vector myConflictLinks; - - /// @brief whether any of myConflictLanes is occupied (vehicles that are the target of a join must be ignored) - bool conflictLaneOccupied(const std::string& joinVehicle = "", bool store = true, const SUMOVehicle* ego = nullptr) const; - - /// @brief whether any of myBidiExtended is occupied by a vehicle that targets myBidi - bool deadlockLaneOccupied(bool store = true) const; - - /// @brief attempt reserve this driveway for the given vehicle - bool reserve(const Approaching& closest, MSEdgeVector& occupied); - - /// @brief Whether the approaching vehicle is prevent from driving by another vehicle approaching the given link - bool hasLinkConflict(const Approaching& closest, MSLink* foeLink) const; - - /// @brief Whether veh must yield to the foe train - static bool mustYield(const Approaching& veh, const Approaching& foe); - - /// @brief Whether any of the conflict links have approaching vehicles - bool conflictLinkApproached() const; - - /// @brief find protection for the given vehicle starting at a switch - bool findProtection(const Approaching& veh, MSLink* link) const; - - /// @brief Wether this driveway (route) overlaps with the given one - bool overlap(const DriveWay& other) const; - - /// @brief Wether there is a flank conflict with the given driveway - bool flankConflict(const DriveWay& other) const; - - /// @brief Write block items for this driveway - void writeBlocks(OutputDevice& od) const; - - /* @brief determine route that identifies this driveway (a subset of the - * vehicle route) - * collects: - * myRoute - * myForward - * myBidi - * myProtectedBidi - * - * returns edge that is assumed to safe from oncoming-deadlock or nullptr - */ - void buildRoute(MSLink* origin, double length, MSRouteIterator next, MSRouteIterator end, LaneVisitedMap& visited); + /// @brief whether the given vehicle is free to drive + bool constraintsAllow(const SUMOVehicle* veh) const; - /* @brief find switches that threaten this driveway - * @param[out] flankSwitches collect the switches - */ - void checkFlanks(const MSLink* originLink, const std::vector& lanes, const LaneVisitedMap& visited, bool allFoes, std::vector& flankSwitches) const; + bool isMovingBlock() const { + return myMovingBlock; + } - /* @brief find links that cross the driveway without entering it - * @param[out] flankSwitches collect the switches - */ - void checkCrossingFlanks(MSLink* dwLink, const LaneVisitedMap& visited, std::vector& flankSwitches) const; - - /* @brief find upstream protection from the given link - * @param[out] flank: the stored flank lanes - */ - void findFlankProtection(MSLink* link, double length, LaneVisitedMap& visited, MSLink* origLink, std::vector& flank); - }; + static bool storeVehicles() { + return myStoreVehicles; + } - /* @brief retrieve driveway with the given numerical id - * @note: throws exception if the driveway does not exist at this rail signal */ - const DriveWay& retrieveDriveWay(int numericalID) const; + static VehicleVector& blockingVehicles() { + return myBlockingVehicles; + } - /// @brief get the closest vehicle approaching the given link - static Approaching getClosest(MSLink* link); + static VehicleVector& rivalVehicles() { + return myRivalVehicles; + } -protected: - /// @brief whether the given vehicle is free to drive - bool constraintsAllow(const SUMOVehicle* veh) const; + static VehicleVector& priorityVehicles() { + return myPriorityVehicles; + } + + /// @brief print link descriptions + static std::string describeLinks(std::vector links); protected: @@ -411,19 +295,19 @@ class MSRailSignal : public MSTrafficLightLogic { /// @brief constructor LinkInfo(MSLink* link); + /// @brief Destructor + ~LinkInfo(); + MSLink* myLink; /// @brief all driveways immediately following this link - std::vector myDriveways; + std::vector myDriveways; /// @brief return id for this railsignal-link std::string getID() const; /// @brief retrieve an existing Driveway or construct a new driveway based on the vehicles route - DriveWay& getDriveWay(const SUMOVehicle*); - - /// @brief construct a new driveway by searching along the given route until all block structures are found - DriveWay buildDriveWay(MSRouteIterator first, MSRouteIterator end); + MSDriveWay& getDriveWay(const SUMOVehicle*); /// @brief try rerouting vehicle if reservation failed void reroute(SUMOVehicle* veh, const MSEdgeVector& occupied); @@ -438,24 +322,6 @@ class MSRailSignal : public MSTrafficLightLogic { /// @brief data storage for every link at this node (more than one when directly guarding a switch) std::vector myLinkInfos; - /// @brief return logicID_linkIndex - static std::string getTLLinkID(MSLink* link); - - /// @brief return junctionID_junctionLinkIndex - static std::string getJunctionLinkID(MSLink* link); - - /// @brief return logicID_linkIndex in a way that allows clicking in sumo-gui - static std::string getClickableTLLinkID(MSLink* link); - - /// @brief print link descriptions - static std::string describeLinks(std::vector links); - - /// @brief print link descriptions - static std::string formatVisitedMap(const LaneVisitedMap& visited); - - /// @brief append to map by map index and avoid undefined behavior - static void appendMapIndex(LaneVisitedMap& map, const MSLane* lane); - protected: /** @brief The list of phases this logic uses @@ -476,10 +342,6 @@ class MSRailSignal : public MSTrafficLightLogic { /// @brief map from tripId to constraint list std::map > myConstraints; - static int myNumWarnings; - - static int myDriveWayIndex; - protected: /// @brief update vehicle lists for traci calls void storeTraCIVehicles(int linkIndex); diff --git a/src/microsim/traffic_lights/MSRailSignalControl.cpp b/src/microsim/traffic_lights/MSRailSignalControl.cpp index 2048ef52b8bf..6251fa621473 100644 --- a/src/microsim/traffic_lights/MSRailSignalControl.cpp +++ b/src/microsim/traffic_lights/MSRailSignalControl.cpp @@ -27,6 +27,7 @@ #include #include #include "MSRailSignal.h" +#include "MSDriveWay.h" #include "MSRailSignalControl.h" @@ -130,8 +131,8 @@ MSRailSignalControl::recheckGreen() { // new driveway pair const MSRailSignal* rs = static_cast(item.first->getTLLogic()); const MSRailSignal* rs2 = static_cast(item2.first->getTLLogic()); - const MSRailSignal::DriveWay& dw = rs->retrieveDriveWay(item.second); - const MSRailSignal::DriveWay& dw2 = rs2->retrieveDriveWay(item2.second); + const MSDriveWay& dw = rs->retrieveDriveWay(item.second); + const MSDriveWay& dw2 = rs2->retrieveDriveWay(item2.second); // overlap may return true if the driveways are consecutive forward sections conflict = dw.flankConflict(dw2) || dw2.flankConflict(dw); myDriveWayCompatibility[code] = conflict; @@ -142,9 +143,9 @@ MSRailSignalControl::recheckGreen() { if (conflict) { MSRailSignal* rs = const_cast(static_cast(item.first->getTLLogic())); MSRailSignal* rs2 = const_cast(static_cast(item2.first->getTLLogic())); - const MSRailSignal::Approaching& veh = rs->getClosest(item.first); - const MSRailSignal::Approaching& veh2 = rs2->getClosest(item2.first); - if (MSRailSignal::DriveWay::mustYield(veh, veh2)) { + const MSRailSignal::Approaching& veh = item.first->getClosest(); + const MSRailSignal::Approaching& veh2 = item2.first->getClosest(); + if (MSDriveWay::mustYield(veh, veh2)) { std::string state = rs->getCurrentPhaseDef().getState(); state[item.first->getTLIndex()] = 'r'; const_cast(rs->getCurrentPhaseDef()).setState(state); From 991a16047281fa8130e36d1ca531db7caddef0bd Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 6 Jun 2024 10:08:54 +0200 Subject: [PATCH 003/334] tweaking debug code --- src/microsim/traffic_lights/MSRailSignalControl.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/microsim/traffic_lights/MSRailSignalControl.cpp b/src/microsim/traffic_lights/MSRailSignalControl.cpp index 6251fa621473..7eed0d528a7d 100644 --- a/src/microsim/traffic_lights/MSRailSignalControl.cpp +++ b/src/microsim/traffic_lights/MSRailSignalControl.cpp @@ -81,6 +81,9 @@ MSRailSignalControl::vehicleStateChanged(const SUMOVehicle* const vehicle, MSNet for (const MSEdge* edge : vehicle->getRoute().getEdges()) { myUsedEdges.insert(edge); if (myProtectedDriveways.count(edge) != 0) { +#ifdef DEBUG_REGISTER_DRIVEWAY + std::cout << "MSRailSignalControl edge=" << edge->getID() << " used by vehicle " << vehicle->getID() << ". Updating " << myProtectedDriveways[edge].size() << " driveways\n"; +#endif updateDriveways(edge); } } From 88bdf24382d389886c109ce708bf700155cc3c28 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 6 Jun 2024 10:32:50 +0200 Subject: [PATCH 004/334] fixing driveway update. #7578 --- src/microsim/traffic_lights/MSRailSignal.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/microsim/traffic_lights/MSRailSignal.cpp b/src/microsim/traffic_lights/MSRailSignal.cpp index 884cadddfbf9..08bb74be187e 100644 --- a/src/microsim/traffic_lights/MSRailSignal.cpp +++ b/src/microsim/traffic_lights/MSRailSignal.cpp @@ -708,12 +708,12 @@ void MSRailSignal::updateDriveway(int numericalID) { for (LinkInfo& li : myLinkInfos) { for (auto it = li.myDriveways.begin(); it != li.myDriveways.end(); it++) { - const MSDriveWay& dw = *it; - if (dw.getNumericalID() == numericalID) { + const MSDriveWay* dw = *it; + if (dw->getNumericalID() == numericalID) { #ifdef DEBUG_DRIVEWAY_UPDATE std::cout << SIMTIME << " rail signal junction '" << getID() << "' requires update for driveway " << numericalID << "\n"; #endif - std::vector route = dw.getRoute(); + std::vector route = dw->getRoute(); delete *it; li.myDriveways.erase(it); if (li.myDriveways.size() == 0) { From 0f0361a8cfb7910624a70d6fa748ff0e3bb38d19 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 6 Jun 2024 12:33:01 +0200 Subject: [PATCH 005/334] tweaking debug code --- src/microsim/MSVehicle.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/microsim/MSVehicle.cpp b/src/microsim/MSVehicle.cpp index bd3532b71c39..7e39ed246bb1 100644 --- a/src/microsim/MSVehicle.cpp +++ b/src/microsim/MSVehicle.cpp @@ -103,6 +103,7 @@ //#define DEBUG_REVERSE_BIDI //#define DEBUG_EXTRAPOLATE_DEPARTPOS //#define DEBUG_REMOTECONTROL +//#define DEBUG_MOVEREMINDERS //#define DEBUG_COND (getID() == "ego") //#define DEBUG_COND (true) #define DEBUG_COND (isSelected()) @@ -5772,6 +5773,15 @@ MSVehicle::leaveLaneBack(const MSMoveReminder::Notification reason, const MSLane rem = myMoveReminders.erase(rem); } } +#ifdef DEBUG_MOVEREMINDERS + if (DEBUG_COND) { + std::cout << SIMTIME << " veh=" << getID() << " myReminders:"; + for (auto rem : myMoveReminders) { + std::cout << rem.first->getDescription() << " "; + } + std::cout << "\n"; + } +#endif } From 0825f8501ad3dc1dd1743c847609401431a06022 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 6 Jun 2024 12:37:16 +0200 Subject: [PATCH 006/334] fixed crash due to invalid moveReminder management. refs #7578 (now all internal tests are working) --- src/microsim/MSLane.cpp | 12 +++++++ src/microsim/MSLane.h | 8 +++++ src/microsim/traffic_lights/MSDriveWay.cpp | 37 ++++++++++++++++++---- src/microsim/traffic_lights/MSDriveWay.h | 2 +- 4 files changed, 52 insertions(+), 7 deletions(-) diff --git a/src/microsim/MSLane.cpp b/src/microsim/MSLane.cpp index 880771f0fe5d..f2946c607ab7 100644 --- a/src/microsim/MSLane.cpp +++ b/src/microsim/MSLane.cpp @@ -356,6 +356,18 @@ MSLane::addMoveReminder(MSMoveReminder* rem) { } +void +MSLane::removeMoveReminder(MSMoveReminder* rem) { + auto it = std::find(myMoveReminders.begin(), myMoveReminders.end(), rem); + if (it != myMoveReminders.end()) { + myMoveReminders.erase(it); + for (MSVehicle* const veh : myVehicles) { + veh->removeReminder(rem); + } + } +} + + double MSLane::setPartialOccupation(MSVehicle* v) { // multithreading: there are concurrent writes to myNeedsCollisionCheck but all of them should set it to true diff --git a/src/microsim/MSLane.h b/src/microsim/MSLane.h index e473a0d4ce9e..26a933f189b9 100644 --- a/src/microsim/MSLane.h +++ b/src/microsim/MSLane.h @@ -309,6 +309,14 @@ class MSLane : public Named, public Parameterised { virtual void addMoveReminder(MSMoveReminder* rem); + /** @brief Remove a move-reminder from move-reminder container + * + * The move reminder will not be deleted by the lane. + * @param[in] rem The move reminder to remvoe + */ + virtual void removeMoveReminder(MSMoveReminder* rem); + + /** @brief Return the list of this lane's move reminders * @return Previously added move reminder */ diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 03b98d063b2f..b06bcd641aad 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -69,8 +69,23 @@ MSDriveWay::MSDriveWay(bool temporary) : myFoundReversal(false) {} + +MSDriveWay::~MSDriveWay() { + for (SUMOVehicle* veh : myTrains) { + MSBaseVehicle* bVeh = dynamic_cast(veh); + bVeh->removeReminder(this); + } + for (const MSLane* lane : myForward) { + const_cast(lane)->removeMoveReminder(this); + } +} + + bool -MSDriveWay::notifyEnter(SUMOTrafficObject& veh, Notification /*reason*/, const MSLane* /*enteredLane*/) { +MSDriveWay::notifyEnter(SUMOTrafficObject& veh, Notification reason, const MSLane* enteredLane) { + UNUSED_PARAMETER(reason); + UNUSED_PARAMETER(enteredLane); + //std::cout << SIMTIME << " notifyEnter " << getDescription() << " veh=" << veh.getID() << " lane=" << enteredLane->getID() << " reason=" << reason << "\n"; if (veh.isVehicle()) { myTrains.insert(&dynamic_cast(veh)); return true; @@ -81,10 +96,15 @@ MSDriveWay::notifyEnter(SUMOTrafficObject& veh, Notification /*reason*/, const M bool -MSDriveWay::notifyLeave(SUMOTrafficObject& veh, double /*lastPos*/, Notification reason, const MSLane* /*enteredLane*/) { +MSDriveWay::notifyLeave(SUMOTrafficObject& veh, double /*lastPos*/, Notification reason, const MSLane* enteredLane) { + UNUSED_PARAMETER(reason); + UNUSED_PARAMETER(enteredLane); + //std::cout << SIMTIME << " notifyLeave " << getDescription() << " veh=" << veh.getID() << " lane=" << Named::getIDSecure(enteredLane) << " reason=" << toString(reason) << "\n"; if (veh.isVehicle()) { - if (reason != MSMoveReminder::NOTIFICATION_JUNCTION) { + // leaving network with departure, teleport etc + if (reason != MSMoveReminder::NOTIFICATION_JUNCTION && reason != MSMoveReminder::NOTIFICATION_SEGMENT) { myTrains.erase(&dynamic_cast(veh)); + //std::cout << " removed\n"; return false; } else { return true; @@ -96,11 +116,14 @@ MSDriveWay::notifyLeave(SUMOTrafficObject& veh, double /*lastPos*/, Notification bool -MSDriveWay::notifyLeaveBack(SUMOTrafficObject& veh, Notification /*reason*/, const MSLane* leftLane) { +MSDriveWay::notifyLeaveBack(SUMOTrafficObject& veh, Notification reason, const MSLane* leftLane) { + UNUSED_PARAMETER(reason); + UNUSED_PARAMETER(leftLane); + //std::cout << SIMTIME << " notifyLeaveBack " << getDescription() << " veh=" << veh.getID() << " lane=" << Named::getIDSecure(leftLane) << " reason=" << toString(reason) << "\n"; if (veh.isVehicle()) { - // leaving network with departure, teleport etc if (leftLane == myForward.back()) { myTrains.erase(&dynamic_cast(veh)); + //std::cout << " removed\n"; return false; } else { return true; @@ -544,7 +567,9 @@ MSDriveWay::buildRoute(const MSLink* origin, double length, if (seekForwardSignal) { if (!foundUnsafeSwitch) { myForward.push_back(toLane); - toLane->addMoveReminder(this); + if (myForward.size() == 1) { + toLane->addMoveReminder(this); + } } } else if (bidi == nullptr) { seekBidiSwitch = false; diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h index 078e9b48f977..566da105e1d0 100644 --- a/src/microsim/traffic_lights/MSDriveWay.h +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -52,7 +52,7 @@ class MSDriveWay : public MSMoveReminder { MSDriveWay(bool temporary = false); /// @brief Destructor - virtual ~MSDriveWay() {}; + virtual ~MSDriveWay(); bool notifyEnter(SUMOTrafficObject& veh, Notification reason, const MSLane* enteredLane); bool notifyLeave(SUMOTrafficObject& veh, double lastPos, Notification reason, const MSLane* enteredLane = 0); From 49d98e204732cbd178daa72e5fc133ee2eec4430 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 6 Jun 2024 15:18:21 +0200 Subject: [PATCH 007/334] fix #14990 --- src/microsim/MSFrame.cpp | 3 ++ src/microsim/MSNet.cpp | 27 ++++++++---- src/microsim/traffic_lights/MSDriveWay.cpp | 43 +++++++++++++++++++- src/microsim/traffic_lights/MSDriveWay.h | 15 +++++++ src/microsim/traffic_lights/MSRailSignal.cpp | 8 +++- src/microsim/traffic_lights/MSRailSignal.h | 2 +- 6 files changed, 85 insertions(+), 13 deletions(-) diff --git a/src/microsim/MSFrame.cpp b/src/microsim/MSFrame.cpp index f4a7a05e62c9..55ba1f129f7a 100644 --- a/src/microsim/MSFrame.cpp +++ b/src/microsim/MSFrame.cpp @@ -278,6 +278,9 @@ MSFrame::fillOptions() { oc.doRegister("railsignal-block-output", new Option_FileName()); oc.addDescription("railsignal-block-output", "Output", TL("Save railsignal-blocks into FILE")); + oc.doRegister("railsignal-vehicle-output", new Option_FileName()); + oc.addDescription("railsignal-vehicle-output", "Output", TL("Record entry and exit times of vehicles for railsignal blocks into FILE")); + oc.doRegister("bt-output", new Option_FileName()); oc.addDescription("bt-output", "Output", TL("Save bluetooth visibilities into FILE (in conjunction with device.btreceiver and device.btsender)")); diff --git a/src/microsim/MSNet.cpp b/src/microsim/MSNet.cpp index 3973da773f36..dea8ba6b032d 100644 --- a/src/microsim/MSNet.cpp +++ b/src/microsim/MSNet.cpp @@ -93,6 +93,7 @@ #include #include #include +#include #include #include #include @@ -191,6 +192,7 @@ MSNet::initStatic() { if (!MSGlobals::gUseMesoSim) { MSVehicle::Influencer::init(); } + MSDriveWay::init(); } void @@ -692,9 +694,7 @@ MSNet::closeSimulation(SUMOTime start, const std::string& reason) { if (OptionsCont::getOptions().isSet("substations-output")) { writeSubstationOutput(); } - if (OptionsCont::getOptions().isSet("railsignal-block-output")) { - writeRailSignalBlocks(); - } + writeRailSignalBlocks(); const long now = SysUtils::getCurrentMillis(); if (myLogExecutionTime || OptionsCont::getOptions().getBool("duration-log.statistics")) { WRITE_MESSAGE(generateStatistics(start, now)); @@ -1407,11 +1407,22 @@ MSNet::writeChargingStationOutput() const { void MSNet::writeRailSignalBlocks() const { - OutputDevice& output = OutputDevice::getDeviceByOption("railsignal-block-output"); - for (auto tls : myLogics->getAllLogics()) { - MSRailSignal* rs = dynamic_cast(tls); - if (rs != nullptr) { - rs->writeBlocks(output); + if (OptionsCont::getOptions().isSet("railsignal-block-output")) { + OutputDevice& output = OutputDevice::getDeviceByOption("railsignal-block-output"); + for (auto tls : myLogics->getAllLogics()) { + MSRailSignal* rs = dynamic_cast(tls); + if (rs != nullptr) { + rs->writeBlocks(output, false); + } + } + } + if (OptionsCont::getOptions().isSet("railsignal-vehicle-output")) { + OutputDevice& output = OutputDevice::getDeviceByOption("railsignal-vehicle-output"); + for (auto tls : myLogics->getAllLogics()) { + MSRailSignal* rs = dynamic_cast(tls); + if (rs != nullptr) { + rs->writeBlocks(output, true); + } } } } diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index b06bcd641aad..d704eba4c351 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -51,7 +51,21 @@ // =========================================================================== int MSDriveWay::myDriveWayIndex(0); int MSDriveWay::myNumWarnings(0); +bool MSDriveWay::myWriteVehicles(false); +// --------------------------------------------------------------------------- +// static initialisation methods +// --------------------------------------------------------------------------- +void +MSDriveWay::init() { + const OptionsCont& oc = OptionsCont::getOptions(); + if (oc.isSet("railsignal-vehicle-output")) { + OutputDevice::createDeviceByOption("railsignal-vehicle-output"); + myWriteVehicles = true; + } else { + myWriteVehicles = false; + } +} // =========================================================================== // MSDriveWay method definitions @@ -88,6 +102,9 @@ MSDriveWay::notifyEnter(SUMOTrafficObject& veh, Notification reason, const MSLan //std::cout << SIMTIME << " notifyEnter " << getDescription() << " veh=" << veh.getID() << " lane=" << enteredLane->getID() << " reason=" << reason << "\n"; if (veh.isVehicle()) { myTrains.insert(&dynamic_cast(veh)); + if (myWriteVehicles) { + myVehicleEvents.push_back(VehicleEvent(SIMSTEP, true, veh.getID(), reason)); + } return true; } else { return false; @@ -104,7 +121,9 @@ MSDriveWay::notifyLeave(SUMOTrafficObject& veh, double /*lastPos*/, Notification // leaving network with departure, teleport etc if (reason != MSMoveReminder::NOTIFICATION_JUNCTION && reason != MSMoveReminder::NOTIFICATION_SEGMENT) { myTrains.erase(&dynamic_cast(veh)); - //std::cout << " removed\n"; + if (myWriteVehicles) { + myVehicleEvents.push_back(VehicleEvent(SIMSTEP, false, veh.getID(), reason)); + } return false; } else { return true; @@ -123,7 +142,9 @@ MSDriveWay::notifyLeaveBack(SUMOTrafficObject& veh, Notification reason, const M if (veh.isVehicle()) { if (leftLane == myForward.back()) { myTrains.erase(&dynamic_cast(veh)); - //std::cout << " removed\n"; + if (myWriteVehicles) { + myVehicleEvents.push_back(VehicleEvent(SIMSTEP, false, veh.getID(), reason)); + } return false; } else { return true; @@ -484,6 +505,9 @@ MSDriveWay::flankConflict(const MSDriveWay& other) const { void MSDriveWay::writeBlocks(OutputDevice& od) const { od.openTag("driveWay"); + if (myWriteVehicles) { + od.writeAttr(SUMO_ATTR_ID, myNumericalID); + } od.writeAttr(SUMO_ATTR_EDGES, toString(myRoute)); if (myCoreSize != (int)myRoute.size()) { od.writeAttr("core", myCoreSize); @@ -522,6 +546,21 @@ MSDriveWay::writeBlocks(OutputDevice& od) const { } +void +MSDriveWay::writeBlockVehicles(OutputDevice& od) const { + od.openTag("driveWay"); + od.writeAttr(SUMO_ATTR_ID, myNumericalID); + for (const VehicleEvent& ve : myVehicleEvents) { + od.openTag(ve.isEntry ? "entry" : "exit"); + od.writeAttr(SUMO_ATTR_ID, ve.id); + od.writeAttr(SUMO_ATTR_TIME, time2string(ve.time)); + od.writeAttr("reason", ve.reason); + od.closeTag(); // event + } + od.closeTag(); // driveWay +} + + void MSDriveWay::buildRoute(const MSLink* origin, double length, MSRouteIterator next, MSRouteIterator end, diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h index 566da105e1d0..cfdbd4ebe7f3 100644 --- a/src/microsim/traffic_lights/MSDriveWay.h +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -75,6 +75,7 @@ class MSDriveWay : public MSMoveReminder { /// @brief Write block items for this driveway void writeBlocks(OutputDevice& od) const; + void writeBlockVehicles(OutputDevice& od) const; const std::vector& getRoute() const { return myRoute; @@ -108,6 +109,8 @@ class MSDriveWay : public MSMoveReminder { return myFoundReversal; } + static void init(); + /// @brief Whether veh must yield to the foe train static bool mustYield(const Approaching& veh, const Approaching& foe); @@ -229,8 +232,20 @@ class MSDriveWay : public MSMoveReminder { private: std::set myTrains; + + struct VehicleEvent { + VehicleEvent(SUMOTime _time, bool _isEntry, const std::string& _id, Notification _reason): + time(_time), isEntry(_isEntry), id(_id), reason(_reason) {} + SUMOTime time; + bool isEntry; + std::string id; + Notification reason; + }; + std::vector myVehicleEvents; + static int myDriveWayIndex; static int myNumWarnings; + static bool myWriteVehicles; }; diff --git a/src/microsim/traffic_lights/MSRailSignal.cpp b/src/microsim/traffic_lights/MSRailSignal.cpp index 08bb74be187e..41996adc202a 100644 --- a/src/microsim/traffic_lights/MSRailSignal.cpp +++ b/src/microsim/traffic_lights/MSRailSignal.cpp @@ -320,7 +320,7 @@ MSRailSignal::describeLinks(std::vector links) { void -MSRailSignal::writeBlocks(OutputDevice& od) const { +MSRailSignal::writeBlocks(OutputDevice& od, bool writeVehicles) const { od.openTag("railSignal"); od.writeAttr(SUMO_ATTR_ID, getID()); for (const LinkInfo& li : myLinkInfos) { @@ -330,7 +330,11 @@ MSRailSignal::writeBlocks(OutputDevice& od) const { od.writeAttr(SUMO_ATTR_FROM, link->getLaneBefore()->getID()); od.writeAttr(SUMO_ATTR_TO, link->getViaLaneOrLane()->getID()); for (const MSDriveWay* dw : li.myDriveways) { - dw->writeBlocks(od); + if (writeVehicles) { + dw->writeBlockVehicles(od); + } else { + dw->writeBlocks(od); + } } od.closeTag(); // link } diff --git a/src/microsim/traffic_lights/MSRailSignal.h b/src/microsim/traffic_lights/MSRailSignal.h index 43cb0914ec99..002eaaa8b003 100644 --- a/src/microsim/traffic_lights/MSRailSignal.h +++ b/src/microsim/traffic_lights/MSRailSignal.h @@ -221,7 +221,7 @@ class MSRailSignal : public MSTrafficLightLogic { std::string getConstraintInfo() const; /// @brief write rail signal block output for all links and driveways - void writeBlocks(OutputDevice& od) const; + void writeBlocks(OutputDevice& od, bool writeVehicles) const; /// @brief register constraint for signal switching void addConstraint(const std::string& tripId, MSRailSignalConstraint* constraint); From 53ca2c131c2e440bcc8c474b6096d7ace50cdfcb Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 6 Jun 2024 15:18:33 +0200 Subject: [PATCH 008/334] added test refs #14990, #21 --- tests/sumo/config.sumo | 2 + tests/sumo/rail/interlocking/options.sumo | 1 + .../rail/interlocking/railsignalblocks.sumo | 17 ++--- .../rail/interlocking/railsignalvehs.sumo | 65 +++++++++++++++++++ 4 files changed, 77 insertions(+), 8 deletions(-) create mode 100644 tests/sumo/rail/interlocking/railsignalvehs.sumo diff --git a/tests/sumo/config.sumo b/tests/sumo/config.sumo index 6a019171ad95..5735487adcfd 100644 --- a/tests/sumo/config.sumo +++ b/tests/sumo/config.sumo @@ -92,6 +92,7 @@ binstate:state.sbx calibrator_log:calibrator.log.xml links:linkstate.xml railsignalblocks:railsignal_blocks.xml +railsignalvehs:railsignal_vehicles.xml dispatchinfos:dispatchinfos.xml aggregated60Prefixed:pre_aggregated_60.xml tripinfosPrefix:pre_tripinfos.xml @@ -145,6 +146,7 @@ battery: chargingstations: links: railsignalblocks: +railsignalvehs: dispatchinfos: ssm: ssm2: diff --git a/tests/sumo/rail/interlocking/options.sumo b/tests/sumo/rail/interlocking/options.sumo index d1f933c11130..17b9db196dfa 100644 --- a/tests/sumo/rail/interlocking/options.sumo +++ b/tests/sumo/rail/interlocking/options.sumo @@ -1 +1,2 @@ -e 16678 -b 16000 --no-step-log --no-duration-log --net-file=net.net.xml --fcd-output fcd.xml --routes=input_routes.rou.xml --additional-files input_additional.add.xml +--railsignal-vehicle-output railsignal_vehicles.xml diff --git a/tests/sumo/rail/interlocking/railsignalblocks.sumo b/tests/sumo/rail/interlocking/railsignalblocks.sumo index bff3e74302a5..96780133e6be 100644 --- a/tests/sumo/rail/interlocking/railsignalblocks.sumo +++ b/tests/sumo/rail/interlocking/railsignalblocks.sumo @@ -1,6 +1,6 @@ - @@ -116,6 +116,7 @@ + @@ -578,7 +579,6 @@ - diff --git a/tests/sumo/meta/write_template_commented_full/cfg.sumo b/tests/sumo/meta/write_template_commented_full/cfg.sumo index 9859ea869557..98f1f348610c 100644 --- a/tests/sumo/meta/write_template_commented_full/cfg.sumo +++ b/tests/sumo/meta/write_template_commented_full/cfg.sumo @@ -1,6 +1,6 @@ - @@ -240,6 +240,9 @@ + + + @@ -1338,9 +1341,6 @@ - - - diff --git a/tests/sumo/meta/write_template_full/cfg.sumo b/tests/sumo/meta/write_template_full/cfg.sumo index b434f0e21804..684a55b0ed5a 100644 --- a/tests/sumo/meta/write_template_full/cfg.sumo +++ b/tests/sumo/meta/write_template_full/cfg.sumo @@ -1,6 +1,6 @@ - @@ -88,6 +88,7 @@ + @@ -502,7 +503,6 @@ - From 13ad45d7b3f7e829b4907690f1766901c469ce50 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 6 Jun 2024 15:29:28 +0200 Subject: [PATCH 010/334] addendum to avoid superfluous events. refs #14990 --- src/microsim/MSMoveReminder.h | 2 +- src/microsim/traffic_lights/MSDriveWay.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/microsim/MSMoveReminder.h b/src/microsim/MSMoveReminder.h index d69c05468199..6bbd51aef57f 100644 --- a/src/microsim/MSMoveReminder.h +++ b/src/microsim/MSMoveReminder.h @@ -292,7 +292,7 @@ class MSMoveReminder { protected: /// @brief Lane on which the reminder works - MSLane* const myLane; + MSLane* myLane; /// @brief a description of this moveReminder std::string myDescription; diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index d704eba4c351..53e82c716bb7 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -100,7 +100,7 @@ MSDriveWay::notifyEnter(SUMOTrafficObject& veh, Notification reason, const MSLan UNUSED_PARAMETER(reason); UNUSED_PARAMETER(enteredLane); //std::cout << SIMTIME << " notifyEnter " << getDescription() << " veh=" << veh.getID() << " lane=" << enteredLane->getID() << " reason=" << reason << "\n"; - if (veh.isVehicle()) { + if (veh.isVehicle() && enteredLane == myLane && (reason == NOTIFICATION_DEPARTED || reason == NOTIFICATION_JUNCTION)) { myTrains.insert(&dynamic_cast(veh)); if (myWriteVehicles) { myVehicleEvents.push_back(VehicleEvent(SIMSTEP, true, veh.getID(), reason)); @@ -607,6 +607,7 @@ MSDriveWay::buildRoute(const MSLink* origin, double length, if (!foundUnsafeSwitch) { myForward.push_back(toLane); if (myForward.size() == 1) { + myLane = toLane; toLane->addMoveReminder(this); } } From 18f7bbb6f7d7f2b25703b0383203acfbf6fb8a41 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 6 Jun 2024 15:29:35 +0200 Subject: [PATCH 011/334] patching expected results refs #21, #14990 --- .../sumo/rail/interlocking/railsignalvehs.sumo | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/tests/sumo/rail/interlocking/railsignalvehs.sumo b/tests/sumo/rail/interlocking/railsignalvehs.sumo index 1f073e7b7e6b..84742e14440d 100644 --- a/tests/sumo/rail/interlocking/railsignalvehs.sumo +++ b/tests/sumo/rail/interlocking/railsignalvehs.sumo @@ -2,17 +2,11 @@ - - - - - - @@ -21,18 +15,12 @@ - - - - - - @@ -41,9 +29,6 @@ - - - @@ -51,14 +36,12 @@ - - From b78b543fe7352f8209d21a058470a0de8a7bf0cb Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 6 Jun 2024 16:26:35 +0200 Subject: [PATCH 012/334] added test refs #14990, #21 --- .../rail/overlapping_driveways/errors.sumo | 0 .../input_routes.rou.xml | 21 +++ .../rail/overlapping_driveways/net.net.xml | 121 ++++++++++++++++++ .../rail/overlapping_driveways/options.sumo | 2 + .../rail/overlapping_driveways/output.sumo | 0 .../railsignalblocks.sumo | 92 +++++++++++++ .../railsignalblocks.sumo.meso | 121 ++++++++++++++++++ .../overlapping_driveways/railsignalvehs.sumo | 56 ++++++++ tests/sumo/rail/testsuite.sumo | 4 +- 9 files changed, 416 insertions(+), 1 deletion(-) create mode 100644 tests/sumo/rail/overlapping_driveways/errors.sumo create mode 100644 tests/sumo/rail/overlapping_driveways/input_routes.rou.xml create mode 100644 tests/sumo/rail/overlapping_driveways/net.net.xml create mode 100644 tests/sumo/rail/overlapping_driveways/options.sumo create mode 100644 tests/sumo/rail/overlapping_driveways/output.sumo create mode 100644 tests/sumo/rail/overlapping_driveways/railsignalblocks.sumo create mode 100644 tests/sumo/rail/overlapping_driveways/railsignalblocks.sumo.meso create mode 100644 tests/sumo/rail/overlapping_driveways/railsignalvehs.sumo diff --git a/tests/sumo/rail/overlapping_driveways/errors.sumo b/tests/sumo/rail/overlapping_driveways/errors.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/overlapping_driveways/input_routes.rou.xml b/tests/sumo/rail/overlapping_driveways/input_routes.rou.xml new file mode 100644 index 000000000000..bcb7e3ac2a59 --- /dev/null +++ b/tests/sumo/rail/overlapping_driveways/input_routes.rou.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/overlapping_driveways/net.net.xml b/tests/sumo/rail/overlapping_driveways/net.net.xml new file mode 100644 index 000000000000..68f2581445f0 --- /dev/null +++ b/tests/sumo/rail/overlapping_driveways/net.net.xml @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/overlapping_driveways/options.sumo b/tests/sumo/rail/overlapping_driveways/options.sumo new file mode 100644 index 000000000000..aeb315cdf1d9 --- /dev/null +++ b/tests/sumo/rail/overlapping_driveways/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml --routes=input_routes.rou.xml +--railsignal-vehicle-output railsignal_vehicles.xml diff --git a/tests/sumo/rail/overlapping_driveways/output.sumo b/tests/sumo/rail/overlapping_driveways/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/overlapping_driveways/railsignalblocks.sumo b/tests/sumo/rail/overlapping_driveways/railsignalblocks.sumo new file mode 100644 index 000000000000..a5c1c4e3a593 --- /dev/null +++ b/tests/sumo/rail/overlapping_driveways/railsignalblocks.sumo @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/overlapping_driveways/railsignalblocks.sumo.meso b/tests/sumo/rail/overlapping_driveways/railsignalblocks.sumo.meso new file mode 100644 index 000000000000..1e31798e5563 --- /dev/null +++ b/tests/sumo/rail/overlapping_driveways/railsignalblocks.sumo.meso @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/overlapping_driveways/railsignalvehs.sumo b/tests/sumo/rail/overlapping_driveways/railsignalvehs.sumo new file mode 100644 index 000000000000..b81851781f7c --- /dev/null +++ b/tests/sumo/rail/overlapping_driveways/railsignalvehs.sumo @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/testsuite.sumo b/tests/sumo/rail/testsuite.sumo index a4040b1e20ff..7259afe16404 100644 --- a/tests/sumo/rail/testsuite.sumo +++ b/tests/sumo/rail/testsuite.sumo @@ -19,6 +19,9 @@ headonconflict # Tests interlocked block signalling interlocking +# test vehicle-on-driveway registration +overlapping_driveways + # speed when passing tracks with different speed limits slow_fast_slow @@ -64,4 +67,3 @@ crossing # test for various types of train collision collision - From 2004838cf5d764585f84ce23a9232aeb7cc285cd Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 6 Jun 2024 16:59:37 +0200 Subject: [PATCH 013/334] refactoring refs #12 --- src/microsim/traffic_lights/MSDriveWay.cpp | 24 ++++++++++++++++++++ src/microsim/traffic_lights/MSDriveWay.h | 9 ++------ src/microsim/traffic_lights/MSRailSignal.cpp | 19 +--------------- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 53e82c716bb7..280c0ae64724 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -1004,5 +1004,29 @@ MSDriveWay::appendMapIndex(LaneVisitedMap& map, const MSLane* lane) { map[lane] = tmp; } +bool +MSDriveWay::match(const MSRoute& route, MSRouteIterator firstIt) const { + // @todo optimize: it is sufficient to check for specific edges (after each switch) + auto itRoute = firstIt; + auto itDwRoute = myRoute.begin(); + bool match = true; + while (itRoute != route.end() && itDwRoute != myRoute.end()) { + if (*itRoute != *itDwRoute) { + match = false; + //std::cout << " check dw=" << " match failed at vehEdge=" << (*itRoute)->getID() << " dwEdge=" << (*itDwRoute)->getID() << "\n"; + break; + } + itRoute++; + itDwRoute++; + } + // if the vehicle arrives before the end of this driveway, + // we'd rather build a new driveway to avoid superfluous restrictions + if (match && itDwRoute == myRoute.end() + && (itRoute == route.end() || myFoundSignal || myFoundReversal)) { + //std::cout << " using dw=" << "\n"; + return true; + } + return false; +} /****************************************************************************/ diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h index cfdbd4ebe7f3..4e9e34d8e2c1 100644 --- a/src/microsim/traffic_lights/MSDriveWay.h +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -101,13 +101,8 @@ class MSDriveWay : public MSMoveReminder { return myNumericalID; } - bool foundSignal() const { - return myFoundSignal; - } - - bool foundReversal() const { - return myFoundReversal; - } + /// @brief whether the give route matches this driveway + bool match(const MSRoute& route, MSRouteIterator firstIt) const; static void init(); diff --git a/src/microsim/traffic_lights/MSRailSignal.cpp b/src/microsim/traffic_lights/MSRailSignal.cpp index 41996adc202a..e241aee4d7a4 100644 --- a/src/microsim/traffic_lights/MSRailSignal.cpp +++ b/src/microsim/traffic_lights/MSRailSignal.cpp @@ -580,24 +580,7 @@ MSRailSignal::LinkInfo::getDriveWay(const SUMOVehicle* veh) { } //std::cout << SIMTIME << " veh=" << veh->getID() << " rsl=" << getID() << " dws=" << myDriveways.size() << "\n"; for (MSDriveWay* dw : myDriveways) { - // @todo optimize: it is sufficient to check for specific edges (after each switch) - auto itRoute = firstIt; - auto itDwRoute = dw->getRoute().begin(); - bool match = true; - while (itRoute != veh->getRoute().end() && itDwRoute != dw->getRoute().end()) { - if (*itRoute != *itDwRoute) { - match = false; - //std::cout << " check dw=" << " match failed at vehEdge=" << (*itRoute)->getID() << " dwEdge=" << (*itDwRoute)->getID() << "\n"; - break; - } - itRoute++; - itDwRoute++; - } - // if the vehicle arrives before the end of this driveway, - // we'd rather build a new driveway to avoid superfluous restrictions - if (match && itDwRoute == dw->getRoute().end() - && (itRoute == veh->getRoute().end() || dw->foundSignal() || dw->foundReversal())) { - //std::cout << " using dw=" << "\n"; + if (dw->match(veh->getRoute(), firstIt)) { return *dw; } #ifdef DEBUG_SELECT_DRIVEWAY From 2552dc7d29101a5126ef679f857917a5397e47e0 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 6 Jun 2024 17:05:57 +0200 Subject: [PATCH 014/334] addendum to avoid invalid registration. refs #14990 --- src/microsim/traffic_lights/MSDriveWay.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 280c0ae64724..34013eca53e5 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -101,14 +101,17 @@ MSDriveWay::notifyEnter(SUMOTrafficObject& veh, Notification reason, const MSLan UNUSED_PARAMETER(enteredLane); //std::cout << SIMTIME << " notifyEnter " << getDescription() << " veh=" << veh.getID() << " lane=" << enteredLane->getID() << " reason=" << reason << "\n"; if (veh.isVehicle() && enteredLane == myLane && (reason == NOTIFICATION_DEPARTED || reason == NOTIFICATION_JUNCTION)) { - myTrains.insert(&dynamic_cast(veh)); - if (myWriteVehicles) { - myVehicleEvents.push_back(VehicleEvent(SIMSTEP, true, veh.getID(), reason)); + SUMOVehicle& sveh = dynamic_cast(veh); + MSRouteIterator firstIt = std::find(sveh.getCurrentRouteEdge(), sveh.getRoute().end(), myLane->getNextNormal()); + if (match(sveh.getRoute(), firstIt)) { + myTrains.insert(&sveh); + if (myWriteVehicles) { + myVehicleEvents.push_back(VehicleEvent(SIMSTEP, true, veh.getID(), reason)); + } + return true; } - return true; - } else { - return false; } + return false; } From 42fc1ca62a4f2235f66779eae9b61c69c7500694 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 6 Jun 2024 17:06:01 +0200 Subject: [PATCH 015/334] patching expected results refs #21, #14990 --- tests/sumo/rail/overlapping_driveways/railsignalvehs.sumo | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/sumo/rail/overlapping_driveways/railsignalvehs.sumo b/tests/sumo/rail/overlapping_driveways/railsignalvehs.sumo index b81851781f7c..ef77ef4ca9fe 100644 --- a/tests/sumo/rail/overlapping_driveways/railsignalvehs.sumo +++ b/tests/sumo/rail/overlapping_driveways/railsignalvehs.sumo @@ -17,20 +17,14 @@ - - - - - - From 0e8d48c4996e0244435ce1487900277745184477 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 6 Jun 2024 18:08:39 +0200 Subject: [PATCH 016/334] always write driveway id. refs #14991 --- src/microsim/traffic_lights/MSDriveWay.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 34013eca53e5..a1d385e8d03c 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -508,9 +508,7 @@ MSDriveWay::flankConflict(const MSDriveWay& other) const { void MSDriveWay::writeBlocks(OutputDevice& od) const { od.openTag("driveWay"); - if (myWriteVehicles) { - od.writeAttr(SUMO_ATTR_ID, myNumericalID); - } + od.writeAttr(SUMO_ATTR_ID, myNumericalID); od.writeAttr(SUMO_ATTR_EDGES, toString(myRoute)); if (myCoreSize != (int)myRoute.size()) { od.writeAttr("core", myCoreSize); From 12db074e0f60230f07ec1e48e342f85b85a0a717 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 6 Jun 2024 18:08:45 +0200 Subject: [PATCH 017/334] patching expected results refs #21, #14991 --- .../alternativeRoute/railsignalblocks.sumo | 36 ++++---- .../railsignalblocks.sumo | 4 +- .../railsignalblocks.sumo | 4 +- .../railsignalblocks.sumo | 4 +- .../railsignalblocks.sumo | 6 +- .../railsignalblocks.sumo | 16 ++-- .../insertion_at_signal/railsignalblocks.sumo | 6 +- .../railsignalblocks.sumo | 14 +-- .../railsignalblocks.sumo | 6 +- .../stopped_at_signal/railsignalblocks.sumo | 14 +-- .../stopped_at_signal2/railsignalblocks.sumo | 6 +- .../bugs/ticket11384/railsignalblocks.sumo | 6 +- .../bugs/ticket11440/railsignalblocks.sumo | 8 +- .../bugs/ticket12184/railsignalblocks.sumo | 6 +- .../bugs/ticket12184b/railsignalblocks.sumo | 8 +- .../bugs/ticket12858/railsignalblocks.sumo | 12 +-- .../bugs/ticket12868/railsignalblocks.sumo | 6 +- .../bugs/ticket12873/railsignalblocks.sumo | 10 +-- .../bugs/ticket13262/railsignalblocks.sumo | 6 +- .../bugs/ticket14973/railsignalblocks.sumo | 6 +- .../bugs/ticket7563/railsignalblocks.sumo | 16 ++-- .../crossing_tracks/railsignalblocks.sumo | 12 +-- .../default_rail_type/railsignalblocks.sumo | 9 +- .../rail/headonconflict/railsignalblocks.sumo | 22 +++-- .../join_front_signal/railsignalblocks.sumo | 4 +- .../join_signal/railsignalblocks.sumo | 4 +- .../rail_signal/circle/railsignalblocks.sumo | 4 +- .../circle_bidi/railsignalblocks.sumo | 4 +- .../conflict_lookahead/railsignalblocks.sumo | 16 ++-- .../constraints/bidi/railsignalblocks.sumo | 10 +-- .../foeInsertion/railsignalblocks.sumo | 16 ++-- .../constraints/limit2/railsignalblocks.sumo | 16 ++-- .../constraints/limit3/railsignalblocks.sumo | 16 ++-- .../wait_for_one/railsignalblocks.sumo | 16 ++-- .../railsignalblocks.sumo | 16 ++-- .../wait_for_one_tripId/railsignalblocks.sumo | 16 ++-- .../wait_for_three/railsignalblocks.sumo | 16 ++-- .../railsignalblocks.sumo | 16 ++-- .../wait_not/railsignalblocks.sumo | 16 ++-- .../deadlock_insertion/railsignalblocks.sumo | 15 ++-- .../end_after_bidi/railsignalblocks.sumo | 14 +-- .../end_within_bidi/railsignalblocks.sumo | 14 +-- .../fork_without_signal/railsignalblocks.sumo | 6 +- .../guard_insertion/railsignalblocks.sumo | 8 +- .../halting_conflict/railsignalblocks.sumo | 10 +-- .../indirect_guard/railsignalblocks.sumo | 16 ++-- .../railsignalblocks.sumo | 10 +-- .../railsignalblocks.sumo | 8 +- .../railsignalblocks.sumo | 8 +- .../railsignalblocks.sumo | 6 +- .../railsignalblocks.sumo | 12 +-- .../insertionOrder/railsignalblocks.sumo | 4 +- .../parking/railsignalblocks.sumo | 6 +- .../signal_on_next_edge/railsignalblocks.sumo | 4 +- .../wait_for_one/railsignalblocks.sumo | 4 +- .../railsignalblocks.sumo | 4 +- .../railsignalblocks.sumo | 4 +- .../large_step_size/railsignalblocks.sumo | 6 +- .../protect_bidi/railsignalblocks.sumo | 16 ++-- .../protect_bidi_option/railsignalblocks.sumo | 18 ++-- .../railsignalblocks.sumo | 14 +-- .../waiting_time_bottom/railsignalblocks.sumo | 17 ++-- .../waiting_time_top/railsignalblocks.sumo | 17 ++-- .../railsignalblocks.sumo | 4 +- .../route_as_additional/railsignalblocks.sumo | 6 +- .../several_blocks/railsignalblocks.sumo | 14 +-- .../railsignalblocks.sumo | 4 +- .../railsignalblocks.sumo | 4 +- .../railsignalblocks.sumo | 16 ++-- .../railsignalblocks.sumo | 4 +- .../railsignalblocks.sumo | 12 ++- .../small_step_size/railsignalblocks.sumo | 20 ++--- .../railsignalblocks.sumo | 14 +-- .../railsignalblocks.sumo | 14 +-- .../railsignalblocks.sumo | 16 ++-- .../railsignalblocks.sumo | 14 +-- .../railsignalblocks.sumo | 6 +- .../railsignalblocks.sumo | 6 +- .../reverse_on_signal/railsignalblocks.sumo | 14 +-- .../rail/slow_fast_slow/railsignalblocks.sumo | 14 +-- .../tramwayLoop/basic/railsignalblocks.sumo | 80 ++++++++--------- .../track_closed/railsignalblocks.sumo | 88 +++++++++---------- .../two_passing_loops/railsignalblocks.sumo | 24 ++--- .../two_passing_loops2/railsignalblocks.sumo | 24 ++--- 84 files changed, 596 insertions(+), 472 deletions(-) diff --git a/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo b/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo index 03cecc771ac1..c7af8aa0b70e 100644 --- a/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo +++ b/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - + @@ -57,7 +57,7 @@ SPDX-License-Identifier: EPL-2.0 - + @@ -68,7 +68,7 @@ SPDX-License-Identifier: EPL-2.0 - + diff --git a/tests/sumo/rail/rail_signal/stopped_link_conflict/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/stopped_link_conflict/railsignalblocks.sumo index e2bd3f9d9651..07d647a497b4 100644 --- a/tests/sumo/rail/rail_signal/stopped_link_conflict/railsignalblocks.sumo +++ b/tests/sumo/rail/rail_signal/stopped_link_conflict/railsignalblocks.sumo @@ -1,11 +1,16 @@ - - - - + + + - + diff --git a/tests/sumo/rail/alternativeRoute/vehroutes.sumo b/tests/sumo/rail/alternativeRoute/vehroutes.sumo index 759f28295fbc..9e3a9c2c0037 100644 --- a/tests/sumo/rail/alternativeRoute/vehroutes.sumo +++ b/tests/sumo/rail/alternativeRoute/vehroutes.sumo @@ -1,6 +1,6 @@ - - + @@ -52,11 +52,11 @@ SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later - + - + @@ -76,7 +76,7 @@ SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later - + diff --git a/tests/sumo/rail/bidi_noconflict_insertion3/railsignalblocks.sumo b/tests/sumo/rail/bidi_noconflict_insertion3/railsignalblocks.sumo index 6af9538c43b7..d275b3b245d4 100644 --- a/tests/sumo/rail/bidi_noconflict_insertion3/railsignalblocks.sumo +++ b/tests/sumo/rail/bidi_noconflict_insertion3/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - - - + + + diff --git a/tests/sumo/rail/alternativeRoute/vehroutes.sumo b/tests/sumo/rail/alternativeRoute/vehroutes.sumo index 9e3a9c2c0037..68efc4281289 100644 --- a/tests/sumo/rail/alternativeRoute/vehroutes.sumo +++ b/tests/sumo/rail/alternativeRoute/vehroutes.sumo @@ -1,6 +1,6 @@ - - - - - - - + + - + - - + + + + + + diff --git a/tests/sumo/rail/bidi_noconflict_insertion3/railsignalblocks.sumo b/tests/sumo/rail/bidi_noconflict_insertion3/railsignalblocks.sumo index d275b3b245d4..a2fb0594db0e 100644 --- a/tests/sumo/rail/bidi_noconflict_insertion3/railsignalblocks.sumo +++ b/tests/sumo/rail/bidi_noconflict_insertion3/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - + @@ -136,111 +136,111 @@ SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 46a47f7ee86a602510f90b075cde4383555f5786 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 4 Jul 2024 13:54:52 +0200 Subject: [PATCH 068/334] now driveway output writes self-foes to make the difference between block control and train-following control explicit. refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index acc26c6c84d6..af1ee07bb3db 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -706,10 +706,7 @@ MSDriveWay::writeBlocks(OutputDevice& od) const { std::vector foes; for (MSDriveWay* dw : myFoes) { - if (dw != this) { - // every driveway is it's own foe but we don't need to write this - foes.push_back(dw->myID); - } + foes.push_back(dw->myID); } if (foes.size() > 0) { od.openTag("foes"); From 0959a35f568b35e7901301a7d58d8c03f68197f7 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 4 Jul 2024 13:54:57 +0200 Subject: [PATCH 069/334] patching expected results refs #21, #7578 --- .../alternativeRoute/railsignalblocks.sumo | 53 +++++------ .../railsignalblocks.sumo | 10 +-- .../railsignalblocks.sumo | 12 +-- .../railsignalblocks.sumo | 9 +- .../railsignalblocks.sumo | 14 +-- .../railsignalblocks.sumo | 8 +- .../insertion_at_signal/railsignalblocks.sumo | 8 +- .../railsignalblocks.sumo | 10 ++- .../railsignalblocks.sumo | 10 ++- .../stopped_at_signal/railsignalblocks.sumo | 8 +- .../stopped_at_signal2/railsignalblocks.sumo | 8 +- .../bugs/ticket11384/railsignalblocks.sumo | 13 +-- .../bugs/ticket11440/railsignalblocks.sumo | 13 +-- .../bugs/ticket12184/railsignalblocks.sumo | 10 +-- .../bugs/ticket12184b/railsignalblocks.sumo | 12 +-- .../bugs/ticket12858/railsignalblocks.sumo | 15 ++-- .../bugs/ticket12868/railsignalblocks.sumo | 10 +-- .../bugs/ticket12873/railsignalblocks.sumo | 14 +-- .../bugs/ticket13262/railsignalblocks.sumo | 10 +-- .../bugs/ticket14973/railsignalblocks.sumo | 5 +- .../bugs/ticket7563/railsignalblocks.sumo | 13 +-- .../crossing_tracks/railsignalblocks.sumo | 17 ++-- .../default_rail_type/railsignalblocks.sumo | 6 +- .../rail/headonconflict/railsignalblocks.sumo | 12 ++- .../rail/interlocking/railsignalblocks.sumo | 24 ++--- .../railsignalblocks.sumo | 8 +- .../join_front_signal/railsignalblocks.sumo | 5 +- .../join_signal/railsignalblocks.sumo | 5 +- .../rail_signal/circle/railsignalblocks.sumo | 4 +- .../circle_bidi/railsignalblocks.sumo | 7 +- .../conflict_lookahead/railsignalblocks.sumo | 9 +- .../constraints/bidi/railsignalblocks.sumo | 10 ++- .../foeInsertion/railsignalblocks.sumo | 8 +- .../constraints/limit2/railsignalblocks.sumo | 8 +- .../constraints/limit3/railsignalblocks.sumo | 8 +- .../wait_for_one/railsignalblocks.sumo | 8 +- .../railsignalblocks.sumo | 8 +- .../wait_for_one_tripId/railsignalblocks.sumo | 8 +- .../wait_for_three/railsignalblocks.sumo | 8 +- .../railsignalblocks.sumo | 8 +- .../wait_not/railsignalblocks.sumo | 8 +- .../deadlock_insertion/railsignalblocks.sumo | 17 ++-- .../end_after_bidi/railsignalblocks.sumo | 8 +- .../end_within_bidi/railsignalblocks.sumo | 8 +- .../fork_without_signal/railsignalblocks.sumo | 5 +- .../guard_insertion/railsignalblocks.sumo | 12 +-- .../halting_conflict/railsignalblocks.sumo | 18 ++-- .../indirect_guard/railsignalblocks.sumo | 20 +++-- .../railsignalblocks.sumo | 10 ++- .../railsignalblocks.sumo | 13 +-- .../railsignalblocks.sumo | 15 ++-- .../railsignalblocks.sumo | 14 +-- .../railsignalblocks.sumo | 20 ++--- .../railsignalblocks.sumo | 3 +- .../insertionOrder/railsignalblocks.sumo | 4 +- .../parking/railsignalblocks.sumo | 5 +- .../signal_on_next_edge/railsignalblocks.sumo | 5 +- .../wait_for_one/railsignalblocks.sumo | 5 +- .../railsignalblocks.sumo | 5 +- .../railsignalblocks.sumo | 4 +- .../large_step_size/railsignalblocks.sumo | 5 +- .../protect_bidi/railsignalblocks.sumo | 6 +- .../protect_bidi_option/railsignalblocks.sumo | 4 +- .../railsignalblocks.sumo | 4 +- .../waiting_time_bottom/railsignalblocks.sumo | 10 ++- .../waiting_time_top/railsignalblocks.sumo | 10 ++- .../railsignalblocks.sumo | 4 +- .../route_as_additional/railsignalblocks.sumo | 5 +- .../several_blocks/railsignalblocks.sumo | 5 +- .../railsignalblocks.sumo | 4 +- .../railsignalblocks.sumo | 4 +- .../railsignalblocks.sumo | 11 ++- .../railsignalblocks.sumo | 4 +- .../railsignalblocks.sumo | 4 +- .../small_step_size/railsignalblocks.sumo | 9 +- .../railsignalblocks.sumo | 8 +- .../railsignalblocks.sumo | 8 +- .../railsignalblocks.sumo | 9 +- .../railsignalblocks.sumo | 5 +- .../railsignalblocks.sumo | 5 +- .../railsignalblocks.sumo | 7 +- .../reverse_on_signal/railsignalblocks.sumo | 7 +- .../rail/slow_fast_slow/railsignalblocks.sumo | 5 +- .../tramwayLoop/basic/railsignalblocks.sumo | 76 +++++++++------- .../track_closed/railsignalblocks.sumo | 90 ++++++++++--------- .../two_passing_loops/railsignalblocks.sumo | 29 +++--- .../two_passing_loops2/railsignalblocks.sumo | 29 +++--- .../uncontrolled_links/railsignalblocks.sumo | 6 +- 88 files changed, 607 insertions(+), 401 deletions(-) diff --git a/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo b/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo index f412e7e9ccd1..31acd2de33a5 100644 --- a/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo +++ b/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo @@ -1,6 +1,6 @@ - @@ -188,6 +188,7 @@ + diff --git a/tests/sumo/meta/write_template_commented_full/cfg.sumo b/tests/sumo/meta/write_template_commented_full/cfg.sumo index 98f1f348610c..1b64c5d4c14a 100644 --- a/tests/sumo/meta/write_template_commented_full/cfg.sumo +++ b/tests/sumo/meta/write_template_commented_full/cfg.sumo @@ -1,6 +1,6 @@ - @@ -432,6 +432,9 @@ + + + diff --git a/tests/sumo/meta/write_template_full/cfg.sumo b/tests/sumo/meta/write_template_full/cfg.sumo index 684a55b0ed5a..989befe46ae2 100644 --- a/tests/sumo/meta/write_template_full/cfg.sumo +++ b/tests/sumo/meta/write_template_full/cfg.sumo @@ -1,6 +1,6 @@ - @@ -156,6 +156,7 @@ + diff --git a/tests/sumo/rail/collision_noInsertionChecks/crossing_tracks_collision/errors.sumo b/tests/sumo/rail/collision_noInsertionChecks/crossing_tracks_collision/errors.sumo new file mode 100644 index 000000000000..54b41d0a1bad --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/crossing_tracks_collision/errors.sumo @@ -0,0 +1,3 @@ +Warning: Teleporting vehicle 'rail2'; junction collision with vehicle 'rail1', lane=':k1_1_0', gap=-1.00, time=101.00 stage=move. +Warning: Vehicle 'rail2' ends teleporting on edge 'T7_1', time=103.00. +Warning: Teleporting vehicle 'rail5'; junction collision with vehicle 'rail4', lane=':k1_1_0', gap=-1.00, time=501.00 stage=move. diff --git a/tests/sumo/rail/collision_noInsertionChecks/crossing_tracks_collision/errors.sumo.meso b/tests/sumo/rail/collision_noInsertionChecks/crossing_tracks_collision/errors.sumo.meso new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/collision_noInsertionChecks/crossing_tracks_collision/input_routes.rou.xml b/tests/sumo/rail/collision_noInsertionChecks/crossing_tracks_collision/input_routes.rou.xml new file mode 100755 index 000000000000..a0ed5b842a68 --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/crossing_tracks_collision/input_routes.rou.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + diff --git a/tests/sumo/rail/collision_noInsertionChecks/crossing_tracks_collision/net.net.xml b/tests/sumo/rail/collision_noInsertionChecks/crossing_tracks_collision/net.net.xml new file mode 100755 index 000000000000..fbb1d9d10843 --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/crossing_tracks_collision/net.net.xml @@ -0,0 +1,384 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/collision_noInsertionChecks/crossing_tracks_collision/options.sumo b/tests/sumo/rail/collision_noInsertionChecks/crossing_tracks_collision/options.sumo new file mode 100644 index 000000000000..936a3017aa11 --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/crossing_tracks_collision/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml --routes=input_routes.rou.xml +--collision.check-junctions diff --git a/tests/sumo/rail/collision_noInsertionChecks/crossing_tracks_collision/output.sumo b/tests/sumo/rail/collision_noInsertionChecks/crossing_tracks_collision/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/collision_noInsertionChecks/crossing_tracks_collision/railsignalblocks.sumo b/tests/sumo/rail/collision_noInsertionChecks/crossing_tracks_collision/railsignalblocks.sumo new file mode 100644 index 000000000000..df3db5a55b6a --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/crossing_tracks_collision/railsignalblocks.sumo @@ -0,0 +1,36 @@ + + + + + + diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision/errors.sumo b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision/errors.sumo new file mode 100644 index 000000000000..9c448b5b70c4 --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision/errors.sumo @@ -0,0 +1,2 @@ +Warning: Vehicle 'RE2'; collision with vehicle 'RE1', lane='-c_0', gap=-1.00, time=106.00 stage=move. +Warning: Vehicle 'RE1'; collision with vehicle 'RE2', lane='d_0', gap=-1.00, time=106.00 stage=move. diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision/errors.sumo.meso b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision/errors.sumo.meso new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision/input_routes.rou.xml b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision/input_routes.rou.xml new file mode 100644 index 000000000000..332efbd9b6d4 --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision/input_routes.rou.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision/net.net.xml b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision/net.net.xml new file mode 100644 index 000000000000..c9fd8a0a4113 --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision/net.net.xml @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision/options.sumo b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision/options.sumo new file mode 100644 index 000000000000..a6643cdddf5d --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml --routes=input_routes.rou.xml +--collision.action warn diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision/output.sumo b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision/railsignalblocks.sumo b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision/railsignalblocks.sumo new file mode 100644 index 000000000000..01d0b159fdec --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision/railsignalblocks.sumo @@ -0,0 +1,35 @@ + + + + + + diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_further/errors.sumo b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_further/errors.sumo new file mode 100644 index 000000000000..166366d2ebf0 --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_further/errors.sumo @@ -0,0 +1 @@ +Warning: Vehicle 'RE1'; collision with vehicle 'RE2', lane='-c_0', gap=-1.00, time=110.00 stage=move. diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_further/errors.sumo.meso b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_further/errors.sumo.meso new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_further/input_routes.rou.xml b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_further/input_routes.rou.xml new file mode 100644 index 000000000000..4615f0629134 --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_further/input_routes.rou.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_further/net.net.xml b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_further/net.net.xml new file mode 100644 index 000000000000..c9fd8a0a4113 --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_further/net.net.xml @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_further/options.sumo b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_further/options.sumo new file mode 100644 index 000000000000..a6643cdddf5d --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_further/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml --routes=input_routes.rou.xml +--collision.action warn diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_further/output.sumo b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_further/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_further/railsignalblocks.sumo b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_further/railsignalblocks.sumo new file mode 100644 index 000000000000..01d0b159fdec --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_further/railsignalblocks.sumo @@ -0,0 +1,35 @@ + + + + + + diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump/errors.sumo b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump/errors.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump/errors.sumo.meso b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump/errors.sumo.meso new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump/input_routes.rou.xml b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump/input_routes.rou.xml new file mode 100644 index 000000000000..e5d4dd757e08 --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump/input_routes.rou.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump/net.net.xml b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump/net.net.xml new file mode 100644 index 000000000000..c9fd8a0a4113 --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump/net.net.xml @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump/options.sumo b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump/options.sumo new file mode 100644 index 000000000000..768b2b2c086c --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump/options.sumo @@ -0,0 +1 @@ +--no-step-log --no-duration-log --net-file=net.net.xml --routes=input_routes.rou.xml diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump/output.sumo b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump/railsignalblocks.sumo b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump/railsignalblocks.sumo new file mode 100644 index 000000000000..01d0b159fdec --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump/railsignalblocks.sumo @@ -0,0 +1,35 @@ + + + + + + diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump_sameEdge/errors.sumo b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump_sameEdge/errors.sumo new file mode 100644 index 000000000000..c49d04863a65 --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump_sameEdge/errors.sumo @@ -0,0 +1,2 @@ +Warning: Vehicle 'RE2'; frontal collision with vehicle 'RE1', lane='-d_0', gap=-1.00, time=110.00 stage=move. +Warning: Vehicle 'RE1'; frontal collision with vehicle 'RE2', lane='d_0', gap=-1.00, time=110.00 stage=move. diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump_sameEdge/errors.sumo.meso b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump_sameEdge/errors.sumo.meso new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump_sameEdge/input_routes.rou.xml b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump_sameEdge/input_routes.rou.xml new file mode 100644 index 000000000000..f1db6c23c6df --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump_sameEdge/input_routes.rou.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump_sameEdge/net.net.xml b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump_sameEdge/net.net.xml new file mode 100644 index 000000000000..c9fd8a0a4113 --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump_sameEdge/net.net.xml @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump_sameEdge/options.sumo b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump_sameEdge/options.sumo new file mode 100644 index 000000000000..a6643cdddf5d --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump_sameEdge/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml --routes=input_routes.rou.xml +--collision.action warn diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump_sameEdge/output.sumo b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump_sameEdge/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump_sameEdge/railsignalblocks.sumo b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump_sameEdge/railsignalblocks.sumo new file mode 100644 index 000000000000..01d0b159fdec --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_jump_sameEdge/railsignalblocks.sumo @@ -0,0 +1,35 @@ + + + + + + diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_reverseRoles/errors.sumo b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_reverseRoles/errors.sumo new file mode 100644 index 000000000000..50589c87b909 --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_reverseRoles/errors.sumo @@ -0,0 +1,2 @@ +Warning: Teleporting vehicle 'RE1'; frontal collision with vehicle 'RE2', lane='-d_0', gap=-1.00, time=108.00 stage=move. +Warning: Vehicle 'RE1' ends teleporting on edge 'e', time=108.00. diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_reverseRoles/errors.sumo.meso b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_reverseRoles/errors.sumo.meso new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_reverseRoles/input_routes.rou.xml b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_reverseRoles/input_routes.rou.xml new file mode 100644 index 000000000000..01936fbb31a9 --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_reverseRoles/input_routes.rou.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_reverseRoles/net.net.xml b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_reverseRoles/net.net.xml new file mode 100644 index 000000000000..c9fd8a0a4113 --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_reverseRoles/net.net.xml @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_reverseRoles/options.sumo b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_reverseRoles/options.sumo new file mode 100644 index 000000000000..768b2b2c086c --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_reverseRoles/options.sumo @@ -0,0 +1 @@ +--no-step-log --no-duration-log --net-file=net.net.xml --routes=input_routes.rou.xml diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_reverseRoles/output.sumo b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_reverseRoles/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_reverseRoles/railsignalblocks.sumo b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_reverseRoles/railsignalblocks.sumo new file mode 100644 index 000000000000..01d0b159fdec --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/frontal_collision_reverseRoles/railsignalblocks.sumo @@ -0,0 +1,35 @@ + + + + + + diff --git a/tests/sumo/rail/collision_noInsertionChecks/testsuite.sumo b/tests/sumo/rail/collision_noInsertionChecks/testsuite.sumo new file mode 100644 index 000000000000..29c38dbbd99a --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/testsuite.sumo @@ -0,0 +1,19 @@ +# as above but without rail signals +crossing_tracks_collision + +# unsafe train insertion with an oncoming train beyond the insertion lookahead-horizon. +frontal_collision + +# unsafe train insertion with an oncoming train beyond the insertion lookahead-horizon. Collision occurs between when only the back of one vehicle is still on the collision edge +frontal_collision_further + +# change train speeds to change assigned collider and victim roles +frontal_collision_reverseRoles + +# unsafe train insertion with an oncoming train beyond the insertion lookahead-horizon. (short vehicles make this hard to detect because each sim step by itself looks safe +# +# vehicles change edge while "jumping" through each other +frontal_collision_jump + +# unsafe train insertion with an oncoming train beyond the insertion lookahead-horizon. (short vehicles make this hard to detect because each sim step by itself looks safe +frontal_collision_jump_sameEdge From f2f2affd80ec35fd9f526406e233f8762f743fc2 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 4 Jul 2024 15:27:06 +0200 Subject: [PATCH 078/334] fix #15149 --- src/microsim/MSLane.cpp | 39 ++++++++++++++++++++++++--------------- src/microsim/MSLane.h | 2 ++ 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/microsim/MSLane.cpp b/src/microsim/MSLane.cpp index f2946c607ab7..8298912be7b6 100644 --- a/src/microsim/MSLane.cpp +++ b/src/microsim/MSLane.cpp @@ -796,7 +796,7 @@ MSLane::checkFailure(const MSVehicle* aVehicle, double& speed, double& dist, con speed = MIN2(nspeed, speed); dist = aVehicle->getCarFollowModel().brakeGap(speed) + aVehicle->getVehicleType().getMinGap(); } else if (speed > 0) { - if ((aVehicle->getParameter().insertionChecks & (int)check) == 0) { + if ((getInsertionChecks(aVehicle) & (int)check) == 0) { return false; } if (MSGlobals::gEmergencyInsert) { @@ -825,6 +825,7 @@ bool MSLane::isInsertionSuccess(MSVehicle* aVehicle, double speed, double pos, double posLat, bool patchSpeed, MSMoveReminder::Notification notification) { + int insertionChecks = getInsertionChecks(aVehicle); if (pos < 0 || pos > myLength) { // we may not start there WRITE_WARNINGF(TL("Invalid departPos % given for vehicle '%'. Inserting at lane end instead."), @@ -855,7 +856,7 @@ MSLane::isInsertionSuccess(MSVehicle* aVehicle, const bool isRail = isRailway(aVehicle->getVClass()); // do not insert if the bidirectional edge is occupied if (getBidiLane() != nullptr && isRail && getBidiLane()->getVehicleNumberWithPartials() > 0) { - if ((aVehicle->getParameter().insertionChecks & (int)InsertionCheck::BIDI) != 0) { + if ((insertionChecks & (int)InsertionCheck::BIDI) != 0) { #ifdef DEBUG_INSERTION if (DEBUG_COND2(aVehicle) || DEBUG_COND) { std::cout << " bidi-lane occupied\n"; @@ -945,7 +946,7 @@ MSLane::isInsertionSuccess(MSVehicle* aVehicle, std::cout << " oncoming rail traffic at link " << (*link)->getDescription() << "\n"; } #endif - if ((aVehicle->getParameter().insertionChecks & (int)InsertionCheck::ONCOMING_TRAIN) != 0) { + if ((insertionChecks & (int)InsertionCheck::ONCOMING_TRAIN) != 0) { setParameter("insertionFail:" + aVehicle->getID(), "oncoming rail traffic"); return false; } @@ -1026,7 +1027,7 @@ MSLane::isInsertionSuccess(MSVehicle* aVehicle, // do not insert if the bidirectional edge is occupied before a railSignal has been encountered if (firstRailSignal == nullptr && nextLane->getBidiLane() != nullptr && nextLane->getBidiLane()->getVehicleNumberWithPartials() > 0) { - if ((aVehicle->getParameter().insertionChecks & (int)InsertionCheck::ONCOMING_TRAIN) != 0) { + if ((insertionChecks & (int)InsertionCheck::ONCOMING_TRAIN) != 0) { return false; } } @@ -1085,7 +1086,7 @@ MSLane::isInsertionSuccess(MSVehicle* aVehicle, speed = nspeed; dist = cfModel.brakeGap(speed) + aVehicle->getVehicleType().getMinGap(); } else { - if ((aVehicle->getParameter().insertionChecks & (int)InsertionCheck::SPEED_LIMIT) != 0) { + if ((insertionChecks & (int)InsertionCheck::SPEED_LIMIT) != 0) { if (!MSGlobals::gCheckRoutes) { WRITE_WARNINGF(TL("Vehicle '%' is inserted too fast and will violate the speed limit on a lane '%'."), aVehicle->getID(), nextLane->getID()); @@ -1153,8 +1154,8 @@ MSLane::isInsertionSuccess(MSVehicle* aVehicle, if (follower != nullptr) { const double backGapNeeded = follower->getCarFollowModel().getSecureGap(follower, aVehicle, follower->getSpeed(), speed, cfModel.getMaxDecel()); if (followers[i].second < backGapNeeded - && ((aVehicle->getParameter().insertionChecks & (int)InsertionCheck::FOLLOWER_GAP) != 0 - || (followers[i].second < 0 && (aVehicle->getParameter().insertionChecks & (int)InsertionCheck::COLLISION) != 0))) { + && ((insertionChecks & (int)InsertionCheck::FOLLOWER_GAP) != 0 + || (followers[i].second < 0 && (insertionChecks & (int)InsertionCheck::COLLISION) != 0))) { // too close to the follower on this lane #ifdef DEBUG_INSERTION if (DEBUG_COND2(aVehicle) || DEBUG_COND) { @@ -1192,8 +1193,8 @@ MSLane::isInsertionSuccess(MSVehicle* aVehicle, if (follower != nullptr) { const double backGapNeeded = follower->getCarFollowModel().getSecureGap(follower, aVehicle, follower->getSpeed(), speed, cfModel.getMaxDecel()); if (shadowFollowers[i].second < backGapNeeded - && ((aVehicle->getParameter().insertionChecks & (int)InsertionCheck::FOLLOWER_GAP) != 0 - || (shadowFollowers[i].second < 0 && (aVehicle->getParameter().insertionChecks & (int)InsertionCheck::COLLISION) != 0))) { + && ((insertionChecks & (int)InsertionCheck::FOLLOWER_GAP) != 0 + || (shadowFollowers[i].second < 0 && (insertionChecks & (int)InsertionCheck::COLLISION) != 0))) { // too close to the follower on this lane #ifdef DEBUG_INSERTION if (DEBUG_COND2(aVehicle) || DEBUG_COND) { @@ -1221,8 +1222,8 @@ MSLane::isInsertionSuccess(MSVehicle* aVehicle, const double gap = veh->getBackPositionOnLane(shadowLane) - aVehicle->getPositionOnLane() - aVehicle->getVehicleType().getMinGap(); const double gapNeeded = aVehicle->getCarFollowModel().getSecureGap(aVehicle, veh, speed, veh->getSpeed(), veh->getCarFollowModel().getMaxDecel()); if (gap < gapNeeded - && ((aVehicle->getParameter().insertionChecks & (int)InsertionCheck::LEADER_GAP) != 0 - || (gap < 0 && (aVehicle->getParameter().insertionChecks & (int)InsertionCheck::COLLISION) != 0))) { + && ((insertionChecks & (int)InsertionCheck::LEADER_GAP) != 0 + || (gap < 0 && (insertionChecks & (int)InsertionCheck::COLLISION) != 0))) { // too close to the shadow leader #ifdef DEBUG_INSERTION if (DEBUG_COND2(aVehicle) || DEBUG_COND) { @@ -1249,7 +1250,7 @@ MSLane::isInsertionSuccess(MSVehicle* aVehicle, const double backOffset = pos - aVehicle->getVehicleType().getLength(); const double missingRearGap = getMissingRearGap(aVehicle, backOffset, speed); if (missingRearGap > 0 - && (aVehicle->getParameter().insertionChecks & (int)InsertionCheck::LEADER_GAP) != 0) { + && (insertionChecks & (int)InsertionCheck::LEADER_GAP) != 0) { // too close to a follower #ifdef DEBUG_INSERTION if (DEBUG_COND2(aVehicle) || DEBUG_COND) { @@ -1267,7 +1268,7 @@ MSLane::isInsertionSuccess(MSVehicle* aVehicle, return false; } } - if (aVehicle->getParameter().insertionChecks == (int)InsertionCheck::NONE) { + if (insertionChecks == (int)InsertionCheck::NONE) { speed = MAX2(0.0, speed); } // may got negative while adaptation @@ -1351,6 +1352,14 @@ MSLane::forceVehicleInsertion(MSVehicle* veh, double pos, MSMoveReminder::Notifi }), notification); } +int +MSLane::getInsertionChecks(const MSVehicle* veh) { + if (veh->getParameter().wasSet(VEHPARS_INSERTION_CHECKS_SET)) { + return veh->getParameter().insertionChecks; + } else { + return MSGlobals::gInsertionChecks; + } +} double MSLane::safeInsertionSpeed(const MSVehicle* veh, double seen, const MSLeaderInfo& leaders, double speed) { @@ -1374,7 +1383,7 @@ MSLane::safeInsertionSpeed(const MSVehicle* veh, double seen, const MSLeaderInfo std::cout << " leader=" << leader->getID() << " bPos=" << leader->getBackPositionOnLane(this) << " gap=" << gap << "\n"; } #endif - if ((veh->getParameter().insertionChecks & (int)InsertionCheck::COLLISION) != 0) { + if ((getInsertionChecks(veh) & (int)InsertionCheck::COLLISION) != 0) { return INVALID_SPEED; } else { return 0; @@ -4482,7 +4491,7 @@ MSLane::checkForPedestrians(const MSVehicle* aVehicle, double& speed, double& di if (leader.first != 0) { const double gap = leader.second - aVehicle->getVehicleType().getLengthWithGap(); const double stopSpeed = aVehicle->getCarFollowModel().stopSpeed(aVehicle, speed, gap, MSCFModel::CalcReason::FUTURE); - if ((gap < 0 && (aVehicle->getParameter().insertionChecks & ((int)InsertionCheck::COLLISION | (int)InsertionCheck::PEDESTRIAN)) != 0) + if ((gap < 0 && (getInsertionChecks(aVehicle) & ((int)InsertionCheck::COLLISION | (int)InsertionCheck::PEDESTRIAN)) != 0) || checkFailure(aVehicle, speed, dist, stopSpeed, patchSpeed, "", InsertionCheck::PEDESTRIAN)) { // we may not drive with the given velocity - we crash into the pedestrian #ifdef DEBUG_INSERTION diff --git a/src/microsim/MSLane.h b/src/microsim/MSLane.h index 26a933f189b9..0f4864de47cc 100644 --- a/src/microsim/MSLane.h +++ b/src/microsim/MSLane.h @@ -1623,6 +1623,8 @@ class MSLane : public Named, public Parameterised { static double myCollisionMinGapFactor; static bool myExtrapolateSubstepDepart; + static int getInsertionChecks(const MSVehicle* veh); + /** * @class vehicle_position_sorter * @brief Sorts vehicles by their position (descending) From a0147d8fa385c290530c3601aaca7f077d0cf03a Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 4 Jul 2024 15:27:42 +0200 Subject: [PATCH 079/334] added test refs #21, #15149 --- .../leaderGap_option/errors.sumo | 0 .../leaderGap_option/input_routes.rou.xml | 7 +++ .../leaderGap_option/options.sumo | 3 ++ .../leaderGap_option/output.sumo | 0 .../leaderGap_option/vehroutes.sumo | 48 +++++++++++++++++ .../leaderGap_option/vehroutes.sumo.meso | 53 +++++++++++++++++++ .../departure/insertionChecks/testsuite.sumo | 3 ++ 7 files changed, 114 insertions(+) create mode 100644 tests/sumo/spec/departure/insertionChecks/leaderGap_option/errors.sumo create mode 100644 tests/sumo/spec/departure/insertionChecks/leaderGap_option/input_routes.rou.xml create mode 100644 tests/sumo/spec/departure/insertionChecks/leaderGap_option/options.sumo create mode 100644 tests/sumo/spec/departure/insertionChecks/leaderGap_option/output.sumo create mode 100644 tests/sumo/spec/departure/insertionChecks/leaderGap_option/vehroutes.sumo create mode 100644 tests/sumo/spec/departure/insertionChecks/leaderGap_option/vehroutes.sumo.meso diff --git a/tests/sumo/spec/departure/insertionChecks/leaderGap_option/errors.sumo b/tests/sumo/spec/departure/insertionChecks/leaderGap_option/errors.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/spec/departure/insertionChecks/leaderGap_option/input_routes.rou.xml b/tests/sumo/spec/departure/insertionChecks/leaderGap_option/input_routes.rou.xml new file mode 100644 index 000000000000..9f819f362d47 --- /dev/null +++ b/tests/sumo/spec/departure/insertionChecks/leaderGap_option/input_routes.rou.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/sumo/spec/departure/insertionChecks/leaderGap_option/options.sumo b/tests/sumo/spec/departure/insertionChecks/leaderGap_option/options.sumo new file mode 100644 index 000000000000..32cb93aa724c --- /dev/null +++ b/tests/sumo/spec/departure/insertionChecks/leaderGap_option/options.sumo @@ -0,0 +1,3 @@ +--no-step-log --net-file=net3.net.xml -r=input_routes.rou.xml +--vehroute-output vehroutes.xml +--insertion-checks none diff --git a/tests/sumo/spec/departure/insertionChecks/leaderGap_option/output.sumo b/tests/sumo/spec/departure/insertionChecks/leaderGap_option/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/spec/departure/insertionChecks/leaderGap_option/vehroutes.sumo b/tests/sumo/spec/departure/insertionChecks/leaderGap_option/vehroutes.sumo new file mode 100644 index 000000000000..50f427e14f6d --- /dev/null +++ b/tests/sumo/spec/departure/insertionChecks/leaderGap_option/vehroutes.sumo @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + diff --git a/tests/sumo/spec/departure/insertionChecks/leaderGap_option/vehroutes.sumo.meso b/tests/sumo/spec/departure/insertionChecks/leaderGap_option/vehroutes.sumo.meso new file mode 100644 index 000000000000..2328a19c7fe5 --- /dev/null +++ b/tests/sumo/spec/departure/insertionChecks/leaderGap_option/vehroutes.sumo.meso @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + diff --git a/tests/sumo/spec/departure/insertionChecks/testsuite.sumo b/tests/sumo/spec/departure/insertionChecks/testsuite.sumo index 02dc2e91c20b..423185c6bdd7 100644 --- a/tests/sumo/spec/departure/insertionChecks/testsuite.sumo +++ b/tests/sumo/spec/departure/insertionChecks/testsuite.sumo @@ -4,5 +4,8 @@ stop # remove check on gap to leader leaderGap +# remove check on gap to leader with option +leaderGap_option + # remove check on gap to follower followerGap From b0324eac69d0c7bae7883cdb7e21887d6fb7aa8e Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 4 Jul 2024 15:29:44 +0200 Subject: [PATCH 080/334] using new option for more tests refs #21, #15149 --- tests/sumo/rail/collision_noInsertionChecks/options.sumo | 1 + tests/sumo/rail/testsuite.sumo | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 tests/sumo/rail/collision_noInsertionChecks/options.sumo diff --git a/tests/sumo/rail/collision_noInsertionChecks/options.sumo b/tests/sumo/rail/collision_noInsertionChecks/options.sumo new file mode 100644 index 000000000000..e0f02218f792 --- /dev/null +++ b/tests/sumo/rail/collision_noInsertionChecks/options.sumo @@ -0,0 +1 @@ +--insertion-checks none diff --git a/tests/sumo/rail/testsuite.sumo b/tests/sumo/rail/testsuite.sumo index 7259afe16404..87b6a09b0f80 100644 --- a/tests/sumo/rail/testsuite.sumo +++ b/tests/sumo/rail/testsuite.sumo @@ -67,3 +67,6 @@ crossing # test for various types of train collision collision + +# test for various types of train collision without enforcing insertion checks +collision_noInsertionChecks From 33d5246948c6eb13834d4e6ca0b3b4991052df92 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 4 Jul 2024 15:46:53 +0200 Subject: [PATCH 081/334] adding vehicles to new subDriveWays. refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index af11a31e05ed..156fa533544f 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -1403,6 +1403,20 @@ MSDriveWay::buildSubFoe(MSDriveWay* foe) { } } sub->myCoreSize = sub->myRoute.size(); + + // copy trains that are currently on this driveway (and associated entry events) + for (SUMOVehicle* veh : myTrains) { + if (std::find(sub->myRoute.begin(), sub->myRoute.end(), veh->getEdge()) != sub->myRoute.end()) { + sub->myTrains.insert(veh); + dynamic_cast(veh)->addReminder(sub); + for (const VehicleEvent& ve : myVehicleEvents) { + if (ve.id == veh->getID()) { + sub->myVehicleEvents.push_back(ve); + } + } + } + } + foe->myFoes.push_back(sub); mySubDriveWays.push_back(sub); #ifdef DEBUG_BUILD_SUBDRIVEWAY From 6bc500e45b2ac90952efd49a470d9bd96f9bd004 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 4 Jul 2024 15:47:33 +0200 Subject: [PATCH 082/334] preparing extra insertion checks. refs #7578 --- src/microsim/MSLane.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/microsim/MSLane.cpp b/src/microsim/MSLane.cpp index 8298912be7b6..94c1fd1f992b 100644 --- a/src/microsim/MSLane.cpp +++ b/src/microsim/MSLane.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include "MSNet.h" @@ -854,6 +855,20 @@ MSLane::isInsertionSuccess(MSVehicle* aVehicle, double seen = getLength() - pos; // == distance from insertion position until the end of the currentLane double dist = cfModel.brakeGap(speed) + aVehicle->getVehicleType().getMinGap(); const bool isRail = isRailway(aVehicle->getVClass()); + /* + if (isRail && insertionChecks != (int)InsertionCheck::NONE) { + const MSDriveWay* dw = MSDriveWay::getDepartureDriveway(aVehicle); + MSEdgeVector occupied; + if (dw->foeDriveWayOccupied(false, aVehicle, occupied)) { +#ifdef DEBUG_INSERTION + if (DEBUG_COND2(aVehicle) || DEBUG_COND) { + std::cout << " foe of driveway " + dw->getID() + " has occupied edges " + toString(occupied) << "\n"; + } +#endif + return false; + } + } + */ // do not insert if the bidirectional edge is occupied if (getBidiLane() != nullptr && isRail && getBidiLane()->getVehicleNumberWithPartials() > 0) { if ((insertionChecks & (int)InsertionCheck::BIDI) != 0) { From 4ea7e9a6ac64a18c245785bfd20f36f6f805a547 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 4 Jul 2024 17:27:19 +0200 Subject: [PATCH 083/334] fixed superfluous depart-driveWays after railSignal. refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 156fa533544f..b1715c84a9a0 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -1145,7 +1145,7 @@ MSDriveWay::buildDriveWay(const std::string& id, const MSLink* link, MSRouteIter #ifdef DEBUG_BUILD_DRIVEWAY if (DEBUG_COND_DW) { - std::cout << SIMTIME << " buildDriveWay " << dw->myID << " (" << dw->myNumericalID << ")" + std::cout << SIMTIME << " buildDriveWay " << dw->myID << " link=" << (link == nullptr ? "NULL" : link->getDescription()) << "\n route=" << toString(dw->myRoute) << "\n forward=" << toString(dw->myForward) << "\n bidi=" << toString(dw->myBidi) @@ -1445,9 +1445,10 @@ MSDriveWay::getDepartureDriveway(const SUMOVehicle* veh) { if (edge->getFromJunction()->getType() == SumoXMLNodeType::RAIL_SIGNAL) { for (const MSLane* lane : edge->getLanes()) { for (auto ili : lane->getIncomingLanes()) { - const MSRailSignal* rs = dynamic_cast(ili.viaLink->getTLLogic()); + const MSLink* entry = ili.viaLink->getCorrespondingEntryLink(); + const MSRailSignal* rs = dynamic_cast(entry->getTLLogic()); if (rs != nullptr) { - return &const_cast(rs)->retrieveDriveWayForVeh(ili.viaLink->getTLIndex(), veh); + return &const_cast(rs)->retrieveDriveWayForVeh(entry->getTLIndex(), veh); } } } From dbc98d8bf6bbd33fbd3c8cf3bde3ef97e6698167 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 4 Jul 2024 17:27:47 +0200 Subject: [PATCH 084/334] patching expected results refs #21, #7578 --- .../bugs/ticket12868/railsignalblocks.sumo | 26 +--- .../large_step_size/railsignalblocks.sumo | 23 ++-- .../large_step_size/tls_state.sumo | 116 +++++++++--------- .../railsignalblocks.sumo | 23 ++-- .../small_step_size/railsignalblocks.sumo | 18 +-- .../railsignalblocks.sumo | 18 +-- .../tramwayLoop/basic/railsignalblocks.sumo | 42 +++---- .../track_closed/railsignalblocks.sumo | 44 ++----- 8 files changed, 122 insertions(+), 188 deletions(-) diff --git a/tests/sumo/rail/bugs/ticket12868/railsignalblocks.sumo b/tests/sumo/rail/bugs/ticket12868/railsignalblocks.sumo index a8536b0277b8..15a370c673ba 100644 --- a/tests/sumo/rail/bugs/ticket12868/railsignalblocks.sumo +++ b/tests/sumo/rail/bugs/ticket12868/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - + @@ -79,170 +79,170 @@ SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/tests/sumo/rail/rail_signal/reversal_before_signal/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/reversal_before_signal/railsignalblocks.sumo index 33f513b81552..ed291baacb88 100644 --- a/tests/sumo/rail/rail_signal/reversal_before_signal/railsignalblocks.sumo +++ b/tests/sumo/rail/rail_signal/reversal_before_signal/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - + @@ -79,73 +79,73 @@ SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + diff --git a/tests/sumo/rail/rail_signal/priority/waiting_time_bottom/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/priority/waiting_time_bottom/railsignalblocks.sumo index 32ed471e7ad9..e70c149821e9 100644 --- a/tests/sumo/rail/rail_signal/priority/waiting_time_bottom/railsignalblocks.sumo +++ b/tests/sumo/rail/rail_signal/priority/waiting_time_bottom/railsignalblocks.sumo @@ -1,6 +1,6 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/bugs/deadlock_bidi_reversal2/railsignalblocks.sumo b/tests/sumo/rail/bugs/deadlock_bidi_reversal2/railsignalblocks.sumo index b6f1c4b7953f..34134190c20a 100644 --- a/tests/sumo/rail/bugs/deadlock_bidi_reversal2/railsignalblocks.sumo +++ b/tests/sumo/rail/bugs/deadlock_bidi_reversal2/railsignalblocks.sumo @@ -1,6 +1,6 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/bugs/double_stop/railsignalblocks.sumo b/tests/sumo/rail/bugs/double_stop/railsignalblocks.sumo index bb45a53088cd..17f3fad1acdb 100644 --- a/tests/sumo/rail/bugs/double_stop/railsignalblocks.sumo +++ b/tests/sumo/rail/bugs/double_stop/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/bugs/double_stop/vehroutes.sumo b/tests/sumo/rail/bugs/double_stop/vehroutes.sumo index a69c605950d9..50da333cd51d 100644 --- a/tests/sumo/rail/bugs/double_stop/vehroutes.sumo +++ b/tests/sumo/rail/bugs/double_stop/vehroutes.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/bugs/ticket12184/tripinfos.sumo b/tests/sumo/rail/bugs/ticket12184/tripinfos.sumo index c33f96d0297e..258b73eefba7 100644 --- a/tests/sumo/rail/bugs/ticket12184/tripinfos.sumo +++ b/tests/sumo/rail/bugs/ticket12184/tripinfos.sumo @@ -1,6 +1,6 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/bugs/ticket12868/railsignalblocks.sumo b/tests/sumo/rail/bugs/ticket12868/railsignalblocks.sumo index 7c0706deaa88..d9b58265c5c4 100644 --- a/tests/sumo/rail/bugs/ticket12868/railsignalblocks.sumo +++ b/tests/sumo/rail/bugs/ticket12868/railsignalblocks.sumo @@ -1,6 +1,6 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/collision/frontal_collision/errors.sumo b/tests/sumo/rail/collision/frontal_collision/errors.sumo index 9c448b5b70c4..e69de29bb2d1 100644 --- a/tests/sumo/rail/collision/frontal_collision/errors.sumo +++ b/tests/sumo/rail/collision/frontal_collision/errors.sumo @@ -1,2 +0,0 @@ -Warning: Vehicle 'RE2'; collision with vehicle 'RE1', lane='-c_0', gap=-1.00, time=106.00 stage=move. -Warning: Vehicle 'RE1'; collision with vehicle 'RE2', lane='d_0', gap=-1.00, time=106.00 stage=move. diff --git a/tests/sumo/rail/collision/frontal_collision/railsignalblocks.sumo b/tests/sumo/rail/collision/frontal_collision/railsignalblocks.sumo index 01d0b159fdec..722496fa4147 100644 --- a/tests/sumo/rail/collision/frontal_collision/railsignalblocks.sumo +++ b/tests/sumo/rail/collision/frontal_collision/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/collision/frontal_collision_further/errors.sumo b/tests/sumo/rail/collision/frontal_collision_further/errors.sumo index 166366d2ebf0..e69de29bb2d1 100644 --- a/tests/sumo/rail/collision/frontal_collision_further/errors.sumo +++ b/tests/sumo/rail/collision/frontal_collision_further/errors.sumo @@ -1 +0,0 @@ -Warning: Vehicle 'RE1'; collision with vehicle 'RE2', lane='-c_0', gap=-1.00, time=110.00 stage=move. diff --git a/tests/sumo/rail/collision/frontal_collision_further/railsignalblocks.sumo b/tests/sumo/rail/collision/frontal_collision_further/railsignalblocks.sumo index 01d0b159fdec..722496fa4147 100644 --- a/tests/sumo/rail/collision/frontal_collision_further/railsignalblocks.sumo +++ b/tests/sumo/rail/collision/frontal_collision_further/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/collision/frontal_collision_jump/railsignalblocks.sumo b/tests/sumo/rail/collision/frontal_collision_jump/railsignalblocks.sumo index 01d0b159fdec..d995f454fba4 100644 --- a/tests/sumo/rail/collision/frontal_collision_jump/railsignalblocks.sumo +++ b/tests/sumo/rail/collision/frontal_collision_jump/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/collision/frontal_collision_jump_sameEdge/errors.sumo b/tests/sumo/rail/collision/frontal_collision_jump_sameEdge/errors.sumo index c49d04863a65..e69de29bb2d1 100644 --- a/tests/sumo/rail/collision/frontal_collision_jump_sameEdge/errors.sumo +++ b/tests/sumo/rail/collision/frontal_collision_jump_sameEdge/errors.sumo @@ -1,2 +0,0 @@ -Warning: Vehicle 'RE2'; frontal collision with vehicle 'RE1', lane='-d_0', gap=-1.00, time=110.00 stage=move. -Warning: Vehicle 'RE1'; frontal collision with vehicle 'RE2', lane='d_0', gap=-1.00, time=110.00 stage=move. diff --git a/tests/sumo/rail/collision/frontal_collision_jump_sameEdge/railsignalblocks.sumo b/tests/sumo/rail/collision/frontal_collision_jump_sameEdge/railsignalblocks.sumo index 01d0b159fdec..722496fa4147 100644 --- a/tests/sumo/rail/collision/frontal_collision_jump_sameEdge/railsignalblocks.sumo +++ b/tests/sumo/rail/collision/frontal_collision_jump_sameEdge/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/collision/frontal_collision_reverseRoles/errors.sumo b/tests/sumo/rail/collision/frontal_collision_reverseRoles/errors.sumo index 50589c87b909..e69de29bb2d1 100644 --- a/tests/sumo/rail/collision/frontal_collision_reverseRoles/errors.sumo +++ b/tests/sumo/rail/collision/frontal_collision_reverseRoles/errors.sumo @@ -1,2 +0,0 @@ -Warning: Teleporting vehicle 'RE1'; frontal collision with vehicle 'RE2', lane='-d_0', gap=-1.00, time=108.00 stage=move. -Warning: Vehicle 'RE1' ends teleporting on edge 'e', time=108.00. diff --git a/tests/sumo/rail/collision/frontal_collision_reverseRoles/railsignalblocks.sumo b/tests/sumo/rail/collision/frontal_collision_reverseRoles/railsignalblocks.sumo index 01d0b159fdec..d995f454fba4 100644 --- a/tests/sumo/rail/collision/frontal_collision_reverseRoles/railsignalblocks.sumo +++ b/tests/sumo/rail/collision/frontal_collision_reverseRoles/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/crossing/space-gap/railsignalblocks.sumo b/tests/sumo/rail/crossing/space-gap/railsignalblocks.sumo index 7dd234787a17..d5b91db7c52e 100644 --- a/tests/sumo/rail/crossing/space-gap/railsignalblocks.sumo +++ b/tests/sumo/rail/crossing/space-gap/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/crossing/time-gap/railsignalblocks.sumo b/tests/sumo/rail/crossing/time-gap/railsignalblocks.sumo index 7dd234787a17..d5b91db7c52e 100644 --- a/tests/sumo/rail/crossing/time-gap/railsignalblocks.sumo +++ b/tests/sumo/rail/crossing/time-gap/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/model_railroad/railsignalblocks.sumo b/tests/sumo/rail/model_railroad/railsignalblocks.sumo index 7d3ca714578e..4e05ede63677 100644 --- a/tests/sumo/rail/model_railroad/railsignalblocks.sumo +++ b/tests/sumo/rail/model_railroad/railsignalblocks.sumo @@ -1,17 +1,22 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/overlapping_driveways/railsignalvehs.sumo b/tests/sumo/rail/overlapping_driveways/railsignalvehs.sumo index fa5cf0ea3c04..9221dc01f712 100644 --- a/tests/sumo/rail/overlapping_driveways/railsignalvehs.sumo +++ b/tests/sumo/rail/overlapping_driveways/railsignalvehs.sumo @@ -3,12 +3,12 @@ - - - + + + - - + + @@ -17,14 +17,14 @@ - + - - - - + + + + @@ -41,22 +41,22 @@ - - - - + + + + - - - - - - + + + + + + diff --git a/tests/sumo/rail/portion_working/join/railsignalblocks.sumo b/tests/sumo/rail/portion_working/join/railsignalblocks.sumo index f74b7aa099e2..dd7bf123c313 100644 --- a/tests/sumo/rail/portion_working/join/railsignalblocks.sumo +++ b/tests/sumo/rail/portion_working/join/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/portion_working/join_RB425/railsignalblocks.sumo b/tests/sumo/rail/portion_working/join_RB425/railsignalblocks.sumo index f74b7aa099e2..dd7bf123c313 100644 --- a/tests/sumo/rail/portion_working/join_RB425/railsignalblocks.sumo +++ b/tests/sumo/rail/portion_working/join_RB425/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/portion_working/join_fail/railsignalblocks.sumo b/tests/sumo/rail/portion_working/join_fail/railsignalblocks.sumo index f74b7aa099e2..777a6caa3b52 100644 --- a/tests/sumo/rail/portion_working/join_fail/railsignalblocks.sumo +++ b/tests/sumo/rail/portion_working/join_fail/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/portion_working/join_fail_abort/railsignalblocks.sumo b/tests/sumo/rail/portion_working/join_fail_abort/railsignalblocks.sumo index f74b7aa099e2..e7daa18cc66c 100644 --- a/tests/sumo/rail/portion_working/join_fail_abort/railsignalblocks.sumo +++ b/tests/sumo/rail/portion_working/join_fail_abort/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/portion_working/join_front/railsignalblocks.sumo b/tests/sumo/rail/portion_working/join_front/railsignalblocks.sumo index f74b7aa099e2..26d463c83630 100644 --- a/tests/sumo/rail/portion_working/join_front/railsignalblocks.sumo +++ b/tests/sumo/rail/portion_working/join_front/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/portion_working/join_front_further/errors.sumo b/tests/sumo/rail/portion_working/join_front_further/errors.sumo index e69de29bb2d1..e7ad53455795 100644 --- a/tests/sumo/rail/portion_working/join_front_further/errors.sumo +++ b/tests/sumo/rail/portion_working/join_front_further/errors.sumo @@ -0,0 +1 @@ +Warning: Vehicle 't1' aborts stop. diff --git a/tests/sumo/rail/portion_working/join_front_further/railsignalblocks.sumo b/tests/sumo/rail/portion_working/join_front_further/railsignalblocks.sumo index f74b7aa099e2..bd1466c0ce1e 100644 --- a/tests/sumo/rail/portion_working/join_front_further/railsignalblocks.sumo +++ b/tests/sumo/rail/portion_working/join_front_further/railsignalblocks.sumo @@ -1,23 +1,28 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/portion_working/join_front_further/stopinfos.sumo b/tests/sumo/rail/portion_working/join_front_further/stopinfos.sumo index ec8437a013db..ed5417ac710d 100644 --- a/tests/sumo/rail/portion_working/join_front_further/stopinfos.sumo +++ b/tests/sumo/rail/portion_working/join_front_further/stopinfos.sumo @@ -1,6 +1,6 @@ - - - + + diff --git a/tests/sumo/rail/portion_working/join_front_further/tripinfos.sumo b/tests/sumo/rail/portion_working/join_front_further/tripinfos.sumo index f8463ca5334c..ba700c1e4e68 100644 --- a/tests/sumo/rail/portion_working/join_front_further/tripinfos.sumo +++ b/tests/sumo/rail/portion_working/join_front_further/tripinfos.sumo @@ -1,6 +1,6 @@ - - - + + diff --git a/tests/sumo/rail/portion_working/join_front_route_invalid/railsignalblocks.sumo b/tests/sumo/rail/portion_working/join_front_route_invalid/railsignalblocks.sumo index f74b7aa099e2..4c9a0c32d864 100644 --- a/tests/sumo/rail/portion_working/join_front_route_invalid/railsignalblocks.sumo +++ b/tests/sumo/rail/portion_working/join_front_route_invalid/railsignalblocks.sumo @@ -1,23 +1,28 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/portion_working/join_front_route_problem/railsignalblocks.sumo b/tests/sumo/rail/portion_working/join_front_route_problem/railsignalblocks.sumo index f74b7aa099e2..46e432dbb82e 100644 --- a/tests/sumo/rail/portion_working/join_front_route_problem/railsignalblocks.sumo +++ b/tests/sumo/rail/portion_working/join_front_route_problem/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/portion_working/locomotive_switches_sides/railsignalblocks.sumo b/tests/sumo/rail/portion_working/locomotive_switches_sides/railsignalblocks.sumo index f74b7aa099e2..0738ed2d4e1d 100644 --- a/tests/sumo/rail/portion_working/locomotive_switches_sides/railsignalblocks.sumo +++ b/tests/sumo/rail/portion_working/locomotive_switches_sides/railsignalblocks.sumo @@ -1,23 +1,28 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/portion_working/split/railsignalblocks.sumo b/tests/sumo/rail/portion_working/split/railsignalblocks.sumo index f74b7aa099e2..1f6abb35c034 100644 --- a/tests/sumo/rail/portion_working/split/railsignalblocks.sumo +++ b/tests/sumo/rail/portion_working/split/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/portion_working/splitFront/railsignalblocks.sumo b/tests/sumo/rail/portion_working/splitFront/railsignalblocks.sumo index f74b7aa099e2..1f6abb35c034 100644 --- a/tests/sumo/rail/portion_working/splitFront/railsignalblocks.sumo +++ b/tests/sumo/rail/portion_working/splitFront/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/portion_working/split_departPosDefault/railsignalblocks.sumo b/tests/sumo/rail/portion_working/split_departPosDefault/railsignalblocks.sumo index f74b7aa099e2..dd2d808fbbaa 100644 --- a/tests/sumo/rail/portion_working/split_departPosDefault/railsignalblocks.sumo +++ b/tests/sumo/rail/portion_working/split_departPosDefault/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/portion_working/split_departPosDefault/tripinfos.sumo b/tests/sumo/rail/portion_working/split_departPosDefault/tripinfos.sumo index 3b065dfe667e..78199f2ba437 100644 --- a/tests/sumo/rail/portion_working/split_departPosDefault/tripinfos.sumo +++ b/tests/sumo/rail/portion_working/split_departPosDefault/tripinfos.sumo @@ -1,6 +1,6 @@ - + + + + + + diff --git a/tests/sumo/rail/portion_working/split_departPosDefault_legacy/net.net.xml b/tests/sumo/rail/portion_working/split_departPosDefault_legacy/net.net.xml new file mode 100644 index 000000000000..aa6b81443753 --- /dev/null +++ b/tests/sumo/rail/portion_working/split_departPosDefault_legacy/net.net.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/portion_working/split_departPosDefault_legacy/options.sumo b/tests/sumo/rail/portion_working/split_departPosDefault_legacy/options.sumo new file mode 100644 index 000000000000..f49a7a360c1a --- /dev/null +++ b/tests/sumo/rail/portion_working/split_departPosDefault_legacy/options.sumo @@ -0,0 +1,4 @@ +--no-step-log --no-duration-log --net-file=net.net.xml --routes=input_routes.rou.xml +-a input_additional.add.xml +--tripinfo-output tripinfos.xml +--stop-output stopinfos.xml diff --git a/tests/sumo/rail/portion_working/split_departPosDefault_legacy/output.sumo b/tests/sumo/rail/portion_working/split_departPosDefault_legacy/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/portion_working/split_departPosDefault_legacy/railsignalblocks.sumo b/tests/sumo/rail/portion_working/split_departPosDefault_legacy/railsignalblocks.sumo new file mode 100644 index 000000000000..dd2d808fbbaa --- /dev/null +++ b/tests/sumo/rail/portion_working/split_departPosDefault_legacy/railsignalblocks.sumo @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/portion_working/split_departPosDefault_legacy/stopinfos.sumo b/tests/sumo/rail/portion_working/split_departPosDefault_legacy/stopinfos.sumo new file mode 100644 index 000000000000..53b41d1f7465 --- /dev/null +++ b/tests/sumo/rail/portion_working/split_departPosDefault_legacy/stopinfos.sumo @@ -0,0 +1,45 @@ + + + + + + + + diff --git a/tests/sumo/rail/portion_working/split_departPosDefault_legacy/stopinfos.sumo.meso b/tests/sumo/rail/portion_working/split_departPosDefault_legacy/stopinfos.sumo.meso new file mode 100644 index 000000000000..1a92ae3d7bca --- /dev/null +++ b/tests/sumo/rail/portion_working/split_departPosDefault_legacy/stopinfos.sumo.meso @@ -0,0 +1,48 @@ + + + + + + + diff --git a/tests/sumo/rail/portion_working/split_departPosDefault_legacy/tripinfos.sumo b/tests/sumo/rail/portion_working/split_departPosDefault_legacy/tripinfos.sumo new file mode 100644 index 000000000000..98bc8f8dc540 --- /dev/null +++ b/tests/sumo/rail/portion_working/split_departPosDefault_legacy/tripinfos.sumo @@ -0,0 +1,46 @@ + + + + + + + + + diff --git a/tests/sumo/rail/portion_working/split_departPosDefault_legacy/tripinfos.sumo.meso b/tests/sumo/rail/portion_working/split_departPosDefault_legacy/tripinfos.sumo.meso new file mode 100644 index 000000000000..d23379c0709b --- /dev/null +++ b/tests/sumo/rail/portion_working/split_departPosDefault_legacy/tripinfos.sumo.meso @@ -0,0 +1,49 @@ + + + + + + + + diff --git a/tests/sumo/rail/portion_working/split_longTrain/railsignalblocks.sumo b/tests/sumo/rail/portion_working/split_longTrain/railsignalblocks.sumo index f74b7aa099e2..136240544da1 100644 --- a/tests/sumo/rail/portion_working/split_longTrain/railsignalblocks.sumo +++ b/tests/sumo/rail/portion_working/split_longTrain/railsignalblocks.sumo @@ -1,23 +1,28 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/portion_working/testsuite.sumo b/tests/sumo/rail/portion_working/testsuite.sumo index d8cda61fa415..4959cca3b91f 100644 --- a/tests/sumo/rail/portion_working/testsuite.sumo +++ b/tests/sumo/rail/portion_working/testsuite.sumo @@ -10,6 +10,9 @@ splitFront # split a train into two parts without specifing the departPos of the train that is created by splitting split_departPosDefault +# split a train into two parts without specifing the departPos of the train that is created by splitting +split_departPosDefault_legacy + # split a train into a long rear part and a short front part split_longTrain diff --git a/tests/sumo/rail/portion_working/transportables/join_containers/railsignalblocks.sumo b/tests/sumo/rail/portion_working/transportables/join_containers/railsignalblocks.sumo index f74b7aa099e2..dd7bf123c313 100644 --- a/tests/sumo/rail/portion_working/transportables/join_containers/railsignalblocks.sumo +++ b/tests/sumo/rail/portion_working/transportables/join_containers/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/portion_working/transportables/join_persons/railsignalblocks.sumo b/tests/sumo/rail/portion_working/transportables/join_persons/railsignalblocks.sumo index f74b7aa099e2..dd7bf123c313 100644 --- a/tests/sumo/rail/portion_working/transportables/join_persons/railsignalblocks.sumo +++ b/tests/sumo/rail/portion_working/transportables/join_persons/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/portion_working/transportables/split_containers/railsignalblocks.sumo b/tests/sumo/rail/portion_working/transportables/split_containers/railsignalblocks.sumo index f74b7aa099e2..1f6abb35c034 100644 --- a/tests/sumo/rail/portion_working/transportables/split_containers/railsignalblocks.sumo +++ b/tests/sumo/rail/portion_working/transportables/split_containers/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/portion_working/transportables/split_containers_noStop/railsignalblocks.sumo b/tests/sumo/rail/portion_working/transportables/split_containers_noStop/railsignalblocks.sumo index f74b7aa099e2..1f6abb35c034 100644 --- a/tests/sumo/rail/portion_working/transportables/split_containers_noStop/railsignalblocks.sumo +++ b/tests/sumo/rail/portion_working/transportables/split_containers_noStop/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/deadlock_insertion/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/deadlock_insertion/railsignalblocks.sumo index 4b3cf05c4a92..be7168ec146e 100644 --- a/tests/sumo/rail/rail_signal/deadlock_insertion/railsignalblocks.sumo +++ b/tests/sumo/rail/rail_signal/deadlock_insertion/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - - + + diff --git a/tests/sumo/rail/rail_signal/end_block_mode/end_after_bidi/vehroutes.sumo b/tests/sumo/rail/rail_signal/end_block_mode/end_after_bidi/vehroutes.sumo index f787be49bde9..959337bb53ba 100644 --- a/tests/sumo/rail/rail_signal/end_block_mode/end_after_bidi/vehroutes.sumo +++ b/tests/sumo/rail/rail_signal/end_block_mode/end_after_bidi/vehroutes.sumo @@ -1,11 +1,16 @@ - - + diff --git a/tests/sumo/rail/rail_signal/insertionConstraints/insertionOrder/tripinfos.sumo b/tests/sumo/rail/rail_signal/insertionConstraints/insertionOrder/tripinfos.sumo index fede7bf1eece..735b44a4448e 100644 --- a/tests/sumo/rail/rail_signal/insertionConstraints/insertionOrder/tripinfos.sumo +++ b/tests/sumo/rail/rail_signal/insertionConstraints/insertionOrder/tripinfos.sumo @@ -1,6 +1,6 @@ - - + diff --git a/tests/sumo/rail/rail_signal/moving_block/protect_bidi/tripinfos.sumo b/tests/sumo/rail/rail_signal/moving_block/protect_bidi/tripinfos.sumo index 858eda898817..f497673ec3a8 100644 --- a/tests/sumo/rail/rail_signal/moving_block/protect_bidi/tripinfos.sumo +++ b/tests/sumo/rail/rail_signal/moving_block/protect_bidi/tripinfos.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/anticipate_reversal_unafe_insertion/railsignalblocks.sumo b/tests/sumo/rail/reversal/anticipate_reversal_unafe_insertion/railsignalblocks.sumo index 601778f00b86..8d0ca8b16517 100644 --- a/tests/sumo/rail/reversal/anticipate_reversal_unafe_insertion/railsignalblocks.sumo +++ b/tests/sumo/rail/reversal/anticipate_reversal_unafe_insertion/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reverse_at_route_end/railsignalblocks.sumo b/tests/sumo/rail/reversal/reverse_at_route_end/railsignalblocks.sumo index bb45a53088cd..423fea7c9fbe 100644 --- a/tests/sumo/rail/reversal/reverse_at_route_end/railsignalblocks.sumo +++ b/tests/sumo/rail/reversal/reverse_at_route_end/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reverse_at_route_end_impossible/railsignalblocks.sumo b/tests/sumo/rail/reversal/reverse_at_route_end_impossible/railsignalblocks.sumo index bb45a53088cd..b8ad97c64d73 100644 --- a/tests/sumo/rail/reversal/reverse_at_route_end_impossible/railsignalblocks.sumo +++ b/tests/sumo/rail/reversal/reverse_at_route_end_impossible/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reverse_at_stop/railsignalblocks.sumo b/tests/sumo/rail/reversal/reverse_at_stop/railsignalblocks.sumo index bb45a53088cd..3e9f84aad9e8 100644 --- a/tests/sumo/rail/reversal/reverse_at_stop/railsignalblocks.sumo +++ b/tests/sumo/rail/reversal/reverse_at_stop/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reverse_before_further_stop/railsignalblocks.sumo b/tests/sumo/rail/reversal/reverse_before_further_stop/railsignalblocks.sumo index bb45a53088cd..3e9f84aad9e8 100644 --- a/tests/sumo/rail/reversal/reverse_before_further_stop/railsignalblocks.sumo +++ b/tests/sumo/rail/reversal/reverse_before_further_stop/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reverse_before_further_stop_tooLong/railsignalblocks.sumo b/tests/sumo/rail/reversal/reverse_before_further_stop_tooLong/railsignalblocks.sumo index bb45a53088cd..3e9f84aad9e8 100644 --- a/tests/sumo/rail/reversal/reverse_before_further_stop_tooLong/railsignalblocks.sumo +++ b/tests/sumo/rail/reversal/reverse_before_further_stop_tooLong/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reverse_before_stop/railsignalblocks.sumo b/tests/sumo/rail/reversal/reverse_before_stop/railsignalblocks.sumo index bb45a53088cd..3e9f84aad9e8 100644 --- a/tests/sumo/rail/reversal/reverse_before_stop/railsignalblocks.sumo +++ b/tests/sumo/rail/reversal/reverse_before_stop/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reverse_before_stop_impossible/railsignalblocks.sumo b/tests/sumo/rail/reversal/reverse_before_stop_impossible/railsignalblocks.sumo index bb45a53088cd..3e9f84aad9e8 100644 --- a/tests/sumo/rail/reversal/reverse_before_stop_impossible/railsignalblocks.sumo +++ b/tests/sumo/rail/reversal/reverse_before_stop_impossible/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reverse_before_stop_no_internal_links/railsignalblocks.sumo b/tests/sumo/rail/reversal/reverse_before_stop_no_internal_links/railsignalblocks.sumo index bb45a53088cd..7c3cd48e47ae 100644 --- a/tests/sumo/rail/reversal/reverse_before_stop_no_internal_links/railsignalblocks.sumo +++ b/tests/sumo/rail/reversal/reverse_before_stop_no_internal_links/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reverse_no_internal_links/railsignalblocks.sumo b/tests/sumo/rail/reversal/reverse_no_internal_links/railsignalblocks.sumo index bb45a53088cd..7c3cd48e47ae 100644 --- a/tests/sumo/rail/reversal/reverse_no_internal_links/railsignalblocks.sumo +++ b/tests/sumo/rail/reversal/reverse_no_internal_links/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reverse_no_link/railsignalblocks.sumo b/tests/sumo/rail/reversal/reverse_no_link/railsignalblocks.sumo index 78744eb06d8a..98d192411456 100644 --- a/tests/sumo/rail/reversal/reverse_no_link/railsignalblocks.sumo +++ b/tests/sumo/rail/reversal/reverse_no_link/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reverse_no_stop/railsignalblocks.sumo b/tests/sumo/rail/reversal/reverse_no_stop/railsignalblocks.sumo index bb45a53088cd..3e9f84aad9e8 100644 --- a/tests/sumo/rail/reversal/reverse_no_stop/railsignalblocks.sumo +++ b/tests/sumo/rail/reversal/reverse_no_stop/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/routing/reversal_possible/railsignalblocks.sumo b/tests/sumo/rail/routing/reversal_possible/railsignalblocks.sumo index 601778f00b86..5840f01f4999 100644 --- a/tests/sumo/rail/routing/reversal_possible/railsignalblocks.sumo +++ b/tests/sumo/rail/routing/reversal_possible/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/routing/reversal_possible_slack/railsignalblocks.sumo b/tests/sumo/rail/routing/reversal_possible_slack/railsignalblocks.sumo index 601778f00b86..537952c9d9e2 100644 --- a/tests/sumo/rail/routing/reversal_possible_slack/railsignalblocks.sumo +++ b/tests/sumo/rail/routing/reversal_possible_slack/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/routing/reverse_short_start/railsignalblocks.sumo b/tests/sumo/rail/routing/reverse_short_start/railsignalblocks.sumo index 601778f00b86..26f3a607075a 100644 --- a/tests/sumo/rail/routing/reverse_short_start/railsignalblocks.sumo +++ b/tests/sumo/rail/routing/reverse_short_start/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/routing/reverse_short_start_stops/railsignalblocks.sumo b/tests/sumo/rail/routing/reverse_short_start_stops/railsignalblocks.sumo index 601778f00b86..d1e70e730f8b 100644 --- a/tests/sumo/rail/routing/reverse_short_start_stops/railsignalblocks.sumo +++ b/tests/sumo/rail/routing/reverse_short_start_stops/railsignalblocks.sumo @@ -1,16 +1,22 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/routing/short_buffer/railsignalblocks.sumo b/tests/sumo/rail/routing/short_buffer/railsignalblocks.sumo index 601778f00b86..a80e5808cb2c 100644 --- a/tests/sumo/rail/routing/short_buffer/railsignalblocks.sumo +++ b/tests/sumo/rail/routing/short_buffer/railsignalblocks.sumo @@ -1,11 +1,16 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/tramwayLoop/basic/output.sumo b/tests/sumo/rail/tramwayLoop/basic/output.sumo index c124faeba74e..748b5b4e83a9 100644 --- a/tests/sumo/rail/tramwayLoop/basic/output.sumo +++ b/tests/sumo/rail/tramwayLoop/basic/output.sumo @@ -1,24 +1,24 @@ Loading net-file from 'net.net.xml' ... done (3ms). Loading additional-files from 'input_additional.add.xml' ... done (0ms). Loading done. -Simulation version v1_20_0+0399-3c678c104b8 started with time: 0.00. +Simulation version v1_20_0+0455-eda2cef667b started with time: 0.00. Simulation ended at time: 2991.00 Reason: All vehicles have left the simulation. Performance: Duration: 0.09s Real time factor: 33233.3 - UPS: 213077.777778 + UPS: 212644.444444 Vehicles: Inserted: 9 Running: 0 Waiting: 0 Statistics (avg of 9): RouteLength: 41665.54 - Speed: 19.32 - Duration: 2130.78 - WaitingTime: 21.22 - TimeLoss: 789.89 - DepartDelay: 0.67 + Speed: 19.35 + Duration: 2126.44 + WaitingTime: 18.44 + TimeLoss: 785.66 + DepartDelay: 5.00 -DijkstraRouter answered 5907 queries and explored 29.37 edges on average. +DijkstraRouter answered 5884 queries and explored 29.34 edges on average. DijkstraRouter spent 0.01s answering queries (0.00ms on average). diff --git a/tests/sumo/rail/tramwayLoop/basic/tripinfos.sumo b/tests/sumo/rail/tramwayLoop/basic/tripinfos.sumo index 81719d2f4ee5..3ff1c38bc61e 100644 --- a/tests/sumo/rail/tramwayLoop/basic/tripinfos.sumo +++ b/tests/sumo/rail/tramwayLoop/basic/tripinfos.sumo @@ -1,6 +1,6 @@ - - - + + - - + + diff --git a/tests/sumo/rail/tramwayLoop/basic/vehroutes.sumo b/tests/sumo/rail/tramwayLoop/basic/vehroutes.sumo index 1da8b90a8dde..6da817e6aeff 100644 --- a/tests/sumo/rail/tramwayLoop/basic/vehroutes.sumo +++ b/tests/sumo/rail/tramwayLoop/basic/vehroutes.sumo @@ -1,6 +1,6 @@ - - - + + - - + + diff --git a/tests/sumo/rail/tramwayLoop/track_closed/vehroutes.sumo b/tests/sumo/rail/tramwayLoop/track_closed/vehroutes.sumo index 51d0490e6b95..c5438dc68dce 100644 --- a/tests/sumo/rail/tramwayLoop/track_closed/vehroutes.sumo +++ b/tests/sumo/rail/tramwayLoop/track_closed/vehroutes.sumo @@ -1,6 +1,6 @@ - - - + + diff --git a/tests/sumo/rail/rail_signal/indirect_guard_route_conflict/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/indirect_guard_route_conflict/railsignalblocks.sumo index 636ba30cb207..8d855b5e75ff 100644 --- a/tests/sumo/rail/rail_signal/indirect_guard_route_conflict/railsignalblocks.sumo +++ b/tests/sumo/rail/rail_signal/indirect_guard_route_conflict/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - - + + diff --git a/tests/sumo/rail/rail_signal/indirect_guard_route_conflict_reroute/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/indirect_guard_route_conflict_reroute/railsignalblocks.sumo index 394b5656182a..ad2d375fae76 100644 --- a/tests/sumo/rail/rail_signal/indirect_guard_route_conflict_reroute/railsignalblocks.sumo +++ b/tests/sumo/rail/rail_signal/indirect_guard_route_conflict_reroute/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - - + + diff --git a/tests/sumo/rail/bugs/ticket13262/errors.sumo b/tests/sumo/rail/bugs/ticket13262/errors.sumo index 722aac5b2344..e69de29bb2d1 100644 --- a/tests/sumo/rail/bugs/ticket13262/errors.sumo +++ b/tests/sumo/rail/bugs/ticket13262/errors.sumo @@ -1,2 +0,0 @@ -Warning: Teleporting vehicle 'v_1'; frontal collision with vehicle 'v_0', lane='E5_0', gap=-1.00, time=103.00 stage=move. -Warning: Vehicle 'v_1' ends teleporting on edge '-E4', time=104.00. diff --git a/tests/sumo/rail/bugs/ticket13262/railsignalblocks.sumo b/tests/sumo/rail/bugs/ticket13262/railsignalblocks.sumo index dd1299aa2460..b6b48c62d1cc 100644 --- a/tests/sumo/rail/bugs/ticket13262/railsignalblocks.sumo +++ b/tests/sumo/rail/bugs/ticket13262/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - - + + diff --git a/tests/sumo/rail/bugs/merge_check_flank_switch/tls_state.sumo b/tests/sumo/rail/bugs/merge_check_flank_switch/tls_state.sumo index d21014467646..06392a634b60 100644 --- a/tests/sumo/rail/bugs/merge_check_flank_switch/tls_state.sumo +++ b/tests/sumo/rail/bugs/merge_check_flank_switch/tls_state.sumo @@ -1,6 +1,6 @@ - @@ -46,7 +47,7 @@ SPDX-License-Identifier: EPL-2.0 - + @@ -56,7 +57,7 @@ SPDX-License-Identifier: EPL-2.0 - + diff --git a/tests/sumo/cf_model/rail/accel/NGT400/errors.sumo b/tests/sumo/cf_model/rail/accel/NGT400/errors.sumo index e69de29bb2d1..7cd189c07e9a 100644 --- a/tests/sumo/cf_model/rail/accel/NGT400/errors.sumo +++ b/tests/sumo/cf_model/rail/accel/NGT400/errors.sumo @@ -0,0 +1 @@ +Warning: Block after insertion lane 'e0_0' exceeds maximum length (stopped searching after edge 'e2' (length=21998.62m). diff --git a/tests/sumo/cf_model/rail/accel/NGT400_16/errors.sumo b/tests/sumo/cf_model/rail/accel/NGT400_16/errors.sumo index e69de29bb2d1..7cd189c07e9a 100644 --- a/tests/sumo/cf_model/rail/accel/NGT400_16/errors.sumo +++ b/tests/sumo/cf_model/rail/accel/NGT400_16/errors.sumo @@ -0,0 +1 @@ +Warning: Block after insertion lane 'e0_0' exceeds maximum length (stopped searching after edge 'e2' (length=21998.62m). diff --git a/tests/sumo/cf_model/rail/accel/RB425/errors.sumo b/tests/sumo/cf_model/rail/accel/RB425/errors.sumo index e69de29bb2d1..7cd189c07e9a 100644 --- a/tests/sumo/cf_model/rail/accel/RB425/errors.sumo +++ b/tests/sumo/cf_model/rail/accel/RB425/errors.sumo @@ -0,0 +1 @@ +Warning: Block after insertion lane 'e0_0' exceeds maximum length (stopped searching after edge 'e2' (length=21998.62m). diff --git a/tests/sumo/cf_model/rail/accel/RB628/errors.sumo b/tests/sumo/cf_model/rail/accel/RB628/errors.sumo index e69de29bb2d1..7cd189c07e9a 100644 --- a/tests/sumo/cf_model/rail/accel/RB628/errors.sumo +++ b/tests/sumo/cf_model/rail/accel/RB628/errors.sumo @@ -0,0 +1 @@ +Warning: Block after insertion lane 'e0_0' exceeds maximum length (stopped searching after edge 'e2' (length=21998.62m). diff --git a/tests/sumo/cf_model/rail/accel/REDosto7/errors.sumo b/tests/sumo/cf_model/rail/accel/REDosto7/errors.sumo index e69de29bb2d1..7cd189c07e9a 100644 --- a/tests/sumo/cf_model/rail/accel/REDosto7/errors.sumo +++ b/tests/sumo/cf_model/rail/accel/REDosto7/errors.sumo @@ -0,0 +1 @@ +Warning: Block after insertion lane 'e0_0' exceeds maximum length (stopped searching after edge 'e2' (length=21998.62m). diff --git a/tests/sumo/cf_model/rail/accel/custom_curves/errors.sumo b/tests/sumo/cf_model/rail/accel/custom_curves/errors.sumo index e69de29bb2d1..7cd189c07e9a 100644 --- a/tests/sumo/cf_model/rail/accel/custom_curves/errors.sumo +++ b/tests/sumo/cf_model/rail/accel/custom_curves/errors.sumo @@ -0,0 +1 @@ +Warning: Block after insertion lane 'e0_0' exceeds maximum length (stopped searching after edge 'e2' (length=21998.62m). diff --git a/tests/sumo/cf_model/rail/accel/custom_tables/errors.sumo b/tests/sumo/cf_model/rail/accel/custom_tables/errors.sumo index e69de29bb2d1..7cd189c07e9a 100644 --- a/tests/sumo/cf_model/rail/accel/custom_tables/errors.sumo +++ b/tests/sumo/cf_model/rail/accel/custom_tables/errors.sumo @@ -0,0 +1 @@ +Warning: Block after insertion lane 'e0_0' exceeds maximum length (stopped searching after edge 'e2' (length=21998.62m). diff --git a/tests/sumo/devices/fcd-replay/persons/options.sumo b/tests/sumo/devices/fcd-replay/persons/options.sumo index 58d75f89004a..9312b0c59efa 100644 --- a/tests/sumo/devices/fcd-replay/persons/options.sumo +++ b/tests/sumo/devices/fcd-replay/persons/options.sumo @@ -1,2 +1,3 @@ --no-step-log --no-duration-log --net-file=net.net.xml --intermodal-collision.action none -a input_additional.add.xml --fcd-output fcd.xml --device.fcd-replay.file input_state.xml +--railsignal-moving-block From 7b4f56687825935a921c10186be580e5a709eda7 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 1 Aug 2024 09:24:35 +0200 Subject: [PATCH 130/334] avoid gui freeze due to unreleased lock. refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index b48ea28e26f0..80cc0710539c 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -494,6 +494,7 @@ MSDriveWay::deadlockLaneOccupied(const SUMOVehicle* ego, bool store) const { assert(myBidi.size() != 0); const MSEdge* lastBidi = myBidi.back()->getNextNormal(); MSVehicle* foe = lane->getVehiclesSecure().front(); + lane->releaseVehicles(); if (foe == ego) { continue; } @@ -520,7 +521,6 @@ MSDriveWay::deadlockLaneOccupied(const SUMOVehicle* ego, bool store) const { } foeIt++; } - lane->releaseVehicles(); if (conflict) { if (MSRailSignal::storeVehicles() && store) { MSRailSignal::blockingVehicles().push_back(foe); From f80af383973705d47e0834b509e5f8da9d91fd47 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 1 Aug 2024 10:10:38 +0200 Subject: [PATCH 131/334] added test refs #7578, #21 --- .../insertion_before_reversal/errors.sumo | 4 + .../errors.sumo.meso | 1 + .../input_routes.rou.xml | 15 ++ .../insertion_before_reversal/net.net.xml | 134 ++++++++++++++++++ .../insertion_before_reversal/options.sumo | 3 + .../insertion_before_reversal/output.sumo | 0 .../railsignalblocks.sumo | 133 +++++++++++++++++ .../railsignalblocks.sumo.meso | 66 +++++++++ .../insertion_before_reversal/stopinfos.sumo | 1 + tests/sumo/rail/reversal/testsuite.sumo | 1 + 10 files changed, 358 insertions(+) create mode 100644 tests/sumo/rail/reversal/insertion_before_reversal/errors.sumo create mode 100644 tests/sumo/rail/reversal/insertion_before_reversal/errors.sumo.meso create mode 100644 tests/sumo/rail/reversal/insertion_before_reversal/input_routes.rou.xml create mode 100644 tests/sumo/rail/reversal/insertion_before_reversal/net.net.xml create mode 100644 tests/sumo/rail/reversal/insertion_before_reversal/options.sumo create mode 100644 tests/sumo/rail/reversal/insertion_before_reversal/output.sumo create mode 100644 tests/sumo/rail/reversal/insertion_before_reversal/railsignalblocks.sumo create mode 100644 tests/sumo/rail/reversal/insertion_before_reversal/railsignalblocks.sumo.meso create mode 100644 tests/sumo/rail/reversal/insertion_before_reversal/stopinfos.sumo diff --git a/tests/sumo/rail/reversal/insertion_before_reversal/errors.sumo b/tests/sumo/rail/reversal/insertion_before_reversal/errors.sumo new file mode 100644 index 000000000000..0416c916f79b --- /dev/null +++ b/tests/sumo/rail/reversal/insertion_before_reversal/errors.sumo @@ -0,0 +1,4 @@ +Warning: Teleporting vehicle 'v_1'; waited too long (yield), lane='E0_0', time=350.00. +Warning: Vehicle 'v_1' ends teleporting on edge 'E1', time=350.00. +Warning: Teleporting vehicle 'v_0'; frontal collision with vehicle 'v_1', lane='E1_0', gap=-1.00, time=390.00 stage=move. +Warning: Vehicle 'v_0' ends teleporting on edge '-E0', time=390.00. diff --git a/tests/sumo/rail/reversal/insertion_before_reversal/errors.sumo.meso b/tests/sumo/rail/reversal/insertion_before_reversal/errors.sumo.meso new file mode 100644 index 000000000000..7c5032aa693c --- /dev/null +++ b/tests/sumo/rail/reversal/insertion_before_reversal/errors.sumo.meso @@ -0,0 +1 @@ +Warning: Network contains internal links which are ignored. Vehicles will 'jump' across junctions and thus underestimate route lengths and travel times. diff --git a/tests/sumo/rail/reversal/insertion_before_reversal/input_routes.rou.xml b/tests/sumo/rail/reversal/insertion_before_reversal/input_routes.rou.xml new file mode 100644 index 000000000000..3c3f504bc29d --- /dev/null +++ b/tests/sumo/rail/reversal/insertion_before_reversal/input_routes.rou.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/insertion_before_reversal/net.net.xml b/tests/sumo/rail/reversal/insertion_before_reversal/net.net.xml new file mode 100644 index 000000000000..132877ecf379 --- /dev/null +++ b/tests/sumo/rail/reversal/insertion_before_reversal/net.net.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/insertion_before_reversal/options.sumo b/tests/sumo/rail/reversal/insertion_before_reversal/options.sumo new file mode 100644 index 000000000000..db1f2e389912 --- /dev/null +++ b/tests/sumo/rail/reversal/insertion_before_reversal/options.sumo @@ -0,0 +1,3 @@ +--no-step-log --no-duration-log +--net-file=net.net.xml +--routes=input_routes.rou.xml diff --git a/tests/sumo/rail/reversal/insertion_before_reversal/output.sumo b/tests/sumo/rail/reversal/insertion_before_reversal/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/reversal/insertion_before_reversal/railsignalblocks.sumo b/tests/sumo/rail/reversal/insertion_before_reversal/railsignalblocks.sumo new file mode 100644 index 000000000000..35eeca6ef464 --- /dev/null +++ b/tests/sumo/rail/reversal/insertion_before_reversal/railsignalblocks.sumo @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/insertion_before_reversal/railsignalblocks.sumo.meso b/tests/sumo/rail/reversal/insertion_before_reversal/railsignalblocks.sumo.meso new file mode 100644 index 000000000000..ef865be25246 --- /dev/null +++ b/tests/sumo/rail/reversal/insertion_before_reversal/railsignalblocks.sumo.meso @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/insertion_before_reversal/stopinfos.sumo b/tests/sumo/rail/reversal/insertion_before_reversal/stopinfos.sumo new file mode 100644 index 000000000000..c9c406034fdb --- /dev/null +++ b/tests/sumo/rail/reversal/insertion_before_reversal/stopinfos.sumo @@ -0,0 +1 @@ +Auto-generated by TextTest to simulate missing file for this version... diff --git a/tests/sumo/rail/reversal/testsuite.sumo b/tests/sumo/rail/reversal/testsuite.sumo index d69a47ed9530..54f463383fd1 100644 --- a/tests/sumo/rail/reversal/testsuite.sumo +++ b/tests/sumo/rail/reversal/testsuite.sumo @@ -64,3 +64,4 @@ reverse_at_route_end_impossible # see #13260 double_reversal_same_dir +insertion_before_reversal From 93162477c77abfa34dc28fe4bb244247307625c6 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 1 Aug 2024 11:08:09 +0200 Subject: [PATCH 132/334] added test refs #7578, #21 --- .../follower_ends_before_reversal/errors.sumo | 2 + .../errors.sumo.meso | 1 + .../input_routes.rou.xml | 23 + .../follower_ends_before_reversal/net.net.xml | 1283 +++++++++++++++++ .../options.sumo | 3 + .../follower_ends_before_reversal/output.sumo | 0 .../railsignalblocks.sumo | 163 +++ .../railsignalblocks.sumo.meso | 66 + .../stopinfos.sumo | 1 + tests/sumo/rail/reversal/testsuite.sumo | 3 + 10 files changed, 1545 insertions(+) create mode 100644 tests/sumo/rail/reversal/follower_ends_before_reversal/errors.sumo create mode 100644 tests/sumo/rail/reversal/follower_ends_before_reversal/errors.sumo.meso create mode 100644 tests/sumo/rail/reversal/follower_ends_before_reversal/input_routes.rou.xml create mode 100644 tests/sumo/rail/reversal/follower_ends_before_reversal/net.net.xml create mode 100644 tests/sumo/rail/reversal/follower_ends_before_reversal/options.sumo create mode 100644 tests/sumo/rail/reversal/follower_ends_before_reversal/output.sumo create mode 100644 tests/sumo/rail/reversal/follower_ends_before_reversal/railsignalblocks.sumo create mode 100644 tests/sumo/rail/reversal/follower_ends_before_reversal/railsignalblocks.sumo.meso create mode 100644 tests/sumo/rail/reversal/follower_ends_before_reversal/stopinfos.sumo diff --git a/tests/sumo/rail/reversal/follower_ends_before_reversal/errors.sumo b/tests/sumo/rail/reversal/follower_ends_before_reversal/errors.sumo new file mode 100644 index 000000000000..ad2d31b3b211 --- /dev/null +++ b/tests/sumo/rail/reversal/follower_ends_before_reversal/errors.sumo @@ -0,0 +1,2 @@ +Warning: Teleporting vehicle 'v_1'; frontal collision with vehicle 'v_0', lane='S_11506-11514_0', gap=-1.00, time=414.00 stage=move. +Warning: Vehicle 'v_1' teleports beyond arrival edge 'F_11514-11506', time=414.00. diff --git a/tests/sumo/rail/reversal/follower_ends_before_reversal/errors.sumo.meso b/tests/sumo/rail/reversal/follower_ends_before_reversal/errors.sumo.meso new file mode 100644 index 000000000000..7c5032aa693c --- /dev/null +++ b/tests/sumo/rail/reversal/follower_ends_before_reversal/errors.sumo.meso @@ -0,0 +1 @@ +Warning: Network contains internal links which are ignored. Vehicles will 'jump' across junctions and thus underestimate route lengths and travel times. diff --git a/tests/sumo/rail/reversal/follower_ends_before_reversal/input_routes.rou.xml b/tests/sumo/rail/reversal/follower_ends_before_reversal/input_routes.rou.xml new file mode 100644 index 000000000000..ab677ffa9510 --- /dev/null +++ b/tests/sumo/rail/reversal/follower_ends_before_reversal/input_routes.rou.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/follower_ends_before_reversal/net.net.xml b/tests/sumo/rail/reversal/follower_ends_before_reversal/net.net.xml new file mode 100644 index 000000000000..37caa87a34b7 --- /dev/null +++ b/tests/sumo/rail/reversal/follower_ends_before_reversal/net.net.xml @@ -0,0 +1,1283 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/follower_ends_before_reversal/options.sumo b/tests/sumo/rail/reversal/follower_ends_before_reversal/options.sumo new file mode 100644 index 000000000000..db1f2e389912 --- /dev/null +++ b/tests/sumo/rail/reversal/follower_ends_before_reversal/options.sumo @@ -0,0 +1,3 @@ +--no-step-log --no-duration-log +--net-file=net.net.xml +--routes=input_routes.rou.xml diff --git a/tests/sumo/rail/reversal/follower_ends_before_reversal/output.sumo b/tests/sumo/rail/reversal/follower_ends_before_reversal/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/reversal/follower_ends_before_reversal/railsignalblocks.sumo b/tests/sumo/rail/reversal/follower_ends_before_reversal/railsignalblocks.sumo new file mode 100644 index 000000000000..50a06d0f3570 --- /dev/null +++ b/tests/sumo/rail/reversal/follower_ends_before_reversal/railsignalblocks.sumo @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/follower_ends_before_reversal/railsignalblocks.sumo.meso b/tests/sumo/rail/reversal/follower_ends_before_reversal/railsignalblocks.sumo.meso new file mode 100644 index 000000000000..ef865be25246 --- /dev/null +++ b/tests/sumo/rail/reversal/follower_ends_before_reversal/railsignalblocks.sumo.meso @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/follower_ends_before_reversal/stopinfos.sumo b/tests/sumo/rail/reversal/follower_ends_before_reversal/stopinfos.sumo new file mode 100644 index 000000000000..c9c406034fdb --- /dev/null +++ b/tests/sumo/rail/reversal/follower_ends_before_reversal/stopinfos.sumo @@ -0,0 +1 @@ +Auto-generated by TextTest to simulate missing file for this version... diff --git a/tests/sumo/rail/reversal/testsuite.sumo b/tests/sumo/rail/reversal/testsuite.sumo index 54f463383fd1..cfb2b10df942 100644 --- a/tests/sumo/rail/reversal/testsuite.sumo +++ b/tests/sumo/rail/reversal/testsuite.sumo @@ -65,3 +65,6 @@ reverse_at_route_end_impossible # see #13260 double_reversal_same_dir insertion_before_reversal + +# the leading train reverse and the follower train ends right before the reversal +follower_ends_before_reversal From 6c0c517acc5c22376b7b59c82a591237dce1d295 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 1 Aug 2024 12:36:22 +0200 Subject: [PATCH 133/334] added missing foe driveways. refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 45 ++++++++++++++++++---- src/microsim/traffic_lights/MSDriveWay.h | 3 ++ 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 80cc0710539c..d495ecf5c19c 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -1181,6 +1181,8 @@ MSDriveWay::buildDriveWay(const std::string& id, const MSLink* link, MSRouteIter } dw->addBidiFoes(rs); + // add driveways that start on the same signal / lane + dw->addParallelFoes(link, *first); // make foes unique and symmetrical std::set uniqueFoes(dw->myFoes.begin(), dw->myFoes.end()); std::set uniqueCLink(dw->myConflictLinks.begin(), dw->myConflictLinks.end()); @@ -1207,12 +1209,15 @@ MSDriveWay::buildDriveWay(const std::string& id, const MSLink* link, MSRouteIter if (link) { foe->addConflictLink(link); } - for (auto ili : foe->myForward.front()->getIncomingLanes()) { - if (ili.viaLink->getTLLogic() != nullptr) { - // ignore links that originate on myBidi - const MSLane* origin = ili.viaLink->getLaneBefore(); - if (std::find(dw->myBidi.begin(), dw->myBidi.end(), origin) == dw->myBidi.end()) { - uniqueCLink.insert(ili.viaLink); + // ignore links that have the same start junction + if (foe->myRoute.front()->getFromJunction() != dw->myRoute.front()->getFromJunction()) { + for (auto ili : foe->myForward.front()->getIncomingLanes()) { + if (ili.viaLink->getTLLogic() != nullptr) { + // ignore links that originate on myBidi + const MSLane* origin = ili.viaLink->getLaneBefore(); + if (std::find(dw->myBidi.begin(), dw->myBidi.end(), origin) == dw->myBidi.end()) { + uniqueCLink.insert(ili.viaLink); + } } } } @@ -1379,6 +1384,27 @@ MSDriveWay::addBidiFoes(const MSRailSignal* ownSignal) { } +void +MSDriveWay::addParallelFoes(const MSLink* link, const MSEdge* first) { +#ifdef DEBUG_ADD_FOES + std::cout << "driveway " << myID << " (" << myNumericalID << ") addParallelFoes\n"; +#endif + if (link) { + addFoes(link); + } else { + auto it = myDepartureDriveways.find(first); + if (it != myDepartureDriveways.end()) { + for (MSDriveWay* foe : it->second) { +#ifdef DEBUG_ADD_FOES + std::cout << " foe " << foe->getID() << " departs on first=" << first->getID() << "\n"; +#endif + myFoes.push_back(foe); + } + } + } +} + + void MSDriveWay::buildSubFoe(MSDriveWay* foe, bool movingBlock) { // Subdriveways (Teilfahrstraße) model the resolution of a driving conflict @@ -1473,10 +1499,13 @@ void MSDriveWay::addConflictLink(const MSLink* link) { if (link->getTLLogic() != nullptr) { // ignore links that originate on myBidi + // and also links from the same junction as my own link const MSLane* origin = link->getLaneBefore(); if (std::find(myBidi.begin(), myBidi.end(), origin) == myBidi.end()) { - if (std::find(myConflictLinks.begin(), myConflictLinks.end(), link) == myConflictLinks.end()) { - myConflictLinks.push_back(const_cast(link)); + if (link->getJunction() != myRoute.front()->getFromJunction()) { + if (std::find(myConflictLinks.begin(), myConflictLinks.end(), link) == myConflictLinks.end()) { + myConflictLinks.push_back(const_cast(link)); + } } } } diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h index cb623a8fdadb..e8e91c201748 100644 --- a/src/microsim/traffic_lights/MSDriveWay.h +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -238,6 +238,9 @@ class MSDriveWay : public MSMoveReminder, public Named { /// @brief derive foe driveways based on myBidi void addBidiFoes(const MSRailSignal* ownSignal); + /// @brief derive foe driveways that start at the same signal + void addParallelFoes(const MSLink* link, const MSEdge* first); + /// @brief build shortened driveway that ends where the foe train leaves the conflict zone of this driveway void buildSubFoe(MSDriveWay* foe, bool movingBlock); From 3e78ce9997d8e3195a2167bede976ddcf0e550a2 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 1 Aug 2024 12:36:28 +0200 Subject: [PATCH 134/334] patching expected results refs #21, #7578 --- .../alternativeRoute/railsignalblocks.sumo | 43 ++-- .../bugs/ticket11440/railsignalblocks.sumo | 4 +- .../bugs/ticket12868/railsignalblocks.sumo | 6 +- .../bugs/ticket12873/railsignalblocks.sumo | 9 +- .../railsignalblocks.sumo | 12 +- .../overlapping_driveways/railsignalvehs.sumo | 18 ++ .../railsignalblocks.sumo | 9 +- .../railsignalblocks.sumo | 6 +- .../follower_ends_before_reversal/errors.sumo | 4 +- .../railsignalblocks.sumo | 95 ++++++++- tests/sumo/rail/tramwayLoop/basic/output.sumo | 26 +-- .../tramwayLoop/basic/railsignalblocks.sumo | 28 ++- .../rail/tramwayLoop/basic/stopinfos.sumo | 62 +++--- .../rail/tramwayLoop/basic/tripinfos.sumo | 20 +- .../rail/tramwayLoop/basic/vehroutes.sumo | 198 +++++++++--------- .../rail/tramwayLoop/track_closed/output.sumo | 26 +-- .../track_closed/railsignalblocks.sumo | 26 ++- .../tramwayLoop/track_closed/stopinfos.sumo | 64 +++--- .../tramwayLoop/track_closed/tripinfos.sumo | 20 +- .../tramwayLoop/track_closed/vehroutes.sumo | 18 +- .../two_passing_loops/railsignalblocks.sumo | 4 +- .../two_passing_loops2/railsignalblocks.sumo | 4 +- 22 files changed, 417 insertions(+), 285 deletions(-) diff --git a/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo b/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo index 79e60de715df..8e8ff61ce58a 100644 --- a/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo +++ b/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - + - + - + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/tramwayLoop/basic/tripinfos.sumo b/tests/sumo/rail/tramwayLoop/basic/tripinfos.sumo index 3ff1c38bc61e..a93dee535007 100644 --- a/tests/sumo/rail/tramwayLoop/basic/tripinfos.sumo +++ b/tests/sumo/rail/tramwayLoop/basic/tripinfos.sumo @@ -1,6 +1,6 @@ - - - - - - - - - - + + + + + + + + + diff --git a/tests/sumo/rail/tramwayLoop/basic/vehroutes.sumo b/tests/sumo/rail/tramwayLoop/basic/vehroutes.sumo index 6da817e6aeff..4b81bb793086 100644 --- a/tests/sumo/rail/tramwayLoop/basic/vehroutes.sumo +++ b/tests/sumo/rail/tramwayLoop/basic/vehroutes.sumo @@ -1,6 +1,6 @@ - - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/tramwayLoop/track_closed/tripinfos.sumo b/tests/sumo/rail/tramwayLoop/track_closed/tripinfos.sumo index 6980877623e7..4b7effdf27d9 100644 --- a/tests/sumo/rail/tramwayLoop/track_closed/tripinfos.sumo +++ b/tests/sumo/rail/tramwayLoop/track_closed/tripinfos.sumo @@ -1,6 +1,6 @@ - - - - - - - - - - + + + + + + + + + diff --git a/tests/sumo/rail/tramwayLoop/track_closed/vehroutes.sumo b/tests/sumo/rail/tramwayLoop/track_closed/vehroutes.sumo index c5438dc68dce..6ccb52a7607e 100644 --- a/tests/sumo/rail/tramwayLoop/track_closed/vehroutes.sumo +++ b/tests/sumo/rail/tramwayLoop/track_closed/vehroutes.sumo @@ -1,6 +1,6 @@ - - - - - - - - - - diff --git a/tests/sumo/rail/reversal/follower_ends_before_reversal/net.net.xml b/tests/sumo/rail/reversal/follower_ends_before_reversal/net.net.xml index 37caa87a34b7..89e723d469a7 100644 --- a/tests/sumo/rail/reversal/follower_ends_before_reversal/net.net.xml +++ b/tests/sumo/rail/reversal/follower_ends_before_reversal/net.net.xml @@ -1,17 +1,14 @@ - - + @@ -194,6 +187,12 @@ + + + + + + @@ -282,6 +281,12 @@ + + + + + + @@ -443,7 +448,7 @@ - + @@ -771,7 +776,7 @@ - + @@ -1009,7 +1014,9 @@ - + + + @@ -1018,6 +1025,7 @@ + @@ -1120,6 +1128,7 @@ + @@ -1199,6 +1208,7 @@ + @@ -1250,6 +1260,8 @@ + + diff --git a/tests/sumo/rail/reversal/follower_ends_before_reversal/railsignalblocks.sumo b/tests/sumo/rail/reversal/follower_ends_before_reversal/railsignalblocks.sumo index 3995f8ce0729..375f92fbac44 100644 --- a/tests/sumo/rail/reversal/follower_ends_before_reversal/railsignalblocks.sumo +++ b/tests/sumo/rail/reversal/follower_ends_before_reversal/railsignalblocks.sumo @@ -1,6 +1,6 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/follower_ends_before_reversal2/net.net.xml b/tests/sumo/rail/reversal/follower_ends_before_reversal2/net.net.xml new file mode 100644 index 000000000000..89e723d469a7 --- /dev/null +++ b/tests/sumo/rail/reversal/follower_ends_before_reversal2/net.net.xml @@ -0,0 +1,1295 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/follower_ends_before_reversal2/options.sumo b/tests/sumo/rail/reversal/follower_ends_before_reversal2/options.sumo new file mode 100644 index 000000000000..db1f2e389912 --- /dev/null +++ b/tests/sumo/rail/reversal/follower_ends_before_reversal2/options.sumo @@ -0,0 +1,3 @@ +--no-step-log --no-duration-log +--net-file=net.net.xml +--routes=input_routes.rou.xml diff --git a/tests/sumo/rail/reversal/follower_ends_before_reversal2/output.sumo b/tests/sumo/rail/reversal/follower_ends_before_reversal2/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/reversal/follower_ends_before_reversal2/railsignalblocks.sumo b/tests/sumo/rail/reversal/follower_ends_before_reversal2/railsignalblocks.sumo new file mode 100644 index 000000000000..011de8cd5a69 --- /dev/null +++ b/tests/sumo/rail/reversal/follower_ends_before_reversal2/railsignalblocks.sumo @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/follower_ends_before_reversal2/railsignalblocks.sumo.meso b/tests/sumo/rail/reversal/follower_ends_before_reversal2/railsignalblocks.sumo.meso new file mode 100644 index 000000000000..ef865be25246 --- /dev/null +++ b/tests/sumo/rail/reversal/follower_ends_before_reversal2/railsignalblocks.sumo.meso @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/follower_ends_before_reversal2/stopinfos.sumo b/tests/sumo/rail/reversal/follower_ends_before_reversal2/stopinfos.sumo new file mode 100644 index 000000000000..c9c406034fdb --- /dev/null +++ b/tests/sumo/rail/reversal/follower_ends_before_reversal2/stopinfos.sumo @@ -0,0 +1 @@ +Auto-generated by TextTest to simulate missing file for this version... diff --git a/tests/sumo/rail/reversal/testsuite.sumo b/tests/sumo/rail/reversal/testsuite.sumo index cfb2b10df942..36aab7456b0a 100644 --- a/tests/sumo/rail/reversal/testsuite.sumo +++ b/tests/sumo/rail/reversal/testsuite.sumo @@ -68,3 +68,6 @@ insertion_before_reversal # the leading train reverse and the follower train ends right before the reversal follower_ends_before_reversal + +# the leading train reverse and the follower train ends right before the reversal +follower_ends_before_reversal2 From 0545685f4e8eaa71ea663f6dc9ce1a2361e27631 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 2 Aug 2024 11:16:51 +0200 Subject: [PATCH 137/334] fixed bug where driveway building was aborted too early at reversal. refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index e83455117431..81e76ffbfd7e 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -822,12 +822,20 @@ MSDriveWay::buildRoute(const MSLink* origin, double length, } } } else if (bidi == nullptr) { - seekBidiSwitch = false; + if (toLane->isInternal() && toLane->getIncomingLanes().front().viaLink->isTurnaround()) { #ifdef DEBUG_DRIVEWAY_BUILDROUTE - if (gDebugFlag4) { - std::cout << " noBidi, abort search for bidiSwitch\n"; - } + if (gDebugFlag4) { + std::cout << " continue bidiSearch beyond turnaround\n"; + } +#endif + } else { + seekBidiSwitch = false; +#ifdef DEBUG_DRIVEWAY_BUILDROUTE + if (gDebugFlag4) { + std::cout << " noBidi, abort search for bidiSwitch\n"; + } #endif + } } if (bidi != nullptr) { if (foundUnsafeSwitch) { From 1f70f837fb0ce3e7216d0eee48724a4cfd8c998e Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 2 Aug 2024 11:17:00 +0200 Subject: [PATCH 138/334] patching expected results refs #21, #7578 --- .../railsignalblocks.sumo | 8 +- .../railsignalblocks.sumo | 8 +- .../bugs/ticket11440/railsignalblocks.sumo | 31 +++---- .../bugs/ticket13262/railsignalblocks.sumo | 10 +- .../railsignalblocks.sumo | 10 +- .../railsignalblocks.sumo | 41 ++++++--- .../railsignalblocks.sumo | 92 ++++++++++++++----- .../insertion_before_reversal/errors.sumo | 4 - .../railsignalblocks.sumo | 45 +++------ .../railsignalblocks.sumo | 10 +- .../reverse_on_signal/railsignalblocks.sumo | 10 +- 11 files changed, 148 insertions(+), 121 deletions(-) diff --git a/tests/sumo/rail/bugs/deadlock_bidi_reversal/railsignalblocks.sumo b/tests/sumo/rail/bugs/deadlock_bidi_reversal/railsignalblocks.sumo index 401c24ac05f5..d398f9b45dc9 100644 --- a/tests/sumo/rail/bugs/deadlock_bidi_reversal/railsignalblocks.sumo +++ b/tests/sumo/rail/bugs/deadlock_bidi_reversal/railsignalblocks.sumo @@ -1,6 +1,6 @@ - + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/insertion_before_reversal2/net.net.xml b/tests/sumo/rail/reversal/insertion_before_reversal2/net.net.xml new file mode 100644 index 000000000000..132877ecf379 --- /dev/null +++ b/tests/sumo/rail/reversal/insertion_before_reversal2/net.net.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/insertion_before_reversal2/options.sumo b/tests/sumo/rail/reversal/insertion_before_reversal2/options.sumo new file mode 100644 index 000000000000..db1f2e389912 --- /dev/null +++ b/tests/sumo/rail/reversal/insertion_before_reversal2/options.sumo @@ -0,0 +1,3 @@ +--no-step-log --no-duration-log +--net-file=net.net.xml +--routes=input_routes.rou.xml diff --git a/tests/sumo/rail/reversal/insertion_before_reversal2/output.sumo b/tests/sumo/rail/reversal/insertion_before_reversal2/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/reversal/insertion_before_reversal2/railsignalblocks.sumo b/tests/sumo/rail/reversal/insertion_before_reversal2/railsignalblocks.sumo new file mode 100644 index 000000000000..5d739e01cb6f --- /dev/null +++ b/tests/sumo/rail/reversal/insertion_before_reversal2/railsignalblocks.sumo @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/insertion_before_reversal2/railsignalblocks.sumo.meso b/tests/sumo/rail/reversal/insertion_before_reversal2/railsignalblocks.sumo.meso new file mode 100644 index 000000000000..ef865be25246 --- /dev/null +++ b/tests/sumo/rail/reversal/insertion_before_reversal2/railsignalblocks.sumo.meso @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/insertion_before_reversal2/stopinfos.sumo b/tests/sumo/rail/reversal/insertion_before_reversal2/stopinfos.sumo new file mode 100644 index 000000000000..c9c406034fdb --- /dev/null +++ b/tests/sumo/rail/reversal/insertion_before_reversal2/stopinfos.sumo @@ -0,0 +1 @@ +Auto-generated by TextTest to simulate missing file for this version... diff --git a/tests/sumo/rail/reversal/testsuite.sumo b/tests/sumo/rail/reversal/testsuite.sumo index 36aab7456b0a..485c16b39f1d 100644 --- a/tests/sumo/rail/reversal/testsuite.sumo +++ b/tests/sumo/rail/reversal/testsuite.sumo @@ -66,6 +66,9 @@ reverse_at_route_end_impossible double_reversal_same_dir insertion_before_reversal +# second train ends before reversal +insertion_before_reversal2 + # the leading train reverse and the follower train ends right before the reversal follower_ends_before_reversal From d482bdfa85b154367acbccfa871180a79de14586 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 2 Aug 2024 12:33:54 +0200 Subject: [PATCH 140/334] finding more reversal-based foes. refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 71 +++++++++++++++++++++- src/microsim/traffic_lights/MSDriveWay.h | 12 ++++ 2 files changed, 80 insertions(+), 3 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 81e76ffbfd7e..6a90c5d0ed74 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -69,6 +69,7 @@ int MSDriveWay::myDepartDriveWayIndex(0); int MSDriveWay::myNumWarnings(0); bool MSDriveWay::myWriteVehicles(false); std::map > MSDriveWay::mySwitchDriveWays; +std::map > MSDriveWay::myReversalDriveWays; std::map > MSDriveWay::myDepartureDriveways; std::map > MSDriveWay::myDepartureDrivewaysEnds; std::map > MSDriveWay::myEndingDriveways; @@ -129,6 +130,10 @@ MSDriveWay::~MSDriveWay() { std::vector& dws = mySwitchDriveWays[link]; dws.erase(std::find(dws.begin(), dws.end(), this)); } + for (const MSEdge* edge : myReversals) { + std::vector& dws = myReversalDriveWays[edge]; + dws.erase(std::find(dws.begin(), dws.end(), this)); + } if (myLane != nullptr) { const MSEdge* first = &myLane->getEdge(); if (myIsDepartDriveway) { @@ -688,6 +693,15 @@ MSDriveWay::bidiBlockedByEnd(const MSDriveWay& other) const { return false; } +bool +MSDriveWay::forwardRouteConflict(std::set forward, const MSDriveWay& other) { + for (const MSEdge* edge2 : other.myRoute) { + if (forward.count(edge2->getBidiEdge()) != 0) { + return true; + } + } + return false; +} void MSDriveWay::writeBlocks(OutputDevice& od) const { @@ -804,8 +818,9 @@ MSDriveWay::buildRoute(const MSLink* origin, double length, std::cout << " toLane=" << toLane->getID() << " visited=" << formatVisitedMap(visited) << "\n"; } #endif - if (toLane->getEdge().isNormal()) { - myRoute.push_back(&toLane->getEdge()); + const MSEdge* current = &toLane->getEdge(); + if (current->isNormal()) { + myRoute.push_back(current); if (next != end) { next++; } @@ -929,6 +944,11 @@ MSDriveWay::buildRoute(const MSLink* origin, double length, mySwitchDriveWays[link].push_back(this); myForwardSwitches.push_back(link); } + if (link->getLane()->getBidiLane() != nullptr && &link->getLane()->getEdge() == current->getBidiEdge()) { + // reversal on driveway + myReversalDriveWays[current].push_back(this); + myReversals.push_back(current); + } break; } } @@ -1192,6 +1212,8 @@ MSDriveWay::buildDriveWay(const std::string& id, const MSLink* link, MSRouteIter dw->addBidiFoes(rs); // add driveways that start on the same signal / lane dw->addParallelFoes(link, *first); + // add driveways that reverse along this driveways route + dw->addReversalFoes(); // make foes unique and symmetrical std::set uniqueFoes(dw->myFoes.begin(), dw->myFoes.end()); std::set uniqueCLink(dw->myConflictLinks.begin(), dw->myConflictLinks.end()); @@ -1202,7 +1224,9 @@ MSDriveWay::buildDriveWay(const std::string& id, const MSLink* link, MSRouteIter const bool sameLast = foeLastEdge == lastEdge; if (sameLast && !movingBlock) { dw->myFoes.push_back(foe); - foe->myFoes.push_back(dw); + if (foe != dw) { + foe->myFoes.push_back(dw); + } } else { if (foe->bidiBlockedByEnd(*dw)) { foe->myFoes.push_back(dw); @@ -1245,6 +1269,11 @@ MSDriveWay::buildDriveWay(const std::string& id, const MSLink* link, MSRouteIter } } } +#ifdef DEBUG_BUILD_DRIVEWAY + if (DEBUG_COND_DW) { + std::cout << dw->myID << " finalFoes " << toString(dw->myFoes) << "\n"; + } +#endif return dw; } @@ -1414,6 +1443,42 @@ MSDriveWay::addParallelFoes(const MSLink* link, const MSEdge* first) { } +void +MSDriveWay::addReversalFoes() { +#ifdef DEBUG_ADD_FOES + std::cout << "driveway " << myID << " addReversalFoes\n"; +#endif + std::set forward; + for (const MSLane* lane : myForward) { + if (lane->isNormal()) { + forward.insert(&lane->getEdge()); + } + } + for (const MSEdge* e : myRoute) { + if (forward.count(e) != 0) { + // reversals in our own forward section must be ignored + continue; + } + auto it = myReversalDriveWays.find(e); + if (it != myReversalDriveWays.end()) { + for (MSDriveWay* foe : it->second) { + // check whether the foe reverses into our own forward section + // (it might reverse again or disappear via arrival) +#ifdef DEBUG_ADD_FOES + std::cout << " candidate foe " << foe->getID() << " reverses on edge=" << e->getID() << " forward=" << joinNamedToString(forward, " ") << " foeRoute=" << toString(foe->myRoute) << "\n"; +#endif + if (forwardRouteConflict(forward, *foe)) { +#ifdef DEBUG_ADD_FOES + std::cout << " foe " << foe->getID() << " reverses on edge=" << e->getID() << "\n"; +#endif + myFoes.push_back(foe); + } + } + } + } +} + + void MSDriveWay::buildSubFoe(MSDriveWay* foe, bool movingBlock) { // Subdriveways (Teilfahrstraße) model the resolution of a driving conflict diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h index e8e91c201748..431312668a3a 100644 --- a/src/microsim/traffic_lights/MSDriveWay.h +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -70,6 +70,9 @@ class MSDriveWay : public MSMoveReminder, public Named { /// @brief Wether there is a bidi conflict with the end of the given driveway bool bidiBlockedByEnd(const MSDriveWay& other) const; + /// @brief Wether the route of other passes into the forward section of this driveway + bool forwardRouteConflict(std::set forward, const MSDriveWay& other); + /// @brief whether any of myConflictLanes is occupied (vehicles that are the target of a join must be ignored) bool conflictLaneOccupied(bool store = true, const SUMOVehicle* ego = nullptr) const; @@ -241,6 +244,9 @@ class MSDriveWay : public MSMoveReminder, public Named { /// @brief derive foe driveways that start at the same signal void addParallelFoes(const MSLink* link, const MSEdge* first); + /// @brief derive foe driveways that enter the bidi section by reversing + void addReversalFoes(); + /// @brief build shortened driveway that ends where the foe train leaves the conflict zone of this driveway void buildSubFoe(MSDriveWay* foe, bool movingBlock); @@ -282,6 +288,9 @@ class MSDriveWay : public MSMoveReminder, public Named { /// @brief track own occurences in mySwitchDriveWays for cleanup in destructor std::vector myForwardSwitches; + /// @brief track own occurences in myReversalDriveWays for cleanup in destructor + std::vector myReversals; + static int myGlobalDriveWayIndex; static int myDepartDriveWayIndex; static int myNumWarnings; @@ -290,6 +299,9 @@ class MSDriveWay : public MSMoveReminder, public Named { /// @brief all driveways passing the given switch (used to look up flank foes) static std::map > mySwitchDriveWays; + /// @brief all driveways reversing on the given switch (used to look up flank foes) + static std::map > myReversalDriveWays; + /// @brief all driveways that do not start at a rail signal (and are only used at departure) static std::map > myDepartureDriveways; /// @brief all driveways that do not start at a rail signal (and are only used at departure) by end edge From 44f86e73b9cb09daca1228ccb3cd181e17ce6d63 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 2 Aug 2024 12:33:59 +0200 Subject: [PATCH 141/334] patching expected results refs #21, #7578 --- .../bugs/ticket11440/railsignalblocks.sumo | 19 +-- .../bugs/ticket12868/railsignalblocks.sumo | 8 +- .../follower_ends_before_reversal/errors.sumo | 2 - .../options.sumo | 1 + .../railsignalblocks.sumo | 103 ++-------------- .../errors.sumo | 12 +- .../options.sumo | 1 + .../railsignalblocks.sumo | 116 +++++++++--------- .../insertion_before_reversal2/errors.sumo | 2 - .../railsignalblocks.sumo | 51 ++------ 10 files changed, 99 insertions(+), 216 deletions(-) diff --git a/tests/sumo/rail/bugs/ticket11440/railsignalblocks.sumo b/tests/sumo/rail/bugs/ticket11440/railsignalblocks.sumo index 84326a826384..4c82a9c1494e 100644 --- a/tests/sumo/rail/bugs/ticket11440/railsignalblocks.sumo +++ b/tests/sumo/rail/bugs/ticket11440/railsignalblocks.sumo @@ -1,6 +1,6 @@ - + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/parking_insertion/net.net.xml b/tests/sumo/rail/rail_signal/parking_insertion/net.net.xml new file mode 100644 index 000000000000..05ba747495e3 --- /dev/null +++ b/tests/sumo/rail/rail_signal/parking_insertion/net.net.xml @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/parking_insertion/options.sumo b/tests/sumo/rail/rail_signal/parking_insertion/options.sumo new file mode 100644 index 000000000000..ac90e948d74d --- /dev/null +++ b/tests/sumo/rail/rail_signal/parking_insertion/options.sumo @@ -0,0 +1,3 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml --tripinfo-output=tripinfos.xml +--use-stop-ended +--railsignal-vehicle-output railsignal_vehicles.xml diff --git a/tests/sumo/rail/rail_signal/parking_insertion/output.sumo b/tests/sumo/rail/rail_signal/parking_insertion/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/parking_insertion/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/parking_insertion/railsignalblocks.sumo new file mode 100644 index 000000000000..12a9f0588404 --- /dev/null +++ b/tests/sumo/rail/rail_signal/parking_insertion/railsignalblocks.sumo @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/parking_insertion/railsignalvehs.sumo b/tests/sumo/rail/rail_signal/parking_insertion/railsignalvehs.sumo new file mode 100644 index 000000000000..ad601ec3c968 --- /dev/null +++ b/tests/sumo/rail/rail_signal/parking_insertion/railsignalvehs.sumo @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/parking_insertion/tripinfos.sumo b/tests/sumo/rail/rail_signal/parking_insertion/tripinfos.sumo new file mode 100644 index 000000000000..b92ff52b0d21 --- /dev/null +++ b/tests/sumo/rail/rail_signal/parking_insertion/tripinfos.sumo @@ -0,0 +1,44 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/parking_insertion/tripinfos.sumo.meso b/tests/sumo/rail/rail_signal/parking_insertion/tripinfos.sumo.meso new file mode 100644 index 000000000000..e872986da5b1 --- /dev/null +++ b/tests/sumo/rail/rail_signal/parking_insertion/tripinfos.sumo.meso @@ -0,0 +1,49 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/testsuite.sumo b/tests/sumo/rail/rail_signal/testsuite.sumo index 9542040050d6..af24ee2e35d4 100644 --- a/tests/sumo/rail/rail_signal/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/testsuite.sumo @@ -113,3 +113,6 @@ deadlock_insertion # see #14554 reversal_before_signal + +# driveways must register vehicle after it finishes parking +parking_insertion From 99c4cd971cb6e6971e23f85d83bc91e4a52a12ae Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 3 Sep 2024 17:40:23 +0200 Subject: [PATCH 148/334] fixing driveway registration after parking refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 0d34927ad070..cb0a6f9fa945 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -172,7 +172,7 @@ MSDriveWay::notifyEnter(SUMOTrafficObject& veh, Notification reason, const MSLan #ifdef DEBUG_MOVEREMINDER std::cout << SIMTIME << " notifyEnter " << getDescription() << " veh=" << veh.getID() << " lane=" << enteredLane->getID() << " reason=" << reason << "\n"; #endif - if (veh.isVehicle() && enteredLane == myLane && (reason == NOTIFICATION_DEPARTED || reason == NOTIFICATION_JUNCTION)) { + if (veh.isVehicle() && enteredLane == myLane && (reason == NOTIFICATION_DEPARTED || reason == NOTIFICATION_JUNCTION || reason == NOTIFICATION_PARKING)) { SUMOVehicle& sveh = dynamic_cast(veh); MSRouteIterator firstIt = std::find(sveh.getCurrentRouteEdge(), sveh.getRoute().end(), myLane->getNextNormal()); if (myTrains.count(&sveh) == 0 && match(sveh.getRoute(), firstIt)) { From faff1e68388207fa2edb72af12ed35eb35b05ba0 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 3 Sep 2024 17:40:28 +0200 Subject: [PATCH 149/334] patching expected results refs #21, #7578 --- .../rail_signal/parking_insertion/errors.sumo | 2 -- .../parking_insertion/railsignalvehs.sumo | 28 ++++++++++--------- .../parking_insertion/tripinfos.sumo | 7 +++-- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/tests/sumo/rail/rail_signal/parking_insertion/errors.sumo b/tests/sumo/rail/rail_signal/parking_insertion/errors.sumo index 8e2b48f563ef..e69de29bb2d1 100644 --- a/tests/sumo/rail/rail_signal/parking_insertion/errors.sumo +++ b/tests/sumo/rail/rail_signal/parking_insertion/errors.sumo @@ -1,2 +0,0 @@ -Warning: Teleporting vehicle 'oncoming'; frontal collision with vehicle 'ego', lane='b_0', gap=-1.00, time=66.00 stage=move. -Warning: Vehicle 'oncoming' teleports beyond arrival edge '-b', time=66.00. diff --git a/tests/sumo/rail/rail_signal/parking_insertion/railsignalvehs.sumo b/tests/sumo/rail/rail_signal/parking_insertion/railsignalvehs.sumo index ad601ec3c968..40a1cf4feb37 100644 --- a/tests/sumo/rail/rail_signal/parking_insertion/railsignalvehs.sumo +++ b/tests/sumo/rail/rail_signal/parking_insertion/railsignalvehs.sumo @@ -1,50 +1,52 @@ - - + + - - + + - - + + - - + + - - + + - - + + - + + + diff --git a/tests/sumo/rail/rail_signal/parking_insertion/tripinfos.sumo b/tests/sumo/rail/rail_signal/parking_insertion/tripinfos.sumo index b92ff52b0d21..86479a5dac4f 100644 --- a/tests/sumo/rail/rail_signal/parking_insertion/tripinfos.sumo +++ b/tests/sumo/rail/rail_signal/parking_insertion/tripinfos.sumo @@ -1,6 +1,6 @@ - - - + + From 69655d29e0cacb285df3519f378e39c5e8a24cd8 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 4 Sep 2024 10:52:56 +0200 Subject: [PATCH 150/334] added test refs #7578, #21 --- .../rail_signal/end_depart_within/errors.sumo | 1 + .../end_depart_within/errors.sumo.meso | 0 .../end_depart_within/input_routes.rou.xml | 33 +++++++ .../rail_signal/end_depart_within/net.net.xml | 93 +++++++++++++++++++ .../end_depart_within/options.sumo | 2 + .../rail_signal/end_depart_within/output.sumo | 0 .../end_depart_within/railsignalblocks.sumo | 89 ++++++++++++++++++ .../end_depart_within/tripinfos.sumo | 44 +++++++++ .../end_depart_within/tripinfos.sumo.meso | 49 ++++++++++ tests/sumo/rail/rail_signal/testsuite.sumo | 3 + 10 files changed, 314 insertions(+) create mode 100644 tests/sumo/rail/rail_signal/end_depart_within/errors.sumo create mode 100644 tests/sumo/rail/rail_signal/end_depart_within/errors.sumo.meso create mode 100644 tests/sumo/rail/rail_signal/end_depart_within/input_routes.rou.xml create mode 100644 tests/sumo/rail/rail_signal/end_depart_within/net.net.xml create mode 100644 tests/sumo/rail/rail_signal/end_depart_within/options.sumo create mode 100644 tests/sumo/rail/rail_signal/end_depart_within/output.sumo create mode 100644 tests/sumo/rail/rail_signal/end_depart_within/railsignalblocks.sumo create mode 100644 tests/sumo/rail/rail_signal/end_depart_within/tripinfos.sumo create mode 100644 tests/sumo/rail/rail_signal/end_depart_within/tripinfos.sumo.meso diff --git a/tests/sumo/rail/rail_signal/end_depart_within/errors.sumo b/tests/sumo/rail/rail_signal/end_depart_within/errors.sumo new file mode 100644 index 000000000000..a47397225ecf --- /dev/null +++ b/tests/sumo/rail/rail_signal/end_depart_within/errors.sumo @@ -0,0 +1 @@ +Warning: No point of conflict found between driveway 'J1.0' and driveway 'J2.d1' when creating sub-driveway diff --git a/tests/sumo/rail/rail_signal/end_depart_within/errors.sumo.meso b/tests/sumo/rail/rail_signal/end_depart_within/errors.sumo.meso new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/end_depart_within/input_routes.rou.xml b/tests/sumo/rail/rail_signal/end_depart_within/input_routes.rou.xml new file mode 100644 index 000000000000..9485aaea5479 --- /dev/null +++ b/tests/sumo/rail/rail_signal/end_depart_within/input_routes.rou.xml @@ -0,0 +1,33 @@ + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/end_depart_within/net.net.xml b/tests/sumo/rail/rail_signal/end_depart_within/net.net.xml new file mode 100644 index 000000000000..9cd23a5fd4a2 --- /dev/null +++ b/tests/sumo/rail/rail_signal/end_depart_within/net.net.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/end_depart_within/options.sumo b/tests/sumo/rail/rail_signal/end_depart_within/options.sumo new file mode 100644 index 000000000000..b8e33d6d2664 --- /dev/null +++ b/tests/sumo/rail/rail_signal/end_depart_within/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml --tripinfo-output=tripinfos.xml +--use-stop-ended diff --git a/tests/sumo/rail/rail_signal/end_depart_within/output.sumo b/tests/sumo/rail/rail_signal/end_depart_within/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/end_depart_within/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/end_depart_within/railsignalblocks.sumo new file mode 100644 index 000000000000..888a25cbb5ac --- /dev/null +++ b/tests/sumo/rail/rail_signal/end_depart_within/railsignalblocks.sumo @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/end_depart_within/tripinfos.sumo b/tests/sumo/rail/rail_signal/end_depart_within/tripinfos.sumo new file mode 100644 index 000000000000..87e08a670a7c --- /dev/null +++ b/tests/sumo/rail/rail_signal/end_depart_within/tripinfos.sumo @@ -0,0 +1,44 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/end_depart_within/tripinfos.sumo.meso b/tests/sumo/rail/rail_signal/end_depart_within/tripinfos.sumo.meso new file mode 100644 index 000000000000..e872986da5b1 --- /dev/null +++ b/tests/sumo/rail/rail_signal/end_depart_within/tripinfos.sumo.meso @@ -0,0 +1,49 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/testsuite.sumo b/tests/sumo/rail/rail_signal/testsuite.sumo index af24ee2e35d4..9027c0549efa 100644 --- a/tests/sumo/rail/rail_signal/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/testsuite.sumo @@ -116,3 +116,6 @@ reversal_before_signal # driveways must register vehicle after it finishes parking parking_insertion + +# one route ends within the block and another train starts within the block +end_depart_within From 2707a6276e7f3e15f968b59bafe427849cdf3504 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 4 Sep 2024 11:04:17 +0200 Subject: [PATCH 151/334] patching expected results after 99c4cd9 refs #21, #7578 --- .../rail/rail_signal/end_depart_within/errors.sumo | 1 - .../end_depart_within/input_routes.rou.xml | 2 +- .../end_depart_within/railsignalblocks.sumo | 2 +- .../rail_signal/end_depart_within/tripinfos.sumo | 6 +++--- .../insertionConstraints/parking/tripinfos.sumo | 12 ++++++++---- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/tests/sumo/rail/rail_signal/end_depart_within/errors.sumo b/tests/sumo/rail/rail_signal/end_depart_within/errors.sumo index a47397225ecf..e69de29bb2d1 100644 --- a/tests/sumo/rail/rail_signal/end_depart_within/errors.sumo +++ b/tests/sumo/rail/rail_signal/end_depart_within/errors.sumo @@ -1 +0,0 @@ -Warning: No point of conflict found between driveway 'J1.0' and driveway 'J2.d1' when creating sub-driveway diff --git a/tests/sumo/rail/rail_signal/end_depart_within/input_routes.rou.xml b/tests/sumo/rail/rail_signal/end_depart_within/input_routes.rou.xml index 9485aaea5479..eb575a9d051a 100644 --- a/tests/sumo/rail/rail_signal/end_depart_within/input_routes.rou.xml +++ b/tests/sumo/rail/rail_signal/end_depart_within/input_routes.rou.xml @@ -29,5 +29,5 @@ - + diff --git a/tests/sumo/rail/rail_signal/end_depart_within/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/end_depart_within/railsignalblocks.sumo index 888a25cbb5ac..b87bf3510f66 100644 --- a/tests/sumo/rail/rail_signal/end_depart_within/railsignalblocks.sumo +++ b/tests/sumo/rail/rail_signal/end_depart_within/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - - + + diff --git a/tests/sumo/rail/rail_signal/insertionConstraints/parking/tripinfos.sumo b/tests/sumo/rail/rail_signal/insertionConstraints/parking/tripinfos.sumo index 335cd2961edc..cbf7cc7b22f2 100644 --- a/tests/sumo/rail/rail_signal/insertionConstraints/parking/tripinfos.sumo +++ b/tests/sumo/rail/rail_signal/insertionConstraints/parking/tripinfos.sumo @@ -1,11 +1,16 @@ - - - + + From 0d26ac0ff08da0f3c802d17bdfee276c2b6f7f8b Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 4 Sep 2024 13:57:37 +0200 Subject: [PATCH 154/334] implemented filtering refs #15027 --- tools/route/driveways2poly.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tools/route/driveways2poly.py b/tools/route/driveways2poly.py index de49fe2717ce..c04bbbb92ef5 100755 --- a/tools/route/driveways2poly.py +++ b/tools/route/driveways2poly.py @@ -51,6 +51,8 @@ def parse_args(args=None): "group size multiplied with the given factor (in m)") optParser.add_option("--filter-signals", dest="filterSignals", help="only write output for driveways of the given signals") + optParser.add_option("--filter-driveways", dest="filterDriveways", + help="only write output for the given driveways") optParser.add_option("--filter-foes", dest="filterFoes", help="only write output for the foes of the given driveways") optParser.add_option("--seed", type=int, help="random seed") @@ -59,6 +61,13 @@ def parse_args(args=None): if options.seed: random.seed(options.seed) + if options.filterSignals: + options.filterSignals = set(options.filterSignals.split(',')) + if options.filterDriveways: + options.filterDriveways = set(options.filterDriveways.split(',')) + if options.filterFoes: + options.filterFoes = set(options.filterFoes.split(',')) + return options @@ -66,13 +75,29 @@ def main(options): colorgen = sumolib.miscutils. Colorgen((options.hue, options.saturation, options.brightness)) net = sumolib.net.readNet(options.netfile, withInternal=options.internal) + permittedFoes = None + if options.filterFoes: + permittedFoes = set() + for rs in sumolib.xml.parse(options.driveways, "railSignal"): + for link in rs.link: + for dw in link.driveWay: + if dw.id in options.filterFoes: + permittedFoes.update(dw.foes[0].driveWays.split()) + + with open(options.output, 'w') as outf: sumolib.xml.writeHeader(outf, root='polygons', rootAttrs=None, options=options) for rs in sumolib.xml.parse(options.driveways, "railSignal"): + if options.filterSignals and rs.id not in options.filterSignals: + continue for link in rs.link: if not link.driveWay: continue for dw in link.driveWay: + if options.filterDriveways and dw.id not in options.filterDriveways: + continue + if permittedFoes and dw.id not in permittedFoes: + continue route2poly.generate_poly(options, net, dw.id, colorgen(), dw.edges.split(), outf) outf.write('\n') From 8cdc17cd9803aff66d560834d34de617f2bb775b Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 4 Sep 2024 16:18:34 +0200 Subject: [PATCH 155/334] #2 improving comment --- src/microsim/traffic_lights/MSDriveWay.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 8c03f0b1e061..9c00ccec6e1d 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -907,7 +907,10 @@ MSDriveWay::buildRoute(const MSLink* origin, double length, visitedEdges.insert(&item.first->getEdge()); } while (next != end && visitedEdges.count(*next) == 0) { - // the driveway is route specific but only but stop recording if it loops back on itself + // if bidiNext is used at some point, this driveway will be updated + // by looking further along the route until a new protecting switch is found or there are no more bidi edges. + // For this reason, we must record the rest of the route (or at least up to where it loops back on itself). + // This leads to seemingly redundant driveways that may be differentiated on update. visitedEdges.insert(*next); const MSEdge* nextBidi = (*next)->getBidiEdge(); if (nextBidi != nullptr) { From 0811363c787eb3953886d2268c4c912655b21e25 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 5 Sep 2024 08:47:54 +0200 Subject: [PATCH 156/334] sorting block output attributes refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 9c00ccec6e1d..8b1d51c4bdf4 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -752,7 +752,7 @@ MSDriveWay::writeBlocks(OutputDevice& od) const { for (MSLink* link : myProtectingSwitches) { links.push_back(getJunctionLinkID(link)); } - od.writeAttr("links", joinToString(links, " ")); + od.writeAttr("links", joinToStringSorting(links, " ")); od.closeTag(); od.openTag("conflictLinks"); @@ -761,7 +761,7 @@ MSDriveWay::writeBlocks(OutputDevice& od) const { for (MSLink* link : myConflictLinks) { signals.push_back(getTLLinkID(link)); } - od.writeAttr("signals", joinToString(signals, " ")); + od.writeAttr("signals", joinToStringSorting(signals, " ")); od.closeTag(); std::vector foes; @@ -770,7 +770,7 @@ MSDriveWay::writeBlocks(OutputDevice& od) const { } if (foes.size() > 0) { od.openTag("foes"); - od.writeAttr("driveWays", joinToString(foes, " ")); + od.writeAttr("driveWays", joinToStringSorting(foes, " ")); od.closeTag(); } } From 5e0b0e7c4f1264f388805845d74ac114aa25213f Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 5 Sep 2024 08:47:59 +0200 Subject: [PATCH 157/334] patching expected results refs #21, #7578 --- .../alternativeRoute/railsignalblocks.sumo | 100 +++++++++--------- .../railsignalblocks.sumo | 6 +- .../railsignalblocks.sumo | 6 +- .../insertion_at_signal/railsignalblocks.sumo | 6 +- .../railsignalblocks.sumo | 8 +- .../railsignalblocks.sumo | 10 +- .../bugs/ticket11384/railsignalblocks.sumo | 12 +-- .../bugs/ticket11440/railsignalblocks.sumo | 12 +-- .../bugs/ticket12184/railsignalblocks.sumo | 6 +- .../bugs/ticket12184b/railsignalblocks.sumo | 8 +- .../bugs/ticket12857/railsignalblocks.sumo | 6 +- .../bugs/ticket12858/railsignalblocks.sumo | 22 ++-- .../bugs/ticket12868/railsignalblocks.sumo | 12 +-- .../bugs/ticket12873/railsignalblocks.sumo | 16 +-- .../bugs/ticket13262/railsignalblocks.sumo | 4 +- .../bugs/ticket7563/railsignalblocks.sumo | 6 +- .../railsignalblocks.sumo | 6 +- .../crossing_tracks/railsignalblocks.sumo | 8 +- .../rail/interlocking/railsignalblocks.sumo | 16 +-- .../rail/model_railroad/railsignalblocks.sumo | 4 +- .../circle_bidi/railsignalblocks.sumo | 4 +- .../constraints/bidi/railsignalblocks.sumo | 6 +- .../constraints/limit2/railsignalblocks.sumo | 6 +- .../constraints/limit3/railsignalblocks.sumo | 6 +- .../wait_not/railsignalblocks.sumo | 6 +- .../deadlock_insertion/railsignalblocks.sumo | 8 +- .../guard_insertion/railsignalblocks.sumo | 8 +- .../halting_conflict/railsignalblocks.sumo | 14 +-- .../indirect_guard/railsignalblocks.sumo | 6 +- .../railsignalblocks.sumo | 11 +- .../railsignalblocks.sumo | 10 +- .../railsignalblocks.sumo | 6 +- .../railsignalblocks.sumo | 16 +-- .../parking_insertion/railsignalblocks.sumo | 11 +- .../waiting_time_bottom/railsignalblocks.sumo | 10 +- .../waiting_time_top/railsignalblocks.sumo | 10 +- .../railsignalblocks.sumo | 6 +- .../route_as_additional/railsignalblocks.sumo | 4 +- .../railsignalblocks.sumo | 4 +- .../railsignalblocks.sumo | 4 +- .../railsignalblocks.sumo | 6 +- .../railsignalblocks.sumo | 30 +++--- .../railsignalblocks.sumo | 54 +++++----- .../railsignalblocks.sumo | 12 +-- .../railsignalblocks.sumo | 18 ++-- .../railsignalblocks.sumo | 8 +- .../reverse_on_signal/railsignalblocks.sumo | 8 +- .../tramwayLoop/basic/railsignalblocks.sumo | 18 ++-- .../track_closed/railsignalblocks.sumo | 20 ++-- .../two_passing_loops/railsignalblocks.sumo | 26 ++--- .../two_passing_loops2/railsignalblocks.sumo | 26 ++--- 51 files changed, 329 insertions(+), 327 deletions(-) diff --git a/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo b/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo index 1c6e785835cf..c9e2c81f5a23 100644 --- a/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo +++ b/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo @@ -1,6 +1,6 @@ - + + + + + + + diff --git a/tests/sumo/rail/rail_signal/update_driveways/net.net.xml b/tests/sumo/rail/rail_signal/update_driveways/net.net.xml new file mode 100644 index 000000000000..e981136c4b56 --- /dev/null +++ b/tests/sumo/rail/rail_signal/update_driveways/net.net.xml @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/update_driveways/options.sumo b/tests/sumo/rail/rail_signal/update_driveways/options.sumo new file mode 100644 index 000000000000..8e4a58f914af --- /dev/null +++ b/tests/sumo/rail/rail_signal/update_driveways/options.sumo @@ -0,0 +1,3 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--railsignal-vehicle-output railsignal_vehicles.xml +--use-stop-ended diff --git a/tests/sumo/rail/rail_signal/update_driveways/output.sumo b/tests/sumo/rail/rail_signal/update_driveways/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/update_driveways/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/update_driveways/railsignalblocks.sumo new file mode 100644 index 000000000000..561ca6e5944f --- /dev/null +++ b/tests/sumo/rail/rail_signal/update_driveways/railsignalblocks.sumo @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/update_driveways/railsignalvehs.sumo b/tests/sumo/rail/rail_signal/update_driveways/railsignalvehs.sumo new file mode 100644 index 000000000000..110f91a3a8a1 --- /dev/null +++ b/tests/sumo/rail/rail_signal/update_driveways/railsignalvehs.sumo @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From fd7ed1cde025962516d5ca77db4b8101f257b17e Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 5 Sep 2024 13:10:30 +0200 Subject: [PATCH 160/334] preserving driveway events on update. refs #7578 --- src/microsim/traffic_lights/MSDriveWay.h | 25 +++++++++++++------- src/microsim/traffic_lights/MSRailSignal.cpp | 10 ++++---- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h index c65d38e32c8e..1d8acf76acee 100644 --- a/src/microsim/traffic_lights/MSDriveWay.h +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -43,6 +43,15 @@ class MSDriveWay : public MSMoveReminder, public Named { typedef std::set LaneSet; typedef std::map LaneVisitedMap; + struct VehicleEvent { + VehicleEvent(SUMOTime _time, bool _isEntry, const std::string& _id, Notification _reason): + time(_time), isEntry(_isEntry), id(_id), reason(_reason) {} + SUMOTime time; + bool isEntry; + std::string id; + Notification reason; + }; + /* The driveways (Fahrstrassen) for each link index of MSRailSignal * Each link index has at least one driveway * A driveway describes one possible route that passes the signal up to @@ -119,6 +128,14 @@ class MSDriveWay : public MSMoveReminder, public Named { return myNumericalID; } + const std::vector& getEvents() const { + return myVehicleEvents; + } + + void setEvents(const std::vector& events) { + myVehicleEvents = events; + } + /// @brief whether the give route matches this driveway bool match(const MSRoute& route, MSRouteIterator firstIt) const; @@ -272,14 +289,6 @@ class MSDriveWay : public MSMoveReminder, public Named { std::set myTrains; - struct VehicleEvent { - VehicleEvent(SUMOTime _time, bool _isEntry, const std::string& _id, Notification _reason): - time(_time), isEntry(_isEntry), id(_id), reason(_reason) {} - SUMOTime time; - bool isEntry; - std::string id; - Notification reason; - }; std::vector myVehicleEvents; std::vector myFoes; diff --git a/src/microsim/traffic_lights/MSRailSignal.cpp b/src/microsim/traffic_lights/MSRailSignal.cpp index 9f399310b3d6..24484433eb86 100644 --- a/src/microsim/traffic_lights/MSRailSignal.cpp +++ b/src/microsim/traffic_lights/MSRailSignal.cpp @@ -621,13 +621,15 @@ MSRailSignal::updateDriveway(int numericalID) { #ifdef DEBUG_DRIVEWAY_UPDATE std::cout << SIMTIME << " rail signal junction '" << getID() << "' requires update for driveway " << numericalID << "\n"; #endif + std::string oldID = getNewDrivewayID(); std::vector route = dw->getRoute(); + auto oldEvents = dw->getEvents(); delete *it; li.myDriveways.erase(it); - if (li.myDriveways.size() == 0) { - // rebuild default driveway - li.myDriveways.push_back(MSDriveWay::buildDriveWay(getNewDrivewayID(), li.myLink, route.begin(), route.end())); - } + // restore driveway to preserve events + MSDriveWay* newDW = MSDriveWay::buildDriveWay(oldID, li.myLink, route.begin(), route.end()); + newDW->setEvents(oldEvents); + li.myDriveways.push_back(newDW); return; } } From c23abd9e2f55d7c3debee9342eba4251fdbe7a93 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 5 Sep 2024 13:10:34 +0200 Subject: [PATCH 161/334] patching expected results refs #21, #7578 --- .../sumo/rail/rail_signal/update_driveways/railsignalvehs.sumo | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/sumo/rail/rail_signal/update_driveways/railsignalvehs.sumo b/tests/sumo/rail/rail_signal/update_driveways/railsignalvehs.sumo index 110f91a3a8a1..cf5eb6c80de3 100644 --- a/tests/sumo/rail/rail_signal/update_driveways/railsignalvehs.sumo +++ b/tests/sumo/rail/rail_signal/update_driveways/railsignalvehs.sumo @@ -1,6 +1,8 @@ + + From fcfba4809fa7d46b573f4d654129eb08f1f7e641 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 5 Sep 2024 13:13:30 +0200 Subject: [PATCH 162/334] keeping driveway name on update refs #7578 --- src/microsim/traffic_lights/MSRailSignal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/microsim/traffic_lights/MSRailSignal.cpp b/src/microsim/traffic_lights/MSRailSignal.cpp index 24484433eb86..ba1ef8381794 100644 --- a/src/microsim/traffic_lights/MSRailSignal.cpp +++ b/src/microsim/traffic_lights/MSRailSignal.cpp @@ -621,7 +621,7 @@ MSRailSignal::updateDriveway(int numericalID) { #ifdef DEBUG_DRIVEWAY_UPDATE std::cout << SIMTIME << " rail signal junction '" << getID() << "' requires update for driveway " << numericalID << "\n"; #endif - std::string oldID = getNewDrivewayID(); + std::string oldID = dw->getID(); std::vector route = dw->getRoute(); auto oldEvents = dw->getEvents(); delete *it; From 5e4c9ee5dc8ccf101b639c1da5a7c3f897e8cee4 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 5 Sep 2024 13:13:34 +0200 Subject: [PATCH 163/334] patching expected results refs #21, #7578 --- .../alternativeRoute/railsignalblocks.sumo | 48 +++++++++---------- .../bugs/ticket7563/railsignalblocks.sumo | 10 ++-- .../rail/interlocking/railsignalblocks.sumo | 14 +++--- .../rail/interlocking/railsignalvehs.sumo | 4 +- .../update_driveways/railsignalblocks.sumo | 8 ++-- .../update_driveways/railsignalvehs.sumo | 2 +- .../two_passing_loops/railsignalblocks.sumo | 30 ++++++------ .../two_passing_loops2/railsignalblocks.sumo | 30 ++++++------ 8 files changed, 73 insertions(+), 73 deletions(-) diff --git a/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo b/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo index c9e2c81f5a23..69686e89e7c9 100644 --- a/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo +++ b/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo @@ -1,6 +1,6 @@ - + + + + + + + + diff --git a/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/net.net.xml b/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/net.net.xml new file mode 100644 index 000000000000..b3130db4d3a1 --- /dev/null +++ b/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/net.net.xml @@ -0,0 +1,209 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/options.sumo b/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/options.sumo new file mode 100644 index 000000000000..3909a2b2b852 --- /dev/null +++ b/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/options.sumo @@ -0,0 +1,4 @@ +--no-step-log --no-duration-log +--net-file=net.net.xml +--routes=input_routes.rou.xml +--time-to-teleport 1000 diff --git a/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/output.sumo b/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/railsignalblocks.sumo b/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/railsignalblocks.sumo new file mode 100644 index 000000000000..2140b145fe1a --- /dev/null +++ b/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/railsignalblocks.sumo @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/railsignalblocks.sumo.meso b/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/railsignalblocks.sumo.meso new file mode 100644 index 000000000000..ef865be25246 --- /dev/null +++ b/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/railsignalblocks.sumo.meso @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/stopinfos.sumo b/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/stopinfos.sumo new file mode 100644 index 000000000000..c9c406034fdb --- /dev/null +++ b/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/stopinfos.sumo @@ -0,0 +1 @@ +Auto-generated by TextTest to simulate missing file for this version... diff --git a/tests/sumo/rail/reversal/testsuite.sumo b/tests/sumo/rail/reversal/testsuite.sumo index 485c16b39f1d..1c7ab4bc0f22 100644 --- a/tests/sumo/rail/reversal/testsuite.sumo +++ b/tests/sumo/rail/reversal/testsuite.sumo @@ -74,3 +74,6 @@ follower_ends_before_reversal # the leading train reverse and the follower train ends right before the reversal follower_ends_before_reversal2 + +# avoid spurious foe checks +reversal_onRoute_beyond_core From 7fbe9c348ffdf857a5b897d7ea5cc85c7e81abd2 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 5 Sep 2024 15:17:00 +0200 Subject: [PATCH 167/334] avoiding false positives in addReversalFoes. refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 84e739bc97ad..96187498954c 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -715,7 +715,12 @@ MSDriveWay::bidiBlockedByEnd(const MSDriveWay& other) const { bool MSDriveWay::forwardRouteConflict(std::set forward, const MSDriveWay& other) { + int i = 0; for (const MSEdge* edge2 : other.myRoute) { + if (i == other.myCoreSize) { + return false; + } + i++; if (forward.count(edge2->getBidiEdge()) != 0) { return true; } @@ -1496,11 +1501,16 @@ MSDriveWay::addReversalFoes() { forward.insert(&lane->getEdge()); } } + int i = 0; for (const MSEdge* e : myRoute) { if (forward.count(e) != 0) { // reversals in our own forward section must be ignored continue; } + if (i == myCoreSize) { + break; + } + i++; auto it = myReversalDriveWays.find(e); if (it != myReversalDriveWays.end()) { for (MSDriveWay* foe : it->second) { From 24e56411c8d52ba1d1fdef4baddf68710b767c02 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 5 Sep 2024 15:17:04 +0200 Subject: [PATCH 168/334] patching expected results refs #21, #7578 --- .../rail/reversal/reversal_onRoute_beyond_core/errors.sumo | 2 -- .../reversal_onRoute_beyond_core/railsignalblocks.sumo | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/errors.sumo b/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/errors.sumo index 3339d047c136..e69de29bb2d1 100644 --- a/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/errors.sumo +++ b/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/errors.sumo @@ -1,2 +0,0 @@ -Warning: No point of conflict found between driveway 'J0.d0' and driveway 'J7.0' when creating sub-driveway -Warning: No point of conflict found between driveway 'J7.0' and driveway 'J0.d0' when creating sub-driveway diff --git a/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/railsignalblocks.sumo b/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/railsignalblocks.sumo index 2140b145fe1a..7073682d8b01 100644 --- a/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/railsignalblocks.sumo +++ b/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/railsignalblocks.sumo @@ -1,6 +1,6 @@ - + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reversal_in_first_block/net.net.xml b/tests/sumo/rail/reversal/reversal_in_first_block/net.net.xml new file mode 100644 index 000000000000..0d0ebaa2e8ea --- /dev/null +++ b/tests/sumo/rail/reversal/reversal_in_first_block/net.net.xml @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reversal_in_first_block/options.sumo b/tests/sumo/rail/reversal/reversal_in_first_block/options.sumo new file mode 100644 index 000000000000..3909a2b2b852 --- /dev/null +++ b/tests/sumo/rail/reversal/reversal_in_first_block/options.sumo @@ -0,0 +1,4 @@ +--no-step-log --no-duration-log +--net-file=net.net.xml +--routes=input_routes.rou.xml +--time-to-teleport 1000 diff --git a/tests/sumo/rail/reversal/reversal_in_first_block/output.sumo b/tests/sumo/rail/reversal/reversal_in_first_block/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/reversal/reversal_in_first_block/railsignalblocks.sumo b/tests/sumo/rail/reversal/reversal_in_first_block/railsignalblocks.sumo new file mode 100644 index 000000000000..441902451714 --- /dev/null +++ b/tests/sumo/rail/reversal/reversal_in_first_block/railsignalblocks.sumo @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reversal_in_first_block/railsignalblocks.sumo.meso b/tests/sumo/rail/reversal/reversal_in_first_block/railsignalblocks.sumo.meso new file mode 100644 index 000000000000..ef865be25246 --- /dev/null +++ b/tests/sumo/rail/reversal/reversal_in_first_block/railsignalblocks.sumo.meso @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reversal_in_first_block/stopinfos.sumo b/tests/sumo/rail/reversal/reversal_in_first_block/stopinfos.sumo new file mode 100644 index 000000000000..c9c406034fdb --- /dev/null +++ b/tests/sumo/rail/reversal/reversal_in_first_block/stopinfos.sumo @@ -0,0 +1 @@ +Auto-generated by TextTest to simulate missing file for this version... diff --git a/tests/sumo/rail/reversal/testsuite.sumo b/tests/sumo/rail/reversal/testsuite.sumo index 1c7ab4bc0f22..fe4478a0dfc4 100644 --- a/tests/sumo/rail/reversal/testsuite.sumo +++ b/tests/sumo/rail/reversal/testsuite.sumo @@ -77,3 +77,6 @@ follower_ends_before_reversal2 # avoid spurious foe checks reversal_onRoute_beyond_core + +# avoid spurious foe checks +reversal_in_first_block From d0c3161320344e6b69c16a7789da19da26a490eb Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 6 Sep 2024 11:27:49 +0200 Subject: [PATCH 172/334] tweaking debug code --- src/microsim/traffic_lights/MSDriveWay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 516e6a507264..55c471120f05 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -44,11 +44,11 @@ //#define DEBUG_BUILD_DRIVEWAY //#define DEBUG_BUILD_SUBDRIVEWAY +//#define DEBUG_ADD_FOES //#define DEBUG_DRIVEWAY_BUILDROUTE //#define DEBUG_CHECK_FLANKS //#define DEBUG_SIGNALSTATE_PRIORITY //#define DEBUG_FIND_PROTECTION -//#define DEBUG_ADD_FOES //#define DEBUG_SIGNALSTATE //#define DEBUG_MOVEREMINDER //#define DEBUG_MATCH From 7e02dd3f73aa4c2a7853600a702e5a5a5c1c213b Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 6 Sep 2024 11:33:27 +0200 Subject: [PATCH 173/334] added test refs #7578, #21 --- .../reversal_in_first_block2/errors.sumo | 0 .../reversal_in_first_block2/errors.sumo.meso | 1 + .../input_routes.rou.xml | 15 ++ .../reversal_in_first_block2/net.net.xml | 158 ++++++++++++++++++ .../reversal_in_first_block2/options.sumo | 4 + .../reversal_in_first_block2/output.sumo | 0 .../railsignalblocks.sumo | 103 ++++++++++++ .../railsignalblocks.sumo.meso | 66 ++++++++ .../reversal_in_first_block2/stopinfos.sumo | 1 + tests/sumo/rail/reversal/testsuite.sumo | 3 + 10 files changed, 351 insertions(+) create mode 100644 tests/sumo/rail/reversal/reversal_in_first_block2/errors.sumo create mode 100644 tests/sumo/rail/reversal/reversal_in_first_block2/errors.sumo.meso create mode 100644 tests/sumo/rail/reversal/reversal_in_first_block2/input_routes.rou.xml create mode 100644 tests/sumo/rail/reversal/reversal_in_first_block2/net.net.xml create mode 100644 tests/sumo/rail/reversal/reversal_in_first_block2/options.sumo create mode 100644 tests/sumo/rail/reversal/reversal_in_first_block2/output.sumo create mode 100644 tests/sumo/rail/reversal/reversal_in_first_block2/railsignalblocks.sumo create mode 100644 tests/sumo/rail/reversal/reversal_in_first_block2/railsignalblocks.sumo.meso create mode 100644 tests/sumo/rail/reversal/reversal_in_first_block2/stopinfos.sumo diff --git a/tests/sumo/rail/reversal/reversal_in_first_block2/errors.sumo b/tests/sumo/rail/reversal/reversal_in_first_block2/errors.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/reversal/reversal_in_first_block2/errors.sumo.meso b/tests/sumo/rail/reversal/reversal_in_first_block2/errors.sumo.meso new file mode 100644 index 000000000000..7c5032aa693c --- /dev/null +++ b/tests/sumo/rail/reversal/reversal_in_first_block2/errors.sumo.meso @@ -0,0 +1 @@ +Warning: Network contains internal links which are ignored. Vehicles will 'jump' across junctions and thus underestimate route lengths and travel times. diff --git a/tests/sumo/rail/reversal/reversal_in_first_block2/input_routes.rou.xml b/tests/sumo/rail/reversal/reversal_in_first_block2/input_routes.rou.xml new file mode 100644 index 000000000000..d443257db0b1 --- /dev/null +++ b/tests/sumo/rail/reversal/reversal_in_first_block2/input_routes.rou.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reversal_in_first_block2/net.net.xml b/tests/sumo/rail/reversal/reversal_in_first_block2/net.net.xml new file mode 100644 index 000000000000..139cf227a73d --- /dev/null +++ b/tests/sumo/rail/reversal/reversal_in_first_block2/net.net.xml @@ -0,0 +1,158 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reversal_in_first_block2/options.sumo b/tests/sumo/rail/reversal/reversal_in_first_block2/options.sumo new file mode 100644 index 000000000000..3909a2b2b852 --- /dev/null +++ b/tests/sumo/rail/reversal/reversal_in_first_block2/options.sumo @@ -0,0 +1,4 @@ +--no-step-log --no-duration-log +--net-file=net.net.xml +--routes=input_routes.rou.xml +--time-to-teleport 1000 diff --git a/tests/sumo/rail/reversal/reversal_in_first_block2/output.sumo b/tests/sumo/rail/reversal/reversal_in_first_block2/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/reversal/reversal_in_first_block2/railsignalblocks.sumo b/tests/sumo/rail/reversal/reversal_in_first_block2/railsignalblocks.sumo new file mode 100644 index 000000000000..abb21d001136 --- /dev/null +++ b/tests/sumo/rail/reversal/reversal_in_first_block2/railsignalblocks.sumo @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reversal_in_first_block2/railsignalblocks.sumo.meso b/tests/sumo/rail/reversal/reversal_in_first_block2/railsignalblocks.sumo.meso new file mode 100644 index 000000000000..ef865be25246 --- /dev/null +++ b/tests/sumo/rail/reversal/reversal_in_first_block2/railsignalblocks.sumo.meso @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reversal_in_first_block2/stopinfos.sumo b/tests/sumo/rail/reversal/reversal_in_first_block2/stopinfos.sumo new file mode 100644 index 000000000000..c9c406034fdb --- /dev/null +++ b/tests/sumo/rail/reversal/reversal_in_first_block2/stopinfos.sumo @@ -0,0 +1 @@ +Auto-generated by TextTest to simulate missing file for this version... diff --git a/tests/sumo/rail/reversal/testsuite.sumo b/tests/sumo/rail/reversal/testsuite.sumo index fe4478a0dfc4..b3e241c3d7f1 100644 --- a/tests/sumo/rail/reversal/testsuite.sumo +++ b/tests/sumo/rail/reversal/testsuite.sumo @@ -80,3 +80,6 @@ reversal_onRoute_beyond_core # avoid spurious foe checks reversal_in_first_block + +# avoid spurious foe checks, both driveways have a route that ends at the network boundary (terminateRoute) +reversal_in_first_block2 From 83c6a33d40988e7cfc15cbc7248182872b0debed Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 6 Sep 2024 12:31:39 +0200 Subject: [PATCH 174/334] avoiding more warnings. refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 55c471120f05..05dd8f445821 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -1579,7 +1579,11 @@ MSDriveWay::buildSubFoe(MSDriveWay* foe, bool movingBlock) { } else if (myTerminateRoute) { foe->myFoes.push_back(this); #ifdef DEBUG_BUILD_SUBDRIVEWAY - std::cout << SIMTIME << " buildSubFoe dw=" << getID() << " terinates, foe=" << foe->getID() << "\n"; + std::cout << SIMTIME << " buildSubFoe dw=" << getID() << " terminates, foe=" << foe->getID() << "\n"; +#endif + } else if (foe->myReversals.size() % 2 == 1) { +#ifdef DEBUG_BUILD_SUBDRIVEWAY + std::cout << SIMTIME << " buildSubFoe dw=" << getID() << " foe=" << foe->getID() << " has " << foe->myReversals.size() << " reversals\n"; #endif } else { #ifdef DEBUG_BUILD_SUBDRIVEWAY From 1f00b22371e13312bd49da76bb4da75b9cf7d4b0 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 6 Sep 2024 12:31:43 +0200 Subject: [PATCH 175/334] patching expected results refs #21, #7578 --- tests/sumo/rail/reversal/reversal_in_first_block/errors.sumo | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/sumo/rail/reversal/reversal_in_first_block/errors.sumo b/tests/sumo/rail/reversal/reversal_in_first_block/errors.sumo index 586af1842b20..e69de29bb2d1 100644 --- a/tests/sumo/rail/reversal/reversal_in_first_block/errors.sumo +++ b/tests/sumo/rail/reversal/reversal_in_first_block/errors.sumo @@ -1,2 +0,0 @@ -Warning: No point of conflict found between driveway 'J2.0' and driveway 'J4.d0' when creating sub-driveway -Warning: No point of conflict found between driveway 'J0.d1' and driveway 'J4.d0' when creating sub-driveway From ae7db466e27eacad6c459df76f993d0083221416 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 6 Sep 2024 13:05:44 +0200 Subject: [PATCH 176/334] refactoring refs #12 --- src/microsim/traffic_lights/MSDriveWay.cpp | 17 ++++++++--------- src/microsim/traffic_lights/MSDriveWay.h | 10 ++++++++-- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 05dd8f445821..34aacd630049 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -93,10 +93,11 @@ MSDriveWay::init() { // =========================================================================== -MSDriveWay::MSDriveWay(const std::string& id, bool temporary) : +MSDriveWay::MSDriveWay(const MSLink* origin, const std::string& id, bool temporary) : MSMoveReminder("DriveWay_" + (temporary ? "tmp" : id)), Named(id), myNumericalID(temporary ? -1 : myGlobalDriveWayIndex++), + myOrigin(origin), myMaxFlankLength(0), myActive(nullptr), myProtectedBidi(nullptr), @@ -104,8 +105,7 @@ MSDriveWay::MSDriveWay(const std::string& id, bool temporary) : myFoundSignal(false), myFoundJump(false), myTerminateRoute(false), - myIsSubDriveway(false), - myIsDepartDriveway(false) + myIsSubDriveway(false) {} @@ -136,7 +136,7 @@ MSDriveWay::~MSDriveWay() { } if (myLane != nullptr) { const MSEdge* first = &myLane->getEdge(); - if (myIsDepartDriveway) { + if (isDepartDriveway() && !myIsSubDriveway) { std::vector& dws = myDepartureDriveways[first]; dws.erase(std::find(dws.begin(), dws.end(), this)); std::vector& dws2 = myDepartureDrivewaysEnds[&myForward.back()->getEdge()]; @@ -596,7 +596,7 @@ MSDriveWay::findProtection(const Approaching& veh, MSLink* link) const { return true; } else { // find protection further upstream - MSDriveWay tmp("tmp", true); + MSDriveWay tmp(link, "tmp", true); const MSLane* before = link->getLaneBefore(); tmp.myFlank.push_back(before); LaneVisitedMap visited; @@ -1183,8 +1183,7 @@ MSDriveWay::buildDriveWay(const std::string& id, const MSLink* link, MSRouteIter // until controlled railSignal link or protecting switch is found // -> add all found lanes to conflictLanes // -> add final links to conflictLinks - MSDriveWay* dw = new MSDriveWay(id); - dw->myIsDepartDriveway = link == nullptr; + MSDriveWay* dw = new MSDriveWay(link, id); LaneVisitedMap visited; std::vector before; MSLane* fromBidi = nullptr; @@ -1553,7 +1552,7 @@ MSDriveWay::buildSubFoe(MSDriveWay* foe, bool movingBlock) { bool foundConflict = false; while (subLast >= 0) { const MSLane* lane = myForward[subLast]; - MSDriveWay tmp("tmp", true); + MSDriveWay tmp(myOrigin, "tmp", true); tmp.myForward.push_back(lane); #ifdef DEBUG_BUILD_SUBDRIVEWAY std::cout << " subLast=" << subLast << " lane=" << lane->getID() << " fc=" << tmp.flankConflict(*foe) << " cc=" << tmp.crossingConflict(*foe) @@ -1605,7 +1604,7 @@ MSDriveWay::buildSubFoe(MSDriveWay* foe, bool movingBlock) { return; } } - MSDriveWay* sub = new MSDriveWay(getID() + "." + toString(mySubDriveWays.size())); + MSDriveWay* sub = new MSDriveWay(myOrigin, getID() + "." + toString(mySubDriveWays.size())); sub->myLane = myLane; sub->myIsSubDriveway = true; myLane->addMoveReminder(sub); diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h index bef4c73907d5..b7eea43ea3dd 100644 --- a/src/microsim/traffic_lights/MSDriveWay.h +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -59,7 +59,7 @@ class MSDriveWay : public MSMoveReminder, public Named { * When a signal guards a switch (indirect guard) that signal stores two * or more driveways */ - MSDriveWay(const std::string& id, bool temporary = false); + MSDriveWay(const MSLink* origin, const std::string& id, bool temporary = false); /// @brief Destructor virtual ~MSDriveWay(); @@ -165,6 +165,9 @@ class MSDriveWay : public MSMoveReminder, public Named { /// @brief global driveway index int myNumericalID; + /// @brief the link that enters this driveway or nullptr for a departure driveWay + const MSLink* myOrigin; + /// @brief the maximum flank length searched while building this driveway double myMaxFlankLength; @@ -185,7 +188,6 @@ class MSDriveWay : public MSMoveReminder, public Named { bool myFoundJump; bool myTerminateRoute; bool myIsSubDriveway; - bool myIsDepartDriveway; /* @brief the actual driveway part up to the next railsignal (halting position) * This must be free of other trains */ @@ -277,6 +279,10 @@ class MSDriveWay : public MSMoveReminder, public Named { /// @brief add symmetical conflict link for foes when building a new driveway void addConflictLink(const MSLink* link); + bool isDepartDriveway() { + return myOrigin == nullptr; + }; + /// @brief return logicID_linkIndex static std::string getTLLinkID(const MSLink* link); From 2d71bec5bfc60555df02cd7a57207089a6520457 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 6 Sep 2024 13:10:59 +0200 Subject: [PATCH 177/334] added test refs #7578, #21 --- .../insertion_vs_fastApproach/errors.sumo | 2 + .../input_routes.rou.xml | 37 +++++++++ .../insertion_vs_fastApproach/options.sumo | 3 + .../insertion_vs_fastApproach/output.sumo | 0 .../railsignalblocks.sumo | 76 +++++++++++++++++++ .../insertion_vs_fastApproach/tripinfos.sumo | 43 +++++++++++ .../tripinfos.sumo.meso | 45 +++++++++++ .../rail/rail_signal/priority/testsuite.sumo | 3 + 8 files changed, 209 insertions(+) create mode 100644 tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/errors.sumo create mode 100644 tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/input_routes.rou.xml create mode 100644 tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/options.sumo create mode 100644 tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/output.sumo create mode 100644 tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/railsignalblocks.sumo create mode 100644 tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/tripinfos.sumo create mode 100644 tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/tripinfos.sumo.meso diff --git a/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/errors.sumo b/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/errors.sumo new file mode 100644 index 000000000000..aff31325170c --- /dev/null +++ b/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/errors.sumo @@ -0,0 +1,2 @@ +Warning: Vehicle 't0' performs emergency braking on lane 'a_0' with decel=5.00, wished=1.30, severity=1.00, time=26.00. +Warning: Vehicle 't0' performs emergency stop at the end of lane 'a_0' because of a red traffic light (decel=-13.89, offset=6.24), time=26.00. diff --git a/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/input_routes.rou.xml b/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/input_routes.rou.xml new file mode 100644 index 000000000000..5bce253a1f4a --- /dev/null +++ b/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/input_routes.rou.xml @@ -0,0 +1,37 @@ + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/options.sumo b/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/options.sumo new file mode 100644 index 000000000000..33fe0509751a --- /dev/null +++ b/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/options.sumo @@ -0,0 +1,3 @@ +--no-step-log --no-duration-log --net-file=net.net.xml +-a input_routes.rou.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/output.sumo b/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/railsignalblocks.sumo new file mode 100644 index 000000000000..b01cc81b5758 --- /dev/null +++ b/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/railsignalblocks.sumo @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/tripinfos.sumo b/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/tripinfos.sumo new file mode 100644 index 000000000000..17ac61e191b7 --- /dev/null +++ b/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/tripinfos.sumo @@ -0,0 +1,43 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/tripinfos.sumo.meso b/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/tripinfos.sumo.meso new file mode 100644 index 000000000000..d74aa49fd7e9 --- /dev/null +++ b/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/tripinfos.sumo.meso @@ -0,0 +1,45 @@ + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/priority/testsuite.sumo b/tests/sumo/rail/rail_signal/priority/testsuite.sumo index 194a7f6885ea..0de966ec321f 100644 --- a/tests/sumo/rail/rail_signal/priority/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/priority/testsuite.sumo @@ -6,3 +6,6 @@ waiting_time_top # route files is loaded with option -a so that the vehicle with the later depart (lower waitingTime) can be defined first. # This way the later vehicle would be allowed to to first if the numerical-id tiebraker were used. waiting_time_bottom + +# insertion cannot happen if the driveway is approache by a fast train that cannot stop safely. +insertion_vs_fastApproach From 77845cb38827909c3efa57671c10e9b1601a18c2 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 6 Sep 2024 15:34:24 +0200 Subject: [PATCH 178/334] guarding insertion against comitted approach refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 16 +++++++++++++++- src/microsim/traffic_lights/MSDriveWay.h | 4 ++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 34aacd630049..f8a7a7e858ff 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -283,7 +283,7 @@ MSDriveWay::conflictLinkApproached() const { bool -MSDriveWay::hasLinkConflict(const Approaching& veh, MSLink* foeLink) const { +MSDriveWay::hasLinkConflict(const Approaching& veh, const MSLink* foeLink) const { #ifdef DEBUG_SIGNALSTATE_PRIORITY if (gDebugFlag4) { std::cout << " checkLinkConflict foeLink=" << getTLLinkID(foeLink) << "\n"; @@ -499,6 +499,20 @@ MSDriveWay::foeDriveWayOccupied(bool store, const SUMOVehicle* ego, MSEdgeVector /// @todo: if foe occupies more than one edge we should add all of them to the occupied vector } return true; + } else if (foeDW != this && isDepartDriveway() && !foeDW->isDepartDriveway()) { + if (foeDW->myOrigin->getApproaching().size() > 0) { + Approaching foeA = foeDW->myOrigin->getClosest(); + const SUMOVehicle* foe = foeA.first; + if (foeA.second.dist < foe->getBrakeGap(true)) { + MSRouteIterator firstIt = std::find(foe->getCurrentRouteEdge(), foe->getRoute().end(), foeDW->myRoute.front()); + if (firstIt != foe->getRoute().end()) { + if (foeDW->match(foe->getRoute(), firstIt)) { + //std::cout << SIMTIME << " " << getID() << " blocked by " << foeDW->getID() << " (approached by " << foe->getID() << ")\n"; + return true; + } + } + } + } } } return false; diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h index b7eea43ea3dd..310e52a1934b 100644 --- a/src/microsim/traffic_lights/MSDriveWay.h +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -226,7 +226,7 @@ class MSDriveWay : public MSMoveReminder, public Named { bool deadlockLaneOccupied(const SUMOVehicle* ego, bool store = true) const; /// @brief Whether the approaching vehicle is prevent from driving by another vehicle approaching the given link - bool hasLinkConflict(const Approaching& closest, MSLink* foeLink) const; + bool hasLinkConflict(const Approaching& closest, const MSLink* foeLink) const; /// @brief Wether this driveway (route) overlaps with the given one bool overlap(const MSDriveWay& other) const; @@ -279,7 +279,7 @@ class MSDriveWay : public MSMoveReminder, public Named { /// @brief add symmetical conflict link for foes when building a new driveway void addConflictLink(const MSLink* link); - bool isDepartDriveway() { + bool isDepartDriveway() const { return myOrigin == nullptr; }; From 0ab45899c6284b43d710621786a9787fc3161f86 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 6 Sep 2024 15:34:28 +0200 Subject: [PATCH 179/334] patching expected results refs #21, #7578 --- .../priority/insertion_vs_fastApproach/errors.sumo | 2 -- .../priority/insertion_vs_fastApproach/tripinfos.sumo | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/errors.sumo b/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/errors.sumo index aff31325170c..e69de29bb2d1 100644 --- a/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/errors.sumo +++ b/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/errors.sumo @@ -1,2 +0,0 @@ -Warning: Vehicle 't0' performs emergency braking on lane 'a_0' with decel=5.00, wished=1.30, severity=1.00, time=26.00. -Warning: Vehicle 't0' performs emergency stop at the end of lane 'a_0' because of a red traffic light (decel=-13.89, offset=6.24), time=26.00. diff --git a/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/tripinfos.sumo b/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/tripinfos.sumo index 17ac61e191b7..ff8a66a41a14 100644 --- a/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/tripinfos.sumo +++ b/tests/sumo/rail/rail_signal/priority/insertion_vs_fastApproach/tripinfos.sumo @@ -1,6 +1,6 @@ - - - + + From 4d06a9ab00dfe464c7fecab458839d44f5615c51 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Mon, 9 Sep 2024 12:35:10 +0200 Subject: [PATCH 180/334] added test refs #7578, #21 --- .../double_reversal_dwEnd/errors.sumo | 3 + .../double_reversal_dwEnd/errors.sumo.meso | 0 .../input_routes.rou.xml | 36 +++++ .../double_reversal_dwEnd/net.net.xml | 144 ++++++++++++++++++ .../double_reversal_dwEnd/options.sumo | 4 + .../double_reversal_dwEnd/output.sumo | 0 .../railsignalblocks.sumo | 93 +++++++++++ .../double_reversal_dwEnd/railsignalvehs.sumo | 41 +++++ .../double_reversal_dwEnd/tripinfos.sumo | 46 ++++++ .../double_reversal_dwEnd/tripinfos.sumo.meso | 49 ++++++ tests/sumo/rail/reversal/testsuite.sumo | 3 + 11 files changed, 419 insertions(+) create mode 100644 tests/sumo/rail/reversal/double_reversal_dwEnd/errors.sumo create mode 100644 tests/sumo/rail/reversal/double_reversal_dwEnd/errors.sumo.meso create mode 100644 tests/sumo/rail/reversal/double_reversal_dwEnd/input_routes.rou.xml create mode 100644 tests/sumo/rail/reversal/double_reversal_dwEnd/net.net.xml create mode 100644 tests/sumo/rail/reversal/double_reversal_dwEnd/options.sumo create mode 100644 tests/sumo/rail/reversal/double_reversal_dwEnd/output.sumo create mode 100644 tests/sumo/rail/reversal/double_reversal_dwEnd/railsignalblocks.sumo create mode 100644 tests/sumo/rail/reversal/double_reversal_dwEnd/railsignalvehs.sumo create mode 100644 tests/sumo/rail/reversal/double_reversal_dwEnd/tripinfos.sumo create mode 100644 tests/sumo/rail/reversal/double_reversal_dwEnd/tripinfos.sumo.meso diff --git a/tests/sumo/rail/reversal/double_reversal_dwEnd/errors.sumo b/tests/sumo/rail/reversal/double_reversal_dwEnd/errors.sumo new file mode 100644 index 000000000000..1f2d13614e9f --- /dev/null +++ b/tests/sumo/rail/reversal/double_reversal_dwEnd/errors.sumo @@ -0,0 +1,3 @@ +Warning: Vehicle 'v1'; frontal collision with vehicle 'v0', lane='-E3_0', gap=-1.00, time=86.00 stage=move. +Warning: Vehicle 'v0'; frontal collision with vehicle 'v1', lane='-E3_0', gap=-1.00, time=100.00 stage=move. +Warning: Vehicle 'v0'; frontal collision with vehicle 'v1', lane='-E3_0', gap=-1.00, time=102.00 stage=move. diff --git a/tests/sumo/rail/reversal/double_reversal_dwEnd/errors.sumo.meso b/tests/sumo/rail/reversal/double_reversal_dwEnd/errors.sumo.meso new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/reversal/double_reversal_dwEnd/input_routes.rou.xml b/tests/sumo/rail/reversal/double_reversal_dwEnd/input_routes.rou.xml new file mode 100644 index 000000000000..2816b6cdb9ac --- /dev/null +++ b/tests/sumo/rail/reversal/double_reversal_dwEnd/input_routes.rou.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/double_reversal_dwEnd/net.net.xml b/tests/sumo/rail/reversal/double_reversal_dwEnd/net.net.xml new file mode 100644 index 000000000000..a50c6c53f2a1 --- /dev/null +++ b/tests/sumo/rail/reversal/double_reversal_dwEnd/net.net.xml @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/double_reversal_dwEnd/options.sumo b/tests/sumo/rail/reversal/double_reversal_dwEnd/options.sumo new file mode 100644 index 000000000000..97ca7def9193 --- /dev/null +++ b/tests/sumo/rail/reversal/double_reversal_dwEnd/options.sumo @@ -0,0 +1,4 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml --tripinfo-output=tripinfos.xml +--use-stop-ended +--railsignal-vehicle-output railsignal_vehicles.xml +--collision.action warn diff --git a/tests/sumo/rail/reversal/double_reversal_dwEnd/output.sumo b/tests/sumo/rail/reversal/double_reversal_dwEnd/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/reversal/double_reversal_dwEnd/railsignalblocks.sumo b/tests/sumo/rail/reversal/double_reversal_dwEnd/railsignalblocks.sumo new file mode 100644 index 000000000000..1be39ceb108e --- /dev/null +++ b/tests/sumo/rail/reversal/double_reversal_dwEnd/railsignalblocks.sumo @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/double_reversal_dwEnd/railsignalvehs.sumo b/tests/sumo/rail/reversal/double_reversal_dwEnd/railsignalvehs.sumo new file mode 100644 index 000000000000..e891afa072d5 --- /dev/null +++ b/tests/sumo/rail/reversal/double_reversal_dwEnd/railsignalvehs.sumo @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/double_reversal_dwEnd/tripinfos.sumo b/tests/sumo/rail/reversal/double_reversal_dwEnd/tripinfos.sumo new file mode 100644 index 000000000000..f27efc0db502 --- /dev/null +++ b/tests/sumo/rail/reversal/double_reversal_dwEnd/tripinfos.sumo @@ -0,0 +1,46 @@ + + + + + + + + diff --git a/tests/sumo/rail/reversal/double_reversal_dwEnd/tripinfos.sumo.meso b/tests/sumo/rail/reversal/double_reversal_dwEnd/tripinfos.sumo.meso new file mode 100644 index 000000000000..e872986da5b1 --- /dev/null +++ b/tests/sumo/rail/reversal/double_reversal_dwEnd/tripinfos.sumo.meso @@ -0,0 +1,49 @@ + + + + + + + + diff --git a/tests/sumo/rail/reversal/testsuite.sumo b/tests/sumo/rail/reversal/testsuite.sumo index b3e241c3d7f1..364a3c3cd395 100644 --- a/tests/sumo/rail/reversal/testsuite.sumo +++ b/tests/sumo/rail/reversal/testsuite.sumo @@ -83,3 +83,6 @@ reversal_in_first_block # avoid spurious foe checks, both driveways have a route that ends at the network boundary (terminateRoute) reversal_in_first_block2 + +# train must not exit driveway by reversal +double_reversal_dwEnd From 0c8db92494ff0d0e3b5d55634e3357fd87dfabad Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Mon, 9 Sep 2024 14:25:36 +0200 Subject: [PATCH 181/334] reversal no longer leaves a driveway. refs #7578 --- src/mesosim/MEVehicle.h | 4 ++++ src/microsim/traffic_lights/MSDriveWay.cpp | 2 +- src/microsim/transportables/MSTransportable.h | 4 ++++ src/utils/vehicle/SUMOTrafficObject.h | 7 +++++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/mesosim/MEVehicle.h b/src/mesosim/MEVehicle.h index 9a745f7f812c..480ad4c468ab 100644 --- a/src/mesosim/MEVehicle.h +++ b/src/mesosim/MEVehicle.h @@ -82,6 +82,10 @@ class MEVehicle : public MSBaseVehicle { return nullptr; } + const MSLane* getBackLane() const { + return nullptr; + } + /** @brief Return current position (x/y, cartesian) * * If the vehicle's myLane is 0, Position::INVALID. diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index f8a7a7e858ff..070e127ecff1 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -219,7 +219,7 @@ MSDriveWay::notifyLeaveBack(SUMOTrafficObject& veh, Notification reason, const M std::cout << SIMTIME << " notifyLeaveBack " << getDescription() << " veh=" << veh.getID() << " lane=" << Named::getIDSecure(leftLane) << " reason=" << toString(reason) << "\n"; #endif if (veh.isVehicle()) { - if (leftLane == myForward.back()) { + if (leftLane == myForward.back() && veh.getBackLane() != leftLane->getBidiLane()) { myTrains.erase(&dynamic_cast(veh)); if (myWriteVehicles) { myVehicleEvents.push_back(VehicleEvent(SIMSTEP, false, veh.getID(), reason)); diff --git a/src/microsim/transportables/MSTransportable.h b/src/microsim/transportables/MSTransportable.h index 97e46faaf087..3ca6347e6b01 100644 --- a/src/microsim/transportables/MSTransportable.h +++ b/src/microsim/transportables/MSTransportable.h @@ -180,6 +180,10 @@ class MSTransportable : public SUMOTrafficObject { return (*myStep)->getLane(); } + const MSLane* getBackLane() const { + return getLane(); + } + /// @brief Returns the departure edge const MSEdge* getFromEdge() const { return (*myStep)->getFromEdge(); diff --git a/src/utils/vehicle/SUMOTrafficObject.h b/src/utils/vehicle/SUMOTrafficObject.h index 00b5ccd96263..a9a90edddd29 100644 --- a/src/utils/vehicle/SUMOTrafficObject.h +++ b/src/utils/vehicle/SUMOTrafficObject.h @@ -138,6 +138,13 @@ class SUMOTrafficObject : public Named { */ virtual const MSLane* getLane() const = 0; + /** @brief Returns the lane the where the rear of the object is currently at + * + * @return The current back lane or nullptr if the object is not on a lane + */ + virtual const MSLane* getBackLane() const = 0; + + /// @brief return index of edge within route virtual int getRoutePosition() const = 0; From 43bbc0052c40df1413a7773f4d097ee7e6b4f6f0 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Mon, 9 Sep 2024 14:25:45 +0200 Subject: [PATCH 182/334] patching expected results refs #21, #7578 --- .../rail/reversal/double_reversal_dwEnd/errors.sumo | 3 --- .../double_reversal_dwEnd/railsignalvehs.sumo | 12 ++++++------ .../reversal/double_reversal_dwEnd/tripinfos.sumo | 4 ++-- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/tests/sumo/rail/reversal/double_reversal_dwEnd/errors.sumo b/tests/sumo/rail/reversal/double_reversal_dwEnd/errors.sumo index 1f2d13614e9f..e69de29bb2d1 100644 --- a/tests/sumo/rail/reversal/double_reversal_dwEnd/errors.sumo +++ b/tests/sumo/rail/reversal/double_reversal_dwEnd/errors.sumo @@ -1,3 +0,0 @@ -Warning: Vehicle 'v1'; frontal collision with vehicle 'v0', lane='-E3_0', gap=-1.00, time=86.00 stage=move. -Warning: Vehicle 'v0'; frontal collision with vehicle 'v1', lane='-E3_0', gap=-1.00, time=100.00 stage=move. -Warning: Vehicle 'v0'; frontal collision with vehicle 'v1', lane='-E3_0', gap=-1.00, time=102.00 stage=move. diff --git a/tests/sumo/rail/reversal/double_reversal_dwEnd/railsignalvehs.sumo b/tests/sumo/rail/reversal/double_reversal_dwEnd/railsignalvehs.sumo index e891afa072d5..1c5b023b84d6 100644 --- a/tests/sumo/rail/reversal/double_reversal_dwEnd/railsignalvehs.sumo +++ b/tests/sumo/rail/reversal/double_reversal_dwEnd/railsignalvehs.sumo @@ -5,7 +5,7 @@ - + @@ -14,9 +14,9 @@ - - - + + + @@ -24,10 +24,10 @@ - - + + diff --git a/tests/sumo/rail/reversal/double_reversal_dwEnd/tripinfos.sumo b/tests/sumo/rail/reversal/double_reversal_dwEnd/tripinfos.sumo index f27efc0db502..39cfeae0ac01 100644 --- a/tests/sumo/rail/reversal/double_reversal_dwEnd/tripinfos.sumo +++ b/tests/sumo/rail/reversal/double_reversal_dwEnd/tripinfos.sumo @@ -1,6 +1,6 @@ - - + From 8643e0c2683ab03e5ab63edf82117e161c48c825 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Mon, 9 Sep 2024 16:42:17 +0200 Subject: [PATCH 183/334] added test refs #7578, #21 --- .../reversal/bidiDepart_reversal/errors.sumo | 2 + .../bidiDepart_reversal/errors.sumo.meso | 0 .../bidiDepart_reversal/input_routes.rou.xml | 37 +++++ .../reversal/bidiDepart_reversal/net.net.xml | 135 ++++++++++++++++++ .../reversal/bidiDepart_reversal/options.sumo | 4 + .../reversal/bidiDepart_reversal/output.sumo | 0 .../bidiDepart_reversal/railsignalblocks.sumo | 113 +++++++++++++++ .../bidiDepart_reversal/railsignalvehs.sumo | 54 +++++++ .../bidiDepart_reversal/tripinfos.sumo | 47 ++++++ .../bidiDepart_reversal/tripinfos.sumo.meso | 49 +++++++ tests/sumo/rail/reversal/testsuite.sumo | 3 + 11 files changed, 444 insertions(+) create mode 100644 tests/sumo/rail/reversal/bidiDepart_reversal/errors.sumo create mode 100644 tests/sumo/rail/reversal/bidiDepart_reversal/errors.sumo.meso create mode 100644 tests/sumo/rail/reversal/bidiDepart_reversal/input_routes.rou.xml create mode 100644 tests/sumo/rail/reversal/bidiDepart_reversal/net.net.xml create mode 100644 tests/sumo/rail/reversal/bidiDepart_reversal/options.sumo create mode 100644 tests/sumo/rail/reversal/bidiDepart_reversal/output.sumo create mode 100644 tests/sumo/rail/reversal/bidiDepart_reversal/railsignalblocks.sumo create mode 100644 tests/sumo/rail/reversal/bidiDepart_reversal/railsignalvehs.sumo create mode 100644 tests/sumo/rail/reversal/bidiDepart_reversal/tripinfos.sumo create mode 100644 tests/sumo/rail/reversal/bidiDepart_reversal/tripinfos.sumo.meso diff --git a/tests/sumo/rail/reversal/bidiDepart_reversal/errors.sumo b/tests/sumo/rail/reversal/bidiDepart_reversal/errors.sumo new file mode 100644 index 000000000000..8dd3b6b460d4 --- /dev/null +++ b/tests/sumo/rail/reversal/bidiDepart_reversal/errors.sumo @@ -0,0 +1,2 @@ +Warning: Vehicle 'v1' performs emergency braking on lane 'E0_0' with decel=5.00, wished=1.30, severity=1.00, time=111.00. +Warning: Vehicle 'v1' performs emergency stop at the end of lane 'E0_0' because of a red traffic light (decel=-8.89, offset=1.78), time=112.00. diff --git a/tests/sumo/rail/reversal/bidiDepart_reversal/errors.sumo.meso b/tests/sumo/rail/reversal/bidiDepart_reversal/errors.sumo.meso new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/reversal/bidiDepart_reversal/input_routes.rou.xml b/tests/sumo/rail/reversal/bidiDepart_reversal/input_routes.rou.xml new file mode 100644 index 000000000000..9eafebd423eb --- /dev/null +++ b/tests/sumo/rail/reversal/bidiDepart_reversal/input_routes.rou.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/bidiDepart_reversal/net.net.xml b/tests/sumo/rail/reversal/bidiDepart_reversal/net.net.xml new file mode 100644 index 000000000000..3acbc5f9b7cd --- /dev/null +++ b/tests/sumo/rail/reversal/bidiDepart_reversal/net.net.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/bidiDepart_reversal/options.sumo b/tests/sumo/rail/reversal/bidiDepart_reversal/options.sumo new file mode 100644 index 000000000000..97ca7def9193 --- /dev/null +++ b/tests/sumo/rail/reversal/bidiDepart_reversal/options.sumo @@ -0,0 +1,4 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml --tripinfo-output=tripinfos.xml +--use-stop-ended +--railsignal-vehicle-output railsignal_vehicles.xml +--collision.action warn diff --git a/tests/sumo/rail/reversal/bidiDepart_reversal/output.sumo b/tests/sumo/rail/reversal/bidiDepart_reversal/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/reversal/bidiDepart_reversal/railsignalblocks.sumo b/tests/sumo/rail/reversal/bidiDepart_reversal/railsignalblocks.sumo new file mode 100644 index 000000000000..bd15cbbd9d8c --- /dev/null +++ b/tests/sumo/rail/reversal/bidiDepart_reversal/railsignalblocks.sumo @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/bidiDepart_reversal/railsignalvehs.sumo b/tests/sumo/rail/reversal/bidiDepart_reversal/railsignalvehs.sumo new file mode 100644 index 000000000000..b47158ee032f --- /dev/null +++ b/tests/sumo/rail/reversal/bidiDepart_reversal/railsignalvehs.sumo @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/bidiDepart_reversal/tripinfos.sumo b/tests/sumo/rail/reversal/bidiDepart_reversal/tripinfos.sumo new file mode 100644 index 000000000000..1026197e841b --- /dev/null +++ b/tests/sumo/rail/reversal/bidiDepart_reversal/tripinfos.sumo @@ -0,0 +1,47 @@ + + + + + + + + + diff --git a/tests/sumo/rail/reversal/bidiDepart_reversal/tripinfos.sumo.meso b/tests/sumo/rail/reversal/bidiDepart_reversal/tripinfos.sumo.meso new file mode 100644 index 000000000000..e872986da5b1 --- /dev/null +++ b/tests/sumo/rail/reversal/bidiDepart_reversal/tripinfos.sumo.meso @@ -0,0 +1,49 @@ + + + + + + + + diff --git a/tests/sumo/rail/reversal/testsuite.sumo b/tests/sumo/rail/reversal/testsuite.sumo index 364a3c3cd395..0354393c33af 100644 --- a/tests/sumo/rail/reversal/testsuite.sumo +++ b/tests/sumo/rail/reversal/testsuite.sumo @@ -86,3 +86,6 @@ reversal_in_first_block2 # train must not exit driveway by reversal double_reversal_dwEnd + +# invalid conflict when a train reverses within the bidi section, causing emergency braking +bidiDepart_reversal From 3b4f7119bf360a9e2155a67f7af7dd3580d10742 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Mon, 9 Sep 2024 17:12:31 +0200 Subject: [PATCH 184/334] removing invalid foes. refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 070e127ecff1..50960338e529 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -1452,7 +1452,7 @@ MSDriveWay::addBidiFoes(const MSRailSignal* ownSignal, bool extended) { const MSEdge* bidiEdge = &bidi->getEdge(); if (myDepartureDriveways.count(bidiEdge) != 0) { for (MSDriveWay* foe : myDepartureDriveways[bidiEdge]) { - if (!extended || flankConflict(*foe)) { + if (flankConflict(*foe)) { #ifdef DEBUG_ADD_FOES std::cout << " foe " << foe->getID() << " departs on bidi=" << bidiEdge->getID() << "\n"; #endif @@ -1466,7 +1466,7 @@ MSDriveWay::addBidiFoes(const MSRailSignal* ownSignal, bool extended) { } if (myDepartureDrivewaysEnds.count(bidiEdge) != 0) { for (MSDriveWay* foe : myDepartureDrivewaysEnds[bidiEdge]) { - if (!extended || flankConflict(*foe)) { + if (flankConflict(*foe)) { #ifdef DEBUG_ADD_FOES std::cout << " foe " << foe->getID() << " ends on bidi=" << bidiEdge->getID() << "\n"; #endif From d9049bde4d9d10a57b60adbcf2285508194e9fe2 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Mon, 9 Sep 2024 17:12:36 +0200 Subject: [PATCH 185/334] patching expected results refs #21, #7578 --- .../bugs/ticket12184/railsignalblocks.sumo | 4 ++-- .../sumo/rail/bugs/ticket12184/tripinfos.sumo | 4 ++-- .../bugs/ticket12184b/railsignalblocks.sumo | 4 ++-- .../rail/bugs/ticket12184b/tripinfos.sumo | 4 ++-- .../reversal/bidiDepart_reversal/errors.sumo | 2 -- .../bidiDepart_reversal/railsignalblocks.sumo | 11 ++++------ .../bidiDepart_reversal/railsignalvehs.sumo | 20 +++++++------------ .../bidiDepart_reversal/tripinfos.sumo | 4 ++-- .../railsignalblocks.sumo | 11 ++++------ .../railsignalblocks.sumo | 11 ++++------ 10 files changed, 29 insertions(+), 46 deletions(-) diff --git a/tests/sumo/rail/bugs/ticket12184/railsignalblocks.sumo b/tests/sumo/rail/bugs/ticket12184/railsignalblocks.sumo index 2aa73a8919cb..13d13e6f53b0 100644 --- a/tests/sumo/rail/bugs/ticket12184/railsignalblocks.sumo +++ b/tests/sumo/rail/bugs/ticket12184/railsignalblocks.sumo @@ -1,6 +1,6 @@ - + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/priority/stop_before_signal/net.net.xml b/tests/sumo/rail/rail_signal/priority/stop_before_signal/net.net.xml new file mode 100644 index 000000000000..2d82f4a40393 --- /dev/null +++ b/tests/sumo/rail/rail_signal/priority/stop_before_signal/net.net.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/priority/stop_before_signal/options.sumo b/tests/sumo/rail/rail_signal/priority/stop_before_signal/options.sumo new file mode 100644 index 000000000000..17dad2aecbd4 --- /dev/null +++ b/tests/sumo/rail/rail_signal/priority/stop_before_signal/options.sumo @@ -0,0 +1,4 @@ +--no-step-log --no-duration-log --net-file=net.net.xml +-r input_routes.rou.xml +--tripinfo-output tripinfos.xml +--additional-files input_additional.add.xml diff --git a/tests/sumo/rail/rail_signal/priority/stop_before_signal/output.sumo b/tests/sumo/rail/rail_signal/priority/stop_before_signal/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/priority/stop_before_signal/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/priority/stop_before_signal/railsignalblocks.sumo new file mode 100644 index 000000000000..76e1d49c1d2d --- /dev/null +++ b/tests/sumo/rail/rail_signal/priority/stop_before_signal/railsignalblocks.sumo @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/priority/stop_before_signal/tls_state_switch.sumo b/tests/sumo/rail/rail_signal/priority/stop_before_signal/tls_state_switch.sumo new file mode 100644 index 000000000000..c78c23310c3c --- /dev/null +++ b/tests/sumo/rail/rail_signal/priority/stop_before_signal/tls_state_switch.sumo @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/priority/stop_before_signal/tripinfos.sumo b/tests/sumo/rail/rail_signal/priority/stop_before_signal/tripinfos.sumo new file mode 100644 index 000000000000..fd6fd8b7d973 --- /dev/null +++ b/tests/sumo/rail/rail_signal/priority/stop_before_signal/tripinfos.sumo @@ -0,0 +1,44 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/priority/stop_before_signal/tripinfos.sumo.meso b/tests/sumo/rail/rail_signal/priority/stop_before_signal/tripinfos.sumo.meso new file mode 100644 index 000000000000..d74aa49fd7e9 --- /dev/null +++ b/tests/sumo/rail/rail_signal/priority/stop_before_signal/tripinfos.sumo.meso @@ -0,0 +1,45 @@ + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/priority/testsuite.sumo b/tests/sumo/rail/rail_signal/priority/testsuite.sumo index 0de966ec321f..53e10555c1a3 100644 --- a/tests/sumo/rail/rail_signal/priority/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/priority/testsuite.sumo @@ -9,3 +9,6 @@ waiting_time_bottom # insertion cannot happen if the driveway is approache by a fast train that cannot stop safely. insertion_vs_fastApproach + +# ensure stable priority decision if one train wants to stop before a signal +stop_before_signal From e5a6b9f566b431029676e01eefc9b75a389f2137 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 10 Sep 2024 10:30:14 +0200 Subject: [PATCH 187/334] preventing unstable signal state when a stop is planned directly before a signal. refs #7578 --- src/microsim/MSVehicle.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/microsim/MSVehicle.cpp b/src/microsim/MSVehicle.cpp index 7e39ed246bb1..6e32f395f883 100644 --- a/src/microsim/MSVehicle.cpp +++ b/src/microsim/MSVehicle.cpp @@ -2270,6 +2270,7 @@ MSVehicle::planMoveInternal(const SUMOTime t, MSLeaderInfo ahead, DriveItemVecto assert(lane != 0); const MSLane* leaderLane = myLane; bool foundRailSignal = !isRailway(getVClass()); + bool planningToStop = false; #ifdef PARALLEL_STOPWATCH myLane->getStopWatch()[0].start(); #endif @@ -2559,9 +2560,12 @@ MSVehicle::planMoveInternal(const SUMOTime t, MSLeaderInfo ahead, DriveItemVecto #endif // if the vehicle is going to stop we don't need to look further // (except for trains that make use of further link-approach registration for safety purposes) - if (!isWaypoint && !isRailway(getVClass())) { - lfLinks.emplace_back(v, newStopDist); - break; + if (!isWaypoint) { + planningToStop = true; + if (!isRailway(getVClass())) { + lfLinks.emplace_back(v, newStopDist); + break; + } } } @@ -2873,7 +2877,7 @@ MSVehicle::planMoveInternal(const SUMOTime t, MSLeaderInfo ahead, DriveItemVecto // if stopping is possible, arrivalTime can be arbitrarily large. A small value keeps fractional times (impatience) meaningful double arrivalSpeedBraking = 0; const double bGap = cfModel.brakeGap(v); - if (seen < bGap && !isStopped()) { // XXX: should this use the current speed (at least for the ballistic case)? (Leo) Refs. #2575 + if (seen < bGap && !isStopped() && !planningToStop) { // XXX: should this use the current speed (at least for the ballistic case)? (Leo) Refs. #2575 // vehicle cannot come to a complete stop in time if (MSGlobals::gSemiImplicitEulerUpdate) { arrivalSpeedBraking = cfModel.getMinimalArrivalSpeedEuler(seen, v); From 971abb1ea0b85a9a826ccf343a92e549bb21c1d1 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 10 Sep 2024 10:30:19 +0200 Subject: [PATCH 188/334] patching expected results refs #21, #7578 --- .../priority/stop_before_signal/errors.sumo | 1 - .../stop_before_signal/tls_state_switch.sumo | 12 ++++-------- .../priority/stop_before_signal/tripinfos.sumo | 6 +++--- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/tests/sumo/rail/rail_signal/priority/stop_before_signal/errors.sumo b/tests/sumo/rail/rail_signal/priority/stop_before_signal/errors.sumo index 7e820b468f61..e69de29bb2d1 100644 --- a/tests/sumo/rail/rail_signal/priority/stop_before_signal/errors.sumo +++ b/tests/sumo/rail/rail_signal/priority/stop_before_signal/errors.sumo @@ -1 +0,0 @@ -Warning: Vehicle 't1' performs emergency braking on lane 'd_0' with decel=2.00, wished=1.00, severity=1.00, time=5.00. diff --git a/tests/sumo/rail/rail_signal/priority/stop_before_signal/tls_state_switch.sumo b/tests/sumo/rail/rail_signal/priority/stop_before_signal/tls_state_switch.sumo index c78c23310c3c..a85817ce7aa4 100644 --- a/tests/sumo/rail/rail_signal/priority/stop_before_signal/tls_state_switch.sumo +++ b/tests/sumo/rail/rail_signal/priority/stop_before_signal/tls_state_switch.sumo @@ -1,6 +1,6 @@ - - - + + From bb8e71e12ebb5f38c16d0011fde8088ff2cbc394 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 10 Sep 2024 10:45:46 +0200 Subject: [PATCH 189/334] remove superfluous quote from warning. refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 50960338e529..ed2467f4ab38 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -837,7 +837,7 @@ MSDriveWay::buildRoute(const MSLink* origin, double length, bool seekBidiSwitch = true; bool foundUnsafeSwitch = false; MSLane* toLane = origin ? origin->getViaLaneOrLane() : (*next)->getLanes()[0]; - const std::string warnID = origin ? "rail signal '" + getClickableTLLinkID(origin) + "'" : "insertion lane '" + toLane->getID() + "'"; + const std::string warnID = origin ? "rail signal " + getClickableTLLinkID(origin) + "'" : "insertion lane '" + toLane->getID() + "'"; #ifdef DEBUG_DRIVEWAY_BUILDROUTE gDebugFlag4 = DEBUG_HELPER(orignRS); if (gDebugFlag4) std::cout << "buildRoute origin=" << warnID << " vehRoute=" << toString(ConstMSEdgeVector(next, end)) From 57e2d1b90b36a409b39cca54deff4935d8bb1e2e Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 10 Sep 2024 10:49:26 +0200 Subject: [PATCH 190/334] remove superfluous quote from warning. refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index ed2467f4ab38..a8efe61730ca 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -837,7 +837,7 @@ MSDriveWay::buildRoute(const MSLink* origin, double length, bool seekBidiSwitch = true; bool foundUnsafeSwitch = false; MSLane* toLane = origin ? origin->getViaLaneOrLane() : (*next)->getLanes()[0]; - const std::string warnID = origin ? "rail signal " + getClickableTLLinkID(origin) + "'" : "insertion lane '" + toLane->getID() + "'"; + const std::string warnID = origin ? "rail signal " + getClickableTLLinkID(origin) : "insertion lane '" + toLane->getID() + "'"; #ifdef DEBUG_DRIVEWAY_BUILDROUTE gDebugFlag4 = DEBUG_HELPER(orignRS); if (gDebugFlag4) std::cout << "buildRoute origin=" << warnID << " vehRoute=" << toString(ConstMSEdgeVector(next, end)) From c5eee1baec3eda950663af5204f4fa12a73b4a7c Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 10 Sep 2024 12:23:39 +0200 Subject: [PATCH 191/334] added test refs #7578, #21 --- .../reversal/routes_cross_twice/errors.sumo | 4 + .../routes_cross_twice/errors.sumo.meso | 0 .../routes_cross_twice/input_routes.rou.xml | 41 ++++ .../reversal/routes_cross_twice/net.net.xml | 199 ++++++++++++++++++ .../reversal/routes_cross_twice/options.sumo | 1 + .../reversal/routes_cross_twice/output.sumo | 0 .../routes_cross_twice/railsignalblocks.sumo | 137 ++++++++++++ .../routes_cross_twice/tripinfos.sumo | 43 ++++ .../routes_cross_twice/tripinfos.sumo.meso | 49 +++++ tests/sumo/rail/reversal/testsuite.sumo | 3 + 10 files changed, 477 insertions(+) create mode 100644 tests/sumo/rail/reversal/routes_cross_twice/errors.sumo create mode 100644 tests/sumo/rail/reversal/routes_cross_twice/errors.sumo.meso create mode 100644 tests/sumo/rail/reversal/routes_cross_twice/input_routes.rou.xml create mode 100644 tests/sumo/rail/reversal/routes_cross_twice/net.net.xml create mode 100644 tests/sumo/rail/reversal/routes_cross_twice/options.sumo create mode 100644 tests/sumo/rail/reversal/routes_cross_twice/output.sumo create mode 100644 tests/sumo/rail/reversal/routes_cross_twice/railsignalblocks.sumo create mode 100644 tests/sumo/rail/reversal/routes_cross_twice/tripinfos.sumo create mode 100644 tests/sumo/rail/reversal/routes_cross_twice/tripinfos.sumo.meso diff --git a/tests/sumo/rail/reversal/routes_cross_twice/errors.sumo b/tests/sumo/rail/reversal/routes_cross_twice/errors.sumo new file mode 100644 index 000000000000..de0b9092f696 --- /dev/null +++ b/tests/sumo/rail/reversal/routes_cross_twice/errors.sumo @@ -0,0 +1,4 @@ +Warning: Teleporting vehicle 't1'; waited too long (yield), lane='b2_0', time=339.00. +Warning: Teleporting vehicle 't0'; waited too long (yield), lane='b_0', time=339.00. +Warning: Vehicle 't0' ends teleporting on edge 'c', time=339.00. +Warning: Vehicle 't1' ends teleporting on edge 'c2', time=339.00. diff --git a/tests/sumo/rail/reversal/routes_cross_twice/errors.sumo.meso b/tests/sumo/rail/reversal/routes_cross_twice/errors.sumo.meso new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/reversal/routes_cross_twice/input_routes.rou.xml b/tests/sumo/rail/reversal/routes_cross_twice/input_routes.rou.xml new file mode 100644 index 000000000000..7df11a0c6142 --- /dev/null +++ b/tests/sumo/rail/reversal/routes_cross_twice/input_routes.rou.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/routes_cross_twice/net.net.xml b/tests/sumo/rail/reversal/routes_cross_twice/net.net.xml new file mode 100644 index 000000000000..2fb73c12c595 --- /dev/null +++ b/tests/sumo/rail/reversal/routes_cross_twice/net.net.xml @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/routes_cross_twice/options.sumo b/tests/sumo/rail/reversal/routes_cross_twice/options.sumo new file mode 100644 index 000000000000..e4f87d6703ff --- /dev/null +++ b/tests/sumo/rail/reversal/routes_cross_twice/options.sumo @@ -0,0 +1 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml --tripinfo-output=tripinfos.xml diff --git a/tests/sumo/rail/reversal/routes_cross_twice/output.sumo b/tests/sumo/rail/reversal/routes_cross_twice/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/reversal/routes_cross_twice/railsignalblocks.sumo b/tests/sumo/rail/reversal/routes_cross_twice/railsignalblocks.sumo new file mode 100644 index 000000000000..3dc12f3ad622 --- /dev/null +++ b/tests/sumo/rail/reversal/routes_cross_twice/railsignalblocks.sumo @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/routes_cross_twice/tripinfos.sumo b/tests/sumo/rail/reversal/routes_cross_twice/tripinfos.sumo new file mode 100644 index 000000000000..f0d72034c512 --- /dev/null +++ b/tests/sumo/rail/reversal/routes_cross_twice/tripinfos.sumo @@ -0,0 +1,43 @@ + + + + + + + + diff --git a/tests/sumo/rail/reversal/routes_cross_twice/tripinfos.sumo.meso b/tests/sumo/rail/reversal/routes_cross_twice/tripinfos.sumo.meso new file mode 100644 index 000000000000..e872986da5b1 --- /dev/null +++ b/tests/sumo/rail/reversal/routes_cross_twice/tripinfos.sumo.meso @@ -0,0 +1,49 @@ + + + + + + + + diff --git a/tests/sumo/rail/reversal/testsuite.sumo b/tests/sumo/rail/reversal/testsuite.sumo index 0354393c33af..ae4cdf6e7371 100644 --- a/tests/sumo/rail/reversal/testsuite.sumo +++ b/tests/sumo/rail/reversal/testsuite.sumo @@ -89,3 +89,6 @@ double_reversal_dwEnd # invalid conflict when a train reverses within the bidi section, causing emergency braking bidiDepart_reversal + +# invalid conflict +routes_cross_twice From 4bc872b8daed5cb6ceed2d4cbb4cd65a19fced81 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 10 Sep 2024 17:00:35 +0200 Subject: [PATCH 192/334] added test refs #7578, #21 --- .../rail_signal/siding_both_ways/errors.sumo | 0 .../siding_both_ways/input_routes.rou.xml | 44 ++++ .../rail_signal/siding_both_ways/net.net.xml | 236 ++++++++++++++++++ .../rail_signal/siding_both_ways/options.sumo | 2 + .../rail_signal/siding_both_ways/output.sumo | 0 .../siding_both_ways/railsignalblocks.sumo | 209 ++++++++++++++++ .../siding_both_ways/tripinfos.sumo | 45 ++++ tests/sumo/rail/rail_signal/testsuite.sumo | 3 + 8 files changed, 539 insertions(+) create mode 100644 tests/sumo/rail/rail_signal/siding_both_ways/errors.sumo create mode 100644 tests/sumo/rail/rail_signal/siding_both_ways/input_routes.rou.xml create mode 100644 tests/sumo/rail/rail_signal/siding_both_ways/net.net.xml create mode 100644 tests/sumo/rail/rail_signal/siding_both_ways/options.sumo create mode 100644 tests/sumo/rail/rail_signal/siding_both_ways/output.sumo create mode 100644 tests/sumo/rail/rail_signal/siding_both_ways/railsignalblocks.sumo create mode 100644 tests/sumo/rail/rail_signal/siding_both_ways/tripinfos.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways/errors.sumo b/tests/sumo/rail/rail_signal/siding_both_ways/errors.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/siding_both_ways/input_routes.rou.xml b/tests/sumo/rail/rail_signal/siding_both_ways/input_routes.rou.xml new file mode 100644 index 000000000000..67f36438774b --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_both_ways/input_routes.rou.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_both_ways/net.net.xml b/tests/sumo/rail/rail_signal/siding_both_ways/net.net.xml new file mode 100644 index 000000000000..0ddc5c773058 --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_both_ways/net.net.xml @@ -0,0 +1,236 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_both_ways/options.sumo b/tests/sumo/rail/rail_signal/siding_both_ways/options.sumo new file mode 100644 index 000000000000..aca2e8d18e45 --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_both_ways/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/rail_signal/siding_both_ways/output.sumo b/tests/sumo/rail/rail_signal/siding_both_ways/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/siding_both_ways/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/siding_both_ways/railsignalblocks.sumo new file mode 100644 index 000000000000..b45249395516 --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_both_ways/railsignalblocks.sumo @@ -0,0 +1,209 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_both_ways/tripinfos.sumo b/tests/sumo/rail/rail_signal/siding_both_ways/tripinfos.sumo new file mode 100644 index 000000000000..a96fa9f92a9d --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_both_ways/tripinfos.sumo @@ -0,0 +1,45 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/testsuite.sumo b/tests/sumo/rail/rail_signal/testsuite.sumo index 0e503f84cba9..9675f75bf1d5 100644 --- a/tests/sumo/rail/rail_signal/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/testsuite.sumo @@ -122,3 +122,6 @@ end_depart_within # a driveway is updated after being used update_driveways + +# both sides of a siding are used in both directions +siding_both_ways From cd06fdaa816cd923ff832c0fd413bad8ea099d9e Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 10 Sep 2024 17:23:18 +0200 Subject: [PATCH 193/334] added test refs #7578, #21 --- .../sidingShort_deadlock/errors.sumo | 2 + .../sidingShort_deadlock/input_routes.rou.xml | 41 +++ .../sidingShort_deadlock/net.net.xml | 236 ++++++++++++++++++ .../sidingShort_deadlock/options.sumo | 2 + .../sidingShort_deadlock/output.sumo | 0 .../railsignalblocks.sumo | 140 +++++++++++ .../sidingShort_deadlock/tripinfos.sumo | 43 ++++ .../rail_signal/siding_deadlock/errors.sumo | 4 + .../siding_deadlock/input_routes.rou.xml | 47 ++++ .../rail_signal/siding_deadlock/net.net.xml | 236 ++++++++++++++++++ .../rail_signal/siding_deadlock/options.sumo | 2 + .../rail_signal/siding_deadlock/output.sumo | 0 .../siding_deadlock/railsignalblocks.sumo | 199 +++++++++++++++ .../siding_deadlock/tripinfos.sumo | 45 ++++ tests/sumo/rail/rail_signal/testsuite.sumo | 6 + 15 files changed, 1003 insertions(+) create mode 100644 tests/sumo/rail/rail_signal/sidingShort_deadlock/errors.sumo create mode 100644 tests/sumo/rail/rail_signal/sidingShort_deadlock/input_routes.rou.xml create mode 100644 tests/sumo/rail/rail_signal/sidingShort_deadlock/net.net.xml create mode 100644 tests/sumo/rail/rail_signal/sidingShort_deadlock/options.sumo create mode 100644 tests/sumo/rail/rail_signal/sidingShort_deadlock/output.sumo create mode 100644 tests/sumo/rail/rail_signal/sidingShort_deadlock/railsignalblocks.sumo create mode 100644 tests/sumo/rail/rail_signal/sidingShort_deadlock/tripinfos.sumo create mode 100644 tests/sumo/rail/rail_signal/siding_deadlock/errors.sumo create mode 100644 tests/sumo/rail/rail_signal/siding_deadlock/input_routes.rou.xml create mode 100644 tests/sumo/rail/rail_signal/siding_deadlock/net.net.xml create mode 100644 tests/sumo/rail/rail_signal/siding_deadlock/options.sumo create mode 100644 tests/sumo/rail/rail_signal/siding_deadlock/output.sumo create mode 100644 tests/sumo/rail/rail_signal/siding_deadlock/railsignalblocks.sumo create mode 100644 tests/sumo/rail/rail_signal/siding_deadlock/tripinfos.sumo diff --git a/tests/sumo/rail/rail_signal/sidingShort_deadlock/errors.sumo b/tests/sumo/rail/rail_signal/sidingShort_deadlock/errors.sumo new file mode 100644 index 000000000000..9cf2ccbaf565 --- /dev/null +++ b/tests/sumo/rail/rail_signal/sidingShort_deadlock/errors.sumo @@ -0,0 +1,2 @@ +Warning: Teleporting vehicle 't0'; waited too long (yield), lane='d_0', time=348.00. +Warning: Vehicle 't0' teleports beyond arrival edge 'g', time=370.00. diff --git a/tests/sumo/rail/rail_signal/sidingShort_deadlock/input_routes.rou.xml b/tests/sumo/rail/rail_signal/sidingShort_deadlock/input_routes.rou.xml new file mode 100644 index 000000000000..cb0bc79de76b --- /dev/null +++ b/tests/sumo/rail/rail_signal/sidingShort_deadlock/input_routes.rou.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/sidingShort_deadlock/net.net.xml b/tests/sumo/rail/rail_signal/sidingShort_deadlock/net.net.xml new file mode 100644 index 000000000000..0ddc5c773058 --- /dev/null +++ b/tests/sumo/rail/rail_signal/sidingShort_deadlock/net.net.xml @@ -0,0 +1,236 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/sidingShort_deadlock/options.sumo b/tests/sumo/rail/rail_signal/sidingShort_deadlock/options.sumo new file mode 100644 index 000000000000..aca2e8d18e45 --- /dev/null +++ b/tests/sumo/rail/rail_signal/sidingShort_deadlock/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/rail_signal/sidingShort_deadlock/output.sumo b/tests/sumo/rail/rail_signal/sidingShort_deadlock/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/sidingShort_deadlock/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/sidingShort_deadlock/railsignalblocks.sumo new file mode 100644 index 000000000000..9d978e059f42 --- /dev/null +++ b/tests/sumo/rail/rail_signal/sidingShort_deadlock/railsignalblocks.sumo @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/sidingShort_deadlock/tripinfos.sumo b/tests/sumo/rail/rail_signal/sidingShort_deadlock/tripinfos.sumo new file mode 100644 index 000000000000..f5b3aa76b752 --- /dev/null +++ b/tests/sumo/rail/rail_signal/sidingShort_deadlock/tripinfos.sumo @@ -0,0 +1,43 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_deadlock/errors.sumo b/tests/sumo/rail/rail_signal/siding_deadlock/errors.sumo new file mode 100644 index 000000000000..4875df5f45eb --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_deadlock/errors.sumo @@ -0,0 +1,4 @@ +Warning: Teleporting vehicle 't3'; waited too long (yield), lane='-g_0', time=330.00. +Warning: Teleporting vehicle 't2'; waited too long (yield), lane='a_0', time=330.00. +Warning: Vehicle 't2' ends teleporting on edge 'd', time=350.00. +Warning: Vehicle 't3' ends teleporting on edge '-d2', time=350.00. diff --git a/tests/sumo/rail/rail_signal/siding_deadlock/input_routes.rou.xml b/tests/sumo/rail/rail_signal/siding_deadlock/input_routes.rou.xml new file mode 100644 index 000000000000..05882aafcf5d --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_deadlock/input_routes.rou.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_deadlock/net.net.xml b/tests/sumo/rail/rail_signal/siding_deadlock/net.net.xml new file mode 100644 index 000000000000..0ddc5c773058 --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_deadlock/net.net.xml @@ -0,0 +1,236 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_deadlock/options.sumo b/tests/sumo/rail/rail_signal/siding_deadlock/options.sumo new file mode 100644 index 000000000000..aca2e8d18e45 --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_deadlock/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/rail_signal/siding_deadlock/output.sumo b/tests/sumo/rail/rail_signal/siding_deadlock/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/siding_deadlock/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/siding_deadlock/railsignalblocks.sumo new file mode 100644 index 000000000000..682afb3753e6 --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_deadlock/railsignalblocks.sumo @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_deadlock/tripinfos.sumo b/tests/sumo/rail/rail_signal/siding_deadlock/tripinfos.sumo new file mode 100644 index 000000000000..94d807f3c351 --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_deadlock/tripinfos.sumo @@ -0,0 +1,45 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/testsuite.sumo b/tests/sumo/rail/rail_signal/testsuite.sumo index 9675f75bf1d5..ac1938b53c2f 100644 --- a/tests/sumo/rail/rail_signal/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/testsuite.sumo @@ -125,3 +125,9 @@ update_driveways # both sides of a siding are used in both directions siding_both_ways + +# siding cannot be used because it is already occupied +siding_deadlock + +# siding cannot be used because the trains are too long +sidingShort_deadlock From 28f5108968cc0f6a87288fb6e9f9a72d5108f7c2 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 11 Sep 2024 00:04:14 +0200 Subject: [PATCH 194/334] tweaking debug code --- src/microsim/traffic_lights/MSDriveWay.cpp | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index a8efe61730ca..a25386840252 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -628,7 +628,6 @@ MSDriveWay::findProtection(const Approaching& veh, MSLink* link) const { } } - bool MSDriveWay::overlap(const MSDriveWay& other) const { for (int i = 0; i < myCoreSize; i++) { @@ -1218,13 +1217,21 @@ MSDriveWay::buildDriveWay(const std::string& id, const MSLink* link, MSRouteIter dw->checkFlanks(link, dw->myBidi, visited, false, flankSwitches); dw->checkFlanks(link, before, visited, true, flankSwitches); for (MSLink* fsLink : flankSwitches) { - //std::cout << getID() << " flankSwitch=" << link->getDescription() << "\n"; +#ifdef DEBUG_ADD_FOES + if (DEBUG_COND_DW) { + std::cout << " fsLink=" << fsLink->getDescription() << "\n"; + } +#endif dw->findFlankProtection(fsLink, 0, visited, fsLink, dw->myFlank); } std::set flankSwitchesBidiExtended; dw->checkFlanks(link, dw->myBidiExtended, visited, false, flankSwitchesBidiExtended); for (MSLink* link : flankSwitchesBidiExtended) { - //std::cout << getID() << " flankSwitchBEx=" << link->getDescription() << "\n"; +#ifdef DEBUG_ADD_FOES + if (DEBUG_COND_DW) { + std::cout << " fsLinkExtended=" << link->getDescription() << "\n"; + } +#endif dw->findFlankProtection(link, 0, visited, link, dw->myBidiExtended); } MSRailSignal* rs = link ? const_cast(static_cast(link->getTLLogic())) : nullptr; @@ -1395,7 +1402,7 @@ MSDriveWay::match(const MSRoute& route, MSRouteIterator firstIt) const { void MSDriveWay::addFoes(const MSLink* link) { #ifdef DEBUG_ADD_FOES - std::cout << "driveway " << myID << " (" << myNumericalID << ") addFoes for link " << link->getDescription() << "\n"; + std::cout << "driveway " << myID << " addFoes for link " << link->getDescription() << " extraCheck=" << extraCheck << "\n"; #endif const MSRailSignal* rs = dynamic_cast(link->getTLLogic()); if (rs != nullptr) { @@ -1405,7 +1412,7 @@ MSDriveWay::addFoes(const MSLink* link) { #endif if (foe != this && (flankConflict(*foe) || foe->flankConflict(*this) || crossingConflict(*foe) || foe->crossingConflict(*this))) { #ifdef DEBUG_ADD_FOES - std::cout << " foe=" << foe->myID << " (" << foe->getNumericalID() << ")\n"; + std::cout << " foe=" << foe->myID << "\n"; #endif myFoes.push_back(foe); } @@ -1417,7 +1424,7 @@ MSDriveWay::addFoes(const MSLink* link) { void MSDriveWay::addSwitchFoes(const MSLink* link) { #ifdef DEBUG_ADD_FOES - std::cout << "driveway " << myID << " (" << myNumericalID << ") addSwitchFoes for link " << link->getDescription() << "\n"; + std::cout << "driveway " << myID << " addSwitchFoes for link " << link->getDescription() << "\n"; #endif auto it = mySwitchDriveWays.find(link); if (it != mySwitchDriveWays.end()) { @@ -1438,7 +1445,7 @@ MSDriveWay::addSwitchFoes(const MSLink* link) { void MSDriveWay::addBidiFoes(const MSRailSignal* ownSignal, bool extended) { #ifdef DEBUG_ADD_FOES - std::cout << "driveway " << myID << " (" << myNumericalID << ") addBidiFoes extended=" << extended << "\n"; + std::cout << "driveway " << myID << " addBidiFoes extended=" << extended << "\n"; #endif const std::vector& bidiLanes = extended ? myBidiExtended : myBidi; for (const MSLane* bidi : bidiLanes) { @@ -1485,7 +1492,7 @@ MSDriveWay::addBidiFoes(const MSRailSignal* ownSignal, bool extended) { void MSDriveWay::addParallelFoes(const MSLink* link, const MSEdge* first) { #ifdef DEBUG_ADD_FOES - std::cout << "driveway " << myID << " (" << myNumericalID << ") addParallelFoes\n"; + std::cout << "driveway " << myID << " addParallelFoes\n"; #endif if (link) { addFoes(link); From f5c5cf736c06f27cf8f9d16751808c6cecb0491c Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 11 Sep 2024 00:05:09 +0200 Subject: [PATCH 195/334] avoiding superfluous switch recordings for extended bidi. refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index a25386840252..2e5c6c187084 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -981,7 +981,7 @@ MSDriveWay::buildRoute(const MSLink* origin, double length, } #endif } - if (links.size() > 1) { + if (links.size() > 1 && !foundUnsafeSwitch) { // switch on driveway mySwitchDriveWays[link].push_back(this); myForwardSwitches.push_back(link); From 666cfc249e947700303f2aaa1ad0453c45b1aa03 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 11 Sep 2024 08:36:47 +0200 Subject: [PATCH 196/334] tweaking debug code --- src/microsim/traffic_lights/MSDriveWay.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 2e5c6c187084..b5c8ef1a4f59 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -1280,6 +1280,11 @@ MSDriveWay::buildDriveWay(const std::string& id, const MSLink* link, MSRouteIter } } else { if (foe->bidiBlockedByEnd(*dw)) { +#ifdef DEBUG_ADD_FOES + if (DEBUG_COND_DW) { + std::cout << " setting " << dw->getID() << " as foe of " << foe->getID() << "\n"; + } +#endif foe->myFoes.push_back(dw); } else { dw->buildSubFoe(foe, movingBlock); @@ -1402,7 +1407,7 @@ MSDriveWay::match(const MSRoute& route, MSRouteIterator firstIt) const { void MSDriveWay::addFoes(const MSLink* link) { #ifdef DEBUG_ADD_FOES - std::cout << "driveway " << myID << " addFoes for link " << link->getDescription() << " extraCheck=" << extraCheck << "\n"; + std::cout << "driveway " << myID << " addFoes for link " << link->getDescription() << "\n"; #endif const MSRailSignal* rs = dynamic_cast(link->getTLLogic()); if (rs != nullptr) { From 2f76013358cc10cb649d7780960cc8bb98760060 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 11 Sep 2024 11:41:12 +0200 Subject: [PATCH 197/334] fix unsymmetrical recording of driveway route with safe switch and unsafe switches. refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index b5c8ef1a4f59..9a02a5f1acf3 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -925,7 +925,7 @@ MSDriveWay::buildRoute(const MSLink* origin, double length, for (auto item : visited) { visitedEdges.insert(&item.first->getEdge()); } - while (next != end && visitedEdges.count(*next) == 0) { + while (next != end) { // if bidiNext is used at some point, this driveway will be updated // by looking further along the route until a new protecting switch is found or there are no more bidi edges. // For this reason, we must record the rest of the route (or at least up to where it loops back on itself). From a08a3ca7ddc55f0032a05ed2b33a472860081d3f Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 11 Sep 2024 11:41:22 +0200 Subject: [PATCH 198/334] patching expected results. refs #12, #7578 --- .../bugs/ticket12858/railsignalblocks.sumo | 4 +- .../railsignalblocks.sumo | 14 ++- .../railsignalblocks.sumo | 6 +- .../reversal/routes_cross_twice/errors.sumo | 4 - .../routes_cross_twice/railsignalblocks.sumo | 14 +-- .../routes_cross_twice/tripinfos.sumo | 6 +- .../track_closed/railsignalblocks.sumo | 93 ++++++++++++++----- 7 files changed, 94 insertions(+), 47 deletions(-) diff --git a/tests/sumo/rail/bugs/ticket12858/railsignalblocks.sumo b/tests/sumo/rail/bugs/ticket12858/railsignalblocks.sumo index dff501b49102..586a217a883b 100644 --- a/tests/sumo/rail/bugs/ticket12858/railsignalblocks.sumo +++ b/tests/sumo/rail/bugs/ticket12858/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - - + + diff --git a/tests/sumo/rail/tramwayLoop/track_closed/railsignalblocks.sumo b/tests/sumo/rail/tramwayLoop/track_closed/railsignalblocks.sumo index 70bd5848f5cb..f689231d39b3 100644 --- a/tests/sumo/rail/tramwayLoop/track_closed/railsignalblocks.sumo +++ b/tests/sumo/rail/tramwayLoop/track_closed/railsignalblocks.sumo @@ -1,6 +1,6 @@ - + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_oneSide/net.net.xml b/tests/sumo/rail/rail_signal/siding_oneSide/net.net.xml new file mode 100644 index 000000000000..fc75ce39eddb --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_oneSide/net.net.xml @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_oneSide/options.sumo b/tests/sumo/rail/rail_signal/siding_oneSide/options.sumo new file mode 100644 index 000000000000..aca2e8d18e45 --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_oneSide/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/rail_signal/siding_oneSide/output.sumo b/tests/sumo/rail/rail_signal/siding_oneSide/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/siding_oneSide/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/siding_oneSide/railsignalblocks.sumo new file mode 100644 index 000000000000..f09fcb9e77ed --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_oneSide/railsignalblocks.sumo @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_oneSide/tripinfos.sumo b/tests/sumo/rail/rail_signal/siding_oneSide/tripinfos.sumo new file mode 100644 index 000000000000..7e5662828994 --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_oneSide/tripinfos.sumo @@ -0,0 +1,43 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/testsuite.sumo b/tests/sumo/rail/rail_signal/testsuite.sumo index ac1938b53c2f..20f05bfbed38 100644 --- a/tests/sumo/rail/rail_signal/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/testsuite.sumo @@ -131,3 +131,6 @@ siding_deadlock # siding cannot be used because the trains are too long sidingShort_deadlock + +# siding only has a signal on one side +siding_oneSide From 3fa13bff4d43e7167359efb8e07fd8f4a648d004 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 11 Sep 2024 15:21:41 +0200 Subject: [PATCH 200/334] added test refs #7578, #21 --- .../siding_oneSide_slow/errors.sumo | 0 .../siding_oneSide_slow/input_routes.rou.xml | 37 +++ .../siding_oneSide_slow/net.net.xml | 242 ++++++++++++++++++ .../siding_oneSide_slow/options.sumo | 2 + .../siding_oneSide_slow/output.sumo | 0 .../siding_oneSide_slow/railsignalblocks.sumo | 116 +++++++++ .../siding_oneSide_slow/tripinfos.sumo | 43 ++++ tests/sumo/rail/rail_signal/testsuite.sumo | 3 + 8 files changed, 443 insertions(+) create mode 100644 tests/sumo/rail/rail_signal/siding_oneSide_slow/errors.sumo create mode 100644 tests/sumo/rail/rail_signal/siding_oneSide_slow/input_routes.rou.xml create mode 100644 tests/sumo/rail/rail_signal/siding_oneSide_slow/net.net.xml create mode 100644 tests/sumo/rail/rail_signal/siding_oneSide_slow/options.sumo create mode 100644 tests/sumo/rail/rail_signal/siding_oneSide_slow/output.sumo create mode 100644 tests/sumo/rail/rail_signal/siding_oneSide_slow/railsignalblocks.sumo create mode 100644 tests/sumo/rail/rail_signal/siding_oneSide_slow/tripinfos.sumo diff --git a/tests/sumo/rail/rail_signal/siding_oneSide_slow/errors.sumo b/tests/sumo/rail/rail_signal/siding_oneSide_slow/errors.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/siding_oneSide_slow/input_routes.rou.xml b/tests/sumo/rail/rail_signal/siding_oneSide_slow/input_routes.rou.xml new file mode 100644 index 000000000000..7ae1e6c1b9ef --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_oneSide_slow/input_routes.rou.xml @@ -0,0 +1,37 @@ + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_oneSide_slow/net.net.xml b/tests/sumo/rail/rail_signal/siding_oneSide_slow/net.net.xml new file mode 100644 index 000000000000..fc75ce39eddb --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_oneSide_slow/net.net.xml @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_oneSide_slow/options.sumo b/tests/sumo/rail/rail_signal/siding_oneSide_slow/options.sumo new file mode 100644 index 000000000000..aca2e8d18e45 --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_oneSide_slow/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/rail_signal/siding_oneSide_slow/output.sumo b/tests/sumo/rail/rail_signal/siding_oneSide_slow/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/siding_oneSide_slow/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/siding_oneSide_slow/railsignalblocks.sumo new file mode 100644 index 000000000000..f09fcb9e77ed --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_oneSide_slow/railsignalblocks.sumo @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_oneSide_slow/tripinfos.sumo b/tests/sumo/rail/rail_signal/siding_oneSide_slow/tripinfos.sumo new file mode 100644 index 000000000000..3ed41a8ed71c --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_oneSide_slow/tripinfos.sumo @@ -0,0 +1,43 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/testsuite.sumo b/tests/sumo/rail/rail_signal/testsuite.sumo index 20f05bfbed38..f01531d8fd64 100644 --- a/tests/sumo/rail/rail_signal/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/testsuite.sumo @@ -134,3 +134,6 @@ sidingShort_deadlock # siding only has a signal on one side siding_oneSide + +# siding only has a signal on one side +siding_oneSide_slow From 6b8364d66fb2156175492a0ff876fcac30fb81e3 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 12 Sep 2024 10:40:45 +0200 Subject: [PATCH 201/334] first draft of sidings. refs #15474 --- src/microsim/traffic_lights/MSDriveWay.cpp | 84 +++++++++++++++++++++- src/microsim/traffic_lights/MSDriveWay.h | 14 ++++ 2 files changed, 96 insertions(+), 2 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 9a02a5f1acf3..c7e2817538ea 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -125,6 +125,10 @@ MSDriveWay::~MSDriveWay() { if (it != foe->myFoes.end()) { foe->myFoes.erase(it); } + auto it2 = foe->mySidings.find(this); + if (it2 != foe->mySidings.end()) { + foe->mySidings.erase(it2); + } } for (const MSLink* link : myForwardSwitches) { std::vector& dws = mySwitchDriveWays[link]; @@ -792,6 +796,18 @@ MSDriveWay::writeBlocks(OutputDevice& od) const { od.writeAttr("driveWays", joinToStringSorting(foes, " ")); od.closeTag(); } + for (auto item : mySidings) { + od.openTag("sidings"); + od.writeAttr("foe", item.first->getID()); + for (auto siding : item.second) { + od.openTag("siding"); + od.writeAttr("start", siding.start); + od.writeAttr("end", siding.end); + od.writeAttr("length", siding.length); + od.closeTag(); + } + od.closeTag(); + } } od.closeTag(); // driveWay @@ -1285,12 +1301,12 @@ MSDriveWay::buildDriveWay(const std::string& id, const MSLink* link, MSRouteIter std::cout << " setting " << dw->getID() << " as foe of " << foe->getID() << "\n"; } #endif - foe->myFoes.push_back(dw); + foe->addFoeCheckSiding(dw); } else { dw->buildSubFoe(foe, movingBlock); } if (dw->bidiBlockedByEnd(*foe)) { - dw->myFoes.push_back(foe); + dw->addFoeCheckSiding(foe); } else { foe->buildSubFoe(dw, movingBlock); } @@ -1663,6 +1679,70 @@ MSDriveWay::buildSubFoe(MSDriveWay* foe, bool movingBlock) { #endif } +void +MSDriveWay::addFoeCheckSiding(MSDriveWay* foe) { + myFoes.push_back(foe); + const MSEdge* foeEndBidi = foe->myForward.back()->getEdge().getBidiEdge(); + auto foeSearchBeg = foe->myRoute.begin() + foe->myForward.size(); + auto foeSearchEnd = foe->myRoute.end(); + + if (foeEndBidi == nullptr) { + throw ProcessError("addFoeCheckSiding " + getID() + " foe=" + foe->getID() + " noBidi\n"); + } + int i; + int start = -1; + double length = 0; + for (i = (int)myRoute.size() - 1; i >= 0; i--) { + if (myRoute[i] == foeEndBidi) { + break; + } + } + if (i == -1) { + throw ProcessError("addFoeCheckSiding " + getID() + " foe=" + foe->getID() + " foeEndBidi=" + foeEndBidi->getID() + " not on route\n"); + } + const MSEdge* next = myRoute[i]; + i--; + for (; i >= 0; i--) { + const MSEdge* cur = myRoute[i]; + if (start == -1) { + if (hasRS(cur, next)) { + if (std::find(foeSearchBeg, foeSearchEnd, cur->getBidiEdge()) == foeSearchEnd) { + start = i; + length = cur->getLength(); + } + } + } else { + auto itFind = std::find(foeSearchBeg, foeSearchEnd, cur->getBidiEdge()); + //std::cout << "addFoeCheckSiding " << getID() << " foe=" << foe->getID() << " i=" << i << " curBidi=" << Named::getIDSecure(cur->getBidiEdge()) << " found=" << (itFind != foeSearchEnd) << "\n"; + if (itFind != foeSearchEnd) { + mySidings[foe].push_back(Siding(i + 1, start, length)); + start = -1; + length = 0; + foeSearchBeg = itFind; + } else { + length += cur->getLength(); + } + } + next = cur; + } +} + + +bool +MSDriveWay::hasRS(const MSEdge* cur, const MSEdge* next) { + if (cur->getToJunction()->getType() == SumoXMLNodeType::RAIL_SIGNAL) { + // check if there is a controlled link between cur and next + for (auto lane : cur->getLanes()) { + for (const MSLink* link : lane->getLinkCont()) { + if (&link->getLane()->getEdge() == next && link->getTLLogic() != nullptr) { + return true; + } + } + } + } + return false; +} + void MSDriveWay::addConflictLink(const MSLink* link) { diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h index 310e52a1934b..717eff0ea0ec 100644 --- a/src/microsim/traffic_lights/MSDriveWay.h +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -145,6 +145,8 @@ class MSDriveWay : public MSMoveReminder, public Named { static void init(); + static bool hasRS(const MSEdge* cur, const MSEdge* next); + /// @brief Whether veh must yield to the foe train static bool mustYield(const Approaching& veh, const Approaching& foe); @@ -261,6 +263,9 @@ class MSDriveWay : public MSMoveReminder, public Named { /// @brief add all driveWays that start at the given link as foes void addFoes(const MSLink* link); + /// @brief add foe and update sidings + void addFoeCheckSiding(MSDriveWay* foe); + /// @brief add all driveWays that pass the given link as foes void addSwitchFoes(const MSLink* link); @@ -297,10 +302,19 @@ class MSDriveWay : public MSMoveReminder, public Named { private: + struct Siding { + Siding(int s, int e, double l) : start(s), end(e), length(l) {} + // indices along route + int start; + int end; + double length; + }; + std::set myTrains; std::vector myVehicleEvents; std::vector myFoes; + std::map, ComparatorIdLess> mySidings; /* @brief shortened versions of this driveway to be used as foes instead of the long original * (ends as soon as the train has left a particular conflict section) From a4ebdc7926da4b8c81d5cba91df4936baf3ae649 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 12 Sep 2024 10:57:09 +0200 Subject: [PATCH 202/334] patching expected results refs #21, #15474 --- .../railsignalblocks.sumo | 5 +- .../railsignalblocks.sumo | 5 +- .../siding_both_ways/railsignalblocks.sumo | 26 +++++- .../railsignalblocks.sumo | 17 +++- .../railsignalblocks.sumo | 83 ++++++++++++++++++- .../routes_cross_twice/railsignalblocks.sumo | 14 +++- .../two_passing_loops/railsignalblocks.sumo | 5 +- .../two_passing_loops2/railsignalblocks.sumo | 11 ++- 8 files changed, 158 insertions(+), 8 deletions(-) diff --git a/tests/sumo/rail/bugs/deadlock_bidi_reversal/railsignalblocks.sumo b/tests/sumo/rail/bugs/deadlock_bidi_reversal/railsignalblocks.sumo index 26aa897fa8a8..82b3da8bc7bc 100644 --- a/tests/sumo/rail/bugs/deadlock_bidi_reversal/railsignalblocks.sumo +++ b/tests/sumo/rail/bugs/deadlock_bidi_reversal/railsignalblocks.sumo @@ -1,6 +1,6 @@ - + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_both_ways2/net.net.xml b/tests/sumo/rail/rail_signal/siding_both_ways2/net.net.xml new file mode 100644 index 000000000000..3c1369b6f82e --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_both_ways2/net.net.xml @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_both_ways2/options.sumo b/tests/sumo/rail/rail_signal/siding_both_ways2/options.sumo new file mode 100644 index 000000000000..aca2e8d18e45 --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_both_ways2/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/rail_signal/siding_both_ways2/output.sumo b/tests/sumo/rail/rail_signal/siding_both_ways2/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/siding_both_ways2/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/siding_both_ways2/railsignalblocks.sumo new file mode 100644 index 000000000000..f577f3152122 --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_both_ways2/railsignalblocks.sumo @@ -0,0 +1,185 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_both_ways2/tripinfos.sumo b/tests/sumo/rail/rail_signal/siding_both_ways2/tripinfos.sumo new file mode 100644 index 000000000000..efc48d54cb3c --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_both_ways2/tripinfos.sumo @@ -0,0 +1,45 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/testsuite.sumo b/tests/sumo/rail/rail_signal/testsuite.sumo index f01531d8fd64..35b0e34b5a5d 100644 --- a/tests/sumo/rail/rail_signal/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/testsuite.sumo @@ -126,14 +126,11 @@ update_driveways # both sides of a siding are used in both directions siding_both_ways +# both sides of a siding are used in both directions but the "wrong" way is only used by stumps +siding_both_ways2 + # siding cannot be used because it is already occupied siding_deadlock # siding cannot be used because the trains are too long sidingShort_deadlock - -# siding only has a signal on one side -siding_oneSide - -# siding only has a signal on one side -siding_oneSide_slow From 17ad93bf87dd53c12b1241417b72570431bae7fe Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 13 Sep 2024 16:32:25 +0200 Subject: [PATCH 213/334] added test refs #15474, #21 --- .../siding_both_ways_addTrain/errors.sumo | 0 .../input_routes.rou.xml | 47 ++++ .../siding_both_ways_addTrain/net.net.xml | 236 ++++++++++++++++++ .../siding_both_ways_addTrain/options.sumo | 2 + .../siding_both_ways_addTrain/output.sumo | 0 .../railsignalblocks.sumo | 233 +++++++++++++++++ .../siding_both_ways_addTrain/tripinfos.sumo | 46 ++++ tests/sumo/rail/rail_signal/testsuite.sumo | 4 + 8 files changed, 568 insertions(+) create mode 100644 tests/sumo/rail/rail_signal/siding_both_ways_addTrain/errors.sumo create mode 100644 tests/sumo/rail/rail_signal/siding_both_ways_addTrain/input_routes.rou.xml create mode 100644 tests/sumo/rail/rail_signal/siding_both_ways_addTrain/net.net.xml create mode 100644 tests/sumo/rail/rail_signal/siding_both_ways_addTrain/options.sumo create mode 100644 tests/sumo/rail/rail_signal/siding_both_ways_addTrain/output.sumo create mode 100644 tests/sumo/rail/rail_signal/siding_both_ways_addTrain/railsignalblocks.sumo create mode 100644 tests/sumo/rail/rail_signal/siding_both_ways_addTrain/tripinfos.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/errors.sumo b/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/errors.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/input_routes.rou.xml b/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/input_routes.rou.xml new file mode 100644 index 000000000000..54ede179f022 --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/input_routes.rou.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/net.net.xml b/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/net.net.xml new file mode 100644 index 000000000000..0ddc5c773058 --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/net.net.xml @@ -0,0 +1,236 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/options.sumo b/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/options.sumo new file mode 100644 index 000000000000..aca2e8d18e45 --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/output.sumo b/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/railsignalblocks.sumo new file mode 100644 index 000000000000..4526425c563a --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/railsignalblocks.sumo @@ -0,0 +1,233 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/tripinfos.sumo b/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/tripinfos.sumo new file mode 100644 index 000000000000..a0cfe417887d --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/tripinfos.sumo @@ -0,0 +1,46 @@ + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/testsuite.sumo b/tests/sumo/rail/rail_signal/testsuite.sumo index 35b0e34b5a5d..da0b1d236094 100644 --- a/tests/sumo/rail/rail_signal/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/testsuite.sumo @@ -126,6 +126,10 @@ update_driveways # both sides of a siding are used in both directions siding_both_ways +# both sides of a siding are used in both directions. +# Check that all other foes are checked even after a usable siding is found for one foe. +siding_both_ways_addTrain + # both sides of a siding are used in both directions but the "wrong" way is only used by stumps siding_both_ways2 From 459b20b66f30d6f428ba132c4f40267a844dc83b Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 13 Sep 2024 16:34:18 +0200 Subject: [PATCH 214/334] fixing early abort of occupied check. refs #15474 --- src/microsim/traffic_lights/MSDriveWay.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index d7bacef32683..55c03824b2f9 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -513,7 +513,13 @@ MSDriveWay::foeDriveWayOccupied(bool store, const SUMOVehicle* ego, MSEdgeVector } /// @todo: if foe occupies more than one edge we should add all of them to the occupied vector } - return !canUseSiding(ego, foeDW); + bool useSiding = canUseSiding(ego, foeDW); + if (useSiding) { + //std::cout << SIMTIME << " " << getID() << " ego=" << ego->getID() << " foeDW=" << foeDW->getID() << " myFoes=" << toString(myFoes) << "\n"; + continue; + } else { + return true; + } } else if (foeDW != this && isDepartDriveway() && !foeDW->isDepartDriveway()) { if (foeDW->myOrigin->getApproaching().size() > 0) { Approaching foeA = foeDW->myOrigin->getClosest(); @@ -523,7 +529,13 @@ MSDriveWay::foeDriveWayOccupied(bool store, const SUMOVehicle* ego, MSEdgeVector if (firstIt != foe->getRoute().end()) { if (foeDW->match(foe->getRoute(), firstIt)) { //std::cout << SIMTIME << " " << getID() << " blocked by " << foeDW->getID() << " (approached by " << foe->getID() << ")\n"; - return !canUseSiding(ego, foeDW); + bool useSiding = canUseSiding(ego, foeDW); + if (useSiding) { + //std::cout << SIMTIME << " " << getID() << " ego=" << ego->getID() << " foeDW=" << foeDW->getID() << " myFoes=" << toString(myFoes) << "\n"; + continue; + } else { + return true; + } } } } From acb3711c326d6ae3053c55936f7b53bbb57da7ea Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 13 Sep 2024 16:34:25 +0200 Subject: [PATCH 215/334] patching expected results refs #21, #15474 --- .../rail/rail_signal/siding_both_ways_addTrain/tripinfos.sumo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/tripinfos.sumo b/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/tripinfos.sumo index a0cfe417887d..7104361625f0 100644 --- a/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/tripinfos.sumo +++ b/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/tripinfos.sumo @@ -1,6 +1,6 @@ - + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_both_ways3/net.net.xml b/tests/sumo/rail/rail_signal/siding_both_ways3/net.net.xml new file mode 100644 index 000000000000..5d564d43e68f --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_both_ways3/net.net.xml @@ -0,0 +1,264 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_both_ways3/options.sumo b/tests/sumo/rail/rail_signal/siding_both_ways3/options.sumo new file mode 100644 index 000000000000..aca2e8d18e45 --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_both_ways3/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/rail_signal/siding_both_ways3/output.sumo b/tests/sumo/rail/rail_signal/siding_both_ways3/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/siding_both_ways3/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/siding_both_ways3/railsignalblocks.sumo new file mode 100644 index 000000000000..5176057a87e9 --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_both_ways3/railsignalblocks.sumo @@ -0,0 +1,217 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_both_ways3/tripinfos.sumo b/tests/sumo/rail/rail_signal/siding_both_ways3/tripinfos.sumo new file mode 100644 index 000000000000..e4d110c31f11 --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_both_ways3/tripinfos.sumo @@ -0,0 +1,45 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/testsuite.sumo b/tests/sumo/rail/rail_signal/testsuite.sumo index da0b1d236094..f0530f7bb091 100644 --- a/tests/sumo/rail/rail_signal/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/testsuite.sumo @@ -133,6 +133,11 @@ siding_both_ways_addTrain # both sides of a siding are used in both directions but the "wrong" way is only used by stumps siding_both_ways2 +# both sides of a siding are used in both directions but the "wrong" way is only used by stumps. +# +# One of the driveways doesn't have the terminateRoute flag. +siding_both_ways3 + # siding cannot be used because it is already occupied siding_deadlock From 47be2ef7dc8734349cd9151556a46ceab1ac7db7 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Mon, 16 Sep 2024 16:21:08 +0200 Subject: [PATCH 217/334] added test refs #7578, #21 --- .../rail_signal/siding_both_ways4/errors.sumo | 4 + .../siding_both_ways4/input_routes.rou.xml | 39 +++ .../rail_signal/siding_both_ways4/net.net.xml | 264 ++++++++++++++++++ .../siding_both_ways4/options.sumo | 2 + .../rail_signal/siding_both_ways4/output.sumo | 0 .../siding_both_ways4/railsignalblocks.sumo | 191 +++++++++++++ .../siding_both_ways4/tripinfos.sumo | 45 +++ tests/sumo/rail/rail_signal/testsuite.sumo | 5 + 8 files changed, 550 insertions(+) create mode 100644 tests/sumo/rail/rail_signal/siding_both_ways4/errors.sumo create mode 100644 tests/sumo/rail/rail_signal/siding_both_ways4/input_routes.rou.xml create mode 100644 tests/sumo/rail/rail_signal/siding_both_ways4/net.net.xml create mode 100644 tests/sumo/rail/rail_signal/siding_both_ways4/options.sumo create mode 100644 tests/sumo/rail/rail_signal/siding_both_ways4/output.sumo create mode 100644 tests/sumo/rail/rail_signal/siding_both_ways4/railsignalblocks.sumo create mode 100644 tests/sumo/rail/rail_signal/siding_both_ways4/tripinfos.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways4/errors.sumo b/tests/sumo/rail/rail_signal/siding_both_ways4/errors.sumo new file mode 100644 index 000000000000..2bbb37fe4b3b --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_both_ways4/errors.sumo @@ -0,0 +1,4 @@ +Warning: No point of conflict found between driveway 'A.1' and driveway 'G.d3' when creating sub-driveway +Warning: No point of conflict found between driveway 'F.1' and driveway 'J0.d2' when creating sub-driveway +Warning: No point of conflict found between driveway 'F.1' and driveway 'A.1' when creating sub-driveway +Warning: No point of conflict found between driveway 'A.1' and driveway 'F.1' when creating sub-driveway diff --git a/tests/sumo/rail/rail_signal/siding_both_ways4/input_routes.rou.xml b/tests/sumo/rail/rail_signal/siding_both_ways4/input_routes.rou.xml new file mode 100644 index 000000000000..6f02c39e0c35 --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_both_ways4/input_routes.rou.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_both_ways4/net.net.xml b/tests/sumo/rail/rail_signal/siding_both_ways4/net.net.xml new file mode 100644 index 000000000000..5d564d43e68f --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_both_ways4/net.net.xml @@ -0,0 +1,264 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_both_ways4/options.sumo b/tests/sumo/rail/rail_signal/siding_both_ways4/options.sumo new file mode 100644 index 000000000000..aca2e8d18e45 --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_both_ways4/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/rail_signal/siding_both_ways4/output.sumo b/tests/sumo/rail/rail_signal/siding_both_ways4/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/siding_both_ways4/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/siding_both_ways4/railsignalblocks.sumo new file mode 100644 index 000000000000..7bf447c0bd4e --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_both_ways4/railsignalblocks.sumo @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_both_ways4/tripinfos.sumo b/tests/sumo/rail/rail_signal/siding_both_ways4/tripinfos.sumo new file mode 100644 index 000000000000..a6c705737623 --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_both_ways4/tripinfos.sumo @@ -0,0 +1,45 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/testsuite.sumo b/tests/sumo/rail/rail_signal/testsuite.sumo index f0530f7bb091..996442de77d1 100644 --- a/tests/sumo/rail/rail_signal/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/testsuite.sumo @@ -138,6 +138,11 @@ siding_both_ways2 # One of the driveways doesn't have the terminateRoute flag. siding_both_ways3 +# both sides of a siding are used in both directions but the "wrong" way is only used by stumps. +# +# both driveways don't have the terminateRoute flag. +siding_both_ways4 + # siding cannot be used because it is already occupied siding_deadlock From ec1626e2fe512bdb7e327ec70c65bf3a0edbf3d5 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Mon, 16 Sep 2024 16:26:39 +0200 Subject: [PATCH 218/334] avoiding invalid foes. refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 55c03824b2f9..4aedbffd2515 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -1653,7 +1653,7 @@ MSDriveWay::buildSubFoe(MSDriveWay* foe, bool movingBlock) { #ifdef DEBUG_BUILD_SUBDRIVEWAY std::cout << SIMTIME << " buildSubFoe dw=" << getID() << " foe=" << foe->getID() << " terminates\n"; #endif - } else if (myTerminateRoute) { + } else if (myTerminateRoute && myBidi.size() <= myForward.size()) { foe->myFoes.push_back(this); #ifdef DEBUG_BUILD_SUBDRIVEWAY std::cout << SIMTIME << " buildSubFoe dw=" << getID() << " terminates, foe=" << foe->getID() << "\n"; From fae92e11254eb649248937847e187d4983d95afa Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Mon, 16 Sep 2024 16:26:45 +0200 Subject: [PATCH 219/334] patching expected results refs #21, #7578 --- .../rail_signal/siding_both_ways3/errors.sumo | 4 +- .../siding_both_ways3/railsignalblocks.sumo | 41 +++---------------- .../siding_both_ways3/tripinfos.sumo | 6 +-- 3 files changed, 11 insertions(+), 40 deletions(-) diff --git a/tests/sumo/rail/rail_signal/siding_both_ways3/errors.sumo b/tests/sumo/rail/rail_signal/siding_both_ways3/errors.sumo index bb29cdbab312..57578a2b4341 100644 --- a/tests/sumo/rail/rail_signal/siding_both_ways3/errors.sumo +++ b/tests/sumo/rail/rail_signal/siding_both_ways3/errors.sumo @@ -1,2 +1,2 @@ -Warning: Teleporting vehicle 't1'; waited too long (yield), lane='-g_0', time=309.00. -Warning: Vehicle 't1' ends teleporting on edge '-e2', time=318.00. +Warning: No point of conflict found between driveway 'A.1' and driveway 'G.d3' when creating sub-driveway +Warning: No point of conflict found between driveway 'A.1' and driveway 'F.1' when creating sub-driveway diff --git a/tests/sumo/rail/rail_signal/siding_both_ways3/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/siding_both_ways3/railsignalblocks.sumo index 5176057a87e9..1bfa28a6f074 100644 --- a/tests/sumo/rail/rail_signal/siding_both_ways3/railsignalblocks.sumo +++ b/tests/sumo/rail/rail_signal/siding_both_ways3/railsignalblocks.sumo @@ -1,6 +1,6 @@ - + + + + + + diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal/net.net.xml b/tests/sumo/rail/rail_signal/sidingShort_noSignal/net.net.xml new file mode 100644 index 000000000000..33fe23abd26b --- /dev/null +++ b/tests/sumo/rail/rail_signal/sidingShort_noSignal/net.net.xml @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal/options.sumo b/tests/sumo/rail/rail_signal/sidingShort_noSignal/options.sumo new file mode 100644 index 000000000000..aca2e8d18e45 --- /dev/null +++ b/tests/sumo/rail/rail_signal/sidingShort_noSignal/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal/output.sumo b/tests/sumo/rail/rail_signal/sidingShort_noSignal/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/sidingShort_noSignal/railsignalblocks.sumo new file mode 100644 index 000000000000..8c826d525ca4 --- /dev/null +++ b/tests/sumo/rail/rail_signal/sidingShort_noSignal/railsignalblocks.sumo @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal/tripinfos.sumo b/tests/sumo/rail/rail_signal/sidingShort_noSignal/tripinfos.sumo new file mode 100644 index 000000000000..2812769ded77 --- /dev/null +++ b/tests/sumo/rail/rail_signal/sidingShort_noSignal/tripinfos.sumo @@ -0,0 +1,43 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/testsuite.sumo b/tests/sumo/rail/rail_signal/testsuite.sumo index 996442de77d1..64c3e171dd20 100644 --- a/tests/sumo/rail/rail_signal/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/testsuite.sumo @@ -148,3 +148,6 @@ siding_deadlock # siding cannot be used because the trains are too long sidingShort_deadlock + +# siding does not prevent deadlock because it doesn't have a signal +sidingShort_noSignal From e12035278ba15ad494625febe3ea7e955312e2b7 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 20 Sep 2024 10:05:08 +0200 Subject: [PATCH 223/334] added test refs #7578, #21 --- .../sidingShort_noSignal2/errors.sumo | 4 + .../input_routes.rou.xml | 37 ++++ .../sidingShort_noSignal2/net.net.xml | 186 ++++++++++++++++++ .../sidingShort_noSignal2/options.sumo | 2 + .../sidingShort_noSignal2/output.sumo | 0 .../railsignalblocks.sumo | 121 ++++++++++++ .../sidingShort_noSignal2/tripinfos.sumo | 43 ++++ tests/sumo/rail/rail_signal/testsuite.sumo | 3 + 8 files changed, 396 insertions(+) create mode 100644 tests/sumo/rail/rail_signal/sidingShort_noSignal2/errors.sumo create mode 100644 tests/sumo/rail/rail_signal/sidingShort_noSignal2/input_routes.rou.xml create mode 100644 tests/sumo/rail/rail_signal/sidingShort_noSignal2/net.net.xml create mode 100644 tests/sumo/rail/rail_signal/sidingShort_noSignal2/options.sumo create mode 100644 tests/sumo/rail/rail_signal/sidingShort_noSignal2/output.sumo create mode 100644 tests/sumo/rail/rail_signal/sidingShort_noSignal2/railsignalblocks.sumo create mode 100644 tests/sumo/rail/rail_signal/sidingShort_noSignal2/tripinfos.sumo diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal2/errors.sumo b/tests/sumo/rail/rail_signal/sidingShort_noSignal2/errors.sumo new file mode 100644 index 000000000000..574c1c66e3a5 --- /dev/null +++ b/tests/sumo/rail/rail_signal/sidingShort_noSignal2/errors.sumo @@ -0,0 +1,4 @@ +Warning: Teleporting vehicle 't3'; waited too long (yield), lane='-g_0', time=338.00. +Warning: Teleporting vehicle 't2'; waited too long (yield), lane='a_0', time=338.00. +Warning: Vehicle 't2' ends teleporting on edge 'b', time=338.00. +Warning: Vehicle 't3' ends teleporting on edge '-f', time=346.00. diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal2/input_routes.rou.xml b/tests/sumo/rail/rail_signal/sidingShort_noSignal2/input_routes.rou.xml new file mode 100644 index 000000000000..e259024af86d --- /dev/null +++ b/tests/sumo/rail/rail_signal/sidingShort_noSignal2/input_routes.rou.xml @@ -0,0 +1,37 @@ + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal2/net.net.xml b/tests/sumo/rail/rail_signal/sidingShort_noSignal2/net.net.xml new file mode 100644 index 000000000000..faeb34819505 --- /dev/null +++ b/tests/sumo/rail/rail_signal/sidingShort_noSignal2/net.net.xml @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal2/options.sumo b/tests/sumo/rail/rail_signal/sidingShort_noSignal2/options.sumo new file mode 100644 index 000000000000..aca2e8d18e45 --- /dev/null +++ b/tests/sumo/rail/rail_signal/sidingShort_noSignal2/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal2/output.sumo b/tests/sumo/rail/rail_signal/sidingShort_noSignal2/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal2/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/sidingShort_noSignal2/railsignalblocks.sumo new file mode 100644 index 000000000000..639c7998a5a8 --- /dev/null +++ b/tests/sumo/rail/rail_signal/sidingShort_noSignal2/railsignalblocks.sumo @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal2/tripinfos.sumo b/tests/sumo/rail/rail_signal/sidingShort_noSignal2/tripinfos.sumo new file mode 100644 index 000000000000..6ae0247b8352 --- /dev/null +++ b/tests/sumo/rail/rail_signal/sidingShort_noSignal2/tripinfos.sumo @@ -0,0 +1,43 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/testsuite.sumo b/tests/sumo/rail/rail_signal/testsuite.sumo index 64c3e171dd20..2fa374e875c8 100644 --- a/tests/sumo/rail/rail_signal/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/testsuite.sumo @@ -151,3 +151,6 @@ sidingShort_deadlock # siding does not prevent deadlock because it doesn't have a signal sidingShort_noSignal + +# siding does not prevent deadlock because it doesn't have a signal. one more layer of signals outside the siding +sidingShort_noSignal2 From 3904de50cc1593c5d661ebba94ef03a205cb4455 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 20 Sep 2024 11:58:01 +0200 Subject: [PATCH 224/334] added test refs #7578, #21 --- .../rail_signal/driveway_variants/errors.sumo | 0 .../driveway_variants/input_routes.rou.xml | 11 ++ .../rail_signal/driveway_variants/net.net.xml | 134 +++++++++++++++++ .../driveway_variants/options.sumo | 2 + .../rail_signal/driveway_variants/output.sumo | 0 .../driveway_variants/railsignalblocks.sumo | 140 ++++++++++++++++++ .../driveway_variants/tripinfos.sumo | 44 ++++++ tests/sumo/rail/rail_signal/testsuite.sumo | 3 + 8 files changed, 334 insertions(+) create mode 100644 tests/sumo/rail/rail_signal/driveway_variants/errors.sumo create mode 100644 tests/sumo/rail/rail_signal/driveway_variants/input_routes.rou.xml create mode 100644 tests/sumo/rail/rail_signal/driveway_variants/net.net.xml create mode 100644 tests/sumo/rail/rail_signal/driveway_variants/options.sumo create mode 100644 tests/sumo/rail/rail_signal/driveway_variants/output.sumo create mode 100644 tests/sumo/rail/rail_signal/driveway_variants/railsignalblocks.sumo create mode 100644 tests/sumo/rail/rail_signal/driveway_variants/tripinfos.sumo diff --git a/tests/sumo/rail/rail_signal/driveway_variants/errors.sumo b/tests/sumo/rail/rail_signal/driveway_variants/errors.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/driveway_variants/input_routes.rou.xml b/tests/sumo/rail/rail_signal/driveway_variants/input_routes.rou.xml new file mode 100644 index 000000000000..b6777b623f51 --- /dev/null +++ b/tests/sumo/rail/rail_signal/driveway_variants/input_routes.rou.xml @@ -0,0 +1,11 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/driveway_variants/net.net.xml b/tests/sumo/rail/rail_signal/driveway_variants/net.net.xml new file mode 100644 index 000000000000..18b67e2f72e6 --- /dev/null +++ b/tests/sumo/rail/rail_signal/driveway_variants/net.net.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/driveway_variants/options.sumo b/tests/sumo/rail/rail_signal/driveway_variants/options.sumo new file mode 100644 index 000000000000..aca2e8d18e45 --- /dev/null +++ b/tests/sumo/rail/rail_signal/driveway_variants/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/rail_signal/driveway_variants/output.sumo b/tests/sumo/rail/rail_signal/driveway_variants/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/driveway_variants/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/driveway_variants/railsignalblocks.sumo new file mode 100644 index 000000000000..53250a4b43f6 --- /dev/null +++ b/tests/sumo/rail/rail_signal/driveway_variants/railsignalblocks.sumo @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/driveway_variants/tripinfos.sumo b/tests/sumo/rail/rail_signal/driveway_variants/tripinfos.sumo new file mode 100644 index 000000000000..75fb84a913bf --- /dev/null +++ b/tests/sumo/rail/rail_signal/driveway_variants/tripinfos.sumo @@ -0,0 +1,44 @@ + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/testsuite.sumo b/tests/sumo/rail/rail_signal/testsuite.sumo index 2fa374e875c8..f9982c31272e 100644 --- a/tests/sumo/rail/rail_signal/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/testsuite.sumo @@ -154,3 +154,6 @@ sidingShort_noSignal # siding does not prevent deadlock because it doesn't have a signal. one more layer of signals outside the siding sidingShort_noSignal2 + +# reduce number of "parallel" driveways +driveway_variants From 6b92b54fcff21f306447c29915f251ebf50aff4c Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 20 Sep 2024 13:46:43 +0200 Subject: [PATCH 225/334] renamed tests refs #21 --- .../{sidingShort_noSignal => siding_noSignal}/errors.sumo | 0 .../input_routes.rou.xml | 0 .../{sidingShort_noSignal => siding_noSignal}/net.net.xml | 0 .../{sidingShort_noSignal => siding_noSignal}/options.sumo | 0 .../{sidingShort_noSignal => siding_noSignal}/output.sumo | 0 .../railsignalblocks.sumo | 0 .../{sidingShort_noSignal => siding_noSignal}/tripinfos.sumo | 0 .../{sidingShort_noSignal2 => siding_noSignal2}/errors.sumo | 0 .../input_routes.rou.xml | 0 .../{sidingShort_noSignal2 => siding_noSignal2}/net.net.xml | 0 .../{sidingShort_noSignal2 => siding_noSignal2}/options.sumo | 0 .../{sidingShort_noSignal2 => siding_noSignal2}/output.sumo | 0 .../railsignalblocks.sumo | 0 .../tripinfos.sumo | 0 tests/sumo/rail/rail_signal/testsuite.sumo | 4 ++-- 15 files changed, 2 insertions(+), 2 deletions(-) rename tests/sumo/rail/rail_signal/{sidingShort_noSignal => siding_noSignal}/errors.sumo (100%) rename tests/sumo/rail/rail_signal/{sidingShort_noSignal => siding_noSignal}/input_routes.rou.xml (100%) rename tests/sumo/rail/rail_signal/{sidingShort_noSignal => siding_noSignal}/net.net.xml (100%) rename tests/sumo/rail/rail_signal/{sidingShort_noSignal => siding_noSignal}/options.sumo (100%) rename tests/sumo/rail/rail_signal/{sidingShort_noSignal => siding_noSignal}/output.sumo (100%) rename tests/sumo/rail/rail_signal/{sidingShort_noSignal => siding_noSignal}/railsignalblocks.sumo (100%) rename tests/sumo/rail/rail_signal/{sidingShort_noSignal => siding_noSignal}/tripinfos.sumo (100%) rename tests/sumo/rail/rail_signal/{sidingShort_noSignal2 => siding_noSignal2}/errors.sumo (100%) rename tests/sumo/rail/rail_signal/{sidingShort_noSignal2 => siding_noSignal2}/input_routes.rou.xml (100%) rename tests/sumo/rail/rail_signal/{sidingShort_noSignal2 => siding_noSignal2}/net.net.xml (100%) rename tests/sumo/rail/rail_signal/{sidingShort_noSignal2 => siding_noSignal2}/options.sumo (100%) rename tests/sumo/rail/rail_signal/{sidingShort_noSignal2 => siding_noSignal2}/output.sumo (100%) rename tests/sumo/rail/rail_signal/{sidingShort_noSignal2 => siding_noSignal2}/railsignalblocks.sumo (100%) rename tests/sumo/rail/rail_signal/{sidingShort_noSignal2 => siding_noSignal2}/tripinfos.sumo (100%) diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal/errors.sumo b/tests/sumo/rail/rail_signal/siding_noSignal/errors.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/sidingShort_noSignal/errors.sumo rename to tests/sumo/rail/rail_signal/siding_noSignal/errors.sumo diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal/input_routes.rou.xml b/tests/sumo/rail/rail_signal/siding_noSignal/input_routes.rou.xml similarity index 100% rename from tests/sumo/rail/rail_signal/sidingShort_noSignal/input_routes.rou.xml rename to tests/sumo/rail/rail_signal/siding_noSignal/input_routes.rou.xml diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal/net.net.xml b/tests/sumo/rail/rail_signal/siding_noSignal/net.net.xml similarity index 100% rename from tests/sumo/rail/rail_signal/sidingShort_noSignal/net.net.xml rename to tests/sumo/rail/rail_signal/siding_noSignal/net.net.xml diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal/options.sumo b/tests/sumo/rail/rail_signal/siding_noSignal/options.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/sidingShort_noSignal/options.sumo rename to tests/sumo/rail/rail_signal/siding_noSignal/options.sumo diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal/output.sumo b/tests/sumo/rail/rail_signal/siding_noSignal/output.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/sidingShort_noSignal/output.sumo rename to tests/sumo/rail/rail_signal/siding_noSignal/output.sumo diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/siding_noSignal/railsignalblocks.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/sidingShort_noSignal/railsignalblocks.sumo rename to tests/sumo/rail/rail_signal/siding_noSignal/railsignalblocks.sumo diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal/tripinfos.sumo b/tests/sumo/rail/rail_signal/siding_noSignal/tripinfos.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/sidingShort_noSignal/tripinfos.sumo rename to tests/sumo/rail/rail_signal/siding_noSignal/tripinfos.sumo diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal2/errors.sumo b/tests/sumo/rail/rail_signal/siding_noSignal2/errors.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/sidingShort_noSignal2/errors.sumo rename to tests/sumo/rail/rail_signal/siding_noSignal2/errors.sumo diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal2/input_routes.rou.xml b/tests/sumo/rail/rail_signal/siding_noSignal2/input_routes.rou.xml similarity index 100% rename from tests/sumo/rail/rail_signal/sidingShort_noSignal2/input_routes.rou.xml rename to tests/sumo/rail/rail_signal/siding_noSignal2/input_routes.rou.xml diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal2/net.net.xml b/tests/sumo/rail/rail_signal/siding_noSignal2/net.net.xml similarity index 100% rename from tests/sumo/rail/rail_signal/sidingShort_noSignal2/net.net.xml rename to tests/sumo/rail/rail_signal/siding_noSignal2/net.net.xml diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal2/options.sumo b/tests/sumo/rail/rail_signal/siding_noSignal2/options.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/sidingShort_noSignal2/options.sumo rename to tests/sumo/rail/rail_signal/siding_noSignal2/options.sumo diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal2/output.sumo b/tests/sumo/rail/rail_signal/siding_noSignal2/output.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/sidingShort_noSignal2/output.sumo rename to tests/sumo/rail/rail_signal/siding_noSignal2/output.sumo diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal2/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/siding_noSignal2/railsignalblocks.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/sidingShort_noSignal2/railsignalblocks.sumo rename to tests/sumo/rail/rail_signal/siding_noSignal2/railsignalblocks.sumo diff --git a/tests/sumo/rail/rail_signal/sidingShort_noSignal2/tripinfos.sumo b/tests/sumo/rail/rail_signal/siding_noSignal2/tripinfos.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/sidingShort_noSignal2/tripinfos.sumo rename to tests/sumo/rail/rail_signal/siding_noSignal2/tripinfos.sumo diff --git a/tests/sumo/rail/rail_signal/testsuite.sumo b/tests/sumo/rail/rail_signal/testsuite.sumo index f9982c31272e..822487c4ec45 100644 --- a/tests/sumo/rail/rail_signal/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/testsuite.sumo @@ -150,10 +150,10 @@ siding_deadlock sidingShort_deadlock # siding does not prevent deadlock because it doesn't have a signal -sidingShort_noSignal +siding_noSignal # siding does not prevent deadlock because it doesn't have a signal. one more layer of signals outside the siding -sidingShort_noSignal2 +siding_noSignal2 # reduce number of "parallel" driveways driveway_variants From 6c4303811f972318eb640a341119512f30973ddf Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 24 Sep 2024 21:27:34 +0200 Subject: [PATCH 226/334] recognizing more conflicts refs #7578 (by no longer assuming any switch save) --- src/microsim/traffic_lights/MSDriveWay.cpp | 69 ++++++++++++++++------ src/microsim/traffic_lights/MSDriveWay.h | 2 + 2 files changed, 52 insertions(+), 19 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index fe085c2db4c1..42f7f453dd75 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -41,6 +41,7 @@ #define MAX_SIGNAL_WARNINGS 10 #define DRIVEWAY_SANITY_CHECK +//#define SUBDRIVEWAY_WARN_NOCONFLICT //#define DEBUG_BUILD_DRIVEWAY //#define DEBUG_BUILD_SUBDRIVEWAY @@ -273,9 +274,9 @@ MSDriveWay::reserve(const Approaching& closest, MSEdgeVector& occupied) { return false; } } - if (deadlockLaneOccupied(closest.first)) { - return false; - } + //if (deadlockLaneOccupied(closest.first)) { + // return false; + //} myActive = closest.first; return true; } @@ -320,15 +321,21 @@ MSDriveWay::hasLinkConflict(const Approaching& veh, const MSLink* foeLink) const if (foeDriveWay.conflictLaneOccupied(false, foe.first) || foeDriveWay.deadlockLaneOccupied(nullptr, false) || !foeRS->constraintsAllow(foe.first) || - !overlap(foeDriveWay)) { + !overlap(foeDriveWay) || + !isFoeOrSubFoe(&foeDriveWay) || + canUseSiding(veh.first, &foeDriveWay)) { #ifdef DEBUG_SIGNALSTATE_PRIORITY if (gDebugFlag4) { if (foeDriveWay.conflictLaneOccupied(false, foe.first)) { std::cout << " foe blocked\n"; } else if (!foeRS->constraintsAllow(foe.first)) { std::cout << " foe constrained\n"; - } else { + } else if (!overlap(foeDriveWay)) { std::cout << " no overlap\n"; + } else if (!isFoeOrSubFoe(&foeDriveWay)) { + std::cout << " foeDW=" << foeDriveWay.getID() << " is not a foe to " << getID() << "\n"; + } else if (canUseSiding(veh.first, &foeDriveWay)) { + std::cout << " use siding\n"; } } #endif @@ -360,6 +367,20 @@ MSDriveWay::hasLinkConflict(const Approaching& veh, const MSLink* foeLink) const } +bool +MSDriveWay::isFoeOrSubFoe(const MSDriveWay* foe) const { + if (std::find(myFoes.begin(), myFoes.end(), foe) != myFoes.end()) { + return true; + } + for (const MSDriveWay* sub : foe->mySubDriveWays) { + if (isFoeOrSubFoe(sub)) { + return true; + } + } + return false; +} + + bool MSDriveWay::mustYield(const Approaching& veh, const Approaching& foe) { if (foe.second.arrivalSpeedBraking == veh.second.arrivalSpeedBraking) { @@ -499,25 +520,33 @@ MSDriveWay::foeDriveWayOccupied(bool store, const SUMOVehicle* ego, MSEdgeVector } } } - if (MSRailSignal::storeVehicles() && store) { - for (SUMOVehicle* foe : foeDW->myTrains) { - MSRailSignal::blockingVehicles().push_back(foe); - } - MSRailSignal::blockingDriveWays().push_back(foeDW); - } - for (const SUMOVehicle* foe : foeDW->myTrains) { - occupied.push_back(const_cast(foe->getEdge())); - MSEdge* bidi = const_cast(foe->getEdge()->getBidiEdge()); - if (bidi != nullptr) { - occupied.push_back(bidi); + bool useSiding = canUseSiding(ego, foeDW); + if (ego->isSelected()) { + auto it = mySidings.find(foeDW); + int numSidings = 0; + if (it != mySidings.end()) { + numSidings = it->second.size(); } - /// @todo: if foe occupies more than one edge we should add all of them to the occupied vector + std::cout << SIMTIME << " " << getID() << " ego=" << ego->getID() << " foeDW=" << foeDW->getID() << " myFoes=" << toString(myFoes) << " useSiding=" << useSiding << " numSidings=" << numSidings << "\n"; } - bool useSiding = canUseSiding(ego, foeDW); if (useSiding) { //std::cout << SIMTIME << " " << getID() << " ego=" << ego->getID() << " foeDW=" << foeDW->getID() << " myFoes=" << toString(myFoes) << "\n"; continue; } else { + if (MSRailSignal::storeVehicles() && store) { + for (SUMOVehicle* foe : foeDW->myTrains) { + MSRailSignal::blockingVehicles().push_back(foe); + } + MSRailSignal::blockingDriveWays().push_back(foeDW); + } + for (const SUMOVehicle* foe : foeDW->myTrains) { + occupied.push_back(const_cast(foe->getEdge())); + MSEdge* bidi = const_cast(foe->getEdge()->getBidiEdge()); + if (bidi != nullptr) { + occupied.push_back(bidi); + } + /// @todo: if foe occupies more than one edge we should add all of them to the occupied vector + } return true; } } else if (foeDW != this && isDepartDriveway() && !foeDW->isDepartDriveway()) { @@ -963,7 +992,7 @@ MSDriveWay::buildRoute(const MSLink* origin, double length, //myProtectingSwitches.push_back(ili.viaLink); const MSEdge* const bidiNext = bidi->getNextNormal(); myCoreSize = (int)myRoute.size(); - if (MSRailSignalControl::getInstance().getUsedEdges().count(bidiNext) == 0) { + if (MSRailSignalControl::getInstance().getUsedEdges().count(bidiNext) == 0 && false) { #ifdef DEBUG_DRIVEWAY_BUILDROUTE if (gDebugFlag4) { std::cout << " abort: found protecting switch " << ili.viaLink->getDescription() << "\n"; @@ -1669,7 +1698,9 @@ MSDriveWay::buildSubFoe(MSDriveWay* foe, bool movingBlock) { #ifdef DEBUG_BUILD_SUBDRIVEWAY std::cout << SIMTIME << " buildSubFoe dw=" << getID() << " foe=" << foe->getID() << " failed\n"; #endif +#ifdef SUBDRIVEWAY_WARN_NOCONFLICT WRITE_WARNINGF("No point of conflict found between driveway '%' and driveway '%' when creating sub-driveway", getID(), foe->getID()); +#endif } return false; } diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h index 6ef7659cbf36..f81e727e4d16 100644 --- a/src/microsim/traffic_lights/MSDriveWay.h +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -292,6 +292,8 @@ class MSDriveWay : public MSMoveReminder, public Named { bool canUseSiding(const SUMOVehicle* ego, const MSDriveWay* foe) const; + bool isFoeOrSubFoe(const MSDriveWay* foe) const; + void cleanupPointersToSelf(const std::vector others); /// @brief return logicID_linkIndex From aafbbd9b23b0f97628ef9e9de9e85658d93b8db0 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 24 Sep 2024 21:27:44 +0200 Subject: [PATCH 227/334] patching expected results refs #21, #7578 --- .../alternativeRoute/railsignalblocks.sumo | 58 ++-- .../railsignalblocks.sumo | 9 +- .../railsignalblocks.sumo | 9 +- .../insertion_at_signal/railsignalblocks.sumo | 9 +- .../stopped_at_signal/railsignalblocks.sumo | 22 +- .../stopped_at_signal2/railsignalblocks.sumo | 9 +- .../bugs/ticket12858/railsignalblocks.sumo | 11 +- .../bugs/ticket12873/railsignalblocks.sumo | 23 +- .../bugs/ticket7563/railsignalblocks.sumo | 16 +- .../crossing_tracks/railsignalblocks.sumo | 9 +- .../rail/interlocking/railsignalblocks.sumo | 11 +- .../circle_bidi/railsignalblocks.sumo | 9 +- .../constraints/bidi/railsignalblocks.sumo | 16 +- .../deadlock_insertion/railsignalblocks.sumo | 7 +- .../driveway_variants/railsignalblocks.sumo | 16 +- .../halting_conflict/railsignalblocks.sumo | 11 +- .../indirect_guard/railsignalblocks.sumo | 11 +- .../railsignalblocks.sumo | 16 +- .../railsignalblocks.sumo | 18 +- .../railsignalblocks.sumo | 25 +- .../parking_insertion/railsignalblocks.sumo | 9 +- .../route_as_additional/railsignalblocks.sumo | 9 +- .../sidingShort_deadlock/errors.sumo | 2 - .../railsignalblocks.sumo | 73 ++--- .../sidingShort_deadlock/tripinfos.sumo | 6 +- .../siding_both_ways/railsignalblocks.sumo | 46 +-- .../siding_both_ways/tripinfos.sumo | 4 +- .../siding_both_ways2/tripinfos.sumo | 6 +- .../rail_signal/siding_both_ways3/errors.sumo | 2 - .../siding_both_ways3/tripinfos.sumo | 6 +- .../rail_signal/siding_both_ways4/errors.sumo | 4 - .../siding_both_ways4/tripinfos.sumo | 6 +- .../railsignalblocks.sumo | 46 +-- .../siding_both_ways_addTrain/tripinfos.sumo | 8 +- .../siding_deadlock/railsignalblocks.sumo | 114 +++++--- .../rail_signal/siding_noSignal/errors.sumo | 4 - .../siding_noSignal/railsignalblocks.sumo | 62 +--- .../siding_noSignal/tripinfos.sumo | 6 +- .../rail_signal/siding_noSignal2/errors.sumo | 4 - .../siding_noSignal2/railsignalblocks.sumo | 38 +-- .../siding_noSignal2/tripinfos.sumo | 6 +- .../update_driveways/railsignalblocks.sumo | 18 +- .../update_driveways/railsignalvehs.sumo | 4 +- .../railsignalblocks.sumo | 22 +- .../railsignalblocks.sumo | 48 ++-- .../routes_cross_twice/railsignalblocks.sumo | 4 +- tests/sumo/rail/tramwayLoop/basic/output.sumo | 24 +- .../rail/tramwayLoop/basic/stopinfos.sumo | 50 ++-- .../rail/tramwayLoop/basic/tripinfos.sumo | 18 +- .../rail/tramwayLoop/basic/vehroutes.sumo | 272 +++++++++++------- .../track_closed/railsignalblocks.sumo | 220 ++++---------- .../two_passing_loops/railsignalblocks.sumo | 30 +- .../two_passing_loops2/railsignalblocks.sumo | 30 +- 53 files changed, 764 insertions(+), 752 deletions(-) diff --git a/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo b/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo index 971d9b90a46c..54042c443783 100644 --- a/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo +++ b/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - - + + diff --git a/tests/sumo/rail/rail_signal/siding_both_ways/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/siding_both_ways/railsignalblocks.sumo index 4526425c563a..820ac2ff84f0 100644 --- a/tests/sumo/rail/rail_signal/siding_both_ways/railsignalblocks.sumo +++ b/tests/sumo/rail/rail_signal/siding_both_ways/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - - + + diff --git a/tests/sumo/rail/rail_signal/siding_noSignal2/errors.sumo b/tests/sumo/rail/rail_signal/siding_noSignal2/errors.sumo index 574c1c66e3a5..e69de29bb2d1 100644 --- a/tests/sumo/rail/rail_signal/siding_noSignal2/errors.sumo +++ b/tests/sumo/rail/rail_signal/siding_noSignal2/errors.sumo @@ -1,4 +0,0 @@ -Warning: Teleporting vehicle 't3'; waited too long (yield), lane='-g_0', time=338.00. -Warning: Teleporting vehicle 't2'; waited too long (yield), lane='a_0', time=338.00. -Warning: Vehicle 't2' ends teleporting on edge 'b', time=338.00. -Warning: Vehicle 't3' ends teleporting on edge '-f', time=346.00. diff --git a/tests/sumo/rail/rail_signal/siding_noSignal2/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/siding_noSignal2/railsignalblocks.sumo index 639c7998a5a8..9312bde5e893 100644 --- a/tests/sumo/rail/rail_signal/siding_noSignal2/railsignalblocks.sumo +++ b/tests/sumo/rail/rail_signal/siding_noSignal2/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - - + + diff --git a/tests/sumo/rail/rail_signal/update_driveways/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/update_driveways/railsignalblocks.sumo index 9a5d0c471f01..e2475a6a6ec2 100644 --- a/tests/sumo/rail/rail_signal/update_driveways/railsignalblocks.sumo +++ b/tests/sumo/rail/rail_signal/update_driveways/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - - + + diff --git a/tests/sumo/rail/alternativeRoute/vehroutes.sumo b/tests/sumo/rail/alternativeRoute/vehroutes.sumo index 4d9616fc8ea1..aeb740f71063 100644 --- a/tests/sumo/rail/alternativeRoute/vehroutes.sumo +++ b/tests/sumo/rail/alternativeRoute/vehroutes.sumo @@ -1,6 +1,6 @@ - - + - + diff --git a/tests/sumo/rail/bidi_conflict_insertion/railsignalblocks.sumo b/tests/sumo/rail/bidi_conflict_insertion/railsignalblocks.sumo index 0b5b33afeaf6..895ada844b85 100644 --- a/tests/sumo/rail/bidi_conflict_insertion/railsignalblocks.sumo +++ b/tests/sumo/rail/bidi_conflict_insertion/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - - + + diff --git a/tests/sumo/rail/portion_working/join/tripinfos.sumo b/tests/sumo/rail/portion_working/join/tripinfos.sumo index 2b156754849f..ec03405b5fd9 100644 --- a/tests/sumo/rail/portion_working/join/tripinfos.sumo +++ b/tests/sumo/rail/portion_working/join/tripinfos.sumo @@ -1,11 +1,16 @@ - - - + + diff --git a/tests/sumo/rail/portion_working/join_RB425/railsignalblocks.sumo b/tests/sumo/rail/portion_working/join_RB425/railsignalblocks.sumo index d1e8e02358b0..374a9690877a 100644 --- a/tests/sumo/rail/portion_working/join_RB425/railsignalblocks.sumo +++ b/tests/sumo/rail/portion_working/join_RB425/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - + diff --git a/tests/sumo/rail/portion_working/join_RB425/tripinfos.sumo b/tests/sumo/rail/portion_working/join_RB425/tripinfos.sumo index 9001a7e36c94..97ba21090b85 100644 --- a/tests/sumo/rail/portion_working/join_RB425/tripinfos.sumo +++ b/tests/sumo/rail/portion_working/join_RB425/tripinfos.sumo @@ -1,11 +1,16 @@ - - + diff --git a/tests/sumo/rail/portion_working/join_front/railsignalblocks.sumo b/tests/sumo/rail/portion_working/join_front/railsignalblocks.sumo index b802be32806f..dccfd8303737 100644 --- a/tests/sumo/rail/portion_working/join_front/railsignalblocks.sumo +++ b/tests/sumo/rail/portion_working/join_front/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - - + + diff --git a/tests/sumo/rail/portion_working/join_front_route_problem/tripinfos.sumo b/tests/sumo/rail/portion_working/join_front_route_problem/tripinfos.sumo index 693372032180..943ecc9958b7 100644 --- a/tests/sumo/rail/portion_working/join_front_route_problem/tripinfos.sumo +++ b/tests/sumo/rail/portion_working/join_front_route_problem/tripinfos.sumo @@ -1,6 +1,6 @@ - - - + + diff --git a/tests/sumo/rail/portion_working/transportables/join_containers/railsignalblocks.sumo b/tests/sumo/rail/portion_working/transportables/join_containers/railsignalblocks.sumo index d1e8e02358b0..374a9690877a 100644 --- a/tests/sumo/rail/portion_working/transportables/join_containers/railsignalblocks.sumo +++ b/tests/sumo/rail/portion_working/transportables/join_containers/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - - + + - + - + - - + + - + diff --git a/tests/sumo/rail/portion_working/transportables/join_persons/railsignalblocks.sumo b/tests/sumo/rail/portion_working/transportables/join_persons/railsignalblocks.sumo index d1e8e02358b0..374a9690877a 100644 --- a/tests/sumo/rail/portion_working/transportables/join_persons/railsignalblocks.sumo +++ b/tests/sumo/rail/portion_working/transportables/join_persons/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - - + + - + - + - - + + - + From 66ab900566b69d94620a8ae1575a7d19bbb535dc Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 25 Sep 2024 16:04:03 +0200 Subject: [PATCH 234/334] revised code for identifying switches. Adding upstream flank search but only up to the first switch of any kind. refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 116 ++++++++++++--------- src/microsim/traffic_lights/MSDriveWay.h | 5 +- 2 files changed, 66 insertions(+), 55 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index ce85e91e015b..5c750df9a564 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -1044,7 +1044,7 @@ MSDriveWay::buildRoute(const MSLink* origin, double length, bool MSDriveWay::isSwitch(const MSLink* link) { for (const MSLink* other : link->getLaneBefore()->getNormalPredecessorLane()->getLinkCont()) { - if (other != link && !other->isTurnaround()) { + if (other->getLane() != link->getLane() && !other->isTurnaround()) { return true; } } @@ -1053,6 +1053,14 @@ MSDriveWay::isSwitch(const MSLink* link) { return true; } } + const MSLane* bidi = link->getLane()->getBidiLane(); + if (bidi != nullptr) { + for (const MSLink* other : bidi->getLinkCont()) { + if (other->getLane() != link->getLaneBefore()->getNormalPredecessorLane()->getBidiLane() && !other->isTurnaround()) { + return true; + } + } + } return false; } @@ -1137,23 +1145,57 @@ MSDriveWay::checkCrossingFlanks(MSLink* dwLink, const LaneVisitedMap& visited, s } void -MSDriveWay::findFlankProtection(MSLink* link, double length, LaneVisitedMap& visited, MSLink* origLink, std::vector& flank) { +MSDriveWay::findFlankProtection(MSLink* link, MSLink* origLink, std::vector& flank) { #ifdef DEBUG_CHECK_FLANKS - std::cout << " findFlankProtection link=" << link->getDescription() << " length=" << length << " origLink=" << origLink->getDescription() << "\n"; + std::cout << " findFlankProtection link=" << link->getDescription() << " origLink=" << origLink->getDescription() << "\n"; #endif - if (link->getTLLogic() != nullptr) { + if (link->getCorrespondingEntryLink()->getTLLogic() != nullptr) { + MSLink* entry = const_cast(link->getCorrespondingEntryLink()); // guarded by signal #ifdef DEBUG_CHECK_FLANKS - std::cout << " flank guarded by " << link->getTLLogic()->getID() << "\n"; + std::cout << " flank guarded by " << entry->getTLLogic()->getID() << "\n"; #endif // @note, technically it's enough to collect links from foe driveways // but this also adds "unused" conflict links which may aid comprehension - myConflictLinks.push_back(link); - addFoes(link); + myConflictLinks.push_back(entry); + addFoes(entry); + + } else if (isSwitch(link)) { + auto it = mySwitchDriveWays.find(link); + if (it != mySwitchDriveWays.end()) { +#ifdef DEBUG_ADD_FOES + std::cout << "driveway " << myID << " addSwitchFoes for link " << link->getDescription() << "\n"; +#endif + for (MSDriveWay* foe : it->second) { + if (foe != this && (flankConflict(*foe) || foe->flankConflict(*this) || crossingConflict(*foe) || foe->crossingConflict(*this))) { +#ifdef DEBUG_ADD_FOES + std::cout << " foe=" << foe->myID + << " fc1=" << flankConflict(*foe) << " fc2=" << foe->flankConflict(*this) + << " cc1=" << crossingConflict(*foe) << " cc2=" << foe->crossingConflict(*this) << "\n"; +#endif + myFoes.push_back(foe); + } else { +#ifdef DEBUG_ADD_FOES + std::cout << " cand=" << foe->myID + << " fc1=" << flankConflict(*foe) << " fc2=" << foe->flankConflict(*this) + << " cc1=" << crossingConflict(*foe) << " cc2=" << foe->crossingConflict(*this) << "\n"; +#endif + } + } + } + } else { - addSwitchFoes(link); + const MSLane* lane = link->getLaneBefore(); + MSLink* cand = nullptr; + for (auto ili : lane->getIncomingLanes()) { + if (!ili.viaLink->isTurnaround()) { + cand = ili.viaLink; + } + } + if (cand != nullptr) { + findFlankProtection(cand, origLink, flank); + } } - myMaxFlankLength = MAX2(myMaxFlankLength, length); } @@ -1207,7 +1249,7 @@ MSDriveWay::buildDriveWay(const std::string& id, const MSLink* link, MSRouteIter std::cout << " fsLink=" << fsLink->getDescription() << "\n"; } #endif - dw->findFlankProtection(fsLink, 0, visited, fsLink, dw->myFlank); + dw->findFlankProtection(fsLink, fsLink, dw->myFlank); } std::set flankSwitchesBidiExtended; dw->checkFlanks(link, dw->myBidiExtended, visited, false, flankSwitchesBidiExtended); @@ -1217,7 +1259,7 @@ MSDriveWay::buildDriveWay(const std::string& id, const MSLink* link, MSRouteIter std::cout << " fsLinkExtended=" << link->getDescription() << "\n"; } #endif - dw->findFlankProtection(link, 0, visited, link, dw->myBidiExtended); + dw->findFlankProtection(link, link, dw->myBidiExtended); } MSRailSignal* rs = link ? const_cast(static_cast(link->getTLLogic())) : nullptr; const bool movingBlock = (rs && rs->isMovingBlock()) || (!rs && OptionsCont::getOptions().getBool("railsignal-moving-block")); @@ -1336,19 +1378,18 @@ MSDriveWay::getClickableTLLinkID(const MSLink* link) { std::string MSDriveWay::formatVisitedMap(const LaneVisitedMap& visited) { - //std::vector lanes(visited.size(), nullptr); - //for (auto item : visited) { - // lanes[item.second] = item.first; - //} - //for (auto it = lanes.begin(); it != lanes.end();) { - // if (*it == nullptr) { - // it = lanes.erase(it); - // } else { - // it++; - // } - //} - //return toString(lanes); - return "Placeholder"; + std::vector lanes(visited.size(), nullptr); + for (auto item : visited) { + lanes[item.second] = item.first; + } + for (auto it = lanes.begin(); it != lanes.end();) { + if (*it == nullptr) { + it = lanes.erase(it); + } else { + it++; + } + } + return toString(lanes); } @@ -1420,33 +1461,6 @@ MSDriveWay::addFoes(const MSLink* link) { } -void -MSDriveWay::addSwitchFoes(const MSLink* link) { -#ifdef DEBUG_ADD_FOES - std::cout << "driveway " << myID << " addSwitchFoes for link " << link->getDescription() << "\n"; -#endif - auto it = mySwitchDriveWays.find(link); - if (it != mySwitchDriveWays.end()) { - for (MSDriveWay* foe : it->second) { - if (foe != this && (flankConflict(*foe) || foe->flankConflict(*this) || crossingConflict(*foe) || foe->crossingConflict(*this))) { -#ifdef DEBUG_ADD_FOES - std::cout << " foe=" << foe->myID - << " fc1=" << flankConflict(*foe) << " fc2=" << foe->flankConflict(*this) - << " cc1=" << crossingConflict(*foe) << " cc2=" << foe->crossingConflict(*this) << "\n"; -#endif - myFoes.push_back(foe); - } else { -#ifdef DEBUG_ADD_FOES - std::cout << " cand=" << foe->myID - << " fc1=" << flankConflict(*foe) << " fc2=" << foe->flankConflict(*this) - << " cc1=" << crossingConflict(*foe) << " cc2=" << foe->crossingConflict(*this) << "\n"; -#endif - } - } - } -} - - void MSDriveWay::addBidiFoes(const MSRailSignal* ownSignal, bool extended) { #ifdef DEBUG_ADD_FOES diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h index 1319a7b32752..d10062a502b4 100644 --- a/src/microsim/traffic_lights/MSDriveWay.h +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -243,7 +243,7 @@ class MSDriveWay : public MSMoveReminder, public Named { /* @brief find upstream protection from the given link * @param[out] flank: the stored flank lanes */ - void findFlankProtection(MSLink* link, double length, LaneVisitedMap& visited, MSLink* origLink, std::vector& flank); + void findFlankProtection(MSLink* link, MSLink* origLink, std::vector& flank); /// @brief add all driveWays that start at the given link as foes void addFoes(const MSLink* link); @@ -251,9 +251,6 @@ class MSDriveWay : public MSMoveReminder, public Named { /// @brief add foe and update sidings void addFoeCheckSiding(MSDriveWay* foe); - /// @brief add all driveWays that pass the given link as foes - void addSwitchFoes(const MSLink* link); - /// @brief derive foe driveways based on myBidi or myBidiExtended void addBidiFoes(const MSRailSignal* ownSignal, bool extended); From d2a552c3abe59f2b04d2817b3517d156b2021edc Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 25 Sep 2024 16:04:08 +0200 Subject: [PATCH 235/334] patching expected results refs #21, #7578 --- .../insertion_at_signal/railsignalblocks.sumo | 6 ++-- .../railsignalblocks.sumo | 15 ++++------ .../merge_check_flank_switch/tls_state.sumo | 20 ++++++------- .../railsignalblocks.sumo | 19 +++++-------- .../merge_check_flank_switch2/tls_state.sumo | 20 ++++++------- .../stopped_at_signal/railsignalblocks.sumo | 4 +-- .../stopped_at_signal2/railsignalblocks.sumo | 6 ++-- .../bugs/ticket11440/railsignalblocks.sumo | 4 +-- .../bugs/ticket12868/railsignalblocks.sumo | 4 +-- .../bugs/ticket7563/railsignalblocks.sumo | 2 +- .../default_rail_type/railsignalblocks.sumo | 6 ++-- .../rail/headonconflict/railsignalblocks.sumo | 6 ++-- .../rail/interlocking/railsignalblocks.sumo | 12 ++++---- .../guard_insertion/railsignalblocks.sumo | 6 ++-- .../halting_conflict/railsignalblocks.sumo | 2 +- .../large_step_size/railsignalblocks.sumo | 4 +-- .../railsignalblocks.sumo | 12 ++++---- .../railsignalblocks.sumo | 4 +-- .../siding_both_ways2/railsignalblocks.sumo | 6 ++-- .../siding_both_ways3/railsignalblocks.sumo | 6 ++-- .../siding_both_ways4/railsignalblocks.sumo | 6 ++-- .../siding_deadlock/railsignalblocks.sumo | 6 ++-- .../small_step_size/railsignalblocks.sumo | 4 +-- .../railsignalblocks.sumo | 4 +-- .../bidiDepart_reversal/railsignalblocks.sumo | 12 ++------ .../railsignalblocks.sumo | 18 +++++------- .../railsignalblocks.sumo | 4 +-- .../tramwayLoop/basic/railsignalblocks.sumo | 4 +-- .../track_closed/railsignalblocks.sumo | 4 +-- .../two_passing_loops/railsignalblocks.sumo | 28 +++++++++---------- .../two_passing_loops2/railsignalblocks.sumo | 28 +++++++++---------- 31 files changed, 131 insertions(+), 151 deletions(-) diff --git a/tests/sumo/rail/bugs/insertion_at_signal/railsignalblocks.sumo b/tests/sumo/rail/bugs/insertion_at_signal/railsignalblocks.sumo index 44e67306a561..29f61eb5b2bc 100644 --- a/tests/sumo/rail/bugs/insertion_at_signal/railsignalblocks.sumo +++ b/tests/sumo/rail/bugs/insertion_at_signal/railsignalblocks.sumo @@ -1,6 +1,6 @@ - + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/end_within/net.net.xml b/tests/sumo/rail/rail_signal/end_within/net.net.xml new file mode 100644 index 000000000000..56d96abff9c6 --- /dev/null +++ b/tests/sumo/rail/rail_signal/end_within/net.net.xml @@ -0,0 +1,210 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/end_within/options.sumo b/tests/sumo/rail/rail_signal/end_within/options.sumo new file mode 100644 index 000000000000..aa17b0c2faa0 --- /dev/null +++ b/tests/sumo/rail/rail_signal/end_within/options.sumo @@ -0,0 +1,3 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml +--no-internal-links diff --git a/tests/sumo/rail/rail_signal/end_within/output.sumo b/tests/sumo/rail/rail_signal/end_within/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/end_within/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/end_within/railsignalblocks.sumo new file mode 100644 index 000000000000..4a7de475db22 --- /dev/null +++ b/tests/sumo/rail/rail_signal/end_within/railsignalblocks.sumo @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/end_within/tripinfos.sumo b/tests/sumo/rail/rail_signal/end_within/tripinfos.sumo new file mode 100644 index 000000000000..702821529860 --- /dev/null +++ b/tests/sumo/rail/rail_signal/end_within/tripinfos.sumo @@ -0,0 +1,44 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/testsuite.sumo b/tests/sumo/rail/rail_signal/testsuite.sumo index 822487c4ec45..ee42193279c5 100644 --- a/tests/sumo/rail/rail_signal/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/testsuite.sumo @@ -120,6 +120,9 @@ parking_insertion # one route ends within the block and another train starts within the block end_depart_within +# test flank search beyond route end +end_within + # a driveway is updated after being used update_driveways From 4a2f0e674e45e06ba69df2dbfa5ff62a0eb66f1d Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 25 Sep 2024 23:59:19 +0200 Subject: [PATCH 237/334] adding lost switch approach refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 69 +++++++++++++--------- src/microsim/traffic_lights/MSDriveWay.h | 2 + 2 files changed, 44 insertions(+), 27 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 5c750df9a564..bc5d7465c222 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -1159,42 +1159,57 @@ MSDriveWay::findFlankProtection(MSLink* link, MSLink* origLink, std::vectorgetLaneBefore(); + std::vector predLinks; + for (auto ili : lane->getIncomingLanes()) { + if (!ili.viaLink->isTurnaround()) { + predLinks.push_back(ili.viaLink); + } + } + if (predLinks.size() > 1) { + // this is a switch +#ifdef DEBUG_ADD_FOES + std::cout << " predecessors of " << link->getDescription() << " isSwitch\n"; +#endif + for (MSLink* pred : predLinks) { + addSwitchFoes(pred); + } + } else if (predLinks.size() == 1) { + if (isSwitch(link)) { + addSwitchFoes(link); + } else { + // continue upstream via single predecessor + findFlankProtection(predLinks.front(), origLink, flank); + } + } + } +} - } else if (isSwitch(link)) { - auto it = mySwitchDriveWays.find(link); - if (it != mySwitchDriveWays.end()) { + +void +MSDriveWay::addSwitchFoes(MSLink* link) { + auto it = mySwitchDriveWays.find(link); + if (it != mySwitchDriveWays.end()) { #ifdef DEBUG_ADD_FOES - std::cout << "driveway " << myID << " addSwitchFoes for link " << link->getDescription() << "\n"; + std::cout << " driveway " << myID << " addSwitchFoes for link " << link->getDescription() << "\n"; #endif - for (MSDriveWay* foe : it->second) { - if (foe != this && (flankConflict(*foe) || foe->flankConflict(*this) || crossingConflict(*foe) || foe->crossingConflict(*this))) { + for (MSDriveWay* foe : it->second) { + if (foe != this && (flankConflict(*foe) || foe->flankConflict(*this) || crossingConflict(*foe) || foe->crossingConflict(*this))) { #ifdef DEBUG_ADD_FOES - std::cout << " foe=" << foe->myID - << " fc1=" << flankConflict(*foe) << " fc2=" << foe->flankConflict(*this) - << " cc1=" << crossingConflict(*foe) << " cc2=" << foe->crossingConflict(*this) << "\n"; + std::cout << " foe=" << foe->myID + << " fc1=" << flankConflict(*foe) << " fc2=" << foe->flankConflict(*this) + << " cc1=" << crossingConflict(*foe) << " cc2=" << foe->crossingConflict(*this) << "\n"; #endif - myFoes.push_back(foe); - } else { + myFoes.push_back(foe); + } else { #ifdef DEBUG_ADD_FOES - std::cout << " cand=" << foe->myID - << " fc1=" << flankConflict(*foe) << " fc2=" << foe->flankConflict(*this) - << " cc1=" << crossingConflict(*foe) << " cc2=" << foe->crossingConflict(*this) << "\n"; + std::cout << " cand=" << foe->myID + << " fc1=" << flankConflict(*foe) << " fc2=" << foe->flankConflict(*this) + << " cc1=" << crossingConflict(*foe) << " cc2=" << foe->crossingConflict(*this) << "\n"; #endif - } } } - - } else { - const MSLane* lane = link->getLaneBefore(); - MSLink* cand = nullptr; - for (auto ili : lane->getIncomingLanes()) { - if (!ili.viaLink->isTurnaround()) { - cand = ili.viaLink; - } - } - if (cand != nullptr) { - findFlankProtection(cand, origLink, flank); - } } } diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h index d10062a502b4..145cfe8d35db 100644 --- a/src/microsim/traffic_lights/MSDriveWay.h +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -276,6 +276,8 @@ class MSDriveWay : public MSMoveReminder, public Named { bool isFoeOrSubFoe(const MSDriveWay* foe) const; + void addSwitchFoes(MSLink* link); + static bool hasJoin(const SUMOVehicle* ego, const SUMOVehicle* foe); static bool isSwitch(const MSLink* link); From 6a9d97ef19c1a0649a367b403c3ea09e35ec56e6 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 25 Sep 2024 23:59:24 +0200 Subject: [PATCH 238/334] patching expected results refs #21, #7578 --- .../railsignalblocks.sumo | 2 +- .../constraints/bidi/railsignalblocks.sumo | 2 +- .../deadlock_insertion/railsignalblocks.sumo | 2 +- .../rail/rail_signal/end_within/errors.sumo | 3 -- .../end_within/railsignalblocks.sumo | 30 ++++++------------- .../rail_signal/end_within/tripinfos.sumo | 4 +-- .../halting_conflict/railsignalblocks.sumo | 2 +- .../indirect_guard/railsignalblocks.sumo | 2 +- .../railsignalblocks.sumo | 2 +- .../railsignalblocks.sumo | 2 +- .../railsignalblocks.sumo | 2 +- .../railsignalblocks.sumo | 2 +- .../railsignalblocks.sumo | 2 +- .../insertionOrder/railsignalblocks.sumo | 2 +- .../parking/railsignalblocks.sumo | 2 +- .../signal_on_next_edge/railsignalblocks.sumo | 2 +- .../wait_for_one/railsignalblocks.sumo | 2 +- .../railsignalblocks.sumo | 2 +- .../railsignalblocks.sumo | 2 +- .../parking_insertion/railsignalblocks.sumo | 2 +- .../railsignalblocks.sumo | 2 +- .../waiting_time_bottom/railsignalblocks.sumo | 2 +- .../waiting_time_top/railsignalblocks.sumo | 2 +- .../route_as_additional/railsignalblocks.sumo | 2 +- .../railsignalblocks.sumo | 2 +- .../siding_both_ways2/railsignalblocks.sumo | 2 +- .../siding_both_ways2/tripinfos.sumo | 2 +- .../siding_both_ways3/railsignalblocks.sumo | 2 +- .../siding_both_ways3/tripinfos.sumo | 2 +- .../siding_both_ways4/railsignalblocks.sumo | 2 +- .../siding_both_ways4/tripinfos.sumo | 2 +- .../siding_deadlock/railsignalblocks.sumo | 2 +- .../siding_noSignal/railsignalblocks.sumo | 2 +- .../siding_noSignal2/railsignalblocks.sumo | 2 +- .../tramwayLoop/basic/railsignalblocks.sumo | 2 +- .../track_closed/railsignalblocks.sumo | 2 +- 36 files changed, 44 insertions(+), 59 deletions(-) diff --git a/tests/sumo/rail/portion_working/join_front_route_invalid/railsignalblocks.sumo b/tests/sumo/rail/portion_working/join_front_route_invalid/railsignalblocks.sumo index 3bac5223a52a..dbde832c316f 100644 --- a/tests/sumo/rail/portion_working/join_front_route_invalid/railsignalblocks.sumo +++ b/tests/sumo/rail/portion_working/join_front_route_invalid/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - + diff --git a/tests/sumo/rail/rail_signal/halting_conflict/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/halting_conflict/railsignalblocks.sumo index bc9777300491..1e71b50d409d 100644 --- a/tests/sumo/rail/rail_signal/halting_conflict/railsignalblocks.sumo +++ b/tests/sumo/rail/rail_signal/halting_conflict/railsignalblocks.sumo @@ -1,6 +1,6 @@ - + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_occupied_advance/net.net.xml b/tests/sumo/rail/rail_signal/siding_occupied_advance/net.net.xml new file mode 100644 index 000000000000..aeb39bf12beb --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_occupied_advance/net.net.xml @@ -0,0 +1,302 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_occupied_advance/options.sumo b/tests/sumo/rail/rail_signal/siding_occupied_advance/options.sumo new file mode 100644 index 000000000000..aca2e8d18e45 --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_occupied_advance/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/rail_signal/siding_occupied_advance/output.sumo b/tests/sumo/rail/rail_signal/siding_occupied_advance/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/siding_occupied_advance/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/siding_occupied_advance/railsignalblocks.sumo new file mode 100644 index 000000000000..3f3a127763fb --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_occupied_advance/railsignalblocks.sumo @@ -0,0 +1,232 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/siding_occupied_advance/tripinfos.sumo b/tests/sumo/rail/rail_signal/siding_occupied_advance/tripinfos.sumo new file mode 100644 index 000000000000..c8478b58e71c --- /dev/null +++ b/tests/sumo/rail/rail_signal/siding_occupied_advance/tripinfos.sumo @@ -0,0 +1,44 @@ + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/testsuite.sumo b/tests/sumo/rail/rail_signal/testsuite.sumo index ee42193279c5..74a153d7395e 100644 --- a/tests/sumo/rail/rail_signal/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/testsuite.sumo @@ -149,6 +149,9 @@ siding_both_ways4 # siding cannot be used because it is already occupied siding_deadlock +# driveway should be usable despite occupied siding if the other side is still usable +siding_occupied_advance + # siding cannot be used because the trains are too long sidingShort_deadlock From f913c51078d8072ee7bf1be3bc4b358cb64d800e Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 26 Sep 2024 13:55:12 +0200 Subject: [PATCH 240/334] now considering dynamics blockage of sidings. refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 49 +++++++++++++++++++--- src/microsim/traffic_lights/MSDriveWay.h | 2 +- 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index bc5d7465c222..197d0e6cd6bf 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -274,7 +274,7 @@ bool MSDriveWay::hasLinkConflict(const Approaching& veh, const MSLink* foeLink) const { #ifdef DEBUG_SIGNALSTATE_PRIORITY if (gDebugFlag4) { - std::cout << " checkLinkConflict foeLink=" << getTLLinkID(foeLink) << "\n"; + std::cout << " checkLinkConflict foeLink=" << getTLLinkID(foeLink) << " ego=" << Named::getIDSecure(veh.first) << "\n"; } #endif if (foeLink->getApproaching().size() > 0) { @@ -284,6 +284,9 @@ MSDriveWay::hasLinkConflict(const Approaching& veh, const MSLink* foeLink) const std::cout << " approaching foe=" << foe.first->getID() << "\n"; } #endif + if (foe.first == veh.first) { + return false; + } const MSTrafficLightLogic* foeTLL = foeLink->getTLLogic(); assert(foeTLL != nullptr); const MSRailSignal* constFoeRS = dynamic_cast(foeTLL); @@ -463,7 +466,7 @@ MSDriveWay::foeDriveWayOccupied(bool store, const SUMOVehicle* ego, MSEdgeVector if (!foeDW->myTrains.empty()) { #ifdef DEBUG_SIGNALSTATE if (gDebugFlag4 || DEBUG_COND_DW) { - std::cout << SIMTIME << " foeDriveWay " << foeDW->getID() << " occupied ego=" << Named::getIDSecure(ego) << " foeVeh=" << toString(foeDW->myTrains) << "\n"; + std::cout << SIMTIME << " " << getID() << " foeDriveWay " << foeDW->getID() << " occupied ego=" << Named::getIDSecure(ego) << " foeVeh=" << toString(foeDW->myTrains) << "\n"; } #endif if (foeDW->myTrains.size() == 1) { @@ -587,12 +590,47 @@ MSDriveWay::hasJoin(const SUMOVehicle* ego, const SUMOVehicle* foe) { bool -MSDriveWay::canUseSiding(const SUMOVehicle* ego, const MSDriveWay* foe) const { +MSDriveWay::canUseSiding(const SUMOVehicle* ego, const MSDriveWay* foe, bool recurse) const { auto it = mySidings.find(foe); if (it != mySidings.end()) { for (auto siding : it->second) { + // assume siding is usuable when computing state for unapproached signal (ego == nullptr) if (ego == nullptr || siding.length >= ego->getLength()) { - // assume siding is usuable when computing state for unapproached signal + // if the siding is already "reserved" by another vehicle we cannot use it here + const MSEdge* sidingEnd = myRoute[siding.end]; + for (MSDriveWay* sidingApproach : myEndingDriveways[sidingEnd]) { + if (!sidingApproach->myTrains.empty()) { + // possibly the foe vehicle can use the other part of the siding + if (recurse) { + const SUMOVehicle* foeVeh = nullptr; + if (!foe->myTrains.empty()) { + foeVeh = *foe->myTrains.begin(); + } else if (foe->myOrigin != nullptr && foe->myOrigin->getApproaching().size() > 0) { + foeVeh = foe->myOrigin->getClosest().first; + } + if (foeVeh == nullptr) { + WRITE_WARNINGF("Invalid call to canUseSiding dw=% foe=% ego=% time=%", getID(), foe->getID(), Named::getIDSecure(ego), time2string(SIMSTEP)); + continue; + } + if (foe->canUseSiding(foeVeh, this, false)) { + continue; + } + } + // possibly the foe vehicle + // @todo: in principle it might still be possible to continue if vehicle that approaches the siding can safely leave the situation +#ifdef DEBUG_SIGNALSTATE + if (gDebugFlag4 || DEBUG_COND_DW) { + std::cout << SIMTIME << " " << getID() << " ego=" << Named::getIDSecure(ego) << " foe=" << foe->getID() + << " foeVeh=" << toString(foe->myTrains) + << " sidingEnd=" << sidingEnd->getID() << " sidingApproach=" << sidingApproach->getID() << " approaching=" << toString(sidingApproach->myTrains) << "\n"; + } +#endif + return false; + } + } + //std::cout << SIMTIME << " " << getID() << " ego=" << Named::getIDSecure(ego) << " foe=" << foe->getID() + // << " foeVeh=" << toString(foe->myTrains) + // << " sidingEnd=" << sidingEnd->getID() << "usable\n"; return true; } } @@ -1749,7 +1787,8 @@ MSDriveWay::addFoeCheckSiding(MSDriveWay* foe) { #ifdef DEBUG_BUILD_SIDINGS std::cout << "endSiding " << getID() << " foe=" << foe->getID() << " i=" << i << " curBidi=" << Named::getIDSecure(cur->getBidiEdge()) << " length=" << length << "\n"; #endif - mySidings[foe].push_back(Siding(i + 1, start, length)); + auto& foeSidings = mySidings[foe]; + foeSidings.insert(foeSidings.begin(), Siding(i + 1, start, length)); start = -1; length = 0; foeSearchBeg = itFind; diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h index 145cfe8d35db..8e70e07b7f5c 100644 --- a/src/microsim/traffic_lights/MSDriveWay.h +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -272,7 +272,7 @@ class MSDriveWay : public MSMoveReminder, public Named { return myOrigin == nullptr; }; - bool canUseSiding(const SUMOVehicle* ego, const MSDriveWay* foe) const; + bool canUseSiding(const SUMOVehicle* ego, const MSDriveWay* foe, bool recurse=true) const; bool isFoeOrSubFoe(const MSDriveWay* foe) const; From 3115dd4bfd3e0cb528a204849bcc69ae173d0f4c Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 26 Sep 2024 13:55:18 +0200 Subject: [PATCH 241/334] patching expected results refs #21, #7578 --- .../rail_signal/siding_deadlock/errors.sumo | 4 - .../siding_deadlock/railsignalblocks.sumo | 88 ++----------------- .../siding_deadlock/tripinfos.sumo | 10 +-- .../railsignalblocks.sumo | 4 +- 4 files changed, 12 insertions(+), 94 deletions(-) diff --git a/tests/sumo/rail/rail_signal/siding_deadlock/errors.sumo b/tests/sumo/rail/rail_signal/siding_deadlock/errors.sumo index 4875df5f45eb..e69de29bb2d1 100644 --- a/tests/sumo/rail/rail_signal/siding_deadlock/errors.sumo +++ b/tests/sumo/rail/rail_signal/siding_deadlock/errors.sumo @@ -1,4 +0,0 @@ -Warning: Teleporting vehicle 't3'; waited too long (yield), lane='-g_0', time=330.00. -Warning: Teleporting vehicle 't2'; waited too long (yield), lane='a_0', time=330.00. -Warning: Vehicle 't2' ends teleporting on edge 'd', time=350.00. -Warning: Vehicle 't3' ends teleporting on edge '-d2', time=350.00. diff --git a/tests/sumo/rail/rail_signal/siding_deadlock/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/siding_deadlock/railsignalblocks.sumo index 2a25b9195809..90f2d9278292 100644 --- a/tests/sumo/rail/rail_signal/siding_deadlock/railsignalblocks.sumo +++ b/tests/sumo/rail/rail_signal/siding_deadlock/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - - - - + + + + diff --git a/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/railsignalblocks.sumo b/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/railsignalblocks.sumo index f3d5b942fd4c..aaa86d964a07 100644 --- a/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/railsignalblocks.sumo +++ b/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/railsignalblocks.sumo @@ -1,6 +1,6 @@ - + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/two_double_reversals/net.net.xml b/tests/sumo/rail/reversal/two_double_reversals/net.net.xml new file mode 100644 index 000000000000..14095d10ff52 --- /dev/null +++ b/tests/sumo/rail/reversal/two_double_reversals/net.net.xml @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/two_double_reversals/options.sumo b/tests/sumo/rail/reversal/two_double_reversals/options.sumo new file mode 100644 index 000000000000..a05c625502e9 --- /dev/null +++ b/tests/sumo/rail/reversal/two_double_reversals/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml --tripinfo-output=tripinfos.xml +--railsignal-vehicle-output railsignal_vehicles.xml diff --git a/tests/sumo/rail/reversal/two_double_reversals/output.sumo b/tests/sumo/rail/reversal/two_double_reversals/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/reversal/two_double_reversals/railsignalblocks.sumo b/tests/sumo/rail/reversal/two_double_reversals/railsignalblocks.sumo new file mode 100644 index 000000000000..80f3447e2a34 --- /dev/null +++ b/tests/sumo/rail/reversal/two_double_reversals/railsignalblocks.sumo @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/two_double_reversals/railsignalvehs.sumo b/tests/sumo/rail/reversal/two_double_reversals/railsignalvehs.sumo new file mode 100644 index 000000000000..1513bb31c217 --- /dev/null +++ b/tests/sumo/rail/reversal/two_double_reversals/railsignalvehs.sumo @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/two_double_reversals/tripinfos.sumo b/tests/sumo/rail/reversal/two_double_reversals/tripinfos.sumo new file mode 100644 index 000000000000..4058f5a3c63b --- /dev/null +++ b/tests/sumo/rail/reversal/two_double_reversals/tripinfos.sumo @@ -0,0 +1,45 @@ + + + + + + + + + diff --git a/tests/sumo/rail/reversal/two_double_reversals/tripinfos.sumo.meso b/tests/sumo/rail/reversal/two_double_reversals/tripinfos.sumo.meso new file mode 100644 index 000000000000..e872986da5b1 --- /dev/null +++ b/tests/sumo/rail/reversal/two_double_reversals/tripinfos.sumo.meso @@ -0,0 +1,49 @@ + + + + + + + + From 13371ddc65e398bb847f1a7661661cdeca70cdfc Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 26 Sep 2024 23:04:38 +0200 Subject: [PATCH 245/334] no longer building subDriveWays that end with reversal. refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 29 ++++++++++++++++------ 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index a2f7b1ccfa72..edf043e9412f 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -1701,17 +1701,32 @@ MSDriveWay::buildSubFoe(MSDriveWay* foe, bool movingBlock) { return true; } } - MSDriveWay* sub = new MSDriveWay(myOrigin, getID() + "." + toString(mySubDriveWays.size())); - sub->myLane = myLane; - sub->myIsSubDriveway = true; - myLane->addMoveReminder(sub); - sub->myForward.insert(sub->myForward.begin(), myForward.begin(), myForward.begin() + subSize); - for (const MSLane* lane : sub->myForward) { + std::vector forward(myForward.begin(), myForward.begin() + subSize); + std::vector route; + for (const MSLane* lane : forward) { if (lane->isNormal()) { - sub->myRoute.push_back(&lane->getEdge()); + route.push_back(&lane->getEdge()); } } + if (myRoute.size() > route.size()) { + // route continues. make sure the subDriveway does not end with a reversal + const MSEdge* lastNormal = route.back(); + const MSEdge* nextNormal = myRoute[route.size()]; + if (lastNormal->getBidiEdge() == nextNormal) { +#ifdef DEBUG_BUILD_SUBDRIVEWAY + std::cout << SIMTIME << " abort subFoe dw=" << getID() << " foe=" << foe->getID() + << " lastNormal=" << lastNormal->getID() << " nextNormal=" << nextNormal->getID() << " endWithReversal\n"; +#endif + return false; + } + } + MSDriveWay* sub = new MSDriveWay(myOrigin, getID() + "." + toString(mySubDriveWays.size())); + sub->myLane = myLane; + sub->myIsSubDriveway = true; + sub->myForward = forward; + sub->myRoute = route; sub->myCoreSize = sub->myRoute.size(); + myLane->addMoveReminder(sub); // copy trains that are currently on this driveway (and associated entry events) for (SUMOVehicle* veh : myTrains) { From 7b7b13d25d348bad03bd48cf0c069f1f7587ed54 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 26 Sep 2024 23:04:43 +0200 Subject: [PATCH 246/334] patching expected results refs #21, #7578 --- .../railsignalblocks.sumo | 9 +++------ .../two_double_reversals/railsignalvehs.sumo | 20 ++++++++----------- .../two_double_reversals/tripinfos.sumo | 6 +++--- .../tramwayLoop/basic/railsignalblocks.sumo | 9 +++------ .../track_closed/railsignalblocks.sumo | 9 +++------ 5 files changed, 20 insertions(+), 33 deletions(-) diff --git a/tests/sumo/rail/reversal/two_double_reversals/railsignalblocks.sumo b/tests/sumo/rail/reversal/two_double_reversals/railsignalblocks.sumo index 80f3447e2a34..2788dada4b78 100644 --- a/tests/sumo/rail/reversal/two_double_reversals/railsignalblocks.sumo +++ b/tests/sumo/rail/reversal/two_double_reversals/railsignalblocks.sumo @@ -1,6 +1,6 @@ - + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reversal_after_common_block/net.net.xml b/tests/sumo/rail/reversal/reversal_after_common_block/net.net.xml new file mode 100644 index 000000000000..a905cd90d884 --- /dev/null +++ b/tests/sumo/rail/reversal/reversal_after_common_block/net.net.xml @@ -0,0 +1,295 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reversal_after_common_block/options.sumo b/tests/sumo/rail/reversal/reversal_after_common_block/options.sumo new file mode 100644 index 000000000000..a05c625502e9 --- /dev/null +++ b/tests/sumo/rail/reversal/reversal_after_common_block/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml --tripinfo-output=tripinfos.xml +--railsignal-vehicle-output railsignal_vehicles.xml diff --git a/tests/sumo/rail/reversal/reversal_after_common_block/output.sumo b/tests/sumo/rail/reversal/reversal_after_common_block/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/reversal/reversal_after_common_block/railsignalblocks.sumo b/tests/sumo/rail/reversal/reversal_after_common_block/railsignalblocks.sumo new file mode 100644 index 000000000000..2dcbaf6c482a --- /dev/null +++ b/tests/sumo/rail/reversal/reversal_after_common_block/railsignalblocks.sumo @@ -0,0 +1,304 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reversal_after_common_block/railsignalvehs.sumo b/tests/sumo/rail/reversal/reversal_after_common_block/railsignalvehs.sumo new file mode 100644 index 000000000000..83cdceb17618 --- /dev/null +++ b/tests/sumo/rail/reversal/reversal_after_common_block/railsignalvehs.sumo @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/reversal_after_common_block/tripinfos.sumo b/tests/sumo/rail/reversal/reversal_after_common_block/tripinfos.sumo new file mode 100644 index 000000000000..bc0aa183f5ae --- /dev/null +++ b/tests/sumo/rail/reversal/reversal_after_common_block/tripinfos.sumo @@ -0,0 +1,44 @@ + + + + + + + + diff --git a/tests/sumo/rail/reversal/reversal_after_common_block/tripinfos.sumo.meso b/tests/sumo/rail/reversal/reversal_after_common_block/tripinfos.sumo.meso new file mode 100644 index 000000000000..e872986da5b1 --- /dev/null +++ b/tests/sumo/rail/reversal/reversal_after_common_block/tripinfos.sumo.meso @@ -0,0 +1,49 @@ + + + + + + + + diff --git a/tests/sumo/rail/reversal/testsuite.sumo b/tests/sumo/rail/reversal/testsuite.sumo index 3123222d6224..e0ef81cbe8ad 100644 --- a/tests/sumo/rail/reversal/testsuite.sumo +++ b/tests/sumo/rail/reversal/testsuite.sumo @@ -95,3 +95,6 @@ routes_cross_twice # invalid subDriveway construction two_double_reversals + +# invalid subDriveway construction +reversal_after_common_block From a2eeb414018e77e86a98500cebf1b0540a949357 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 27 Sep 2024 13:35:31 +0200 Subject: [PATCH 249/334] added test refs #7578, #21 --- .../insertion_before_reversal3/errors.sumo | 2 + .../errors.sumo.meso | 1 + .../input_routes.rou.xml | 15 ++ .../insertion_before_reversal3/net.net.xml | 134 ++++++++++ .../insertion_before_reversal3/options.sumo | 3 + .../insertion_before_reversal3/output.sumo | 0 .../railsignalblocks.sumo | 228 ++++++++++++++++++ .../railsignalblocks.sumo.meso | 66 +++++ .../insertion_before_reversal3/stopinfos.sumo | 1 + .../railsignalblocks.sumo | 2 +- .../tripinfos.sumo | 2 +- tests/sumo/rail/reversal/testsuite.sumo | 1 + 12 files changed, 453 insertions(+), 2 deletions(-) create mode 100644 tests/sumo/rail/reversal/insertion_before_reversal3/errors.sumo create mode 100644 tests/sumo/rail/reversal/insertion_before_reversal3/errors.sumo.meso create mode 100644 tests/sumo/rail/reversal/insertion_before_reversal3/input_routes.rou.xml create mode 100644 tests/sumo/rail/reversal/insertion_before_reversal3/net.net.xml create mode 100644 tests/sumo/rail/reversal/insertion_before_reversal3/options.sumo create mode 100644 tests/sumo/rail/reversal/insertion_before_reversal3/output.sumo create mode 100644 tests/sumo/rail/reversal/insertion_before_reversal3/railsignalblocks.sumo create mode 100644 tests/sumo/rail/reversal/insertion_before_reversal3/railsignalblocks.sumo.meso create mode 100644 tests/sumo/rail/reversal/insertion_before_reversal3/stopinfos.sumo diff --git a/tests/sumo/rail/reversal/insertion_before_reversal3/errors.sumo b/tests/sumo/rail/reversal/insertion_before_reversal3/errors.sumo new file mode 100644 index 000000000000..c1e1abb66116 --- /dev/null +++ b/tests/sumo/rail/reversal/insertion_before_reversal3/errors.sumo @@ -0,0 +1,2 @@ +Warning: Teleporting vehicle 'v_0'; waited too long (yield), lane='E1_0', time=338.00. +Warning: Vehicle 'v_0' ends teleporting on edge '-E2', time=383.00. diff --git a/tests/sumo/rail/reversal/insertion_before_reversal3/errors.sumo.meso b/tests/sumo/rail/reversal/insertion_before_reversal3/errors.sumo.meso new file mode 100644 index 000000000000..7c5032aa693c --- /dev/null +++ b/tests/sumo/rail/reversal/insertion_before_reversal3/errors.sumo.meso @@ -0,0 +1 @@ +Warning: Network contains internal links which are ignored. Vehicles will 'jump' across junctions and thus underestimate route lengths and travel times. diff --git a/tests/sumo/rail/reversal/insertion_before_reversal3/input_routes.rou.xml b/tests/sumo/rail/reversal/insertion_before_reversal3/input_routes.rou.xml new file mode 100644 index 000000000000..e764b5be9219 --- /dev/null +++ b/tests/sumo/rail/reversal/insertion_before_reversal3/input_routes.rou.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/insertion_before_reversal3/net.net.xml b/tests/sumo/rail/reversal/insertion_before_reversal3/net.net.xml new file mode 100644 index 000000000000..132877ecf379 --- /dev/null +++ b/tests/sumo/rail/reversal/insertion_before_reversal3/net.net.xml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/insertion_before_reversal3/options.sumo b/tests/sumo/rail/reversal/insertion_before_reversal3/options.sumo new file mode 100644 index 000000000000..db1f2e389912 --- /dev/null +++ b/tests/sumo/rail/reversal/insertion_before_reversal3/options.sumo @@ -0,0 +1,3 @@ +--no-step-log --no-duration-log +--net-file=net.net.xml +--routes=input_routes.rou.xml diff --git a/tests/sumo/rail/reversal/insertion_before_reversal3/output.sumo b/tests/sumo/rail/reversal/insertion_before_reversal3/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/reversal/insertion_before_reversal3/railsignalblocks.sumo b/tests/sumo/rail/reversal/insertion_before_reversal3/railsignalblocks.sumo new file mode 100644 index 000000000000..7cfd32c768d3 --- /dev/null +++ b/tests/sumo/rail/reversal/insertion_before_reversal3/railsignalblocks.sumo @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/insertion_before_reversal3/railsignalblocks.sumo.meso b/tests/sumo/rail/reversal/insertion_before_reversal3/railsignalblocks.sumo.meso new file mode 100644 index 000000000000..ef865be25246 --- /dev/null +++ b/tests/sumo/rail/reversal/insertion_before_reversal3/railsignalblocks.sumo.meso @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/insertion_before_reversal3/stopinfos.sumo b/tests/sumo/rail/reversal/insertion_before_reversal3/stopinfos.sumo new file mode 100644 index 000000000000..c9c406034fdb --- /dev/null +++ b/tests/sumo/rail/reversal/insertion_before_reversal3/stopinfos.sumo @@ -0,0 +1 @@ +Auto-generated by TextTest to simulate missing file for this version... diff --git a/tests/sumo/rail/reversal/reversal_after_common_block/railsignalblocks.sumo b/tests/sumo/rail/reversal/reversal_after_common_block/railsignalblocks.sumo index 2dcbaf6c482a..a62356f9b84a 100644 --- a/tests/sumo/rail/reversal/reversal_after_common_block/railsignalblocks.sumo +++ b/tests/sumo/rail/reversal/reversal_after_common_block/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - - + + From d2d5fd4a8794bfab1a771d8980aad8e798300ca5 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 27 Sep 2024 17:12:40 +0200 Subject: [PATCH 252/334] reorganized tests refs #21 --- tests/sumo/rail/rail_signal/testsuite.sumo | 35 ------------------- .../sidingShort_deadlock/errors.sumo | 0 .../sidingShort_deadlock/input_routes.rou.xml | 0 .../sidingShort_deadlock/net.net.xml | 0 .../sidingShort_deadlock/options.sumo | 0 .../sidingShort_deadlock/output.sumo | 0 .../railsignalblocks.sumo | 0 .../sidingShort_deadlock/tripinfos.sumo | 0 .../siding_both_ways/errors.sumo | 0 .../siding_both_ways/input_routes.rou.xml | 0 .../siding_both_ways/net.net.xml | 0 .../siding_both_ways/options.sumo | 0 .../siding_both_ways/output.sumo | 0 .../siding_both_ways/railsignalblocks.sumo | 0 .../siding_both_ways/tripinfos.sumo | 0 .../siding_both_ways2/errors.sumo | 0 .../siding_both_ways2/input_routes.rou.xml | 0 .../siding_both_ways2/net.net.xml | 0 .../siding_both_ways2/options.sumo | 0 .../siding_both_ways2/output.sumo | 0 .../siding_both_ways2/railsignalblocks.sumo | 0 .../siding_both_ways2/tripinfos.sumo | 0 .../siding_both_ways3/errors.sumo | 0 .../siding_both_ways3/input_routes.rou.xml | 0 .../siding_both_ways3/net.net.xml | 0 .../siding_both_ways3/options.sumo | 0 .../siding_both_ways3/output.sumo | 0 .../siding_both_ways3/railsignalblocks.sumo | 0 .../siding_both_ways3/tripinfos.sumo | 0 .../siding_both_ways4/errors.sumo | 0 .../siding_both_ways4/input_routes.rou.xml | 0 .../siding_both_ways4/net.net.xml | 0 .../siding_both_ways4/options.sumo | 0 .../siding_both_ways4/output.sumo | 0 .../siding_both_ways4/railsignalblocks.sumo | 0 .../siding_both_ways4/tripinfos.sumo | 0 .../siding_both_ways_addTrain/errors.sumo | 0 .../input_routes.rou.xml | 0 .../siding_both_ways_addTrain/net.net.xml | 0 .../siding_both_ways_addTrain/options.sumo | 0 .../siding_both_ways_addTrain/output.sumo | 0 .../railsignalblocks.sumo | 0 .../siding_both_ways_addTrain/tripinfos.sumo | 0 .../siding_deadlock/errors.sumo | 0 .../siding_deadlock/input_routes.rou.xml | 0 .../siding_deadlock/net.net.xml | 0 .../siding_deadlock/options.sumo | 0 .../siding_deadlock/output.sumo | 0 .../siding_deadlock/railsignalblocks.sumo | 0 .../siding_deadlock/tripinfos.sumo | 0 .../siding_noSignal/errors.sumo | 0 .../siding_noSignal/input_routes.rou.xml | 0 .../siding_noSignal/net.net.xml | 0 .../siding_noSignal/options.sumo | 0 .../siding_noSignal/output.sumo | 0 .../siding_noSignal/railsignalblocks.sumo | 0 .../siding_noSignal/tripinfos.sumo | 0 .../siding_noSignal2/errors.sumo | 0 .../siding_noSignal2/input_routes.rou.xml | 0 .../siding_noSignal2/net.net.xml | 0 .../siding_noSignal2/options.sumo | 0 .../siding_noSignal2/output.sumo | 0 .../siding_noSignal2/railsignalblocks.sumo | 0 .../siding_noSignal2/tripinfos.sumo | 0 .../siding_occupied_advance/errors.sumo | 0 .../input_routes.rou.xml | 0 .../siding_occupied_advance/net.net.xml | 0 .../siding_occupied_advance/options.sumo | 0 .../siding_occupied_advance/output.sumo | 0 .../railsignalblocks.sumo | 0 .../siding_occupied_advance/tripinfos.sumo | 0 tests/sumo/rail/siding/testsuite.sumo | 34 ++++++++++++++++++ tests/sumo/rail/testsuite.sumo | 3 ++ 73 files changed, 37 insertions(+), 35 deletions(-) rename tests/sumo/rail/{rail_signal => siding}/sidingShort_deadlock/errors.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/sidingShort_deadlock/input_routes.rou.xml (100%) rename tests/sumo/rail/{rail_signal => siding}/sidingShort_deadlock/net.net.xml (100%) rename tests/sumo/rail/{rail_signal => siding}/sidingShort_deadlock/options.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/sidingShort_deadlock/output.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/sidingShort_deadlock/railsignalblocks.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/sidingShort_deadlock/tripinfos.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways/errors.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways/input_routes.rou.xml (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways/net.net.xml (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways/options.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways/output.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways/railsignalblocks.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways/tripinfos.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways2/errors.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways2/input_routes.rou.xml (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways2/net.net.xml (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways2/options.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways2/output.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways2/railsignalblocks.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways2/tripinfos.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways3/errors.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways3/input_routes.rou.xml (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways3/net.net.xml (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways3/options.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways3/output.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways3/railsignalblocks.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways3/tripinfos.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways4/errors.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways4/input_routes.rou.xml (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways4/net.net.xml (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways4/options.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways4/output.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways4/railsignalblocks.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways4/tripinfos.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways_addTrain/errors.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways_addTrain/input_routes.rou.xml (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways_addTrain/net.net.xml (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways_addTrain/options.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways_addTrain/output.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways_addTrain/railsignalblocks.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_both_ways_addTrain/tripinfos.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_deadlock/errors.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_deadlock/input_routes.rou.xml (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_deadlock/net.net.xml (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_deadlock/options.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_deadlock/output.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_deadlock/railsignalblocks.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_deadlock/tripinfos.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_noSignal/errors.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_noSignal/input_routes.rou.xml (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_noSignal/net.net.xml (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_noSignal/options.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_noSignal/output.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_noSignal/railsignalblocks.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_noSignal/tripinfos.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_noSignal2/errors.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_noSignal2/input_routes.rou.xml (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_noSignal2/net.net.xml (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_noSignal2/options.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_noSignal2/output.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_noSignal2/railsignalblocks.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_noSignal2/tripinfos.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_occupied_advance/errors.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_occupied_advance/input_routes.rou.xml (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_occupied_advance/net.net.xml (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_occupied_advance/options.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_occupied_advance/output.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_occupied_advance/railsignalblocks.sumo (100%) rename tests/sumo/rail/{rail_signal => siding}/siding_occupied_advance/tripinfos.sumo (100%) create mode 100644 tests/sumo/rail/siding/testsuite.sumo diff --git a/tests/sumo/rail/rail_signal/testsuite.sumo b/tests/sumo/rail/rail_signal/testsuite.sumo index 74a153d7395e..3b8f2508063f 100644 --- a/tests/sumo/rail/rail_signal/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/testsuite.sumo @@ -126,40 +126,5 @@ end_within # a driveway is updated after being used update_driveways -# both sides of a siding are used in both directions -siding_both_ways - -# both sides of a siding are used in both directions. -# Check that all other foes are checked even after a usable siding is found for one foe. -siding_both_ways_addTrain - -# both sides of a siding are used in both directions but the "wrong" way is only used by stumps -siding_both_ways2 - -# both sides of a siding are used in both directions but the "wrong" way is only used by stumps. -# -# One of the driveways doesn't have the terminateRoute flag. -siding_both_ways3 - -# both sides of a siding are used in both directions but the "wrong" way is only used by stumps. -# -# both driveways don't have the terminateRoute flag. -siding_both_ways4 - -# siding cannot be used because it is already occupied -siding_deadlock - -# driveway should be usable despite occupied siding if the other side is still usable -siding_occupied_advance - -# siding cannot be used because the trains are too long -sidingShort_deadlock - -# siding does not prevent deadlock because it doesn't have a signal -siding_noSignal - -# siding does not prevent deadlock because it doesn't have a signal. one more layer of signals outside the siding -siding_noSignal2 - # reduce number of "parallel" driveways driveway_variants diff --git a/tests/sumo/rail/rail_signal/sidingShort_deadlock/errors.sumo b/tests/sumo/rail/siding/sidingShort_deadlock/errors.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/sidingShort_deadlock/errors.sumo rename to tests/sumo/rail/siding/sidingShort_deadlock/errors.sumo diff --git a/tests/sumo/rail/rail_signal/sidingShort_deadlock/input_routes.rou.xml b/tests/sumo/rail/siding/sidingShort_deadlock/input_routes.rou.xml similarity index 100% rename from tests/sumo/rail/rail_signal/sidingShort_deadlock/input_routes.rou.xml rename to tests/sumo/rail/siding/sidingShort_deadlock/input_routes.rou.xml diff --git a/tests/sumo/rail/rail_signal/sidingShort_deadlock/net.net.xml b/tests/sumo/rail/siding/sidingShort_deadlock/net.net.xml similarity index 100% rename from tests/sumo/rail/rail_signal/sidingShort_deadlock/net.net.xml rename to tests/sumo/rail/siding/sidingShort_deadlock/net.net.xml diff --git a/tests/sumo/rail/rail_signal/sidingShort_deadlock/options.sumo b/tests/sumo/rail/siding/sidingShort_deadlock/options.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/sidingShort_deadlock/options.sumo rename to tests/sumo/rail/siding/sidingShort_deadlock/options.sumo diff --git a/tests/sumo/rail/rail_signal/sidingShort_deadlock/output.sumo b/tests/sumo/rail/siding/sidingShort_deadlock/output.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/sidingShort_deadlock/output.sumo rename to tests/sumo/rail/siding/sidingShort_deadlock/output.sumo diff --git a/tests/sumo/rail/rail_signal/sidingShort_deadlock/railsignalblocks.sumo b/tests/sumo/rail/siding/sidingShort_deadlock/railsignalblocks.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/sidingShort_deadlock/railsignalblocks.sumo rename to tests/sumo/rail/siding/sidingShort_deadlock/railsignalblocks.sumo diff --git a/tests/sumo/rail/rail_signal/sidingShort_deadlock/tripinfos.sumo b/tests/sumo/rail/siding/sidingShort_deadlock/tripinfos.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/sidingShort_deadlock/tripinfos.sumo rename to tests/sumo/rail/siding/sidingShort_deadlock/tripinfos.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways/errors.sumo b/tests/sumo/rail/siding/siding_both_ways/errors.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways/errors.sumo rename to tests/sumo/rail/siding/siding_both_ways/errors.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways/input_routes.rou.xml b/tests/sumo/rail/siding/siding_both_ways/input_routes.rou.xml similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways/input_routes.rou.xml rename to tests/sumo/rail/siding/siding_both_ways/input_routes.rou.xml diff --git a/tests/sumo/rail/rail_signal/siding_both_ways/net.net.xml b/tests/sumo/rail/siding/siding_both_ways/net.net.xml similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways/net.net.xml rename to tests/sumo/rail/siding/siding_both_ways/net.net.xml diff --git a/tests/sumo/rail/rail_signal/siding_both_ways/options.sumo b/tests/sumo/rail/siding/siding_both_ways/options.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways/options.sumo rename to tests/sumo/rail/siding/siding_both_ways/options.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways/output.sumo b/tests/sumo/rail/siding/siding_both_ways/output.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways/output.sumo rename to tests/sumo/rail/siding/siding_both_ways/output.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways/railsignalblocks.sumo b/tests/sumo/rail/siding/siding_both_ways/railsignalblocks.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways/railsignalblocks.sumo rename to tests/sumo/rail/siding/siding_both_ways/railsignalblocks.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways/tripinfos.sumo b/tests/sumo/rail/siding/siding_both_ways/tripinfos.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways/tripinfos.sumo rename to tests/sumo/rail/siding/siding_both_ways/tripinfos.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways2/errors.sumo b/tests/sumo/rail/siding/siding_both_ways2/errors.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways2/errors.sumo rename to tests/sumo/rail/siding/siding_both_ways2/errors.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways2/input_routes.rou.xml b/tests/sumo/rail/siding/siding_both_ways2/input_routes.rou.xml similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways2/input_routes.rou.xml rename to tests/sumo/rail/siding/siding_both_ways2/input_routes.rou.xml diff --git a/tests/sumo/rail/rail_signal/siding_both_ways2/net.net.xml b/tests/sumo/rail/siding/siding_both_ways2/net.net.xml similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways2/net.net.xml rename to tests/sumo/rail/siding/siding_both_ways2/net.net.xml diff --git a/tests/sumo/rail/rail_signal/siding_both_ways2/options.sumo b/tests/sumo/rail/siding/siding_both_ways2/options.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways2/options.sumo rename to tests/sumo/rail/siding/siding_both_ways2/options.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways2/output.sumo b/tests/sumo/rail/siding/siding_both_ways2/output.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways2/output.sumo rename to tests/sumo/rail/siding/siding_both_ways2/output.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways2/railsignalblocks.sumo b/tests/sumo/rail/siding/siding_both_ways2/railsignalblocks.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways2/railsignalblocks.sumo rename to tests/sumo/rail/siding/siding_both_ways2/railsignalblocks.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways2/tripinfos.sumo b/tests/sumo/rail/siding/siding_both_ways2/tripinfos.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways2/tripinfos.sumo rename to tests/sumo/rail/siding/siding_both_ways2/tripinfos.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways3/errors.sumo b/tests/sumo/rail/siding/siding_both_ways3/errors.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways3/errors.sumo rename to tests/sumo/rail/siding/siding_both_ways3/errors.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways3/input_routes.rou.xml b/tests/sumo/rail/siding/siding_both_ways3/input_routes.rou.xml similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways3/input_routes.rou.xml rename to tests/sumo/rail/siding/siding_both_ways3/input_routes.rou.xml diff --git a/tests/sumo/rail/rail_signal/siding_both_ways3/net.net.xml b/tests/sumo/rail/siding/siding_both_ways3/net.net.xml similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways3/net.net.xml rename to tests/sumo/rail/siding/siding_both_ways3/net.net.xml diff --git a/tests/sumo/rail/rail_signal/siding_both_ways3/options.sumo b/tests/sumo/rail/siding/siding_both_ways3/options.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways3/options.sumo rename to tests/sumo/rail/siding/siding_both_ways3/options.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways3/output.sumo b/tests/sumo/rail/siding/siding_both_ways3/output.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways3/output.sumo rename to tests/sumo/rail/siding/siding_both_ways3/output.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways3/railsignalblocks.sumo b/tests/sumo/rail/siding/siding_both_ways3/railsignalblocks.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways3/railsignalblocks.sumo rename to tests/sumo/rail/siding/siding_both_ways3/railsignalblocks.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways3/tripinfos.sumo b/tests/sumo/rail/siding/siding_both_ways3/tripinfos.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways3/tripinfos.sumo rename to tests/sumo/rail/siding/siding_both_ways3/tripinfos.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways4/errors.sumo b/tests/sumo/rail/siding/siding_both_ways4/errors.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways4/errors.sumo rename to tests/sumo/rail/siding/siding_both_ways4/errors.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways4/input_routes.rou.xml b/tests/sumo/rail/siding/siding_both_ways4/input_routes.rou.xml similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways4/input_routes.rou.xml rename to tests/sumo/rail/siding/siding_both_ways4/input_routes.rou.xml diff --git a/tests/sumo/rail/rail_signal/siding_both_ways4/net.net.xml b/tests/sumo/rail/siding/siding_both_ways4/net.net.xml similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways4/net.net.xml rename to tests/sumo/rail/siding/siding_both_ways4/net.net.xml diff --git a/tests/sumo/rail/rail_signal/siding_both_ways4/options.sumo b/tests/sumo/rail/siding/siding_both_ways4/options.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways4/options.sumo rename to tests/sumo/rail/siding/siding_both_ways4/options.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways4/output.sumo b/tests/sumo/rail/siding/siding_both_ways4/output.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways4/output.sumo rename to tests/sumo/rail/siding/siding_both_ways4/output.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways4/railsignalblocks.sumo b/tests/sumo/rail/siding/siding_both_ways4/railsignalblocks.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways4/railsignalblocks.sumo rename to tests/sumo/rail/siding/siding_both_ways4/railsignalblocks.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways4/tripinfos.sumo b/tests/sumo/rail/siding/siding_both_ways4/tripinfos.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways4/tripinfos.sumo rename to tests/sumo/rail/siding/siding_both_ways4/tripinfos.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/errors.sumo b/tests/sumo/rail/siding/siding_both_ways_addTrain/errors.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways_addTrain/errors.sumo rename to tests/sumo/rail/siding/siding_both_ways_addTrain/errors.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/input_routes.rou.xml b/tests/sumo/rail/siding/siding_both_ways_addTrain/input_routes.rou.xml similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways_addTrain/input_routes.rou.xml rename to tests/sumo/rail/siding/siding_both_ways_addTrain/input_routes.rou.xml diff --git a/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/net.net.xml b/tests/sumo/rail/siding/siding_both_ways_addTrain/net.net.xml similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways_addTrain/net.net.xml rename to tests/sumo/rail/siding/siding_both_ways_addTrain/net.net.xml diff --git a/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/options.sumo b/tests/sumo/rail/siding/siding_both_ways_addTrain/options.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways_addTrain/options.sumo rename to tests/sumo/rail/siding/siding_both_ways_addTrain/options.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/output.sumo b/tests/sumo/rail/siding/siding_both_ways_addTrain/output.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways_addTrain/output.sumo rename to tests/sumo/rail/siding/siding_both_ways_addTrain/output.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/railsignalblocks.sumo b/tests/sumo/rail/siding/siding_both_ways_addTrain/railsignalblocks.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways_addTrain/railsignalblocks.sumo rename to tests/sumo/rail/siding/siding_both_ways_addTrain/railsignalblocks.sumo diff --git a/tests/sumo/rail/rail_signal/siding_both_ways_addTrain/tripinfos.sumo b/tests/sumo/rail/siding/siding_both_ways_addTrain/tripinfos.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_both_ways_addTrain/tripinfos.sumo rename to tests/sumo/rail/siding/siding_both_ways_addTrain/tripinfos.sumo diff --git a/tests/sumo/rail/rail_signal/siding_deadlock/errors.sumo b/tests/sumo/rail/siding/siding_deadlock/errors.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_deadlock/errors.sumo rename to tests/sumo/rail/siding/siding_deadlock/errors.sumo diff --git a/tests/sumo/rail/rail_signal/siding_deadlock/input_routes.rou.xml b/tests/sumo/rail/siding/siding_deadlock/input_routes.rou.xml similarity index 100% rename from tests/sumo/rail/rail_signal/siding_deadlock/input_routes.rou.xml rename to tests/sumo/rail/siding/siding_deadlock/input_routes.rou.xml diff --git a/tests/sumo/rail/rail_signal/siding_deadlock/net.net.xml b/tests/sumo/rail/siding/siding_deadlock/net.net.xml similarity index 100% rename from tests/sumo/rail/rail_signal/siding_deadlock/net.net.xml rename to tests/sumo/rail/siding/siding_deadlock/net.net.xml diff --git a/tests/sumo/rail/rail_signal/siding_deadlock/options.sumo b/tests/sumo/rail/siding/siding_deadlock/options.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_deadlock/options.sumo rename to tests/sumo/rail/siding/siding_deadlock/options.sumo diff --git a/tests/sumo/rail/rail_signal/siding_deadlock/output.sumo b/tests/sumo/rail/siding/siding_deadlock/output.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_deadlock/output.sumo rename to tests/sumo/rail/siding/siding_deadlock/output.sumo diff --git a/tests/sumo/rail/rail_signal/siding_deadlock/railsignalblocks.sumo b/tests/sumo/rail/siding/siding_deadlock/railsignalblocks.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_deadlock/railsignalblocks.sumo rename to tests/sumo/rail/siding/siding_deadlock/railsignalblocks.sumo diff --git a/tests/sumo/rail/rail_signal/siding_deadlock/tripinfos.sumo b/tests/sumo/rail/siding/siding_deadlock/tripinfos.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_deadlock/tripinfos.sumo rename to tests/sumo/rail/siding/siding_deadlock/tripinfos.sumo diff --git a/tests/sumo/rail/rail_signal/siding_noSignal/errors.sumo b/tests/sumo/rail/siding/siding_noSignal/errors.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_noSignal/errors.sumo rename to tests/sumo/rail/siding/siding_noSignal/errors.sumo diff --git a/tests/sumo/rail/rail_signal/siding_noSignal/input_routes.rou.xml b/tests/sumo/rail/siding/siding_noSignal/input_routes.rou.xml similarity index 100% rename from tests/sumo/rail/rail_signal/siding_noSignal/input_routes.rou.xml rename to tests/sumo/rail/siding/siding_noSignal/input_routes.rou.xml diff --git a/tests/sumo/rail/rail_signal/siding_noSignal/net.net.xml b/tests/sumo/rail/siding/siding_noSignal/net.net.xml similarity index 100% rename from tests/sumo/rail/rail_signal/siding_noSignal/net.net.xml rename to tests/sumo/rail/siding/siding_noSignal/net.net.xml diff --git a/tests/sumo/rail/rail_signal/siding_noSignal/options.sumo b/tests/sumo/rail/siding/siding_noSignal/options.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_noSignal/options.sumo rename to tests/sumo/rail/siding/siding_noSignal/options.sumo diff --git a/tests/sumo/rail/rail_signal/siding_noSignal/output.sumo b/tests/sumo/rail/siding/siding_noSignal/output.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_noSignal/output.sumo rename to tests/sumo/rail/siding/siding_noSignal/output.sumo diff --git a/tests/sumo/rail/rail_signal/siding_noSignal/railsignalblocks.sumo b/tests/sumo/rail/siding/siding_noSignal/railsignalblocks.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_noSignal/railsignalblocks.sumo rename to tests/sumo/rail/siding/siding_noSignal/railsignalblocks.sumo diff --git a/tests/sumo/rail/rail_signal/siding_noSignal/tripinfos.sumo b/tests/sumo/rail/siding/siding_noSignal/tripinfos.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_noSignal/tripinfos.sumo rename to tests/sumo/rail/siding/siding_noSignal/tripinfos.sumo diff --git a/tests/sumo/rail/rail_signal/siding_noSignal2/errors.sumo b/tests/sumo/rail/siding/siding_noSignal2/errors.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_noSignal2/errors.sumo rename to tests/sumo/rail/siding/siding_noSignal2/errors.sumo diff --git a/tests/sumo/rail/rail_signal/siding_noSignal2/input_routes.rou.xml b/tests/sumo/rail/siding/siding_noSignal2/input_routes.rou.xml similarity index 100% rename from tests/sumo/rail/rail_signal/siding_noSignal2/input_routes.rou.xml rename to tests/sumo/rail/siding/siding_noSignal2/input_routes.rou.xml diff --git a/tests/sumo/rail/rail_signal/siding_noSignal2/net.net.xml b/tests/sumo/rail/siding/siding_noSignal2/net.net.xml similarity index 100% rename from tests/sumo/rail/rail_signal/siding_noSignal2/net.net.xml rename to tests/sumo/rail/siding/siding_noSignal2/net.net.xml diff --git a/tests/sumo/rail/rail_signal/siding_noSignal2/options.sumo b/tests/sumo/rail/siding/siding_noSignal2/options.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_noSignal2/options.sumo rename to tests/sumo/rail/siding/siding_noSignal2/options.sumo diff --git a/tests/sumo/rail/rail_signal/siding_noSignal2/output.sumo b/tests/sumo/rail/siding/siding_noSignal2/output.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_noSignal2/output.sumo rename to tests/sumo/rail/siding/siding_noSignal2/output.sumo diff --git a/tests/sumo/rail/rail_signal/siding_noSignal2/railsignalblocks.sumo b/tests/sumo/rail/siding/siding_noSignal2/railsignalblocks.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_noSignal2/railsignalblocks.sumo rename to tests/sumo/rail/siding/siding_noSignal2/railsignalblocks.sumo diff --git a/tests/sumo/rail/rail_signal/siding_noSignal2/tripinfos.sumo b/tests/sumo/rail/siding/siding_noSignal2/tripinfos.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_noSignal2/tripinfos.sumo rename to tests/sumo/rail/siding/siding_noSignal2/tripinfos.sumo diff --git a/tests/sumo/rail/rail_signal/siding_occupied_advance/errors.sumo b/tests/sumo/rail/siding/siding_occupied_advance/errors.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_occupied_advance/errors.sumo rename to tests/sumo/rail/siding/siding_occupied_advance/errors.sumo diff --git a/tests/sumo/rail/rail_signal/siding_occupied_advance/input_routes.rou.xml b/tests/sumo/rail/siding/siding_occupied_advance/input_routes.rou.xml similarity index 100% rename from tests/sumo/rail/rail_signal/siding_occupied_advance/input_routes.rou.xml rename to tests/sumo/rail/siding/siding_occupied_advance/input_routes.rou.xml diff --git a/tests/sumo/rail/rail_signal/siding_occupied_advance/net.net.xml b/tests/sumo/rail/siding/siding_occupied_advance/net.net.xml similarity index 100% rename from tests/sumo/rail/rail_signal/siding_occupied_advance/net.net.xml rename to tests/sumo/rail/siding/siding_occupied_advance/net.net.xml diff --git a/tests/sumo/rail/rail_signal/siding_occupied_advance/options.sumo b/tests/sumo/rail/siding/siding_occupied_advance/options.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_occupied_advance/options.sumo rename to tests/sumo/rail/siding/siding_occupied_advance/options.sumo diff --git a/tests/sumo/rail/rail_signal/siding_occupied_advance/output.sumo b/tests/sumo/rail/siding/siding_occupied_advance/output.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_occupied_advance/output.sumo rename to tests/sumo/rail/siding/siding_occupied_advance/output.sumo diff --git a/tests/sumo/rail/rail_signal/siding_occupied_advance/railsignalblocks.sumo b/tests/sumo/rail/siding/siding_occupied_advance/railsignalblocks.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_occupied_advance/railsignalblocks.sumo rename to tests/sumo/rail/siding/siding_occupied_advance/railsignalblocks.sumo diff --git a/tests/sumo/rail/rail_signal/siding_occupied_advance/tripinfos.sumo b/tests/sumo/rail/siding/siding_occupied_advance/tripinfos.sumo similarity index 100% rename from tests/sumo/rail/rail_signal/siding_occupied_advance/tripinfos.sumo rename to tests/sumo/rail/siding/siding_occupied_advance/tripinfos.sumo diff --git a/tests/sumo/rail/siding/testsuite.sumo b/tests/sumo/rail/siding/testsuite.sumo new file mode 100644 index 000000000000..a7ae115ed6bc --- /dev/null +++ b/tests/sumo/rail/siding/testsuite.sumo @@ -0,0 +1,34 @@ +# both sides of a siding are used in both directions +siding_both_ways + +# both sides of a siding are used in both directions. +# Check that all other foes are checked even after a usable siding is found for one foe. +siding_both_ways_addTrain + +# both sides of a siding are used in both directions but the "wrong" way is only used by stumps +siding_both_ways2 + +# both sides of a siding are used in both directions but the "wrong" way is only used by stumps. +# +# One of the driveways doesn't have the terminateRoute flag. +siding_both_ways3 + +# both sides of a siding are used in both directions but the "wrong" way is only used by stumps. +# +# both driveways don't have the terminateRoute flag. +siding_both_ways4 + +# siding cannot be used because it is already occupied +siding_deadlock + +# driveway should be usable despite occupied siding if the other side is still usable +siding_occupied_advance + +# siding cannot be used because the trains are too long +sidingShort_deadlock + +# siding does not prevent deadlock because it doesn't have a signal +siding_noSignal + +# siding does not prevent deadlock because it doesn't have a signal. one more layer of signals outside the siding +siding_noSignal2 diff --git a/tests/sumo/rail/testsuite.sumo b/tests/sumo/rail/testsuite.sumo index 87b6a09b0f80..5433a56f3ee1 100644 --- a/tests/sumo/rail/testsuite.sumo +++ b/tests/sumo/rail/testsuite.sumo @@ -1,6 +1,9 @@ # tests for rail signals rail_signal +# test for conflicts and deadlocks involving a siding +siding + # trams driving in a loop servicing stops tramwayLoop From ca7a79bb7b38ba8d2a4a4608e921ee75b92d6e90 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 27 Sep 2024 17:14:09 +0200 Subject: [PATCH 253/334] added test refs #7578, #21 --- tests/sumo/rail/siding/loop_3veh/errors.sumo | 2 + .../siding/loop_3veh/input_routes.rou.xml | 39 ++ tests/sumo/rail/siding/loop_3veh/net.net.xml | 483 ++++++++++++++++++ tests/sumo/rail/siding/loop_3veh/options.sumo | 2 + tests/sumo/rail/siding/loop_3veh/output.sumo | 0 .../siding/loop_3veh/railsignalblocks.sumo | 209 ++++++++ .../sumo/rail/siding/loop_3veh/tripinfos.sumo | 44 ++ tests/sumo/rail/siding/testsuite.sumo | 3 + 8 files changed, 782 insertions(+) create mode 100644 tests/sumo/rail/siding/loop_3veh/errors.sumo create mode 100644 tests/sumo/rail/siding/loop_3veh/input_routes.rou.xml create mode 100644 tests/sumo/rail/siding/loop_3veh/net.net.xml create mode 100644 tests/sumo/rail/siding/loop_3veh/options.sumo create mode 100644 tests/sumo/rail/siding/loop_3veh/output.sumo create mode 100644 tests/sumo/rail/siding/loop_3veh/railsignalblocks.sumo create mode 100644 tests/sumo/rail/siding/loop_3veh/tripinfos.sumo diff --git a/tests/sumo/rail/siding/loop_3veh/errors.sumo b/tests/sumo/rail/siding/loop_3veh/errors.sumo new file mode 100644 index 000000000000..2f87d19d5a19 --- /dev/null +++ b/tests/sumo/rail/siding/loop_3veh/errors.sumo @@ -0,0 +1,2 @@ +Warning: Teleporting vehicle 't2'; waited too long (yield), lane='a_0', time=359.00. +Warning: Vehicle 't2' ends teleporting on edge '-a', time=473.00. diff --git a/tests/sumo/rail/siding/loop_3veh/input_routes.rou.xml b/tests/sumo/rail/siding/loop_3veh/input_routes.rou.xml new file mode 100644 index 000000000000..8902f51ec624 --- /dev/null +++ b/tests/sumo/rail/siding/loop_3veh/input_routes.rou.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/loop_3veh/net.net.xml b/tests/sumo/rail/siding/loop_3veh/net.net.xml new file mode 100644 index 000000000000..9668c0590a07 --- /dev/null +++ b/tests/sumo/rail/siding/loop_3veh/net.net.xml @@ -0,0 +1,483 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/loop_3veh/options.sumo b/tests/sumo/rail/siding/loop_3veh/options.sumo new file mode 100644 index 000000000000..aca2e8d18e45 --- /dev/null +++ b/tests/sumo/rail/siding/loop_3veh/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/siding/loop_3veh/output.sumo b/tests/sumo/rail/siding/loop_3veh/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/siding/loop_3veh/railsignalblocks.sumo b/tests/sumo/rail/siding/loop_3veh/railsignalblocks.sumo new file mode 100644 index 000000000000..c89cac3028f4 --- /dev/null +++ b/tests/sumo/rail/siding/loop_3veh/railsignalblocks.sumo @@ -0,0 +1,209 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/loop_3veh/tripinfos.sumo b/tests/sumo/rail/siding/loop_3veh/tripinfos.sumo new file mode 100644 index 000000000000..d3924c6c017a --- /dev/null +++ b/tests/sumo/rail/siding/loop_3veh/tripinfos.sumo @@ -0,0 +1,44 @@ + + + + + + + + + diff --git a/tests/sumo/rail/siding/testsuite.sumo b/tests/sumo/rail/siding/testsuite.sumo index a7ae115ed6bc..dc3030380977 100644 --- a/tests/sumo/rail/siding/testsuite.sumo +++ b/tests/sumo/rail/siding/testsuite.sumo @@ -32,3 +32,6 @@ siding_noSignal # siding does not prevent deadlock because it doesn't have a signal. one more layer of signals outside the siding siding_noSignal2 + +# a loop that reverses on itself can create a deadlock with 3 vehicles +loop_3veh From b88f2fd166e0c61cb8d2d5e8adf5da79ed9422a3 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 27 Sep 2024 20:21:14 +0200 Subject: [PATCH 254/334] refactoring refs #12 --- src/microsim/traffic_lights/MSDriveWay.cpp | 12 +++++++----- src/microsim/traffic_lights/MSDriveWay.h | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 243a92f79cff..72b52595b098 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -1360,7 +1360,8 @@ MSDriveWay::buildDriveWay(const std::string& id, const MSLink* link, MSRouteIter std::cout << " setting " << dw->getID() << " as foe of " << foe->getID() << "\n"; } #endif - foe->addFoeCheckSiding(dw); + foe->myFoes.push_back(dw); + foe->addSidings(dw); dw->myUpdateDelete.push_back(foe); } else { dw->buildSubFoe(foe, movingBlock); @@ -1371,7 +1372,8 @@ MSDriveWay::buildDriveWay(const std::string& id, const MSLink* link, MSRouteIter std::cout << " addFoeCheckSiding " << foe->getID() << "\n"; } #endif - dw->addFoeCheckSiding(foe); + dw->myFoes.push_back(foe); + dw->addSidings(foe); foe->myUpdateDelete.push_back(dw); } else { foe->buildSubFoe(dw, movingBlock); @@ -1670,6 +1672,7 @@ MSDriveWay::buildSubFoe(MSDriveWay* foe, bool movingBlock) { if (subLast < 0) { if (foe->myTerminateRoute) { if (bidiBlockedByEnd(*foe) && bidiBlockedByEnd(*this) && foe->forwardEndOnRoute(this)) { + //if (bidiBlockedByEnd(*foe) && bidiBlockedBy(*this) && foe->forwardEndOnRoute(this)) { foe->myFoes.push_back(this); myUpdateDelete.push_back(foe); } @@ -1759,8 +1762,7 @@ MSDriveWay::buildSubFoe(MSDriveWay* foe, bool movingBlock) { } void -MSDriveWay::addFoeCheckSiding(MSDriveWay* foe) { - myFoes.push_back(foe); +MSDriveWay::addSidings(MSDriveWay* foe, bool addToFoe) { const MSEdge* foeEndBidi = foe->myForward.back()->getEdge().getBidiEdge(); int forwardNormals = 0; for (auto lane : foe->myForward) { @@ -1810,7 +1812,7 @@ MSDriveWay::addFoeCheckSiding(MSDriveWay* foe) { #ifdef DEBUG_BUILD_SIDINGS std::cout << "endSiding " << getID() << " foe=" << foe->getID() << " i=" << i << " curBidi=" << Named::getIDSecure(cur->getBidiEdge()) << " length=" << length << "\n"; #endif - auto& foeSidings = mySidings[foe]; + auto& foeSidings = addToFoe ? foe->mySidings[this] : mySidings[foe]; foeSidings.insert(foeSidings.begin(), Siding(i + 1, start, length)); start = -1; length = 0; diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h index ffd4571f681d..fa8567b355d9 100644 --- a/src/microsim/traffic_lights/MSDriveWay.h +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -248,8 +248,8 @@ class MSDriveWay : public MSMoveReminder, public Named { /// @brief add all driveWays that start at the given link as foes void addFoes(const MSLink* link); - /// @brief add foe and update sidings - void addFoeCheckSiding(MSDriveWay* foe); + /// @brief add sidings for the given foe + void addSidings(MSDriveWay* foe, bool addToFoe = false); /// @brief derive foe driveways based on myBidi or myBidiExtended void addBidiFoes(const MSRailSignal* ownSignal, bool extended); From 20dc238b95b0cb86eeaf56bf8be53083ec93e11e Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 27 Sep 2024 20:42:11 +0200 Subject: [PATCH 255/334] recognizing more foes and sidings refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 23 ++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 72b52595b098..0c6c00cec9f8 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -1671,9 +1671,10 @@ MSDriveWay::buildSubFoe(MSDriveWay* foe, bool movingBlock) { } if (subLast < 0) { if (foe->myTerminateRoute) { - if (bidiBlockedByEnd(*foe) && bidiBlockedByEnd(*this) && foe->forwardEndOnRoute(this)) { - //if (bidiBlockedByEnd(*foe) && bidiBlockedBy(*this) && foe->forwardEndOnRoute(this)) { + if (bidiBlockedByEnd(*foe) && bidiBlockedBy(*this) && foe->forwardEndOnRoute(this)) { foe->myFoes.push_back(this); + // foe will get the sidings + addSidings(foe, true); myUpdateDelete.push_back(foe); } #ifdef DEBUG_BUILD_SUBDRIVEWAY @@ -1812,8 +1813,22 @@ MSDriveWay::addSidings(MSDriveWay* foe, bool addToFoe) { #ifdef DEBUG_BUILD_SIDINGS std::cout << "endSiding " << getID() << " foe=" << foe->getID() << " i=" << i << " curBidi=" << Named::getIDSecure(cur->getBidiEdge()) << " length=" << length << "\n"; #endif - auto& foeSidings = addToFoe ? foe->mySidings[this] : mySidings[foe]; - foeSidings.insert(foeSidings.begin(), Siding(i + 1, start, length)); + if (addToFoe) { + auto& foeSidings = foe->mySidings[this]; + // indices must be mapped onto foe route; + const MSEdge* first = myRoute[i + 1]; + auto itFirst = std::find(foe->myRoute.begin(), foe->myRoute.end(), first); + if (itFirst != foe->myRoute.end()) { + const MSEdge* last = myRoute[start]; + auto itLast = std::find(itFirst, foe->myRoute.end(), last); + if (itLast != foe->myRoute.end()) { + foeSidings.insert(foeSidings.begin(), Siding(itFirst - foe->myRoute.begin(), itLast - foe->myRoute.begin(), length)); + } + } + } else { + auto& foeSidings = mySidings[foe]; + foeSidings.insert(foeSidings.begin(), Siding(i + 1, start, length)); + } start = -1; length = 0; foeSearchBeg = itFind; From d9b9b9ee34148f8cfe3b4ca2b2b1ab8b830c1c93 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 27 Sep 2024 20:42:20 +0200 Subject: [PATCH 256/334] patching expected results refs #21, #7578 --- .../railsignalblocks.sumo | 11 +- tests/sumo/rail/siding/loop_3veh/errors.sumo | 2 - .../siding/loop_3veh/railsignalblocks.sumo | 117 +----------------- .../sumo/rail/siding/loop_3veh/tripinfos.sumo | 8 +- 4 files changed, 19 insertions(+), 119 deletions(-) diff --git a/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/railsignalblocks.sumo b/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/railsignalblocks.sumo index aaa86d964a07..202a1a0c9f2a 100644 --- a/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/railsignalblocks.sumo +++ b/tests/sumo/rail/reversal/reversal_onRoute_beyond_core/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - - - + + + From 65cf8f4e151da3ff978839aef2b0bf3a41fd69ae Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 27 Sep 2024 20:52:31 +0200 Subject: [PATCH 257/334] added test refs #7578, #21 --- tests/sumo/rail/siding/loop_4veh/errors.sumo | 2 + .../siding/loop_4veh/input_routes.rou.xml | 42 ++ tests/sumo/rail/siding/loop_4veh/net.net.xml | 489 ++++++++++++++++++ tests/sumo/rail/siding/loop_4veh/options.sumo | 2 + tests/sumo/rail/siding/loop_4veh/output.sumo | 0 .../siding/loop_4veh/railsignalblocks.sumo | 259 ++++++++++ .../sumo/rail/siding/loop_4veh/tripinfos.sumo | 45 ++ tests/sumo/rail/siding/testsuite.sumo | 3 + 8 files changed, 842 insertions(+) create mode 100644 tests/sumo/rail/siding/loop_4veh/errors.sumo create mode 100644 tests/sumo/rail/siding/loop_4veh/input_routes.rou.xml create mode 100644 tests/sumo/rail/siding/loop_4veh/net.net.xml create mode 100644 tests/sumo/rail/siding/loop_4veh/options.sumo create mode 100644 tests/sumo/rail/siding/loop_4veh/output.sumo create mode 100644 tests/sumo/rail/siding/loop_4veh/railsignalblocks.sumo create mode 100644 tests/sumo/rail/siding/loop_4veh/tripinfos.sumo diff --git a/tests/sumo/rail/siding/loop_4veh/errors.sumo b/tests/sumo/rail/siding/loop_4veh/errors.sumo new file mode 100644 index 000000000000..85d0e7cc8b4a --- /dev/null +++ b/tests/sumo/rail/siding/loop_4veh/errors.sumo @@ -0,0 +1,2 @@ +Warning: Teleporting vehicle 't1'; waited too long (yield), lane='a_0', time=318.00. +Warning: Vehicle 't1' ends teleporting on edge 'e', time=415.00. diff --git a/tests/sumo/rail/siding/loop_4veh/input_routes.rou.xml b/tests/sumo/rail/siding/loop_4veh/input_routes.rou.xml new file mode 100644 index 000000000000..31eccd652f1a --- /dev/null +++ b/tests/sumo/rail/siding/loop_4veh/input_routes.rou.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/loop_4veh/net.net.xml b/tests/sumo/rail/siding/loop_4veh/net.net.xml new file mode 100644 index 000000000000..2f0045b4ec4b --- /dev/null +++ b/tests/sumo/rail/siding/loop_4veh/net.net.xml @@ -0,0 +1,489 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/loop_4veh/options.sumo b/tests/sumo/rail/siding/loop_4veh/options.sumo new file mode 100644 index 000000000000..aca2e8d18e45 --- /dev/null +++ b/tests/sumo/rail/siding/loop_4veh/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/siding/loop_4veh/output.sumo b/tests/sumo/rail/siding/loop_4veh/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/siding/loop_4veh/railsignalblocks.sumo b/tests/sumo/rail/siding/loop_4veh/railsignalblocks.sumo new file mode 100644 index 000000000000..accdbd64a6d3 --- /dev/null +++ b/tests/sumo/rail/siding/loop_4veh/railsignalblocks.sumo @@ -0,0 +1,259 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/loop_4veh/tripinfos.sumo b/tests/sumo/rail/siding/loop_4veh/tripinfos.sumo new file mode 100644 index 000000000000..a6e9ee955024 --- /dev/null +++ b/tests/sumo/rail/siding/loop_4veh/tripinfos.sumo @@ -0,0 +1,45 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/siding/testsuite.sumo b/tests/sumo/rail/siding/testsuite.sumo index dc3030380977..b9e61e7b5d98 100644 --- a/tests/sumo/rail/siding/testsuite.sumo +++ b/tests/sumo/rail/siding/testsuite.sumo @@ -35,3 +35,6 @@ siding_noSignal2 # a loop that reverses on itself can create a deadlock with 3 vehicles loop_3veh + +# a loop that reverses on itself can create a deadlock with 4 vehicles (2 from either direction) +loop_4veh From ecdd6e30c0308ac63b5956cea0682855dd8ba657 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Mon, 7 Oct 2024 12:40:02 +0200 Subject: [PATCH 258/334] added test refs #7578, #21 --- tests/sumo/rail/siding/loop_4veh2/errors.sumo | 2 + .../siding/loop_4veh2/input_routes.rou.xml | 42 ++ tests/sumo/rail/siding/loop_4veh2/net.net.xml | 489 ++++++++++++++++++ .../sumo/rail/siding/loop_4veh2/options.sumo | 2 + tests/sumo/rail/siding/loop_4veh2/output.sumo | 0 .../siding/loop_4veh2/railsignalblocks.sumo | 259 ++++++++++ .../rail/siding/loop_4veh2/tripinfos.sumo | 45 ++ tests/sumo/rail/siding/testsuite.sumo | 3 + 8 files changed, 842 insertions(+) create mode 100644 tests/sumo/rail/siding/loop_4veh2/errors.sumo create mode 100644 tests/sumo/rail/siding/loop_4veh2/input_routes.rou.xml create mode 100644 tests/sumo/rail/siding/loop_4veh2/net.net.xml create mode 100644 tests/sumo/rail/siding/loop_4veh2/options.sumo create mode 100644 tests/sumo/rail/siding/loop_4veh2/output.sumo create mode 100644 tests/sumo/rail/siding/loop_4veh2/railsignalblocks.sumo create mode 100644 tests/sumo/rail/siding/loop_4veh2/tripinfos.sumo diff --git a/tests/sumo/rail/siding/loop_4veh2/errors.sumo b/tests/sumo/rail/siding/loop_4veh2/errors.sumo new file mode 100644 index 000000000000..85d0e7cc8b4a --- /dev/null +++ b/tests/sumo/rail/siding/loop_4veh2/errors.sumo @@ -0,0 +1,2 @@ +Warning: Teleporting vehicle 't1'; waited too long (yield), lane='a_0', time=318.00. +Warning: Vehicle 't1' ends teleporting on edge 'e', time=415.00. diff --git a/tests/sumo/rail/siding/loop_4veh2/input_routes.rou.xml b/tests/sumo/rail/siding/loop_4veh2/input_routes.rou.xml new file mode 100644 index 000000000000..1490871e263b --- /dev/null +++ b/tests/sumo/rail/siding/loop_4veh2/input_routes.rou.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/loop_4veh2/net.net.xml b/tests/sumo/rail/siding/loop_4veh2/net.net.xml new file mode 100644 index 000000000000..2f0045b4ec4b --- /dev/null +++ b/tests/sumo/rail/siding/loop_4veh2/net.net.xml @@ -0,0 +1,489 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/loop_4veh2/options.sumo b/tests/sumo/rail/siding/loop_4veh2/options.sumo new file mode 100644 index 000000000000..aca2e8d18e45 --- /dev/null +++ b/tests/sumo/rail/siding/loop_4veh2/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/siding/loop_4veh2/output.sumo b/tests/sumo/rail/siding/loop_4veh2/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/siding/loop_4veh2/railsignalblocks.sumo b/tests/sumo/rail/siding/loop_4veh2/railsignalblocks.sumo new file mode 100644 index 000000000000..c21bea32cefb --- /dev/null +++ b/tests/sumo/rail/siding/loop_4veh2/railsignalblocks.sumo @@ -0,0 +1,259 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/loop_4veh2/tripinfos.sumo b/tests/sumo/rail/siding/loop_4veh2/tripinfos.sumo new file mode 100644 index 000000000000..d0902b0bc494 --- /dev/null +++ b/tests/sumo/rail/siding/loop_4veh2/tripinfos.sumo @@ -0,0 +1,45 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/siding/testsuite.sumo b/tests/sumo/rail/siding/testsuite.sumo index b9e61e7b5d98..37e4537a85c8 100644 --- a/tests/sumo/rail/siding/testsuite.sumo +++ b/tests/sumo/rail/siding/testsuite.sumo @@ -38,3 +38,6 @@ loop_3veh # a loop that reverses on itself can create a deadlock with 4 vehicles (2 from either direction) loop_4veh + +# a loop that reverses on itself can create a deadlock with 4 vehicles (2 from either direction), this time with different driveway initialization order +loop_4veh2 From 4d64fbde82930e07dd2a5cd19e21796cbf4004a0 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Mon, 7 Oct 2024 16:42:31 +0200 Subject: [PATCH 259/334] refactoring refs #12 --- src/microsim/traffic_lights/MSDriveWay.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 0c6c00cec9f8..91f847422f8f 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -696,6 +696,7 @@ MSDriveWay::overlap(const MSDriveWay& other) const { return false; } + bool MSDriveWay::flankConflict(const MSDriveWay& other) const { for (const MSLane* lane : myForward) { @@ -1238,9 +1239,7 @@ MSDriveWay::addSwitchFoes(MSLink* link) { myFoes.push_back(foe); } else { #ifdef DEBUG_ADD_FOES - std::cout << " cand=" << foe->myID - << " fc1=" << flankConflict(*foe) << " fc2=" << foe->flankConflict(*this) - << " cc1=" << crossingConflict(*foe) << " cc2=" << foe->crossingConflict(*this) << "\n"; + std::cout << " cand=" << foe->myID << "\n"; #endif } } @@ -1813,10 +1812,11 @@ MSDriveWay::addSidings(MSDriveWay* foe, bool addToFoe) { #ifdef DEBUG_BUILD_SIDINGS std::cout << "endSiding " << getID() << " foe=" << foe->getID() << " i=" << i << " curBidi=" << Named::getIDSecure(cur->getBidiEdge()) << " length=" << length << "\n"; #endif + const int firstIndex = i + 1; if (addToFoe) { auto& foeSidings = foe->mySidings[this]; // indices must be mapped onto foe route; - const MSEdge* first = myRoute[i + 1]; + const MSEdge* first = myRoute[firstIndex]; auto itFirst = std::find(foe->myRoute.begin(), foe->myRoute.end(), first); if (itFirst != foe->myRoute.end()) { const MSEdge* last = myRoute[start]; @@ -1827,7 +1827,7 @@ MSDriveWay::addSidings(MSDriveWay* foe, bool addToFoe) { } } else { auto& foeSidings = mySidings[foe]; - foeSidings.insert(foeSidings.begin(), Siding(i + 1, start, length)); + foeSidings.insert(foeSidings.begin(), Siding(firstIndex, start, length)); } start = -1; length = 0; From 76857aef900263ab37eca03af65fcacafaa931bd Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Mon, 7 Oct 2024 17:18:31 +0200 Subject: [PATCH 260/334] added test refs #7578, #21 --- tests/sumo/rail/siding/loop_4veh3/errors.sumo | 1 + .../siding/loop_4veh3/input_routes.rou.xml | 46 ++ tests/sumo/rail/siding/loop_4veh3/net.net.xml | 489 ++++++++++++++++++ .../sumo/rail/siding/loop_4veh3/options.sumo | 3 + tests/sumo/rail/siding/loop_4veh3/output.sumo | 0 .../siding/loop_4veh3/railsignalblocks.sumo | 135 +++++ .../rail/siding/loop_4veh3/tripinfos.sumo | 46 ++ tests/sumo/rail/siding/testsuite.sumo | 3 + 8 files changed, 723 insertions(+) create mode 100644 tests/sumo/rail/siding/loop_4veh3/errors.sumo create mode 100644 tests/sumo/rail/siding/loop_4veh3/input_routes.rou.xml create mode 100644 tests/sumo/rail/siding/loop_4veh3/net.net.xml create mode 100644 tests/sumo/rail/siding/loop_4veh3/options.sumo create mode 100644 tests/sumo/rail/siding/loop_4veh3/output.sumo create mode 100644 tests/sumo/rail/siding/loop_4veh3/railsignalblocks.sumo create mode 100644 tests/sumo/rail/siding/loop_4veh3/tripinfos.sumo diff --git a/tests/sumo/rail/siding/loop_4veh3/errors.sumo b/tests/sumo/rail/siding/loop_4veh3/errors.sumo new file mode 100644 index 000000000000..0e5d0af080c4 --- /dev/null +++ b/tests/sumo/rail/siding/loop_4veh3/errors.sumo @@ -0,0 +1 @@ +Warning: Vehicle 't1'; collision with vehicle 't3', lane='-i2_0', gap=-1.00, time=255.00 stage=move. diff --git a/tests/sumo/rail/siding/loop_4veh3/input_routes.rou.xml b/tests/sumo/rail/siding/loop_4veh3/input_routes.rou.xml new file mode 100644 index 000000000000..192936e07187 --- /dev/null +++ b/tests/sumo/rail/siding/loop_4veh3/input_routes.rou.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/loop_4veh3/net.net.xml b/tests/sumo/rail/siding/loop_4veh3/net.net.xml new file mode 100644 index 000000000000..2f0045b4ec4b --- /dev/null +++ b/tests/sumo/rail/siding/loop_4veh3/net.net.xml @@ -0,0 +1,489 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/loop_4veh3/options.sumo b/tests/sumo/rail/siding/loop_4veh3/options.sumo new file mode 100644 index 000000000000..acc06781c620 --- /dev/null +++ b/tests/sumo/rail/siding/loop_4veh3/options.sumo @@ -0,0 +1,3 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml +--collision.action warn diff --git a/tests/sumo/rail/siding/loop_4veh3/output.sumo b/tests/sumo/rail/siding/loop_4veh3/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/siding/loop_4veh3/railsignalblocks.sumo b/tests/sumo/rail/siding/loop_4veh3/railsignalblocks.sumo new file mode 100644 index 000000000000..0bc8b3f3b28f --- /dev/null +++ b/tests/sumo/rail/siding/loop_4veh3/railsignalblocks.sumo @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/loop_4veh3/tripinfos.sumo b/tests/sumo/rail/siding/loop_4veh3/tripinfos.sumo new file mode 100644 index 000000000000..93a6b4f6ed33 --- /dev/null +++ b/tests/sumo/rail/siding/loop_4veh3/tripinfos.sumo @@ -0,0 +1,46 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/siding/testsuite.sumo b/tests/sumo/rail/siding/testsuite.sumo index 37e4537a85c8..5c7be90ea813 100644 --- a/tests/sumo/rail/siding/testsuite.sumo +++ b/tests/sumo/rail/siding/testsuite.sumo @@ -41,3 +41,6 @@ loop_4veh # a loop that reverses on itself can create a deadlock with 4 vehicles (2 from either direction), this time with different driveway initialization order loop_4veh2 + +# collision (caused by rail-signal triggered rerouting) +loop_4veh3 From ff2d6b3dc87536931b97393949d3a668dc4f8eb5 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Mon, 7 Oct 2024 17:25:50 +0200 Subject: [PATCH 261/334] added test refs #7578, #21 --- .../rail/siding/siding_deadlock2/errors.sumo | 6 + .../siding_deadlock2/input_routes.rou.xml | 47 ++++ .../rail/siding/siding_deadlock2/net.net.xml | 236 ++++++++++++++++++ .../rail/siding/siding_deadlock2/options.sumo | 3 + .../rail/siding/siding_deadlock2/output.sumo | 0 .../siding_deadlock2/railsignalblocks.sumo | 203 +++++++++++++++ .../siding/siding_deadlock2/tripinfos.sumo | 46 ++++ tests/sumo/rail/siding/testsuite.sumo | 3 + 8 files changed, 544 insertions(+) create mode 100644 tests/sumo/rail/siding/siding_deadlock2/errors.sumo create mode 100644 tests/sumo/rail/siding/siding_deadlock2/input_routes.rou.xml create mode 100644 tests/sumo/rail/siding/siding_deadlock2/net.net.xml create mode 100644 tests/sumo/rail/siding/siding_deadlock2/options.sumo create mode 100644 tests/sumo/rail/siding/siding_deadlock2/output.sumo create mode 100644 tests/sumo/rail/siding/siding_deadlock2/railsignalblocks.sumo create mode 100644 tests/sumo/rail/siding/siding_deadlock2/tripinfos.sumo diff --git a/tests/sumo/rail/siding/siding_deadlock2/errors.sumo b/tests/sumo/rail/siding/siding_deadlock2/errors.sumo new file mode 100644 index 000000000000..5e823aa13788 --- /dev/null +++ b/tests/sumo/rail/siding/siding_deadlock2/errors.sumo @@ -0,0 +1,6 @@ +Warning: Teleporting vehicle 't0'; waited too long (yield), lane='d_0', time=330.00. +Warning: Teleporting vehicle 't3'; waited too long (yield), lane='-g_0', time=330.00. +Warning: Teleporting vehicle 't2'; waited too long (yield), lane='a_0', time=330.00. +Warning: Vehicle 't0' ends teleporting on edge 'e', time=330.00. +Warning: Vehicle 't2' ends teleporting on edge 'b', time=330.00. +Warning: Vehicle 't3' ends teleporting on edge '-d2', time=350.00. diff --git a/tests/sumo/rail/siding/siding_deadlock2/input_routes.rou.xml b/tests/sumo/rail/siding/siding_deadlock2/input_routes.rou.xml new file mode 100644 index 000000000000..e0ff9ebb3792 --- /dev/null +++ b/tests/sumo/rail/siding/siding_deadlock2/input_routes.rou.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/siding_deadlock2/net.net.xml b/tests/sumo/rail/siding/siding_deadlock2/net.net.xml new file mode 100644 index 000000000000..0ddc5c773058 --- /dev/null +++ b/tests/sumo/rail/siding/siding_deadlock2/net.net.xml @@ -0,0 +1,236 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/siding_deadlock2/options.sumo b/tests/sumo/rail/siding/siding_deadlock2/options.sumo new file mode 100644 index 000000000000..acc06781c620 --- /dev/null +++ b/tests/sumo/rail/siding/siding_deadlock2/options.sumo @@ -0,0 +1,3 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml +--collision.action warn diff --git a/tests/sumo/rail/siding/siding_deadlock2/output.sumo b/tests/sumo/rail/siding/siding_deadlock2/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/siding/siding_deadlock2/railsignalblocks.sumo b/tests/sumo/rail/siding/siding_deadlock2/railsignalblocks.sumo new file mode 100644 index 000000000000..7a2ff72055f5 --- /dev/null +++ b/tests/sumo/rail/siding/siding_deadlock2/railsignalblocks.sumo @@ -0,0 +1,203 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/siding_deadlock2/tripinfos.sumo b/tests/sumo/rail/siding/siding_deadlock2/tripinfos.sumo new file mode 100644 index 000000000000..c93e3ec8a926 --- /dev/null +++ b/tests/sumo/rail/siding/siding_deadlock2/tripinfos.sumo @@ -0,0 +1,46 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/siding/testsuite.sumo b/tests/sumo/rail/siding/testsuite.sumo index 5c7be90ea813..d71d6bfbcbbb 100644 --- a/tests/sumo/rail/siding/testsuite.sumo +++ b/tests/sumo/rail/siding/testsuite.sumo @@ -21,6 +21,9 @@ siding_both_ways4 # siding cannot be used because it is already occupied siding_deadlock +# siding cannot be used because it is already occupied, vehicle routes start or end in the siding +siding_deadlock2 + # driveway should be usable despite occupied siding if the other side is still usable siding_occupied_advance From 401b571b4efc17a79e35e1edc9904fd2ef9ca56c Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Mon, 7 Oct 2024 22:16:57 +0200 Subject: [PATCH 262/334] added test refs #7578, #21 --- tests/sumo/rail/siding/testsuite.sumo | 3 + .../rail/siding/triangle_6veh/errors.sumo | 9 + .../siding/triangle_6veh/input_routes.rou.xml | 53 +++ .../rail/siding/triangle_6veh/net.net.xml | 281 ++++++++++++++ .../rail/siding/triangle_6veh/options.sumo | 3 + .../rail/siding/triangle_6veh/output.sumo | 0 .../triangle_6veh/railsignalblocks.sumo | 354 ++++++++++++++++++ .../rail/siding/triangle_6veh/tripinfos.sumo | 48 +++ 8 files changed, 751 insertions(+) create mode 100644 tests/sumo/rail/siding/triangle_6veh/errors.sumo create mode 100644 tests/sumo/rail/siding/triangle_6veh/input_routes.rou.xml create mode 100644 tests/sumo/rail/siding/triangle_6veh/net.net.xml create mode 100644 tests/sumo/rail/siding/triangle_6veh/options.sumo create mode 100644 tests/sumo/rail/siding/triangle_6veh/output.sumo create mode 100644 tests/sumo/rail/siding/triangle_6veh/railsignalblocks.sumo create mode 100644 tests/sumo/rail/siding/triangle_6veh/tripinfos.sumo diff --git a/tests/sumo/rail/siding/testsuite.sumo b/tests/sumo/rail/siding/testsuite.sumo index d71d6bfbcbbb..8ca346d188d8 100644 --- a/tests/sumo/rail/siding/testsuite.sumo +++ b/tests/sumo/rail/siding/testsuite.sumo @@ -47,3 +47,6 @@ loop_4veh2 # collision (caused by rail-signal triggered rerouting) loop_4veh3 + +# deadlock +triangle_6veh diff --git a/tests/sumo/rail/siding/triangle_6veh/errors.sumo b/tests/sumo/rail/siding/triangle_6veh/errors.sumo new file mode 100644 index 000000000000..18a01fb911ad --- /dev/null +++ b/tests/sumo/rail/siding/triangle_6veh/errors.sumo @@ -0,0 +1,9 @@ +Warning: Teleporting vehicle 't5'; waited too long (yield), lane='-a2_0', time=318.00. +Warning: Teleporting vehicle 't3'; waited too long (yield), lane='-f_0', time=318.00. +Warning: Teleporting vehicle 't1'; waited too long (yield), lane='a_0', time=318.00. +Warning: Vehicle 't1' skips stop on lane 'c_0' time=334.00. +Warning: Vehicle 't3' skips stop on lane 'd2_0' time=334.00. +Warning: Vehicle 't5' skips stop on lane 'c3_0' time=334.00. +Warning: Vehicle 't1' ends teleporting on edge 'f', time=367.00. +Warning: Vehicle 't3' ends teleporting on edge 'a2', time=370.00. +Warning: Vehicle 't5' ends teleporting on edge '-a', time=370.00. diff --git a/tests/sumo/rail/siding/triangle_6veh/input_routes.rou.xml b/tests/sumo/rail/siding/triangle_6veh/input_routes.rou.xml new file mode 100644 index 000000000000..a5da10cb8cc9 --- /dev/null +++ b/tests/sumo/rail/siding/triangle_6veh/input_routes.rou.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/triangle_6veh/net.net.xml b/tests/sumo/rail/siding/triangle_6veh/net.net.xml new file mode 100644 index 000000000000..886a278f9152 --- /dev/null +++ b/tests/sumo/rail/siding/triangle_6veh/net.net.xml @@ -0,0 +1,281 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/triangle_6veh/options.sumo b/tests/sumo/rail/siding/triangle_6veh/options.sumo new file mode 100644 index 000000000000..acc06781c620 --- /dev/null +++ b/tests/sumo/rail/siding/triangle_6veh/options.sumo @@ -0,0 +1,3 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml +--collision.action warn diff --git a/tests/sumo/rail/siding/triangle_6veh/output.sumo b/tests/sumo/rail/siding/triangle_6veh/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/siding/triangle_6veh/railsignalblocks.sumo b/tests/sumo/rail/siding/triangle_6veh/railsignalblocks.sumo new file mode 100644 index 000000000000..3445efb9c4b9 --- /dev/null +++ b/tests/sumo/rail/siding/triangle_6veh/railsignalblocks.sumo @@ -0,0 +1,354 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/triangle_6veh/tripinfos.sumo b/tests/sumo/rail/siding/triangle_6veh/tripinfos.sumo new file mode 100644 index 000000000000..4ed22dc82b43 --- /dev/null +++ b/tests/sumo/rail/siding/triangle_6veh/tripinfos.sumo @@ -0,0 +1,48 @@ + + + + + + + + + + + + From 9f0eaa86dc76544066b25eeee61b7ac01bea432c Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 8 Oct 2024 08:28:22 +0200 Subject: [PATCH 263/334] added test refs #7578, #21 --- .../sumo/rail/siding/circle_3veh/errors.sumo | 4 + .../siding/circle_3veh/input_routes.rou.xml | 38 ++++++ .../sumo/rail/siding/circle_3veh/net.net.xml | 77 +++++++++++++ .../sumo/rail/siding/circle_3veh/options.sumo | 2 + .../sumo/rail/siding/circle_3veh/output.sumo | 0 .../siding/circle_3veh/railsignalblocks.sumo | 108 ++++++++++++++++++ .../rail/siding/circle_3veh/tripinfos.sumo | 44 +++++++ tests/sumo/rail/siding/testsuite.sumo | 3 + 8 files changed, 276 insertions(+) create mode 100644 tests/sumo/rail/siding/circle_3veh/errors.sumo create mode 100644 tests/sumo/rail/siding/circle_3veh/input_routes.rou.xml create mode 100644 tests/sumo/rail/siding/circle_3veh/net.net.xml create mode 100644 tests/sumo/rail/siding/circle_3veh/options.sumo create mode 100644 tests/sumo/rail/siding/circle_3veh/output.sumo create mode 100644 tests/sumo/rail/siding/circle_3veh/railsignalblocks.sumo create mode 100644 tests/sumo/rail/siding/circle_3veh/tripinfos.sumo diff --git a/tests/sumo/rail/siding/circle_3veh/errors.sumo b/tests/sumo/rail/siding/circle_3veh/errors.sumo new file mode 100644 index 000000000000..4e8fd75e8bd5 --- /dev/null +++ b/tests/sumo/rail/siding/circle_3veh/errors.sumo @@ -0,0 +1,4 @@ +Warning: Teleporting vehicle 't2'; waited too long (yield), lane='c_0', time=343.00. +Warning: Teleporting vehicle 't0'; waited too long (yield), lane='a_0', time=357.00. +Warning: Vehicle 't2' ends teleporting on edge 'a', time=357.00. +Warning: Vehicle 't0' ends teleporting on edge 'b', time=363.00. diff --git a/tests/sumo/rail/siding/circle_3veh/input_routes.rou.xml b/tests/sumo/rail/siding/circle_3veh/input_routes.rou.xml new file mode 100644 index 000000000000..39684102432d --- /dev/null +++ b/tests/sumo/rail/siding/circle_3veh/input_routes.rou.xml @@ -0,0 +1,38 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/siding/circle_3veh/net.net.xml b/tests/sumo/rail/siding/circle_3veh/net.net.xml new file mode 100644 index 000000000000..ebed5ce0e562 --- /dev/null +++ b/tests/sumo/rail/siding/circle_3veh/net.net.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/circle_3veh/options.sumo b/tests/sumo/rail/siding/circle_3veh/options.sumo new file mode 100644 index 000000000000..aca2e8d18e45 --- /dev/null +++ b/tests/sumo/rail/siding/circle_3veh/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/siding/circle_3veh/output.sumo b/tests/sumo/rail/siding/circle_3veh/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/siding/circle_3veh/railsignalblocks.sumo b/tests/sumo/rail/siding/circle_3veh/railsignalblocks.sumo new file mode 100644 index 000000000000..f20ba8b9c241 --- /dev/null +++ b/tests/sumo/rail/siding/circle_3veh/railsignalblocks.sumo @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/circle_3veh/tripinfos.sumo b/tests/sumo/rail/siding/circle_3veh/tripinfos.sumo new file mode 100644 index 000000000000..648a45c855d1 --- /dev/null +++ b/tests/sumo/rail/siding/circle_3veh/tripinfos.sumo @@ -0,0 +1,44 @@ + + + + + + + + + diff --git a/tests/sumo/rail/siding/testsuite.sumo b/tests/sumo/rail/siding/testsuite.sumo index 8ca346d188d8..f5549f91fa48 100644 --- a/tests/sumo/rail/siding/testsuite.sumo +++ b/tests/sumo/rail/siding/testsuite.sumo @@ -50,3 +50,6 @@ loop_4veh3 # deadlock triangle_6veh + +# deadlock +circle_3veh From 100cba2e7196b648604247643643ae36a149cf20 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 9 Oct 2024 10:00:58 +0200 Subject: [PATCH 264/334] implemented deadlock detection and reporting. refs #15561 --- src/microsim/MSFrame.cpp | 8 ++++ src/microsim/MSGlobals.cpp | 1 + src/microsim/MSGlobals.h | 3 ++ src/microsim/MSLane.cpp | 8 +++- src/microsim/MSNet.cpp | 3 ++ src/microsim/traffic_lights/MSDriveWay.cpp | 5 +++ .../traffic_lights/MSRailSignalControl.cpp | 41 +++++++++++++++++++ .../traffic_lights/MSRailSignalControl.h | 16 ++++++++ 8 files changed, 83 insertions(+), 2 deletions(-) diff --git a/src/microsim/MSFrame.cpp b/src/microsim/MSFrame.cpp index 9af72ed4cd7d..c6cdc3f70919 100644 --- a/src/microsim/MSFrame.cpp +++ b/src/microsim/MSFrame.cpp @@ -313,6 +313,9 @@ MSFrame::fillOptions() { oc.addSynonyme("statistic-output", "statistics-output"); oc.addDescription("statistic-output", "Output", TL("Write overall statistics into FILE")); + oc.doRegister("deadlock-output", new Option_FileName()); + oc.addDescription("deadlock-output", "Output", TL("Write reports on deadlocks FILE")); + #ifdef _DEBUG oc.doRegister("movereminder-output", new Option_FileName()); oc.addDescription("movereminder-output", "Output", TL("Save movereminder states of selected vehicles into FILE")); @@ -439,6 +442,9 @@ MSFrame::fillOptions() { oc.doRegister("time-to-teleport.bidi", new Option_String("-1", "TIME")); oc.addDescription("time-to-teleport.bidi", "Processing", TL("The waiting time after which vehicles on bidirectional edges are teleported")); + oc.doRegister("time-to-teleport.railsignal-deadlock", new Option_String("-1", "TIME")); + oc.addDescription("time-to-teleport.railsignal-deadlock", "Processing", TL("The waiting time after which vehicles in a rail-signal based deadlock are teleported")); + oc.doRegister("waiting-time-memory", new Option_String("100", "TIME")); oc.addDescription("waiting-time-memory", "Processing", TL("Length of time interval, over which accumulated waiting time is taken into account (default is 100s.)")); @@ -834,6 +840,7 @@ MSFrame::buildStreams() { OutputDevice::createDeviceByOption("stop-output", "stops", "stopinfo_file.xsd"); OutputDevice::createDeviceByOption("collision-output", "collisions", "collision_file.xsd"); OutputDevice::createDeviceByOption("statistic-output", "statistics", "statistic_file.xsd"); + OutputDevice::createDeviceByOption("deadlock-output", "additional", "additional_file.xsd"); #ifdef _DEBUG OutputDevice::createDeviceByOption("movereminder-output", "movereminder-output"); @@ -1061,6 +1068,7 @@ MSFrame::setMSGlobals(OptionsCont& oc) { MSGlobals::gGridlockHighwaysSpeed = oc.getFloat("time-to-teleport.highways.min-speed"); MSGlobals::gTimeToTeleportDisconnected = string2time(oc.getString("time-to-teleport.disconnected")); MSGlobals::gTimeToTeleportBidi = string2time(oc.getString("time-to-teleport.bidi")); + MSGlobals::gTimeToTeleportRSDeadlock = string2time(oc.getString("time-to-teleport.railsignal-deadlock")); MSGlobals::gRemoveGridlocked = oc.getBool("time-to-teleport.remove"); MSGlobals::gCheck4Accidents = !oc.getBool("ignore-accidents"); MSGlobals::gCheckRoutes = !oc.getBool("ignore-route-errors"); diff --git a/src/microsim/MSGlobals.cpp b/src/microsim/MSGlobals.cpp index e03f900a47fb..4f796728b7a0 100644 --- a/src/microsim/MSGlobals.cpp +++ b/src/microsim/MSGlobals.cpp @@ -37,6 +37,7 @@ SUMOTime MSGlobals::gTimeToGridlockHighways; double MSGlobals::gGridlockHighwaysSpeed; SUMOTime MSGlobals::gTimeToTeleportDisconnected; SUMOTime MSGlobals::gTimeToTeleportBidi; +SUMOTime MSGlobals::gTimeToTeleportRSDeadlock; bool MSGlobals::gRemoveGridlocked; SUMOTime MSGlobals::gTimeToImpatience; diff --git a/src/microsim/MSGlobals.h b/src/microsim/MSGlobals.h index 1da2cf7258e7..37c8965771db 100644 --- a/src/microsim/MSGlobals.h +++ b/src/microsim/MSGlobals.h @@ -68,6 +68,9 @@ class MSGlobals { /** The time to wait for teleport on bidi edges */ static SUMOTime gTimeToTeleportBidi; + /** The time to wait for teleport when rail signals cause deadlock */ + static SUMOTime gTimeToTeleportRSDeadlock; + /** Whether gridlocked vehicles shall be removed instead of teleporting */ static bool gRemoveGridlocked; diff --git a/src/microsim/MSLane.cpp b/src/microsim/MSLane.cpp index 7cf84d4f22ed..a8460dabaa66 100644 --- a/src/microsim/MSLane.cpp +++ b/src/microsim/MSLane.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -2294,7 +2295,7 @@ MSLane::executeMovements(const SUMOTime t) { if (firstNotStopped != nullptr) { const SUMOTime ttt = firstNotStopped->getVehicleType().getParameter().getTimeToTeleport(MSGlobals::gTimeToGridlock); const SUMOTime tttb = firstNotStopped->getVehicleType().getParameter().getTimeToTeleportBidi(MSGlobals::gTimeToTeleportBidi); - if (ttt > 0 || MSGlobals::gTimeToGridlockHighways > 0 || MSGlobals::gTimeToTeleportDisconnected >= 0 || tttb > 0) { + if (ttt > 0 || MSGlobals::gTimeToGridlockHighways > 0 || MSGlobals::gTimeToTeleportDisconnected >= 0 || tttb > 0 || MSGlobals::gTimeToTeleportRSDeadlock > 0) { const bool wrongLane = !appropriate(firstNotStopped); const bool r1 = ttt > 0 && firstNotStopped->getWaitingTime() > ttt; const bool r2 = !r1 && MSGlobals::gTimeToGridlockHighways > 0 @@ -2305,7 +2306,9 @@ MSLane::executeMovements(const SUMOTime t) { && firstNotStopped->getEdge()->allowedLanes(*firstNotStopped->succEdge(1), firstNotStopped->getVClass()) == nullptr; const bool r4 = !r1 && !r2 && !r3 && tttb > 0 && firstNotStopped->getWaitingTime() > tttb && getBidiLane(); - if (r1 || r2 || r3 || r4) { + const bool r5 = MSGlobals::gTimeToTeleportRSDeadlock > 0 && MSRailSignalControl::hasInstance() && !r1 && !r2 && !r3 && !r4 + && firstNotStopped->getWaitingTime() > MSGlobals::gTimeToTeleportRSDeadlock && MSRailSignalControl::getInstance().haveDeadlock(firstNotStopped); + if (r1 || r2 || r3 || r4 || r5) { const std::vector::const_iterator link = succLinkSec(*firstNotStopped, 1, *this, firstNotStopped->getBestLanesContinuation()); const bool minorLink = !wrongLane && (link != myLinks.end()) && !((*link)->havePriority()); std::string reason = (wrongLane ? " (wrong lane" : (minorLink ? " (yield" : " (jam")); @@ -2321,6 +2324,7 @@ MSLane::executeMovements(const SUMOTime t) { + (r2 ? ", highway" : "") + (r3 ? ", disconnected" : "") + (r4 ? ", bidi" : "") + + (r5 ? ", railSignal" : "") + "), lane='%', time=%.", firstNotStopped->getID(), getID(), time2string(t)); if (wrongLane) { MSNet::getInstance()->getVehicleControl().registerTeleportWrongLane(); diff --git a/src/microsim/MSNet.cpp b/src/microsim/MSNet.cpp index 1d932178b5a1..916d7569e6da 100644 --- a/src/microsim/MSNet.cpp +++ b/src/microsim/MSNet.cpp @@ -760,6 +760,9 @@ MSNet::simulationStep(const bool onlyMove) { myPeriodicStateFiles.erase(myPeriodicStateFiles.begin()); } } + if (MSRailSignalControl::hasInstance()) { + MSRailSignalControl::getInstance().resetWaitRelations(); + } myBeginOfTimestepEvents->execute(myStep); if (MSRailSignalControl::hasInstance()) { MSRailSignalControl::getInstance().recheckGreen(); diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 91f847422f8f..2a8c34e40e4b 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -510,6 +510,11 @@ MSDriveWay::foeDriveWayOccupied(bool store, const SUMOVehicle* ego, MSEdgeVector } /// @todo: if foe occupies more than one edge we should add all of them to the occupied vector } + if (ego != nullptr && myOrigin != nullptr && MSGlobals::gTimeToTeleportRSDeadlock > 0 + && ego->getWaitingTime() > ego->getVehicleType().getCarFollowModel().getStartupDelay()) { + SUMOVehicle* foe = *foeDW->myTrains.begin(); + MSRailSignalControl::getInstance().addWaitRelation(ego, dynamic_cast(myOrigin->getTLLogic()), foe); + } return true; } } else if (foeDW != this && isDepartDriveway() && !foeDW->isDepartDriveway()) { diff --git a/src/microsim/traffic_lights/MSRailSignalControl.cpp b/src/microsim/traffic_lights/MSRailSignalControl.cpp index ba0cf9c9f74b..14d730a21e0e 100644 --- a/src/microsim/traffic_lights/MSRailSignalControl.cpp +++ b/src/microsim/traffic_lights/MSRailSignalControl.cpp @@ -197,4 +197,45 @@ MSRailSignalControl::recheckGreen() { } +bool +MSRailSignalControl::haveDeadlock(const SUMOVehicle* veh) const { + std::set seen; + std::vector > list; + const SUMOVehicle* cur = veh; + while (seen.count(cur) == 0) { + auto it = myWaitRelations.find(cur); + if (it != myWaitRelations.end()) { + seen.insert(cur); + list.push_back(it->second); + cur = it->second.second; + } else { + return false; + } + } + if (cur == veh) { + if (OptionsCont::getOptions().isSet("deadlock-output")) { + if (myWrittenDeadlocks.count(seen) == 0) { + myWrittenDeadlocks.insert(seen); + std::vector signals; + std::vector vehicles; + for (auto item : list) { + signals.push_back(item.first->getID()); + vehicles.push_back(item.second->getID()); + } + OutputDevice& od = OutputDevice::getDeviceByOption("deadlock-output"); + od.openTag("deadlock"); + od.writeAttr(SUMO_ATTR_TIME, time2string(SIMSTEP)); + od.writeAttr(SUMO_ATTR_SIGNALS, signals); + od.writeAttr("vehicles", vehicles); + od.closeTag(); + } + } + return true; + } else { + // it's a deadlock but does not involve veh + return false; + } +} + + /****************************************************************************/ diff --git a/src/microsim/traffic_lights/MSRailSignalControl.h b/src/microsim/traffic_lights/MSRailSignalControl.h index d4f7e8e3bae2..f49051aeb734 100644 --- a/src/microsim/traffic_lights/MSRailSignalControl.h +++ b/src/microsim/traffic_lights/MSRailSignalControl.h @@ -50,6 +50,19 @@ class MSRailSignalControl : public MSNet::VehicleStateListener { /** @brief Perform resets events when quick-loading state */ static void clearState(); + /// @brief reset all waiting-for relationships at the start of the simulation step + void resetWaitRelations() { + myWaitRelations.clear(); + myWrittenDeadlocks.clear(); + } + + void addWaitRelation(const SUMOVehicle* waits, const MSRailSignal* rs, SUMOVehicle* reason) { + myWaitRelations[waits] = std::make_pair(rs, reason); + } + + /// @brief whether there is a circle in the waiting-for relationships that contains the given vehicle + bool haveDeadlock(const SUMOVehicle* veh) const; + /** @brief Called if a vehicle changes its state * @param[in] vehicle The vehicle which changed its state * @param[in] to The state the vehicle has changed to @@ -99,6 +112,9 @@ class MSRailSignalControl : public MSNet::VehicleStateListener { /// @brief map of driveways that must perform additional checks if the key edge is used by a train route std::map > myProtectedDriveways; + std::map > myWaitRelations; + mutable std::set > myWrittenDeadlocks; + /// @brief list of all rail signals std::vector mySignals; From 64e0cbae2ae6f6c6484c59feb783adfc7f6d0311 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 9 Oct 2024 10:01:17 +0200 Subject: [PATCH 265/334] patching expected results refs #21, #15561 --- tests/sumo/config.sumo | 2 + tests/sumo/meta/help/output.sumo | 6 ++- tests/sumo/meta/write_schema/cfg.sumo | 4 +- .../write_template_commented_full/cfg.sumo | 8 +++- tests/sumo/meta/write_template_full/cfg.sumo | 4 +- tests/sumo/rail/options.sumo | 1 + .../rail/siding/circle_3veh/deadlocks.sumo | 44 ++++++++++++++++++ .../sumo/rail/siding/circle_3veh/errors.sumo | 6 +-- .../rail/siding/circle_3veh/tripinfos.sumo | 10 +++-- .../sumo/rail/siding/loop_3veh/deadlocks.sumo | 43 ++++++++++++++++++ .../sumo/rail/siding/loop_4veh/deadlocks.sumo | 44 ++++++++++++++++++ tests/sumo/rail/siding/loop_4veh/errors.sumo | 4 +- .../sumo/rail/siding/loop_4veh/tripinfos.sumo | 12 ++--- .../rail/siding/loop_4veh2/deadlocks.sumo | 44 ++++++++++++++++++ tests/sumo/rail/siding/loop_4veh2/errors.sumo | 4 +- .../rail/siding/loop_4veh2/tripinfos.sumo | 12 ++--- .../rail/siding/loop_4veh3/deadlocks.sumo | 44 ++++++++++++++++++ tests/sumo/rail/siding/options.sumo | 1 + .../sidingShort_deadlock/deadlocks.sumo | 43 ++++++++++++++++++ .../siding/siding_both_ways/deadlocks.sumo | 43 ++++++++++++++++++ .../siding/siding_both_ways2/deadlocks.sumo | 43 ++++++++++++++++++ .../siding/siding_both_ways3/deadlocks.sumo | 43 ++++++++++++++++++ .../siding/siding_both_ways4/deadlocks.sumo | 43 ++++++++++++++++++ .../siding_both_ways_addTrain/deadlocks.sumo | 43 ++++++++++++++++++ .../siding/siding_deadlock/deadlocks.sumo | 43 ++++++++++++++++++ .../siding/siding_deadlock2/deadlocks.sumo | 45 +++++++++++++++++++ .../rail/siding/siding_deadlock2/errors.sumo | 12 ++--- .../siding/siding_deadlock2/tripinfos.sumo | 11 ++--- .../siding/siding_noSignal/deadlocks.sumo | 43 ++++++++++++++++++ .../siding/siding_noSignal2/deadlocks.sumo | 43 ++++++++++++++++++ .../siding_occupied_advance/deadlocks.sumo | 43 ++++++++++++++++++ .../rail/siding/triangle_6veh/deadlocks.sumo | 45 +++++++++++++++++++ .../rail/siding/triangle_6veh/errors.sumo | 18 ++++---- .../rail/siding/triangle_6veh/tripinfos.sumo | 15 ++++--- 34 files changed, 816 insertions(+), 53 deletions(-) create mode 100644 tests/sumo/rail/siding/circle_3veh/deadlocks.sumo create mode 100644 tests/sumo/rail/siding/loop_3veh/deadlocks.sumo create mode 100644 tests/sumo/rail/siding/loop_4veh/deadlocks.sumo create mode 100644 tests/sumo/rail/siding/loop_4veh2/deadlocks.sumo create mode 100644 tests/sumo/rail/siding/loop_4veh3/deadlocks.sumo create mode 100644 tests/sumo/rail/siding/options.sumo create mode 100644 tests/sumo/rail/siding/sidingShort_deadlock/deadlocks.sumo create mode 100644 tests/sumo/rail/siding/siding_both_ways/deadlocks.sumo create mode 100644 tests/sumo/rail/siding/siding_both_ways2/deadlocks.sumo create mode 100644 tests/sumo/rail/siding/siding_both_ways3/deadlocks.sumo create mode 100644 tests/sumo/rail/siding/siding_both_ways4/deadlocks.sumo create mode 100644 tests/sumo/rail/siding/siding_both_ways_addTrain/deadlocks.sumo create mode 100644 tests/sumo/rail/siding/siding_deadlock/deadlocks.sumo create mode 100644 tests/sumo/rail/siding/siding_deadlock2/deadlocks.sumo create mode 100644 tests/sumo/rail/siding/siding_noSignal/deadlocks.sumo create mode 100644 tests/sumo/rail/siding/siding_noSignal2/deadlocks.sumo create mode 100644 tests/sumo/rail/siding/siding_occupied_advance/deadlocks.sumo create mode 100644 tests/sumo/rail/siding/triangle_6veh/deadlocks.sumo diff --git a/tests/sumo/config.sumo b/tests/sumo/config.sumo index 5735487adcfd..077bcfc7257d 100644 --- a/tests/sumo/config.sumo +++ b/tests/sumo/config.sumo @@ -99,6 +99,7 @@ tripinfosPrefix:pre_tripinfos.xml logPrefixed:pre_log.txt weights:weights.xml lanechanges:lanechanges.xml +deadlocks:deadlocks.xml ssm:ssm.xml ssm2:ssm_ego.xml png:out.png @@ -200,6 +201,7 @@ cfg:JuPedSim cfg:^$ weights: lanechanges: +deadlocks: ps:%%CreationDate ps2:%%CreationDate statistic: - @@ -128,6 +128,7 @@ + @@ -182,6 +183,7 @@ + diff --git a/tests/sumo/meta/write_template_commented_full/cfg.sumo b/tests/sumo/meta/write_template_commented_full/cfg.sumo index 1b64c5d4c14a..a2316f372c1f 100644 --- a/tests/sumo/meta/write_template_commented_full/cfg.sumo +++ b/tests/sumo/meta/write_template_commented_full/cfg.sumo @@ -1,6 +1,6 @@ - @@ -276,6 +276,9 @@ + + + @@ -414,6 +417,9 @@ + + + diff --git a/tests/sumo/meta/write_template_full/cfg.sumo b/tests/sumo/meta/write_template_full/cfg.sumo index 989befe46ae2..ab13dd4fcb01 100644 --- a/tests/sumo/meta/write_template_full/cfg.sumo +++ b/tests/sumo/meta/write_template_full/cfg.sumo @@ -1,6 +1,6 @@ - @@ -100,6 +100,7 @@ + @@ -150,6 +151,7 @@ + diff --git a/tests/sumo/rail/options.sumo b/tests/sumo/rail/options.sumo index 82332c304f02..8c15a2cae28f 100644 --- a/tests/sumo/rail/options.sumo +++ b/tests/sumo/rail/options.sumo @@ -1 +1,2 @@ --railsignal-block-output railsignal_blocks.xml +--time-to-teleport.railsignal-deadlock 200 diff --git a/tests/sumo/rail/siding/circle_3veh/deadlocks.sumo b/tests/sumo/rail/siding/circle_3veh/deadlocks.sumo new file mode 100644 index 000000000000..46822fac95ed --- /dev/null +++ b/tests/sumo/rail/siding/circle_3veh/deadlocks.sumo @@ -0,0 +1,44 @@ + + + + + + + diff --git a/tests/sumo/rail/siding/circle_3veh/errors.sumo b/tests/sumo/rail/siding/circle_3veh/errors.sumo index 4e8fd75e8bd5..d1cefa5db6cf 100644 --- a/tests/sumo/rail/siding/circle_3veh/errors.sumo +++ b/tests/sumo/rail/siding/circle_3veh/errors.sumo @@ -1,4 +1,2 @@ -Warning: Teleporting vehicle 't2'; waited too long (yield), lane='c_0', time=343.00. -Warning: Teleporting vehicle 't0'; waited too long (yield), lane='a_0', time=357.00. -Warning: Vehicle 't2' ends teleporting on edge 'a', time=357.00. -Warning: Vehicle 't0' ends teleporting on edge 'b', time=363.00. +Warning: Teleporting vehicle 't2'; waited too long (yield, railSignal), lane='c_0', time=243.00. +Warning: Vehicle 't2' ends teleporting on edge 'a', time=283.00. diff --git a/tests/sumo/rail/siding/circle_3veh/tripinfos.sumo b/tests/sumo/rail/siding/circle_3veh/tripinfos.sumo index 648a45c855d1..e1afbb7b37ee 100644 --- a/tests/sumo/rail/siding/circle_3veh/tripinfos.sumo +++ b/tests/sumo/rail/siding/circle_3veh/tripinfos.sumo @@ -1,6 +1,6 @@ - - - - + + + diff --git a/tests/sumo/rail/siding/loop_3veh/deadlocks.sumo b/tests/sumo/rail/siding/loop_3veh/deadlocks.sumo new file mode 100644 index 000000000000..0c4f8dd62432 --- /dev/null +++ b/tests/sumo/rail/siding/loop_3veh/deadlocks.sumo @@ -0,0 +1,43 @@ + + + + + + diff --git a/tests/sumo/rail/siding/loop_4veh/deadlocks.sumo b/tests/sumo/rail/siding/loop_4veh/deadlocks.sumo new file mode 100644 index 000000000000..0e5fbdebf7f7 --- /dev/null +++ b/tests/sumo/rail/siding/loop_4veh/deadlocks.sumo @@ -0,0 +1,44 @@ + + + + + + + diff --git a/tests/sumo/rail/siding/loop_4veh/errors.sumo b/tests/sumo/rail/siding/loop_4veh/errors.sumo index 85d0e7cc8b4a..7edc05b2ddb6 100644 --- a/tests/sumo/rail/siding/loop_4veh/errors.sumo +++ b/tests/sumo/rail/siding/loop_4veh/errors.sumo @@ -1,2 +1,2 @@ -Warning: Teleporting vehicle 't1'; waited too long (yield), lane='a_0', time=318.00. -Warning: Vehicle 't1' ends teleporting on edge 'e', time=415.00. +Warning: Teleporting vehicle 't1'; waited too long (yield, railSignal), lane='a_0', time=272.00. +Warning: Vehicle 't1' ends teleporting on edge 'e', time=369.00. diff --git a/tests/sumo/rail/siding/loop_4veh/tripinfos.sumo b/tests/sumo/rail/siding/loop_4veh/tripinfos.sumo index a6e9ee955024..4ace36c9b8e8 100644 --- a/tests/sumo/rail/siding/loop_4veh/tripinfos.sumo +++ b/tests/sumo/rail/siding/loop_4veh/tripinfos.sumo @@ -1,6 +1,6 @@ - - - - - + + + + diff --git a/tests/sumo/rail/siding/loop_4veh2/deadlocks.sumo b/tests/sumo/rail/siding/loop_4veh2/deadlocks.sumo new file mode 100644 index 000000000000..0e5fbdebf7f7 --- /dev/null +++ b/tests/sumo/rail/siding/loop_4veh2/deadlocks.sumo @@ -0,0 +1,44 @@ + + + + + + + diff --git a/tests/sumo/rail/siding/loop_4veh2/errors.sumo b/tests/sumo/rail/siding/loop_4veh2/errors.sumo index 85d0e7cc8b4a..7edc05b2ddb6 100644 --- a/tests/sumo/rail/siding/loop_4veh2/errors.sumo +++ b/tests/sumo/rail/siding/loop_4veh2/errors.sumo @@ -1,2 +1,2 @@ -Warning: Teleporting vehicle 't1'; waited too long (yield), lane='a_0', time=318.00. -Warning: Vehicle 't1' ends teleporting on edge 'e', time=415.00. +Warning: Teleporting vehicle 't1'; waited too long (yield, railSignal), lane='a_0', time=272.00. +Warning: Vehicle 't1' ends teleporting on edge 'e', time=369.00. diff --git a/tests/sumo/rail/siding/loop_4veh2/tripinfos.sumo b/tests/sumo/rail/siding/loop_4veh2/tripinfos.sumo index d0902b0bc494..e191f7bf94d0 100644 --- a/tests/sumo/rail/siding/loop_4veh2/tripinfos.sumo +++ b/tests/sumo/rail/siding/loop_4veh2/tripinfos.sumo @@ -1,6 +1,6 @@ - - - - - + + + + diff --git a/tests/sumo/rail/siding/loop_4veh3/deadlocks.sumo b/tests/sumo/rail/siding/loop_4veh3/deadlocks.sumo new file mode 100644 index 000000000000..e377cc676853 --- /dev/null +++ b/tests/sumo/rail/siding/loop_4veh3/deadlocks.sumo @@ -0,0 +1,44 @@ + + + + + + diff --git a/tests/sumo/rail/siding/options.sumo b/tests/sumo/rail/siding/options.sumo new file mode 100644 index 000000000000..d3973627d54d --- /dev/null +++ b/tests/sumo/rail/siding/options.sumo @@ -0,0 +1 @@ +--deadlock-output deadlocks.xml diff --git a/tests/sumo/rail/siding/sidingShort_deadlock/deadlocks.sumo b/tests/sumo/rail/siding/sidingShort_deadlock/deadlocks.sumo new file mode 100644 index 000000000000..0c4f8dd62432 --- /dev/null +++ b/tests/sumo/rail/siding/sidingShort_deadlock/deadlocks.sumo @@ -0,0 +1,43 @@ + + + + + + diff --git a/tests/sumo/rail/siding/siding_both_ways/deadlocks.sumo b/tests/sumo/rail/siding/siding_both_ways/deadlocks.sumo new file mode 100644 index 000000000000..73ef2c8877a2 --- /dev/null +++ b/tests/sumo/rail/siding/siding_both_ways/deadlocks.sumo @@ -0,0 +1,43 @@ + + + + + + diff --git a/tests/sumo/rail/siding/siding_both_ways2/deadlocks.sumo b/tests/sumo/rail/siding/siding_both_ways2/deadlocks.sumo new file mode 100644 index 000000000000..73ef2c8877a2 --- /dev/null +++ b/tests/sumo/rail/siding/siding_both_ways2/deadlocks.sumo @@ -0,0 +1,43 @@ + + + + + + diff --git a/tests/sumo/rail/siding/siding_both_ways3/deadlocks.sumo b/tests/sumo/rail/siding/siding_both_ways3/deadlocks.sumo new file mode 100644 index 000000000000..73ef2c8877a2 --- /dev/null +++ b/tests/sumo/rail/siding/siding_both_ways3/deadlocks.sumo @@ -0,0 +1,43 @@ + + + + + + diff --git a/tests/sumo/rail/siding/siding_both_ways4/deadlocks.sumo b/tests/sumo/rail/siding/siding_both_ways4/deadlocks.sumo new file mode 100644 index 000000000000..73ef2c8877a2 --- /dev/null +++ b/tests/sumo/rail/siding/siding_both_ways4/deadlocks.sumo @@ -0,0 +1,43 @@ + + + + + + diff --git a/tests/sumo/rail/siding/siding_both_ways_addTrain/deadlocks.sumo b/tests/sumo/rail/siding/siding_both_ways_addTrain/deadlocks.sumo new file mode 100644 index 000000000000..73ef2c8877a2 --- /dev/null +++ b/tests/sumo/rail/siding/siding_both_ways_addTrain/deadlocks.sumo @@ -0,0 +1,43 @@ + + + + + + diff --git a/tests/sumo/rail/siding/siding_deadlock/deadlocks.sumo b/tests/sumo/rail/siding/siding_deadlock/deadlocks.sumo new file mode 100644 index 000000000000..73ef2c8877a2 --- /dev/null +++ b/tests/sumo/rail/siding/siding_deadlock/deadlocks.sumo @@ -0,0 +1,43 @@ + + + + + + diff --git a/tests/sumo/rail/siding/siding_deadlock2/deadlocks.sumo b/tests/sumo/rail/siding/siding_deadlock2/deadlocks.sumo new file mode 100644 index 000000000000..d73bbf64758f --- /dev/null +++ b/tests/sumo/rail/siding/siding_deadlock2/deadlocks.sumo @@ -0,0 +1,45 @@ + + + + + + + diff --git a/tests/sumo/rail/siding/siding_deadlock2/errors.sumo b/tests/sumo/rail/siding/siding_deadlock2/errors.sumo index 5e823aa13788..a5d9d0a7cfd1 100644 --- a/tests/sumo/rail/siding/siding_deadlock2/errors.sumo +++ b/tests/sumo/rail/siding/siding_deadlock2/errors.sumo @@ -1,6 +1,6 @@ -Warning: Teleporting vehicle 't0'; waited too long (yield), lane='d_0', time=330.00. -Warning: Teleporting vehicle 't3'; waited too long (yield), lane='-g_0', time=330.00. -Warning: Teleporting vehicle 't2'; waited too long (yield), lane='a_0', time=330.00. -Warning: Vehicle 't0' ends teleporting on edge 'e', time=330.00. -Warning: Vehicle 't2' ends teleporting on edge 'b', time=330.00. -Warning: Vehicle 't3' ends teleporting on edge '-d2', time=350.00. +Warning: Teleporting vehicle 't0'; waited too long (yield, railSignal), lane='d_0', time=230.00. +Warning: Teleporting vehicle 't3'; waited too long (yield, railSignal), lane='-g_0', time=230.00. +Warning: Teleporting vehicle 't2'; waited too long (yield, railSignal), lane='a_0', time=230.00. +Warning: Vehicle 't0' ends teleporting on edge 'e', time=230.00. +Warning: Vehicle 't2' ends teleporting on edge 'b', time=230.00. +Warning: Vehicle 't3' ends teleporting on edge '-d2', time=250.00. diff --git a/tests/sumo/rail/siding/siding_deadlock2/tripinfos.sumo b/tests/sumo/rail/siding/siding_deadlock2/tripinfos.sumo index c93e3ec8a926..740c287a0f41 100644 --- a/tests/sumo/rail/siding/siding_deadlock2/tripinfos.sumo +++ b/tests/sumo/rail/siding/siding_deadlock2/tripinfos.sumo @@ -1,6 +1,6 @@ - - - - - + + + + diff --git a/tests/sumo/rail/siding/siding_noSignal/deadlocks.sumo b/tests/sumo/rail/siding/siding_noSignal/deadlocks.sumo new file mode 100644 index 000000000000..0c4f8dd62432 --- /dev/null +++ b/tests/sumo/rail/siding/siding_noSignal/deadlocks.sumo @@ -0,0 +1,43 @@ + + + + + + diff --git a/tests/sumo/rail/siding/siding_noSignal2/deadlocks.sumo b/tests/sumo/rail/siding/siding_noSignal2/deadlocks.sumo new file mode 100644 index 000000000000..0c4f8dd62432 --- /dev/null +++ b/tests/sumo/rail/siding/siding_noSignal2/deadlocks.sumo @@ -0,0 +1,43 @@ + + + + + + diff --git a/tests/sumo/rail/siding/siding_occupied_advance/deadlocks.sumo b/tests/sumo/rail/siding/siding_occupied_advance/deadlocks.sumo new file mode 100644 index 000000000000..0c4f8dd62432 --- /dev/null +++ b/tests/sumo/rail/siding/siding_occupied_advance/deadlocks.sumo @@ -0,0 +1,43 @@ + + + + + + diff --git a/tests/sumo/rail/siding/triangle_6veh/deadlocks.sumo b/tests/sumo/rail/siding/triangle_6veh/deadlocks.sumo new file mode 100644 index 000000000000..90e35439a91f --- /dev/null +++ b/tests/sumo/rail/siding/triangle_6veh/deadlocks.sumo @@ -0,0 +1,45 @@ + + + + + + + diff --git a/tests/sumo/rail/siding/triangle_6veh/errors.sumo b/tests/sumo/rail/siding/triangle_6veh/errors.sumo index 18a01fb911ad..2e6f527c97b0 100644 --- a/tests/sumo/rail/siding/triangle_6veh/errors.sumo +++ b/tests/sumo/rail/siding/triangle_6veh/errors.sumo @@ -1,9 +1,9 @@ -Warning: Teleporting vehicle 't5'; waited too long (yield), lane='-a2_0', time=318.00. -Warning: Teleporting vehicle 't3'; waited too long (yield), lane='-f_0', time=318.00. -Warning: Teleporting vehicle 't1'; waited too long (yield), lane='a_0', time=318.00. -Warning: Vehicle 't1' skips stop on lane 'c_0' time=334.00. -Warning: Vehicle 't3' skips stop on lane 'd2_0' time=334.00. -Warning: Vehicle 't5' skips stop on lane 'c3_0' time=334.00. -Warning: Vehicle 't1' ends teleporting on edge 'f', time=367.00. -Warning: Vehicle 't3' ends teleporting on edge 'a2', time=370.00. -Warning: Vehicle 't5' ends teleporting on edge '-a', time=370.00. +Warning: Teleporting vehicle 't5'; waited too long (yield, railSignal), lane='-a2_0', time=218.00. +Warning: Teleporting vehicle 't3'; waited too long (yield, railSignal), lane='-f_0', time=218.00. +Warning: Teleporting vehicle 't1'; waited too long (yield, railSignal), lane='a_0', time=218.00. +Warning: Vehicle 't1' skips stop on lane 'c_0' time=234.00. +Warning: Vehicle 't3' skips stop on lane 'd2_0' time=234.00. +Warning: Vehicle 't5' skips stop on lane 'c3_0' time=234.00. +Warning: Vehicle 't1' ends teleporting on edge 'f', time=267.00. +Warning: Vehicle 't3' ends teleporting on edge 'a2', time=270.00. +Warning: Vehicle 't5' ends teleporting on edge '-a', time=270.00. diff --git a/tests/sumo/rail/siding/triangle_6veh/tripinfos.sumo b/tests/sumo/rail/siding/triangle_6veh/tripinfos.sumo index 4ed22dc82b43..9065a2b174d0 100644 --- a/tests/sumo/rail/siding/triangle_6veh/tripinfos.sumo +++ b/tests/sumo/rail/siding/triangle_6veh/tripinfos.sumo @@ -1,6 +1,6 @@ - - - - - - - + + + + + + From 681d40a8980d6d9ed59708df895892b228bbd8eb Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 9 Oct 2024 15:20:57 +0200 Subject: [PATCH 266/334] added test refs #15569, #21 --- .../siding/circle_3veh.loadDL/deadlocks.sumo | 44 +++++++ .../siding/circle_3veh.loadDL/errors.sumo | 2 + .../input_additional.add.xml | 44 +++++++ .../circle_3veh.loadDL/input_routes.rou.xml | 38 ++++++ .../siding/circle_3veh.loadDL/net.net.xml | 77 +++++++++++++ .../siding/circle_3veh.loadDL/options.sumo | 3 + .../siding/circle_3veh.loadDL/output.sumo | 0 .../circle_3veh.loadDL/railsignalblocks.sumo | 108 ++++++++++++++++++ .../siding/circle_3veh.loadDL/tripinfos.sumo | 46 ++++++++ tests/sumo/rail/siding/testsuite.sumo | 3 + 10 files changed, 365 insertions(+) create mode 100644 tests/sumo/rail/siding/circle_3veh.loadDL/deadlocks.sumo create mode 100644 tests/sumo/rail/siding/circle_3veh.loadDL/errors.sumo create mode 100644 tests/sumo/rail/siding/circle_3veh.loadDL/input_additional.add.xml create mode 100644 tests/sumo/rail/siding/circle_3veh.loadDL/input_routes.rou.xml create mode 100644 tests/sumo/rail/siding/circle_3veh.loadDL/net.net.xml create mode 100644 tests/sumo/rail/siding/circle_3veh.loadDL/options.sumo create mode 100644 tests/sumo/rail/siding/circle_3veh.loadDL/output.sumo create mode 100644 tests/sumo/rail/siding/circle_3veh.loadDL/railsignalblocks.sumo create mode 100644 tests/sumo/rail/siding/circle_3veh.loadDL/tripinfos.sumo diff --git a/tests/sumo/rail/siding/circle_3veh.loadDL/deadlocks.sumo b/tests/sumo/rail/siding/circle_3veh.loadDL/deadlocks.sumo new file mode 100644 index 000000000000..46822fac95ed --- /dev/null +++ b/tests/sumo/rail/siding/circle_3veh.loadDL/deadlocks.sumo @@ -0,0 +1,44 @@ + + + + + + + diff --git a/tests/sumo/rail/siding/circle_3veh.loadDL/errors.sumo b/tests/sumo/rail/siding/circle_3veh.loadDL/errors.sumo new file mode 100644 index 000000000000..d1cefa5db6cf --- /dev/null +++ b/tests/sumo/rail/siding/circle_3veh.loadDL/errors.sumo @@ -0,0 +1,2 @@ +Warning: Teleporting vehicle 't2'; waited too long (yield, railSignal), lane='c_0', time=243.00. +Warning: Vehicle 't2' ends teleporting on edge 'a', time=283.00. diff --git a/tests/sumo/rail/siding/circle_3veh.loadDL/input_additional.add.xml b/tests/sumo/rail/siding/circle_3veh.loadDL/input_additional.add.xml new file mode 100644 index 000000000000..46822fac95ed --- /dev/null +++ b/tests/sumo/rail/siding/circle_3veh.loadDL/input_additional.add.xml @@ -0,0 +1,44 @@ + + + + + + + diff --git a/tests/sumo/rail/siding/circle_3veh.loadDL/input_routes.rou.xml b/tests/sumo/rail/siding/circle_3veh.loadDL/input_routes.rou.xml new file mode 100644 index 000000000000..39684102432d --- /dev/null +++ b/tests/sumo/rail/siding/circle_3veh.loadDL/input_routes.rou.xml @@ -0,0 +1,38 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/siding/circle_3veh.loadDL/net.net.xml b/tests/sumo/rail/siding/circle_3veh.loadDL/net.net.xml new file mode 100644 index 000000000000..ebed5ce0e562 --- /dev/null +++ b/tests/sumo/rail/siding/circle_3veh.loadDL/net.net.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/circle_3veh.loadDL/options.sumo b/tests/sumo/rail/siding/circle_3veh.loadDL/options.sumo new file mode 100644 index 000000000000..07a9a6f47f76 --- /dev/null +++ b/tests/sumo/rail/siding/circle_3veh.loadDL/options.sumo @@ -0,0 +1,3 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +-a input_additional.add.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/siding/circle_3veh.loadDL/output.sumo b/tests/sumo/rail/siding/circle_3veh.loadDL/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/siding/circle_3veh.loadDL/railsignalblocks.sumo b/tests/sumo/rail/siding/circle_3veh.loadDL/railsignalblocks.sumo new file mode 100644 index 000000000000..f20ba8b9c241 --- /dev/null +++ b/tests/sumo/rail/siding/circle_3veh.loadDL/railsignalblocks.sumo @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/circle_3veh.loadDL/tripinfos.sumo b/tests/sumo/rail/siding/circle_3veh.loadDL/tripinfos.sumo new file mode 100644 index 000000000000..e1afbb7b37ee --- /dev/null +++ b/tests/sumo/rail/siding/circle_3veh.loadDL/tripinfos.sumo @@ -0,0 +1,46 @@ + + + + + + + + + diff --git a/tests/sumo/rail/siding/testsuite.sumo b/tests/sumo/rail/siding/testsuite.sumo index f5549f91fa48..0f19de8c8480 100644 --- a/tests/sumo/rail/siding/testsuite.sumo +++ b/tests/sumo/rail/siding/testsuite.sumo @@ -53,3 +53,6 @@ triangle_6veh # deadlock circle_3veh + +# avoid deadlock by loading a deadlock file +circle_3veh.loadDL From c3d945f5f550b4090d800e333813cf91be54ea76 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 9 Oct 2024 15:21:34 +0200 Subject: [PATCH 267/334] now loading deadlocks from file. refs #15569 (no extra checks yet) --- data/xsd/additional_file.xsd | 7 +++++++ src/microsim/traffic_lights/MSDriveWay.h | 4 ++++ .../traffic_lights/MSRailSignalControl.cpp | 17 ++++++++++++++- .../traffic_lights/MSRailSignalControl.h | 8 +++++++ src/netload/NLHandler.cpp | 21 +++++++++++++++++++ src/netload/NLHandler.h | 5 +++++ src/utils/xml/SUMOXMLDefinitions.cpp | 1 + src/utils/xml/SUMOXMLDefinitions.h | 2 ++ 8 files changed, 64 insertions(+), 1 deletion(-) diff --git a/data/xsd/additional_file.xsd b/data/xsd/additional_file.xsd index af8e08309ec1..e5c93bea4407 100644 --- a/data/xsd/additional_file.xsd +++ b/data/xsd/additional_file.xsd @@ -39,6 +39,7 @@ + @@ -611,6 +612,12 @@ + + + + + + diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h index fa8567b355d9..db10210d171d 100644 --- a/src/microsim/traffic_lights/MSDriveWay.h +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -66,6 +66,10 @@ class MSDriveWay : public MSMoveReminder, public Named { static void cleanup(); + static bool haveDriveWays() { + return myGlobalDriveWayIndex > 0; + } + bool notifyEnter(SUMOTrafficObject& veh, Notification reason, const MSLane* enteredLane); bool notifyLeave(SUMOTrafficObject& veh, double lastPos, Notification reason, const MSLane* enteredLane = 0); bool notifyLeaveBack(SUMOTrafficObject& veh, Notification reason, const MSLane* leftLane); diff --git a/src/microsim/traffic_lights/MSRailSignalControl.cpp b/src/microsim/traffic_lights/MSRailSignalControl.cpp index 14d730a21e0e..3f18eed467fd 100644 --- a/src/microsim/traffic_lights/MSRailSignalControl.cpp +++ b/src/microsim/traffic_lights/MSRailSignalControl.cpp @@ -223,7 +223,7 @@ MSRailSignalControl::haveDeadlock(const SUMOVehicle* veh) const { vehicles.push_back(item.second->getID()); } OutputDevice& od = OutputDevice::getDeviceByOption("deadlock-output"); - od.openTag("deadlock"); + od.openTag(SUMO_TAG_DEADLOCK); od.writeAttr(SUMO_ATTR_TIME, time2string(SIMSTEP)); od.writeAttr(SUMO_ATTR_SIGNALS, signals); od.writeAttr("vehicles", vehicles); @@ -238,4 +238,19 @@ MSRailSignalControl::haveDeadlock(const SUMOVehicle* veh) const { } +void +MSRailSignalControl::addDeadlockCheck(std::vector signals) { + if (MSDriveWay::haveDriveWays()) { + WRITE_WARNING("Deadlocks should be loaded before any vehicles"); + } + const int n = (int)signals.size(); + for (int i = 0; i < n; i++) { + std::vector others; + for (int j = 1; j < n; j++) { + others.push_back(signals[(i + j) % n]); + } + myDeadlockChecks[signals[i]] = others; + } +} + /****************************************************************************/ diff --git a/src/microsim/traffic_lights/MSRailSignalControl.h b/src/microsim/traffic_lights/MSRailSignalControl.h index f49051aeb734..4a3935629c79 100644 --- a/src/microsim/traffic_lights/MSRailSignalControl.h +++ b/src/microsim/traffic_lights/MSRailSignalControl.h @@ -63,6 +63,8 @@ class MSRailSignalControl : public MSNet::VehicleStateListener { /// @brief whether there is a circle in the waiting-for relationships that contains the given vehicle bool haveDeadlock(const SUMOVehicle* veh) const; + void addDeadlockCheck(std::vector signals); + /** @brief Called if a vehicle changes its state * @param[in] vehicle The vehicle which changed its state * @param[in] to The state the vehicle has changed to @@ -90,6 +92,10 @@ class MSRailSignalControl : public MSNet::VehicleStateListener { /// @brief final check for driveway compatibility of signals that switched green in this step void recheckGreen(); + const std::map >& getDeadlockChecks() const { + return myDeadlockChecks; + } + private: /** @brief Constructor */ MSRailSignalControl(); @@ -115,6 +121,8 @@ class MSRailSignalControl : public MSNet::VehicleStateListener { std::map > myWaitRelations; mutable std::set > myWrittenDeadlocks; + std::map > myDeadlockChecks; + /// @brief list of all rail signals std::vector mySignals; diff --git a/src/netload/NLHandler.cpp b/src/netload/NLHandler.cpp index 1d66ea862d99..b519918d8f0c 100644 --- a/src/netload/NLHandler.cpp +++ b/src/netload/NLHandler.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -289,6 +290,9 @@ NLHandler::myStartElement(int element, case SUMO_TAG_BIDI_PREDECESSOR: myLastParameterised.push_back(addPredecessorConstraint(element, attrs, myConstrainedSignal)); break; + case SUMO_TAG_DEADLOCK: + addDeadlock(attrs); + break; default: break; } @@ -1721,6 +1725,23 @@ NLHandler::addMesoEdgeType(const SUMOSAXAttributes& attrs) { } } +void +NLHandler::addDeadlock(const SUMOSAXAttributes& attrs) { + bool ok = true; + std::vector signalIDs = attrs.get>(SUMO_ATTR_SIGNALS, nullptr, ok); + std::vector signals; + for (const std::string& id : signalIDs) { + const MSTrafficLightLogic* tll = myJunctionControlBuilder.getTLLogicControlToUse().getActive(id); + const MSRailSignal* rs = dynamic_cast(tll); + if (rs != nullptr) { + signals.push_back(rs); + } else { + throw InvalidArgument("Rail signal '" + toString(id) + "' in " + toString(SUMO_TAG_DEADLOCK) + " is not known"); + } + } + MSRailSignalControl::getInstance().addDeadlockCheck(signals); +} + // ---------------------------------- void NLHandler::endE3Detector() { diff --git a/src/netload/NLHandler.h b/src/netload/NLHandler.h index cc6daeb4c041..74daada7eff4 100644 --- a/src/netload/NLHandler.h +++ b/src/netload/NLHandler.h @@ -214,6 +214,11 @@ class NLHandler : public MSRouteHandler { */ virtual void addMesoEdgeType(const SUMOSAXAttributes& attrs); + /** @brief Loads deadlock information for preparing additional rail signal checks + * @param[in] attrs The attributes that hold the parameters + */ + virtual void addDeadlock(const SUMOSAXAttributes& attrs); + /// Closes the process of building an edge virtual void closeEdge(); diff --git a/src/utils/xml/SUMOXMLDefinitions.cpp b/src/utils/xml/SUMOXMLDefinitions.cpp index 5317c69dfddf..d4888c3ad90a 100644 --- a/src/utils/xml/SUMOXMLDefinitions.cpp +++ b/src/utils/xml/SUMOXMLDefinitions.cpp @@ -158,6 +158,7 @@ StringBijection::Entry SUMOXMLDefinitions::tags[] = { { "insertionOrder", SUMO_TAG_INSERTION_ORDER }, { "bidiPredecessor", SUMO_TAG_BIDI_PREDECESSOR }, { "railSignalConstraintTracker", SUMO_TAG_RAILSIGNAL_CONSTRAINT_TRACKER }, + { "deadlock", SUMO_TAG_DEADLOCK }, { "link", SUMO_TAG_LINK }, { "approaching", SUMO_TAG_APPROACHING }, // OSM diff --git a/src/utils/xml/SUMOXMLDefinitions.h b/src/utils/xml/SUMOXMLDefinitions.h index 08c30d017f19..162c4ff54b23 100644 --- a/src/utils/xml/SUMOXMLDefinitions.h +++ b/src/utils/xml/SUMOXMLDefinitions.h @@ -279,6 +279,8 @@ enum SumoXMLTag { SUMO_TAG_BIDI_PREDECESSOR, /// @brief Saved state for constraint tracker SUMO_TAG_RAILSIGNAL_CONSTRAINT_TRACKER, + /// @brief Saved deadlock information, also for loading as an extra check + SUMO_TAG_DEADLOCK, /// @brief Link information for state-saving SUMO_TAG_LINK, /// @brief Link-approaching vehicle information for state-saving From d155f103ddde8452323b45cad567184350c7195e Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 10 Oct 2024 11:31:52 +0200 Subject: [PATCH 268/334] refactoring refs #12 --- src/microsim/traffic_lights/MSDriveWay.cpp | 14 +++++++------- src/microsim/traffic_lights/MSDriveWay.h | 2 +- src/microsim/traffic_lights/MSRailSignal.cpp | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 2a8c34e40e4b..74cab9152afc 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -191,7 +191,7 @@ MSDriveWay::notifyEnter(SUMOTrafficObject& veh, Notification reason, const MSLan if (veh.isVehicle() && enteredLane == myLane && (reason == NOTIFICATION_DEPARTED || reason == NOTIFICATION_JUNCTION || reason == NOTIFICATION_PARKING)) { SUMOVehicle& sveh = dynamic_cast(veh); MSRouteIterator firstIt = std::find(sveh.getCurrentRouteEdge(), sveh.getRoute().end(), myLane->getNextNormal()); - if (myTrains.count(&sveh) == 0 && match(sveh.getRoute(), firstIt)) { + if (myTrains.count(&sveh) == 0 && match(firstIt, sveh.getRoute().end())) { myTrains.insert(&sveh); if (myWriteVehicles) { myVehicleEvents.push_back(VehicleEvent(SIMSTEP, true, veh.getID(), reason)); @@ -524,7 +524,7 @@ MSDriveWay::foeDriveWayOccupied(bool store, const SUMOVehicle* ego, MSEdgeVector if (foeA.second.dist < foe->getBrakeGap(true)) { MSRouteIterator firstIt = std::find(foe->getCurrentRouteEdge(), foe->getRoute().end(), foeDW->myRoute.front()); if (firstIt != foe->getRoute().end()) { - if (foeDW->match(foe->getRoute(), firstIt)) { + if (foeDW->match(firstIt, foe->getRoute().end())) { bool useSiding = canUseSiding(ego, foeDW); #ifdef DEBUG_SIGNALSTATE if (gDebugFlag4 || DEBUG_COND_DW || DEBUG_HELPER(ego)) { @@ -1465,12 +1465,12 @@ MSDriveWay::appendMapIndex(LaneVisitedMap& map, const MSLane* lane) { } bool -MSDriveWay::match(const MSRoute& route, MSRouteIterator firstIt) const { +MSDriveWay::match(MSRouteIterator firstIt, MSRouteIterator endIt) const { // @todo optimize: it is sufficient to check for specific edges (after each switch) auto itRoute = firstIt; auto itDwRoute = myRoute.begin(); bool match = true; - while (itRoute != route.end() && itDwRoute != myRoute.end()) { + while (itRoute != endIt && itDwRoute != myRoute.end()) { if (*itRoute != *itDwRoute) { match = false; #ifdef DEBUG_MATCH @@ -1484,9 +1484,9 @@ MSDriveWay::match(const MSRoute& route, MSRouteIterator firstIt) const { // if the vehicle arrives before the end of this driveway, // we'd rather build a new driveway to avoid superfluous restrictions if (match && itDwRoute == myRoute.end() - && (itRoute == route.end() || myFoundSignal || myFoundJump || myIsSubDriveway)) { + && (itRoute == endIt || myFoundSignal || myFoundJump || myIsSubDriveway)) { //std::cout << " using dw=" << "\n"; - if (myFoundJump && itRoute != route.end()) { + if (myFoundJump && itRoute != endIt) { // check whether the current route requires an extended driveway const MSEdge* next = *itRoute; const MSEdge* prev = myRoute.back(); @@ -1903,7 +1903,7 @@ MSDriveWay::getDepartureDriveway(const SUMOVehicle* veh) { } } for (MSDriveWay* dw : myDepartureDriveways[edge]) { - if (dw->match(veh->getRoute(), veh->getCurrentRouteEdge())) { + if (dw->match(veh->getCurrentRouteEdge(), veh->getRoute().end())) { return dw; } } diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h index db10210d171d..49a95cc0c722 100644 --- a/src/microsim/traffic_lights/MSDriveWay.h +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -138,7 +138,7 @@ class MSDriveWay : public MSMoveReminder, public Named { } /// @brief whether the give route matches this driveway - bool match(const MSRoute& route, MSRouteIterator firstIt) const; + bool match(MSRouteIterator firstIt, MSRouteIterator endIt) const; static void init(); diff --git a/src/microsim/traffic_lights/MSRailSignal.cpp b/src/microsim/traffic_lights/MSRailSignal.cpp index 7593f9eeb0e2..737336bc1cba 100644 --- a/src/microsim/traffic_lights/MSRailSignal.cpp +++ b/src/microsim/traffic_lights/MSRailSignal.cpp @@ -478,7 +478,7 @@ MSRailSignal::LinkInfo::getDriveWay(const SUMOVehicle* veh) { } //std::cout << SIMTIME << " veh=" << veh->getID() << " rsl=" << getID() << " dws=" << myDriveways.size() << "\n"; for (MSDriveWay* dw : myDriveways) { - if (dw->match(veh->getRoute(), firstIt)) { + if (dw->match(firstIt, veh->getRoute().end())) { return *dw; } #ifdef DEBUG_SELECT_DRIVEWAY From dde8c906ae1f26decc07a9b0181bfa66b64e5f70 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 10 Oct 2024 11:41:38 +0200 Subject: [PATCH 269/334] refactoring refs #12 --- src/microsim/traffic_lights/MSRailSignal.cpp | 24 ++++++++++++++++---- src/microsim/traffic_lights/MSRailSignal.h | 2 ++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/microsim/traffic_lights/MSRailSignal.cpp b/src/microsim/traffic_lights/MSRailSignal.cpp index 737336bc1cba..75f0445cd6c4 100644 --- a/src/microsim/traffic_lights/MSRailSignal.cpp +++ b/src/microsim/traffic_lights/MSRailSignal.cpp @@ -477,18 +477,27 @@ MSRailSignal::LinkInfo::getDriveWay(const SUMOVehicle* veh) { return *myDriveways.front(); } //std::cout << SIMTIME << " veh=" << veh->getID() << " rsl=" << getID() << " dws=" << myDriveways.size() << "\n"; + return getDriveWay(firstIt, veh->getRoute().end(), veh->getID()); +} + + +MSDriveWay& +MSRailSignal::LinkInfo::getDriveWay(MSRouteIterator firstIt, MSRouteIterator endIt, const std::string& info) { for (MSDriveWay* dw : myDriveways) { - if (dw->match(firstIt, veh->getRoute().end())) { + if (dw->match(firstIt, endIt)) { return *dw; } #ifdef DEBUG_SELECT_DRIVEWAY - std::cout << SIMTIME << " rs=" << getID() << " veh=" << veh->getID() << " other dwSignal=" << dw->foundSignal() << " dwRoute=" << toString(dw->getRoute()) << " route=" << toString(veh->getRoute().getEdges()) << "\n"; + std::cout << SIMTIME << " rs=" << getID() << " veh=" << info << " other dwSignal=" << dw->foundSignal() << " dwRoute=" << toString(dw->getRoute()) << "\n"; +#else + UNUSED_PARAMETER(info); #endif } - MSDriveWay* dw = MSDriveWay::buildDriveWay(rs->getNewDrivewayID(), myLink, firstIt, veh->getRoute().end()); - dw->setVehicle(veh->getID()); + MSRailSignal* rs = const_cast(dynamic_cast(myLink->getTLLogic())); + MSDriveWay* dw = MSDriveWay::buildDriveWay(rs->getNewDrivewayID(), myLink, firstIt, endIt); + dw->setVehicle(info); #ifdef DEBUG_SELECT_DRIVEWAY - std::cout << SIMTIME << " rs=" << getID() << " veh=" << veh->getID() << " new dwSignal=" << dw->foundSignal() << " dwRoute=" << toString(dw->getRoute()) << " route=" << toString(veh->getRoute().getEdges()) << "\n"; + std::cout << SIMTIME << " rs=" << getID() << " veh=" << info << " new dwSignal=" << dw->foundSignal() << " dwRoute=" << toString(dw->getRoute()) << "\n"; #endif myDriveways.push_back(dw); return *myDriveways.back(); @@ -607,6 +616,11 @@ MSRailSignal::retrieveDriveWayForVeh(int tlIndex, const SUMOVehicle* veh) { return myLinkInfos[tlIndex].getDriveWay(veh); } +const MSDriveWay& +MSRailSignal::retrieveDriveWayForRoute(int tlIndex, MSRouteIterator first, MSRouteIterator end) { + return myLinkInfos[tlIndex].getDriveWay(first, end); +} + const std::vector MSRailSignal::retrieveDriveWays(int tlIndex) const { diff --git a/src/microsim/traffic_lights/MSRailSignal.h b/src/microsim/traffic_lights/MSRailSignal.h index fa82705522a6..557ea198d83c 100644 --- a/src/microsim/traffic_lights/MSRailSignal.h +++ b/src/microsim/traffic_lights/MSRailSignal.h @@ -264,6 +264,7 @@ class MSRailSignal : public MSTrafficLightLogic { const MSDriveWay& retrieveDriveWay(int numericalID) const; const MSDriveWay& retrieveDriveWayForVeh(int tlIndex, const SUMOVehicle* veh); + const MSDriveWay& retrieveDriveWayForRoute(int tlIndex, MSRouteIterator first, MSRouteIterator end); const std::vector retrieveDriveWays(int tlIndex) const; @@ -320,6 +321,7 @@ class MSRailSignal : public MSTrafficLightLogic { /// @brief retrieve an existing Driveway or construct a new driveway based on the vehicles route MSDriveWay& getDriveWay(const SUMOVehicle*); + MSDriveWay& getDriveWay(MSRouteIterator firstIt, MSRouteIterator endIt, const std::string& info=""); /// @brief try rerouting vehicle if reservation failed void reroute(SUMOVehicle* veh, const MSEdgeVector& occupied); From d1c277975536d0740e770f3620e687ffd447e1ec Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 10 Oct 2024 23:51:28 +0200 Subject: [PATCH 270/334] correcting xsd, refs #15569 --- data/xsd/additional_file.xsd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/xsd/additional_file.xsd b/data/xsd/additional_file.xsd index e5c93bea4407..709678f0edfa 100644 --- a/data/xsd/additional_file.xsd +++ b/data/xsd/additional_file.xsd @@ -615,7 +615,7 @@ - + From e93cd75176802417c5b4485b8fa11944610249e6 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 11 Oct 2024 11:36:08 +0200 Subject: [PATCH 271/334] added test refs #21, #7578 --- .../reversal/subdriveway_reversal/errors.sumo | 0 .../subdriveway_reversal/errors.sumo.meso | 0 .../subdriveway_reversal/input_routes.rou.xml | 39 +++ .../reversal/subdriveway_reversal/net.net.xml | 237 ++++++++++++++++++ .../subdriveway_reversal/options.sumo | 2 + .../reversal/subdriveway_reversal/output.sumo | 0 .../railsignalblocks.sumo | 102 ++++++++ .../subdriveway_reversal/railsignalvehs.sumo | 64 +++++ .../subdriveway_reversal/tripinfos.sumo | 46 ++++ .../subdriveway_reversal/tripinfos.sumo.meso | 49 ++++ tests/sumo/rail/reversal/testsuite.sumo | 3 + 11 files changed, 542 insertions(+) create mode 100644 tests/sumo/rail/reversal/subdriveway_reversal/errors.sumo create mode 100644 tests/sumo/rail/reversal/subdriveway_reversal/errors.sumo.meso create mode 100644 tests/sumo/rail/reversal/subdriveway_reversal/input_routes.rou.xml create mode 100644 tests/sumo/rail/reversal/subdriveway_reversal/net.net.xml create mode 100644 tests/sumo/rail/reversal/subdriveway_reversal/options.sumo create mode 100644 tests/sumo/rail/reversal/subdriveway_reversal/output.sumo create mode 100644 tests/sumo/rail/reversal/subdriveway_reversal/railsignalblocks.sumo create mode 100644 tests/sumo/rail/reversal/subdriveway_reversal/railsignalvehs.sumo create mode 100644 tests/sumo/rail/reversal/subdriveway_reversal/tripinfos.sumo create mode 100644 tests/sumo/rail/reversal/subdriveway_reversal/tripinfos.sumo.meso diff --git a/tests/sumo/rail/reversal/subdriveway_reversal/errors.sumo b/tests/sumo/rail/reversal/subdriveway_reversal/errors.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/reversal/subdriveway_reversal/errors.sumo.meso b/tests/sumo/rail/reversal/subdriveway_reversal/errors.sumo.meso new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/reversal/subdriveway_reversal/input_routes.rou.xml b/tests/sumo/rail/reversal/subdriveway_reversal/input_routes.rou.xml new file mode 100644 index 000000000000..991101a5ace7 --- /dev/null +++ b/tests/sumo/rail/reversal/subdriveway_reversal/input_routes.rou.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/subdriveway_reversal/net.net.xml b/tests/sumo/rail/reversal/subdriveway_reversal/net.net.xml new file mode 100644 index 000000000000..f9e46a84cd6f --- /dev/null +++ b/tests/sumo/rail/reversal/subdriveway_reversal/net.net.xml @@ -0,0 +1,237 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/subdriveway_reversal/options.sumo b/tests/sumo/rail/reversal/subdriveway_reversal/options.sumo new file mode 100644 index 000000000000..a05c625502e9 --- /dev/null +++ b/tests/sumo/rail/reversal/subdriveway_reversal/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml --tripinfo-output=tripinfos.xml +--railsignal-vehicle-output railsignal_vehicles.xml diff --git a/tests/sumo/rail/reversal/subdriveway_reversal/output.sumo b/tests/sumo/rail/reversal/subdriveway_reversal/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/reversal/subdriveway_reversal/railsignalblocks.sumo b/tests/sumo/rail/reversal/subdriveway_reversal/railsignalblocks.sumo new file mode 100644 index 000000000000..f3f21d91b6be --- /dev/null +++ b/tests/sumo/rail/reversal/subdriveway_reversal/railsignalblocks.sumo @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/subdriveway_reversal/railsignalvehs.sumo b/tests/sumo/rail/reversal/subdriveway_reversal/railsignalvehs.sumo new file mode 100644 index 000000000000..dfd972e8bc47 --- /dev/null +++ b/tests/sumo/rail/reversal/subdriveway_reversal/railsignalvehs.sumo @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/subdriveway_reversal/tripinfos.sumo b/tests/sumo/rail/reversal/subdriveway_reversal/tripinfos.sumo new file mode 100644 index 000000000000..48a8ea91c525 --- /dev/null +++ b/tests/sumo/rail/reversal/subdriveway_reversal/tripinfos.sumo @@ -0,0 +1,46 @@ + + + + + + + + + diff --git a/tests/sumo/rail/reversal/subdriveway_reversal/tripinfos.sumo.meso b/tests/sumo/rail/reversal/subdriveway_reversal/tripinfos.sumo.meso new file mode 100644 index 000000000000..e872986da5b1 --- /dev/null +++ b/tests/sumo/rail/reversal/subdriveway_reversal/tripinfos.sumo.meso @@ -0,0 +1,49 @@ + + + + + + + + diff --git a/tests/sumo/rail/reversal/testsuite.sumo b/tests/sumo/rail/reversal/testsuite.sumo index 0234eb37bc40..10e22aee2bb2 100644 --- a/tests/sumo/rail/reversal/testsuite.sumo +++ b/tests/sumo/rail/reversal/testsuite.sumo @@ -99,3 +99,6 @@ two_double_reversals # invalid subDriveway construction reversal_after_common_block + +# vehicle should not be assigned to a subDriveway if it would have to leave via reversal +subdriveway_reversal From 3016b45a6289e52c3d9621f6f1b0f5a19b1a21ee Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 11 Oct 2024 12:13:27 +0200 Subject: [PATCH 272/334] tweaking debug code --- src/microsim/traffic_lights/MSDriveWay.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 74cab9152afc..601c74bee243 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -900,7 +900,7 @@ MSDriveWay::buildRoute(const MSLink* origin, double length, MSLane* toLane = origin ? origin->getViaLaneOrLane() : (*next)->getLanes()[0]; const std::string warnID = origin ? "rail signal " + getClickableTLLinkID(origin) : "insertion lane '" + toLane->getID() + "'"; #ifdef DEBUG_DRIVEWAY_BUILDROUTE - gDebugFlag4 = DEBUG_HELPER(orignRS); + gDebugFlag4 = DEBUG_COND_DW; if (gDebugFlag4) std::cout << "buildRoute origin=" << warnID << " vehRoute=" << toString(ConstMSEdgeVector(next, end)) << " visited=" << formatVisitedMap(visited) << "\n"; #endif From 78e4e349bd3774dec257ca6ca0292057ccb6748a Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 11 Oct 2024 12:22:37 +0200 Subject: [PATCH 273/334] avoiding assignment to invalid driveway refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 601c74bee243..b8d301a7a445 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -1486,14 +1486,22 @@ MSDriveWay::match(MSRouteIterator firstIt, MSRouteIterator endIt) const { if (match && itDwRoute == myRoute.end() && (itRoute == endIt || myFoundSignal || myFoundJump || myIsSubDriveway)) { //std::cout << " using dw=" << "\n"; - if (myFoundJump && itRoute != endIt) { + if (itRoute != endIt) { // check whether the current route requires an extended driveway const MSEdge* next = *itRoute; const MSEdge* prev = myRoute.back(); - if (prev->getBidiEdge() != next && prev->getBidiEdge() != nullptr + if (myFoundJump && prev->getBidiEdge() != next && prev->getBidiEdge() != nullptr && prev->isConnectedTo(*next, (SUMOVehicleClass)(SVC_RAIL_CLASSES & prev->getPermissions()))) { #ifdef DEBUG_MATCH std::cout << " check dw=" << getID() << " prev=" << prev->getID() << " next=" << next->getID() << "\n"; +#endif + return false; + } + if (!myFoundJump && prev->getBidiEdge() == next) { + assert(myIsSubDriveway); + // must not leave driveway via reversal +#ifdef DEBUG_MATCH + std::cout << getID() << " back=" << myForward.back()->getID() << " noMatch route " << toString(ConstMSEdgeVector(firstIt, endIt)) << "\n"; #endif return false; } From b2dc6c989aee01f1f5fe5ae6a7dae116efa9470d Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Fri, 11 Oct 2024 12:22:46 +0200 Subject: [PATCH 274/334] patching expected results refs #21, #7578 --- .../bidiDepart_reversal/railsignalblocks.sumo | 16 +++++++++--- .../bidiDepart_reversal/railsignalvehs.sumo | 1 + .../subdriveway_reversal/railsignalvehs.sumo | 26 ++++++++----------- .../subdriveway_reversal/tripinfos.sumo | 4 +-- 4 files changed, 26 insertions(+), 21 deletions(-) diff --git a/tests/sumo/rail/reversal/bidiDepart_reversal/railsignalblocks.sumo b/tests/sumo/rail/reversal/bidiDepart_reversal/railsignalblocks.sumo index 44204521f6b4..0590218ff2ed 100644 --- a/tests/sumo/rail/reversal/bidiDepart_reversal/railsignalblocks.sumo +++ b/tests/sumo/rail/reversal/bidiDepart_reversal/railsignalblocks.sumo @@ -1,6 +1,6 @@ - + + + + + + diff --git a/tests/sumo/rail/reversal/consecutive_before_reversal/net.net.xml b/tests/sumo/rail/reversal/consecutive_before_reversal/net.net.xml new file mode 100644 index 000000000000..1abadedd432e --- /dev/null +++ b/tests/sumo/rail/reversal/consecutive_before_reversal/net.net.xml @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/consecutive_before_reversal/options.sumo b/tests/sumo/rail/reversal/consecutive_before_reversal/options.sumo new file mode 100644 index 000000000000..a05c625502e9 --- /dev/null +++ b/tests/sumo/rail/reversal/consecutive_before_reversal/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml --tripinfo-output=tripinfos.xml +--railsignal-vehicle-output railsignal_vehicles.xml diff --git a/tests/sumo/rail/reversal/consecutive_before_reversal/output.sumo b/tests/sumo/rail/reversal/consecutive_before_reversal/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/reversal/consecutive_before_reversal/railsignalblocks.sumo b/tests/sumo/rail/reversal/consecutive_before_reversal/railsignalblocks.sumo new file mode 100644 index 000000000000..aeb62484dd2d --- /dev/null +++ b/tests/sumo/rail/reversal/consecutive_before_reversal/railsignalblocks.sumo @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/consecutive_before_reversal/railsignalvehs.sumo b/tests/sumo/rail/reversal/consecutive_before_reversal/railsignalvehs.sumo new file mode 100644 index 000000000000..5de69947128e --- /dev/null +++ b/tests/sumo/rail/reversal/consecutive_before_reversal/railsignalvehs.sumo @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/consecutive_before_reversal/tripinfos.sumo b/tests/sumo/rail/reversal/consecutive_before_reversal/tripinfos.sumo new file mode 100644 index 000000000000..cb3ef3ab2bd8 --- /dev/null +++ b/tests/sumo/rail/reversal/consecutive_before_reversal/tripinfos.sumo @@ -0,0 +1,45 @@ + + + + + + + + diff --git a/tests/sumo/rail/reversal/consecutive_before_reversal/tripinfos.sumo.meso b/tests/sumo/rail/reversal/consecutive_before_reversal/tripinfos.sumo.meso new file mode 100644 index 000000000000..e872986da5b1 --- /dev/null +++ b/tests/sumo/rail/reversal/consecutive_before_reversal/tripinfos.sumo.meso @@ -0,0 +1,49 @@ + + + + + + + + diff --git a/tests/sumo/rail/reversal/testsuite.sumo b/tests/sumo/rail/reversal/testsuite.sumo index 10e22aee2bb2..0548c00f3922 100644 --- a/tests/sumo/rail/reversal/testsuite.sumo +++ b/tests/sumo/rail/reversal/testsuite.sumo @@ -102,3 +102,6 @@ reversal_after_common_block # vehicle should not be assigned to a subDriveway if it would have to leave via reversal subdriveway_reversal + +# consecutive signals for the same route should not be foes if the train branches of after reversal and before entering their section +consecutive_before_reversal From 3bed8c205dd9f2507d42522e415f5abe42fac37b Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Mon, 14 Oct 2024 12:52:26 +0200 Subject: [PATCH 278/334] avoiding some invalid foes. refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index b8d301a7a445..ca0fc4b90147 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -792,6 +792,10 @@ MSDriveWay::forwardRouteConflict(std::set forward, const MSDriveW return false; } i++; + if (edge2 == myForward.front()->getNextNormal()) { + // foe should not pass from behind through our own forward section + return false; + } if (forward.count(edge2->getBidiEdge()) != 0) { return true; } From fce596942bf8c4c1bf048cddfce72c330163e8f8 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Mon, 14 Oct 2024 12:52:30 +0200 Subject: [PATCH 279/334] patching expected results refs #21, #7578 --- .../consecutive_before_reversal/railsignalblocks.sumo | 8 ++++---- .../consecutive_before_reversal/railsignalvehs.sumo | 4 ++-- .../reversal/consecutive_before_reversal/tripinfos.sumo | 4 ++-- .../follower_ends_before_reversal/railsignalblocks.sumo | 7 ++++--- .../follower_ends_before_reversal2/railsignalblocks.sumo | 9 +++++---- .../insertion_before_reversal2/railsignalblocks.sumo | 5 +++-- .../insertion_before_reversal3/railsignalblocks.sumo | 5 +++-- .../reversal_after_common_block/railsignalblocks.sumo | 9 +++++---- .../reversal/two_double_reversals/railsignalblocks.sumo | 5 +++-- 9 files changed, 31 insertions(+), 25 deletions(-) diff --git a/tests/sumo/rail/reversal/consecutive_before_reversal/railsignalblocks.sumo b/tests/sumo/rail/reversal/consecutive_before_reversal/railsignalblocks.sumo index aeb62484dd2d..5953ca3e814b 100644 --- a/tests/sumo/rail/reversal/consecutive_before_reversal/railsignalblocks.sumo +++ b/tests/sumo/rail/reversal/consecutive_before_reversal/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - diff --git a/tests/sumo/rail/siding/circle_3veh.loadDL/errors.sumo b/tests/sumo/rail/siding/circle_3veh.loadDL/errors.sumo index d1cefa5db6cf..e69de29bb2d1 100644 --- a/tests/sumo/rail/siding/circle_3veh.loadDL/errors.sumo +++ b/tests/sumo/rail/siding/circle_3veh.loadDL/errors.sumo @@ -1,2 +0,0 @@ -Warning: Teleporting vehicle 't2'; waited too long (yield, railSignal), lane='c_0', time=243.00. -Warning: Vehicle 't2' ends teleporting on edge 'a', time=283.00. diff --git a/tests/sumo/rail/siding/circle_3veh.loadDL/railsignalblocks.sumo b/tests/sumo/rail/siding/circle_3veh.loadDL/railsignalblocks.sumo index 8185430b147c..7f6abd78f4db 100644 --- a/tests/sumo/rail/siding/circle_3veh.loadDL/railsignalblocks.sumo +++ b/tests/sumo/rail/siding/circle_3veh.loadDL/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - - - + + + From 510b06d01a39464dee2404fa1446a69f0d20f3b8 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Mon, 14 Oct 2024 16:46:08 +0200 Subject: [PATCH 283/334] reorganized deadlock tests refs #21 --- .../circle_3veh.loadDL/deadlocks.sumo | 0 .../circle_3veh.loadDL/errors.sumo | 0 .../input_additional.add.xml | 0 .../circle_3veh.loadDL/input_routes.rou.xml | 0 .../circle_3veh.loadDL/net.net.xml | 0 .../circle_3veh.loadDL/options.sumo | 0 .../circle_3veh.loadDL/output.sumo | 0 .../circle_3veh.loadDL/railsignalblocks.sumo | 0 .../circle_3veh.loadDL/tripinfos.sumo | 0 .../circle_3veh/deadlocks.sumo | 0 .../circle_3veh/errors.sumo | 0 .../circle_3veh/input_routes.rou.xml | 0 .../circle_3veh/net.net.xml | 0 .../circle_3veh/options.sumo | 0 .../circle_3veh/output.sumo | 0 .../circle_3veh/railsignalblocks.sumo | 0 .../circle_3veh/tripinfos.sumo | 0 .../loop_4veh/deadlocks.sumo | 0 .../loop_4veh/errors.sumo | 0 .../loop_4veh/input_routes.rou.xml | 0 .../loop_4veh/net.net.xml | 0 .../loop_4veh/options.sumo | 0 .../loop_4veh/output.sumo | 0 .../loop_4veh/railsignalblocks.sumo | 0 .../loop_4veh/tripinfos.sumo | 0 .../loop_4veh2/deadlocks.sumo | 0 .../loop_4veh2/errors.sumo | 0 .../loop_4veh2/input_routes.rou.xml | 0 .../loop_4veh2/net.net.xml | 0 .../loop_4veh2/options.sumo | 0 .../loop_4veh2/output.sumo | 0 .../loop_4veh2/railsignalblocks.sumo | 0 .../loop_4veh2/tripinfos.sumo | 0 .../loop_4veh3/deadlocks.sumo | 0 .../loop_4veh3/errors.sumo | 0 .../loop_4veh3/input_routes.rou.xml | 0 .../loop_4veh3/net.net.xml | 0 .../loop_4veh3/options.sumo | 0 .../loop_4veh3/output.sumo | 0 .../loop_4veh3/railsignalblocks.sumo | 0 .../loop_4veh3/tripinfos.sumo | 0 .../rail/{siding => deadlocks}/options.sumo | 0 .../siding_deadlock2/deadlocks.sumo | 0 .../siding_deadlock2/errors.sumo | 0 .../siding_deadlock2/input_routes.rou.xml | 0 .../siding_deadlock2/net.net.xml | 0 .../siding_deadlock2/options.sumo | 0 .../siding_deadlock2/output.sumo | 0 .../siding_deadlock2/railsignalblocks.sumo | 0 .../siding_deadlock2/tripinfos.sumo | 0 tests/sumo/rail/deadlocks/testsuite.sumo | 20 +++++++++ .../triangle_6veh/deadlocks.sumo | 0 .../triangle_6veh/errors.sumo | 0 .../triangle_6veh/input_routes.rou.xml | 0 .../triangle_6veh/net.net.xml | 0 .../triangle_6veh/options.sumo | 0 .../triangle_6veh/output.sumo | 0 .../triangle_6veh/railsignalblocks.sumo | 0 .../triangle_6veh/tripinfos.sumo | 0 .../sumo/rail/siding/loop_3veh/deadlocks.sumo | 43 ------------------- .../sidingShort_deadlock/deadlocks.sumo | 43 ------------------- .../siding/siding_both_ways/deadlocks.sumo | 43 ------------------- .../siding/siding_both_ways2/deadlocks.sumo | 43 ------------------- .../siding/siding_both_ways3/deadlocks.sumo | 43 ------------------- .../siding/siding_both_ways4/deadlocks.sumo | 43 ------------------- .../siding_both_ways_addTrain/deadlocks.sumo | 43 ------------------- .../siding/siding_deadlock/deadlocks.sumo | 43 ------------------- .../siding/siding_noSignal/deadlocks.sumo | 43 ------------------- .../siding/siding_noSignal2/deadlocks.sumo | 43 ------------------- .../siding_occupied_advance/deadlocks.sumo | 43 ------------------- tests/sumo/rail/siding/testsuite.sumo | 21 --------- tests/sumo/rail/testsuite.sumo | 3 ++ 72 files changed, 23 insertions(+), 494 deletions(-) rename tests/sumo/rail/{siding => deadlocks}/circle_3veh.loadDL/deadlocks.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/circle_3veh.loadDL/errors.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/circle_3veh.loadDL/input_additional.add.xml (100%) rename tests/sumo/rail/{siding => deadlocks}/circle_3veh.loadDL/input_routes.rou.xml (100%) rename tests/sumo/rail/{siding => deadlocks}/circle_3veh.loadDL/net.net.xml (100%) rename tests/sumo/rail/{siding => deadlocks}/circle_3veh.loadDL/options.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/circle_3veh.loadDL/output.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/circle_3veh.loadDL/railsignalblocks.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/circle_3veh.loadDL/tripinfos.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/circle_3veh/deadlocks.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/circle_3veh/errors.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/circle_3veh/input_routes.rou.xml (100%) rename tests/sumo/rail/{siding => deadlocks}/circle_3veh/net.net.xml (100%) rename tests/sumo/rail/{siding => deadlocks}/circle_3veh/options.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/circle_3veh/output.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/circle_3veh/railsignalblocks.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/circle_3veh/tripinfos.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/loop_4veh/deadlocks.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/loop_4veh/errors.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/loop_4veh/input_routes.rou.xml (100%) rename tests/sumo/rail/{siding => deadlocks}/loop_4veh/net.net.xml (100%) rename tests/sumo/rail/{siding => deadlocks}/loop_4veh/options.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/loop_4veh/output.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/loop_4veh/railsignalblocks.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/loop_4veh/tripinfos.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/loop_4veh2/deadlocks.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/loop_4veh2/errors.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/loop_4veh2/input_routes.rou.xml (100%) rename tests/sumo/rail/{siding => deadlocks}/loop_4veh2/net.net.xml (100%) rename tests/sumo/rail/{siding => deadlocks}/loop_4veh2/options.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/loop_4veh2/output.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/loop_4veh2/railsignalblocks.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/loop_4veh2/tripinfos.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/loop_4veh3/deadlocks.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/loop_4veh3/errors.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/loop_4veh3/input_routes.rou.xml (100%) rename tests/sumo/rail/{siding => deadlocks}/loop_4veh3/net.net.xml (100%) rename tests/sumo/rail/{siding => deadlocks}/loop_4veh3/options.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/loop_4veh3/output.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/loop_4veh3/railsignalblocks.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/loop_4veh3/tripinfos.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/options.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/siding_deadlock2/deadlocks.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/siding_deadlock2/errors.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/siding_deadlock2/input_routes.rou.xml (100%) rename tests/sumo/rail/{siding => deadlocks}/siding_deadlock2/net.net.xml (100%) rename tests/sumo/rail/{siding => deadlocks}/siding_deadlock2/options.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/siding_deadlock2/output.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/siding_deadlock2/railsignalblocks.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/siding_deadlock2/tripinfos.sumo (100%) create mode 100644 tests/sumo/rail/deadlocks/testsuite.sumo rename tests/sumo/rail/{siding => deadlocks}/triangle_6veh/deadlocks.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/triangle_6veh/errors.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/triangle_6veh/input_routes.rou.xml (100%) rename tests/sumo/rail/{siding => deadlocks}/triangle_6veh/net.net.xml (100%) rename tests/sumo/rail/{siding => deadlocks}/triangle_6veh/options.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/triangle_6veh/output.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/triangle_6veh/railsignalblocks.sumo (100%) rename tests/sumo/rail/{siding => deadlocks}/triangle_6veh/tripinfos.sumo (100%) delete mode 100644 tests/sumo/rail/siding/loop_3veh/deadlocks.sumo delete mode 100644 tests/sumo/rail/siding/sidingShort_deadlock/deadlocks.sumo delete mode 100644 tests/sumo/rail/siding/siding_both_ways/deadlocks.sumo delete mode 100644 tests/sumo/rail/siding/siding_both_ways2/deadlocks.sumo delete mode 100644 tests/sumo/rail/siding/siding_both_ways3/deadlocks.sumo delete mode 100644 tests/sumo/rail/siding/siding_both_ways4/deadlocks.sumo delete mode 100644 tests/sumo/rail/siding/siding_both_ways_addTrain/deadlocks.sumo delete mode 100644 tests/sumo/rail/siding/siding_deadlock/deadlocks.sumo delete mode 100644 tests/sumo/rail/siding/siding_noSignal/deadlocks.sumo delete mode 100644 tests/sumo/rail/siding/siding_noSignal2/deadlocks.sumo delete mode 100644 tests/sumo/rail/siding/siding_occupied_advance/deadlocks.sumo diff --git a/tests/sumo/rail/siding/circle_3veh.loadDL/deadlocks.sumo b/tests/sumo/rail/deadlocks/circle_3veh.loadDL/deadlocks.sumo similarity index 100% rename from tests/sumo/rail/siding/circle_3veh.loadDL/deadlocks.sumo rename to tests/sumo/rail/deadlocks/circle_3veh.loadDL/deadlocks.sumo diff --git a/tests/sumo/rail/siding/circle_3veh.loadDL/errors.sumo b/tests/sumo/rail/deadlocks/circle_3veh.loadDL/errors.sumo similarity index 100% rename from tests/sumo/rail/siding/circle_3veh.loadDL/errors.sumo rename to tests/sumo/rail/deadlocks/circle_3veh.loadDL/errors.sumo diff --git a/tests/sumo/rail/siding/circle_3veh.loadDL/input_additional.add.xml b/tests/sumo/rail/deadlocks/circle_3veh.loadDL/input_additional.add.xml similarity index 100% rename from tests/sumo/rail/siding/circle_3veh.loadDL/input_additional.add.xml rename to tests/sumo/rail/deadlocks/circle_3veh.loadDL/input_additional.add.xml diff --git a/tests/sumo/rail/siding/circle_3veh.loadDL/input_routes.rou.xml b/tests/sumo/rail/deadlocks/circle_3veh.loadDL/input_routes.rou.xml similarity index 100% rename from tests/sumo/rail/siding/circle_3veh.loadDL/input_routes.rou.xml rename to tests/sumo/rail/deadlocks/circle_3veh.loadDL/input_routes.rou.xml diff --git a/tests/sumo/rail/siding/circle_3veh.loadDL/net.net.xml b/tests/sumo/rail/deadlocks/circle_3veh.loadDL/net.net.xml similarity index 100% rename from tests/sumo/rail/siding/circle_3veh.loadDL/net.net.xml rename to tests/sumo/rail/deadlocks/circle_3veh.loadDL/net.net.xml diff --git a/tests/sumo/rail/siding/circle_3veh.loadDL/options.sumo b/tests/sumo/rail/deadlocks/circle_3veh.loadDL/options.sumo similarity index 100% rename from tests/sumo/rail/siding/circle_3veh.loadDL/options.sumo rename to tests/sumo/rail/deadlocks/circle_3veh.loadDL/options.sumo diff --git a/tests/sumo/rail/siding/circle_3veh.loadDL/output.sumo b/tests/sumo/rail/deadlocks/circle_3veh.loadDL/output.sumo similarity index 100% rename from tests/sumo/rail/siding/circle_3veh.loadDL/output.sumo rename to tests/sumo/rail/deadlocks/circle_3veh.loadDL/output.sumo diff --git a/tests/sumo/rail/siding/circle_3veh.loadDL/railsignalblocks.sumo b/tests/sumo/rail/deadlocks/circle_3veh.loadDL/railsignalblocks.sumo similarity index 100% rename from tests/sumo/rail/siding/circle_3veh.loadDL/railsignalblocks.sumo rename to tests/sumo/rail/deadlocks/circle_3veh.loadDL/railsignalblocks.sumo diff --git a/tests/sumo/rail/siding/circle_3veh.loadDL/tripinfos.sumo b/tests/sumo/rail/deadlocks/circle_3veh.loadDL/tripinfos.sumo similarity index 100% rename from tests/sumo/rail/siding/circle_3veh.loadDL/tripinfos.sumo rename to tests/sumo/rail/deadlocks/circle_3veh.loadDL/tripinfos.sumo diff --git a/tests/sumo/rail/siding/circle_3veh/deadlocks.sumo b/tests/sumo/rail/deadlocks/circle_3veh/deadlocks.sumo similarity index 100% rename from tests/sumo/rail/siding/circle_3veh/deadlocks.sumo rename to tests/sumo/rail/deadlocks/circle_3veh/deadlocks.sumo diff --git a/tests/sumo/rail/siding/circle_3veh/errors.sumo b/tests/sumo/rail/deadlocks/circle_3veh/errors.sumo similarity index 100% rename from tests/sumo/rail/siding/circle_3veh/errors.sumo rename to tests/sumo/rail/deadlocks/circle_3veh/errors.sumo diff --git a/tests/sumo/rail/siding/circle_3veh/input_routes.rou.xml b/tests/sumo/rail/deadlocks/circle_3veh/input_routes.rou.xml similarity index 100% rename from tests/sumo/rail/siding/circle_3veh/input_routes.rou.xml rename to tests/sumo/rail/deadlocks/circle_3veh/input_routes.rou.xml diff --git a/tests/sumo/rail/siding/circle_3veh/net.net.xml b/tests/sumo/rail/deadlocks/circle_3veh/net.net.xml similarity index 100% rename from tests/sumo/rail/siding/circle_3veh/net.net.xml rename to tests/sumo/rail/deadlocks/circle_3veh/net.net.xml diff --git a/tests/sumo/rail/siding/circle_3veh/options.sumo b/tests/sumo/rail/deadlocks/circle_3veh/options.sumo similarity index 100% rename from tests/sumo/rail/siding/circle_3veh/options.sumo rename to tests/sumo/rail/deadlocks/circle_3veh/options.sumo diff --git a/tests/sumo/rail/siding/circle_3veh/output.sumo b/tests/sumo/rail/deadlocks/circle_3veh/output.sumo similarity index 100% rename from tests/sumo/rail/siding/circle_3veh/output.sumo rename to tests/sumo/rail/deadlocks/circle_3veh/output.sumo diff --git a/tests/sumo/rail/siding/circle_3veh/railsignalblocks.sumo b/tests/sumo/rail/deadlocks/circle_3veh/railsignalblocks.sumo similarity index 100% rename from tests/sumo/rail/siding/circle_3veh/railsignalblocks.sumo rename to tests/sumo/rail/deadlocks/circle_3veh/railsignalblocks.sumo diff --git a/tests/sumo/rail/siding/circle_3veh/tripinfos.sumo b/tests/sumo/rail/deadlocks/circle_3veh/tripinfos.sumo similarity index 100% rename from tests/sumo/rail/siding/circle_3veh/tripinfos.sumo rename to tests/sumo/rail/deadlocks/circle_3veh/tripinfos.sumo diff --git a/tests/sumo/rail/siding/loop_4veh/deadlocks.sumo b/tests/sumo/rail/deadlocks/loop_4veh/deadlocks.sumo similarity index 100% rename from tests/sumo/rail/siding/loop_4veh/deadlocks.sumo rename to tests/sumo/rail/deadlocks/loop_4veh/deadlocks.sumo diff --git a/tests/sumo/rail/siding/loop_4veh/errors.sumo b/tests/sumo/rail/deadlocks/loop_4veh/errors.sumo similarity index 100% rename from tests/sumo/rail/siding/loop_4veh/errors.sumo rename to tests/sumo/rail/deadlocks/loop_4veh/errors.sumo diff --git a/tests/sumo/rail/siding/loop_4veh/input_routes.rou.xml b/tests/sumo/rail/deadlocks/loop_4veh/input_routes.rou.xml similarity index 100% rename from tests/sumo/rail/siding/loop_4veh/input_routes.rou.xml rename to tests/sumo/rail/deadlocks/loop_4veh/input_routes.rou.xml diff --git a/tests/sumo/rail/siding/loop_4veh/net.net.xml b/tests/sumo/rail/deadlocks/loop_4veh/net.net.xml similarity index 100% rename from tests/sumo/rail/siding/loop_4veh/net.net.xml rename to tests/sumo/rail/deadlocks/loop_4veh/net.net.xml diff --git a/tests/sumo/rail/siding/loop_4veh/options.sumo b/tests/sumo/rail/deadlocks/loop_4veh/options.sumo similarity index 100% rename from tests/sumo/rail/siding/loop_4veh/options.sumo rename to tests/sumo/rail/deadlocks/loop_4veh/options.sumo diff --git a/tests/sumo/rail/siding/loop_4veh/output.sumo b/tests/sumo/rail/deadlocks/loop_4veh/output.sumo similarity index 100% rename from tests/sumo/rail/siding/loop_4veh/output.sumo rename to tests/sumo/rail/deadlocks/loop_4veh/output.sumo diff --git a/tests/sumo/rail/siding/loop_4veh/railsignalblocks.sumo b/tests/sumo/rail/deadlocks/loop_4veh/railsignalblocks.sumo similarity index 100% rename from tests/sumo/rail/siding/loop_4veh/railsignalblocks.sumo rename to tests/sumo/rail/deadlocks/loop_4veh/railsignalblocks.sumo diff --git a/tests/sumo/rail/siding/loop_4veh/tripinfos.sumo b/tests/sumo/rail/deadlocks/loop_4veh/tripinfos.sumo similarity index 100% rename from tests/sumo/rail/siding/loop_4veh/tripinfos.sumo rename to tests/sumo/rail/deadlocks/loop_4veh/tripinfos.sumo diff --git a/tests/sumo/rail/siding/loop_4veh2/deadlocks.sumo b/tests/sumo/rail/deadlocks/loop_4veh2/deadlocks.sumo similarity index 100% rename from tests/sumo/rail/siding/loop_4veh2/deadlocks.sumo rename to tests/sumo/rail/deadlocks/loop_4veh2/deadlocks.sumo diff --git a/tests/sumo/rail/siding/loop_4veh2/errors.sumo b/tests/sumo/rail/deadlocks/loop_4veh2/errors.sumo similarity index 100% rename from tests/sumo/rail/siding/loop_4veh2/errors.sumo rename to tests/sumo/rail/deadlocks/loop_4veh2/errors.sumo diff --git a/tests/sumo/rail/siding/loop_4veh2/input_routes.rou.xml b/tests/sumo/rail/deadlocks/loop_4veh2/input_routes.rou.xml similarity index 100% rename from tests/sumo/rail/siding/loop_4veh2/input_routes.rou.xml rename to tests/sumo/rail/deadlocks/loop_4veh2/input_routes.rou.xml diff --git a/tests/sumo/rail/siding/loop_4veh2/net.net.xml b/tests/sumo/rail/deadlocks/loop_4veh2/net.net.xml similarity index 100% rename from tests/sumo/rail/siding/loop_4veh2/net.net.xml rename to tests/sumo/rail/deadlocks/loop_4veh2/net.net.xml diff --git a/tests/sumo/rail/siding/loop_4veh2/options.sumo b/tests/sumo/rail/deadlocks/loop_4veh2/options.sumo similarity index 100% rename from tests/sumo/rail/siding/loop_4veh2/options.sumo rename to tests/sumo/rail/deadlocks/loop_4veh2/options.sumo diff --git a/tests/sumo/rail/siding/loop_4veh2/output.sumo b/tests/sumo/rail/deadlocks/loop_4veh2/output.sumo similarity index 100% rename from tests/sumo/rail/siding/loop_4veh2/output.sumo rename to tests/sumo/rail/deadlocks/loop_4veh2/output.sumo diff --git a/tests/sumo/rail/siding/loop_4veh2/railsignalblocks.sumo b/tests/sumo/rail/deadlocks/loop_4veh2/railsignalblocks.sumo similarity index 100% rename from tests/sumo/rail/siding/loop_4veh2/railsignalblocks.sumo rename to tests/sumo/rail/deadlocks/loop_4veh2/railsignalblocks.sumo diff --git a/tests/sumo/rail/siding/loop_4veh2/tripinfos.sumo b/tests/sumo/rail/deadlocks/loop_4veh2/tripinfos.sumo similarity index 100% rename from tests/sumo/rail/siding/loop_4veh2/tripinfos.sumo rename to tests/sumo/rail/deadlocks/loop_4veh2/tripinfos.sumo diff --git a/tests/sumo/rail/siding/loop_4veh3/deadlocks.sumo b/tests/sumo/rail/deadlocks/loop_4veh3/deadlocks.sumo similarity index 100% rename from tests/sumo/rail/siding/loop_4veh3/deadlocks.sumo rename to tests/sumo/rail/deadlocks/loop_4veh3/deadlocks.sumo diff --git a/tests/sumo/rail/siding/loop_4veh3/errors.sumo b/tests/sumo/rail/deadlocks/loop_4veh3/errors.sumo similarity index 100% rename from tests/sumo/rail/siding/loop_4veh3/errors.sumo rename to tests/sumo/rail/deadlocks/loop_4veh3/errors.sumo diff --git a/tests/sumo/rail/siding/loop_4veh3/input_routes.rou.xml b/tests/sumo/rail/deadlocks/loop_4veh3/input_routes.rou.xml similarity index 100% rename from tests/sumo/rail/siding/loop_4veh3/input_routes.rou.xml rename to tests/sumo/rail/deadlocks/loop_4veh3/input_routes.rou.xml diff --git a/tests/sumo/rail/siding/loop_4veh3/net.net.xml b/tests/sumo/rail/deadlocks/loop_4veh3/net.net.xml similarity index 100% rename from tests/sumo/rail/siding/loop_4veh3/net.net.xml rename to tests/sumo/rail/deadlocks/loop_4veh3/net.net.xml diff --git a/tests/sumo/rail/siding/loop_4veh3/options.sumo b/tests/sumo/rail/deadlocks/loop_4veh3/options.sumo similarity index 100% rename from tests/sumo/rail/siding/loop_4veh3/options.sumo rename to tests/sumo/rail/deadlocks/loop_4veh3/options.sumo diff --git a/tests/sumo/rail/siding/loop_4veh3/output.sumo b/tests/sumo/rail/deadlocks/loop_4veh3/output.sumo similarity index 100% rename from tests/sumo/rail/siding/loop_4veh3/output.sumo rename to tests/sumo/rail/deadlocks/loop_4veh3/output.sumo diff --git a/tests/sumo/rail/siding/loop_4veh3/railsignalblocks.sumo b/tests/sumo/rail/deadlocks/loop_4veh3/railsignalblocks.sumo similarity index 100% rename from tests/sumo/rail/siding/loop_4veh3/railsignalblocks.sumo rename to tests/sumo/rail/deadlocks/loop_4veh3/railsignalblocks.sumo diff --git a/tests/sumo/rail/siding/loop_4veh3/tripinfos.sumo b/tests/sumo/rail/deadlocks/loop_4veh3/tripinfos.sumo similarity index 100% rename from tests/sumo/rail/siding/loop_4veh3/tripinfos.sumo rename to tests/sumo/rail/deadlocks/loop_4veh3/tripinfos.sumo diff --git a/tests/sumo/rail/siding/options.sumo b/tests/sumo/rail/deadlocks/options.sumo similarity index 100% rename from tests/sumo/rail/siding/options.sumo rename to tests/sumo/rail/deadlocks/options.sumo diff --git a/tests/sumo/rail/siding/siding_deadlock2/deadlocks.sumo b/tests/sumo/rail/deadlocks/siding_deadlock2/deadlocks.sumo similarity index 100% rename from tests/sumo/rail/siding/siding_deadlock2/deadlocks.sumo rename to tests/sumo/rail/deadlocks/siding_deadlock2/deadlocks.sumo diff --git a/tests/sumo/rail/siding/siding_deadlock2/errors.sumo b/tests/sumo/rail/deadlocks/siding_deadlock2/errors.sumo similarity index 100% rename from tests/sumo/rail/siding/siding_deadlock2/errors.sumo rename to tests/sumo/rail/deadlocks/siding_deadlock2/errors.sumo diff --git a/tests/sumo/rail/siding/siding_deadlock2/input_routes.rou.xml b/tests/sumo/rail/deadlocks/siding_deadlock2/input_routes.rou.xml similarity index 100% rename from tests/sumo/rail/siding/siding_deadlock2/input_routes.rou.xml rename to tests/sumo/rail/deadlocks/siding_deadlock2/input_routes.rou.xml diff --git a/tests/sumo/rail/siding/siding_deadlock2/net.net.xml b/tests/sumo/rail/deadlocks/siding_deadlock2/net.net.xml similarity index 100% rename from tests/sumo/rail/siding/siding_deadlock2/net.net.xml rename to tests/sumo/rail/deadlocks/siding_deadlock2/net.net.xml diff --git a/tests/sumo/rail/siding/siding_deadlock2/options.sumo b/tests/sumo/rail/deadlocks/siding_deadlock2/options.sumo similarity index 100% rename from tests/sumo/rail/siding/siding_deadlock2/options.sumo rename to tests/sumo/rail/deadlocks/siding_deadlock2/options.sumo diff --git a/tests/sumo/rail/siding/siding_deadlock2/output.sumo b/tests/sumo/rail/deadlocks/siding_deadlock2/output.sumo similarity index 100% rename from tests/sumo/rail/siding/siding_deadlock2/output.sumo rename to tests/sumo/rail/deadlocks/siding_deadlock2/output.sumo diff --git a/tests/sumo/rail/siding/siding_deadlock2/railsignalblocks.sumo b/tests/sumo/rail/deadlocks/siding_deadlock2/railsignalblocks.sumo similarity index 100% rename from tests/sumo/rail/siding/siding_deadlock2/railsignalblocks.sumo rename to tests/sumo/rail/deadlocks/siding_deadlock2/railsignalblocks.sumo diff --git a/tests/sumo/rail/siding/siding_deadlock2/tripinfos.sumo b/tests/sumo/rail/deadlocks/siding_deadlock2/tripinfos.sumo similarity index 100% rename from tests/sumo/rail/siding/siding_deadlock2/tripinfos.sumo rename to tests/sumo/rail/deadlocks/siding_deadlock2/tripinfos.sumo diff --git a/tests/sumo/rail/deadlocks/testsuite.sumo b/tests/sumo/rail/deadlocks/testsuite.sumo new file mode 100644 index 000000000000..2bc703238352 --- /dev/null +++ b/tests/sumo/rail/deadlocks/testsuite.sumo @@ -0,0 +1,20 @@ +# siding cannot be used because it is already occupied, vehicle routes start or end in the siding +siding_deadlock2 + +# a loop that reverses on itself can create a deadlock with 4 vehicles (2 from either direction) +loop_4veh + +# a loop that reverses on itself can create a deadlock with 4 vehicles (2 from either direction), this time with different driveway initialization order +loop_4veh2 + +# collision (caused by rail-signal triggered rerouting) +loop_4veh3 + +# deadlock +triangle_6veh + +# deadlock +circle_3veh + +# avoid deadlock by loading a deadlock file +circle_3veh.loadDL diff --git a/tests/sumo/rail/siding/triangle_6veh/deadlocks.sumo b/tests/sumo/rail/deadlocks/triangle_6veh/deadlocks.sumo similarity index 100% rename from tests/sumo/rail/siding/triangle_6veh/deadlocks.sumo rename to tests/sumo/rail/deadlocks/triangle_6veh/deadlocks.sumo diff --git a/tests/sumo/rail/siding/triangle_6veh/errors.sumo b/tests/sumo/rail/deadlocks/triangle_6veh/errors.sumo similarity index 100% rename from tests/sumo/rail/siding/triangle_6veh/errors.sumo rename to tests/sumo/rail/deadlocks/triangle_6veh/errors.sumo diff --git a/tests/sumo/rail/siding/triangle_6veh/input_routes.rou.xml b/tests/sumo/rail/deadlocks/triangle_6veh/input_routes.rou.xml similarity index 100% rename from tests/sumo/rail/siding/triangle_6veh/input_routes.rou.xml rename to tests/sumo/rail/deadlocks/triangle_6veh/input_routes.rou.xml diff --git a/tests/sumo/rail/siding/triangle_6veh/net.net.xml b/tests/sumo/rail/deadlocks/triangle_6veh/net.net.xml similarity index 100% rename from tests/sumo/rail/siding/triangle_6veh/net.net.xml rename to tests/sumo/rail/deadlocks/triangle_6veh/net.net.xml diff --git a/tests/sumo/rail/siding/triangle_6veh/options.sumo b/tests/sumo/rail/deadlocks/triangle_6veh/options.sumo similarity index 100% rename from tests/sumo/rail/siding/triangle_6veh/options.sumo rename to tests/sumo/rail/deadlocks/triangle_6veh/options.sumo diff --git a/tests/sumo/rail/siding/triangle_6veh/output.sumo b/tests/sumo/rail/deadlocks/triangle_6veh/output.sumo similarity index 100% rename from tests/sumo/rail/siding/triangle_6veh/output.sumo rename to tests/sumo/rail/deadlocks/triangle_6veh/output.sumo diff --git a/tests/sumo/rail/siding/triangle_6veh/railsignalblocks.sumo b/tests/sumo/rail/deadlocks/triangle_6veh/railsignalblocks.sumo similarity index 100% rename from tests/sumo/rail/siding/triangle_6veh/railsignalblocks.sumo rename to tests/sumo/rail/deadlocks/triangle_6veh/railsignalblocks.sumo diff --git a/tests/sumo/rail/siding/triangle_6veh/tripinfos.sumo b/tests/sumo/rail/deadlocks/triangle_6veh/tripinfos.sumo similarity index 100% rename from tests/sumo/rail/siding/triangle_6veh/tripinfos.sumo rename to tests/sumo/rail/deadlocks/triangle_6veh/tripinfos.sumo diff --git a/tests/sumo/rail/siding/loop_3veh/deadlocks.sumo b/tests/sumo/rail/siding/loop_3veh/deadlocks.sumo deleted file mode 100644 index 0c4f8dd62432..000000000000 --- a/tests/sumo/rail/siding/loop_3veh/deadlocks.sumo +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - diff --git a/tests/sumo/rail/siding/sidingShort_deadlock/deadlocks.sumo b/tests/sumo/rail/siding/sidingShort_deadlock/deadlocks.sumo deleted file mode 100644 index 0c4f8dd62432..000000000000 --- a/tests/sumo/rail/siding/sidingShort_deadlock/deadlocks.sumo +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - diff --git a/tests/sumo/rail/siding/siding_both_ways/deadlocks.sumo b/tests/sumo/rail/siding/siding_both_ways/deadlocks.sumo deleted file mode 100644 index 73ef2c8877a2..000000000000 --- a/tests/sumo/rail/siding/siding_both_ways/deadlocks.sumo +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - diff --git a/tests/sumo/rail/siding/siding_both_ways2/deadlocks.sumo b/tests/sumo/rail/siding/siding_both_ways2/deadlocks.sumo deleted file mode 100644 index 73ef2c8877a2..000000000000 --- a/tests/sumo/rail/siding/siding_both_ways2/deadlocks.sumo +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - diff --git a/tests/sumo/rail/siding/siding_both_ways3/deadlocks.sumo b/tests/sumo/rail/siding/siding_both_ways3/deadlocks.sumo deleted file mode 100644 index 73ef2c8877a2..000000000000 --- a/tests/sumo/rail/siding/siding_both_ways3/deadlocks.sumo +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - diff --git a/tests/sumo/rail/siding/siding_both_ways4/deadlocks.sumo b/tests/sumo/rail/siding/siding_both_ways4/deadlocks.sumo deleted file mode 100644 index 73ef2c8877a2..000000000000 --- a/tests/sumo/rail/siding/siding_both_ways4/deadlocks.sumo +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - diff --git a/tests/sumo/rail/siding/siding_both_ways_addTrain/deadlocks.sumo b/tests/sumo/rail/siding/siding_both_ways_addTrain/deadlocks.sumo deleted file mode 100644 index 73ef2c8877a2..000000000000 --- a/tests/sumo/rail/siding/siding_both_ways_addTrain/deadlocks.sumo +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - diff --git a/tests/sumo/rail/siding/siding_deadlock/deadlocks.sumo b/tests/sumo/rail/siding/siding_deadlock/deadlocks.sumo deleted file mode 100644 index 73ef2c8877a2..000000000000 --- a/tests/sumo/rail/siding/siding_deadlock/deadlocks.sumo +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - diff --git a/tests/sumo/rail/siding/siding_noSignal/deadlocks.sumo b/tests/sumo/rail/siding/siding_noSignal/deadlocks.sumo deleted file mode 100644 index 0c4f8dd62432..000000000000 --- a/tests/sumo/rail/siding/siding_noSignal/deadlocks.sumo +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - diff --git a/tests/sumo/rail/siding/siding_noSignal2/deadlocks.sumo b/tests/sumo/rail/siding/siding_noSignal2/deadlocks.sumo deleted file mode 100644 index 0c4f8dd62432..000000000000 --- a/tests/sumo/rail/siding/siding_noSignal2/deadlocks.sumo +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - diff --git a/tests/sumo/rail/siding/siding_occupied_advance/deadlocks.sumo b/tests/sumo/rail/siding/siding_occupied_advance/deadlocks.sumo deleted file mode 100644 index 0c4f8dd62432..000000000000 --- a/tests/sumo/rail/siding/siding_occupied_advance/deadlocks.sumo +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - diff --git a/tests/sumo/rail/siding/testsuite.sumo b/tests/sumo/rail/siding/testsuite.sumo index 0f19de8c8480..dc3030380977 100644 --- a/tests/sumo/rail/siding/testsuite.sumo +++ b/tests/sumo/rail/siding/testsuite.sumo @@ -21,9 +21,6 @@ siding_both_ways4 # siding cannot be used because it is already occupied siding_deadlock -# siding cannot be used because it is already occupied, vehicle routes start or end in the siding -siding_deadlock2 - # driveway should be usable despite occupied siding if the other side is still usable siding_occupied_advance @@ -38,21 +35,3 @@ siding_noSignal2 # a loop that reverses on itself can create a deadlock with 3 vehicles loop_3veh - -# a loop that reverses on itself can create a deadlock with 4 vehicles (2 from either direction) -loop_4veh - -# a loop that reverses on itself can create a deadlock with 4 vehicles (2 from either direction), this time with different driveway initialization order -loop_4veh2 - -# collision (caused by rail-signal triggered rerouting) -loop_4veh3 - -# deadlock -triangle_6veh - -# deadlock -circle_3veh - -# avoid deadlock by loading a deadlock file -circle_3veh.loadDL diff --git a/tests/sumo/rail/testsuite.sumo b/tests/sumo/rail/testsuite.sumo index 5433a56f3ee1..d4c8c47d27e3 100644 --- a/tests/sumo/rail/testsuite.sumo +++ b/tests/sumo/rail/testsuite.sumo @@ -4,6 +4,9 @@ rail_signal # test for conflicts and deadlocks involving a siding siding +# complex deadlocks that are not found automatically +deadlocks + # trams driving in a loop servicing stops tramwayLoop From 8b17697e9332c07bb31a18d8ac39991dc4e53abd Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Mon, 14 Oct 2024 17:02:49 +0200 Subject: [PATCH 284/334] removing unused code refs #12 --- src/microsim/traffic_lights/MSDriveWay.cpp | 80 +++---------------- src/microsim/traffic_lights/MSDriveWay.h | 3 - src/microsim/traffic_lights/MSRailSignal.cpp | 24 ------ .../traffic_lights/MSRailSignalControl.cpp | 36 --------- .../traffic_lights/MSRailSignalControl.h | 19 ----- 5 files changed, 11 insertions(+), 151 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 37cd856a7883..fc06aaaf290e 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -102,7 +102,6 @@ MSDriveWay::MSDriveWay(const MSLink* origin, const std::string& id, bool tempora myOrigin(origin), myMaxFlankLength(0), myActive(nullptr), - myProtectedBidi(nullptr), myCoreSize(0), myFoundSignal(false), myFoundJump(false), @@ -1000,49 +999,19 @@ MSDriveWay::buildRoute(const MSLink* origin, double length, continue; } if (link->getViaLaneOrLane() != bidi) { - const MSEdge* const bidiNext = bidi->getNextNormal(); myCoreSize = (int)myRoute.size(); - if (MSRailSignalControl::getInstance().getUsedEdges().count(bidiNext) == 0 && false) { #ifdef DEBUG_DRIVEWAY_BUILDROUTE - if (gDebugFlag4) { - std::cout << " abort: found protecting switch " << ili.viaLink->getDescription() << "\n"; - } -#endif - // if bidi is actually used by a train (rather than - // the other route) we must later adapt this driveway for additional checks (myBidiExtended) - myProtectedBidi = bidiNext; - std::set visitedEdges; - for (auto item : visited) { - visitedEdges.insert(&item.first->getEdge()); - } - while (next != end) { - // if bidiNext is used at some point, this driveway will be updated - // by looking further along the route until a new protecting switch is found or there are no more bidi edges. - // For this reason, we must record the rest of the route (or at least up to where it loops back on itself). - // This leads to seemingly redundant driveways that may be differentiated on update. - visitedEdges.insert(*next); - const MSEdge* nextBidi = (*next)->getBidiEdge(); - if (nextBidi != nullptr) { - visitedEdges.insert(nextBidi); - } - myRoute.push_back(*next); - next++; - } - return; - } else { -#ifdef DEBUG_DRIVEWAY_BUILDROUTE - if (gDebugFlag4) { - std::cout << " found unsafe switch " << ili.viaLink->getDescription() << " (used=" << bidiNext->getID() << ")\n"; - } + if (gDebugFlag4) { + const MSEdge* const bidiNext = bidi->getNextNormal(); + std::cout << " found unsafe switch " << ili.viaLink->getDescription() << " (used=" << bidiNext->getID() << ")\n"; + } #endif - // trains along our route beyond this switch - // might create deadlock - foundUnsafeSwitch = true; - // the switch itself must still be guarded to ensure safety - for (const auto& ili2 : bidi->getIncomingLanes()) { - if (ili2.viaLink->getDirection() != LinkDirection::TURN) { - flankSwitches.insert(ili.viaLink); - } + // trains along our route beyond this switch might create deadlock + foundUnsafeSwitch = true; + // the switch itself must still be guarded to ensure safety + for (const auto& ili2 : bidi->getIncomingLanes()) { + if (ili2.viaLink->getDirection() != LinkDirection::TURN) { + flankSwitches.insert(ili.viaLink); } } } @@ -1320,9 +1289,7 @@ MSDriveWay::buildDriveWay(const std::string& id, const MSLink* link, MSRouteIter before.push_back(fromBidi); } dw->buildRoute(link, 0., first, end, visited, flankSwitches); - if (dw->myProtectedBidi == nullptr) { - dw->myCoreSize = (int)dw->myRoute.size(); - } + dw->myCoreSize = (int)dw->myRoute.size(); dw->checkFlanks(link, dw->myForward, visited, true, flankSwitches); dw->checkFlanks(link, dw->myBidi, visited, false, flankSwitches); dw->checkFlanks(link, before, visited, true, flankSwitches); @@ -1364,10 +1331,6 @@ MSDriveWay::buildDriveWay(const std::string& id, const MSLink* link, MSRouteIter } dw->myConflictLanes.insert(dw->myConflictLanes.end(), dw->myBidi.begin(), dw->myBidi.end()); dw->myConflictLanes.insert(dw->myConflictLanes.end(), dw->myFlank.begin(), dw->myFlank.end()); - if (dw->myProtectedBidi != nullptr) { - MSRailSignalControl::getInstance().registerProtectedDriveway(rs, dw->myRoute.front(), dw->myNumericalID, dw->myProtectedBidi); - } - dw->addBidiFoes(rs, false); dw->addBidiFoes(rs, true); // add driveways that start on the same signal / lane @@ -1967,27 +1930,6 @@ MSDriveWay::getDepartureDriveway(const SUMOVehicle* veh) { } -void -MSDriveWay::updateDepartDriveway(const MSEdge* first, int dwID) { - for (MSDriveWay* oldDW : myDepartureDriveways[first]) { - if (oldDW->getNumericalID() == dwID) { -#ifdef DEBUG_BUILD_DRIVEWAY - if (DEBUG_COND_DW) { - std::cout << "updateDepartDriveway " << oldDW->getID() << "\n"; - } -#endif - MSDriveWay* dw = buildDriveWay(oldDW->getID(), nullptr, oldDW->myRoute.begin(), oldDW->myRoute.end()); - dw->myVehicleEvents = oldDW->myVehicleEvents; - myDepartureDriveways[first].push_back(dw); - myDepartureDrivewaysEnds[&dw->myForward.back()->getEdge()].push_back(dw); - delete oldDW; - return; - } - } - WRITE_WARNINGF("Could not update depart-driveway % starting on edge %", dwID, first->getID()); -} - - void MSDriveWay::writeDepatureBlocks(OutputDevice& od, bool writeVehicles) { for (auto item : myDepartureDriveways) { diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h index a4717e8d6d8b..e4082e052fd8 100644 --- a/src/microsim/traffic_lights/MSDriveWay.h +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -191,9 +191,6 @@ class MSDriveWay : public MSMoveReminder, public Named { /// @brief whether the current signal is switched green for a train approaching this block const SUMOVehicle* myActive; - /// @brief switch assumed safe from bidi-traffic - const MSEdge* myProtectedBidi; - /// @brief list of edges for matching against train routes std::vector myRoute; diff --git a/src/microsim/traffic_lights/MSRailSignal.cpp b/src/microsim/traffic_lights/MSRailSignal.cpp index 3635eb163e30..b850ee7bc6ba 100644 --- a/src/microsim/traffic_lights/MSRailSignal.cpp +++ b/src/microsim/traffic_lights/MSRailSignal.cpp @@ -630,30 +630,6 @@ MSRailSignal::retrieveDriveWays(int tlIndex) const { } -void -MSRailSignal::updateDriveway(int numericalID) { - for (LinkInfo& li : myLinkInfos) { - for (auto it = li.myDriveways.begin(); it != li.myDriveways.end(); it++) { - const MSDriveWay* dw = *it; - if (dw->getNumericalID() == numericalID) { -#ifdef DEBUG_DRIVEWAY_UPDATE - std::cout << SIMTIME << " rail signal junction '" << getID() << "' requires update for driveway " << numericalID << "\n"; -#endif - std::string oldID = dw->getID(); - std::vector route = dw->getRoute(); - auto oldEvents = dw->getEvents(); - delete *it; - li.myDriveways.erase(it); - // restore driveway to preserve events - MSDriveWay* newDW = MSDriveWay::buildDriveWay(oldID, li.myLink, route.begin(), route.end()); - newDW->setEvents(oldEvents); - li.myDriveways.push_back(newDW); - return; - } - } - } -} - std::string MSRailSignal::getBlockingVehicleIDs() const { MSRailSignal* rs = const_cast(this); diff --git a/src/microsim/traffic_lights/MSRailSignalControl.cpp b/src/microsim/traffic_lights/MSRailSignalControl.cpp index 470ad203a0e1..5e0599ee3fd9 100644 --- a/src/microsim/traffic_lights/MSRailSignalControl.cpp +++ b/src/microsim/traffic_lights/MSRailSignalControl.cpp @@ -32,7 +32,6 @@ #include "MSRailSignalControl.h" -//#define DEBUG_REGISTER_DRIVEWAY //#define DEBUG_SIGNALSTATE //#define DEBUG_RECHECKGREEN //#define DEBUG_BUILD_DEADLOCK_CHECK @@ -66,8 +65,6 @@ MSRailSignalControl::cleanup() { void MSRailSignalControl::clearState() { if (myInstance != nullptr) { - myInstance->myUsedEdges.clear(); - myInstance->myProtectedDriveways.clear(); myInstance->myDriveWayCompatibility.clear(); myInstance->myDriveWaySucc.clear(); myInstance->myDriveWayPred.clear(); @@ -84,17 +81,6 @@ MSRailSignalControl::~MSRailSignalControl() { void MSRailSignalControl::vehicleStateChanged(const SUMOVehicle* const vehicle, MSNet::VehicleState to, const std::string& /*info*/) { if (isRailway(vehicle->getVClass())) { - if (to == MSNet::VehicleState::NEWROUTE || to == MSNet::VehicleState::DEPARTED || to == MSNet::VehicleState::BUILT) { - for (const MSEdge* edge : vehicle->getRoute().getEdges()) { - myUsedEdges.insert(edge); - if (myProtectedDriveways.count(edge) != 0) { -#ifdef DEBUG_REGISTER_DRIVEWAY - std::cout << "MSRailSignalControl edge=" << edge->getID() << " used by vehicle " << vehicle->getID() << ". Updating " << myProtectedDriveways[edge].size() << " driveways, time=" << time2string(SIMSTEP) << "\n"; -#endif - updateDriveways(edge); - } - } - } std::string dummyMsg; if ((to == MSNet::VehicleState::BUILT && (!vehicle->getParameter().wasSet(VEHPARS_FORCE_REROUTE) || vehicle->hasValidRoute(dummyMsg))) || (!vehicle->hasDeparted() && to == MSNet::VehicleState::NEWROUTE)) { @@ -107,28 +93,6 @@ MSRailSignalControl::vehicleStateChanged(const SUMOVehicle* const vehicle, MSNet } -void -MSRailSignalControl::registerProtectedDriveway(MSRailSignal* rs, const MSEdge* first, int driveWayID, const MSEdge* protectedBidi) { - myProtectedDriveways[protectedBidi].push_back(ProtectedDriveway(rs, first, driveWayID)); -#ifdef DEBUG_REGISTER_DRIVEWAY - std::cout << "MSRailSignalControl edge=" << protectedBidi->getID() << " assumed secure by driveway " << driveWayID << " at signal " << Named::getIDSecure(rs) << " first=" << first->getID() << "\n"; -#endif -} - - -void -MSRailSignalControl::updateDriveways(const MSEdge* used) { - for (const ProtectedDriveway& pdw : myProtectedDriveways[used]) { - if (pdw.rs != nullptr) { - pdw.rs->updateDriveway(pdw.dwID); - } else { - MSDriveWay::updateDepartDriveway(pdw.first, pdw.dwID); - } - } - myProtectedDriveways.erase(used); -} - - void MSRailSignalControl::addSignal(MSRailSignal* signal) { mySignals.push_back(signal); diff --git a/src/microsim/traffic_lights/MSRailSignalControl.h b/src/microsim/traffic_lights/MSRailSignalControl.h index 2e1be390409a..c54f5cdcafee 100644 --- a/src/microsim/traffic_lights/MSRailSignalControl.h +++ b/src/microsim/traffic_lights/MSRailSignalControl.h @@ -77,13 +77,6 @@ class MSRailSignalControl : public MSNet::VehicleStateListener { */ void vehicleStateChanged(const SUMOVehicle* const vehicle, MSNet::VehicleState to, const std::string& info = ""); - /// @brief mark driveway that must receive additional checks if protectedBidi is ever used by a train route - void registerProtectedDriveway(MSRailSignal* rs, const MSEdge* first, int driveWayID, const MSEdge* protectedBidi); - - const std::set& getUsedEdges() const { - return myUsedEdges; - } - void addSignal(MSRailSignal* signal); const std::vector& getSignals() const { @@ -116,18 +109,6 @@ class MSRailSignalControl : public MSNet::VehicleStateListener { /// @brief all rail edges that are part of a known route std::set myUsedEdges; - struct ProtectedDriveway { - ProtectedDriveway(MSRailSignal* _rs, const MSEdge* _first, int _dwID) : - rs(_rs), first(_first), dwID(_dwID) {}; - - MSRailSignal* rs; - const MSEdge* first; - int dwID; - }; - - /// @brief map of driveways that must perform additional checks if the key edge is used by a train route - std::map > myProtectedDriveways; - std::map > myWaitRelations; mutable std::set > myWrittenDeadlocks; From fb82daa84445f65d1c0288eefe75e137c2c35fa7 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Mon, 14 Oct 2024 17:08:44 +0200 Subject: [PATCH 285/334] removing more unused code (deleting of driveways only happens at simulation and therefore no intermediate cleanup is needed) refs #12 --- src/microsim/traffic_lights/MSDriveWay.cpp | 62 +--------------------- src/microsim/traffic_lights/MSDriveWay.h | 7 --- 2 files changed, 1 insertion(+), 68 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index fc06aaaf290e..be05925b28f2 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -110,62 +110,7 @@ MSDriveWay::MSDriveWay(const MSLink* origin, const std::string& id, bool tempora {} -MSDriveWay::~MSDriveWay() { - for (SUMOVehicle* veh : myTrains) { - MSBaseVehicle* bVeh = dynamic_cast(veh); - bVeh->removeReminder(this); - } - for (const MSLane* lane : myForward) { - const_cast(lane)->removeMoveReminder(this); - } - cleanupPointersToSelf(myFoes); - cleanupPointersToSelf(myUpdateDelete); - for (const MSLink* link : myForwardSwitches) { - std::vector& dws = mySwitchDriveWays[link]; - dws.erase(std::find(dws.begin(), dws.end(), this)); - } - for (const MSEdge* edge : myReversals) { - std::vector& dws = myReversalDriveWays[edge]; - dws.erase(std::find(dws.begin(), dws.end(), this)); - } - if (myLane != nullptr) { - const MSEdge* first = &myLane->getEdge(); - if (isDepartDriveway() && !myIsSubDriveway) { - std::vector& dws = myDepartureDriveways[first]; - dws.erase(std::find(dws.begin(), dws.end(), this)); - std::vector& dws2 = myDepartureDrivewaysEnds[&myForward.back()->getEdge()]; - dws2.erase(std::find(dws2.begin(), dws2.end(), this)); - } - } - if (myNumericalID != -1 && myForward.size() > 0 && !myIsSubDriveway) { - std::vector& dws = myEndingDriveways[&myForward.back()->getEdge()]; - dws.erase(std::find(dws.begin(), dws.end(), this)); - } - for (const MSDriveWay* sub : mySubDriveWays) { - delete sub; - } -} - -void -MSDriveWay::cleanupPointersToSelf(const std::vector others) { - for (MSDriveWay* foe : others) { - if (foe == this) { - continue; - } - auto it = std::find(foe->myFoes.begin(), foe->myFoes.end(), this); - if (it != foe->myFoes.end()) { - foe->myFoes.erase(it); - } - auto it2 = foe->mySidings.find(this); - if (it2 != foe->mySidings.end()) { - foe->mySidings.erase(it2); - } - auto it3 = std::find(foe->myUpdateDelete.begin(), foe->myUpdateDelete.end(), this); - if (it3 != foe->myUpdateDelete.end()) { - foe->myUpdateDelete.erase(it3); - } - } -} +MSDriveWay::~MSDriveWay() { } void MSDriveWay::cleanup() { @@ -1045,7 +990,6 @@ MSDriveWay::buildRoute(const MSLink* origin, double length, // switch on driveway //std::cout << "mySwitchDriveWays " << getID() << " link=" << link->getDescription() << "\n"; mySwitchDriveWays[link].push_back(this); - myForwardSwitches.push_back(link); } if (link->getLane()->getBidiLane() != nullptr && &link->getLane()->getEdge() == current->getBidiEdge()) { // reversal on driveway @@ -1359,7 +1303,6 @@ MSDriveWay::buildDriveWay(const std::string& id, const MSLink* link, MSRouteIter #endif foe->myFoes.push_back(dw); foe->addSidings(dw); - dw->myUpdateDelete.push_back(foe); } else { dw->buildSubFoe(foe, movingBlock); } @@ -1371,7 +1314,6 @@ MSDriveWay::buildDriveWay(const std::string& id, const MSLink* link, MSRouteIter #endif dw->myFoes.push_back(foe); dw->addSidings(foe); - foe->myUpdateDelete.push_back(dw); } else { foe->buildSubFoe(dw, movingBlock); } @@ -1680,14 +1622,12 @@ MSDriveWay::buildSubFoe(MSDriveWay* foe, bool movingBlock) { foe->myFoes.push_back(this); // foe will get the sidings addSidings(foe, true); - myUpdateDelete.push_back(foe); } #ifdef DEBUG_BUILD_SUBDRIVEWAY std::cout << SIMTIME << " buildSubFoe dw=" << getID() << " foe=" << foe->getID() << " terminates\n"; #endif } else if (myTerminateRoute && myBidi.size() <= myForward.size()) { foe->myFoes.push_back(this); - myUpdateDelete.push_back(foe); #ifdef DEBUG_BUILD_SUBDRIVEWAY std::cout << SIMTIME << " buildSubFoe dw=" << getID() << " terminates, foe=" << foe->getID() << "\n"; #endif diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h index e4082e052fd8..927127063c6d 100644 --- a/src/microsim/traffic_lights/MSDriveWay.h +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -330,18 +330,11 @@ class MSDriveWay : public MSMoveReminder, public Named { std::map, ComparatorIdLess> mySidings; std::vector > myDeadlocks; - /* @brief driveways that are not foes but to which this driveway is a foe - * (must be updated if this driveway is deleted */ - std::vector myUpdateDelete; - /* @brief shortened versions of this driveway to be used as foes instead of the long original * (ends as soon as the train has left a particular conflict section) * they are never attached to a LinkInfo and thus never the target of the match() function */ std::vector mySubDriveWays; - /// @brief track own occurences in mySwitchDriveWays for cleanup in destructor - std::vector myForwardSwitches; - /// @brief track own occurences in myReversalDriveWays for cleanup in destructor std::vector myReversals; From aa43601cf7e164f6dbadd7b0ff0515eee564c75a Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Mon, 14 Oct 2024 17:16:02 +0200 Subject: [PATCH 286/334] removing even more unused code (driveways foe relationships are more robust so no secondary green check is needed) refs #12 --- src/microsim/MSNet.cpp | 3 - src/microsim/traffic_lights/MSRailSignal.cpp | 4 -- .../traffic_lights/MSRailSignalControl.cpp | 72 ------------------- .../traffic_lights/MSRailSignalControl.h | 5 -- 4 files changed, 84 deletions(-) diff --git a/src/microsim/MSNet.cpp b/src/microsim/MSNet.cpp index 916d7569e6da..bc11680c928a 100644 --- a/src/microsim/MSNet.cpp +++ b/src/microsim/MSNet.cpp @@ -764,9 +764,6 @@ MSNet::simulationStep(const bool onlyMove) { MSRailSignalControl::getInstance().resetWaitRelations(); } myBeginOfTimestepEvents->execute(myStep); - if (MSRailSignalControl::hasInstance()) { - MSRailSignalControl::getInstance().recheckGreen(); - } #ifdef HAVE_FOX MSRoutingEngine::waitForAll(); #endif diff --git a/src/microsim/traffic_lights/MSRailSignal.cpp b/src/microsim/traffic_lights/MSRailSignal.cpp index b850ee7bc6ba..3067eb99ab89 100644 --- a/src/microsim/traffic_lights/MSRailSignal.cpp +++ b/src/microsim/traffic_lights/MSRailSignal.cpp @@ -155,10 +155,6 @@ MSRailSignal::updateCurrentPhase() { #endif } else { state[li.myLink->getTLIndex()] = 'G'; - if (driveway.getFlank().size() > 0 && myCurrentPhase.getState()[li.myLink->getTLIndex()] != 'G') { - // schedule recheck - MSRailSignalControl::getInstance().addGreenFlankSwitch(li.myLink, driveway.getNumericalID()); - } #ifdef DEBUG_SIGNALSTATE if (gDebugFlag4) { std::cout << SIMTIME << " rsl=" << li.getID() << " veh=" << closest.first->getID() << " reserved\n"; diff --git a/src/microsim/traffic_lights/MSRailSignalControl.cpp b/src/microsim/traffic_lights/MSRailSignalControl.cpp index 5e0599ee3fd9..b2e7a9dfa9b7 100644 --- a/src/microsim/traffic_lights/MSRailSignalControl.cpp +++ b/src/microsim/traffic_lights/MSRailSignalControl.cpp @@ -32,8 +32,6 @@ #include "MSRailSignalControl.h" -//#define DEBUG_SIGNALSTATE -//#define DEBUG_RECHECKGREEN //#define DEBUG_BUILD_DEADLOCK_CHECK // =========================================================================== @@ -69,7 +67,6 @@ MSRailSignalControl::clearState() { myInstance->myDriveWaySucc.clear(); myInstance->myDriveWayPred.clear(); myInstance->myWrittenDeadlocks.clear(); - myInstance->myDWDeadlocks.clear(); myInstance->myDeadlockChecks.clear(); } } @@ -99,75 +96,6 @@ MSRailSignalControl::addSignal(MSRailSignal* signal) { } -void -MSRailSignalControl::recheckGreen() { - if (mySwitchedGreenFlanks.size() > 0) { - for (const auto& item : mySwitchedGreenFlanks) { - for (const auto& item2 : mySwitchedGreenFlanks) { - if (item.second < item2.second) { - bool conflict = false; - std::pair code(item.second, item2.second); - auto it = myDriveWayCompatibility.find(code); - if (it != myDriveWayCompatibility.end()) { - conflict = it->second; - } else { - // new driveway pair - const MSRailSignal* rs = static_cast(item.first->getTLLogic()); - const MSRailSignal* rs2 = static_cast(item2.first->getTLLogic()); - const MSDriveWay& dw = rs->retrieveDriveWay(item.second); - const MSDriveWay& dw2 = rs2->retrieveDriveWay(item2.second); - // overlap may return true if the driveways are consecutive forward sections - conflict = dw.flankConflict(dw2) || dw2.flankConflict(dw); - myDriveWayCompatibility[code] = conflict; -#ifdef DEBUG_RECHECKGREEN - std::cout << SIMTIME << " new code " << code.first << "," << code.second << " conflict=" << conflict << " dw=" << toString(dw.myRoute) << " dw2=" << toString(dw2.myRoute) << "\n"; -#endif - } - if (conflict) { - MSRailSignal* rs = const_cast(static_cast(item.first->getTLLogic())); - MSRailSignal* rs2 = const_cast(static_cast(item2.first->getTLLogic())); - const MSRailSignal::Approaching& veh = item.first->getClosest(); - const MSRailSignal::Approaching& veh2 = item2.first->getClosest(); - if (MSDriveWay::mustYield(veh, veh2)) { - std::string state = rs->getCurrentPhaseDef().getState(); - state[item.first->getTLIndex()] = 'r'; - const_cast(rs->getCurrentPhaseDef()).setState(state); - rs->setTrafficLightSignals(MSNet::getInstance()->getCurrentTimeStep()); -#ifdef DEBUG_RECHECKGREEN - std::cout << SIMTIME << " reset to red " << getClickableTLLinkID(item.first) - << " (" << veh.first->getID() << " yields to " << veh2.first->getID() << "\n"; -#endif -#ifdef DEBUG_SIGNALSTATE - if (DEBUG_HELPER(rs)) { - std::cout << SIMTIME << " reset to red " << getClickableTLLinkID(item.first) - << " (" << veh.first->getID() << " yields to " << veh2.first->getID() << "\n"; - } -#endif - } else { - std::string state = rs2->getCurrentPhaseDef().getState(); - state[item2.first->getTLIndex()] = 'r'; - const_cast(rs2->getCurrentPhaseDef()).setState(state); - rs2->setTrafficLightSignals(MSNet::getInstance()->getCurrentTimeStep()); -#ifdef DEBUG_RECHECKGREEN - std::cout << SIMTIME << " reset to red " << getClickableTLLinkID(item2.first) - << " (" << veh2.first->getID() << " yields to " << veh.first->getID() << "\n"; -#endif -#ifdef DEBUG_SIGNALSTATE - if (DEBUG_HELPER(rs2)) { - std::cout << SIMTIME << " reset to red " << getClickableTLLinkID(item2.first) - << " (" << veh2.first->getID() << " yields to " << veh.first->getID() << "\n"; - } -#endif - } - } - } - } - } - mySwitchedGreenFlanks.clear(); - } -} - - bool MSRailSignalControl::haveDeadlock(const SUMOVehicle* veh) const { std::set seen; diff --git a/src/microsim/traffic_lights/MSRailSignalControl.h b/src/microsim/traffic_lights/MSRailSignalControl.h index c54f5cdcafee..316ac2cbc00e 100644 --- a/src/microsim/traffic_lights/MSRailSignalControl.h +++ b/src/microsim/traffic_lights/MSRailSignalControl.h @@ -83,10 +83,6 @@ class MSRailSignalControl : public MSNet::VehicleStateListener { return mySignals; } - void addGreenFlankSwitch(MSLink* link, int dwID) { - mySwitchedGreenFlanks.emplace_back(link, dwID); - } - /// @brief final check for driveway compatibility of signals that switched green in this step void recheckGreen(); @@ -113,7 +109,6 @@ class MSRailSignalControl : public MSNet::VehicleStateListener { mutable std::set > myWrittenDeadlocks; std::map > myDeadlockChecks; - std::set > myDWDeadlocks; std::map> myDriveWaySucc; std::map> myDriveWayPred; From 74069decff652d91f4ff6d261f8a28cb90fab86f Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Mon, 14 Oct 2024 17:32:56 +0200 Subject: [PATCH 287/334] added tests refs #21, #15569 --- tests/sumo/rail/deadlocks/testsuite.sumo | 3 - .../circle_3veh}/deadlocks.sumo | 0 .../circle_3veh}/errors.sumo | 0 .../circle_3veh}/input_additional.add.xml | 0 .../circle_3veh}/input_routes.rou.xml | 0 .../circle_3veh}/net.net.xml | 0 .../circle_3veh}/options.sumo | 0 .../circle_3veh}/output.sumo | 0 .../circle_3veh}/railsignalblocks.sumo | 0 .../circle_3veh}/tripinfos.sumo | 0 .../loop_4veh/deadlocks.sumo | 44 ++ .../deadlocks_loadHints/loop_4veh/errors.sumo | 0 .../loop_4veh/input_additional.add.xml | 44 ++ .../loop_4veh/input_routes.rou.xml | 42 ++ .../deadlocks_loadHints/loop_4veh/net.net.xml | 489 ++++++++++++++++++ .../loop_4veh/options.sumo | 3 + .../deadlocks_loadHints/loop_4veh/output.sumo | 0 .../loop_4veh/railsignalblocks.sumo | 213 ++++++++ .../loop_4veh/tripinfos.sumo | 48 ++ .../loop_4veh2/deadlocks.sumo | 44 ++ .../loop_4veh2/errors.sumo | 0 .../loop_4veh2/input_additional.add.xml | 44 ++ .../loop_4veh2/input_routes.rou.xml | 42 ++ .../loop_4veh2/net.net.xml | 489 ++++++++++++++++++ .../loop_4veh2/options.sumo | 3 + .../loop_4veh2/output.sumo | 0 .../loop_4veh2/railsignalblocks.sumo | 213 ++++++++ .../loop_4veh2/tripinfos.sumo | 48 ++ .../loop_4veh3/deadlocks.sumo | 44 ++ .../loop_4veh3/errors.sumo | 1 + .../loop_4veh3/input_additional.add.xml | 44 ++ .../loop_4veh3/input_routes.rou.xml | 46 ++ .../loop_4veh3/net.net.xml | 489 ++++++++++++++++++ .../loop_4veh3/options.sumo | 4 + .../loop_4veh3/output.sumo | 0 .../loop_4veh3/railsignalblocks.sumo | 135 +++++ .../loop_4veh3/tripinfos.sumo | 46 ++ .../rail/deadlocks_loadHints/options.sumo | 1 + .../siding_deadlock2/deadlocks.sumo | 45 ++ .../siding_deadlock2/errors.sumo | 0 .../siding_deadlock2/input_additional.add.xml | 45 ++ .../siding_deadlock2/input_routes.rou.xml | 47 ++ .../siding_deadlock2/net.net.xml | 236 +++++++++ .../siding_deadlock2/options.sumo | 4 + .../siding_deadlock2/output.sumo | 0 .../siding_deadlock2/railsignalblocks.sumo | 149 ++++++ .../siding_deadlock2/tripinfos.sumo | 49 ++ .../rail/deadlocks_loadHints/testsuite.sumo | 17 + .../triangle_6veh/deadlocks.sumo | 45 ++ .../triangle_6veh/errors.sumo | 0 .../triangle_6veh/input_additional.add.xml | 45 ++ .../triangle_6veh/input_routes.rou.xml | 53 ++ .../triangle_6veh/net.net.xml | 281 ++++++++++ .../triangle_6veh/options.sumo | 4 + .../triangle_6veh/output.sumo | 0 .../triangle_6veh/railsignalblocks.sumo | 165 ++++++ .../triangle_6veh/tripinfos.sumo | 51 ++ tests/sumo/rail/testsuite.sumo | 3 + 58 files changed, 3815 insertions(+), 3 deletions(-) rename tests/sumo/rail/{deadlocks/circle_3veh.loadDL => deadlocks_loadHints/circle_3veh}/deadlocks.sumo (100%) rename tests/sumo/rail/{deadlocks/circle_3veh.loadDL => deadlocks_loadHints/circle_3veh}/errors.sumo (100%) rename tests/sumo/rail/{deadlocks/circle_3veh.loadDL => deadlocks_loadHints/circle_3veh}/input_additional.add.xml (100%) rename tests/sumo/rail/{deadlocks/circle_3veh.loadDL => deadlocks_loadHints/circle_3veh}/input_routes.rou.xml (100%) rename tests/sumo/rail/{deadlocks/circle_3veh.loadDL => deadlocks_loadHints/circle_3veh}/net.net.xml (100%) rename tests/sumo/rail/{deadlocks/circle_3veh.loadDL => deadlocks_loadHints/circle_3veh}/options.sumo (100%) rename tests/sumo/rail/{deadlocks/circle_3veh.loadDL => deadlocks_loadHints/circle_3veh}/output.sumo (100%) rename tests/sumo/rail/{deadlocks/circle_3veh.loadDL => deadlocks_loadHints/circle_3veh}/railsignalblocks.sumo (100%) rename tests/sumo/rail/{deadlocks/circle_3veh.loadDL => deadlocks_loadHints/circle_3veh}/tripinfos.sumo (100%) create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh/deadlocks.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh/errors.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh/input_additional.add.xml create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh/input_routes.rou.xml create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh/net.net.xml create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh/options.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh/output.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh/railsignalblocks.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh/tripinfos.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh2/deadlocks.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh2/errors.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh2/input_additional.add.xml create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh2/input_routes.rou.xml create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh2/net.net.xml create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh2/options.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh2/output.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh2/railsignalblocks.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh2/tripinfos.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh3/deadlocks.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh3/errors.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh3/input_additional.add.xml create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh3/input_routes.rou.xml create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh3/net.net.xml create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh3/options.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh3/output.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh3/railsignalblocks.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/loop_4veh3/tripinfos.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/options.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/deadlocks.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/errors.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/input_additional.add.xml create mode 100644 tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/input_routes.rou.xml create mode 100644 tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/net.net.xml create mode 100644 tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/options.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/output.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/railsignalblocks.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/tripinfos.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/testsuite.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/triangle_6veh/deadlocks.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/triangle_6veh/errors.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/triangle_6veh/input_additional.add.xml create mode 100644 tests/sumo/rail/deadlocks_loadHints/triangle_6veh/input_routes.rou.xml create mode 100644 tests/sumo/rail/deadlocks_loadHints/triangle_6veh/net.net.xml create mode 100644 tests/sumo/rail/deadlocks_loadHints/triangle_6veh/options.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/triangle_6veh/output.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/triangle_6veh/railsignalblocks.sumo create mode 100644 tests/sumo/rail/deadlocks_loadHints/triangle_6veh/tripinfos.sumo diff --git a/tests/sumo/rail/deadlocks/testsuite.sumo b/tests/sumo/rail/deadlocks/testsuite.sumo index 2bc703238352..ec31abe849f9 100644 --- a/tests/sumo/rail/deadlocks/testsuite.sumo +++ b/tests/sumo/rail/deadlocks/testsuite.sumo @@ -15,6 +15,3 @@ triangle_6veh # deadlock circle_3veh - -# avoid deadlock by loading a deadlock file -circle_3veh.loadDL diff --git a/tests/sumo/rail/deadlocks/circle_3veh.loadDL/deadlocks.sumo b/tests/sumo/rail/deadlocks_loadHints/circle_3veh/deadlocks.sumo similarity index 100% rename from tests/sumo/rail/deadlocks/circle_3veh.loadDL/deadlocks.sumo rename to tests/sumo/rail/deadlocks_loadHints/circle_3veh/deadlocks.sumo diff --git a/tests/sumo/rail/deadlocks/circle_3veh.loadDL/errors.sumo b/tests/sumo/rail/deadlocks_loadHints/circle_3veh/errors.sumo similarity index 100% rename from tests/sumo/rail/deadlocks/circle_3veh.loadDL/errors.sumo rename to tests/sumo/rail/deadlocks_loadHints/circle_3veh/errors.sumo diff --git a/tests/sumo/rail/deadlocks/circle_3veh.loadDL/input_additional.add.xml b/tests/sumo/rail/deadlocks_loadHints/circle_3veh/input_additional.add.xml similarity index 100% rename from tests/sumo/rail/deadlocks/circle_3veh.loadDL/input_additional.add.xml rename to tests/sumo/rail/deadlocks_loadHints/circle_3veh/input_additional.add.xml diff --git a/tests/sumo/rail/deadlocks/circle_3veh.loadDL/input_routes.rou.xml b/tests/sumo/rail/deadlocks_loadHints/circle_3veh/input_routes.rou.xml similarity index 100% rename from tests/sumo/rail/deadlocks/circle_3veh.loadDL/input_routes.rou.xml rename to tests/sumo/rail/deadlocks_loadHints/circle_3veh/input_routes.rou.xml diff --git a/tests/sumo/rail/deadlocks/circle_3veh.loadDL/net.net.xml b/tests/sumo/rail/deadlocks_loadHints/circle_3veh/net.net.xml similarity index 100% rename from tests/sumo/rail/deadlocks/circle_3veh.loadDL/net.net.xml rename to tests/sumo/rail/deadlocks_loadHints/circle_3veh/net.net.xml diff --git a/tests/sumo/rail/deadlocks/circle_3veh.loadDL/options.sumo b/tests/sumo/rail/deadlocks_loadHints/circle_3veh/options.sumo similarity index 100% rename from tests/sumo/rail/deadlocks/circle_3veh.loadDL/options.sumo rename to tests/sumo/rail/deadlocks_loadHints/circle_3veh/options.sumo diff --git a/tests/sumo/rail/deadlocks/circle_3veh.loadDL/output.sumo b/tests/sumo/rail/deadlocks_loadHints/circle_3veh/output.sumo similarity index 100% rename from tests/sumo/rail/deadlocks/circle_3veh.loadDL/output.sumo rename to tests/sumo/rail/deadlocks_loadHints/circle_3veh/output.sumo diff --git a/tests/sumo/rail/deadlocks/circle_3veh.loadDL/railsignalblocks.sumo b/tests/sumo/rail/deadlocks_loadHints/circle_3veh/railsignalblocks.sumo similarity index 100% rename from tests/sumo/rail/deadlocks/circle_3veh.loadDL/railsignalblocks.sumo rename to tests/sumo/rail/deadlocks_loadHints/circle_3veh/railsignalblocks.sumo diff --git a/tests/sumo/rail/deadlocks/circle_3veh.loadDL/tripinfos.sumo b/tests/sumo/rail/deadlocks_loadHints/circle_3veh/tripinfos.sumo similarity index 100% rename from tests/sumo/rail/deadlocks/circle_3veh.loadDL/tripinfos.sumo rename to tests/sumo/rail/deadlocks_loadHints/circle_3veh/tripinfos.sumo diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh/deadlocks.sumo b/tests/sumo/rail/deadlocks_loadHints/loop_4veh/deadlocks.sumo new file mode 100644 index 000000000000..da96522e77e6 --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/loop_4veh/deadlocks.sumo @@ -0,0 +1,44 @@ + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh/errors.sumo b/tests/sumo/rail/deadlocks_loadHints/loop_4veh/errors.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh/input_additional.add.xml b/tests/sumo/rail/deadlocks_loadHints/loop_4veh/input_additional.add.xml new file mode 100644 index 000000000000..0e5fbdebf7f7 --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/loop_4veh/input_additional.add.xml @@ -0,0 +1,44 @@ + + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh/input_routes.rou.xml b/tests/sumo/rail/deadlocks_loadHints/loop_4veh/input_routes.rou.xml new file mode 100644 index 000000000000..31eccd652f1a --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/loop_4veh/input_routes.rou.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh/net.net.xml b/tests/sumo/rail/deadlocks_loadHints/loop_4veh/net.net.xml new file mode 100644 index 000000000000..2f0045b4ec4b --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/loop_4veh/net.net.xml @@ -0,0 +1,489 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh/options.sumo b/tests/sumo/rail/deadlocks_loadHints/loop_4veh/options.sumo new file mode 100644 index 000000000000..07a9a6f47f76 --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/loop_4veh/options.sumo @@ -0,0 +1,3 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +-a input_additional.add.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh/output.sumo b/tests/sumo/rail/deadlocks_loadHints/loop_4veh/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh/railsignalblocks.sumo b/tests/sumo/rail/deadlocks_loadHints/loop_4veh/railsignalblocks.sumo new file mode 100644 index 000000000000..302952c7353d --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/loop_4veh/railsignalblocks.sumo @@ -0,0 +1,213 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh/tripinfos.sumo b/tests/sumo/rail/deadlocks_loadHints/loop_4veh/tripinfos.sumo new file mode 100644 index 000000000000..3c3f0209d3df --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/loop_4veh/tripinfos.sumo @@ -0,0 +1,48 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/deadlocks.sumo b/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/deadlocks.sumo new file mode 100644 index 000000000000..da96522e77e6 --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/deadlocks.sumo @@ -0,0 +1,44 @@ + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/errors.sumo b/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/errors.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/input_additional.add.xml b/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/input_additional.add.xml new file mode 100644 index 000000000000..0e5fbdebf7f7 --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/input_additional.add.xml @@ -0,0 +1,44 @@ + + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/input_routes.rou.xml b/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/input_routes.rou.xml new file mode 100644 index 000000000000..1490871e263b --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/input_routes.rou.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/net.net.xml b/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/net.net.xml new file mode 100644 index 000000000000..2f0045b4ec4b --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/net.net.xml @@ -0,0 +1,489 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/options.sumo b/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/options.sumo new file mode 100644 index 000000000000..07a9a6f47f76 --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/options.sumo @@ -0,0 +1,3 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +-a input_additional.add.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/output.sumo b/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/railsignalblocks.sumo b/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/railsignalblocks.sumo new file mode 100644 index 000000000000..1266fb2b7da9 --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/railsignalblocks.sumo @@ -0,0 +1,213 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/tripinfos.sumo b/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/tripinfos.sumo new file mode 100644 index 000000000000..c6d01a92aa44 --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/loop_4veh2/tripinfos.sumo @@ -0,0 +1,48 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/deadlocks.sumo b/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/deadlocks.sumo new file mode 100644 index 000000000000..e377cc676853 --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/deadlocks.sumo @@ -0,0 +1,44 @@ + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/errors.sumo b/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/errors.sumo new file mode 100644 index 000000000000..0e5d0af080c4 --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/errors.sumo @@ -0,0 +1 @@ +Warning: Vehicle 't1'; collision with vehicle 't3', lane='-i2_0', gap=-1.00, time=255.00 stage=move. diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/input_additional.add.xml b/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/input_additional.add.xml new file mode 100644 index 000000000000..e377cc676853 --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/input_additional.add.xml @@ -0,0 +1,44 @@ + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/input_routes.rou.xml b/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/input_routes.rou.xml new file mode 100644 index 000000000000..192936e07187 --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/input_routes.rou.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/net.net.xml b/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/net.net.xml new file mode 100644 index 000000000000..2f0045b4ec4b --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/net.net.xml @@ -0,0 +1,489 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/options.sumo b/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/options.sumo new file mode 100644 index 000000000000..856016eaed3d --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/options.sumo @@ -0,0 +1,4 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml +-a input_additional.add.xml +--collision.action warn diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/output.sumo b/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/railsignalblocks.sumo b/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/railsignalblocks.sumo new file mode 100644 index 000000000000..0bc8b3f3b28f --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/railsignalblocks.sumo @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/tripinfos.sumo b/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/tripinfos.sumo new file mode 100644 index 000000000000..93a6b4f6ed33 --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/loop_4veh3/tripinfos.sumo @@ -0,0 +1,46 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/options.sumo b/tests/sumo/rail/deadlocks_loadHints/options.sumo new file mode 100644 index 000000000000..d3973627d54d --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/options.sumo @@ -0,0 +1 @@ +--deadlock-output deadlocks.xml diff --git a/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/deadlocks.sumo b/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/deadlocks.sumo new file mode 100644 index 000000000000..db34dac139e7 --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/deadlocks.sumo @@ -0,0 +1,45 @@ + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/errors.sumo b/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/errors.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/input_additional.add.xml b/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/input_additional.add.xml new file mode 100644 index 000000000000..d73bbf64758f --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/input_additional.add.xml @@ -0,0 +1,45 @@ + + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/input_routes.rou.xml b/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/input_routes.rou.xml new file mode 100644 index 000000000000..e0ff9ebb3792 --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/input_routes.rou.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/net.net.xml b/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/net.net.xml new file mode 100644 index 000000000000..0ddc5c773058 --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/net.net.xml @@ -0,0 +1,236 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/options.sumo b/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/options.sumo new file mode 100644 index 000000000000..856016eaed3d --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/options.sumo @@ -0,0 +1,4 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml +-a input_additional.add.xml +--collision.action warn diff --git a/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/output.sumo b/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/railsignalblocks.sumo b/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/railsignalblocks.sumo new file mode 100644 index 000000000000..2dbd3d7eebf2 --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/railsignalblocks.sumo @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/tripinfos.sumo b/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/tripinfos.sumo new file mode 100644 index 000000000000..ed50e4755dbf --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/siding_deadlock2/tripinfos.sumo @@ -0,0 +1,49 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/testsuite.sumo b/tests/sumo/rail/deadlocks_loadHints/testsuite.sumo new file mode 100644 index 000000000000..3c56221f4d5d --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/testsuite.sumo @@ -0,0 +1,17 @@ +# siding cannot be used because it is already occupied, vehicle routes start or end in the siding +siding_deadlock2 + +# a loop that reverses on itself can create a deadlock with 4 vehicles (2 from either direction) +loop_4veh + +# a loop that reverses on itself can create a deadlock with 4 vehicles (2 from either direction), this time with different driveway initialization order +loop_4veh2 + +# collision (caused by rail-signal triggered rerouting) +loop_4veh3 + +# deadlock +triangle_6veh + +# avoid deadlock by loading a deadlock file +circle_3veh diff --git a/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/deadlocks.sumo b/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/deadlocks.sumo new file mode 100644 index 000000000000..91c6cc5394df --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/deadlocks.sumo @@ -0,0 +1,45 @@ + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/errors.sumo b/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/errors.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/input_additional.add.xml b/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/input_additional.add.xml new file mode 100644 index 000000000000..90e35439a91f --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/input_additional.add.xml @@ -0,0 +1,45 @@ + + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/input_routes.rou.xml b/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/input_routes.rou.xml new file mode 100644 index 000000000000..a5da10cb8cc9 --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/input_routes.rou.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/net.net.xml b/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/net.net.xml new file mode 100644 index 000000000000..886a278f9152 --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/net.net.xml @@ -0,0 +1,281 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/options.sumo b/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/options.sumo new file mode 100644 index 000000000000..856016eaed3d --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/options.sumo @@ -0,0 +1,4 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml +-a input_additional.add.xml +--collision.action warn diff --git a/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/output.sumo b/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/railsignalblocks.sumo b/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/railsignalblocks.sumo new file mode 100644 index 000000000000..2c8641591ed1 --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/railsignalblocks.sumo @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/tripinfos.sumo b/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/tripinfos.sumo new file mode 100644 index 000000000000..4eb3546d6075 --- /dev/null +++ b/tests/sumo/rail/deadlocks_loadHints/triangle_6veh/tripinfos.sumo @@ -0,0 +1,51 @@ + + + + + + + + + + + + diff --git a/tests/sumo/rail/testsuite.sumo b/tests/sumo/rail/testsuite.sumo index d4c8c47d27e3..f4ec196309ef 100644 --- a/tests/sumo/rail/testsuite.sumo +++ b/tests/sumo/rail/testsuite.sumo @@ -7,6 +7,9 @@ siding # complex deadlocks that are not found automatically deadlocks +# complex deadlocks that are not found automatically but are avoided by loading deadlock hints. +deadlocks_loadHints + # trams driving in a loop servicing stops tramwayLoop From 00b5479c17d03052bae4d1a18c6448226f6ef183 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Mon, 14 Oct 2024 22:00:44 +0200 Subject: [PATCH 288/334] removing further outdated code refs #12 --- src/microsim/traffic_lights/MSDriveWay.cpp | 47 ---------------------- src/microsim/traffic_lights/MSDriveWay.h | 3 -- 2 files changed, 50 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index be05925b28f2..fb5792fa37ea 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -238,7 +238,6 @@ MSDriveWay::hasLinkConflict(const Approaching& veh, const MSLink* foeLink) const const MSDriveWay& foeDriveWay = foeRS->retrieveDriveWayForVeh(foeLink->getTLIndex(), foe.first); MSEdgeVector occupied; if (foeDriveWay.foeDriveWayOccupied(false, foe.first, occupied) || - foeDriveWay.deadlockLaneOccupied(nullptr, false) || !foeRS->constraintsAllow(foe.first) || !overlap(foeDriveWay) || !isFoeOrSubFoe(&foeDriveWay) || @@ -604,52 +603,6 @@ MSDriveWay::canUseSiding(const SUMOVehicle* ego, const MSDriveWay* foe, bool rec return false; } -bool -MSDriveWay::deadlockLaneOccupied(const SUMOVehicle* ego, bool store) const { - for (const MSLane* lane : myBidiExtended) { - if (!lane->empty()) { - assert(myBidi.size() != 0); - const MSEdge* lastBidi = myBidi.back()->getNextNormal(); - MSVehicle* foe = lane->getVehiclesSecure().front(); - lane->releaseVehicles(); - if (foe == ego) { - continue; - } -#ifdef DEBUG_SIGNALSTATE - if (gDebugFlag4) { - std::cout << " check for deadlock with " << foe->getID() << "\n"; - } -#endif - // check of foe will enter myBidi (need to check at most - // myBidiExtended.size edges) - const int minEdges = (int)myBidiExtended.size(); - auto foeIt = foe->getCurrentRouteEdge() + 1; - auto foeEnd = foe->getRoute().end(); - bool conflict = false; - for (int i = 0; i < minEdges && foeIt != foeEnd; i++) { - if ((*foeIt) == lastBidi) { -#ifdef DEBUG_SIGNALSTATE - if (gDebugFlag4) { - std::cout << " vehicle will enter " << lastBidi->getID() << "\n"; - } -#endif - conflict = true; - break; - } - foeIt++; - } - if (conflict) { - if (MSRailSignal::storeVehicles() && store) { - MSRailSignal::blockingVehicles().push_back(foe); - } - return true; - } - } - } - return false; -} - - bool MSDriveWay::overlap(const MSDriveWay& other) const { for (int i = 0; i < myCoreSize; i++) { diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h index 927127063c6d..d89d1937e43e 100644 --- a/src/microsim/traffic_lights/MSDriveWay.h +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -228,9 +228,6 @@ class MSDriveWay : public MSMoveReminder, public Named { * current link and any of the conflict links */ std::vector myConflictLinks; - /// @brief whether any of myBidiExtended is occupied by a vehicle that targets myBidi - bool deadlockLaneOccupied(const SUMOVehicle* ego, bool store = true) const; - /// @brief Whether the approaching vehicle is prevent from driving by another vehicle approaching the given link bool hasLinkConflict(const Approaching& closest, const MSLink* foeLink) const; From 029b7c44c41df485f9a07a6877967cd7a060a202 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 08:27:24 +0200 Subject: [PATCH 289/334] speeding up rail signals. fix #4379 --- src/microsim/MSNet.cpp | 3 ++ src/microsim/MSVehicle.cpp | 9 +++++ src/microsim/traffic_lights/MSDriveWay.cpp | 9 +++++ src/microsim/traffic_lights/MSRailSignal.cpp | 22 +++++++++-- src/microsim/traffic_lights/MSRailSignal.h | 12 +++++- .../traffic_lights/MSRailSignalControl.cpp | 37 +++++++++++++++++++ .../traffic_lights/MSRailSignalControl.h | 11 ++++-- 7 files changed, 94 insertions(+), 9 deletions(-) diff --git a/src/microsim/MSNet.cpp b/src/microsim/MSNet.cpp index bc11680c928a..38ca6ff31419 100644 --- a/src/microsim/MSNet.cpp +++ b/src/microsim/MSNet.cpp @@ -764,6 +764,9 @@ MSNet::simulationStep(const bool onlyMove) { MSRailSignalControl::getInstance().resetWaitRelations(); } myBeginOfTimestepEvents->execute(myStep); + if (MSRailSignalControl::hasInstance()) { + MSRailSignalControl::getInstance().updateSignals(myStep); + } #ifdef HAVE_FOX MSRoutingEngine::waitForAll(); #endif diff --git a/src/microsim/MSVehicle.cpp b/src/microsim/MSVehicle.cpp index fa1eb6388e71..a608d5509f9f 100644 --- a/src/microsim/MSVehicle.cpp +++ b/src/microsim/MSVehicle.cpp @@ -63,6 +63,7 @@ #include #include #include +#include #include #include #include @@ -5316,6 +5317,13 @@ MSVehicle::setApproachingForAllLinks(const SUMOTime t) { dpi.mySetRequest, dpi.myArrivalSpeedBraking, getWaitingTime(), dpi.myDistance, getLateralPositionOnLane()); } } + if (isRailway(getVClass())) { + for (DriveProcessItem& dpi : myLFLinkLanes) { + if (dpi.myLink != nullptr && dpi.myLink->getTLLogic() != nullptr && dpi.myLink->getTLLogic()->getLogicType() == TrafficLightType::RAIL_SIGNAL) { + MSRailSignalControl::getInstance().notifyApproach(dpi.myLink); + } + } + } if (myLaneChangeModel->getShadowLane() != nullptr) { // register on all shadow links for (const DriveProcessItem& dpi : myLFLinkLanes) { @@ -5362,6 +5370,7 @@ MSVehicle::registerInsertionApproach(MSLink* link, double dist) { link->setApproaching(this, SUMOTime_MAX, 0, 0, false, arrivalSpeedBraking, 0, dpi.myDistance, 0); // ensure cleanup in the next step myLFLinkLanes.push_back(dpi); + MSRailSignalControl::getInstance().notifyApproach(link); } diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index fb5792fa37ea..9e632783d63e 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -137,6 +137,14 @@ MSDriveWay::notifyEnter(SUMOTrafficObject& veh, Notification reason, const MSLan MSRouteIterator firstIt = std::find(sveh.getCurrentRouteEdge(), sveh.getRoute().end(), myLane->getNextNormal()); if (myTrains.count(&sveh) == 0 && match(firstIt, sveh.getRoute().end())) { myTrains.insert(&sveh); + if (myOrigin != nullptr) { + MSRailSignalControl::getInstance().notifyApproach(myOrigin); + } + for (const MSDriveWay* foe : myFoes) { + if (foe->myOrigin != nullptr) { + MSRailSignalControl::getInstance().notifyApproach(foe->myOrigin); + } + } if (myWriteVehicles) { myVehicleEvents.push_back(VehicleEvent(SIMSTEP, true, veh.getID(), reason)); } @@ -193,6 +201,7 @@ MSDriveWay::notifyLeaveBack(SUMOTrafficObject& veh, Notification reason, const M } } + bool MSDriveWay::reserve(const Approaching& closest, MSEdgeVector& occupied) { if (foeDriveWayOccupied(true, closest.first, occupied)) { diff --git a/src/microsim/traffic_lights/MSRailSignal.cpp b/src/microsim/traffic_lights/MSRailSignal.cpp index 3067eb99ab89..3cfe0cc0d871 100644 --- a/src/microsim/traffic_lights/MSRailSignal.cpp +++ b/src/microsim/traffic_lights/MSRailSignal.cpp @@ -69,6 +69,7 @@ MSRailSignal::VehicleVector MSRailSignal::myBlockingVehicles; MSRailSignal::VehicleVector MSRailSignal::myRivalVehicles; MSRailSignal::VehicleVector MSRailSignal::myPriorityVehicles; std::string MSRailSignal::myConstraintInfo; +int MSRailSignal::myRSIndex(0); std::vector MSRailSignal::myBlockingDriveWays; std::string MSRailSignal::myRequestedDriveWay; @@ -79,6 +80,7 @@ MSRailSignal::MSRailSignal(MSTLLogicControl& tlcontrol, const std::string& id, const std::string& programID, SUMOTime delay, const Parameterised::Map& parameters) : MSTrafficLightLogic(tlcontrol, id, programID, 0, TrafficLightType::RAIL_SIGNAL, delay, parameters), + myNumericalID(myRSIndex++), myCurrentPhase(DELTA_T, std::string(SUMO_MAX_CONNECTIONS, 'X')), // dummy phase myPhaseIndex(0), myDriveWayIndex(0) @@ -86,6 +88,7 @@ MSRailSignal::MSRailSignal(MSTLLogicControl& tlcontrol, myDefaultCycleTime = DELTA_T; myMovingBlock = OptionsCont::getOptions().getBool("railsignal-moving-block"); MSRailSignalControl::getInstance().addSignal(this); + mySwitchCommand->deschedule(this); } void @@ -122,21 +125,24 @@ MSRailSignal::adaptLinkInformationFrom(const MSTrafficLightLogic& logic) { // ------------ Switching and setting current rows SUMOTime MSRailSignal::trySwitch() { - updateCurrentPhase(); - return DELTA_T; + // deschedule regular traffic light event, + // updateCurrentPhase is instead called from MSRailSignalControl::updateSignals + return SUMOTime_MAX; } -void +bool MSRailSignal::updateCurrentPhase() { #ifdef DEBUG_SIGNALSTATE gDebugFlag4 = DEBUG_COND; #endif + bool keepActive = false; // green by default so vehicles can be inserted at the borders of the network std::string state(myLinks.size(), 'G'); for (LinkInfo& li : myLinkInfos) { if (li.myLink->getApproaching().size() > 0) { + keepActive = true; Approaching closest = li.myLink->getClosest(); MSDriveWay& driveway = li.getDriveWay(closest.first); //std::cout << SIMTIME << " signal=" << getTLLinkID(li.myLink) << " veh=" << closest.first->getID() << " dw:\n"; @@ -173,6 +179,7 @@ MSRailSignal::updateCurrentPhase() { const MSDriveWay& driveway = *li.myDriveways.front(); MSEdgeVector occupied; if (driveway.foeDriveWayOccupied(true, nullptr, occupied) || driveway.foeDriveWayApproached()) { + keepActive = true; #ifdef DEBUG_SIGNALSTATE if (gDebugFlag4) { std::cout << SIMTIME << " rsl=" << li.getID() << " red for default driveway " << driveway.getID() << "\n"; @@ -192,10 +199,16 @@ MSRailSignal::updateCurrentPhase() { if (myCurrentPhase.getState() != state) { myCurrentPhase.setState(state); myPhaseIndex = 1 - myPhaseIndex; + // set link priorities + setTrafficLightSignals(SIMSTEP); + // execute switch actions (3D-gui) + //const MSTLLogicControl::TLSLogicVariants& vars = myTLControl.get(myTLLogic->getID()); + //vars.executeOnSwitchActions(); } #ifdef DEBUG_SIGNALSTATE gDebugFlag4 = false; #endif + return keepActive; } @@ -366,13 +379,14 @@ MSRailSignal::initDriveWays(const SUMOVehicle* ego, bool update) { MSDriveWay* dw = &li.getDriveWay(ego); MSRailSignalControl::getInstance().addDrivewayFollower(prev, dw); MSRailSignalControl::getInstance().addDWDeadlockChecks(rs, prev); + MSRailSignalControl::getInstance().notifyApproach(link); prev = dw; if (update && rs->isActive()) { // vehicle may have rerouted its intial trip // after the states have been set // @note: This is a hack because it could lead to invalid tls-output // (it's still an improvement over switching based on default driveways) - rs->trySwitch(); + rs->updateCurrentPhase(); rs->setTrafficLightSignals(SIMSTEP); } } diff --git a/src/microsim/traffic_lights/MSRailSignal.h b/src/microsim/traffic_lights/MSRailSignal.h index 557ea198d83c..e4105be8671f 100644 --- a/src/microsim/traffic_lights/MSRailSignal.h +++ b/src/microsim/traffic_lights/MSRailSignal.h @@ -68,6 +68,10 @@ class MSRailSignal : public MSTrafficLightLogic { /// @brief Destructor ~MSRailSignal(); + inline int getNumericalID() const { + return myNumericalID; + } + /**@brief Sets a parameter and updates internal constants */ void setParameter(const std::string& key, const std::string& value) override; @@ -101,8 +105,8 @@ class MSRailSignal : public MSTrafficLightLogic { * @return The state actually required for this signal. */ - /// @brief updates the current phase of the signal - void updateCurrentPhase(); + /// @brief updates the current phase of the signal and return whether it should be kept active + bool updateCurrentPhase(); /** @brief Switches to the next phase * @return The time of the next switch (always the next step) @@ -300,6 +304,8 @@ class MSRailSignal : public MSTrafficLightLogic { protected: + const int myNumericalID; + std::string getNewDrivewayID(); /* The driveways for each link @@ -359,6 +365,8 @@ class MSRailSignal : public MSTrafficLightLogic { /// @brief running number of driveways created for this signal int myDriveWayIndex; + static int myRSIndex; + protected: /// @brief update vehicle lists for traci calls void storeTraCIVehicles(int linkIndex); diff --git a/src/microsim/traffic_lights/MSRailSignalControl.cpp b/src/microsim/traffic_lights/MSRailSignalControl.cpp index b2e7a9dfa9b7..a8f01468171e 100644 --- a/src/microsim/traffic_lights/MSRailSignalControl.cpp +++ b/src/microsim/traffic_lights/MSRailSignalControl.cpp @@ -215,4 +215,41 @@ MSRailSignalControl::findDeadlockFoes(const MSDriveWay* dw, const std::vector(link->getTLLogic()); + assert(rs != nullptr); + myActiveSignals.insert(const_cast(rs)); +} + + +void +MSRailSignalControl::updateSignals(SUMOTime t) { + UNUSED_PARAMETER(t); + // there are 4 states for a signal + // 1. approached and green + // 2. approached and red + // 3. not approached and trains could pass + // 4. not approached and trains coult not pass + // + // for understanding conflicts better in sumo-gui, we want to show (3) as green. This + // means we have to keep updating signals in state (4) until they change to (3) + + //std::cout << SIMTIME << " activeSignals=" << myActiveSignals.size() << "\n"; + for (auto it = myActiveSignals.begin(); it != myActiveSignals.end();) { + MSRailSignal* rs = *it; + //std::cout << SIMTIME << " update " << rs->getID() << "\n"; + const bool keepActive = rs->updateCurrentPhase(); + if (rs->isActive()) { + rs->setTrafficLightSignals(t); + } + if (!keepActive) { + it = myActiveSignals.erase(it); + } else { + it++; + } + } +} + + /****************************************************************************/ diff --git a/src/microsim/traffic_lights/MSRailSignalControl.h b/src/microsim/traffic_lights/MSRailSignalControl.h index 316ac2cbc00e..c9c672ed9782 100644 --- a/src/microsim/traffic_lights/MSRailSignalControl.h +++ b/src/microsim/traffic_lights/MSRailSignalControl.h @@ -83,13 +83,17 @@ class MSRailSignalControl : public MSNet::VehicleStateListener { return mySignals; } - /// @brief final check for driveway compatibility of signals that switched green in this step - void recheckGreen(); - const std::map >& getDeadlockChecks() const { return myDeadlockChecks; } + /// switch rail signal to active + void notifyApproach(const MSLink* link); + + /// @brief update active rail signals + void updateSignals(SUMOTime t); + + protected: void findDeadlockFoes(const MSDriveWay* dw, const std::vector& others, std::vector deadlockFoes); @@ -118,6 +122,7 @@ class MSRailSignalControl : public MSNet::VehicleStateListener { /// @brief list of signals that switched green along with driveway index std::vector > mySwitchedGreenFlanks; std::map, bool> myDriveWayCompatibility; + std::set myActiveSignals; static MSRailSignalControl* myInstance; From 657583a21428296033917e707cf765ff34ac89b6 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 08:27:32 +0200 Subject: [PATCH 290/334] patching expected results refs #21, #4379 --- tests/sumo/rail/bugs/insertion_at_signal/tripinfos.sumo | 5 +++-- .../rail/rail_signal/inserted_behind_signal/tls_state.sumo | 5 +++-- tests/sumo/rail/rail_signal/large_step_size/tls_state.sumo | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/sumo/rail/bugs/insertion_at_signal/tripinfos.sumo b/tests/sumo/rail/bugs/insertion_at_signal/tripinfos.sumo index d0cb98f2ee21..7eb0463cd225 100644 --- a/tests/sumo/rail/bugs/insertion_at_signal/tripinfos.sumo +++ b/tests/sumo/rail/bugs/insertion_at_signal/tripinfos.sumo @@ -1,6 +1,6 @@ - - + diff --git a/tests/sumo/rail/rail_signal/inserted_behind_signal/tls_state.sumo b/tests/sumo/rail/rail_signal/inserted_behind_signal/tls_state.sumo index 9b528e198dd0..1efba5108125 100644 --- a/tests/sumo/rail/rail_signal/inserted_behind_signal/tls_state.sumo +++ b/tests/sumo/rail/rail_signal/inserted_behind_signal/tls_state.sumo @@ -1,6 +1,6 @@ - - + diff --git a/tests/sumo/rail/rail_signal/large_step_size/tls_state.sumo b/tests/sumo/rail/rail_signal/large_step_size/tls_state.sumo index 0d127a83e467..0d08e46ed9d4 100644 --- a/tests/sumo/rail/rail_signal/large_step_size/tls_state.sumo +++ b/tests/sumo/rail/rail_signal/large_step_size/tls_state.sumo @@ -1,6 +1,6 @@ - + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/long_siding_occupied_wait/net.net.xml b/tests/sumo/rail/siding/long_siding_occupied_wait/net.net.xml new file mode 100644 index 000000000000..194f59318c78 --- /dev/null +++ b/tests/sumo/rail/siding/long_siding_occupied_wait/net.net.xml @@ -0,0 +1,322 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/long_siding_occupied_wait/options.sumo b/tests/sumo/rail/siding/long_siding_occupied_wait/options.sumo new file mode 100644 index 000000000000..aca2e8d18e45 --- /dev/null +++ b/tests/sumo/rail/siding/long_siding_occupied_wait/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/siding/long_siding_occupied_wait/output.sumo b/tests/sumo/rail/siding/long_siding_occupied_wait/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/siding/long_siding_occupied_wait/railsignalblocks.sumo b/tests/sumo/rail/siding/long_siding_occupied_wait/railsignalblocks.sumo new file mode 100644 index 000000000000..5b3ea0432e72 --- /dev/null +++ b/tests/sumo/rail/siding/long_siding_occupied_wait/railsignalblocks.sumo @@ -0,0 +1,266 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/long_siding_occupied_wait/tripinfos.sumo b/tests/sumo/rail/siding/long_siding_occupied_wait/tripinfos.sumo new file mode 100644 index 000000000000..697058000045 --- /dev/null +++ b/tests/sumo/rail/siding/long_siding_occupied_wait/tripinfos.sumo @@ -0,0 +1,46 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/siding/testsuite.sumo b/tests/sumo/rail/siding/testsuite.sumo index dc3030380977..d07ecfe19d1e 100644 --- a/tests/sumo/rail/siding/testsuite.sumo +++ b/tests/sumo/rail/siding/testsuite.sumo @@ -33,5 +33,9 @@ siding_noSignal # siding does not prevent deadlock because it doesn't have a signal. one more layer of signals outside the siding siding_noSignal2 +# no deadlock should be found because the sidings will clear up in time +# +long_siding_occupied_wait + # a loop that reverses on itself can create a deadlock with 3 vehicles loop_3veh From 13552d2280cb4b789112fee92ce5d1e9c7362784 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 09:57:25 +0200 Subject: [PATCH 292/334] avoiding invalid deadlock detection at occupied siding. refs #15474, #15561 --- src/microsim/traffic_lights/MSDriveWay.cpp | 21 +++++++++++---------- src/microsim/traffic_lights/MSDriveWay.h | 3 ++- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 9e632783d63e..9f3b4244da10 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -250,7 +250,7 @@ MSDriveWay::hasLinkConflict(const Approaching& veh, const MSLink* foeLink) const !foeRS->constraintsAllow(foe.first) || !overlap(foeDriveWay) || !isFoeOrSubFoe(&foeDriveWay) || - canUseSiding(veh.first, &foeDriveWay)) { + canUseSiding(veh.first, &foeDriveWay).first) { #ifdef DEBUG_SIGNALSTATE_PRIORITY if (gDebugFlag4) { if (foeDriveWay.foeDriveWayOccupied(false, foe.first, occupied)) { @@ -434,7 +434,7 @@ MSDriveWay::foeDriveWayOccupied(bool store, const SUMOVehicle* ego, MSEdgeVector continue; } } - bool useSiding = canUseSiding(ego, foeDW); + std::pair useSiding = canUseSiding(ego, foeDW); #ifdef DEBUG_SIGNALSTATE if (gDebugFlag4 || DEBUG_COND_DW || DEBUG_HELPER(ego)) { auto it = mySidings.find(foeDW); @@ -445,7 +445,7 @@ MSDriveWay::foeDriveWayOccupied(bool store, const SUMOVehicle* ego, MSEdgeVector std::cout << " useSiding=" << useSiding << " numSidings=" << numSidings << "\n"; } #endif - if (useSiding) { + if (useSiding.first) { continue; } else { if (MSRailSignal::storeVehicles() && store) { @@ -464,7 +464,8 @@ MSDriveWay::foeDriveWayOccupied(bool store, const SUMOVehicle* ego, MSEdgeVector } if (ego != nullptr && myOrigin != nullptr && MSGlobals::gTimeToTeleportRSDeadlock > 0 && ego->getWaitingTime() > ego->getVehicleType().getCarFollowModel().getStartupDelay()) { - SUMOVehicle* foe = *foeDW->myTrains.begin(); + // if there is an occupied siding, it becomes part of the waitRelation + SUMOVehicle* foe = *(useSiding.second == nullptr ? foeDW : useSiding.second)->myTrains.begin(); MSRailSignalControl::getInstance().addWaitRelation(ego, dynamic_cast(myOrigin->getTLLogic()), foe); } return true; @@ -477,7 +478,7 @@ MSDriveWay::foeDriveWayOccupied(bool store, const SUMOVehicle* ego, MSEdgeVector MSRouteIterator firstIt = std::find(foe->getCurrentRouteEdge(), foe->getRoute().end(), foeDW->myRoute.front()); if (firstIt != foe->getRoute().end()) { if (foeDW->match(firstIt, foe->getRoute().end())) { - bool useSiding = canUseSiding(ego, foeDW); + bool useSiding = canUseSiding(ego, foeDW).first; #ifdef DEBUG_SIGNALSTATE if (gDebugFlag4 || DEBUG_COND_DW || DEBUG_HELPER(ego)) { std::cout << SIMTIME << " " << getID() << " blocked by " << foeDW->getID() << " (approached by " << foe->getID() << ") useSiding=" << useSiding << "\n"; @@ -563,7 +564,7 @@ MSDriveWay::hasJoin(const SUMOVehicle* ego, const SUMOVehicle* foe) { } -bool +std::pair MSDriveWay::canUseSiding(const SUMOVehicle* ego, const MSDriveWay* foe, bool recurse) const { auto it = mySidings.find(foe); if (it != mySidings.end()) { @@ -586,7 +587,7 @@ MSDriveWay::canUseSiding(const SUMOVehicle* ego, const MSDriveWay* foe, bool rec WRITE_WARNINGF("Invalid call to canUseSiding dw=% foe=% ego=% time=%", getID(), foe->getID(), Named::getIDSecure(ego), time2string(SIMSTEP)); continue; } - if (foe->canUseSiding(foeVeh, this, false)) { + if (foe->canUseSiding(foeVeh, this, false).first) { continue; } } @@ -599,17 +600,17 @@ MSDriveWay::canUseSiding(const SUMOVehicle* ego, const MSDriveWay* foe, bool rec << " sidingEnd=" << sidingEnd->getID() << " sidingApproach=" << sidingApproach->getID() << " approaching=" << toString(sidingApproach->myTrains) << "\n"; } #endif - return false; + return std::make_pair(false, sidingApproach); } } //std::cout << SIMTIME << " " << getID() << " ego=" << Named::getIDSecure(ego) << " foe=" << foe->getID() // << " foeVeh=" << toString(foe->myTrains) // << " sidingEnd=" << sidingEnd->getID() << "usable\n"; - return true; + return std::make_pair(true, nullptr); } } } - return false; + return std::make_pair(false, nullptr); } bool diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h index d89d1937e43e..0e5bd80f2000 100644 --- a/src/microsim/traffic_lights/MSDriveWay.h +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -284,7 +284,8 @@ class MSDriveWay : public MSMoveReminder, public Named { /// @brief add symmetical conflict link for foes when building a new driveway void addConflictLink(const MSLink* link); - bool canUseSiding(const SUMOVehicle* ego, const MSDriveWay* foe, bool recurse=true) const; + /// @brief return whether a siding can be used. If a siding exist but is occupied, also return the occupied driveway in the siding + std::pair canUseSiding(const SUMOVehicle* ego, const MSDriveWay* foe, bool recurse=true) const; bool isFoeOrSubFoe(const MSDriveWay* foe) const; From 84a5fe4757c1bdc57b55ea2bff77365c5ab2aa82 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 09:57:40 +0200 Subject: [PATCH 293/334] patching expected results refs #21, #15474, #15561 --- .../long_siding_occupied_wait/errors.sumo | 4 -- .../input_routes.rou.xml | 4 +- .../railsignalblocks.sumo | 59 ++----------------- .../long_siding_occupied_wait/tripinfos.sumo | 10 ++-- 4 files changed, 13 insertions(+), 64 deletions(-) diff --git a/tests/sumo/rail/siding/long_siding_occupied_wait/errors.sumo b/tests/sumo/rail/siding/long_siding_occupied_wait/errors.sumo index 60bc5f8afc8c..e69de29bb2d1 100644 --- a/tests/sumo/rail/siding/long_siding_occupied_wait/errors.sumo +++ b/tests/sumo/rail/siding/long_siding_occupied_wait/errors.sumo @@ -1,4 +0,0 @@ -Warning: Teleporting vehicle 't2'; waited too long (yield, railSignal), lane='-g_0', time=217.00. -Warning: Teleporting vehicle 't3'; waited too long (yield, railSignal), lane='E1_0', time=217.00. -Warning: Vehicle 't2' ends teleporting on edge '-f', time=217.00. -Warning: Vehicle 't3' ends teleporting on edge 'a', time=217.00. diff --git a/tests/sumo/rail/siding/long_siding_occupied_wait/input_routes.rou.xml b/tests/sumo/rail/siding/long_siding_occupied_wait/input_routes.rou.xml index 2562e718f977..5ccd5e4ece11 100644 --- a/tests/sumo/rail/siding/long_siding_occupied_wait/input_routes.rou.xml +++ b/tests/sumo/rail/siding/long_siding_occupied_wait/input_routes.rou.xml @@ -39,9 +39,9 @@ - + - + diff --git a/tests/sumo/rail/siding/long_siding_occupied_wait/railsignalblocks.sumo b/tests/sumo/rail/siding/long_siding_occupied_wait/railsignalblocks.sumo index 5b3ea0432e72..5b5b0b3adb6b 100644 --- a/tests/sumo/rail/siding/long_siding_occupied_wait/railsignalblocks.sumo +++ b/tests/sumo/rail/siding/long_siding_occupied_wait/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - - - - + + + + From 896cbfcc7a2de692e32a0bfc5f60ae0275e7a4f3 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 10:04:12 +0200 Subject: [PATCH 294/334] added tests refs #21, #15474 --- .../long_siding_occupied_advance/errors.sumo | 8 + .../input_routes.rou.xml | 47 +++ .../long_siding_occupied_advance/net.net.xml | 322 ++++++++++++++++++ .../long_siding_occupied_advance/options.sumo | 2 + .../long_siding_occupied_advance/output.sumo | 0 .../railsignalblocks.sumo | 256 ++++++++++++++ .../tripinfos.sumo | 46 +++ tests/sumo/rail/siding/testsuite.sumo | 3 + 8 files changed, 684 insertions(+) create mode 100644 tests/sumo/rail/siding/long_siding_occupied_advance/errors.sumo create mode 100644 tests/sumo/rail/siding/long_siding_occupied_advance/input_routes.rou.xml create mode 100644 tests/sumo/rail/siding/long_siding_occupied_advance/net.net.xml create mode 100644 tests/sumo/rail/siding/long_siding_occupied_advance/options.sumo create mode 100644 tests/sumo/rail/siding/long_siding_occupied_advance/output.sumo create mode 100644 tests/sumo/rail/siding/long_siding_occupied_advance/railsignalblocks.sumo create mode 100644 tests/sumo/rail/siding/long_siding_occupied_advance/tripinfos.sumo diff --git a/tests/sumo/rail/siding/long_siding_occupied_advance/errors.sumo b/tests/sumo/rail/siding/long_siding_occupied_advance/errors.sumo new file mode 100644 index 000000000000..f8494f71c7c0 --- /dev/null +++ b/tests/sumo/rail/siding/long_siding_occupied_advance/errors.sumo @@ -0,0 +1,8 @@ +Warning: Teleporting vehicle 't2'; waited too long (yield, railSignal), lane='-g_0', time=261.00. +Warning: Teleporting vehicle 't3'; waited too long (yield, railSignal), lane='E1_0', time=261.00. +Warning: Vehicle 't2' ends teleporting on edge '-f', time=261.00. +Warning: Vehicle 't3' ends teleporting on edge 'a', time=261.00. +Warning: Teleporting vehicle 't0'; frontal collision with vehicle 't3', lane='a_0', gap=-1.00, time=313.00 stage=move. +Warning: Vehicle 't0' ends teleporting on edge '-E1', time=313.00. +Warning: Teleporting vehicle 't2'; frontal collision with vehicle 't3', lane='a_0', gap=-1.00, time=365.00 stage=move. +Warning: Vehicle 't2' ends teleporting on edge '-E1', time=365.00. diff --git a/tests/sumo/rail/siding/long_siding_occupied_advance/input_routes.rou.xml b/tests/sumo/rail/siding/long_siding_occupied_advance/input_routes.rou.xml new file mode 100644 index 000000000000..799baa020d72 --- /dev/null +++ b/tests/sumo/rail/siding/long_siding_occupied_advance/input_routes.rou.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/long_siding_occupied_advance/net.net.xml b/tests/sumo/rail/siding/long_siding_occupied_advance/net.net.xml new file mode 100644 index 000000000000..194f59318c78 --- /dev/null +++ b/tests/sumo/rail/siding/long_siding_occupied_advance/net.net.xml @@ -0,0 +1,322 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/long_siding_occupied_advance/options.sumo b/tests/sumo/rail/siding/long_siding_occupied_advance/options.sumo new file mode 100644 index 000000000000..aca2e8d18e45 --- /dev/null +++ b/tests/sumo/rail/siding/long_siding_occupied_advance/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/siding/long_siding_occupied_advance/output.sumo b/tests/sumo/rail/siding/long_siding_occupied_advance/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/siding/long_siding_occupied_advance/railsignalblocks.sumo b/tests/sumo/rail/siding/long_siding_occupied_advance/railsignalblocks.sumo new file mode 100644 index 000000000000..60741df27d1d --- /dev/null +++ b/tests/sumo/rail/siding/long_siding_occupied_advance/railsignalblocks.sumo @@ -0,0 +1,256 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/long_siding_occupied_advance/tripinfos.sumo b/tests/sumo/rail/siding/long_siding_occupied_advance/tripinfos.sumo new file mode 100644 index 000000000000..d18f0a8f90d4 --- /dev/null +++ b/tests/sumo/rail/siding/long_siding_occupied_advance/tripinfos.sumo @@ -0,0 +1,46 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/siding/testsuite.sumo b/tests/sumo/rail/siding/testsuite.sumo index d07ecfe19d1e..6c986b9b06b0 100644 --- a/tests/sumo/rail/siding/testsuite.sumo +++ b/tests/sumo/rail/siding/testsuite.sumo @@ -37,5 +37,8 @@ siding_noSignal2 # long_siding_occupied_wait +# no deadlock should be found because the sidings accomodate multiple vehicles +long_siding_occupied_advance + # a loop that reverses on itself can create a deadlock with 3 vehicles loop_3veh From ed88c09b906b0096a4de279f1cb4564c4992d6ef Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 10:22:30 +0200 Subject: [PATCH 295/334] now building a siding for each rail signal in the passing loop. refs #15474 --- src/microsim/traffic_lights/MSDriveWay.cpp | 43 ++++++++++++---------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 9f3b4244da10..fc0b38b014a7 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -1688,18 +1688,18 @@ MSDriveWay::addSidings(MSDriveWay* foe, bool addToFoe) { auto foeSearchBeg = foe->myRoute.begin() + forwardNormals; auto foeSearchEnd = foe->myRoute.end(); if (foeEndBidi == nullptr) { - throw ProcessError("addFoeCheckSiding " + getID() + " foe=" + foe->getID() + " noBidi\n"); + throw ProcessError("checkSiding " + getID() + " foe=" + foe->getID() + " noBidi\n"); } int i; - int start = -1; - double length = 0; + std::vector start; + std::vector length; for (i = 0; i < (int)myRoute.size(); i++) { if (myRoute[i] == foeEndBidi) { break; } } if (i == (int)myRoute.size()) { - throw ProcessError("addFoeCheckSiding " + getID() + " foe=" + foe->getID() + " foeEndBidi=" + foeEndBidi->getID() + " not on route\n"); + throw ProcessError("checkSiding " + getID() + " foe=" + foe->getID() + " foeEndBidi=" + foeEndBidi->getID() + " not on route\n"); } const MSEdge* next = myRoute[i]; #ifdef DEBUG_BUILD_SIDINGS @@ -1708,14 +1708,13 @@ MSDriveWay::addSidings(MSDriveWay* foe, bool addToFoe) { i--; for (; i >= 0; i--) { const MSEdge* cur = myRoute[i]; - if (start == -1) { - if (hasRS(cur, next)) { - if (std::find(foeSearchBeg, foeSearchEnd, cur->getBidiEdge()) == foeSearchEnd) { - start = i; - length = cur->getLength(); - } + if (hasRS(cur, next)) { + if (std::find(foeSearchBeg, foeSearchEnd, cur->getBidiEdge()) == foeSearchEnd) { + start.push_back(i); + length.push_back(0); } - } else { + } + if (!start.empty()) { auto itFind = std::find(foeSearchBeg, foeSearchEnd, cur->getBidiEdge()); if (itFind != foeSearchEnd) { #ifdef DEBUG_BUILD_SIDINGS @@ -1728,21 +1727,27 @@ MSDriveWay::addSidings(MSDriveWay* foe, bool addToFoe) { const MSEdge* first = myRoute[firstIndex]; auto itFirst = std::find(foe->myRoute.begin(), foe->myRoute.end(), first); if (itFirst != foe->myRoute.end()) { - const MSEdge* last = myRoute[start]; - auto itLast = std::find(itFirst, foe->myRoute.end(), last); - if (itLast != foe->myRoute.end()) { - foeSidings.insert(foeSidings.begin(), Siding(itFirst - foe->myRoute.begin(), itLast - foe->myRoute.begin(), length)); + for (int j = 0; j < (int)length.size(); j++) { + const MSEdge* last = myRoute[start[j]]; + auto itLast = std::find(itFirst, foe->myRoute.end(), last); + if (itLast != foe->myRoute.end()) { + foeSidings.insert(foeSidings.begin(), Siding(itFirst - foe->myRoute.begin(), itLast - foe->myRoute.begin(), length[j])); + } } } } else { auto& foeSidings = mySidings[foe]; - foeSidings.insert(foeSidings.begin(), Siding(firstIndex, start, length)); + for (int j = 0; j < (int)length.size(); j++) { + foeSidings.insert(foeSidings.begin(), Siding(firstIndex, start[j], length[j])); + } } - start = -1; - length = 0; + start.clear(); + length.clear(); foeSearchBeg = itFind; } else { - length += cur->getLength(); + for (int j = 0; j < (int)length.size(); j++) { + length[j] += cur->getLength(); + } } } next = cur; From abe25e3436d2c3f3e210bebea89cc0faa7befb85 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 10:22:42 +0200 Subject: [PATCH 296/334] patching expected results refs #21, #15474, #15561 --- .../deadlocks/loop_4veh/railsignalblocks.sumo | 8 +- .../loop_4veh2/railsignalblocks.sumo | 6 +- .../loop_4veh/railsignalblocks.sumo | 4 +- .../loop_4veh2/railsignalblocks.sumo | 4 +- .../long_siding_occupied_advance/errors.sumo | 8 -- .../railsignalblocks.sumo | 77 ++++--------------- .../tripinfos.sumo | 10 +-- .../railsignalblocks.sumo | 9 ++- .../long_siding_occupied_wait/tripinfos.sumo | 8 +- .../siding/loop_3veh/railsignalblocks.sumo | 5 +- .../sumo/rail/siding/loop_3veh/tripinfos.sumo | 9 ++- .../track_closed/railsignalblocks.sumo | 9 ++- 12 files changed, 66 insertions(+), 91 deletions(-) diff --git a/tests/sumo/rail/deadlocks/loop_4veh/railsignalblocks.sumo b/tests/sumo/rail/deadlocks/loop_4veh/railsignalblocks.sumo index accdbd64a6d3..d383a7041271 100644 --- a/tests/sumo/rail/deadlocks/loop_4veh/railsignalblocks.sumo +++ b/tests/sumo/rail/deadlocks/loop_4veh/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - - - - + + + + diff --git a/tests/sumo/rail/siding/long_siding_occupied_wait/railsignalblocks.sumo b/tests/sumo/rail/siding/long_siding_occupied_wait/railsignalblocks.sumo index 5b5b0b3adb6b..379775f9bf72 100644 --- a/tests/sumo/rail/siding/long_siding_occupied_wait/railsignalblocks.sumo +++ b/tests/sumo/rail/siding/long_siding_occupied_wait/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - - - + + + diff --git a/tests/sumo/rail/tramwayLoop/track_closed/railsignalblocks.sumo b/tests/sumo/rail/tramwayLoop/track_closed/railsignalblocks.sumo index 5593327e67df..b0bc4d71a5e0 100644 --- a/tests/sumo/rail/tramwayLoop/track_closed/railsignalblocks.sumo +++ b/tests/sumo/rail/tramwayLoop/track_closed/railsignalblocks.sumo @@ -1,6 +1,6 @@ - + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/long_siding_occupied_wait2/net.net.xml b/tests/sumo/rail/siding/long_siding_occupied_wait2/net.net.xml new file mode 100644 index 000000000000..194f59318c78 --- /dev/null +++ b/tests/sumo/rail/siding/long_siding_occupied_wait2/net.net.xml @@ -0,0 +1,322 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/long_siding_occupied_wait2/options.sumo b/tests/sumo/rail/siding/long_siding_occupied_wait2/options.sumo new file mode 100644 index 000000000000..aca2e8d18e45 --- /dev/null +++ b/tests/sumo/rail/siding/long_siding_occupied_wait2/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/siding/long_siding_occupied_wait2/output.sumo b/tests/sumo/rail/siding/long_siding_occupied_wait2/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/siding/long_siding_occupied_wait2/railsignalblocks.sumo b/tests/sumo/rail/siding/long_siding_occupied_wait2/railsignalblocks.sumo new file mode 100644 index 000000000000..379775f9bf72 --- /dev/null +++ b/tests/sumo/rail/siding/long_siding_occupied_wait2/railsignalblocks.sumo @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/siding/long_siding_occupied_wait2/tripinfos.sumo b/tests/sumo/rail/siding/long_siding_occupied_wait2/tripinfos.sumo new file mode 100644 index 000000000000..99a1ed568b1c --- /dev/null +++ b/tests/sumo/rail/siding/long_siding_occupied_wait2/tripinfos.sumo @@ -0,0 +1,46 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/siding/testsuite.sumo b/tests/sumo/rail/siding/testsuite.sumo index 6c986b9b06b0..768bf67d02c7 100644 --- a/tests/sumo/rail/siding/testsuite.sumo +++ b/tests/sumo/rail/siding/testsuite.sumo @@ -37,6 +37,10 @@ siding_noSignal2 # long_siding_occupied_wait +# no deadlock should be found because the sidings will clear up in time (even if the first siding is too short for the train) +# +long_siding_occupied_wait2 + # no deadlock should be found because the sidings accomodate multiple vehicles long_siding_occupied_advance From 36f48e6770490eef8cdddba60d7d908e4bf96f18 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 11:21:18 +0200 Subject: [PATCH 298/334] refactoring refs #12 --- .../traffic_lights/MSRailSignalConstraint.cpp | 26 ++++++++++++------- .../traffic_lights/MSRailSignalConstraint.h | 9 ++++++- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/microsim/traffic_lights/MSRailSignalConstraint.cpp b/src/microsim/traffic_lights/MSRailSignalConstraint.cpp index 1c5a4377460a..5a7459a9d384 100644 --- a/src/microsim/traffic_lights/MSRailSignalConstraint.cpp +++ b/src/microsim/traffic_lights/MSRailSignalConstraint.cpp @@ -80,16 +80,16 @@ MSRailSignalConstraint::clearAll() { } -std::string -MSRailSignalConstraint::getVehID(const std::string& tripID) { +const SUMOVehicle* +MSRailSignalConstraint::getVeh(const std::string& tripID) { MSVehicleControl& c = MSNet::getInstance()->getVehicleControl(); for (MSVehicleControl::constVehIt i = c.loadedVehBegin(); i != c.loadedVehEnd(); ++i) { SUMOVehicle* veh = i->second; if (veh->getParameter().getParameter("tripId") == tripID) { - return veh->getID(); + return veh; } } - return ""; + return nullptr; } // =========================================================================== @@ -177,18 +177,19 @@ std::string MSRailSignalConstraint_Predecessor::getDescription() const { // try to retrieve vehicle id that belongs to myTripId // this may be slow so it should only be used for debugging - std::string vehID = getVehID(myTripId); - if (vehID != "") { - vehID = " (" + vehID + ")"; + const SUMOVehicle* veh = getVeh(myTripId); + std::string vehID; + if (veh != nullptr) { + vehID = " (" + veh->getID() + ")"; } std::vector passedIDs; for (const std::string& passedTripID : myTrackers.front()->myPassed) { if (passedTripID == "") { continue; } - const std::string passedID = getVehID(passedTripID); - if (passedID != "") { - passedIDs.push_back(passedID); + const SUMOVehicle* passedVeh = getVeh(passedTripID); + if (passedVeh != nullptr) { + passedIDs.push_back(passedVeh->getID()); } } std::string passedIDs2 = ""; @@ -203,6 +204,11 @@ MSRailSignalConstraint_Predecessor::getDescription() const { + " passed=" + StringUtils::prune(toString(myTrackers.front()->myPassed)) + passedIDs2 + params); } +const SUMOVehicle* +MSRailSignalConstraint_Predecessor::getFoe() const { + return getVeh(myTripId); +} + // =========================================================================== // MSRailSignalConstraint_Predecessor::PassedTracker method definitions // =========================================================================== diff --git a/src/microsim/traffic_lights/MSRailSignalConstraint.h b/src/microsim/traffic_lights/MSRailSignalConstraint.h index e3a275d03186..cf0621b90d99 100644 --- a/src/microsim/traffic_lights/MSRailSignalConstraint.h +++ b/src/microsim/traffic_lights/MSRailSignalConstraint.h @@ -27,6 +27,7 @@ // class declarations // =========================================================================== class MSRailSignal; +class SUMOVehicle; class SUMOSAXAttributes; @@ -66,6 +67,10 @@ class MSRailSignalConstraint : public Parameterised { return "RailSignalConstraint"; } + virtual const SUMOVehicle* getFoe() const { + return nullptr; + } + virtual void write(OutputDevice& out, const std::string& tripId) const = 0; ConstraintType getType() const { @@ -115,7 +120,7 @@ class MSRailSignalConstraint : public Parameterised { static void clearAll(); protected: - static std::string getVehID(const std::string& tripID); + static const SUMOVehicle* getVeh(const std::string& tripID); ConstraintType myType; }; @@ -156,6 +161,8 @@ class MSRailSignalConstraint_Predecessor : public MSRailSignalConstraint { std::string getDescription() const; + const SUMOVehicle* getFoe() const; + class PassedTracker : public MSMoveReminder { public: PassedTracker(MSLane* lane); From 876b19db47fbc4a8153648ff7dd861d20ccbc0d9 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 11:51:42 +0200 Subject: [PATCH 299/334] added tests refs #21, #14543 --- .../constraints/deadlock/deadlocks.sumo | 45 ++++++++++ .../constraints/deadlock/errors.sumo | 2 + .../deadlock/input_additional.add.xml | 10 +++ .../constraints/deadlock/input_routes.rou.xml | 37 +++++++++ .../constraints/deadlock/options.sumo | 1 + .../constraints/deadlock/output.sumo | 0 .../deadlock/railsignalblocks.sumo | 82 +++++++++++++++++++ .../constraints/deadlock/tripinfos.sumo | 45 ++++++++++ .../constraints/deadlock/tripinfos.sumo.meso | 45 ++++++++++ .../rail/rail_signal/constraints/options.sumo | 1 + .../rail_signal/constraints/testsuite.sumo | 3 + 11 files changed, 271 insertions(+) create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock/deadlocks.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock/errors.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock/input_additional.add.xml create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock/input_routes.rou.xml create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock/options.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock/output.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock/railsignalblocks.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock/tripinfos.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock/tripinfos.sumo.meso diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock/deadlocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock/deadlocks.sumo new file mode 100644 index 000000000000..f4cb57a003b0 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock/deadlocks.sumo @@ -0,0 +1,45 @@ + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock/errors.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock/errors.sumo new file mode 100644 index 000000000000..fc65b0cc7b39 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock/errors.sumo @@ -0,0 +1,2 @@ +Warning: Teleporting vehicle 't0'; waited too long (yield, railSignal), lane='a_0', time=231.00. +Warning: Vehicle 't0' ends teleporting on edge 'b', time=231.00. diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock/input_additional.add.xml b/tests/sumo/rail/rail_signal/constraints/deadlock/input_additional.add.xml new file mode 100644 index 000000000000..1eb3ea4da778 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock/input_additional.add.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock/input_routes.rou.xml b/tests/sumo/rail/rail_signal/constraints/deadlock/input_routes.rou.xml new file mode 100644 index 000000000000..f87b358d8afd --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock/input_routes.rou.xml @@ -0,0 +1,37 @@ + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock/options.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock/options.sumo new file mode 100644 index 000000000000..d3973627d54d --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock/options.sumo @@ -0,0 +1 @@ +--deadlock-output deadlocks.xml diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock/output.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock/railsignalblocks.sumo new file mode 100644 index 000000000000..4fa6731c6917 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock/railsignalblocks.sumo @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock/tripinfos.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock/tripinfos.sumo new file mode 100644 index 000000000000..4363233adb3d --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock/tripinfos.sumo @@ -0,0 +1,45 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock/tripinfos.sumo.meso b/tests/sumo/rail/rail_signal/constraints/deadlock/tripinfos.sumo.meso new file mode 100644 index 000000000000..5270000edde0 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock/tripinfos.sumo.meso @@ -0,0 +1,45 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/options.sumo b/tests/sumo/rail/rail_signal/constraints/options.sumo index 166dfe893834..2b3971d07267 100644 --- a/tests/sumo/rail/rail_signal/constraints/options.sumo +++ b/tests/sumo/rail/rail_signal/constraints/options.sumo @@ -2,3 +2,4 @@ --routes=input_routes.rou.xml -a input_additional.add.xml,input_additional2.add.xml --tripinfo-output tripinfos.xml +--time-to-teleport.railsignal-deadlock 200 diff --git a/tests/sumo/rail/rail_signal/constraints/testsuite.sumo b/tests/sumo/rail/rail_signal/constraints/testsuite.sumo index 25f95aa22543..e5482a876b22 100644 --- a/tests/sumo/rail/rail_signal/constraints/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/constraints/testsuite.sumo @@ -24,3 +24,6 @@ foeInsertion # constraint which guards a bidi section bidi + +# conflicting constraints cause deadlock +deadlock From 4bef6f91e91b489b6c8a9859e03f82586749fb57 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 11:53:25 +0200 Subject: [PATCH 300/334] now detecting constraint-based deadlocks. refs #15561, #14543 --- src/microsim/traffic_lights/MSRailSignal.cpp | 11 +++++-- src/microsim/traffic_lights/MSRailSignal.h | 2 +- .../traffic_lights/MSRailSignalConstraint.cpp | 6 ++-- .../traffic_lights/MSRailSignalConstraint.h | 2 +- .../traffic_lights/MSRailSignalControl.cpp | 29 +++++++++++++++---- .../traffic_lights/MSRailSignalControl.h | 16 +++++++--- 6 files changed, 50 insertions(+), 16 deletions(-) diff --git a/src/microsim/traffic_lights/MSRailSignal.cpp b/src/microsim/traffic_lights/MSRailSignal.cpp index 3cfe0cc0d871..e7628fa707dd 100644 --- a/src/microsim/traffic_lights/MSRailSignal.cpp +++ b/src/microsim/traffic_lights/MSRailSignal.cpp @@ -147,7 +147,7 @@ MSRailSignal::updateCurrentPhase() { MSDriveWay& driveway = li.getDriveWay(closest.first); //std::cout << SIMTIME << " signal=" << getTLLinkID(li.myLink) << " veh=" << closest.first->getID() << " dw:\n"; //driveway.writeBlocks(*OutputDevice_COUT::getDevice()); - const bool mustWait = !constraintsAllow(closest.first); + const bool mustWait = !constraintsAllow(closest.first, true); MSEdgeVector occupied; if (mustWait || !driveway.reserve(closest, occupied)) { state[li.myLink->getTLIndex()] = 'r'; @@ -213,7 +213,7 @@ MSRailSignal::updateCurrentPhase() { bool -MSRailSignal::constraintsAllow(const SUMOVehicle* veh) const { +MSRailSignal::constraintsAllow(const SUMOVehicle* veh, bool storeWaitRelation) const { if (myConstraints.size() == 0) { return true; } else { @@ -228,6 +228,13 @@ MSRailSignal::constraintsAllow(const SUMOVehicle* veh) const { std::cout << " constraint '" << c->getDescription() << "' not cleared\n"; } #endif + if (storeWaitRelation && MSGlobals::gTimeToTeleportRSDeadlock > 0 + && veh->getWaitingTime() > veh->getVehicleType().getCarFollowModel().getStartupDelay()) { + const SUMOVehicle* foe = c->getFoe(); + if (foe != nullptr) { + MSRailSignalControl::getInstance().addWaitRelation(veh, this, foe, c); + } + } if (myStoreVehicles) { myConstraintInfo = c->getDescription(); } diff --git a/src/microsim/traffic_lights/MSRailSignal.h b/src/microsim/traffic_lights/MSRailSignal.h index e4105be8671f..4b5cec4fa27a 100644 --- a/src/microsim/traffic_lights/MSRailSignal.h +++ b/src/microsim/traffic_lights/MSRailSignal.h @@ -273,7 +273,7 @@ class MSRailSignal : public MSTrafficLightLogic { const std::vector retrieveDriveWays(int tlIndex) const; /// @brief whether the given vehicle is free to drive - bool constraintsAllow(const SUMOVehicle* veh) const; + bool constraintsAllow(const SUMOVehicle* veh, bool storeWaitRelation = false) const; bool isMovingBlock() const { return myMovingBlock; diff --git a/src/microsim/traffic_lights/MSRailSignalConstraint.cpp b/src/microsim/traffic_lights/MSRailSignalConstraint.cpp index 5a7459a9d384..0009dfaad23f 100644 --- a/src/microsim/traffic_lights/MSRailSignalConstraint.cpp +++ b/src/microsim/traffic_lights/MSRailSignalConstraint.cpp @@ -81,11 +81,11 @@ MSRailSignalConstraint::clearAll() { const SUMOVehicle* -MSRailSignalConstraint::getVeh(const std::string& tripID) { +MSRailSignalConstraint::getVeh(const std::string& tripID, bool checkID) { MSVehicleControl& c = MSNet::getInstance()->getVehicleControl(); for (MSVehicleControl::constVehIt i = c.loadedVehBegin(); i != c.loadedVehEnd(); ++i) { SUMOVehicle* veh = i->second; - if (veh->getParameter().getParameter("tripId") == tripID) { + if (veh->getParameter().getParameter("tripId") == tripID || (checkID && veh->getID() == tripID)) { return veh; } } @@ -206,7 +206,7 @@ MSRailSignalConstraint_Predecessor::getDescription() const { const SUMOVehicle* MSRailSignalConstraint_Predecessor::getFoe() const { - return getVeh(myTripId); + return getVeh(myTripId, true); } // =========================================================================== diff --git a/src/microsim/traffic_lights/MSRailSignalConstraint.h b/src/microsim/traffic_lights/MSRailSignalConstraint.h index cf0621b90d99..9fc3cf7efa8a 100644 --- a/src/microsim/traffic_lights/MSRailSignalConstraint.h +++ b/src/microsim/traffic_lights/MSRailSignalConstraint.h @@ -120,7 +120,7 @@ class MSRailSignalConstraint : public Parameterised { static void clearAll(); protected: - static const SUMOVehicle* getVeh(const std::string& tripID); + static const SUMOVehicle* getVeh(const std::string& tripID, bool checkID = false); ConstraintType myType; }; diff --git a/src/microsim/traffic_lights/MSRailSignalControl.cpp b/src/microsim/traffic_lights/MSRailSignalControl.cpp index a8f01468171e..8d0e2d39e3d2 100644 --- a/src/microsim/traffic_lights/MSRailSignalControl.cpp +++ b/src/microsim/traffic_lights/MSRailSignalControl.cpp @@ -96,17 +96,27 @@ MSRailSignalControl::addSignal(MSRailSignal* signal) { } +void +MSRailSignalControl::addWaitRelation(const SUMOVehicle* waits, const MSRailSignal* rs, const SUMOVehicle* reason, MSRailSignalConstraint* constraint) { + myWaitRelations[waits] = WaitRelation(rs, reason, constraint); +} + + bool MSRailSignalControl::haveDeadlock(const SUMOVehicle* veh) const { std::set seen; - std::vector > list; + std::vector list; const SUMOVehicle* cur = veh; + std::vector constraints; while (seen.count(cur) == 0) { auto it = myWaitRelations.find(cur); if (it != myWaitRelations.end()) { + if (it->second.constraint != nullptr) { + constraints.push_back(it->second.constraint); + } seen.insert(cur); list.push_back(it->second); - cur = it->second.second; + cur = it->second.foe; } else { return false; } @@ -117,15 +127,24 @@ MSRailSignalControl::haveDeadlock(const SUMOVehicle* veh) const { myWrittenDeadlocks.insert(seen); std::vector signals; std::vector vehicles; + std::vector tripIDs; for (auto item : list) { - signals.push_back(item.first->getID()); - vehicles.push_back(item.second->getID()); + signals.push_back(item.railSignal->getID()); + vehicles.push_back(item.foe->getID()); + tripIDs.push_back(item.foe->getParameter().getParameter("tripId", item.foe->getID())); } OutputDevice& od = OutputDevice::getDeviceByOption("deadlock-output"); - od.openTag(SUMO_TAG_DEADLOCK); + if (constraints.empty()) { + od.openTag(SUMO_TAG_DEADLOCK); + } else { + od.openTag("constraintDeadlock"); + } od.writeAttr(SUMO_ATTR_TIME, time2string(SIMSTEP)); od.writeAttr(SUMO_ATTR_SIGNALS, signals); od.writeAttr("vehicles", vehicles); + if (!constraints.empty()) { + od.writeAttr("tripIds", tripIDs); + } od.closeTag(); } } diff --git a/src/microsim/traffic_lights/MSRailSignalControl.h b/src/microsim/traffic_lights/MSRailSignalControl.h index c9c672ed9782..77e9ca89d60f 100644 --- a/src/microsim/traffic_lights/MSRailSignalControl.h +++ b/src/microsim/traffic_lights/MSRailSignalControl.h @@ -26,6 +26,7 @@ // class declarations // =========================================================================== class MSRailSignal; +class MSRailSignalConstraint; class MSEdge; // =========================================================================== @@ -56,9 +57,7 @@ class MSRailSignalControl : public MSNet::VehicleStateListener { myWrittenDeadlocks.clear(); } - void addWaitRelation(const SUMOVehicle* waits, const MSRailSignal* rs, SUMOVehicle* reason) { - myWaitRelations[waits] = std::make_pair(rs, reason); - } + void addWaitRelation(const SUMOVehicle* waits, const MSRailSignal* rs, const SUMOVehicle* reason, MSRailSignalConstraint* constraint = nullptr); void addDrivewayFollower(const MSDriveWay* dw, const MSDriveWay* dw2); @@ -109,7 +108,16 @@ class MSRailSignalControl : public MSNet::VehicleStateListener { /// @brief all rail edges that are part of a known route std::set myUsedEdges; - std::map > myWaitRelations; + struct WaitRelation { + WaitRelation(const MSRailSignal* _railSignal = nullptr, const SUMOVehicle* _foe = nullptr, MSRailSignalConstraint* _constraint = nullptr) : + railSignal(_railSignal), foe(_foe), constraint(_constraint) {} + // indices along route + const MSRailSignal* railSignal; + const SUMOVehicle* foe; + MSRailSignalConstraint* constraint; + }; + std::map myWaitRelations; + mutable std::set > myWrittenDeadlocks; std::map > myDeadlockChecks; From 7d9ea4f130b58e7f1e47cff85f64d5e887eb1ea6 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 11:56:08 +0200 Subject: [PATCH 301/334] added tests refs #21, #14543 --- .../deadlock_remove/deadlocks.sumo | 45 ++++++++++ .../constraints/deadlock_remove/errors.sumo | 2 + .../deadlock_remove/input_additional.add.xml | 10 +++ .../deadlock_remove/input_routes.rou.xml | 37 +++++++++ .../constraints/deadlock_remove/options.sumo | 2 + .../constraints/deadlock_remove/output.sumo | 0 .../deadlock_remove/railsignalblocks.sumo | 82 +++++++++++++++++++ .../deadlock_remove/tripinfos.sumo | 45 ++++++++++ .../deadlock_remove/tripinfos.sumo.meso | 45 ++++++++++ .../rail_signal/constraints/testsuite.sumo | 3 + 10 files changed, 271 insertions(+) create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_remove/deadlocks.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_remove/errors.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_remove/input_additional.add.xml create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_remove/input_routes.rou.xml create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_remove/options.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_remove/output.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_remove/railsignalblocks.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_remove/tripinfos.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_remove/tripinfos.sumo.meso diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_remove/deadlocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/deadlocks.sumo new file mode 100644 index 000000000000..f4cb57a003b0 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/deadlocks.sumo @@ -0,0 +1,45 @@ + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_remove/errors.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/errors.sumo new file mode 100644 index 000000000000..fc65b0cc7b39 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/errors.sumo @@ -0,0 +1,2 @@ +Warning: Teleporting vehicle 't0'; waited too long (yield, railSignal), lane='a_0', time=231.00. +Warning: Vehicle 't0' ends teleporting on edge 'b', time=231.00. diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_remove/input_additional.add.xml b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/input_additional.add.xml new file mode 100644 index 000000000000..1eb3ea4da778 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/input_additional.add.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_remove/input_routes.rou.xml b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/input_routes.rou.xml new file mode 100644 index 000000000000..f87b358d8afd --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/input_routes.rou.xml @@ -0,0 +1,37 @@ + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_remove/options.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/options.sumo new file mode 100644 index 000000000000..ebc6c6223b00 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/options.sumo @@ -0,0 +1,2 @@ +--deadlock-output deadlocks.xml +--time-to-teleport.remove-constraint diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_remove/output.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_remove/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/railsignalblocks.sumo new file mode 100644 index 000000000000..4fa6731c6917 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/railsignalblocks.sumo @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_remove/tripinfos.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/tripinfos.sumo new file mode 100644 index 000000000000..4363233adb3d --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/tripinfos.sumo @@ -0,0 +1,45 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_remove/tripinfos.sumo.meso b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/tripinfos.sumo.meso new file mode 100644 index 000000000000..5270000edde0 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/tripinfos.sumo.meso @@ -0,0 +1,45 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/testsuite.sumo b/tests/sumo/rail/rail_signal/constraints/testsuite.sumo index e5482a876b22..f42b18171357 100644 --- a/tests/sumo/rail/rail_signal/constraints/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/constraints/testsuite.sumo @@ -27,3 +27,6 @@ bidi # conflicting constraints cause deadlock deadlock + +# conflicting constraints cause deadlock, remove the constraint +deadlock_remove From a4db70a7a1f89510401171879bb8741043fe4e4d Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 12:24:42 +0200 Subject: [PATCH 302/334] fix #14543 --- src/microsim/MSFrame.cpp | 3 ++ .../traffic_lights/MSRailSignalControl.cpp | 32 +++++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/microsim/MSFrame.cpp b/src/microsim/MSFrame.cpp index c6cdc3f70919..21c7faf8f938 100644 --- a/src/microsim/MSFrame.cpp +++ b/src/microsim/MSFrame.cpp @@ -436,6 +436,9 @@ MSFrame::fillOptions() { oc.doRegister("time-to-teleport.remove", new Option_Bool(false)); oc.addDescription("time-to-teleport.remove", "Processing", TL("Whether vehicles shall be removed after waiting too long instead of being teleported")); + oc.doRegister("time-to-teleport.remove-constraint", new Option_Bool(false)); + oc.addDescription("time-to-teleport.remove-constraint", "Processing", TL("Whether rail-signal-constraint based deadlocks shall be cleared by removing a constraint")); + oc.doRegister("time-to-teleport.ride", new Option_String("-1", "TIME")); oc.addDescription("time-to-teleport.ride", "Processing", TL("The waiting time after which persons / containers waiting for a pickup are teleported. Negative values disable teleporting")); diff --git a/src/microsim/traffic_lights/MSRailSignalControl.cpp b/src/microsim/traffic_lights/MSRailSignalControl.cpp index 8d0e2d39e3d2..9ce826a4fa6e 100644 --- a/src/microsim/traffic_lights/MSRailSignalControl.cpp +++ b/src/microsim/traffic_lights/MSRailSignalControl.cpp @@ -28,6 +28,7 @@ #include #include #include "MSRailSignal.h" +#include "MSRailSignalConstraint.h" #include "MSDriveWay.h" #include "MSRailSignalControl.h" @@ -108,11 +109,15 @@ MSRailSignalControl::haveDeadlock(const SUMOVehicle* veh) const { std::vector list; const SUMOVehicle* cur = veh; std::vector constraints; + std::vector constraintBlocked; + std::vector constraintSignals; while (seen.count(cur) == 0) { auto it = myWaitRelations.find(cur); if (it != myWaitRelations.end()) { if (it->second.constraint != nullptr) { constraints.push_back(it->second.constraint); + constraintBlocked.push_back(cur); + constraintSignals.push_back(it->second.railSignal); } seen.insert(cur); list.push_back(it->second); @@ -122,7 +127,23 @@ MSRailSignalControl::haveDeadlock(const SUMOVehicle* veh) const { } } if (cur == veh) { - if (OptionsCont::getOptions().isSet("deadlock-output")) { + const OptionsCont& oc = OptionsCont::getOptions(); + MSRailSignalConstraint* resolved = nullptr; + const SUMOVehicle* resolvedUnblocked = nullptr; + const MSRailSignal* resolvedSignal = nullptr; + if (!constraints.empty() && oc.getBool("time-to-teleport.remove-constraint")) { + std::vector tripIDs; + for (auto item : list) { + tripIDs.push_back(item.foe->getParameter().getParameter("tripId", item.foe->getID())); + } + WRITE_WARNINGF("Deactivating constraint to resolve deadlock between tripIds % at time %.", toString(tripIDs), time2string(SIMSTEP)); + resolved = constraints.front(); + resolved->setActive(false); + resolvedUnblocked = constraintBlocked.front(); + resolvedSignal = constraintSignals.front(); + } + + if (oc.isSet("deadlock-output")) { if (myWrittenDeadlocks.count(seen) == 0) { myWrittenDeadlocks.insert(seen); std::vector signals; @@ -145,10 +166,17 @@ MSRailSignalControl::haveDeadlock(const SUMOVehicle* veh) const { if (!constraints.empty()) { od.writeAttr("tripIds", tripIDs); } + if (resolved != nullptr) { + od.openTag("resolvedConstraint"); + od.writeAttr(SUMO_ATTR_ID, resolvedSignal->getID()); + resolved->write(od, resolvedUnblocked->getParameter().getParameter("tripId", resolvedUnblocked->getID())); + od.closeTag(); + } od.closeTag(); + } } - return true; + return resolved == nullptr; } else { // it's a deadlock but does not involve veh return false; From 678e9d1e6a1fe60e9d6edcb225e846f2d50425c5 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 12:24:55 +0200 Subject: [PATCH 303/334] patching expected results refs #21, #14543 --- .../constraints/deadlock_remove/deadlocks.sumo | 9 +++++++-- .../rail_signal/constraints/deadlock_remove/errors.sumo | 3 +-- .../constraints/deadlock_remove/tripinfos.sumo | 8 +++++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_remove/deadlocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/deadlocks.sumo index f4cb57a003b0..5b2a9c92c4f9 100644 --- a/tests/sumo/rail/rail_signal/constraints/deadlock_remove/deadlocks.sumo +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/deadlocks.sumo @@ -1,6 +1,6 @@ - - + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_remove/errors.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/errors.sumo index fc65b0cc7b39..2f0415584ba9 100644 --- a/tests/sumo/rail/rail_signal/constraints/deadlock_remove/errors.sumo +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/errors.sumo @@ -1,2 +1 @@ -Warning: Teleporting vehicle 't0'; waited too long (yield, railSignal), lane='a_0', time=231.00. -Warning: Vehicle 't0' ends teleporting on edge 'b', time=231.00. +Warning: Deactivating constraint to resolve deadlock between tripIds t1 t0 at time 231.00. diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_remove/tripinfos.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/tripinfos.sumo index 4363233adb3d..9c299a5b453b 100644 --- a/tests/sumo/rail/rail_signal/constraints/deadlock_remove/tripinfos.sumo +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/tripinfos.sumo @@ -1,6 +1,6 @@ - - - + + From f95033e698b5a61de1fefd1e098d593c354af8ff Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 12:35:07 +0200 Subject: [PATCH 304/334] added tests refs #21, #14543 --- .../deadlock_remove2/deadlocks.sumo | 50 +++++++++++ .../constraints/deadlock_remove2/errors.sumo | 2 + .../deadlock_remove2/input_additional.add.xml | 10 +++ .../deadlock_remove2/input_routes.rou.xml | 37 +++++++++ .../constraints/deadlock_remove2/options.sumo | 2 + .../constraints/deadlock_remove2/output.sumo | 0 .../deadlock_remove2/railsignalblocks.sumo | 82 +++++++++++++++++++ .../deadlock_remove2/tripinfos.sumo | 47 +++++++++++ .../deadlock_remove2/tripinfos.sumo.meso | 45 ++++++++++ .../rail_signal/constraints/testsuite.sumo | 3 + 10 files changed, 278 insertions(+) create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_remove2/deadlocks.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_remove2/errors.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_remove2/input_additional.add.xml create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_remove2/input_routes.rou.xml create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_remove2/options.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_remove2/output.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_remove2/railsignalblocks.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_remove2/tripinfos.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_remove2/tripinfos.sumo.meso diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/deadlocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/deadlocks.sumo new file mode 100644 index 000000000000..5b2a9c92c4f9 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/deadlocks.sumo @@ -0,0 +1,50 @@ + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/errors.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/errors.sumo new file mode 100644 index 000000000000..a992afa6cbc0 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/errors.sumo @@ -0,0 +1,2 @@ +Warning: Deactivating constraint to resolve deadlock between tripIds t1 t0 at time 231.00. +Warning: Deactivating constraint to resolve deadlock between tripIds t0 t1 at time 231.00. diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/input_additional.add.xml b/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/input_additional.add.xml new file mode 100644 index 000000000000..1eb3ea4da778 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/input_additional.add.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/input_routes.rou.xml b/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/input_routes.rou.xml new file mode 100644 index 000000000000..6e46d677256a --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/input_routes.rou.xml @@ -0,0 +1,37 @@ + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/options.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/options.sumo new file mode 100644 index 000000000000..ebc6c6223b00 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/options.sumo @@ -0,0 +1,2 @@ +--deadlock-output deadlocks.xml +--time-to-teleport.remove-constraint diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/output.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/railsignalblocks.sumo new file mode 100644 index 000000000000..4fa6731c6917 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/railsignalblocks.sumo @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/tripinfos.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/tripinfos.sumo new file mode 100644 index 000000000000..2bf587f87002 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/tripinfos.sumo @@ -0,0 +1,47 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/tripinfos.sumo.meso b/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/tripinfos.sumo.meso new file mode 100644 index 000000000000..5270000edde0 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/tripinfos.sumo.meso @@ -0,0 +1,45 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/testsuite.sumo b/tests/sumo/rail/rail_signal/constraints/testsuite.sumo index f42b18171357..73eb3e4a3411 100644 --- a/tests/sumo/rail/rail_signal/constraints/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/constraints/testsuite.sumo @@ -30,3 +30,6 @@ deadlock # conflicting constraints cause deadlock, remove the constraint deadlock_remove + +# conflicting constraints cause deadlock, remove the constraint (both vehicles arrive at the same time) +deadlock_remove2 From bb94bf64aa579ecde1e5d21aeba7d01f94c8cfeb Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 12:37:22 +0200 Subject: [PATCH 305/334] avoid duplicat warning refs #14543 --- .../traffic_lights/MSRailSignalControl.cpp | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/microsim/traffic_lights/MSRailSignalControl.cpp b/src/microsim/traffic_lights/MSRailSignalControl.cpp index 9ce826a4fa6e..bddefc505ff4 100644 --- a/src/microsim/traffic_lights/MSRailSignalControl.cpp +++ b/src/microsim/traffic_lights/MSRailSignalControl.cpp @@ -127,24 +127,28 @@ MSRailSignalControl::haveDeadlock(const SUMOVehicle* veh) const { } } if (cur == veh) { + const bool newDeadlock = myWrittenDeadlocks.count(seen) == 0; + myWrittenDeadlocks.insert(seen); const OptionsCont& oc = OptionsCont::getOptions(); MSRailSignalConstraint* resolved = nullptr; const SUMOVehicle* resolvedUnblocked = nullptr; const MSRailSignal* resolvedSignal = nullptr; if (!constraints.empty() && oc.getBool("time-to-teleport.remove-constraint")) { - std::vector tripIDs; - for (auto item : list) { - tripIDs.push_back(item.foe->getParameter().getParameter("tripId", item.foe->getID())); - } - WRITE_WARNINGF("Deactivating constraint to resolve deadlock between tripIds % at time %.", toString(tripIDs), time2string(SIMSTEP)); resolved = constraints.front(); - resolved->setActive(false); - resolvedUnblocked = constraintBlocked.front(); - resolvedSignal = constraintSignals.front(); + if (newDeadlock) { + std::vector tripIDs; + for (auto item : list) { + tripIDs.push_back(item.foe->getParameter().getParameter("tripId", item.foe->getID())); + } + WRITE_WARNINGF("Deactivating constraint to resolve deadlock between tripIds % at time %.", toString(tripIDs), time2string(SIMSTEP)); + resolved->setActive(false); + resolvedUnblocked = constraintBlocked.front(); + resolvedSignal = constraintSignals.front(); + } } if (oc.isSet("deadlock-output")) { - if (myWrittenDeadlocks.count(seen) == 0) { + if (newDeadlock) { myWrittenDeadlocks.insert(seen); std::vector signals; std::vector vehicles; From b3a271dbf8308fe43990e9463c0ccac60dc2f4a8 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 12:37:26 +0200 Subject: [PATCH 306/334] patching expected results refs #21, #14543 --- .../rail/rail_signal/constraints/deadlock_remove2/errors.sumo | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/errors.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/errors.sumo index a992afa6cbc0..2f0415584ba9 100644 --- a/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/errors.sumo +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/errors.sumo @@ -1,2 +1 @@ Warning: Deactivating constraint to resolve deadlock between tripIds t1 t0 at time 231.00. -Warning: Deactivating constraint to resolve deadlock between tripIds t0 t1 at time 231.00. From 4c47d320c5fd55916436130ff6b5c034705d80bc Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 14:39:40 +0200 Subject: [PATCH 307/334] using vehicle ids in warning for better locating in sumo-gui refs #14543 --- src/microsim/traffic_lights/MSRailSignalControl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/microsim/traffic_lights/MSRailSignalControl.cpp b/src/microsim/traffic_lights/MSRailSignalControl.cpp index bddefc505ff4..8782f8209ecd 100644 --- a/src/microsim/traffic_lights/MSRailSignalControl.cpp +++ b/src/microsim/traffic_lights/MSRailSignalControl.cpp @@ -136,11 +136,11 @@ MSRailSignalControl::haveDeadlock(const SUMOVehicle* veh) const { if (!constraints.empty() && oc.getBool("time-to-teleport.remove-constraint")) { resolved = constraints.front(); if (newDeadlock) { - std::vector tripIDs; + std::vector vehicles; for (auto item : list) { - tripIDs.push_back(item.foe->getParameter().getParameter("tripId", item.foe->getID())); + vehicles.push_back(item.foe->getID()); } - WRITE_WARNINGF("Deactivating constraint to resolve deadlock between tripIds % at time %.", toString(tripIDs), time2string(SIMSTEP)); + WRITE_WARNINGF("Deactivating constraint to resolve deadlock between vehicles % at time %.", toString(vehicles), time2string(SIMSTEP)); resolved->setActive(false); resolvedUnblocked = constraintBlocked.front(); resolvedSignal = constraintSignals.front(); From 90acfe0f729585ee28e6f3da0d32c63dfaa6f866 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 14:39:44 +0200 Subject: [PATCH 308/334] patching expected results refs #21, #14543 --- .../rail/rail_signal/constraints/deadlock_remove/errors.sumo | 2 +- .../rail/rail_signal/constraints/deadlock_remove2/errors.sumo | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_remove/errors.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/errors.sumo index 2f0415584ba9..5f5c41c53557 100644 --- a/tests/sumo/rail/rail_signal/constraints/deadlock_remove/errors.sumo +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_remove/errors.sumo @@ -1 +1 @@ -Warning: Deactivating constraint to resolve deadlock between tripIds t1 t0 at time 231.00. +Warning: Deactivating constraint to resolve deadlock between vehicles t1 t0 at time 231.00. diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/errors.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/errors.sumo index 2f0415584ba9..5f5c41c53557 100644 --- a/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/errors.sumo +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_remove2/errors.sumo @@ -1 +1 @@ -Warning: Deactivating constraint to resolve deadlock between tripIds t1 t0 at time 231.00. +Warning: Deactivating constraint to resolve deadlock between vehicles t1 t0 at time 231.00. From 3703b293c4ea637cde68420f42296773344f6b00 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 14:55:34 +0200 Subject: [PATCH 309/334] added tests refs #21, #14543 --- .../deadlock_insertion/deadlocks.sumo | 44 ++++++++++++ .../deadlock_insertion/errors.sumo | 2 + .../input_additional.add.xml | 7 ++ .../deadlock_insertion/input_routes.rou.xml | 37 ++++++++++ .../deadlock_insertion/options.sumo | 1 + .../deadlock_insertion/output.sumo | 0 .../deadlock_insertion/railsignalblocks.sumo | 67 +++++++++++++++++++ .../deadlock_insertion/tripinfos.sumo | 46 +++++++++++++ .../deadlock_insertion/tripinfos.sumo.meso | 45 +++++++++++++ .../deadlock_insertion2/deadlocks.sumo | 44 ++++++++++++ .../deadlock_insertion2/errors.sumo | 2 + .../input_additional.add.xml | 7 ++ .../deadlock_insertion2/input_routes.rou.xml | 39 +++++++++++ .../deadlock_insertion2/options.sumo | 1 + .../deadlock_insertion2/output.sumo | 0 .../deadlock_insertion2/railsignalblocks.sumo | 67 +++++++++++++++++++ .../deadlock_insertion2/tripinfos.sumo | 46 +++++++++++++ .../deadlock_insertion2/tripinfos.sumo.meso | 45 +++++++++++++ .../rail_signal/constraints/testsuite.sumo | 6 ++ 19 files changed, 506 insertions(+) create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion/deadlocks.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion/errors.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion/input_additional.add.xml create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion/input_routes.rou.xml create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion/options.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion/output.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion/railsignalblocks.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion/tripinfos.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion/tripinfos.sumo.meso create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/deadlocks.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/errors.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/input_additional.add.xml create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/input_routes.rou.xml create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/options.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/output.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/railsignalblocks.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/tripinfos.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/tripinfos.sumo.meso diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/deadlocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/deadlocks.sumo new file mode 100644 index 000000000000..f2d35086180c --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/deadlocks.sumo @@ -0,0 +1,44 @@ + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/errors.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/errors.sumo new file mode 100644 index 000000000000..9b7d52d9d3dd --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/errors.sumo @@ -0,0 +1,2 @@ +Warning: Teleporting vehicle 't0'; waited too long (yield), lane='a_0', time=331.00. +Warning: Vehicle 't0' ends teleporting on edge 'b', time=331.00. diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/input_additional.add.xml b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/input_additional.add.xml new file mode 100644 index 000000000000..da71e6733f50 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/input_additional.add.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/input_routes.rou.xml b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/input_routes.rou.xml new file mode 100644 index 000000000000..f58cd2c4c2b8 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/input_routes.rou.xml @@ -0,0 +1,37 @@ + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/options.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/options.sumo new file mode 100644 index 000000000000..d3973627d54d --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/options.sumo @@ -0,0 +1 @@ +--deadlock-output deadlocks.xml diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/output.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/railsignalblocks.sumo new file mode 100644 index 000000000000..36accdb87111 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/railsignalblocks.sumo @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/tripinfos.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/tripinfos.sumo new file mode 100644 index 000000000000..0792730b16b7 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/tripinfos.sumo @@ -0,0 +1,46 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/tripinfos.sumo.meso b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/tripinfos.sumo.meso new file mode 100644 index 000000000000..5270000edde0 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/tripinfos.sumo.meso @@ -0,0 +1,45 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/deadlocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/deadlocks.sumo new file mode 100644 index 000000000000..f2d35086180c --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/deadlocks.sumo @@ -0,0 +1,44 @@ + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/errors.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/errors.sumo new file mode 100644 index 000000000000..69b81cb94ffc --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/errors.sumo @@ -0,0 +1,2 @@ +Warning: Teleporting vehicle 't0'; waited too long (yield), lane='a_0', time=362.00. +Warning: Vehicle 't0' ends teleporting on edge 'b', time=362.00. diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/input_additional.add.xml b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/input_additional.add.xml new file mode 100644 index 000000000000..da71e6733f50 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/input_additional.add.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/input_routes.rou.xml b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/input_routes.rou.xml new file mode 100644 index 000000000000..495562f37ed5 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/input_routes.rou.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/options.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/options.sumo new file mode 100644 index 000000000000..d3973627d54d --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/options.sumo @@ -0,0 +1 @@ +--deadlock-output deadlocks.xml diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/output.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/railsignalblocks.sumo new file mode 100644 index 000000000000..964b90e381f7 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/railsignalblocks.sumo @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/tripinfos.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/tripinfos.sumo new file mode 100644 index 000000000000..9340c9110f72 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/tripinfos.sumo @@ -0,0 +1,46 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/tripinfos.sumo.meso b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/tripinfos.sumo.meso new file mode 100644 index 000000000000..5270000edde0 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/tripinfos.sumo.meso @@ -0,0 +1,45 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/testsuite.sumo b/tests/sumo/rail/rail_signal/constraints/testsuite.sumo index 73eb3e4a3411..0e22cde9f954 100644 --- a/tests/sumo/rail/rail_signal/constraints/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/constraints/testsuite.sumo @@ -33,3 +33,9 @@ deadlock_remove # conflicting constraints cause deadlock, remove the constraint (both vehicles arrive at the same time) deadlock_remove2 + +# blocked insertion contributes to deadlock +deadlock_insertion + +# blocked insertion after parking contributes to deadlock +deadlock_insertion2 From 62a31bb9d3e11695e20bffda05f7e44410c05e75 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 15:31:37 +0200 Subject: [PATCH 310/334] now recognizing deadlocks involving blocked insertion. refs #14543 --- src/microsim/MSNet.cpp | 7 ++++--- src/microsim/traffic_lights/MSDriveWay.cpp | 7 ++++--- src/microsim/traffic_lights/MSRailSignalControl.cpp | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/microsim/MSNet.cpp b/src/microsim/MSNet.cpp index 38ca6ff31419..bf9ea57e7830 100644 --- a/src/microsim/MSNet.cpp +++ b/src/microsim/MSNet.cpp @@ -760,9 +760,6 @@ MSNet::simulationStep(const bool onlyMove) { myPeriodicStateFiles.erase(myPeriodicStateFiles.begin()); } } - if (MSRailSignalControl::hasInstance()) { - MSRailSignalControl::getInstance().resetWaitRelations(); - } myBeginOfTimestepEvents->execute(myStep); if (MSRailSignalControl::hasInstance()) { MSRailSignalControl::getInstance().updateSignals(myStep); @@ -814,6 +811,10 @@ MSNet::simulationStep(const bool onlyMove) { if (myContainerControl != nullptr && myContainerControl->hasTransportables()) { myContainerControl->checkWaiting(this, myStep); } + if (MSRailSignalControl::hasInstance()) { + MSRailSignalControl::getInstance().resetWaitRelations(); + // preserve waitRelation from insertion for the next step + } // insert vehicles myInserter->determineCandidates(myStep); myInsertionEvents->execute(myStep); diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index fc0b38b014a7..9bfa8461bd05 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -462,11 +462,12 @@ MSDriveWay::foeDriveWayOccupied(bool store, const SUMOVehicle* ego, MSEdgeVector } /// @todo: if foe occupies more than one edge we should add all of them to the occupied vector } - if (ego != nullptr && myOrigin != nullptr && MSGlobals::gTimeToTeleportRSDeadlock > 0 - && ego->getWaitingTime() > ego->getVehicleType().getCarFollowModel().getStartupDelay()) { + if (ego != nullptr && MSGlobals::gTimeToTeleportRSDeadlock > 0 + && (ego->getWaitingTime() > ego->getVehicleType().getCarFollowModel().getStartupDelay() || !ego->isOnRoad())) { // if there is an occupied siding, it becomes part of the waitRelation SUMOVehicle* foe = *(useSiding.second == nullptr ? foeDW : useSiding.second)->myTrains.begin(); - MSRailSignalControl::getInstance().addWaitRelation(ego, dynamic_cast(myOrigin->getTLLogic()), foe); + const MSRailSignal* rs = myOrigin != nullptr ? dynamic_cast(myOrigin->getTLLogic()) : nullptr; + MSRailSignalControl::getInstance().addWaitRelation(ego, rs, foe); } return true; } diff --git a/src/microsim/traffic_lights/MSRailSignalControl.cpp b/src/microsim/traffic_lights/MSRailSignalControl.cpp index 8782f8209ecd..cb91fe1549ad 100644 --- a/src/microsim/traffic_lights/MSRailSignalControl.cpp +++ b/src/microsim/traffic_lights/MSRailSignalControl.cpp @@ -154,7 +154,7 @@ MSRailSignalControl::haveDeadlock(const SUMOVehicle* veh) const { std::vector vehicles; std::vector tripIDs; for (auto item : list) { - signals.push_back(item.railSignal->getID()); + signals.push_back(item.railSignal == nullptr ? "INSERTION" : item.railSignal->getID()); vehicles.push_back(item.foe->getID()); tripIDs.push_back(item.foe->getParameter().getParameter("tripId", item.foe->getID())); } From 57417926d22ae678886b78d3664919fa22b79b6a Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 15:31:42 +0200 Subject: [PATCH 311/334] added tests refs #21, #14543 --- .../deadlock_insertion/deadlocks.sumo | 3 +- .../deadlock_insertion/errors.sumo | 4 +- .../deadlock_insertion/tripinfos.sumo | 6 +- .../deadlock_insertion2/deadlocks.sumo | 3 +- .../deadlock_insertion2/errors.sumo | 4 +- .../deadlock_insertion2/tripinfos.sumo | 6 +- .../deadlock_insertion2_remove/deadlocks.sumo | 50 ++++++++++++++ .../deadlock_insertion2_remove/errors.sumo | 1 + .../input_additional.add.xml | 7 ++ .../input_routes.rou.xml | 39 +++++++++++ .../deadlock_insertion2_remove/options.sumo | 2 + .../deadlock_insertion2_remove/output.sumo | 0 .../railsignalblocks.sumo | 67 +++++++++++++++++++ .../deadlock_insertion2_remove/tripinfos.sumo | 47 +++++++++++++ .../tripinfos.sumo.meso | 45 +++++++++++++ .../deadlock_insertion_remove/deadlocks.sumo | 50 ++++++++++++++ .../deadlock_insertion_remove/errors.sumo | 1 + .../input_additional.add.xml | 7 ++ .../input_routes.rou.xml | 37 ++++++++++ .../deadlock_insertion_remove/options.sumo | 2 + .../deadlock_insertion_remove/output.sumo | 0 .../railsignalblocks.sumo | 67 +++++++++++++++++++ .../deadlock_insertion_remove/tripinfos.sumo | 47 +++++++++++++ .../tripinfos.sumo.meso | 45 +++++++++++++ .../rail_signal/constraints/testsuite.sumo | 6 ++ 25 files changed, 534 insertions(+), 12 deletions(-) create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/deadlocks.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/errors.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/input_additional.add.xml create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/input_routes.rou.xml create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/options.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/output.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/railsignalblocks.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/tripinfos.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/tripinfos.sumo.meso create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/deadlocks.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/errors.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/input_additional.add.xml create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/input_routes.rou.xml create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/options.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/output.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/railsignalblocks.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/tripinfos.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/tripinfos.sumo.meso diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/deadlocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/deadlocks.sumo index f2d35086180c..633c6cbbb85e 100644 --- a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/deadlocks.sumo +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/deadlocks.sumo @@ -1,6 +1,6 @@ - + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/errors.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/errors.sumo index 9b7d52d9d3dd..fc65b0cc7b39 100644 --- a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/errors.sumo +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/errors.sumo @@ -1,2 +1,2 @@ -Warning: Teleporting vehicle 't0'; waited too long (yield), lane='a_0', time=331.00. -Warning: Vehicle 't0' ends teleporting on edge 'b', time=331.00. +Warning: Teleporting vehicle 't0'; waited too long (yield, railSignal), lane='a_0', time=231.00. +Warning: Vehicle 't0' ends teleporting on edge 'b', time=231.00. diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/tripinfos.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/tripinfos.sumo index 0792730b16b7..5c8c1199d32a 100644 --- a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/tripinfos.sumo +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion/tripinfos.sumo @@ -1,6 +1,6 @@ - - - + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/deadlocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/deadlocks.sumo index f2d35086180c..dc150ac98eb0 100644 --- a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/deadlocks.sumo +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/deadlocks.sumo @@ -1,6 +1,6 @@ - + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/errors.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/errors.sumo index 69b81cb94ffc..3297cad54810 100644 --- a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/errors.sumo +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/errors.sumo @@ -1,2 +1,2 @@ -Warning: Teleporting vehicle 't0'; waited too long (yield), lane='a_0', time=362.00. -Warning: Vehicle 't0' ends teleporting on edge 'b', time=362.00. +Warning: Teleporting vehicle 't0'; waited too long (yield, railSignal), lane='a_0', time=262.00. +Warning: Vehicle 't0' ends teleporting on edge 'b', time=262.00. diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/tripinfos.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/tripinfos.sumo index 9340c9110f72..2f00a757017e 100644 --- a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/tripinfos.sumo +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2/tripinfos.sumo @@ -1,6 +1,6 @@ - - - + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/deadlocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/deadlocks.sumo new file mode 100644 index 000000000000..df3cb2329276 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/deadlocks.sumo @@ -0,0 +1,50 @@ + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/errors.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/errors.sumo new file mode 100644 index 000000000000..369969b0e888 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/errors.sumo @@ -0,0 +1 @@ +Warning: Deactivating constraint to resolve deadlock between vehicles t1 t0 at time 262.00. diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/input_additional.add.xml b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/input_additional.add.xml new file mode 100644 index 000000000000..da71e6733f50 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/input_additional.add.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/input_routes.rou.xml b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/input_routes.rou.xml new file mode 100644 index 000000000000..495562f37ed5 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/input_routes.rou.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/options.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/options.sumo new file mode 100644 index 000000000000..ebc6c6223b00 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/options.sumo @@ -0,0 +1,2 @@ +--deadlock-output deadlocks.xml +--time-to-teleport.remove-constraint diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/output.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/railsignalblocks.sumo new file mode 100644 index 000000000000..964b90e381f7 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/railsignalblocks.sumo @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/tripinfos.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/tripinfos.sumo new file mode 100644 index 000000000000..8753828864af --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/tripinfos.sumo @@ -0,0 +1,47 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/tripinfos.sumo.meso b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/tripinfos.sumo.meso new file mode 100644 index 000000000000..5270000edde0 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion2_remove/tripinfos.sumo.meso @@ -0,0 +1,45 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/deadlocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/deadlocks.sumo new file mode 100644 index 000000000000..f490293c6632 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/deadlocks.sumo @@ -0,0 +1,50 @@ + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/errors.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/errors.sumo new file mode 100644 index 000000000000..5f5c41c53557 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/errors.sumo @@ -0,0 +1 @@ +Warning: Deactivating constraint to resolve deadlock between vehicles t1 t0 at time 231.00. diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/input_additional.add.xml b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/input_additional.add.xml new file mode 100644 index 000000000000..da71e6733f50 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/input_additional.add.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/input_routes.rou.xml b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/input_routes.rou.xml new file mode 100644 index 000000000000..f58cd2c4c2b8 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/input_routes.rou.xml @@ -0,0 +1,37 @@ + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/options.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/options.sumo new file mode 100644 index 000000000000..ebc6c6223b00 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/options.sumo @@ -0,0 +1,2 @@ +--deadlock-output deadlocks.xml +--time-to-teleport.remove-constraint diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/output.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/railsignalblocks.sumo new file mode 100644 index 000000000000..36accdb87111 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/railsignalblocks.sumo @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/tripinfos.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/tripinfos.sumo new file mode 100644 index 000000000000..415974d9958a --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/tripinfos.sumo @@ -0,0 +1,47 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/tripinfos.sumo.meso b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/tripinfos.sumo.meso new file mode 100644 index 000000000000..5270000edde0 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion_remove/tripinfos.sumo.meso @@ -0,0 +1,45 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/testsuite.sumo b/tests/sumo/rail/rail_signal/constraints/testsuite.sumo index 0e22cde9f954..a9bb50c3898e 100644 --- a/tests/sumo/rail/rail_signal/constraints/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/constraints/testsuite.sumo @@ -37,5 +37,11 @@ deadlock_remove2 # blocked insertion contributes to deadlock deadlock_insertion +# blocked insertion contributes to deadlock, remove the constraint +deadlock_insertion_remove + # blocked insertion after parking contributes to deadlock deadlock_insertion2 + +# blocked insertion after parking contributes to deadlock, remove the constraint +deadlock_insertion2_remove From b6d916cb96fff1ab45513919ba5a37b4f8a17779 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 15:42:09 +0200 Subject: [PATCH 312/334] added tests refs #21, #14543 --- .../deadlock_insertion3/deadlocks.sumo | 45 ++++++++++ .../deadlock_insertion3/errors.sumo | 2 + .../input_additional.add.xml | 10 +++ .../deadlock_insertion3/input_routes.rou.xml | 37 +++++++++ .../deadlock_insertion3/options.sumo | 2 + .../deadlock_insertion3/output.sumo | 0 .../deadlock_insertion3/railsignalblocks.sumo | 82 +++++++++++++++++++ .../deadlock_insertion3/tripinfos.sumo | 47 +++++++++++ .../deadlock_insertion3/tripinfos.sumo.meso | 45 ++++++++++ .../rail_signal/constraints/testsuite.sumo | 3 + 10 files changed, 273 insertions(+) create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/deadlocks.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/errors.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/input_additional.add.xml create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/input_routes.rou.xml create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/options.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/output.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/railsignalblocks.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/tripinfos.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/tripinfos.sumo.meso diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/deadlocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/deadlocks.sumo new file mode 100644 index 000000000000..4d80d202a415 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/deadlocks.sumo @@ -0,0 +1,45 @@ + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/errors.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/errors.sumo new file mode 100644 index 000000000000..9b7d52d9d3dd --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/errors.sumo @@ -0,0 +1,2 @@ +Warning: Teleporting vehicle 't0'; waited too long (yield), lane='a_0', time=331.00. +Warning: Vehicle 't0' ends teleporting on edge 'b', time=331.00. diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/input_additional.add.xml b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/input_additional.add.xml new file mode 100644 index 000000000000..6b5513f01e67 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/input_additional.add.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/input_routes.rou.xml b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/input_routes.rou.xml new file mode 100644 index 000000000000..f87b358d8afd --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/input_routes.rou.xml @@ -0,0 +1,37 @@ + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/options.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/options.sumo new file mode 100644 index 000000000000..ebc6c6223b00 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/options.sumo @@ -0,0 +1,2 @@ +--deadlock-output deadlocks.xml +--time-to-teleport.remove-constraint diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/output.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/railsignalblocks.sumo new file mode 100644 index 000000000000..4fa6731c6917 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/railsignalblocks.sumo @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/tripinfos.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/tripinfos.sumo new file mode 100644 index 000000000000..f3993794b31e --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/tripinfos.sumo @@ -0,0 +1,47 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/tripinfos.sumo.meso b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/tripinfos.sumo.meso new file mode 100644 index 000000000000..5270000edde0 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/tripinfos.sumo.meso @@ -0,0 +1,45 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/testsuite.sumo b/tests/sumo/rail/rail_signal/constraints/testsuite.sumo index a9bb50c3898e..9242546eea18 100644 --- a/tests/sumo/rail/rail_signal/constraints/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/constraints/testsuite.sumo @@ -45,3 +45,6 @@ deadlock_insertion2 # blocked insertion after parking contributes to deadlock, remove the constraint deadlock_insertion2_remove + +# conflicting constraints cause deadlock, remove the constraint, includes an insertionConstraint +deadlock_insertion3 From af757ed17764bfac4f0462512ce215f10d77bf2c Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 15:48:54 +0200 Subject: [PATCH 313/334] now recognizing deadlocks involving insertionConstraint. refs #14543 --- src/microsim/traffic_lights/MSRailSignal.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/microsim/traffic_lights/MSRailSignal.cpp b/src/microsim/traffic_lights/MSRailSignal.cpp index e7628fa707dd..092879b5b65f 100644 --- a/src/microsim/traffic_lights/MSRailSignal.cpp +++ b/src/microsim/traffic_lights/MSRailSignal.cpp @@ -423,6 +423,12 @@ MSRailSignal::hasInsertionConstraint(MSLink* link, const MSVehicle* veh, std::st #endif info = c->getDescription(); isInsertionOrder = c->getType() == MSRailSignalConstraint::ConstraintType::INSERTION_ORDER; + if (MSGlobals::gTimeToTeleportRSDeadlock > 0) { + const SUMOVehicle* foe = c->getFoe(); + if (foe != nullptr) { + MSRailSignalControl::getInstance().addWaitRelation(veh, rs, foe, c); + } + } return true; } } From 483afe88b8258a5ee16f404e0012e3927ed228d1 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 15:49:00 +0200 Subject: [PATCH 314/334] patching expected results refs #21, #14543 --- .../deadlock_insertion3/deadlocks.sumo | 4 +- .../deadlock_insertion3/errors.sumo | 4 +- .../deadlock_insertion3/options.sumo | 1 - .../deadlock_insertion3/tripinfos.sumo | 7 +- .../deadlock_insertion3_remove/deadlocks.sumo | 50 +++++++++++ .../deadlock_insertion3_remove/errors.sumo | 1 + .../input_additional.add.xml | 10 +++ .../input_routes.rou.xml | 37 +++++++++ .../deadlock_insertion3_remove/options.sumo | 2 + .../deadlock_insertion3_remove/output.sumo | 0 .../railsignalblocks.sumo | 82 +++++++++++++++++++ .../deadlock_insertion3_remove/tripinfos.sumo | 47 +++++++++++ .../tripinfos.sumo.meso | 45 ++++++++++ .../rail_signal/constraints/testsuite.sumo | 3 + 14 files changed, 284 insertions(+), 9 deletions(-) create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/deadlocks.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/errors.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/input_additional.add.xml create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/input_routes.rou.xml create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/options.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/output.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/railsignalblocks.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/tripinfos.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/tripinfos.sumo.meso diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/deadlocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/deadlocks.sumo index 4d80d202a415..6708333630a4 100644 --- a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/deadlocks.sumo +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/deadlocks.sumo @@ -1,6 +1,6 @@ - + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/errors.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/errors.sumo index 9b7d52d9d3dd..fc65b0cc7b39 100644 --- a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/errors.sumo +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/errors.sumo @@ -1,2 +1,2 @@ -Warning: Teleporting vehicle 't0'; waited too long (yield), lane='a_0', time=331.00. -Warning: Vehicle 't0' ends teleporting on edge 'b', time=331.00. +Warning: Teleporting vehicle 't0'; waited too long (yield, railSignal), lane='a_0', time=231.00. +Warning: Vehicle 't0' ends teleporting on edge 'b', time=231.00. diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/options.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/options.sumo index ebc6c6223b00..d3973627d54d 100644 --- a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/options.sumo +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/options.sumo @@ -1,2 +1 @@ --deadlock-output deadlocks.xml ---time-to-teleport.remove-constraint diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/tripinfos.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/tripinfos.sumo index f3993794b31e..d656ff872219 100644 --- a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/tripinfos.sumo +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3/tripinfos.sumo @@ -1,6 +1,6 @@ - - - + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/deadlocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/deadlocks.sumo new file mode 100644 index 000000000000..4bdb06c48df9 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/deadlocks.sumo @@ -0,0 +1,50 @@ + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/errors.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/errors.sumo new file mode 100644 index 000000000000..5f5c41c53557 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/errors.sumo @@ -0,0 +1 @@ +Warning: Deactivating constraint to resolve deadlock between vehicles t1 t0 at time 231.00. diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/input_additional.add.xml b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/input_additional.add.xml new file mode 100644 index 000000000000..6b5513f01e67 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/input_additional.add.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/input_routes.rou.xml b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/input_routes.rou.xml new file mode 100644 index 000000000000..f87b358d8afd --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/input_routes.rou.xml @@ -0,0 +1,37 @@ + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/options.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/options.sumo new file mode 100644 index 000000000000..ebc6c6223b00 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/options.sumo @@ -0,0 +1,2 @@ +--deadlock-output deadlocks.xml +--time-to-teleport.remove-constraint diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/output.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/railsignalblocks.sumo new file mode 100644 index 000000000000..4fa6731c6917 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/railsignalblocks.sumo @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/tripinfos.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/tripinfos.sumo new file mode 100644 index 000000000000..328950019611 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/tripinfos.sumo @@ -0,0 +1,47 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/tripinfos.sumo.meso b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/tripinfos.sumo.meso new file mode 100644 index 000000000000..5270000edde0 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_remove/tripinfos.sumo.meso @@ -0,0 +1,45 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/testsuite.sumo b/tests/sumo/rail/rail_signal/constraints/testsuite.sumo index 9242546eea18..15562466cc3f 100644 --- a/tests/sumo/rail/rail_signal/constraints/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/constraints/testsuite.sumo @@ -48,3 +48,6 @@ deadlock_insertion2_remove # conflicting constraints cause deadlock, remove the constraint, includes an insertionConstraint deadlock_insertion3 + +# conflicting constraints cause deadlock, remove the constraint, includes an insertionConstraint, remove constraint to resolve the deadlock +deadlock_insertion3_remove From 38c350fdd40ed8ebf736a47f2f650e73722d1933 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 16:41:13 +0200 Subject: [PATCH 315/334] added tests refs #21, #14543 --- .../deadlock_insertion3_tripId/deadlocks.sumo | 44 ++++++++++ .../deadlock_insertion3_tripId/errors.sumo | 2 + .../input_additional.add.xml | 10 +++ .../input_routes.rou.xml | 41 ++++++++++ .../deadlock_insertion3_tripId/options.sumo | 1 + .../deadlock_insertion3_tripId/output.sumo | 0 .../railsignalblocks.sumo | 82 +++++++++++++++++++ .../deadlock_insertion3_tripId/tripinfos.sumo | 46 +++++++++++ .../tripinfos.sumo.meso | 45 ++++++++++ .../rail_signal/constraints/testsuite.sumo | 3 + 10 files changed, 274 insertions(+) create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/deadlocks.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/errors.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/input_additional.add.xml create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/input_routes.rou.xml create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/options.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/output.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/railsignalblocks.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/tripinfos.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/tripinfos.sumo.meso diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/deadlocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/deadlocks.sumo new file mode 100644 index 000000000000..ccc7256a19f7 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/deadlocks.sumo @@ -0,0 +1,44 @@ + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/errors.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/errors.sumo new file mode 100644 index 000000000000..028d71c2757e --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/errors.sumo @@ -0,0 +1,2 @@ +Warning: Teleporting vehicle 't0'; waited too long (yield), lane='a_0', time=332.00. +Warning: Vehicle 't0' ends teleporting on edge 'b', time=332.00. diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/input_additional.add.xml b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/input_additional.add.xml new file mode 100644 index 000000000000..cffba7fe84d3 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/input_additional.add.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/input_routes.rou.xml b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/input_routes.rou.xml new file mode 100644 index 000000000000..e1a14cfdf002 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/input_routes.rou.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/options.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/options.sumo new file mode 100644 index 000000000000..d3973627d54d --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/options.sumo @@ -0,0 +1 @@ +--deadlock-output deadlocks.xml diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/output.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/railsignalblocks.sumo new file mode 100644 index 000000000000..4fa6731c6917 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/railsignalblocks.sumo @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/tripinfos.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/tripinfos.sumo new file mode 100644 index 000000000000..924c15d7cbec --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/tripinfos.sumo @@ -0,0 +1,46 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/tripinfos.sumo.meso b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/tripinfos.sumo.meso new file mode 100644 index 000000000000..5270000edde0 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/tripinfos.sumo.meso @@ -0,0 +1,45 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/testsuite.sumo b/tests/sumo/rail/rail_signal/constraints/testsuite.sumo index 15562466cc3f..386b609cac2d 100644 --- a/tests/sumo/rail/rail_signal/constraints/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/constraints/testsuite.sumo @@ -51,3 +51,6 @@ deadlock_insertion3 # conflicting constraints cause deadlock, remove the constraint, includes an insertionConstraint, remove constraint to resolve the deadlock deadlock_insertion3_remove + +# conflicting constraints cause deadlock, remove the constraint, includes an insertionConstraint with tripId +deadlock_insertion3_tripId From f0a82cf80a2a34e904c7698d7f5666897afb5653 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 16:46:52 +0200 Subject: [PATCH 316/334] deadlock check now makes use of future tripIds. refs #14543 --- src/microsim/MSBaseVehicle.cpp | 4 ++++ .../traffic_lights/MSRailSignalConstraint.cpp | 20 +++++++++++++++++++ .../traffic_lights/MSRailSignalConstraint.h | 6 ++++++ .../traffic_lights/MSRailSignalControl.cpp | 2 ++ 4 files changed, 32 insertions(+) diff --git a/src/microsim/MSBaseVehicle.cpp b/src/microsim/MSBaseVehicle.cpp index db00d14f5ad0..05cbfc69446c 100644 --- a/src/microsim/MSBaseVehicle.cpp +++ b/src/microsim/MSBaseVehicle.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include "MSGlobals.h" #include "MSVehicleControl.h" #include "MSVehicleType.h" @@ -1389,6 +1390,9 @@ MSBaseVehicle::addStop(const SUMOVehicleParameter::Stop& stopPar, std::string& e + " earlier than arrival at " + time2string(stop.pars.arrival) + "."; } myStops.insert(iter, stop); + if (stopPar.tripId != "") { + MSRailSignalConstraint::storeTripId(stopPar.tripId, getID()); + } //std::cout << " added stop " << errorMsgStart << " totalStops=" << myStops.size() << " searchStart=" << (*searchStart - myRoute->begin()) // << " routeIndex=" << (stop.edge - myRoute->begin()) // << " stopIndex=" << std::distance(myStops.begin(), iter) diff --git a/src/microsim/traffic_lights/MSRailSignalConstraint.cpp b/src/microsim/traffic_lights/MSRailSignalConstraint.cpp index 0009dfaad23f..ced44ac1c5b5 100644 --- a/src/microsim/traffic_lights/MSRailSignalConstraint.cpp +++ b/src/microsim/traffic_lights/MSRailSignalConstraint.cpp @@ -39,6 +39,7 @@ // static value definitions // =========================================================================== std::map MSRailSignalConstraint_Predecessor::myTrackerLookup; +std::map MSRailSignalConstraint::myTripIdLookup; // =========================================================================== // MSRailSignalConstraint method definitions @@ -70,6 +71,7 @@ MSRailSignalConstraint::saveState(OutputDevice& out) { void MSRailSignalConstraint::clearState() { MSRailSignalConstraint_Predecessor::clearState(); + myTripIdLookup.clear(); } void @@ -77,12 +79,20 @@ MSRailSignalConstraint::clearAll() { for (MSRailSignal* s : MSRailSignalControl::getInstance().getSignals()) { s->removeConstraints(); } + myTripIdLookup.clear(); } const SUMOVehicle* MSRailSignalConstraint::getVeh(const std::string& tripID, bool checkID) { MSVehicleControl& c = MSNet::getInstance()->getVehicleControl(); + const std::string& vehID = lookupVehId(tripID); + if (vehID != "") { + SUMOVehicle* veh = c.getVehicle(vehID); + if (veh != nullptr) { + return veh; + } + } for (MSVehicleControl::constVehIt i = c.loadedVehBegin(); i != c.loadedVehEnd(); ++i) { SUMOVehicle* veh = i->second; if (veh->getParameter().getParameter("tripId") == tripID || (checkID && veh->getID() == tripID)) { @@ -209,6 +219,16 @@ MSRailSignalConstraint_Predecessor::getFoe() const { return getVeh(myTripId, true); } +void +MSRailSignalConstraint::storeTripId(const std::string& tripId, const std::string& vehID) { + myTripIdLookup[tripId] = vehID; +} + +const std::string& +MSRailSignalConstraint::lookupVehId(const std::string& tripId) { + return myTripIdLookup[tripId]; +} + // =========================================================================== // MSRailSignalConstraint_Predecessor::PassedTracker method definitions // =========================================================================== diff --git a/src/microsim/traffic_lights/MSRailSignalConstraint.h b/src/microsim/traffic_lights/MSRailSignalConstraint.h index 9fc3cf7efa8a..35bd69e45be5 100644 --- a/src/microsim/traffic_lights/MSRailSignalConstraint.h +++ b/src/microsim/traffic_lights/MSRailSignalConstraint.h @@ -107,6 +107,10 @@ class MSRailSignalConstraint : public Parameterised { return myType == INSERTION_PREDECESSOR || myType == INSERTION_ORDER; } + static void storeTripId(const std::string& tripId, const std::string& vehID); + + static const std::string& lookupVehId(const std::string& tripId); + /// @brief clean up state static void cleanup(); @@ -123,6 +127,8 @@ class MSRailSignalConstraint : public Parameterised { static const SUMOVehicle* getVeh(const std::string& tripID, bool checkID = false); ConstraintType myType; + + static std::map myTripIdLookup; }; diff --git a/src/microsim/traffic_lights/MSRailSignalControl.cpp b/src/microsim/traffic_lights/MSRailSignalControl.cpp index cb91fe1549ad..e2a56e8fe769 100644 --- a/src/microsim/traffic_lights/MSRailSignalControl.cpp +++ b/src/microsim/traffic_lights/MSRailSignalControl.cpp @@ -99,6 +99,7 @@ MSRailSignalControl::addSignal(MSRailSignal* signal) { void MSRailSignalControl::addWaitRelation(const SUMOVehicle* waits, const MSRailSignal* rs, const SUMOVehicle* reason, MSRailSignalConstraint* constraint) { + //std::cout << time2string(SIMSTEP) << " addWaitRelation waits=" << waits->getID() << " foe=" << reason->getID() << "\n"; myWaitRelations[waits] = WaitRelation(rs, reason, constraint); } @@ -111,6 +112,7 @@ MSRailSignalControl::haveDeadlock(const SUMOVehicle* veh) const { std::vector constraints; std::vector constraintBlocked; std::vector constraintSignals; + //std::cout << time2string(SIMSTEP) << " haveDeadlock veh=" << veh->getID() << "\n"; while (seen.count(cur) == 0) { auto it = myWaitRelations.find(cur); if (it != myWaitRelations.end()) { From 187b28facee2feb0c931e17f01b57017317b5349 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 16:46:56 +0200 Subject: [PATCH 317/334] patching expected results refs #21, #14543 --- .../deadlock_insertion3_tripId/deadlocks.sumo | 3 +- .../deadlock_insertion3_tripId/errors.sumo | 4 +- .../deadlock_insertion3_tripId/tripinfos.sumo | 6 +- .../deadlocks.sumo | 50 +++++++++++ .../errors.sumo | 1 + .../input_additional.add.xml | 10 +++ .../input_routes.rou.xml | 41 ++++++++++ .../options.sumo | 2 + .../output.sumo | 0 .../railsignalblocks.sumo | 82 +++++++++++++++++++ .../tripinfos.sumo | 47 +++++++++++ .../tripinfos.sumo.meso | 45 ++++++++++ .../rail_signal/constraints/testsuite.sumo | 3 + 13 files changed, 288 insertions(+), 6 deletions(-) create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/deadlocks.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/errors.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/input_additional.add.xml create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/input_routes.rou.xml create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/options.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/output.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/railsignalblocks.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/tripinfos.sumo create mode 100644 tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/tripinfos.sumo.meso diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/deadlocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/deadlocks.sumo index ccc7256a19f7..56c966d3c11e 100644 --- a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/deadlocks.sumo +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/deadlocks.sumo @@ -1,6 +1,6 @@ - + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/errors.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/errors.sumo index 028d71c2757e..e267bda417f0 100644 --- a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/errors.sumo +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/errors.sumo @@ -1,2 +1,2 @@ -Warning: Teleporting vehicle 't0'; waited too long (yield), lane='a_0', time=332.00. -Warning: Vehicle 't0' ends teleporting on edge 'b', time=332.00. +Warning: Teleporting vehicle 't0'; waited too long (yield, railSignal), lane='a_0', time=232.00. +Warning: Vehicle 't0' ends teleporting on edge 'b', time=232.00. diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/tripinfos.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/tripinfos.sumo index 924c15d7cbec..83b6650e23ba 100644 --- a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/tripinfos.sumo +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId/tripinfos.sumo @@ -1,6 +1,6 @@ - - - + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/deadlocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/deadlocks.sumo new file mode 100644 index 000000000000..c6782f35bc43 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/deadlocks.sumo @@ -0,0 +1,50 @@ + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/errors.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/errors.sumo new file mode 100644 index 000000000000..94b11bdaeb37 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/errors.sumo @@ -0,0 +1 @@ +Warning: Deactivating constraint to resolve deadlock between vehicles t1 t0 at time 232.00. diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/input_additional.add.xml b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/input_additional.add.xml new file mode 100644 index 000000000000..cffba7fe84d3 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/input_additional.add.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/input_routes.rou.xml b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/input_routes.rou.xml new file mode 100644 index 000000000000..e1a14cfdf002 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/input_routes.rou.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/options.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/options.sumo new file mode 100644 index 000000000000..ebc6c6223b00 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/options.sumo @@ -0,0 +1,2 @@ +--deadlock-output deadlocks.xml +--time-to-teleport.remove-constraint diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/output.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/railsignalblocks.sumo new file mode 100644 index 000000000000..4fa6731c6917 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/railsignalblocks.sumo @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/tripinfos.sumo b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/tripinfos.sumo new file mode 100644 index 000000000000..0205270fc571 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/tripinfos.sumo @@ -0,0 +1,47 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/tripinfos.sumo.meso b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/tripinfos.sumo.meso new file mode 100644 index 000000000000..5270000edde0 --- /dev/null +++ b/tests/sumo/rail/rail_signal/constraints/deadlock_insertion3_tripId_remove/tripinfos.sumo.meso @@ -0,0 +1,45 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/constraints/testsuite.sumo b/tests/sumo/rail/rail_signal/constraints/testsuite.sumo index 386b609cac2d..eae6bb68d0dc 100644 --- a/tests/sumo/rail/rail_signal/constraints/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/constraints/testsuite.sumo @@ -54,3 +54,6 @@ deadlock_insertion3_remove # conflicting constraints cause deadlock, remove the constraint, includes an insertionConstraint with tripId deadlock_insertion3_tripId + +# conflicting constraints cause deadlock, remove the constraint, includes an insertionConstraint with tripId +deadlock_insertion3_tripId_remove From 92292efaf9e5d3b0917275c26777fbdd8910432c Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Tue, 15 Oct 2024 23:45:49 +0200 Subject: [PATCH 318/334] patching expected results refs #21 (rerouting via rail signals is not safe, refs #15597) --- tests/sumo/rail/bugs/ticket12873/errors.sumo | 10 ++++++++-- .../bugs/ticket12873/railsignalblocks.sumo | 18 ++++++++++++++---- .../sumo/rail/bugs/ticket12873/tripinfos.sumo | 7 ++++--- tests/sumo/rail/two_passing_loops/errors.sumo | 2 ++ .../sumo/rail/two_passing_loops/tripinfos.sumo | 9 +++++---- tests/sumo/rail/two_passing_loops2/errors.sumo | 3 +++ .../rail/two_passing_loops2/tripinfos.sumo | 9 +++++---- 7 files changed, 41 insertions(+), 17 deletions(-) diff --git a/tests/sumo/rail/bugs/ticket12873/errors.sumo b/tests/sumo/rail/bugs/ticket12873/errors.sumo index 1de435adf185..d74509b6768d 100644 --- a/tests/sumo/rail/bugs/ticket12873/errors.sumo +++ b/tests/sumo/rail/bugs/ticket12873/errors.sumo @@ -1,2 +1,8 @@ -Warning: Teleporting vehicle 'v_1'; frontal collision with vehicle 'v_0', lane='-E3.50_0', gap=-1.00, time=15.00 stage=move. -Warning: Vehicle 'v_1' teleports beyond arrival edge '-E0', time=19.00. +Warning: Invalid approach information to rail signal 'junction 'J7', link 0' after rerouting for vehicle 'v_1' first driveway edge '-E6' time=2.00. +Warning: Vehicle 'v_1' performs emergency braking on lane '-E5_0' with decel=5.00, wished=1.30, severity=1.00, time=2.00. +Warning: Vehicle 'v_1' performs emergency stop at the end of lane '-E5_0' because of a red traffic light (decel=-13.89, offset=7.88), time=2.00. +Warning: Invalid approach information to rail signal 'junction 'J7', link 0' after rerouting for vehicle 'v_1' first driveway edge '-E6' time=18.00. +Warning: Invalid approach information to rail signal 'junction 'J7', link 0' after rerouting for vehicle 'v_1' first driveway edge '-E6' time=20.00. +Warning: Invalid approach information to rail signal 'junction 'J7', link 0' after rerouting for vehicle 'v_1' first driveway edge '-E6' time=22.00. +Warning: Teleporting vehicle 'v_1'; frontal collision with vehicle 'v_0', lane='E3_0', gap=-1.00, time=42.00 stage=move. +Warning: Vehicle 'v_1' ends teleporting on edge '-E0', time=42.00. diff --git a/tests/sumo/rail/bugs/ticket12873/railsignalblocks.sumo b/tests/sumo/rail/bugs/ticket12873/railsignalblocks.sumo index 03d4e5aad89e..b40f559c45b7 100644 --- a/tests/sumo/rail/bugs/ticket12873/railsignalblocks.sumo +++ b/tests/sumo/rail/bugs/ticket12873/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - - + + diff --git a/tests/sumo/rail/two_passing_loops/errors.sumo b/tests/sumo/rail/two_passing_loops/errors.sumo index e69de29bb2d1..e3e1ce4d037c 100644 --- a/tests/sumo/rail/two_passing_loops/errors.sumo +++ b/tests/sumo/rail/two_passing_loops/errors.sumo @@ -0,0 +1,2 @@ +Warning: Invalid approach information to rail signal 'junction 'w3', link 2' after rerouting for vehicle 'rail6' first driveway edge 'T4_0' time=430.00. +Warning: Invalid approach information to rail signal 'junction 'w3', link 2' after rerouting for vehicle 'rail6' first driveway edge 'T4_0' time=440.00. diff --git a/tests/sumo/rail/two_passing_loops/tripinfos.sumo b/tests/sumo/rail/two_passing_loops/tripinfos.sumo index b129f60a3756..ba6f643cb836 100644 --- a/tests/sumo/rail/two_passing_loops/tripinfos.sumo +++ b/tests/sumo/rail/two_passing_loops/tripinfos.sumo @@ -1,6 +1,6 @@ - - - - + + + diff --git a/tests/sumo/rail/two_passing_loops2/errors.sumo b/tests/sumo/rail/two_passing_loops2/errors.sumo index e69de29bb2d1..1667c90b63e6 100644 --- a/tests/sumo/rail/two_passing_loops2/errors.sumo +++ b/tests/sumo/rail/two_passing_loops2/errors.sumo @@ -0,0 +1,3 @@ +Warning: Invalid approach information to rail signal 'junction 'w3', link 2' after rerouting for vehicle 'rail4' first driveway edge 'T4_0' time=350.00. +Warning: Invalid approach information to rail signal 'junction 'w3', link 2' after rerouting for vehicle 'rail5' first driveway edge 'T4_0' time=390.00. +Warning: Invalid approach information to rail signal 'junction 'w3', link 2' after rerouting for vehicle 'rail6' first driveway edge 'T4_0' time=440.00. diff --git a/tests/sumo/rail/two_passing_loops2/tripinfos.sumo b/tests/sumo/rail/two_passing_loops2/tripinfos.sumo index dfc808e1c066..33526a2ae586 100644 --- a/tests/sumo/rail/two_passing_loops2/tripinfos.sumo +++ b/tests/sumo/rail/two_passing_loops2/tripinfos.sumo @@ -1,6 +1,6 @@ - - - - + + + From ea0efc4b86e023311908623bb1f62c35629f4f19 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 16 Oct 2024 08:39:45 +0200 Subject: [PATCH 319/334] reorganizing tests refs #21 --- .../{ => rail}/rail_furtherLane/errors.complex | 0 .../rail_furtherLane/input_routes.rou.xml | 0 .../state/{ => rail}/rail_furtherLane/net.net.xml | 0 .../{ => rail}/rail_furtherLane/options.complex | 0 .../{ => rail}/rail_furtherLane/output.complex | 0 .../{ => rail}/rail_furtherLane/output.complex.meso | 0 .../state/{ => rail}/rail_furtherLane/state.complex | 0 .../{ => rail}/rail_furtherLane/state.complex.meso | 0 .../{ => rail}/rail_furtherLane/tripinfo.complex | 0 .../rail_furtherLane/tripinfo.complex.meso | 0 .../{ => rail}/rail_furtherLane/tripinfo2.complex | 0 .../rail_furtherLane/tripinfo2.complex.meso | 0 .../{ => rail}/save_on_rail_signal/errors.complex | 0 .../save_on_rail_signal/input_routes.rou.xml | 0 .../{ => rail}/save_on_rail_signal/net.net.xml | 0 .../{ => rail}/save_on_rail_signal/options.complex | 0 .../{ => rail}/save_on_rail_signal/output.complex | 0 .../save_on_rail_signal/output.complex.meso | 0 .../{ => rail}/save_on_rail_signal/state.complex | 0 .../save_on_rail_signal/state.complex.meso | 0 .../{ => rail}/save_rail_signal/errors.complex | 0 .../save_rail_signal/input_routes.rou.xml | 0 .../state/{ => rail}/save_rail_signal/net.net.xml | 0 .../{ => rail}/save_rail_signal/options.complex | 0 .../{ => rail}/save_rail_signal/output.complex | 0 .../{ => rail}/save_rail_signal/output.complex.meso | 0 .../state/{ => rail}/save_rail_signal/state.complex | 0 .../{ => rail}/save_rail_signal/state.complex.meso | 0 .../errors.complex | 0 .../input_routes.rou.xml | 0 .../net.net.xml | 0 .../options.complex | 0 .../output.complex | 0 .../state.complex | 0 .../save_rail_signal_constraint/errors.complex | 0 .../input_additional.add.xml | 0 .../input_additional2.add.xml | 0 .../input_routes.rou.xml | 0 .../save_rail_signal_constraint/net.net.xml | 0 .../save_rail_signal_constraint/options.complex | 0 .../save_rail_signal_constraint/output.complex | 0 .../save_rail_signal_constraint/output.complex.meso | 0 .../save_rail_signal_constraint/state.complex | 0 .../save_rail_signal_constraint/state.complex.meso | 0 .../save_rail_signal_constraint/state2.complex | 0 .../save_rail_signal_constraint/state2.complex.meso | 0 .../save_rail_signal_constraint/tripinfo.complex | 0 .../tripinfo.complex.meso | 0 .../save_rail_signal_constraint/tripinfo2.complex | 0 .../tripinfo2.complex.meso | 0 .../errors.complex | 0 .../input_additional.add.xml | 0 .../input_additional2.add.xml | 0 .../input_routes.rou.xml | 0 .../save_rail_signal_constraint_include/net.net.xml | 0 .../options.complex | 0 .../output.complex | 0 .../output.complex.meso | 0 .../state.complex | 0 .../state.complex.meso | 0 .../state2.complex | 0 .../state2.complex.meso | 0 .../tripinfo.complex | 0 .../tripinfo.complex.meso | 0 .../tripinfo2.complex | 0 .../tripinfo2.complex.meso | 0 tests/complex/state/rail/testsuite.complex | 10 ++++++++++ tests/complex/state/testsuite.complex | 13 +++---------- tests/complex/state/testsuite.complex.meso | 9 --------- 69 files changed, 13 insertions(+), 19 deletions(-) rename tests/complex/state/{ => rail}/rail_furtherLane/errors.complex (100%) rename tests/complex/state/{ => rail}/rail_furtherLane/input_routes.rou.xml (100%) rename tests/complex/state/{ => rail}/rail_furtherLane/net.net.xml (100%) rename tests/complex/state/{ => rail}/rail_furtherLane/options.complex (100%) rename tests/complex/state/{ => rail}/rail_furtherLane/output.complex (100%) rename tests/complex/state/{ => rail}/rail_furtherLane/output.complex.meso (100%) rename tests/complex/state/{ => rail}/rail_furtherLane/state.complex (100%) rename tests/complex/state/{ => rail}/rail_furtherLane/state.complex.meso (100%) rename tests/complex/state/{ => rail}/rail_furtherLane/tripinfo.complex (100%) rename tests/complex/state/{ => rail}/rail_furtherLane/tripinfo.complex.meso (100%) rename tests/complex/state/{ => rail}/rail_furtherLane/tripinfo2.complex (100%) rename tests/complex/state/{ => rail}/rail_furtherLane/tripinfo2.complex.meso (100%) rename tests/complex/state/{ => rail}/save_on_rail_signal/errors.complex (100%) rename tests/complex/state/{ => rail}/save_on_rail_signal/input_routes.rou.xml (100%) rename tests/complex/state/{ => rail}/save_on_rail_signal/net.net.xml (100%) rename tests/complex/state/{ => rail}/save_on_rail_signal/options.complex (100%) rename tests/complex/state/{ => rail}/save_on_rail_signal/output.complex (100%) rename tests/complex/state/{ => rail}/save_on_rail_signal/output.complex.meso (100%) rename tests/complex/state/{ => rail}/save_on_rail_signal/state.complex (100%) rename tests/complex/state/{ => rail}/save_on_rail_signal/state.complex.meso (100%) rename tests/complex/state/{ => rail}/save_rail_signal/errors.complex (100%) rename tests/complex/state/{ => rail}/save_rail_signal/input_routes.rou.xml (100%) rename tests/complex/state/{ => rail}/save_rail_signal/net.net.xml (100%) rename tests/complex/state/{ => rail}/save_rail_signal/options.complex (100%) rename tests/complex/state/{ => rail}/save_rail_signal/output.complex (100%) rename tests/complex/state/{ => rail}/save_rail_signal/output.complex.meso (100%) rename tests/complex/state/{ => rail}/save_rail_signal/state.complex (100%) rename tests/complex/state/{ => rail}/save_rail_signal/state.complex.meso (100%) rename tests/complex/state/{ => rail}/save_rail_signal_approach_steplength/errors.complex (100%) rename tests/complex/state/{ => rail}/save_rail_signal_approach_steplength/input_routes.rou.xml (100%) rename tests/complex/state/{ => rail}/save_rail_signal_approach_steplength/net.net.xml (100%) rename tests/complex/state/{ => rail}/save_rail_signal_approach_steplength/options.complex (100%) rename tests/complex/state/{ => rail}/save_rail_signal_approach_steplength/output.complex (100%) rename tests/complex/state/{ => rail}/save_rail_signal_approach_steplength/state.complex (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint/errors.complex (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint/input_additional.add.xml (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint/input_additional2.add.xml (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint/input_routes.rou.xml (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint/net.net.xml (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint/options.complex (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint/output.complex (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint/output.complex.meso (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint/state.complex (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint/state.complex.meso (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint/state2.complex (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint/state2.complex.meso (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint/tripinfo.complex (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint/tripinfo.complex.meso (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint/tripinfo2.complex (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint/tripinfo2.complex.meso (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint_include/errors.complex (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint_include/input_additional.add.xml (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint_include/input_additional2.add.xml (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint_include/input_routes.rou.xml (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint_include/net.net.xml (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint_include/options.complex (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint_include/output.complex (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint_include/output.complex.meso (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint_include/state.complex (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint_include/state.complex.meso (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint_include/state2.complex (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint_include/state2.complex.meso (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint_include/tripinfo.complex (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint_include/tripinfo.complex.meso (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint_include/tripinfo2.complex (100%) rename tests/complex/state/{ => rail}/save_rail_signal_constraint_include/tripinfo2.complex.meso (100%) create mode 100644 tests/complex/state/rail/testsuite.complex diff --git a/tests/complex/state/rail_furtherLane/errors.complex b/tests/complex/state/rail/rail_furtherLane/errors.complex similarity index 100% rename from tests/complex/state/rail_furtherLane/errors.complex rename to tests/complex/state/rail/rail_furtherLane/errors.complex diff --git a/tests/complex/state/rail_furtherLane/input_routes.rou.xml b/tests/complex/state/rail/rail_furtherLane/input_routes.rou.xml similarity index 100% rename from tests/complex/state/rail_furtherLane/input_routes.rou.xml rename to tests/complex/state/rail/rail_furtherLane/input_routes.rou.xml diff --git a/tests/complex/state/rail_furtherLane/net.net.xml b/tests/complex/state/rail/rail_furtherLane/net.net.xml similarity index 100% rename from tests/complex/state/rail_furtherLane/net.net.xml rename to tests/complex/state/rail/rail_furtherLane/net.net.xml diff --git a/tests/complex/state/rail_furtherLane/options.complex b/tests/complex/state/rail/rail_furtherLane/options.complex similarity index 100% rename from tests/complex/state/rail_furtherLane/options.complex rename to tests/complex/state/rail/rail_furtherLane/options.complex diff --git a/tests/complex/state/rail_furtherLane/output.complex b/tests/complex/state/rail/rail_furtherLane/output.complex similarity index 100% rename from tests/complex/state/rail_furtherLane/output.complex rename to tests/complex/state/rail/rail_furtherLane/output.complex diff --git a/tests/complex/state/rail_furtherLane/output.complex.meso b/tests/complex/state/rail/rail_furtherLane/output.complex.meso similarity index 100% rename from tests/complex/state/rail_furtherLane/output.complex.meso rename to tests/complex/state/rail/rail_furtherLane/output.complex.meso diff --git a/tests/complex/state/rail_furtherLane/state.complex b/tests/complex/state/rail/rail_furtherLane/state.complex similarity index 100% rename from tests/complex/state/rail_furtherLane/state.complex rename to tests/complex/state/rail/rail_furtherLane/state.complex diff --git a/tests/complex/state/rail_furtherLane/state.complex.meso b/tests/complex/state/rail/rail_furtherLane/state.complex.meso similarity index 100% rename from tests/complex/state/rail_furtherLane/state.complex.meso rename to tests/complex/state/rail/rail_furtherLane/state.complex.meso diff --git a/tests/complex/state/rail_furtherLane/tripinfo.complex b/tests/complex/state/rail/rail_furtherLane/tripinfo.complex similarity index 100% rename from tests/complex/state/rail_furtherLane/tripinfo.complex rename to tests/complex/state/rail/rail_furtherLane/tripinfo.complex diff --git a/tests/complex/state/rail_furtherLane/tripinfo.complex.meso b/tests/complex/state/rail/rail_furtherLane/tripinfo.complex.meso similarity index 100% rename from tests/complex/state/rail_furtherLane/tripinfo.complex.meso rename to tests/complex/state/rail/rail_furtherLane/tripinfo.complex.meso diff --git a/tests/complex/state/rail_furtherLane/tripinfo2.complex b/tests/complex/state/rail/rail_furtherLane/tripinfo2.complex similarity index 100% rename from tests/complex/state/rail_furtherLane/tripinfo2.complex rename to tests/complex/state/rail/rail_furtherLane/tripinfo2.complex diff --git a/tests/complex/state/rail_furtherLane/tripinfo2.complex.meso b/tests/complex/state/rail/rail_furtherLane/tripinfo2.complex.meso similarity index 100% rename from tests/complex/state/rail_furtherLane/tripinfo2.complex.meso rename to tests/complex/state/rail/rail_furtherLane/tripinfo2.complex.meso diff --git a/tests/complex/state/save_on_rail_signal/errors.complex b/tests/complex/state/rail/save_on_rail_signal/errors.complex similarity index 100% rename from tests/complex/state/save_on_rail_signal/errors.complex rename to tests/complex/state/rail/save_on_rail_signal/errors.complex diff --git a/tests/complex/state/save_on_rail_signal/input_routes.rou.xml b/tests/complex/state/rail/save_on_rail_signal/input_routes.rou.xml similarity index 100% rename from tests/complex/state/save_on_rail_signal/input_routes.rou.xml rename to tests/complex/state/rail/save_on_rail_signal/input_routes.rou.xml diff --git a/tests/complex/state/save_on_rail_signal/net.net.xml b/tests/complex/state/rail/save_on_rail_signal/net.net.xml similarity index 100% rename from tests/complex/state/save_on_rail_signal/net.net.xml rename to tests/complex/state/rail/save_on_rail_signal/net.net.xml diff --git a/tests/complex/state/save_on_rail_signal/options.complex b/tests/complex/state/rail/save_on_rail_signal/options.complex similarity index 100% rename from tests/complex/state/save_on_rail_signal/options.complex rename to tests/complex/state/rail/save_on_rail_signal/options.complex diff --git a/tests/complex/state/save_on_rail_signal/output.complex b/tests/complex/state/rail/save_on_rail_signal/output.complex similarity index 100% rename from tests/complex/state/save_on_rail_signal/output.complex rename to tests/complex/state/rail/save_on_rail_signal/output.complex diff --git a/tests/complex/state/save_on_rail_signal/output.complex.meso b/tests/complex/state/rail/save_on_rail_signal/output.complex.meso similarity index 100% rename from tests/complex/state/save_on_rail_signal/output.complex.meso rename to tests/complex/state/rail/save_on_rail_signal/output.complex.meso diff --git a/tests/complex/state/save_on_rail_signal/state.complex b/tests/complex/state/rail/save_on_rail_signal/state.complex similarity index 100% rename from tests/complex/state/save_on_rail_signal/state.complex rename to tests/complex/state/rail/save_on_rail_signal/state.complex diff --git a/tests/complex/state/save_on_rail_signal/state.complex.meso b/tests/complex/state/rail/save_on_rail_signal/state.complex.meso similarity index 100% rename from tests/complex/state/save_on_rail_signal/state.complex.meso rename to tests/complex/state/rail/save_on_rail_signal/state.complex.meso diff --git a/tests/complex/state/save_rail_signal/errors.complex b/tests/complex/state/rail/save_rail_signal/errors.complex similarity index 100% rename from tests/complex/state/save_rail_signal/errors.complex rename to tests/complex/state/rail/save_rail_signal/errors.complex diff --git a/tests/complex/state/save_rail_signal/input_routes.rou.xml b/tests/complex/state/rail/save_rail_signal/input_routes.rou.xml similarity index 100% rename from tests/complex/state/save_rail_signal/input_routes.rou.xml rename to tests/complex/state/rail/save_rail_signal/input_routes.rou.xml diff --git a/tests/complex/state/save_rail_signal/net.net.xml b/tests/complex/state/rail/save_rail_signal/net.net.xml similarity index 100% rename from tests/complex/state/save_rail_signal/net.net.xml rename to tests/complex/state/rail/save_rail_signal/net.net.xml diff --git a/tests/complex/state/save_rail_signal/options.complex b/tests/complex/state/rail/save_rail_signal/options.complex similarity index 100% rename from tests/complex/state/save_rail_signal/options.complex rename to tests/complex/state/rail/save_rail_signal/options.complex diff --git a/tests/complex/state/save_rail_signal/output.complex b/tests/complex/state/rail/save_rail_signal/output.complex similarity index 100% rename from tests/complex/state/save_rail_signal/output.complex rename to tests/complex/state/rail/save_rail_signal/output.complex diff --git a/tests/complex/state/save_rail_signal/output.complex.meso b/tests/complex/state/rail/save_rail_signal/output.complex.meso similarity index 100% rename from tests/complex/state/save_rail_signal/output.complex.meso rename to tests/complex/state/rail/save_rail_signal/output.complex.meso diff --git a/tests/complex/state/save_rail_signal/state.complex b/tests/complex/state/rail/save_rail_signal/state.complex similarity index 100% rename from tests/complex/state/save_rail_signal/state.complex rename to tests/complex/state/rail/save_rail_signal/state.complex diff --git a/tests/complex/state/save_rail_signal/state.complex.meso b/tests/complex/state/rail/save_rail_signal/state.complex.meso similarity index 100% rename from tests/complex/state/save_rail_signal/state.complex.meso rename to tests/complex/state/rail/save_rail_signal/state.complex.meso diff --git a/tests/complex/state/save_rail_signal_approach_steplength/errors.complex b/tests/complex/state/rail/save_rail_signal_approach_steplength/errors.complex similarity index 100% rename from tests/complex/state/save_rail_signal_approach_steplength/errors.complex rename to tests/complex/state/rail/save_rail_signal_approach_steplength/errors.complex diff --git a/tests/complex/state/save_rail_signal_approach_steplength/input_routes.rou.xml b/tests/complex/state/rail/save_rail_signal_approach_steplength/input_routes.rou.xml similarity index 100% rename from tests/complex/state/save_rail_signal_approach_steplength/input_routes.rou.xml rename to tests/complex/state/rail/save_rail_signal_approach_steplength/input_routes.rou.xml diff --git a/tests/complex/state/save_rail_signal_approach_steplength/net.net.xml b/tests/complex/state/rail/save_rail_signal_approach_steplength/net.net.xml similarity index 100% rename from tests/complex/state/save_rail_signal_approach_steplength/net.net.xml rename to tests/complex/state/rail/save_rail_signal_approach_steplength/net.net.xml diff --git a/tests/complex/state/save_rail_signal_approach_steplength/options.complex b/tests/complex/state/rail/save_rail_signal_approach_steplength/options.complex similarity index 100% rename from tests/complex/state/save_rail_signal_approach_steplength/options.complex rename to tests/complex/state/rail/save_rail_signal_approach_steplength/options.complex diff --git a/tests/complex/state/save_rail_signal_approach_steplength/output.complex b/tests/complex/state/rail/save_rail_signal_approach_steplength/output.complex similarity index 100% rename from tests/complex/state/save_rail_signal_approach_steplength/output.complex rename to tests/complex/state/rail/save_rail_signal_approach_steplength/output.complex diff --git a/tests/complex/state/save_rail_signal_approach_steplength/state.complex b/tests/complex/state/rail/save_rail_signal_approach_steplength/state.complex similarity index 100% rename from tests/complex/state/save_rail_signal_approach_steplength/state.complex rename to tests/complex/state/rail/save_rail_signal_approach_steplength/state.complex diff --git a/tests/complex/state/save_rail_signal_constraint/errors.complex b/tests/complex/state/rail/save_rail_signal_constraint/errors.complex similarity index 100% rename from tests/complex/state/save_rail_signal_constraint/errors.complex rename to tests/complex/state/rail/save_rail_signal_constraint/errors.complex diff --git a/tests/complex/state/save_rail_signal_constraint/input_additional.add.xml b/tests/complex/state/rail/save_rail_signal_constraint/input_additional.add.xml similarity index 100% rename from tests/complex/state/save_rail_signal_constraint/input_additional.add.xml rename to tests/complex/state/rail/save_rail_signal_constraint/input_additional.add.xml diff --git a/tests/complex/state/save_rail_signal_constraint/input_additional2.add.xml b/tests/complex/state/rail/save_rail_signal_constraint/input_additional2.add.xml similarity index 100% rename from tests/complex/state/save_rail_signal_constraint/input_additional2.add.xml rename to tests/complex/state/rail/save_rail_signal_constraint/input_additional2.add.xml diff --git a/tests/complex/state/save_rail_signal_constraint/input_routes.rou.xml b/tests/complex/state/rail/save_rail_signal_constraint/input_routes.rou.xml similarity index 100% rename from tests/complex/state/save_rail_signal_constraint/input_routes.rou.xml rename to tests/complex/state/rail/save_rail_signal_constraint/input_routes.rou.xml diff --git a/tests/complex/state/save_rail_signal_constraint/net.net.xml b/tests/complex/state/rail/save_rail_signal_constraint/net.net.xml similarity index 100% rename from tests/complex/state/save_rail_signal_constraint/net.net.xml rename to tests/complex/state/rail/save_rail_signal_constraint/net.net.xml diff --git a/tests/complex/state/save_rail_signal_constraint/options.complex b/tests/complex/state/rail/save_rail_signal_constraint/options.complex similarity index 100% rename from tests/complex/state/save_rail_signal_constraint/options.complex rename to tests/complex/state/rail/save_rail_signal_constraint/options.complex diff --git a/tests/complex/state/save_rail_signal_constraint/output.complex b/tests/complex/state/rail/save_rail_signal_constraint/output.complex similarity index 100% rename from tests/complex/state/save_rail_signal_constraint/output.complex rename to tests/complex/state/rail/save_rail_signal_constraint/output.complex diff --git a/tests/complex/state/save_rail_signal_constraint/output.complex.meso b/tests/complex/state/rail/save_rail_signal_constraint/output.complex.meso similarity index 100% rename from tests/complex/state/save_rail_signal_constraint/output.complex.meso rename to tests/complex/state/rail/save_rail_signal_constraint/output.complex.meso diff --git a/tests/complex/state/save_rail_signal_constraint/state.complex b/tests/complex/state/rail/save_rail_signal_constraint/state.complex similarity index 100% rename from tests/complex/state/save_rail_signal_constraint/state.complex rename to tests/complex/state/rail/save_rail_signal_constraint/state.complex diff --git a/tests/complex/state/save_rail_signal_constraint/state.complex.meso b/tests/complex/state/rail/save_rail_signal_constraint/state.complex.meso similarity index 100% rename from tests/complex/state/save_rail_signal_constraint/state.complex.meso rename to tests/complex/state/rail/save_rail_signal_constraint/state.complex.meso diff --git a/tests/complex/state/save_rail_signal_constraint/state2.complex b/tests/complex/state/rail/save_rail_signal_constraint/state2.complex similarity index 100% rename from tests/complex/state/save_rail_signal_constraint/state2.complex rename to tests/complex/state/rail/save_rail_signal_constraint/state2.complex diff --git a/tests/complex/state/save_rail_signal_constraint/state2.complex.meso b/tests/complex/state/rail/save_rail_signal_constraint/state2.complex.meso similarity index 100% rename from tests/complex/state/save_rail_signal_constraint/state2.complex.meso rename to tests/complex/state/rail/save_rail_signal_constraint/state2.complex.meso diff --git a/tests/complex/state/save_rail_signal_constraint/tripinfo.complex b/tests/complex/state/rail/save_rail_signal_constraint/tripinfo.complex similarity index 100% rename from tests/complex/state/save_rail_signal_constraint/tripinfo.complex rename to tests/complex/state/rail/save_rail_signal_constraint/tripinfo.complex diff --git a/tests/complex/state/save_rail_signal_constraint/tripinfo.complex.meso b/tests/complex/state/rail/save_rail_signal_constraint/tripinfo.complex.meso similarity index 100% rename from tests/complex/state/save_rail_signal_constraint/tripinfo.complex.meso rename to tests/complex/state/rail/save_rail_signal_constraint/tripinfo.complex.meso diff --git a/tests/complex/state/save_rail_signal_constraint/tripinfo2.complex b/tests/complex/state/rail/save_rail_signal_constraint/tripinfo2.complex similarity index 100% rename from tests/complex/state/save_rail_signal_constraint/tripinfo2.complex rename to tests/complex/state/rail/save_rail_signal_constraint/tripinfo2.complex diff --git a/tests/complex/state/save_rail_signal_constraint/tripinfo2.complex.meso b/tests/complex/state/rail/save_rail_signal_constraint/tripinfo2.complex.meso similarity index 100% rename from tests/complex/state/save_rail_signal_constraint/tripinfo2.complex.meso rename to tests/complex/state/rail/save_rail_signal_constraint/tripinfo2.complex.meso diff --git a/tests/complex/state/save_rail_signal_constraint_include/errors.complex b/tests/complex/state/rail/save_rail_signal_constraint_include/errors.complex similarity index 100% rename from tests/complex/state/save_rail_signal_constraint_include/errors.complex rename to tests/complex/state/rail/save_rail_signal_constraint_include/errors.complex diff --git a/tests/complex/state/save_rail_signal_constraint_include/input_additional.add.xml b/tests/complex/state/rail/save_rail_signal_constraint_include/input_additional.add.xml similarity index 100% rename from tests/complex/state/save_rail_signal_constraint_include/input_additional.add.xml rename to tests/complex/state/rail/save_rail_signal_constraint_include/input_additional.add.xml diff --git a/tests/complex/state/save_rail_signal_constraint_include/input_additional2.add.xml b/tests/complex/state/rail/save_rail_signal_constraint_include/input_additional2.add.xml similarity index 100% rename from tests/complex/state/save_rail_signal_constraint_include/input_additional2.add.xml rename to tests/complex/state/rail/save_rail_signal_constraint_include/input_additional2.add.xml diff --git a/tests/complex/state/save_rail_signal_constraint_include/input_routes.rou.xml b/tests/complex/state/rail/save_rail_signal_constraint_include/input_routes.rou.xml similarity index 100% rename from tests/complex/state/save_rail_signal_constraint_include/input_routes.rou.xml rename to tests/complex/state/rail/save_rail_signal_constraint_include/input_routes.rou.xml diff --git a/tests/complex/state/save_rail_signal_constraint_include/net.net.xml b/tests/complex/state/rail/save_rail_signal_constraint_include/net.net.xml similarity index 100% rename from tests/complex/state/save_rail_signal_constraint_include/net.net.xml rename to tests/complex/state/rail/save_rail_signal_constraint_include/net.net.xml diff --git a/tests/complex/state/save_rail_signal_constraint_include/options.complex b/tests/complex/state/rail/save_rail_signal_constraint_include/options.complex similarity index 100% rename from tests/complex/state/save_rail_signal_constraint_include/options.complex rename to tests/complex/state/rail/save_rail_signal_constraint_include/options.complex diff --git a/tests/complex/state/save_rail_signal_constraint_include/output.complex b/tests/complex/state/rail/save_rail_signal_constraint_include/output.complex similarity index 100% rename from tests/complex/state/save_rail_signal_constraint_include/output.complex rename to tests/complex/state/rail/save_rail_signal_constraint_include/output.complex diff --git a/tests/complex/state/save_rail_signal_constraint_include/output.complex.meso b/tests/complex/state/rail/save_rail_signal_constraint_include/output.complex.meso similarity index 100% rename from tests/complex/state/save_rail_signal_constraint_include/output.complex.meso rename to tests/complex/state/rail/save_rail_signal_constraint_include/output.complex.meso diff --git a/tests/complex/state/save_rail_signal_constraint_include/state.complex b/tests/complex/state/rail/save_rail_signal_constraint_include/state.complex similarity index 100% rename from tests/complex/state/save_rail_signal_constraint_include/state.complex rename to tests/complex/state/rail/save_rail_signal_constraint_include/state.complex diff --git a/tests/complex/state/save_rail_signal_constraint_include/state.complex.meso b/tests/complex/state/rail/save_rail_signal_constraint_include/state.complex.meso similarity index 100% rename from tests/complex/state/save_rail_signal_constraint_include/state.complex.meso rename to tests/complex/state/rail/save_rail_signal_constraint_include/state.complex.meso diff --git a/tests/complex/state/save_rail_signal_constraint_include/state2.complex b/tests/complex/state/rail/save_rail_signal_constraint_include/state2.complex similarity index 100% rename from tests/complex/state/save_rail_signal_constraint_include/state2.complex rename to tests/complex/state/rail/save_rail_signal_constraint_include/state2.complex diff --git a/tests/complex/state/save_rail_signal_constraint_include/state2.complex.meso b/tests/complex/state/rail/save_rail_signal_constraint_include/state2.complex.meso similarity index 100% rename from tests/complex/state/save_rail_signal_constraint_include/state2.complex.meso rename to tests/complex/state/rail/save_rail_signal_constraint_include/state2.complex.meso diff --git a/tests/complex/state/save_rail_signal_constraint_include/tripinfo.complex b/tests/complex/state/rail/save_rail_signal_constraint_include/tripinfo.complex similarity index 100% rename from tests/complex/state/save_rail_signal_constraint_include/tripinfo.complex rename to tests/complex/state/rail/save_rail_signal_constraint_include/tripinfo.complex diff --git a/tests/complex/state/save_rail_signal_constraint_include/tripinfo.complex.meso b/tests/complex/state/rail/save_rail_signal_constraint_include/tripinfo.complex.meso similarity index 100% rename from tests/complex/state/save_rail_signal_constraint_include/tripinfo.complex.meso rename to tests/complex/state/rail/save_rail_signal_constraint_include/tripinfo.complex.meso diff --git a/tests/complex/state/save_rail_signal_constraint_include/tripinfo2.complex b/tests/complex/state/rail/save_rail_signal_constraint_include/tripinfo2.complex similarity index 100% rename from tests/complex/state/save_rail_signal_constraint_include/tripinfo2.complex rename to tests/complex/state/rail/save_rail_signal_constraint_include/tripinfo2.complex diff --git a/tests/complex/state/save_rail_signal_constraint_include/tripinfo2.complex.meso b/tests/complex/state/rail/save_rail_signal_constraint_include/tripinfo2.complex.meso similarity index 100% rename from tests/complex/state/save_rail_signal_constraint_include/tripinfo2.complex.meso rename to tests/complex/state/rail/save_rail_signal_constraint_include/tripinfo2.complex.meso diff --git a/tests/complex/state/rail/testsuite.complex b/tests/complex/state/rail/testsuite.complex new file mode 100644 index 000000000000..62019b89e1f9 --- /dev/null +++ b/tests/complex/state/rail/testsuite.complex @@ -0,0 +1,10 @@ +save_on_rail_signal +save_rail_signal +save_rail_signal_constraint + +# include the actual constraints in the saved state +save_rail_signal_constraint_include +save_rail_signal_approach_steplength + +# restore further lanes according to previous route when loading state +rail_furtherLane diff --git a/tests/complex/state/testsuite.complex b/tests/complex/state/testsuite.complex index 4f08340172e1..1ede5cfe7cf6 100644 --- a/tests/complex/state/testsuite.complex +++ b/tests/complex/state/testsuite.complex @@ -1,6 +1,9 @@ # test state saving with persons persons +# railway specific tests +rail + # two vehicles saved and reloaded plain @@ -49,15 +52,8 @@ save_flow50 # save and load flow but do not load the original route file load_flow_state_only -save_on_rail_signal save_parking save_parking_busStop -save_rail_signal -save_rail_signal_constraint - -# include the actual constraints in the saved state -save_rail_signal_constraint_include -save_rail_signal_approach_steplength save_rng save_routeDistribution @@ -72,9 +68,6 @@ save_stopped_started_ended # save stops in named routes named_route_stops -# restore further lanes according to previous route when loading state -rail_furtherLane - # test vehroute-output.exit-times after loading state exit_times diff --git a/tests/complex/state/testsuite.complex.meso b/tests/complex/state/testsuite.complex.meso index 4d94a8eb07cc..c446e5f3134f 100644 --- a/tests/complex/state/testsuite.complex.meso +++ b/tests/complex/state/testsuite.complex.meso @@ -43,14 +43,8 @@ save_flow50 # save and load flow but do not load the original route file load_flow_state_only -save_on_rail_signal save_parking save_parking_busStop -save_rail_signal -save_rail_signal_constraint - -# include the actual constraints in the saved state -save_rail_signal_constraint_include save_rng save_routeDistribution save_stopped @@ -62,9 +56,6 @@ save_stopped_started_ended # save stops in named routes named_route_stops -# restore further lanes according to previous route when loading state -rail_furtherLane - # test vehroute-output.exit-times after loading state exit_times From f016839ee01e4e4c4b8916284ac157149baebfdd Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 16 Oct 2024 08:49:27 +0200 Subject: [PATCH 320/334] added tests refs #21, #7578 --- .../rail/save_rail_signal2/errors.complex | 2 + .../save_rail_signal2/input_routes.rou.xml | 11 ++ .../state/rail/save_rail_signal2/net.net.xml | 150 ++++++++++++++++++ .../rail/save_rail_signal2/options.complex | 10 ++ .../rail/save_rail_signal2/output.complex | 11 ++ .../save_rail_signal2/output.complex.meso | 11 ++ .../rail/save_rail_signal2/state.complex | 53 +++++++ .../rail/save_rail_signal2/state.complex.meso | 57 +++++++ tests/complex/state/rail/testsuite.complex | 3 + 9 files changed, 308 insertions(+) create mode 100644 tests/complex/state/rail/save_rail_signal2/errors.complex create mode 100644 tests/complex/state/rail/save_rail_signal2/input_routes.rou.xml create mode 100644 tests/complex/state/rail/save_rail_signal2/net.net.xml create mode 100644 tests/complex/state/rail/save_rail_signal2/options.complex create mode 100644 tests/complex/state/rail/save_rail_signal2/output.complex create mode 100644 tests/complex/state/rail/save_rail_signal2/output.complex.meso create mode 100644 tests/complex/state/rail/save_rail_signal2/state.complex create mode 100644 tests/complex/state/rail/save_rail_signal2/state.complex.meso diff --git a/tests/complex/state/rail/save_rail_signal2/errors.complex b/tests/complex/state/rail/save_rail_signal2/errors.complex new file mode 100644 index 000000000000..afa40a1db9a4 --- /dev/null +++ b/tests/complex/state/rail/save_rail_signal2/errors.complex @@ -0,0 +1,2 @@ +Warning: Teleporting vehicle 'train'; collision with vehicle 'train2', lane='-c_0', gap=-1.00, time=23.00 stage=move. +Warning: Vehicle 'train' ends teleporting on edge 'd', time=23.00. diff --git a/tests/complex/state/rail/save_rail_signal2/input_routes.rou.xml b/tests/complex/state/rail/save_rail_signal2/input_routes.rou.xml new file mode 100644 index 000000000000..84d7cdab7792 --- /dev/null +++ b/tests/complex/state/rail/save_rail_signal2/input_routes.rou.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/tests/complex/state/rail/save_rail_signal2/net.net.xml b/tests/complex/state/rail/save_rail_signal2/net.net.xml new file mode 100644 index 000000000000..dfab3dc6b359 --- /dev/null +++ b/tests/complex/state/rail/save_rail_signal2/net.net.xml @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/complex/state/rail/save_rail_signal2/options.complex b/tests/complex/state/rail/save_rail_signal2/options.complex new file mode 100644 index 000000000000..a68cceab9dac --- /dev/null +++ b/tests/complex/state/rail/save_rail_signal2/options.complex @@ -0,0 +1,10 @@ +--no-step-log --no-duration-log -v --net-file=net.net.xml +-r=input_routes.rou.xml +--save-state.times 20 +--save-state.files state.xml +--default.speeddev 0 +: +--no-step-log --no-duration-log -v --net-file=net.net.xml +--load-state state.xml +--default.speeddev 0 +tests/complex/state/runner.py diff --git a/tests/complex/state/rail/save_rail_signal2/output.complex b/tests/complex/state/rail/save_rail_signal2/output.complex new file mode 100644 index 000000000000..97568589ef4d --- /dev/null +++ b/tests/complex/state/rail/save_rail_signal2/output.complex @@ -0,0 +1,11 @@ +Loading net-file from 'net.net.xml' ... done (1ms). +Loading done. +Simulation version v1_20_0+0681-187b28facee started with time: 0.00. +Simulation ended at time: 54.00 +Reason: All vehicles have left the simulation. +Loading net-file from 'net.net.xml' ... done (0ms). +Loading state from 'state.xml' ... done (6ms). +Loading done. +Simulation version v1_20_0+0681-187b28facee started with time: 20.00. +Simulation ended at time: 48.00 +Reason: All vehicles have left the simulation. diff --git a/tests/complex/state/rail/save_rail_signal2/output.complex.meso b/tests/complex/state/rail/save_rail_signal2/output.complex.meso new file mode 100644 index 000000000000..c48ee2f9c0ac --- /dev/null +++ b/tests/complex/state/rail/save_rail_signal2/output.complex.meso @@ -0,0 +1,11 @@ +Loading net-file from 'net.net.xml' ... done (2ms). +Loading done. +Simulation version v1_17_0+1317-06f42fb started with time: 0.00. +Simulation ended at time: 135.00 +Reason: All vehicles have left the simulation. +Loading net-file from 'net.net.xml' ... done (1ms). +Loading state from 'state.xml' ... done (11ms). +Loading done. +Simulation version v1_17_0+1317-06f42fb started with time: 30.00. +Simulation ended at time: 135.00 +Reason: All vehicles have left the simulation. diff --git a/tests/complex/state/rail/save_rail_signal2/state.complex b/tests/complex/state/rail/save_rail_signal2/state.complex new file mode 100644 index 000000000000..2ec512e99f5f --- /dev/null +++ b/tests/complex/state/rail/save_rail_signal2/state.complex @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/complex/state/rail/save_rail_signal2/state.complex.meso b/tests/complex/state/rail/save_rail_signal2/state.complex.meso new file mode 100644 index 000000000000..8bbb770e179d --- /dev/null +++ b/tests/complex/state/rail/save_rail_signal2/state.complex.meso @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/complex/state/rail/testsuite.complex b/tests/complex/state/rail/testsuite.complex index 62019b89e1f9..5cfa4051c0e5 100644 --- a/tests/complex/state/rail/testsuite.complex +++ b/tests/complex/state/rail/testsuite.complex @@ -1,5 +1,8 @@ save_on_rail_signal save_rail_signal + +# Copy of save_rail_signal +save_rail_signal2 save_rail_signal_constraint # include the actual constraints in the saved state From f89fe07ffeba1f0eb730943c78de452ce2be5389 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 16 Oct 2024 09:03:16 +0200 Subject: [PATCH 321/334] proper output initialization refs #14990 --- src/microsim/MSFrame.cpp | 1 + src/microsim/traffic_lights/MSDriveWay.cpp | 8 +------- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/microsim/MSFrame.cpp b/src/microsim/MSFrame.cpp index 21c7faf8f938..ad8733743e56 100644 --- a/src/microsim/MSFrame.cpp +++ b/src/microsim/MSFrame.cpp @@ -838,6 +838,7 @@ MSFrame::buildStreams() { //OutputDevice::createDeviceByOption("vtk-output", "vtk-export"); OutputDevice::createDeviceByOption("link-output", "link-output"); OutputDevice::createDeviceByOption("railsignal-block-output", "railsignal-block-output"); + OutputDevice::createDeviceByOption("railsignal-vehicle-output", "railsignal-vehicle-output"); OutputDevice::createDeviceByOption("bt-output", "bt-output"); OutputDevice::createDeviceByOption("lanechange-output", "lanechanges"); OutputDevice::createDeviceByOption("stop-output", "stops", "stopinfo_file.xsd"); diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 9bfa8461bd05..3d69c5404a08 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -81,13 +81,7 @@ std::map > MSDriveWay::myEndingDriveways // --------------------------------------------------------------------------- void MSDriveWay::init() { - const OptionsCont& oc = OptionsCont::getOptions(); - if (oc.isSet("railsignal-vehicle-output")) { - OutputDevice::createDeviceByOption("railsignal-vehicle-output"); - myWriteVehicles = true; - } else { - myWriteVehicles = false; - } + myWriteVehicles = OptionsCont::getOptions().isSet("railsignal-vehicle-output"); } // =========================================================================== From 25e69aee5a293928daae967809a76dd14d3b1137 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 16 Oct 2024 09:03:31 +0200 Subject: [PATCH 322/334] patching expected results refs #21, #14990 --- tests/sumo/config.sumo | 4 + .../rail/interlocking/railsignalvehs.sumo | 175 +++++++----- .../overlapping_driveways/railsignalvehs.sumo | 204 ++++++++------ .../constraints/bidi/railsignalvehs.sumo | 152 +++++++---- .../railsignalvehs.sumo | 145 ++++++---- .../large_step_size/railsignalvehs.sumo | 113 +++++--- .../protect_flank_option/railsignalvehs.sumo | 124 ++++++--- .../parking_insertion/railsignalvehs.sumo | 144 ++++++---- .../railsignalvehs.sumo | 99 +++++-- .../update_driveways/railsignalvehs.sumo | 131 ++++++--- .../bidiDepart_reversal/railsignalvehs.sumo | 137 ++++++---- .../railsignalvehs.sumo | 129 ++++++--- .../double_reversal_dwEnd/railsignalvehs.sumo | 125 ++++++--- .../railsignalvehs.sumo | 253 ++++++++++-------- .../subdriveway_reversal/railsignalvehs.sumo | 163 ++++++----- .../two_double_reversals/railsignalvehs.sumo | 155 +++++++---- 16 files changed, 1460 insertions(+), 793 deletions(-) diff --git a/tests/sumo/config.sumo b/tests/sumo/config.sumo index 077bcfc7257d..49237545aa00 100644 --- a/tests/sumo/config.sumo +++ b/tests/sumo/config.sumo @@ -93,6 +93,8 @@ calibrator_log:calibrator.log.xml links:linkstate.xml railsignalblocks:railsignal_blocks.xml railsignalvehs:railsignal_vehicles.xml +railsignalblocks2:railsignal_blocks2.xml +railsignalvehs2:railsignal_vehicles2.xml dispatchinfos:dispatchinfos.xml aggregated60Prefixed:pre_aggregated_60.xml tripinfosPrefix:pre_tripinfos.xml @@ -148,6 +150,8 @@ chargingstations: links: railsignalblocks: railsignalvehs: +railsignalblocks2: +railsignalvehs2: dispatchinfos: ssm: ssm2: diff --git a/tests/sumo/rail/interlocking/railsignalvehs.sumo b/tests/sumo/rail/interlocking/railsignalvehs.sumo index a38ba02059ed..84ef753a3036 100644 --- a/tests/sumo/rail/interlocking/railsignalvehs.sumo +++ b/tests/sumo/rail/interlocking/railsignalvehs.sumo @@ -1,66 +1,115 @@ - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/tests/sumo/rail/overlapping_driveways/railsignalvehs.sumo b/tests/sumo/rail/overlapping_driveways/railsignalvehs.sumo index 99b44218ae81..a8cae37d0c15 100644 --- a/tests/sumo/rail/overlapping_driveways/railsignalvehs.sumo +++ b/tests/sumo/rail/overlapping_driveways/railsignalvehs.sumo @@ -1,82 +1,124 @@ - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/tests/sumo/rail/rail_signal/constraints/bidi/railsignalvehs.sumo b/tests/sumo/rail/rail_signal/constraints/bidi/railsignalvehs.sumo index bf5faedb7b70..c7823192b1cf 100644 --- a/tests/sumo/rail/rail_signal/constraints/bidi/railsignalvehs.sumo +++ b/tests/sumo/rail/rail_signal/constraints/bidi/railsignalvehs.sumo @@ -1,56 +1,100 @@ - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/tests/sumo/rail/rail_signal/indirect_guard_route_conflict/railsignalvehs.sumo b/tests/sumo/rail/rail_signal/indirect_guard_route_conflict/railsignalvehs.sumo index 1b4ee72a65f7..9ec5e2ad72d0 100644 --- a/tests/sumo/rail/rail_signal/indirect_guard_route_conflict/railsignalvehs.sumo +++ b/tests/sumo/rail/rail_signal/indirect_guard_route_conflict/railsignalvehs.sumo @@ -1,53 +1,96 @@ - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/tests/sumo/rail/rail_signal/large_step_size/railsignalvehs.sumo b/tests/sumo/rail/rail_signal/large_step_size/railsignalvehs.sumo index cb907f3cec1b..592c236fffcc 100644 --- a/tests/sumo/rail/rail_signal/large_step_size/railsignalvehs.sumo +++ b/tests/sumo/rail/rail_signal/large_step_size/railsignalvehs.sumo @@ -1,33 +1,82 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + diff --git a/tests/sumo/rail/rail_signal/moving_block/protect_flank_option/railsignalvehs.sumo b/tests/sumo/rail/rail_signal/moving_block/protect_flank_option/railsignalvehs.sumo index 289e8d8e6440..5a1a32d4df10 100644 --- a/tests/sumo/rail/rail_signal/moving_block/protect_flank_option/railsignalvehs.sumo +++ b/tests/sumo/rail/rail_signal/moving_block/protect_flank_option/railsignalvehs.sumo @@ -1,42 +1,86 @@ - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/tests/sumo/rail/rail_signal/parking_insertion/railsignalvehs.sumo b/tests/sumo/rail/rail_signal/parking_insertion/railsignalvehs.sumo index 40a1cf4feb37..ef46ce5727fe 100644 --- a/tests/sumo/rail/rail_signal/parking_insertion/railsignalvehs.sumo +++ b/tests/sumo/rail/rail_signal/parking_insertion/railsignalvehs.sumo @@ -1,52 +1,96 @@ - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/tests/sumo/rail/rail_signal/reversal_before_signal/railsignalvehs.sumo b/tests/sumo/rail/rail_signal/reversal_before_signal/railsignalvehs.sumo index 1d6ae2dad33d..5804f73b0941 100644 --- a/tests/sumo/rail/rail_signal/reversal_before_signal/railsignalvehs.sumo +++ b/tests/sumo/rail/rail_signal/reversal_before_signal/railsignalvehs.sumo @@ -1,29 +1,72 @@ - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/tests/sumo/rail/rail_signal/update_driveways/railsignalvehs.sumo b/tests/sumo/rail/rail_signal/update_driveways/railsignalvehs.sumo index 0bea42fe6fc6..5813a4bfe2ba 100644 --- a/tests/sumo/rail/rail_signal/update_driveways/railsignalvehs.sumo +++ b/tests/sumo/rail/rail_signal/update_driveways/railsignalvehs.sumo @@ -1,46 +1,89 @@ - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + diff --git a/tests/sumo/rail/reversal/bidiDepart_reversal/railsignalvehs.sumo b/tests/sumo/rail/reversal/bidiDepart_reversal/railsignalvehs.sumo index a7e19409ede7..e71aa0dc001e 100644 --- a/tests/sumo/rail/reversal/bidiDepart_reversal/railsignalvehs.sumo +++ b/tests/sumo/rail/reversal/bidiDepart_reversal/railsignalvehs.sumo @@ -1,49 +1,94 @@ - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + - - - - - - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/tests/sumo/rail/reversal/consecutive_before_reversal/railsignalvehs.sumo b/tests/sumo/rail/reversal/consecutive_before_reversal/railsignalvehs.sumo index 06797ee35589..6db333a7c49c 100644 --- a/tests/sumo/rail/reversal/consecutive_before_reversal/railsignalvehs.sumo +++ b/tests/sumo/rail/reversal/consecutive_before_reversal/railsignalvehs.sumo @@ -1,44 +1,87 @@ - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/tests/sumo/rail/reversal/double_reversal_dwEnd/railsignalvehs.sumo b/tests/sumo/rail/reversal/double_reversal_dwEnd/railsignalvehs.sumo index 1c5b023b84d6..5c223bc6557b 100644 --- a/tests/sumo/rail/reversal/double_reversal_dwEnd/railsignalvehs.sumo +++ b/tests/sumo/rail/reversal/double_reversal_dwEnd/railsignalvehs.sumo @@ -1,41 +1,86 @@ - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/tests/sumo/rail/reversal/reversal_after_common_block/railsignalvehs.sumo b/tests/sumo/rail/reversal/reversal_after_common_block/railsignalvehs.sumo index e0269f8a861f..3f95e5766cf6 100644 --- a/tests/sumo/rail/reversal/reversal_after_common_block/railsignalvehs.sumo +++ b/tests/sumo/rail/reversal/reversal_after_common_block/railsignalvehs.sumo @@ -1,107 +1,150 @@ - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/tests/sumo/rail/reversal/subdriveway_reversal/railsignalvehs.sumo b/tests/sumo/rail/reversal/subdriveway_reversal/railsignalvehs.sumo index 6b33b1a84ac1..f47346c382d9 100644 --- a/tests/sumo/rail/reversal/subdriveway_reversal/railsignalvehs.sumo +++ b/tests/sumo/rail/reversal/subdriveway_reversal/railsignalvehs.sumo @@ -1,62 +1,105 @@ - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/tests/sumo/rail/reversal/two_double_reversals/railsignalvehs.sumo b/tests/sumo/rail/reversal/two_double_reversals/railsignalvehs.sumo index 405b09b49e7e..2470aafb9a66 100644 --- a/tests/sumo/rail/reversal/two_double_reversals/railsignalvehs.sumo +++ b/tests/sumo/rail/reversal/two_double_reversals/railsignalvehs.sumo @@ -1,58 +1,101 @@ - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + From ce2c48e1a8795cb4e843c3bc95793d6bde328212 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 16 Oct 2024 09:05:28 +0200 Subject: [PATCH 323/334] extended state test refs #21, #7578 --- tests/complex/config.complex | 8 ++ .../rail/save_rail_signal2/errors.complex | 3 +- .../rail/save_rail_signal2/options.complex | 7 ++ .../railsignalblocks.complex | 80 +++++++++++++++++++ .../railsignalblocks2.complex | 79 ++++++++++++++++++ .../save_rail_signal2/railsignalvehs.complex | 68 ++++++++++++++++ .../save_rail_signal2/railsignalvehs2.complex | 55 +++++++++++++ 7 files changed, 298 insertions(+), 2 deletions(-) create mode 100644 tests/complex/state/rail/save_rail_signal2/railsignalblocks.complex create mode 100644 tests/complex/state/rail/save_rail_signal2/railsignalblocks2.complex create mode 100644 tests/complex/state/rail/save_rail_signal2/railsignalvehs.complex create mode 100644 tests/complex/state/rail/save_rail_signal2/railsignalvehs2.complex diff --git a/tests/complex/config.complex b/tests/complex/config.complex index c8b8873381ab..74144aaf03ec 100644 --- a/tests/complex/config.complex +++ b/tests/complex/config.complex @@ -89,6 +89,10 @@ gtfs_additional:gtfs_pt_stops.add.xml vtypes:vtypes.xml cfg:config.sumocfg aggregated:aggregated.xml +railsignalblocks:railsignal_blocks.xml +railsignalvehs:railsignal_vehicles.xml +railsignalblocks2:railsignal_blocks2.xml +railsignalvehs2:railsignal_vehicles2.xml [run_dependent_text] output: @@ -154,6 +158,10 @@ detector: toc: toc2: tocs: +railsignalblocks: +railsignalvehs: +railsignalblocks2: +railsignalvehs2: errors:Die Adresse wird bereits verwendet{REPLACE Address already in use} errors:Leaked object at errors:*** 9 leaks found diff --git a/tests/complex/state/rail/save_rail_signal2/errors.complex b/tests/complex/state/rail/save_rail_signal2/errors.complex index afa40a1db9a4..1becacb4b637 100644 --- a/tests/complex/state/rail/save_rail_signal2/errors.complex +++ b/tests/complex/state/rail/save_rail_signal2/errors.complex @@ -1,2 +1 @@ -Warning: Teleporting vehicle 'train'; collision with vehicle 'train2', lane='-c_0', gap=-1.00, time=23.00 stage=move. -Warning: Vehicle 'train' ends teleporting on edge 'd', time=23.00. +Warning: Vehicle 'train'; collision with vehicle 'train2', lane='-c_0', gap=-1.00, time=23.00 stage=move. diff --git a/tests/complex/state/rail/save_rail_signal2/options.complex b/tests/complex/state/rail/save_rail_signal2/options.complex index a68cceab9dac..30d70cc6dfc1 100644 --- a/tests/complex/state/rail/save_rail_signal2/options.complex +++ b/tests/complex/state/rail/save_rail_signal2/options.complex @@ -3,8 +3,15 @@ --save-state.times 20 --save-state.files state.xml --default.speeddev 0 +--railsignal-block-output railsignal_blocks.xml +--railsignal-vehicle-output railsignal_vehicles.xml : --no-step-log --no-duration-log -v --net-file=net.net.xml --load-state state.xml --default.speeddev 0 +--collision.action warn +--railsignal-block-output railsignal_blocks2.xml +--railsignal-vehicle-output railsignal_vehicles2.xml + +--compare railsignal_blocks,railsignal_vehicles tests/complex/state/runner.py diff --git a/tests/complex/state/rail/save_rail_signal2/railsignalblocks.complex b/tests/complex/state/rail/save_rail_signal2/railsignalblocks.complex new file mode 100644 index 000000000000..c928f8a12af9 --- /dev/null +++ b/tests/complex/state/rail/save_rail_signal2/railsignalblocks.complex @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/complex/state/rail/save_rail_signal2/railsignalblocks2.complex b/tests/complex/state/rail/save_rail_signal2/railsignalblocks2.complex new file mode 100644 index 000000000000..3f1bc633c024 --- /dev/null +++ b/tests/complex/state/rail/save_rail_signal2/railsignalblocks2.complex @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/complex/state/rail/save_rail_signal2/railsignalvehs.complex b/tests/complex/state/rail/save_rail_signal2/railsignalvehs.complex new file mode 100644 index 000000000000..7db1aabd2135 --- /dev/null +++ b/tests/complex/state/rail/save_rail_signal2/railsignalvehs.complex @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/complex/state/rail/save_rail_signal2/railsignalvehs2.complex b/tests/complex/state/rail/save_rail_signal2/railsignalvehs2.complex new file mode 100644 index 000000000000..53edf1606d96 --- /dev/null +++ b/tests/complex/state/rail/save_rail_signal2/railsignalvehs2.complex @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 448447256f454993f087ddb04f3989c1fec8ddba Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 16 Oct 2024 10:26:00 +0200 Subject: [PATCH 324/334] working on saving and loading driveway state. refs #7578 --- data/xsd/state_file.xsd | 8 ++ src/microsim/MSStateHandler.cpp | 6 ++ src/microsim/traffic_lights/MSDriveWay.cpp | 82 ++++++++++++++++++- src/microsim/traffic_lights/MSDriveWay.h | 13 ++- .../traffic_lights/MSTLLogicControl.cpp | 2 + src/utils/xml/SUMOXMLDefinitions.cpp | 3 + src/utils/xml/SUMOXMLDefinitions.h | 4 + 7 files changed, 114 insertions(+), 4 deletions(-) diff --git a/data/xsd/state_file.xsd b/data/xsd/state_file.xsd index 60df487c4444..b9c9f1bc77c5 100644 --- a/data/xsd/state_file.xsd +++ b/data/xsd/state_file.xsd @@ -23,6 +23,8 @@ + + @@ -232,4 +234,10 @@ + + + + + + diff --git a/src/microsim/MSStateHandler.cpp b/src/microsim/MSStateHandler.cpp index 96e4e2a082d1..c5b04ee895b4 100644 --- a/src/microsim/MSStateHandler.cpp +++ b/src/microsim/MSStateHandler.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -335,6 +336,11 @@ MSStateHandler::myStartElement(int element, const SUMOSAXAttributes& attrs) { MSRailSignalConstraint_Predecessor::loadState(attrs); break; } + case SUMO_TAG_DRIVEWAY: + case SUMO_TAG_SUBDRIVEWAY: { + MSDriveWay::loadState(attrs, element); + break; + } case SUMO_TAG_PARAM: { bool ok; const std::string key = attrs.get(SUMO_ATTR_KEY, nullptr, ok); diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 3d69c5404a08..24404abfbcd2 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -75,6 +75,8 @@ std::map > MSDriveWay::myReversalDriveWa std::map > MSDriveWay::myDepartureDriveways; std::map > MSDriveWay::myDepartureDrivewaysEnds; std::map > MSDriveWay::myEndingDriveways; +std::map MSDriveWay::myDriveWayRouteLookup; +std::map MSDriveWay::myDriveWayLookup; // --------------------------------------------------------------------------- // static initialisation methods @@ -728,7 +730,7 @@ MSDriveWay::forwardRouteConflict(std::set forward, const MSDriveW void MSDriveWay::writeBlocks(OutputDevice& od) const { - od.openTag(myIsSubDriveway ? "subDriveWay" : "driveWay"); + od.openTag(myIsSubDriveway ? SUMO_TAG_SUBDRIVEWAY : SUMO_TAG_DRIVEWAY); od.writeAttr(SUMO_ATTR_ID, myID); od.writeAttr(SUMO_ATTR_VEHICLE, myFirstVehicle); od.writeAttr(SUMO_ATTR_EDGES, toString(myRoute)); @@ -1852,4 +1854,82 @@ MSDriveWay::writeDepatureBlocks(OutputDevice& od, bool writeVehicles) { } } +void +MSDriveWay::saveState(OutputDevice& out) { + // all driveways are in myEndingDriveways which makes it convenient + for (auto item : myEndingDriveways) { + for (MSDriveWay* dw : item.second) { + dw->_saveState(out); + for (MSDriveWay* sub : dw->mySubDriveWays) { + sub->_saveState(out); + } + } + } +} + +void +MSDriveWay::_saveState(OutputDevice& out) const { + if (!myTrains.empty()) { + out.openTag(myIsSubDriveway ? SUMO_TAG_SUBDRIVEWAY : SUMO_TAG_DRIVEWAY); + out.writeAttr(SUMO_ATTR_ID, getID()); + out.writeAttr(SUMO_ATTR_EDGES, toString(myRoute)); + out.writeAttr(SUMO_ATTR_VEHICLES, toString(myTrains)); + out.closeTag(); + } +} + +void +MSDriveWay::loadState(const SUMOSAXAttributes& attrs, int tag) { + if ((int)myDriveWayRouteLookup.size() < myGlobalDriveWayIndex) { + for (auto item : myEndingDriveways) { + for (MSDriveWay* dw : item.second) { + myDriveWayRouteLookup[dw->myRoute] = dw; + } + } + } + MSVehicleControl& c = MSNet::getInstance()->getVehicleControl(); + bool ok; + const std::string id = attrs.get(SUMO_ATTR_ID, nullptr, ok); + const std::string edges = attrs.get(SUMO_ATTR_EDGES, id.c_str(), ok); + ConstMSEdgeVector route; + if (attrs.hasAttribute(SUMO_ATTR_EDGES)) { + MSEdge::parseEdgesList(edges, route, id); + } + MSDriveWay* dw = nullptr; + if (tag == SUMO_TAG_DRIVEWAY) { + auto it = myDriveWayRouteLookup.find(route); + if (it == myDriveWayRouteLookup.end()) { + throw ProcessError(TLF("Unknown driveWay '%' with route '%'", id, edges)); + } + dw = it->second; + myDriveWayLookup[id] = dw; + } else { + std::string parentID = id.substr(0, id.rfind('.')); + auto it = myDriveWayLookup.find(parentID); + if (it == myDriveWayLookup.end()) { + throw ProcessError(TLF("Unknown parent driveway '%' for subDriveWay '%'", parentID, id)); + } + MSDriveWay* parent = it->second; + for (MSDriveWay* sub : parent->mySubDriveWays) { + if (sub->myRoute == route) { + dw = sub; + break; + } + } + if (dw == nullptr) { + throw ProcessError(TLF("Unknown subDriveWay '%' with route '%' at parent '%'", id, edges, parent->getID())); + } + } + const std::string vehicles = attrs.get(SUMO_ATTR_VEHICLES, id.c_str(), ok); + for (const std::string& vehID : StringTokenizer(vehicles).getVector()) { + MSBaseVehicle* veh = dynamic_cast(c.getVehicle(vehID)); + if (veh == nullptr) { + throw ProcessError(TLF("Unknown vehicle '%' in driveway '%'", vehID, id)); + } + dw->myTrains.insert(veh); + veh->addReminder(dw); + } +} + + /****************************************************************************/ diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h index 0e5bd80f2000..593eeeb62d50 100644 --- a/src/microsim/traffic_lights/MSDriveWay.h +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -22,6 +22,7 @@ #include #include +#include // =========================================================================== // class declarations @@ -173,10 +174,12 @@ class MSDriveWay : public MSMoveReminder, public Named { static const MSDriveWay* getDepartureDriveway(const SUMOVehicle* veh); - static void updateDepartDriveway(const MSEdge* first, int dwID); - static void writeDepatureBlocks(OutputDevice& od, bool writeVehicles); + /** @brief Save driveway occupancy into the given stream */ + static void saveState(OutputDevice& out); + static void loadState(const SUMOSAXAttributes& attrs, int tag); + protected: /// @brief global driveway index @@ -297,7 +300,7 @@ class MSDriveWay : public MSMoveReminder, public Named { static bool isSwitch(const MSLink* link); - void cleanupPointersToSelf(const std::vector others); + void _saveState(OutputDevice& out) const; /// @brief return logicID_linkIndex static std::string getTLLinkID(const MSLink* link); @@ -358,6 +361,10 @@ class MSDriveWay : public MSMoveReminder, public Named { /// @brief all driveways that end on the given edge static std::map > myEndingDriveways; + /// @brief lookup table for state loading + static std::map myDriveWayRouteLookup; + static std::map myDriveWayLookup; + }; diff --git a/src/microsim/traffic_lights/MSTLLogicControl.cpp b/src/microsim/traffic_lights/MSTLLogicControl.cpp index a2eb7bbbe305..975dc771ba3f 100644 --- a/src/microsim/traffic_lights/MSTLLogicControl.cpp +++ b/src/microsim/traffic_lights/MSTLLogicControl.cpp @@ -34,6 +34,7 @@ #include "MSTLLogicControl.h" #include "MSOffTrafficLightLogic.h" #include "MSRailSignalConstraint.h" +#include "MSDriveWay.h" #include #include #include @@ -836,6 +837,7 @@ MSTLLogicControl::saveState(OutputDevice& out) { for (const auto& logic : myLogics) { logic.second->saveState(out); } + MSDriveWay::saveState(out); } diff --git a/src/utils/xml/SUMOXMLDefinitions.cpp b/src/utils/xml/SUMOXMLDefinitions.cpp index d4888c3ad90a..e3c8b7e351b1 100644 --- a/src/utils/xml/SUMOXMLDefinitions.cpp +++ b/src/utils/xml/SUMOXMLDefinitions.cpp @@ -159,6 +159,8 @@ StringBijection::Entry SUMOXMLDefinitions::tags[] = { { "bidiPredecessor", SUMO_TAG_BIDI_PREDECESSOR }, { "railSignalConstraintTracker", SUMO_TAG_RAILSIGNAL_CONSTRAINT_TRACKER }, { "deadlock", SUMO_TAG_DEADLOCK }, + { "driveWay", SUMO_TAG_DRIVEWAY }, + { "subDriveWay", SUMO_TAG_SUBDRIVEWAY }, { "link", SUMO_TAG_LINK }, { "approaching", SUMO_TAG_APPROACHING }, // OSM @@ -1002,6 +1004,7 @@ StringBijection::Entry SUMOXMLDefinitions::attrs[] = { { "arrivalTimeBraking", SUMO_ATTR_ARRIVALTIMEBRAKING }, { "arrivalSpeedBraking", SUMO_ATTR_ARRIVALSPEEDBRAKING }, { "optional", SUMO_ATTR_OPTIONAL }, + { "vehicles", SUMO_ATTR_VEHICLES }, #ifndef WIN32 { "commandPosix", SUMO_ATTR_COMMAND }, diff --git a/src/utils/xml/SUMOXMLDefinitions.h b/src/utils/xml/SUMOXMLDefinitions.h index 162c4ff54b23..0b23ed1c8fca 100644 --- a/src/utils/xml/SUMOXMLDefinitions.h +++ b/src/utils/xml/SUMOXMLDefinitions.h @@ -281,6 +281,9 @@ enum SumoXMLTag { SUMO_TAG_RAILSIGNAL_CONSTRAINT_TRACKER, /// @brief Saved deadlock information, also for loading as an extra check SUMO_TAG_DEADLOCK, + /// @brief Saved driveway information + SUMO_TAG_DRIVEWAY, + SUMO_TAG_SUBDRIVEWAY, /// @brief Link information for state-saving SUMO_TAG_LINK, /// @brief Link-approaching vehicle information for state-saving @@ -1378,6 +1381,7 @@ enum SumoXMLAttr { SUMO_ATTR_ARRIVALTIMEBRAKING, SUMO_ATTR_ARRIVALSPEEDBRAKING, SUMO_ATTR_OPTIONAL, + SUMO_ATTR_VEHICLES, /// @name ActivityGen Tags /// @{ From 312159a30315d247ecaef755353306da710b72bb Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 16 Oct 2024 10:26:08 +0200 Subject: [PATCH 325/334] patching expected results refs #21, #7578 --- .../rail/save_on_rail_signal/state.complex | 14 ++-- .../state/rail/save_rail_signal/state.complex | 5 +- .../rail/save_rail_signal2/errors.complex | 1 - .../rail/save_rail_signal2/output.complex | 68 +++++++++++++++++-- .../save_rail_signal2/railsignalvehs2.complex | 22 +++--- .../rail/save_rail_signal2/state.complex | 9 ++- .../state.complex | 5 +- 7 files changed, 97 insertions(+), 27 deletions(-) diff --git a/tests/complex/state/rail/save_on_rail_signal/state.complex b/tests/complex/state/rail/save_on_rail_signal/state.complex index c146c37605c4..3e19d4f25f2d 100644 --- a/tests/complex/state/rail/save_on_rail_signal/state.complex +++ b/tests/complex/state/rail/save_on_rail_signal/state.complex @@ -1,6 +1,6 @@ - - + - + - + @@ -43,20 +43,18 @@ - - - + - + diff --git a/tests/complex/state/rail/save_rail_signal/state.complex b/tests/complex/state/rail/save_rail_signal/state.complex index 071ef088d865..d2311820d795 100644 --- a/tests/complex/state/rail/save_rail_signal/state.complex +++ b/tests/complex/state/rail/save_rail_signal/state.complex @@ -1,6 +1,6 @@ - - + @@ -38,4 +38,5 @@ + diff --git a/tests/complex/state/rail/save_rail_signal2/errors.complex b/tests/complex/state/rail/save_rail_signal2/errors.complex index 1becacb4b637..e69de29bb2d1 100644 --- a/tests/complex/state/rail/save_rail_signal2/errors.complex +++ b/tests/complex/state/rail/save_rail_signal2/errors.complex @@ -1 +0,0 @@ -Warning: Vehicle 'train'; collision with vehicle 'train2', lane='-c_0', gap=-1.00, time=23.00 stage=move. diff --git a/tests/complex/state/rail/save_rail_signal2/output.complex b/tests/complex/state/rail/save_rail_signal2/output.complex index 97568589ef4d..50aef873001a 100644 --- a/tests/complex/state/rail/save_rail_signal2/output.complex +++ b/tests/complex/state/rail/save_rail_signal2/output.complex @@ -1,11 +1,71 @@ -Loading net-file from 'net.net.xml' ... done (1ms). +Loading net-file from 'net.net.xml' ... done (0ms). Loading done. -Simulation version v1_20_0+0681-187b28facee started with time: 0.00. +Simulation version v1_20_0+0687-ce2c48e1a87 started with time: 0.00. Simulation ended at time: 54.00 Reason: All vehicles have left the simulation. Loading net-file from 'net.net.xml' ... done (0ms). Loading state from 'state.xml' ... done (6ms). Loading done. -Simulation version v1_20_0+0681-187b28facee started with time: 20.00. -Simulation ended at time: 48.00 +Simulation version v1_20_0+0687-ce2c48e1a87 started with time: 20.00. +Simulation ended at time: 54.00 Reason: All vehicles have left the simulation. +< +> +< +> +< +> +< +> +< +> +< +> +< +> +< +> +< +> +< +> +< +> +< +> +< +> +< +> +< +> +< +> +< +> +< +> +< +> +< +> +< +> +< +> +< +> +< +> +< +> +< +> +< +> +< +< +< +< +< +< diff --git a/tests/complex/state/rail/save_rail_signal2/railsignalvehs2.complex b/tests/complex/state/rail/save_rail_signal2/railsignalvehs2.complex index 53edf1606d96..a295d7b85684 100644 --- a/tests/complex/state/rail/save_rail_signal2/railsignalvehs2.complex +++ b/tests/complex/state/rail/save_rail_signal2/railsignalvehs2.complex @@ -1,6 +1,6 @@ - - + @@ -50,4 +52,7 @@ + + + diff --git a/tests/complex/state/rail/save_rail_signal_approach_steplength/state.complex b/tests/complex/state/rail/save_rail_signal_approach_steplength/state.complex index 0bc033b8fc66..f775d7f6eb1e 100644 --- a/tests/complex/state/rail/save_rail_signal_approach_steplength/state.complex +++ b/tests/complex/state/rail/save_rail_signal_approach_steplength/state.complex @@ -1,6 +1,6 @@ - - + @@ -47,4 +47,5 @@ + From 98d621e1ae2dceb0bf6a55d986d9e12a1ee14bd5 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 16 Oct 2024 10:59:29 +0200 Subject: [PATCH 326/334] now initializing driveways on state loading if the network has no rail signals. refs #7578 --- data/xsd/state_file.xsd | 1 + src/microsim/MSStateHandler.cpp | 7 +++++++ src/utils/xml/SUMOXMLDefinitions.cpp | 1 + src/utils/xml/SUMOXMLDefinitions.h | 1 + 4 files changed, 10 insertions(+) diff --git a/data/xsd/state_file.xsd b/data/xsd/state_file.xsd index b9c9f1bc77c5..16bc3005b578 100644 --- a/data/xsd/state_file.xsd +++ b/data/xsd/state_file.xsd @@ -30,6 +30,7 @@ + diff --git a/src/microsim/MSStateHandler.cpp b/src/microsim/MSStateHandler.cpp index c5b04ee895b4..7b0c329c73ee 100644 --- a/src/microsim/MSStateHandler.cpp +++ b/src/microsim/MSStateHandler.cpp @@ -136,6 +136,9 @@ MSStateHandler::saveState(const std::string& file, SUMOTime step, bool usePrefix if (OptionsCont::getOptions().getBool("save-state.constraints")) { out.writeAttr(SUMO_ATTR_CONSTRAINTS, true); } + if (MSDriveWay::haveDriveWays()) { + out.writeAttr(SUMO_ATTR_RAIL, true); + } if (OptionsCont::getOptions().getBool("save-state.rng")) { saveRNGs(out); if (!MSGlobals::gUseMesoSim) { @@ -189,6 +192,10 @@ MSStateHandler::myStartElement(int element, const SUMOSAXAttributes& attrs) { if (attrs.getOpt(SUMO_ATTR_CONSTRAINTS, nullptr, ok, false)) { MSRailSignalConstraint::clearAll(); } + if (attrs.getOpt(SUMO_ATTR_RAIL, nullptr, ok, false)) { + // init before loading any vehicles to ensure that driveways are built early + MSRailSignalControl::getInstance(); + } break; } case SUMO_TAG_RNGSTATE: { diff --git a/src/utils/xml/SUMOXMLDefinitions.cpp b/src/utils/xml/SUMOXMLDefinitions.cpp index e3c8b7e351b1..6e7a68cf41be 100644 --- a/src/utils/xml/SUMOXMLDefinitions.cpp +++ b/src/utils/xml/SUMOXMLDefinitions.cpp @@ -826,6 +826,7 @@ StringBijection::Entry SUMOXMLDefinitions::attrs[] = { { "next", SUMO_ATTR_NEXT }, { "foes", SUMO_ATTR_FOES }, { "constraints", SUMO_ATTR_CONSTRAINTS }, + { "rail", SUMO_ATTR_RAIL }, { "detectors", SUMO_ATTR_DETECTORS }, { "conditions", SUMO_ATTR_CONDITIONS }, { "saveDetectors", SUMO_ATTR_SAVE_DETECTORS }, diff --git a/src/utils/xml/SUMOXMLDefinitions.h b/src/utils/xml/SUMOXMLDefinitions.h index 0b23ed1c8fca..31fe46e01198 100644 --- a/src/utils/xml/SUMOXMLDefinitions.h +++ b/src/utils/xml/SUMOXMLDefinitions.h @@ -1196,6 +1196,7 @@ enum SumoXMLAttr { SUMO_ATTR_FOES, /// @} SUMO_ATTR_CONSTRAINTS, + SUMO_ATTR_RAIL, SUMO_ATTR_DETECTORS, SUMO_ATTR_CONDITIONS, From 822de6bf232dd5042662ef991a705bda32e461c0 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 16 Oct 2024 11:00:17 +0200 Subject: [PATCH 327/334] patching expected results refs #21, #7578 --- tests/complex/state/rail/rail_furtherLane/state.complex | 5 +++-- tests/complex/state/rail/save_on_rail_signal/state.complex | 4 ++-- tests/complex/state/rail/save_rail_signal/state.complex | 4 ++-- tests/complex/state/rail/save_rail_signal2/state.complex | 4 ++-- .../rail/save_rail_signal_approach_steplength/state.complex | 4 ++-- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/tests/complex/state/rail/rail_furtherLane/state.complex b/tests/complex/state/rail/rail_furtherLane/state.complex index 2c4dd6543714..962dc4df317a 100644 --- a/tests/complex/state/rail/rail_furtherLane/state.complex +++ b/tests/complex/state/rail/rail_furtherLane/state.complex @@ -1,6 +1,6 @@ - - + @@ -34,4 +34,5 @@ + diff --git a/tests/complex/state/rail/save_on_rail_signal/state.complex b/tests/complex/state/rail/save_on_rail_signal/state.complex index 3e19d4f25f2d..1efa89845983 100644 --- a/tests/complex/state/rail/save_on_rail_signal/state.complex +++ b/tests/complex/state/rail/save_on_rail_signal/state.complex @@ -1,6 +1,6 @@ - - + diff --git a/tests/complex/state/rail/save_rail_signal/state.complex b/tests/complex/state/rail/save_rail_signal/state.complex index d2311820d795..2e68920d2d99 100644 --- a/tests/complex/state/rail/save_rail_signal/state.complex +++ b/tests/complex/state/rail/save_rail_signal/state.complex @@ -1,6 +1,6 @@ - - + diff --git a/tests/complex/state/rail/save_rail_signal2/state.complex b/tests/complex/state/rail/save_rail_signal2/state.complex index 5a74b935f98d..0721bb1e896e 100644 --- a/tests/complex/state/rail/save_rail_signal2/state.complex +++ b/tests/complex/state/rail/save_rail_signal2/state.complex @@ -1,6 +1,6 @@ - - + diff --git a/tests/complex/state/rail/save_rail_signal_approach_steplength/state.complex b/tests/complex/state/rail/save_rail_signal_approach_steplength/state.complex index f775d7f6eb1e..2db4120cd79c 100644 --- a/tests/complex/state/rail/save_rail_signal_approach_steplength/state.complex +++ b/tests/complex/state/rail/save_rail_signal_approach_steplength/state.complex @@ -1,6 +1,6 @@ - - + From 2d1bd647a72067f0817ae9b44a02316a22dea4d6 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 16 Oct 2024 11:04:51 +0200 Subject: [PATCH 328/334] can ignore missing subdriveway during state loading. refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 24404abfbcd2..f2adee2abe37 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -1917,7 +1917,9 @@ MSDriveWay::loadState(const SUMOSAXAttributes& attrs, int tag) { } } if (dw == nullptr) { - throw ProcessError(TLF("Unknown subDriveWay '%' with route '%' at parent '%'", id, edges, parent->getID())); + // missing subdriveways can be ignored. They may have been created + // as foes for driveways that are not relevant at state loading time + return; } } const std::string vehicles = attrs.get(SUMO_ATTR_VEHICLES, id.c_str(), ok); From 88443d7c46267fbb33a4d7b56e5ea12b6d24a1ea Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 16 Oct 2024 11:04:55 +0200 Subject: [PATCH 329/334] patching expected results refs #21, #7578 --- .../output.complex | 22 ++++++++++--------- .../save_rail_signal_constraint/state.complex | 15 ++++++++----- .../state2.complex | 6 +++-- .../tripinfo.complex | 16 ++++---------- .../tripinfo2.complex | 6 ++--- .../output.complex | 22 ++++++++++--------- .../state.complex | 15 ++++++++----- .../state2.complex | 14 +++++++----- .../tripinfo.complex | 21 ++++++------------ .../tripinfo2.complex | 9 +++++--- 10 files changed, 74 insertions(+), 72 deletions(-) diff --git a/tests/complex/state/rail/save_rail_signal_constraint/output.complex b/tests/complex/state/rail/save_rail_signal_constraint/output.complex index f0befd830805..9b7e8e319b44 100644 --- a/tests/complex/state/rail/save_rail_signal_constraint/output.complex +++ b/tests/complex/state/rail/save_rail_signal_constraint/output.complex @@ -1,17 +1,19 @@ Loading net-file from 'net.net.xml' ... done (1ms). -Loading additional-files from 'input_additional.add.xml' ... done (16ms). -Loading additional-files from 'input_additional2.add.xml' ... done (13ms). +Loading additional-files from 'input_additional.add.xml' ... done (5ms). +Loading additional-files from 'input_additional2.add.xml' ... done (5ms). Loading done. -Simulation version v1_14_1+1638-3dfb534e134 started with time: 0.00. -Simulation ended at time: 260.00 +Simulation version v1_20_0+0691-822de6bf232 started with time: 0.00. +Simulation ended at time: 269.00 Reason: All vehicles have left the simulation. -DijkstraRouter answered 5 queries and explored 2.00 edges on average. +DijkstraRouter answered 6 queries and explored 2.17 edges on average. DijkstraRouter spent 0.00s answering queries (0.00ms on average). Loading net-file from 'net.net.xml' ... done (1ms). -Loading additional-files from 'input_additional.add.xml' ... done (14ms). -Loading additional-files from 'input_additional2.add.xml' ... done (14ms). -Loading state from 'state.xml' ... done (17ms). +Loading additional-files from 'input_additional.add.xml' ... done (5ms). +Loading additional-files from 'input_additional2.add.xml' ... done (5ms). +Loading state from 'state.xml' ... done (6ms). Loading done. -Simulation version v1_14_1+1638-3dfb534e134 started with time: 60.00. -Simulation ended at time: 260.00 +Simulation version v1_20_0+0691-822de6bf232 started with time: 60.00. +Simulation ended at time: 269.00 Reason: All vehicles have left the simulation. +DijkstraRouter answered 1 queries and explored 3.00 edges on average. +DijkstraRouter spent 0.00s answering queries (0.00ms on average). diff --git a/tests/complex/state/rail/save_rail_signal_constraint/state.complex b/tests/complex/state/rail/save_rail_signal_constraint/state.complex index 861e2d3bb8bb..842398d73f3b 100644 --- a/tests/complex/state/rail/save_rail_signal_constraint/state.complex +++ b/tests/complex/state/rail/save_rail_signal_constraint/state.complex @@ -1,6 +1,6 @@ - - + - + - + - + @@ -49,8 +49,11 @@ - + + + + diff --git a/tests/complex/state/rail/save_rail_signal_constraint/state2.complex b/tests/complex/state/rail/save_rail_signal_constraint/state2.complex index 411c3783faa1..81d8244359d9 100644 --- a/tests/complex/state/rail/save_rail_signal_constraint/state2.complex +++ b/tests/complex/state/rail/save_rail_signal_constraint/state2.complex @@ -1,6 +1,6 @@ - - + @@ -59,4 +59,6 @@ + + diff --git a/tests/complex/state/rail/save_rail_signal_constraint/tripinfo.complex b/tests/complex/state/rail/save_rail_signal_constraint/tripinfo.complex index ab57916bae70..4feebd3c32b5 100644 --- a/tests/complex/state/rail/save_rail_signal_constraint/tripinfo.complex +++ b/tests/complex/state/rail/save_rail_signal_constraint/tripinfo.complex @@ -1,11 +1,6 @@ - - - + + diff --git a/tests/complex/state/rail/save_rail_signal_constraint_include/output.complex b/tests/complex/state/rail/save_rail_signal_constraint_include/output.complex index 0019cb7c583f..b3a1d47693b9 100644 --- a/tests/complex/state/rail/save_rail_signal_constraint_include/output.complex +++ b/tests/complex/state/rail/save_rail_signal_constraint_include/output.complex @@ -1,16 +1,18 @@ -Loading net-file from 'net.net.xml' ... done (1ms). -Loading additional-files from 'input_additional.add.xml' ... done (13ms). -Loading additional-files from 'input_additional2.add.xml' ... done (13ms). +Loading net-file from 'net.net.xml' ... done (0ms). +Loading additional-files from 'input_additional.add.xml' ... done (5ms). +Loading additional-files from 'input_additional2.add.xml' ... done (5ms). Loading done. -Simulation version v1_14_1+1638-3dfb534e134 started with time: 0.00. -Simulation ended at time: 260.00 +Simulation version v1_20_0+0691-822de6bf232 started with time: 0.00. +Simulation ended at time: 269.00 Reason: All vehicles have left the simulation. -DijkstraRouter answered 5 queries and explored 2.00 edges on average. +DijkstraRouter answered 6 queries and explored 2.17 edges on average. DijkstraRouter spent 0.00s answering queries (0.00ms on average). Loading net-file from 'net.net.xml' ... done (0ms). -Loading additional-files from 'input_additional.add.xml' ... done (13ms). -Loading state from 'state.xml' ... done (16ms). +Loading additional-files from 'input_additional.add.xml' ... done (5ms). +Loading state from 'state.xml' ... done (6ms). Loading done. -Simulation version v1_14_1+1638-3dfb534e134 started with time: 60.00. -Simulation ended at time: 260.00 +Simulation version v1_20_0+0691-822de6bf232 started with time: 60.00. +Simulation ended at time: 269.00 Reason: All vehicles have left the simulation. +DijkstraRouter answered 1 queries and explored 3.00 edges on average. +DijkstraRouter spent 0.00s answering queries (0.00ms on average). diff --git a/tests/complex/state/rail/save_rail_signal_constraint_include/state.complex b/tests/complex/state/rail/save_rail_signal_constraint_include/state.complex index 6cd21b65154f..34f5b7360f7d 100644 --- a/tests/complex/state/rail/save_rail_signal_constraint_include/state.complex +++ b/tests/complex/state/rail/save_rail_signal_constraint_include/state.complex @@ -1,6 +1,6 @@ - - + - + - + - + @@ -50,7 +50,7 @@ - + @@ -63,4 +63,7 @@ + + + diff --git a/tests/complex/state/rail/save_rail_signal_constraint_include/state2.complex b/tests/complex/state/rail/save_rail_signal_constraint_include/state2.complex index 45d420d9b310..2aacd207fc67 100644 --- a/tests/complex/state/rail/save_rail_signal_constraint_include/state2.complex +++ b/tests/complex/state/rail/save_rail_signal_constraint_include/state2.complex @@ -1,6 +1,6 @@ - - + - + - + - + @@ -54,7 +54,7 @@ - + @@ -67,4 +67,6 @@ + + diff --git a/tests/complex/state/rail/save_rail_signal_constraint_include/tripinfo.complex b/tests/complex/state/rail/save_rail_signal_constraint_include/tripinfo.complex index ab57916bae70..ecdd8345ef56 100644 --- a/tests/complex/state/rail/save_rail_signal_constraint_include/tripinfo.complex +++ b/tests/complex/state/rail/save_rail_signal_constraint_include/tripinfo.complex @@ -1,11 +1,6 @@ - - - + + From 596c5d4ad10e609c32c7eb31a3e20707777a8f70 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 16 Oct 2024 13:32:12 +0200 Subject: [PATCH 330/334] fixing invalid subDriveWay. refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index f2adee2abe37..31c955692634 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -1549,7 +1549,14 @@ MSDriveWay::buildSubFoe(MSDriveWay* foe, bool movingBlock) { // For movingBlock the logic is changed: // We remove the conflict-free part as before but then keep removing the the conflict part until the // another non-conconflit part is found - + if (myForward.size() < foe->myForward.size() && + myForward == std::vector(foe->myForward.begin(), foe->myForward.begin() + myForward.size())) { +#ifdef DEBUG_BUILD_SUBDRIVEWAY + std::cout << SIMTIME << " buildSubFoe dw=" << getID() << " is subpart of foe=" << foe->getID() << "\n"; +#endif + foe->myFoes.push_back(this); + return true; + } int subLast = myForward.size() - 2; #ifdef DEBUG_BUILD_SUBDRIVEWAY if (subLast < 0) { From 6f580f0efc3ed0561eef9f07896984f61481ae09 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 16 Oct 2024 13:32:16 +0200 Subject: [PATCH 331/334] patching expected results refs #21, #7578 --- .../rail_signal/subDriveWay_short/errors.sumo | 0 .../subDriveWay_short/input_routes.rou.xml | 12 ++ .../rail_signal/subDriveWay_short/net.net.xml | 132 ++++++++++++++++++ .../subDriveWay_short/options.sumo | 2 + .../rail_signal/subDriveWay_short/output.sumo | 0 .../subDriveWay_short/railsignalblocks.sumo | 97 +++++++++++++ .../subDriveWay_short/tripinfos.sumo | 44 ++++++ tests/sumo/rail/rail_signal/testsuite.sumo | 3 + .../railsignalblocks.sumo | 8 +- 9 files changed, 293 insertions(+), 5 deletions(-) create mode 100644 tests/sumo/rail/rail_signal/subDriveWay_short/errors.sumo create mode 100644 tests/sumo/rail/rail_signal/subDriveWay_short/input_routes.rou.xml create mode 100644 tests/sumo/rail/rail_signal/subDriveWay_short/net.net.xml create mode 100644 tests/sumo/rail/rail_signal/subDriveWay_short/options.sumo create mode 100644 tests/sumo/rail/rail_signal/subDriveWay_short/output.sumo create mode 100644 tests/sumo/rail/rail_signal/subDriveWay_short/railsignalblocks.sumo create mode 100644 tests/sumo/rail/rail_signal/subDriveWay_short/tripinfos.sumo diff --git a/tests/sumo/rail/rail_signal/subDriveWay_short/errors.sumo b/tests/sumo/rail/rail_signal/subDriveWay_short/errors.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/subDriveWay_short/input_routes.rou.xml b/tests/sumo/rail/rail_signal/subDriveWay_short/input_routes.rou.xml new file mode 100644 index 000000000000..cf764b02d58e --- /dev/null +++ b/tests/sumo/rail/rail_signal/subDriveWay_short/input_routes.rou.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/subDriveWay_short/net.net.xml b/tests/sumo/rail/rail_signal/subDriveWay_short/net.net.xml new file mode 100644 index 000000000000..ad28908a6639 --- /dev/null +++ b/tests/sumo/rail/rail_signal/subDriveWay_short/net.net.xml @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/subDriveWay_short/options.sumo b/tests/sumo/rail/rail_signal/subDriveWay_short/options.sumo new file mode 100644 index 000000000000..aca2e8d18e45 --- /dev/null +++ b/tests/sumo/rail/rail_signal/subDriveWay_short/options.sumo @@ -0,0 +1,2 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml diff --git a/tests/sumo/rail/rail_signal/subDriveWay_short/output.sumo b/tests/sumo/rail/rail_signal/subDriveWay_short/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/subDriveWay_short/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/subDriveWay_short/railsignalblocks.sumo new file mode 100644 index 000000000000..a632b48d9300 --- /dev/null +++ b/tests/sumo/rail/rail_signal/subDriveWay_short/railsignalblocks.sumo @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/subDriveWay_short/tripinfos.sumo b/tests/sumo/rail/rail_signal/subDriveWay_short/tripinfos.sumo new file mode 100644 index 000000000000..5301ce5b2e84 --- /dev/null +++ b/tests/sumo/rail/rail_signal/subDriveWay_short/tripinfos.sumo @@ -0,0 +1,44 @@ + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/testsuite.sumo b/tests/sumo/rail/rail_signal/testsuite.sumo index 3b8f2508063f..52f082c43dc7 100644 --- a/tests/sumo/rail/rail_signal/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/testsuite.sumo @@ -128,3 +128,6 @@ update_driveways # reduce number of "parallel" driveways driveway_variants + +# corner case that caused a crash +subDriveWay_short diff --git a/tests/sumo/rail/siding/siding_occupied_advance/railsignalblocks.sumo b/tests/sumo/rail/siding/siding_occupied_advance/railsignalblocks.sumo index 3f3a127763fb..70b430af39e6 100644 --- a/tests/sumo/rail/siding/siding_occupied_advance/railsignalblocks.sumo +++ b/tests/sumo/rail/siding/siding_occupied_advance/railsignalblocks.sumo @@ -1,6 +1,6 @@ - + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/driveWayShort_badMatch/net.net.xml b/tests/sumo/rail/rail_signal/driveWayShort_badMatch/net.net.xml new file mode 100644 index 000000000000..ad28908a6639 --- /dev/null +++ b/tests/sumo/rail/rail_signal/driveWayShort_badMatch/net.net.xml @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/driveWayShort_badMatch/options.sumo b/tests/sumo/rail/rail_signal/driveWayShort_badMatch/options.sumo new file mode 100644 index 000000000000..483e6bc2534c --- /dev/null +++ b/tests/sumo/rail/rail_signal/driveWayShort_badMatch/options.sumo @@ -0,0 +1,3 @@ +--no-step-log --no-duration-log --net-file=net.net.xml -r=input_routes.rou.xml +--tripinfo-output tripinfos.xml +--time-to-teleport.remove diff --git a/tests/sumo/rail/rail_signal/driveWayShort_badMatch/output.sumo b/tests/sumo/rail/rail_signal/driveWayShort_badMatch/output.sumo new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/sumo/rail/rail_signal/driveWayShort_badMatch/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/driveWayShort_badMatch/railsignalblocks.sumo new file mode 100644 index 000000000000..51b919f901ee --- /dev/null +++ b/tests/sumo/rail/rail_signal/driveWayShort_badMatch/railsignalblocks.sumo @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/driveWayShort_badMatch/tripinfos.sumo b/tests/sumo/rail/rail_signal/driveWayShort_badMatch/tripinfos.sumo new file mode 100644 index 000000000000..9fde9c748a94 --- /dev/null +++ b/tests/sumo/rail/rail_signal/driveWayShort_badMatch/tripinfos.sumo @@ -0,0 +1,46 @@ + + + + + + + + + diff --git a/tests/sumo/rail/rail_signal/testsuite.sumo b/tests/sumo/rail/rail_signal/testsuite.sumo index 52f082c43dc7..4d99c5bf81b7 100644 --- a/tests/sumo/rail/rail_signal/testsuite.sumo +++ b/tests/sumo/rail/rail_signal/testsuite.sumo @@ -131,3 +131,6 @@ driveway_variants # corner case that caused a crash subDriveWay_short + +# corner case that causes a deadlock between 2 vehicles due to invalid driveway matching +driveWayShort_badMatch From 440cbebe9245c1ee7aea5e77a287a54e4203ce40 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 16 Oct 2024 14:28:23 +0200 Subject: [PATCH 333/334] adopting per-junction index for departDriveWays. refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 6 +++--- src/microsim/traffic_lights/MSDriveWay.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index 31c955692634..c432bfa7a356 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -67,12 +67,12 @@ // static value definitions // =========================================================================== int MSDriveWay::myGlobalDriveWayIndex(0); -int MSDriveWay::myDepartDriveWayIndex(0); int MSDriveWay::myNumWarnings(0); bool MSDriveWay::myWriteVehicles(false); std::map > MSDriveWay::mySwitchDriveWays; std::map > MSDriveWay::myReversalDriveWays; std::map > MSDriveWay::myDepartureDriveways; +std::map MSDriveWay::myDepartDrivewayIndex; std::map > MSDriveWay::myDepartureDrivewaysEnds; std::map > MSDriveWay::myEndingDriveways; std::map MSDriveWay::myDriveWayRouteLookup; @@ -111,12 +111,12 @@ MSDriveWay::~MSDriveWay() { } void MSDriveWay::cleanup() { myGlobalDriveWayIndex = 0; - myDepartDriveWayIndex = 0; myNumWarnings = 0; myWriteVehicles = false; MSDriveWay::mySwitchDriveWays.clear(); MSDriveWay::myReversalDriveWays.clear(); MSDriveWay::myDepartureDriveways.clear(); + MSDriveWay::myDepartDrivewayIndex.clear(); MSDriveWay::myDepartureDrivewaysEnds.clear(); MSDriveWay::myEndingDriveways.clear(); } @@ -1833,7 +1833,7 @@ MSDriveWay::getDepartureDriveway(const SUMOVehicle* veh) { return dw; } } - const std::string id = edge->getFromJunction()->getID() + ".d" + toString(myDepartDriveWayIndex++); + const std::string id = edge->getFromJunction()->getID() + ".d" + toString(myDepartDrivewayIndex[edge->getFromJunction()]++); MSDriveWay* dw = buildDriveWay(id, nullptr, veh->getCurrentRouteEdge(), veh->getRoute().end()); myDepartureDriveways[edge].push_back(dw); myDepartureDrivewaysEnds[&dw->myForward.back()->getEdge()].push_back(dw); diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h index 593eeeb62d50..595996df198e 100644 --- a/src/microsim/traffic_lights/MSDriveWay.h +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -343,7 +343,6 @@ class MSDriveWay : public MSMoveReminder, public Named { std::string myFirstVehicle; static int myGlobalDriveWayIndex; - static int myDepartDriveWayIndex; static int myNumWarnings; static bool myWriteVehicles; @@ -355,6 +354,7 @@ class MSDriveWay : public MSMoveReminder, public Named { /// @brief all driveways that do not start at a rail signal (and are only used at departure) static std::map > myDepartureDriveways; + static std::map myDepartDrivewayIndex; /// @brief all driveways that do not start at a rail signal (and are only used at departure) by end edge static std::map > myDepartureDrivewaysEnds; From aca94090b549feac7c742517adf4a61011fbeb81 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Wed, 16 Oct 2024 14:28:27 +0200 Subject: [PATCH 334/334] patching expected results refs #21, #7578 --- .../alternativeRoute/railsignalblocks.sumo | 51 ++++---- .../railsignalblocks.sumo | 9 +- .../railsignalblocks.sumo | 9 +- .../railsignalblocks.sumo | 7 +- .../railsignalblocks.sumo | 7 +- .../railsignalblocks.sumo | 9 +- .../insertion_at_signal/railsignalblocks.sumo | 9 +- .../railsignalblocks.sumo | 11 +- .../railsignalblocks.sumo | 11 +- .../stopped_at_signal/railsignalblocks.sumo | 7 +- .../stopped_at_signal2/railsignalblocks.sumo | 9 +- .../bugs/ticket11384/railsignalblocks.sumo | 9 +- .../bugs/ticket11440/railsignalblocks.sumo | 9 +- .../bugs/ticket12184/railsignalblocks.sumo | 7 +- .../bugs/ticket12184b/railsignalblocks.sumo | 7 +- .../bugs/ticket12857/railsignalblocks.sumo | 9 +- .../bugs/ticket12858/railsignalblocks.sumo | 7 +- .../bugs/ticket12868/railsignalblocks.sumo | 13 +- .../bugs/ticket12873/railsignalblocks.sumo | 20 +-- .../bugs/ticket13262/railsignalblocks.sumo | 17 +-- .../bugs/ticket7563/railsignalblocks.sumo | 17 +-- .../railsignalblocks.sumo | 11 +- .../frontal_collision/railsignalblocks.sumo | 9 +- .../railsignalblocks.sumo | 9 +- .../railsignalblocks.sumo | 9 +- .../railsignalblocks.sumo | 9 +- .../railsignalblocks.sumo | 9 +- .../crossing_tracks/railsignalblocks.sumo | 7 +- .../circle_3veh/railsignalblocks.sumo | 16 +-- .../deadlocks/loop_4veh/railsignalblocks.sumo | 54 ++++---- .../loop_4veh2/railsignalblocks.sumo | 46 +++---- .../loop_4veh3/railsignalblocks.sumo | 12 +- .../siding_deadlock2/railsignalblocks.sumo | 54 ++++---- .../triangle_6veh/railsignalblocks.sumo | 116 +++++++++--------- .../circle_3veh/railsignalblocks.sumo | 30 ++--- .../loop_4veh/railsignalblocks.sumo | 24 ++-- .../loop_4veh2/railsignalblocks.sumo | 10 +- .../loop_4veh3/railsignalblocks.sumo | 13 +- .../siding_deadlock2/railsignalblocks.sumo | 28 ++--- .../triangle_6veh/railsignalblocks.sumo | 20 +-- .../rail/headonconflict/railsignalblocks.sumo | 7 +- .../rail/interlocking/railsignalblocks.sumo | 17 +-- .../rail/interlocking/railsignalvehs.sumo | 6 +- .../join/railsignalblocks.sumo | 11 +- .../join_RB425/railsignalblocks.sumo | 11 +- .../join_fail_abort/railsignalblocks.sumo | 11 +- .../join_front/railsignalblocks.sumo | 11 +- .../join_front_further/railsignalblocks.sumo | 9 +- .../railsignalblocks.sumo | 11 +- .../railsignalblocks.sumo | 11 +- .../join_front_signal/railsignalblocks.sumo | 7 +- .../join_signal/railsignalblocks.sumo | 7 +- .../join_containers/railsignalblocks.sumo | 11 +- .../join_persons/railsignalblocks.sumo | 11 +- .../conflict_lookahead/railsignalblocks.sumo | 7 +- .../constraints/bidi/railsignalblocks.sumo | 7 +- .../constraints/bidi/railsignalvehs.sumo | 4 +- .../deadlock/railsignalblocks.sumo | 8 +- .../deadlock_insertion3/railsignalblocks.sumo | 8 +- .../railsignalblocks.sumo | 9 +- .../railsignalblocks.sumo | 8 +- .../railsignalblocks.sumo | 9 +- .../deadlock_remove/railsignalblocks.sumo | 9 +- .../deadlock_remove2/railsignalblocks.sumo | 9 +- .../foeInsertion/railsignalblocks.sumo | 7 +- .../constraints/limit2/railsignalblocks.sumo | 7 +- .../constraints/limit3/railsignalblocks.sumo | 7 +- .../wait_for_one/railsignalblocks.sumo | 7 +- .../railsignalblocks.sumo | 7 +- .../wait_for_one_tripId/railsignalblocks.sumo | 7 +- .../wait_for_three/railsignalblocks.sumo | 7 +- .../railsignalblocks.sumo | 7 +- .../wait_not/railsignalblocks.sumo | 7 +- .../deadlock_insertion/railsignalblocks.sumo | 13 +- .../railsignalblocks.sumo | 8 +- .../driveway_variants/railsignalblocks.sumo | 14 +-- .../end_after_bidi/railsignalblocks.sumo | 7 +- .../end_within_bidi/railsignalblocks.sumo | 7 +- .../end_depart_within/railsignalblocks.sumo | 11 +- .../end_within/railsignalblocks.sumo | 9 +- .../guard_insertion/railsignalblocks.sumo | 9 +- .../halting_conflict/railsignalblocks.sumo | 15 +-- .../indirect_guard/railsignalblocks.sumo | 7 +- .../railsignalblocks.sumo | 7 +- .../railsignalblocks.sumo | 11 +- .../railsignalvehs.sumo | 4 +- .../railsignalblocks.sumo | 11 +- .../railsignalblocks.sumo | 11 +- .../railsignalblocks.sumo | 11 +- .../signal_on_next_edge/railsignalblocks.sumo | 9 +- .../wait_for_one/railsignalblocks.sumo | 9 +- .../railsignalblocks.sumo | 9 +- .../protect_bidi/railsignalblocks.sumo | 7 +- .../protect_bidi_option/railsignalblocks.sumo | 5 +- .../railsignalblocks.sumo | 5 +- .../protect_flank_option/railsignalvehs.sumo | 4 +- .../parking_insertion/railsignalblocks.sumo | 7 +- .../parking_insertion/railsignalvehs.sumo | 4 +- .../railsignalblocks.sumo | 9 +- .../stop_before_signal/railsignalblocks.sumo | 7 +- .../waiting_time_bottom/railsignalblocks.sumo | 11 +- .../waiting_time_top/railsignalblocks.sumo | 11 +- .../railsignalblocks.sumo | 18 +-- .../railsignalvehs.sumo | 6 +- .../railsignalblocks.sumo | 11 +- .../small_step_size/railsignalblocks.sumo | 7 +- .../railsignalblocks.sumo | 7 +- .../railsignalblocks.sumo | 7 +- .../railsignalblocks.sumo | 7 +- .../update_driveways/railsignalblocks.sumo | 17 +-- .../update_driveways/railsignalvehs.sumo | 8 +- .../bidiDepart_reversal/railsignalblocks.sumo | 16 +-- .../bidiDepart_reversal/railsignalvehs.sumo | 6 +- .../railsignalblocks.sumo | 22 ++-- .../railsignalblocks.sumo | 6 +- .../railsignalvehs.sumo | 4 +- .../railsignalblocks.sumo | 7 +- .../railsignalblocks.sumo | 7 +- .../railsignalblocks.sumo | 9 +- .../reverse_no_link/railsignalblocks.sumo | 11 +- .../routes_cross_twice/railsignalblocks.sumo | 17 +-- .../railsignalblocks.sumo | 28 ++--- .../railsignalblocks.sumo | 30 ++--- .../railsignalblocks.sumo | 30 ++--- .../railsignalblocks.sumo | 17 +-- .../siding_both_ways/railsignalblocks.sumo | 45 +++---- .../siding_both_ways2/railsignalblocks.sumo | 33 ++--- .../siding_both_ways3/railsignalblocks.sumo | 33 ++--- .../siding_both_ways4/railsignalblocks.sumo | 33 ++--- .../railsignalblocks.sumo | 45 +++---- .../siding_deadlock/railsignalblocks.sumo | 17 +-- .../siding_noSignal/railsignalblocks.sumo | 11 +- .../siding_noSignal2/railsignalblocks.sumo | 13 +- .../railsignalblocks.sumo | 22 ++-- .../tramwayLoop/basic/railsignalblocks.sumo | 9 +- .../track_closed/railsignalblocks.sumo | 8 +- .../two_passing_loops/railsignalblocks.sumo | 19 +-- .../two_passing_loops2/railsignalblocks.sumo | 19 +-- .../uncontrolled_links/railsignalblocks.sumo | 9 +- 139 files changed, 1007 insertions(+), 881 deletions(-) diff --git a/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo b/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo index 4f091a22a2f9..c350ad55a1de 100644 --- a/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo +++ b/tests/sumo/rail/alternativeRoute/railsignalblocks.sumo @@ -1,6 +1,6 @@ -