From e5c495eb94d663f0e2fbca97551fbd4d3409ed54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BE=D0=B1=D1=80=D1=8B=D0=B8=CC=86=20=D0=AD=D1=8D?= =?UTF-8?q?=D1=85?= Date: Fri, 5 May 2017 19:14:50 +0300 Subject: [PATCH] [routing] Calculated car model speeds --- routing/edge_estimator.cpp | 8 +++++--- routing_common/car_model.cpp | 12 ++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/routing/edge_estimator.cpp b/routing/edge_estimator.cpp index 90b9f781a9..259789d9ba 100644 --- a/routing/edge_estimator.cpp +++ b/routing/edge_estimator.cpp @@ -74,8 +74,7 @@ double CarEdgeEstimator::CalcSegmentWeight(Segment const & segment, RoadGeometry double const speedMPS = road.GetSpeed() * kKMPH2MPS; double result = TimeBetweenSec(road.GetPoint(segment.GetPointId(false /* front */)), - road.GetPoint(segment.GetPointId(true /* front */)), speedMPS) * - kTimePenalty; + road.GetPoint(segment.GetPointId(true /* front */)), speedMPS); if (m_trafficStash) { @@ -89,7 +88,10 @@ double CarEdgeEstimator::CalcSegmentWeight(Segment const & segment, RoadGeometry SpeedGroup const speedGroup = (it == trafficColoring->cend()) ? SpeedGroup::Unknown : it->second; ASSERT_LESS(speedGroup, SpeedGroup::Count, ()); - result *= CalcTrafficFactor(speedGroup); + double const trafficFactor = CalcTrafficFactor(speedGroup); + result *= trafficFactor; + if (trafficFactor > 1.0) + result *= kTimePenalty; } } diff --git a/routing_common/car_model.cpp b/routing_common/car_model.cpp index 07be768d81..f5d38bb8f4 100644 --- a/routing_common/car_model.cpp +++ b/routing_common/car_model.cpp @@ -8,18 +8,18 @@ namespace { -double constexpr kSpeedMotorwayKMpH = 90.0; +double constexpr kSpeedMotorwayKMpH = 115.37; double constexpr kSpeedMotorwayLinkKMpH = 75.0; -double constexpr kSpeedTrunkKMpH = 85.0; +double constexpr kSpeedTrunkKMpH = 93.89; double constexpr kSpeedTrunkLinkKMpH = 70.0; -double constexpr kSpeedPrimaryKMpH = 65.0; +double constexpr kSpeedPrimaryKMpH = 84.29; double constexpr kSpeedPrimaryLinkKMpH = 60.0; -double constexpr kSpeedSecondaryKMpH = 55.0; +double constexpr kSpeedSecondaryKMpH = 72.23; double constexpr kSpeedSecondaryLinkKMpH = 50.0; -double constexpr kSpeedTertiaryKMpH = 40.0; +double constexpr kSpeedTertiaryKMpH = 62.63; double constexpr kSpeedTertiaryLinkKMpH = 30.0; double constexpr kSpeedResidentialKMpH = 25.0; -double constexpr kSpeedUnclassifiedKMpH = 25.0; +double constexpr kSpeedUnclassifiedKMpH = 51.09; double constexpr kSpeedServiceKMpH = 15.0; double constexpr kSpeedLivingStreetKMpH = 10.0; double constexpr kSpeedRoadKMpH = 10.0;