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()));