Browse Source

优化路网整体拥堵计算

develop
xiepufeng 8 months ago
parent
commit
6286be72bd
  1. 5
      zc-business/src/main/java/com/zc/business/statistics/handler/TrafficAnalysis.java

5
zc-business/src/main/java/com/zc/business/statistics/handler/TrafficAnalysis.java

@ -423,7 +423,8 @@ public class TrafficAnalysis {
// 对于不拥堵的路段,累加之前计算的默认拥堵距离 // 对于不拥堵的路段,累加之前计算的默认拥堵距离
if (!ChannelCongestionLevelEnum.isMediumOrSevereCongestion(averageSpeed, dcTrafficSectionData.getTrafficVolume())) { if (!ChannelCongestionLevelEnum.isMediumOrSevereCongestion(averageSpeed, dcTrafficSectionData.getTrafficVolume())) {
totalCongestionDistance.addAndGet(defaultCongestionDistance); int congestionDistance = Math.abs(stakeMark - previousStakeMark);
totalCongestionDistance.addAndGet(Math.min(congestionDistance, defaultCongestionDistance));
previousStakeMark = stakeMark; previousStakeMark = stakeMark;
defaultCongestionDistance = 0; defaultCongestionDistance = 0;
previousAverageSpeed = 0; previousAverageSpeed = 0;
@ -445,8 +446,6 @@ public class TrafficAnalysis {
congestedSectionQuantity.addAndGet(1); congestedSectionQuantity.addAndGet(1);
} }
} else { } else {
// 如果之前没有计算过任何路段,则直接累加默认拥堵距离
totalCongestionDistance.addAndGet(defaultCongestionDistance);
// 累加拥堵路段数量 // 累加拥堵路段数量
congestedSectionQuantity.addAndGet(1); congestedSectionQuantity.addAndGet(1);
} }

Loading…
Cancel
Save