diff --git a/src/main/java/com/conveyal/r5/profile/FastRaptorWorker.java b/src/main/java/com/conveyal/r5/profile/FastRaptorWorker.java index 0ac37b77f..2a808dadf 100644 --- a/src/main/java/com/conveyal/r5/profile/FastRaptorWorker.java +++ b/src/main/java/com/conveyal/r5/profile/FastRaptorWorker.java @@ -55,12 +55,6 @@ public class FastRaptorWorker { */ public static final int UNREACHED = Integer.MAX_VALUE; - /** - * Minimum time between alighting from one vehicle and boarding another, in seconds. - * TODO make this configurable, and use loop-transfers from transfers.txt. - */ - public static final int BOARD_SLACK_SECONDS = 60; - public static final int SECONDS_PER_MINUTE = 60; /** @@ -70,8 +64,10 @@ public class FastRaptorWorker { private static final int DEPARTURE_STEP_SEC = 60; /** - * Minimum wait for boarding to account for schedule variation. - * FIXME clarify why this is separate from BOARD_SLACK. If it is not, merge the two constants into BOARD_SLACK_SEC. + * To be considered for boarding, a vehicle must depart at least this long after the rider arrives at the stop. + * Intuitively, "leave this long for transfers" to account for schedule variation or other unexpected variations. + * This is separate from BOARD_SLACK_SECONDS used in McRaptor and point-to-point searches, in case someone needs + * to set them independently. */ private static final int MINIMUM_BOARD_WAIT_SEC = 60; diff --git a/src/main/java/com/conveyal/r5/profile/PathWithTimes.java b/src/main/java/com/conveyal/r5/profile/PathWithTimes.java index ba74490cb..f6bfc4ca5 100644 --- a/src/main/java/com/conveyal/r5/profile/PathWithTimes.java +++ b/src/main/java/com/conveyal/r5/profile/PathWithTimes.java @@ -19,6 +19,12 @@ * A path that also includes itineraries and bounds for all possible trips on the paths (even those which may not be optimal) */ public class PathWithTimes extends Path { + /** + * Minimum time between alighting from one vehicle and boarding another, in seconds. + * Appears to be used only in McRaptor and point-to-point searches. + * TODO make this configurable, and use loop-transfers from transfers.txt. + */ + public static final int BOARD_SLACK_SECONDS = 60; /** Stats for the entire path */ public Stats stats; @@ -92,7 +98,7 @@ private void computeTimes (TransportNetwork network, ProfileRequest req, TIntInt // loop over departures within the time window // firstTrip is the trip on the first pattern int firstTrip = 0; - while (times[0][firstTrip][0] < req.fromTime + accessTime + FastRaptorWorker.BOARD_SLACK_SECONDS) firstTrip++; + while (times[0][firstTrip][0] < req.fromTime + accessTime + BOARD_SLACK_SECONDS) firstTrip++; // now interleave times double walkSpeedMillimetersPerSecond = req.walkSpeed * 1000; @@ -137,7 +143,7 @@ private void computeTimes (TransportNetwork network, ProfileRequest req, TIntInt // TODO should board slack be applied at the origin stop? Is this done in RaptorWorker? // See also below in computeStatistics - time = times[patIdx][trip][1] + transferTime + FastRaptorWorker.BOARD_SLACK_SECONDS; + time = times[patIdx][trip][1] + transferTime + BOARD_SLACK_SECONDS; itin.arriveAtBoardStopTimes[patIdx + 1] = time; } } diff --git a/src/main/java/com/conveyal/r5/profile/StatsCalculator.java b/src/main/java/com/conveyal/r5/profile/StatsCalculator.java index 53807e117..43e76b98a 100644 --- a/src/main/java/com/conveyal/r5/profile/StatsCalculator.java +++ b/src/main/java/com/conveyal/r5/profile/StatsCalculator.java @@ -23,7 +23,7 @@ public static StatsCollection computeStatistics (ProfileRequest req, int accessT for (int start = req.fromTime; start < req.toTime; start += 60) { // TODO should board slack be applied at the origin stop? Is this done in RaptorWorker? - int timeAtOriginStop = start + accessTime + FastRaptorWorker.BOARD_SLACK_SECONDS; + int timeAtOriginStop = start + accessTime + PathWithTimes.BOARD_SLACK_SECONDS; int bestTimeAtDestinationStop = Integer.MAX_VALUE; PathWithTimes.Itinerary bestItinerary = null;