From c36f7ab6391524d210484e91124e95f10f5e0430 Mon Sep 17 00:00:00 2001 From: sheng Date: Sat, 19 Dec 2020 22:29:44 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E8=BF=9B=E8=B7=AF=E8=B7=AF=E5=BE=84=E8=AE=A1=E7=AE=97=E9=80=BB?= =?UTF-8?q?=E8=BE=91=20=E4=BF=AE=E6=94=B9=E5=88=97=E8=BD=A6=E7=AB=99?= =?UTF-8?q?=E5=8F=B0=E6=8E=A7=E5=88=B6=E9=80=BB=E8=BE=91=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E6=97=A0=E5=87=BA=E7=AB=99=E4=BF=A1=E5=8F=B7=E6=9C=BA=E7=AB=99?= =?UTF-8?q?=E5=8F=B0=20=E4=BF=AE=E6=94=B9=E5=85=B6=E4=BB=96=E5=8F=91?= =?UTF-8?q?=E7=8E=B0bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DraftMapCiDataGeneratorImpl.java | 3 ++ .../cbtc/CI/service/RouteService.java | 2 +- .../cbtc/data/CalculateService.java | 35 +++++++++++++++---- .../cbtc/onboard/ATP/ATPLogicLoop.java | 20 ++++++----- .../PassengerFlowSimulateService.java | 4 ++- 5 files changed, 47 insertions(+), 17 deletions(-) diff --git a/src/main/java/club/joylink/rtss/services/draftData/DraftMapCiDataGeneratorImpl.java b/src/main/java/club/joylink/rtss/services/draftData/DraftMapCiDataGeneratorImpl.java index f76d82e33..e2dbf3736 100644 --- a/src/main/java/club/joylink/rtss/services/draftData/DraftMapCiDataGeneratorImpl.java +++ b/src/main/java/club/joylink/rtss/services/draftData/DraftMapCiDataGeneratorImpl.java @@ -1938,6 +1938,9 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator { } if (Objects.isNull(section)) { // 找到尽头也没有构成进路,异常 + log.error(String.format("始端信号机[%s(%s)]:找到尽头也没有构成进路,所寻路径为[%s]", + startSignal.getName(), startSignal.getCode(), + tempPath.getSectionPathString())); errorList.add(String.format("始端信号机[%s(%s)]:找到尽头也没有构成进路,所寻路径为[%s]", startSignal.getName(), startSignal.getCode(), tempPath.getSectionPathString())); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/RouteService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/RouteService.java index c80547521..d6bd1a6a4 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/RouteService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/RouteService.java @@ -768,7 +768,7 @@ public class RouteService { if (!CollectionUtils.isEmpty(standTracks)) { for (Section standTrack : standTracks) { List standList = standTrack.getStandList(); - if (standList.stream().anyMatch(stand -> !stand.getPsd().isCloseAndLock())) + if (standList.stream().anyMatch(stand -> stand.getPsd() != null && !stand.getPsd().isCloseAndLock())) return false; } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/CalculateService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/CalculateService.java index 94edbb6d8..eafde90f9 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/CalculateService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/CalculateService.java @@ -639,11 +639,34 @@ public class CalculateService { public static List queryRoutePathsOnDirection(Section start, Section end, Boolean right) { List list = new ArrayList<>(); - Signal signal; - if (start.isSwitchTrack()) { - signal = start.querySwitchSectionRelatedSignalByDirection(right); - } else { - signal = start.getSignalOf(right); + Signal signal = null; +// if (start.isSwitchTrack()) { +// signal = start.querySwitchSectionRelatedSignalByDirection(right); +// } else { +// signal = start.getSignalOf(right); +// } + Section section = start; + int rc = 0; + while (signal == null && rc < 20) { + ++rc; + if (section == null) { + break; + } + signal = section.getSignalOf(right); + if (signal != null) { + break; + } + Section sectionOf = section.getSectionOf(!right); + if (sectionOf != null) { + section = sectionOf; + } else if (sectionOf == null && section.isSwitchTrack()) { + Switch relSwitch = section.getRelSwitch(); + if (relSwitch.isA(section)) { + section = relSwitch.getB(); + } else { + section = relSwitch.getA(); + } + } } RoutePath routePath = new RoutePath(start, end, right); getRoutePaths(signal, right, end, 1, routePath, list); @@ -655,7 +678,7 @@ public class CalculateService { if (Objects.isNull(signal)) { return; } - if (iter > 8) { + if (iter > 20) { return; } routePath.addSignal(signal); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPLogicLoop.java b/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPLogicLoop.java index cf042320e..5cc10adf0 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPLogicLoop.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPLogicLoop.java @@ -219,14 +219,17 @@ public class ATPLogicLoop { case CLOSE_DOOR: // 关门 Signal signal = train.getHeadPosition().getSection().getSignalOf(train.isRight()); if (!train.isHold()) { // 列车未扣车 - if ((Objects.nonNull(signal) && signal.isNormalOpen()) || - (train.isRMMode() || train.isNRMMode())) { // 进路信号机正常开放 或 列车为RM/NRM - // 可以关门 - this.ATOService.syncCloseDoor(simulation, train); - if (this.isAllDoorClose(simulation, train)) { - train.nextParkedTrainActivity(); + if (Objects.nonNull(signal) && !signal.isNormalOpen()) { + if (!train.isRMMode() && !train.isNRMMode()) { + // 信号机未正常开放 + break; } } + // 可以关门 + this.ATOService.syncCloseDoor(simulation, train); + if (this.isAllDoorClose(simulation, train)) { + train.nextParkedTrainActivity(); + } } break; case START: // 准备出发 @@ -620,9 +623,8 @@ public class ATPLogicLoop { if (tailSection.isNormalStandTrack() && Objects.equals(nextStation, tailSection.getStation())) { // 列车尾部在计划的下一站台轨 - Signal signal = tailSection.getSignalOf(right); // 出站信号机 - SectionPosition signalPosition = new SectionPosition(signal.getSection(), signal.getOffset()); - Float distance = CalculateService.calculateDistance(signalPosition, headPosition, right); + SectionPosition standEndPosition = new SectionPosition(tailSection, right ? tailSection.getLen() : 0); + Float distance = CalculateService.calculateDistance(standEndPosition, headPosition, right); if (Objects.nonNull(distance) && distance > 5) { // 列车成功越站 this.atsApiService.handleTrainPassingStation(simulation, train.getGroupNumber(), diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/passenger/PassengerFlowSimulateService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/passenger/PassengerFlowSimulateService.java index 9f5bf96b6..93b0f90ba 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/passenger/PassengerFlowSimulateService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/passenger/PassengerFlowSimulateService.java @@ -100,7 +100,9 @@ public class PassengerFlowSimulateService { if(Objects.isNull(group2mapPassengerFlowID.get(simulation.getGroup()))){ //查询默认的数据 passengerFlowData = this.mapPassengerFlowDataService.queryPassengerFlowDataOfMap(mapId,null); - group2mapPassengerFlowID.put(simulation.getGroup(),passengerFlowData.getId()); + if (passengerFlowData != null) { + group2mapPassengerFlowID.put(simulation.getGroup(),passengerFlowData.getId()); + } }else{ //根据id查询数据 passengerFlowData = this.mapPassengerFlowDataService.queryPassengerFlowDataOfMap(mapId,group2mapPassengerFlowID.get(simulation.getGroup())); From 301ed565d1c339b06525887302ed2a43415132e2 Mon Sep 17 00:00:00 2001 From: DU Date: Mon, 21 Dec 2020 09:16:18 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E5=81=9C=E7=AB=99?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=95=B0=E6=8D=AE=E5=88=A4=E9=87=8D=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../joylink/rtss/services/runplan/RunPlanParktimeService.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/club/joylink/rtss/services/runplan/RunPlanParktimeService.java b/src/main/java/club/joylink/rtss/services/runplan/RunPlanParktimeService.java index 88f185cc4..b79c71e4f 100644 --- a/src/main/java/club/joylink/rtss/services/runplan/RunPlanParktimeService.java +++ b/src/main/java/club/joylink/rtss/services/runplan/RunPlanParktimeService.java @@ -86,7 +86,6 @@ public class RunPlanParktimeService implements IRunPlanParktimeService { example.createCriteria() .andMapIdEqualTo(parkingTimeVO.getMapId()) .andUserIdEqualTo(parkingTimeVO.getUserId()) - .andStationCodeEqualTo(parkingTimeVO.getStationCode()) .andSectionCodeEqualTo(parkingTimeVO.getSectionCode()); if (this.parktimeDAO.countByExample(example) > 0) { return true; From 4353dd014e5cdd23e5ab8ff268b9fc2d0260d577 Mon Sep 17 00:00:00 2001 From: DU Date: Mon, 21 Dec 2020 13:04:35 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E5=9B=BE=E5=BC=82=E5=B8=B8=E6=96=AD=E8=A8=80bug=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../joylink/rtss/vo/runplan/newrunplan/IRunPlanStrategyNew.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/club/joylink/rtss/vo/runplan/newrunplan/IRunPlanStrategyNew.java b/src/main/java/club/joylink/rtss/vo/runplan/newrunplan/IRunPlanStrategyNew.java index 48217f371..0c7fa061a 100644 --- a/src/main/java/club/joylink/rtss/vo/runplan/newrunplan/IRunPlanStrategyNew.java +++ b/src/main/java/club/joylink/rtss/vo/runplan/newrunplan/IRunPlanStrategyNew.java @@ -205,7 +205,7 @@ public interface IRunPlanStrategyNew { } else if (Objects.isNull(runPlanArrivalTime.getDepartureTime())) { runPlanArrivalTime.setDepartureTime(runPlanArrivalTime.getArriveTime()); } - BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(runPlanArrivalTime.getArriveTime().isBefore(runPlanArrivalTime.getDepartureTime()), + BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotTrue(runPlanArrivalTime.getDepartureTime().isBefore(runPlanArrivalTime.getArriveTime()), String.format("数据异常:‘%s’到发时间异常", stationName)); }); // 按到达时间增序排序