From 6c44d38ebdf0ea6252a8746d3035cc86976d2510 Mon Sep 17 00:00:00 2001 From: tiger_zhou <123456> Date: Sat, 13 May 2023 14:04:01 +0800 Subject: [PATCH] =?UTF-8?q?ncc=E5=9B=BE=E4=BE=8B=E9=93=81=E8=BD=A6?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cbtc/ATS/data/SortDiagramStation.java | 15 +++++++++------ .../cbtc/ATS/service/diagram/RuningService.java | 13 ++----------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/data/SortDiagramStation.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/data/SortDiagramStation.java index 208c7a1b2..468ab5e00 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/data/SortDiagramStation.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/data/SortDiagramStation.java @@ -81,23 +81,26 @@ public class SortDiagramStation { }*/ public Station findNext(Station station,boolean isRight){ int index = this.findIndex(station); - - - if(isRight){ + int findIndex = isRight ? index + 1 : index - 1; + return this.findNotDepotStation(isRight,findIndex); + /*if(isRight){ return this.findNotDepotStation(isRight,index + 1); }else{ return this.findNotDepotStation(isRight,index -1); - } + }*/ } public Station findPre(Station station,boolean isRight){ int index = this.findIndex(station); - if(isRight){ + int findIndex = isRight ? index -1 : index +1; + return this.findNotDepotStation(isRight,findIndex); + + /*if(isRight){ return this.findNotDepotStation(isRight,index - 1); }else{ return this.findNotDepotStation(isRight,index + 1); - } + }*/ } public Station find(Station station){ int index = this.findIndex(station); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/diagram/RuningService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/diagram/RuningService.java index ccd1cb859..e254546d1 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/diagram/RuningService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/diagram/RuningService.java @@ -61,8 +61,8 @@ public class RuningService implements CalculateDiagram{ private Float calculateStationRatio(Simulation simulation,Section begin,Section end,VirtualRealityTrain train){ Long mapId = simulation.getBuildParams().getMap().getId(); LocalDateTime simulationDateTime = simulation.getCorrectSystemTime(); - Float totalDis; - Float runOffset; + Float totalDis =null; + Float runOffset =null; try{ totalDis = CalculateService.calculateDistance(begin,end,train.isRight()); if(totalDis == 0F){ @@ -71,15 +71,6 @@ public class RuningService implements CalculateDiagram{ } float off = begin.getStopPointByDirection(train.isRight()); runOffset = CalculateService.calculateDistanceIgnoreSwitchFromStationToTrainHead(new SectionPosition(begin,off),train.getHeadPosition(),train.isRight()); - }catch (Exception e){ - log.debug("计算失败 线路id:{} 仿真时间:{} 车次[{}] 方向[{}] 车头区段[{}] 车头位置[{}] 车尾区段[{}] 查找开始区段[{}] 结束区段[{}] 错误信息[{}] " - ,mapId,simulationDateTime - ,train.getGroupNumber(),train.isRight(),train.getHeadPosition().getSection().getCode(),train.getHeadPosition().getOffset() - ,train.getTailPosition().getSection().getCode(),begin.getCode(),end.getCode(),e.getMessage(),e); - return null; - } - - try{ double t = runOffset / totalDis; float d = new BigDecimal(t).setScale(3, RoundingMode.HALF_UP).floatValue(); if(d >= 1F){