Commit 52872185 authored by hanbing's avatar hanbing

[update] 运行评价-干线方案评价增加拥堵指数

parent 0561b9a8
......@@ -1402,6 +1402,26 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService {
int value = (int) sumOfMax;
curveElement.setValue(value);
curveElementList.add(curveElement);
}
} else if (Objects.equals(metricName, StrategyAndMetricsEnum.Metrics.TRAFFIC_INDEX.getDescription())) {
for (String hourMinute : timeArray) {
MainlineSchemeEvaluateVO.CurveElement curveElement = new MainlineSchemeEvaluateVO.CurveElement();
curveElement.setMetricTime(hourMinute);
List<CrossDirDataHistPO> crossDirDataHistPOList = groupedByTime.get(hourMinute);
double sumOfAverages = crossDirDataHistPOList.stream()
.collect(Collectors.groupingBy(CrossDirDataHistPO::getCrossId))
.entrySet().stream()
.mapToDouble(entry -> entry.getValue().stream()
.mapToDouble(CrossDirDataHistPO::getTrafficIndex)
.average()
.orElse(0.0))
.average().orElse(0.0);
int value = (int) sumOfAverages;
curveElement.setValue(value);
curveElementList.add(curveElement);
}
......@@ -1747,6 +1767,11 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService {
metric7.setMetricName(StrategyAndMetricsEnum.Metrics.CORD_RELIABILITY.getDescription());
metric7.setIsShown(0);
res.add(metric7);
MainlineSchemeAnalysisVO.Metric metric9 = new MainlineSchemeAnalysisVO.Metric();
metric9.setMetricName(StrategyAndMetricsEnum.Metrics.TRAFFIC_INDEX.getDescription());
metric9.setIsShown(0);
res.add(metric9);
}
private String reverseDirName(String input, String character) {
......
......@@ -51,7 +51,8 @@ public class StrategyAndMetricsEnum {
CORD_RELIABILITY("15", "协调方案可靠性", "%", "cordReliability"),
CORD_QUEUE_RATIO("16", "协调路段排队空间占比", "%", "cordQueueRatio"),
UNCOORDINATE_PHASE_QUEUE("17", "非协调相位二次排队", "%", "uncoordinatePhaseQueue"),
TRVAL_TIME("18", "干线行程时间", "s", "trvalTime");
TRVAL_TIME("18", "干线行程时间", "s", "trvalTime"),
TRAFFIC_INDEX("19", "拥堵指数", "", "trafficIndex");
private final String code;
private final String description;
......@@ -122,7 +123,8 @@ public class StrategyAndMetricsEnum {
Metrics.AVERAGE_DELAY,
Metrics.MAX_QUEUE_LENGTH,
Metrics.STOP_TIMES,
Metrics.AVERAGE_SPEED
Metrics.AVERAGE_SPEED,
Metrics.TRAFFIC_INDEX
));
map.put(Strategy.BALANCE, Arrays.asList(
Metrics.GREEN_LIGHT_EFFICIENCY,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment