Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check for negative link traversal times and trip times #3511

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class CarTripStatsFromPathTraversalEventHandler(
override def notifyIterationEnds(event: IterationEndsEvent): Unit = {
val type2RideStats: Map[CarType, Seq[CarTripStat]] = carType2PathTraversals.keys
.map { carType =>
carType -> calcRideStats(event.getIteration, carType)
carType -> calcRideStats(event.getIteration, carType).filter(_.speed > 0)
zneedell marked this conversation as resolved.
Show resolved Hide resolved
}
.toSeq
.sortBy(_._1)
Expand Down Expand Up @@ -544,15 +544,29 @@ object CarTripStatsFromPathTraversalEventHandler extends LazyLogging {
val freeFlowTravelTime: Double = calcFreeFlowDuration(freeFlowTravelTimeCalc, linkIds)
val startCoordWGS = new Coord(driving.startX, driving.startY)
val endCoordWGS = new Coord(parking.endX, parking.endY)
CarTripStat(
vehicleId = driving.vehicleId.toString,
travelTime = travelTime,
distance = length,
freeFlowTravelTime = freeFlowTravelTime,
departureTime = driving.departureTime,
startCoordWGS = startCoordWGS,
endCoordWGS = endCoordWGS
) :: acc
val outputStats = if (travelTime > 0 & freeFlowTravelTime > 0 & length > 0) {
zneedell marked this conversation as resolved.
Show resolved Hide resolved
CarTripStat(
vehicleId = driving.vehicleId.toString,
travelTime = travelTime,
distance = length,
freeFlowTravelTime = freeFlowTravelTime,
departureTime = driving.departureTime,
startCoordWGS = startCoordWGS,
endCoordWGS = endCoordWGS
)
} else {
logger.warn("Bad path traversals {}", linkIds)
zneedell marked this conversation as resolved.
Show resolved Hide resolved
CarTripStat(
vehicleId = driving.vehicleId.toString,
travelTime = 0,
distance = 0,
freeFlowTravelTime = 0,
departureTime = driving.departureTime,
startCoordWGS = startCoordWGS,
endCoordWGS = endCoordWGS
)
}
outputStats :: acc
}
stats
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/beam/physsim/jdeqsim/JDEQSimRunner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,9 @@ object JDEQSimRunner {
val result = ftt * (1 + alpha * math.pow(tmp, beta))
val originalTravelTime =
Math.min(result, link.getLength / caccSettings.adjustedMinimumRoadSpeedInMetersPerSecond)
originalTravelTime + additionalTravelTime(link, time)
Math.max(originalTravelTime, 0.0) + additionalTravelTime(link, time)
} else {
ftt + additionalTravelTime(link, time)
Math.max(ftt, 0.0) + additionalTravelTime(link, time)
}
}
case None =>
Expand Down