Commit a2f90c67 by 黄准

车道指标增加日志级别配置 方便现场调试程序

parent 3463a1c9
...@@ -235,12 +235,13 @@ public class LaneNormProcessFunction extends KeyedCoProcessFunction<String, Cycl ...@@ -235,12 +235,13 @@ public class LaneNormProcessFunction extends KeyedCoProcessFunction<String, Cycl
/** /**
* 北 直行 * 北 直行
* @param stageList * @param cycle
* @param position * @param position
* @param direction * @param direction
* @return * @return
*/ */
private static String gettEffectGreenTimeForDirction(List<Stage> stageList, String position,String direction,String loggerLevel) { private static String gettEffectGreenTimeForDirction(Cycle cycle, String position,String direction,String loggerLevel) {
List<Stage> stageList = cycle.getStageList();
int AllGreenTime = 0; int AllGreenTime = 0;
for (Stage stage : stageList) { for (Stage stage : stageList) {
List<StageForDirection> stageForDirectionList = stage.getStageForDirectionList(); List<StageForDirection> stageForDirectionList = stage.getStageForDirectionList();
...@@ -248,16 +249,13 @@ public class LaneNormProcessFunction extends KeyedCoProcessFunction<String, Cycl ...@@ -248,16 +249,13 @@ public class LaneNormProcessFunction extends KeyedCoProcessFunction<String, Cycl
if (position.equals(dir.getDirection()) && direction.equals(dir.getTraffic_flow_direction())) { if (position.equals(dir.getDirection()) && direction.equals(dir.getTraffic_flow_direction())) {
AllGreenTime += stage.getValidGreen(); AllGreenTime += stage.getValidGreen();
if("debug".equals(loggerLevel)) { if("debug".equals(loggerLevel)) {
System.out.println(position + direction+"命中->相位"+stage.getPhaseValue() + "相位有效绿灯时间为->"+stage.getValidGreen() ); System.out.println("cycleorder->"+cycle.getCycleOrder()+" 路口id->"+cycle.getCrossCode()+" "+position + direction+"命中->相位"+stage.getPhaseValue() + " 相位有效绿灯时间为->"+stage.getValidGreen() );
} }
//同一个相位累加一次即可 //同一个相位累加一次即可
break; break;
} }
} }
} }
if("debug".equals(loggerLevel)){
System.out.println(position+direction+"流向有效绿灯时间为->"+AllGreenTime);
}
return AllGreenTime + ""; return AllGreenTime + "";
} }
...@@ -324,7 +322,7 @@ public class LaneNormProcessFunction extends KeyedCoProcessFunction<String, Cycl ...@@ -324,7 +322,7 @@ public class LaneNormProcessFunction extends KeyedCoProcessFunction<String, Cycl
laneNorm.setResidualCapacity(new BigDecimal(sum2<=0?0d:sum2).setScale(5, BigDecimal.ROUND_HALF_UP).doubleValue()); laneNorm.setResidualCapacity(new BigDecimal(sum2<=0?0d:sum2).setScale(5, BigDecimal.ROUND_HALF_UP).doubleValue());
//laneNorm.setResidualCapacity(new BigDecimal(sum2).setScale(5, BigDecimal.ROUND_HALF_UP).doubleValue()); //laneNorm.setResidualCapacity(new BigDecimal(sum2).setScale(5, BigDecimal.ROUND_HALF_UP).doubleValue());
//有效绿灯时间 相位下此方向此流向有效绿灯时间之和 //有效绿灯时间 相位下此方向此流向有效绿灯时间之和
laneNorm.setEffectGreenTime(gettEffectGreenTimeForDirction(cycle.getStageList(), position,name,loggerLevel)); laneNorm.setEffectGreenTime(gettEffectGreenTimeForDirction(cycle, position,name,loggerLevel));
//识别空间空间占有率 车道长度需要交通流量为0得数据 //识别空间空间占有率 车道长度需要交通流量为0得数据
int sum = list.stream().filter(recode -> position.equals(recode.getDirection()) && recode.getLaneName().indexOf(name) != -1).mapToInt(LaneNorm::getLaneLength).sum(); int sum = list.stream().filter(recode -> position.equals(recode.getDirection()) && recode.getLaneName().indexOf(name) != -1).mapToInt(LaneNorm::getLaneLength).sum();
int sum1 = collect.stream().mapToInt(LaneNorm::getMaxQueueLength).sum(); int sum1 = collect.stream().mapToInt(LaneNorm::getMaxQueueLength).sum();
...@@ -410,8 +408,8 @@ public class LaneNormProcessFunction extends KeyedCoProcessFunction<String, Cycl ...@@ -410,8 +408,8 @@ public class LaneNormProcessFunction extends KeyedCoProcessFunction<String, Cycl
for (Stage stage : cycle1.getStageList()) { for (Stage stage : cycle1.getStageList()) {
stage.setStageForDirectionList(getStageForDiretion(stage, dictResult)); stage.setStageForDirectionList(getStageForDiretion(stage, dictResult));
} }
String s = gettEffectGreenTimeForDirction(cycle.getStageList(), "北", "直行","debug"); String s = gettEffectGreenTimeForDirction(cycle, "北", "直行","debug");
System.out.println(s); //System.out.println(s);
}catch (Exception e){ }catch (Exception e){
System.out.println(e); System.out.println(e);
......
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