From 44964b5e4140d9c11ff6a3dd9ebfc382503737db Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 17 Oct 2024 09:05:46 +0200 Subject: [PATCH 1/7] avoid match with too short driveWay. refs #7578 --- src/microsim/traffic_lights/MSDriveWay.cpp | 7 ++++++- src/microsim/traffic_lights/MSDriveWay.h | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/microsim/traffic_lights/MSDriveWay.cpp b/src/microsim/traffic_lights/MSDriveWay.cpp index c432bfa7a35..a5582a23548 100644 --- a/src/microsim/traffic_lights/MSDriveWay.cpp +++ b/src/microsim/traffic_lights/MSDriveWay.cpp @@ -102,6 +102,8 @@ MSDriveWay::MSDriveWay(const MSLink* origin, const std::string& id, bool tempora myFoundSignal(false), myFoundJump(false), myTerminateRoute(false), + myAbortedBuild(false), + myBidiEnded(false), myIsSubDriveway(false) {} @@ -845,6 +847,7 @@ MSDriveWay::buildRoute(const MSLink* origin, double length, " exceeds maximum length (stopped searching after edge '" + toLane->getEdge().getID() + "' (length=" + toString(length) + "m)."); } myNumWarnings++; + myAbortedBuild = true; // length exceeded return; } @@ -934,6 +937,7 @@ MSDriveWay::buildRoute(const MSLink* origin, double length, if (link == origin) { WRITE_WARNINGF(TL("Found circular block after % (% edges, length %)"), warnID, toString(myRoute.size()), toString(length)); //std::cout << getClickableTLLinkID(origin) << " circularBlock2=" << toString(myRoute) << "\n"; + myAbortedBuild = true; return; } seekForwardSignal = false; @@ -981,6 +985,7 @@ MSDriveWay::buildRoute(const MSLink* origin, double length, } } } + myBidiEnded = !seekBidiSwitch; } @@ -1379,7 +1384,7 @@ MSDriveWay::match(MSRouteIterator firstIt, MSRouteIterator endIt) 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 == endIt || myFoundSignal || myFoundJump || myIsSubDriveway)) { + && (itRoute == endIt || myAbortedBuild || myBidiEnded || myFoundJump || myIsSubDriveway)) { //std::cout << " using dw=" << "\n"; if (itRoute != endIt) { // check whether the current route requires an extended driveway diff --git a/src/microsim/traffic_lights/MSDriveWay.h b/src/microsim/traffic_lights/MSDriveWay.h index 595996df198..40c079fcedb 100644 --- a/src/microsim/traffic_lights/MSDriveWay.h +++ b/src/microsim/traffic_lights/MSDriveWay.h @@ -204,6 +204,10 @@ class MSDriveWay : public MSMoveReminder, public Named { bool myFoundSignal; bool myFoundJump; bool myTerminateRoute; + /// @brief whether driveway building was aborted due to MAX_BLOCK_LENGTH + bool myAbortedBuild; + /// @brief whether driveway building was aborted when no further bidi edge was found + bool myBidiEnded; bool myIsSubDriveway; /* @brief the actual driveway part up to the next railsignal (halting position) From 221e8f1b6a18a1689a0443adf8a696da174802d6 Mon Sep 17 00:00:00 2001 From: Jakob Erdmann Date: Thu, 17 Oct 2024 09:05:50 +0200 Subject: [PATCH 2/7] patching expected results refs #21, #7578 --- .../railsignalblocks.sumo | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tests/sumo/rail/rail_signal/driveWayShort_badMatch/railsignalblocks.sumo b/tests/sumo/rail/rail_signal/driveWayShort_badMatch/railsignalblocks.sumo index 3044d0d185e..d4147cfcd0b 100644 --- a/tests/sumo/rail/rail_signal/driveWayShort_badMatch/railsignalblocks.sumo +++ b/tests/sumo/rail/rail_signal/driveWayShort_badMatch/railsignalblocks.sumo @@ -1,6 +1,6 @@ - - + @@ -56,5 +56,5 @@ - + diff --git a/tests/complex/state/rail/save_rail_signal2/output.complex b/tests/complex/state/rail/save_rail_signal2/output.complex index 50aef873001..e445ffad9a9 100644 --- a/tests/complex/state/rail/save_rail_signal2/output.complex +++ b/tests/complex/state/rail/save_rail_signal2/output.complex @@ -1,12 +1,12 @@ Loading net-file from 'net.net.xml' ... done (0ms). Loading done. -Simulation version v1_20_0+0687-ce2c48e1a87 started with time: 0.00. +Simulation version v1_20_0+0703-550959f676a 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+0687-ce2c48e1a87 started with time: 20.00. +Simulation version v1_20_0+0703-550959f676a started with time: 20.00. Simulation ended at time: 54.00 Reason: All vehicles have left the simulation. < @@ -50,10 +50,10 @@ Reason: All vehicles have left the simulation. < > < -> +> < > -< +< > < > diff --git a/tests/complex/state/rail/save_rail_signal2/railsignalblocks.complex b/tests/complex/state/rail/save_rail_signal2/railsignalblocks.complex index c928f8a12af..6d8043f53ac 100644 --- a/tests/complex/state/rail/save_rail_signal2/railsignalblocks.complex +++ b/tests/complex/state/rail/save_rail_signal2/railsignalblocks.complex @@ -1,6 +1,6 @@ - - + @@ -54,5 +54,5 @@ - + 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 9b7e8e319b4..8fb76b69aa0 100644 --- a/tests/complex/state/rail/save_rail_signal_constraint/output.complex +++ b/tests/complex/state/rail/save_rail_signal_constraint/output.complex @@ -1,18 +1,18 @@ -Loading net-file from 'net.net.xml' ... done (1ms). +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_20_0+0691-822de6bf232 started with time: 0.00. +Simulation version v1_20_0+0703-550959f676a started with time: 0.00. Simulation ended at time: 269.00 Reason: All vehicles have left the simulation. -DijkstraRouter answered 6 queries and explored 2.17 edges on average. +DijkstraRouter answered 7 queries and explored 2.00 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 (5ms). -Loading additional-files from 'input_additional2.add.xml' ... done (5ms). +Loading net-file from 'net.net.xml' ... done (0ms). +Loading additional-files from 'input_additional.add.xml' ... done (7ms). +Loading additional-files from 'input_additional2.add.xml' ... done (6ms). Loading state from 'state.xml' ... done (6ms). Loading done. -Simulation version v1_20_0+0691-822de6bf232 started with time: 60.00. +Simulation version v1_20_0+0703-550959f676a 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. 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 842398d73f3..d8c6a27e6fc 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 @@ - - + @@ -53,7 +53,7 @@ - + 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 81d8244359d..7298c130dc5 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,6 +59,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 b3a1d47693b..cfc7c5e51b1 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,17 +1,17 @@ -Loading net-file from 'net.net.xml' ... done (0ms). -Loading additional-files from 'input_additional.add.xml' ... done (5ms). +Loading net-file from 'net.net.xml' ... done (1ms). +Loading additional-files from 'input_additional.add.xml' ... done (6ms). Loading additional-files from 'input_additional2.add.xml' ... done (5ms). Loading done. -Simulation version v1_20_0+0691-822de6bf232 started with time: 0.00. +Simulation version v1_20_0+0703-550959f676a started with time: 0.00. Simulation ended at time: 269.00 Reason: All vehicles have left the simulation. -DijkstraRouter answered 6 queries and explored 2.17 edges on average. +DijkstraRouter answered 7 queries and explored 2.00 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 (5ms). +Loading additional-files from 'input_additional.add.xml' ... done (9ms). Loading state from 'state.xml' ... done (6ms). Loading done. -Simulation version v1_20_0+0691-822de6bf232 started with time: 60.00. +Simulation version v1_20_0+0703-550959f676a 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. 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 34f5b7360f7..7537145c7e4 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 @@ - - + @@ -63,7 +63,7 @@ - +