From 5b1603cca4987cb0e7df044b921edabd124296c4 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Tue, 13 Jul 2021 10:32:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E6=8E=88=E6=9D=83=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cbtc/ATP/ground/ZCLogicLoop.java | 73 ++++++------------- .../cbtc/data/support/MovementAuthority.java | 6 +- 2 files changed, 24 insertions(+), 55 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/ZCLogicLoop.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/ZCLogicLoop.java index ec7899315..e9bfc39ee 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/ZCLogicLoop.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/ZCLogicLoop.java @@ -172,17 +172,13 @@ public class ZCLogicLoop { } } // 道岔 - MovementAuthority.End end = checkSwitch(section); + MovementAuthority.End end = checkSwitch(section, right); if (end != null) endList.add(end); // 轨道尽头/问题道岔 Section temp = section.getNextRunningSectionOf(right); if (Objects.isNull(temp)) { // 到尽头 - if (section.isSwitchTrack()) { // 问题道岔 - if (Objects.nonNull(section.getSectionOf(!right))) { - endList.add(new MovementAuthority.End(section.getSectionOf(!right), MovementAuthority.EndType.FAULT_SWITCH)); - } - } else { + if (!section.isSwitchTrack()) { // 问题道岔 endList.add(new MovementAuthority.End(section, MovementAuthority.EndType.END_TRACK)); } break; @@ -221,9 +217,9 @@ public class ZCLogicLoop { private MovementAuthority.End checkSwitch(Section tailSection, Section headSection, boolean right) { Section section = tailSection; for (int i = 0; i < 10; i++) { - if (section.equals(headSection)) + if (section == null || section.equals(headSection)) break; - MovementAuthority.End end = checkSwitch(section); + MovementAuthority.End end = checkSwitch(section, right); if (end != null) return end; section = section.getNextRunningSectionOf(right); @@ -231,20 +227,26 @@ public class ZCLogicLoop { return null; } - private MovementAuthority.End checkSwitch(Section section) { + private MovementAuthority.End checkSwitch(Section section, boolean right) { Switch relSwitch = section.getRelSwitch(); - if (relSwitch != null) { + Section nextSection = section.getNextRunningSectionOf(right); + if (relSwitch != null) { //是道岔区段 Route route = relSwitch.getRoute(); - if ((relSwitch.isRouteLock() || relSwitch.isOverlapLock()) && relSwitch.isLoss()) { //区段进路/延续保护锁闭且失表 - return new MovementAuthority.End(section, MovementAuthority.EndType.FAULT_SWITCH); - } else if (route != null) { - List flsList = route.getFlsList(); - if (!CollectionUtils.isEmpty(flsList)) { - List fls = flsList.stream() - .filter(routeFls -> routeFls.getBase().getASwitch().equals(relSwitch)) - .collect(Collectors.toList()); - if (!routeService.isFlsCheckPass(fls)) { - return new MovementAuthority.End(section, MovementAuthority.EndType.FAULT_SWITCH); + Section previousSection = section.getNextRunningSectionOf(!right); + if (previousSection == null) + return null; + if (route != null) { //道岔进路锁闭 + if (relSwitch.isLoss() && nextSection == null) { //失表且下个区段为null(如果下个区段不为null,说明已经越过了失表的道岔) + return new MovementAuthority.End(previousSection, MovementAuthority.EndType.FAULT_SWITCH); + } else if (nextSection.getRelSwitch() == relSwitch){ //下个区段的关联道岔与当前区段关联道岔一样(说明没越过该道岔) + List flsList = route.getFlsList(); + if (!CollectionUtils.isEmpty(flsList)) { + List fls = flsList.stream() + .filter(routeFls -> routeFls.getBase().getASwitch().equals(relSwitch)) + .collect(Collectors.toList()); + if (!routeService.isFlsCheckPass(fls)) { + return new MovementAuthority.End(previousSection, MovementAuthority.EndType.FAULT_SWITCH); + } } } } @@ -346,27 +348,12 @@ public class ZCLogicLoop { // 轨道尽头/问题道岔 Section temp = section.getNextRunningSectionOf(right); if (Objects.isNull(temp)) { // 到尽头 - if (section.isSwitchTrack()) { // 问题道岔 - if (Objects.nonNull(section.getSectionOf(!right))) { - endList.add(new MovementAuthority.End(section.getSectionOf(!right), - MovementAuthority.EndType.FAULT_SWITCH)); -// deviceEnd = new MovementAuthority.End(section.getSectionOf(!right), -// MovementAuthority.EndType.FAULT_SWITCH); - } - } else { + if (!section.isSwitchTrack()) { // 问题道岔 endList.add(new MovementAuthority.End(section, MovementAuthority.EndType.END_TRACK)); -// deviceEnd = new MovementAuthority.End(section, -// MovementAuthority.EndType.END_TRACK); } break; } -// else { -// if (temp.isNonCbtcOccupy() && temp.isInvalid()) { -// endList.add(new MovementAuthority.End(temp, MovementAuthority.EndType.NCT_OCCUPIED_SECTION)); -// } -// } - section = temp; } if (Objects.nonNull(deviceEnd)) { endList.add(deviceEnd); @@ -374,20 +361,6 @@ public class ZCLogicLoop { return endList; } - private MovementAuthority.End checkFaultSwitchAfterSignal(Signal signal) { - if (Objects.nonNull(signal)) { - Section section = signal.getSection().getSectionOf(signal.isRight()); - if (Objects.nonNull(section) && section.isSwitchTrack()) { - Switch relSwitch = section.getRelSwitch(); - if (relSwitch.isLoss() && relSwitch.isLoss()) { - return new MovementAuthority.End(signal.getSection(), - MovementAuthority.EndType.FAULT_SWITCH); - } - } - } - return null; - } - /** * 比较并构建移动授权数据 * diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/support/MovementAuthority.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/support/MovementAuthority.java index e34e1fa0d..1ee79c6d2 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/support/MovementAuthority.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/support/MovementAuthority.java @@ -135,11 +135,7 @@ public class MovementAuthority { float offset = right ? section.getLen() : 0; return new SectionPosition(section, offset); } - case UNLOCKED_OVERLAP: { //这种情况下section是进路的最后一个区段 - Section section = (Section) this.device; - float offset = right ? Math.max(0, section.getLen() - 100) : Math.min(100, section.getLen()); - return new SectionPosition(section, offset); - } + case UNLOCKED_OVERLAP: case FAULT_SWITCH: { Section section = (Section) this.device; float offset = right ? 0 : section.getLen();