From 8faf1c9886485a0a6dcaf97cc29df53a9f38bbcc Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Thu, 8 Jul 2021 14:44:18 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9AIBP=E7=9B=98?= =?UTF-8?q?=E5=85=B3=E9=97=A8=E6=8C=89=E9=92=AE=EF=BC=9BPSL=E7=9B=98?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E4=B8=94=E7=B4=A7=E9=94=81=E6=8C=87=E7=A4=BA?= =?UTF-8?q?=E7=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../services/VirtualRealityIbpService.java | 20 ++++++++++++++++++- .../psl/VirtualRealityPslService.java | 1 + .../cbtc/data/vr/VirtualRealityIbp.java | 1 + .../cbtc/data/vr/VirtualRealityPsl.java | 4 ++++ .../joylink/rtss/vo/client/psl/PslStatus.java | 11 ++++++++++ 5 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/main/java/club/joylink/rtss/services/VirtualRealityIbpService.java b/src/main/java/club/joylink/rtss/services/VirtualRealityIbpService.java index 7d35d803e..431a480ea 100644 --- a/src/main/java/club/joylink/rtss/services/VirtualRealityIbpService.java +++ b/src/main/java/club/joylink/rtss/services/VirtualRealityIbpService.java @@ -120,7 +120,7 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService { break; case ALARM: break; - case KM: + case KM: { element.setOn(true); List key; if (element.getUp()) { @@ -132,6 +132,24 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService { stands.forEach(stand -> ciApiService.openScreenDoor(simulation, stand.getCode())); } break; + } + case GM: { + element.setOn(true); + List key; + if (element.getUp() != null) { + if (element.getUp()) { + key = ibp.query(VirtualRealityIbp.Mean.SXYS, element.getUp()); + } else { + key = ibp.query(VirtualRealityIbp.Mean.XXYS, element.getUp()); + } + } else { + key = ibp.queryByType(VirtualRealityIbp.Type.KEY); + } + if (key.stream().allMatch(VirtualRealityIbp.IbpElement::isOn)) { + stands.forEach(stand -> ciApiService.closeScreenDoor(simulation, stand.getCode())); + } + break; + } case XXYS: case SXYS: element.setOn(!element.isOn()); diff --git a/src/main/java/club/joylink/rtss/services/psl/VirtualRealityPslService.java b/src/main/java/club/joylink/rtss/services/psl/VirtualRealityPslService.java index f1c96ffc5..ecad921f5 100644 --- a/src/main/java/club/joylink/rtss/services/psl/VirtualRealityPslService.java +++ b/src/main/java/club/joylink/rtss/services/psl/VirtualRealityPslService.java @@ -123,6 +123,7 @@ public class VirtualRealityPslService implements IVirtualRealityPslService{ private VirtualRealityPsl collectStatus(Stand stand) { VirtualRealityPsl vrPsl = stand.getVrPsl(); PSD psd = stand.getPsd(); + vrPsl.setQbgmLight(vrPsl.isSdButton() || psd.isCloseAndLock()); vrPsl.setPslczLight(vrPsl.isSdButton() || vrPsl.isYxjzKey()); vrPsl.setHsjcLight(vrPsl.isSdButton() || vrPsl.isHsjcKey()); vrPsl.setKmLight(vrPsl.isSdButton() || !psd.isCloseAndLock()); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealityIbp.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealityIbp.java index 6fc350954..99f551e45 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealityIbp.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealityIbp.java @@ -164,6 +164,7 @@ public class VirtualRealityIbp { * 下行屏蔽门开门 */ KM, + GM, /** * 下行钥匙 */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealityPsl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealityPsl.java index 08460b5d8..304668d6a 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealityPsl.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealityPsl.java @@ -6,6 +6,10 @@ import lombok.Setter; @Getter @Setter public class VirtualRealityPsl { + + /** 所有滑动门/应急门关闭且紧锁指示灯 */ + private boolean qbgmLight; + /** psl操作指示灯 */ private boolean pslczLight; diff --git a/src/main/java/club/joylink/rtss/vo/client/psl/PslStatus.java b/src/main/java/club/joylink/rtss/vo/client/psl/PslStatus.java index 9e72d904e..c9751f46e 100644 --- a/src/main/java/club/joylink/rtss/vo/client/psl/PslStatus.java +++ b/src/main/java/club/joylink/rtss/vo/client/psl/PslStatus.java @@ -14,6 +14,11 @@ import java.util.Objects; @NoArgsConstructor public class PslStatus { + /** + * 所有滑动门/应急门关闭且紧锁 + */ + private Boolean qbgmLight; + /** * psl操作指示灯 */ @@ -60,6 +65,7 @@ public class PslStatus { private Boolean sdButton; public PslStatus(VirtualRealityPsl psl) { + this.qbgmLight = psl.isQbgmLight(); this.pslczLight = psl.isPslczLight(); this.hsjcLight = psl.isHsjcLight(); this.kmLight = psl.isKmLight(); @@ -74,6 +80,11 @@ public class PslStatus { public PslStatus collectDifference(VirtualRealityPsl psl) { PslStatus pslStatus = new PslStatus(); boolean change = false; + if (!Objects.equals(this.qbgmLight, psl.isQbgmLight())) { + this.qbgmLight = psl.isQbgmLight(); + pslStatus.setQbgmLight(this.qbgmLight); + change = true; + } if (!Objects.equals(this.pslczLight, psl.isPslczLight())) { this.pslczLight = psl.isPslczLight(); pslStatus.setPslczLight(this.pslczLight); From 6137c977bc3f75ca95fcb7d8ede27c06e8efd17d Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Thu, 8 Jul 2021 15:07:53 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E5=BC=80?= =?UTF-8?q?=E5=85=B3=E9=97=A8=E6=8C=87=E4=BB=A4=E6=97=A0=E6=95=88bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../club/joylink/rtss/simulation/cbtc/command/CommandBO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/command/CommandBO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/command/CommandBO.java index 84dff9528..b2975b136 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/command/CommandBO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/command/CommandBO.java @@ -396,7 +396,7 @@ public class CommandBO { } else { doorIsRight = train.judgeDirection4DoorIsRight(train.getDoor1()); } - stepList.add(buildDoorOnOffOperationStep(train.getGroupNumber(), doorIsRight, false)); + stepList.add(buildDoorOnOffOperationStep(train.getGroupNumber(), doorIsRight, true)); } } From 5d61e74415e1449b96fe7a79cb5779d9b5844611 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Mon, 12 Jul 2021 14:30:30 +0800 Subject: [PATCH 3/8] =?UTF-8?q?IBP=E7=9B=98bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../services/VirtualRealityIbpService.java | 1 + .../joylink/rtss/vo/client/ibp/IbpData.java | 31 +++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/main/java/club/joylink/rtss/services/VirtualRealityIbpService.java b/src/main/java/club/joylink/rtss/services/VirtualRealityIbpService.java index 431a480ea..1adcb8cd4 100644 --- a/src/main/java/club/joylink/rtss/services/VirtualRealityIbpService.java +++ b/src/main/java/club/joylink/rtss/services/VirtualRealityIbpService.java @@ -307,6 +307,7 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService { case QXJJTC: case BJQC: case KM: + case GM: case AXLE_RESET: case PRERESET_Z: case ALARM: diff --git a/src/main/java/club/joylink/rtss/vo/client/ibp/IbpData.java b/src/main/java/club/joylink/rtss/vo/client/ibp/IbpData.java index 7a8da7613..26786ae01 100644 --- a/src/main/java/club/joylink/rtss/vo/client/ibp/IbpData.java +++ b/src/main/java/club/joylink/rtss/vo/client/ibp/IbpData.java @@ -4,6 +4,7 @@ import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityIbp; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; +import org.springframework.util.StringUtils; import java.util.List; @@ -33,11 +34,19 @@ public class IbpData { public static class SquareButtonVO { private String code; - private VirtualRealityIbp.Mean mean; + private String mean; private String sectionCode; private Boolean direction; + + public VirtualRealityIbp.Mean getMean() { + if (StringUtils.hasText(this.mean)) { + return VirtualRealityIbp.Mean.valueOf(this.mean); + } else { + return null; + } + } } @Getter @@ -55,9 +64,17 @@ public class IbpData { public static class CircularLampVO { private String code; - private VirtualRealityIbp.Mean mean; + private String mean; private Boolean direction; + + public VirtualRealityIbp.Mean getMean() { + if (StringUtils.hasText(this.mean)) { + return VirtualRealityIbp.Mean.valueOf(this.mean); + } else { + return null; + } + } } @Getter @@ -66,8 +83,16 @@ public class IbpData { public static class KeyVO { private String code; - private VirtualRealityIbp.Mean mean; + private String mean; private Boolean direction; //暂时没用 + + public VirtualRealityIbp.Mean getMean() { + if (StringUtils.hasText(this.mean)) { + return VirtualRealityIbp.Mean.valueOf(this.mean); + } else { + return null; + } + } } } From 792263361e902704ed6134dc23a5615f75d2a94f Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Mon, 12 Jul 2021 17:11:50 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E9=81=93?= =?UTF-8?q?=E5=B2=94=E8=BF=9B=E8=B7=AF/=E5=BB=B6=E7=BB=AD=E4=BF=9D?= =?UTF-8?q?=E6=8A=A4=E9=94=81=E9=97=AD=E5=B9=B6=E5=A4=B1=E8=A1=A8=E6=97=B6?= =?UTF-8?q?=E6=89=8D=E8=AE=A1=E7=AE=97=E7=A7=BB=E5=8A=A8=E6=8E=88=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../joylink/rtss/simulation/cbtc/ATP/ground/ZCLogicLoop.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e8a51baef..ec7899315 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 @@ -235,7 +235,7 @@ public class ZCLogicLoop { Switch relSwitch = section.getRelSwitch(); if (relSwitch != null) { Route route = relSwitch.getRoute(); - if (relSwitch.isLoss()) { + if ((relSwitch.isRouteLock() || relSwitch.isOverlapLock()) && relSwitch.isLoss()) { //区段进路/延续保护锁闭且失表 return new MovementAuthority.End(section, MovementAuthority.EndType.FAULT_SWITCH); } else if (route != null) { List flsList = route.getFlsList(); 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 5/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=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(); From 9a25867812608339a611b2e18f7d17baa7e95ecb Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Tue, 13 Jul 2021 13:01:51 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=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 --- .../joylink/rtss/simulation/cbtc/ATP/ground/ZCLogicLoop.java | 4 ++-- 1 file changed, 2 insertions(+), 2 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 e9bfc39ee..0afe01fc7 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 @@ -236,9 +236,9 @@ public class ZCLogicLoop { if (previousSection == null) return null; if (route != null) { //道岔进路锁闭 - if (relSwitch.isLoss() && nextSection == null) { //失表且下个区段为null(如果下个区段不为null,说明已经越过了失表的道岔) + if (relSwitch.isLoss()) { //失表且下个区段 return new MovementAuthority.End(previousSection, MovementAuthority.EndType.FAULT_SWITCH); - } else if (nextSection.getRelSwitch() == relSwitch){ //下个区段的关联道岔与当前区段关联道岔一样(说明没越过该道岔) + } else { List flsList = route.getFlsList(); if (!CollectionUtils.isEmpty(flsList)) { List fls = flsList.stream() From 1b5a6cc68eeb1a6eeb4f5006ee25bcc2cd8fe1e7 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Tue, 13 Jul 2021 14:58:15 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E5=89=8D?= =?UTF-8?q?=E6=96=B9=E5=88=97=E8=BD=A6=E7=9A=84=E7=A7=BB=E5=8A=A8=E6=8E=88?= =?UTF-8?q?=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 | 37 +++++++++------ .../cbtc/data/CalculateService.java | 11 +---- .../cbtc/data/support/MovementAuthority.java | 46 ++++++++++--------- 3 files changed, 50 insertions(+), 44 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 0afe01fc7..a55ce1141 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 @@ -175,6 +175,8 @@ public class ZCLogicLoop { MovementAuthority.End end = checkSwitch(section, right); if (end != null) endList.add(end); + //前方列车 + MovementAuthority.End trainEnd = checkSectionOccupied(section); // 轨道尽头/问题道岔 Section temp = section.getNextRunningSectionOf(right); if (Objects.isNull(temp)) { // 到尽头 @@ -198,22 +200,31 @@ public class ZCLogicLoop { section = temp; } - // 前方列车 - VirtualRealityTrain frontTrain = this.queryFrontTrain(train, trainList); - if (Objects.nonNull(frontTrain)) { - Section baseSection; - if (Objects.equals(frontTrain.isRight(), train.isRight())) { - baseSection = frontTrain.calculateTailPosition().getSection(); - } else { - baseSection = frontTrain.getHeadPosition().getSection(); - } - endList.add(new MovementAuthority.End(frontTrain, - MovementAuthority.EndType.FRONT_TRAIN, - baseSection)); - } +// // 前方列车 +// VirtualRealityTrain frontTrain = this.queryFrontTrain(train, trainList); +// if (Objects.nonNull(frontTrain)) { +// Section baseSection; +// if (Objects.equals(frontTrain.isRight(), train.isRight())) { +// baseSection = frontTrain.calculateTailPosition().getSection(); +// } else { +// baseSection = frontTrain.getHeadPosition().getSection(); +// } +// endList.add(new MovementAuthority.End(frontTrain, +// MovementAuthority.EndType.FRONT_TRAIN, +// baseSection)); +// } return endList; } + private MovementAuthority.End checkSectionOccupied(Section section) { + for (Section logic : section.getLogicList()) { + if (logic.isCtOccupied()) { + return new MovementAuthority.End(section, MovementAuthority.EndType.FRONT_TRAIN, null); + } + } + return null; + } + private MovementAuthority.End checkSwitch(Section tailSection, Section headSection, boolean right) { Section section = tailSection; for (int i = 0; i < 10; i++) { 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 9f9e2760f..25c2865d8 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 @@ -1244,18 +1244,9 @@ public class CalculateService { if (section.isPhysical()) { return sectionPosition; } else { - int offset = 0; Section parent = section.getParent(); if (parent != null) { - for (Section logicSection : parent.getLogicList()) { - if (!logicSection.equals(section)) { - offset += logicSection.getLen(); - } else { - offset += sectionPosition.getOffset(); - break; - } - } - return new SectionPosition(parent, offset); + return new SectionPosition(parent, section.getMinOffset() + sectionPosition.getOffset()); } else { 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 1ee79c6d2..ca44cbb41 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 @@ -109,26 +109,30 @@ public class MovementAuthority { return new SectionPosition(section, offset); } case FRONT_TRAIN: { - VirtualRealityTrain train = (VirtualRealityTrain) this.device; - boolean trainRight = train.isRight(); - SectionPosition headPosition = train.getHeadPosition(); - SectionPosition tailPosition = CalculateService - .calculateNextPositionByStartAndLen(headPosition, !right, train.getLen()); - float offset; - if (Objects.equals(trainRight, right)) { // 同向,取车尾 - offset = right - ? - tailPosition.getOffset() - 2 * SimulationConstants.TRAIN_SAFE_DISTANCE - : - tailPosition.getOffset() + 2 * SimulationConstants.TRAIN_SAFE_DISTANCE; - } else { // 方向相反,取车头 - offset = right - ? - headPosition.getOffset() - 2 * SimulationConstants.TRAIN_SAFE_DISTANCE - : - headPosition.getOffset() + 2 * SimulationConstants.TRAIN_SAFE_DISTANCE; - } - return new SectionPosition(this.baseSection, offset); + Section section = (Section) this.device; + return new SectionPosition(section.getParent(), right ? section.getMinOffset() : section.getMaxOffset()); + + +// VirtualRealityTrain train = (VirtualRealityTrain) this.device; +// boolean trainRight = train.isRight(); +// SectionPosition headPosition = train.getHeadPosition(); +// SectionPosition tailPosition = CalculateService +// .calculateNextPositionByStartAndLen(headPosition, !right, train.getLen()); +// float offset; +// if (Objects.equals(trainRight, right)) { // 同向,取车尾 +// offset = right +// ? +// tailPosition.getOffset() - 2 * SimulationConstants.TRAIN_SAFE_DISTANCE +// : +// tailPosition.getOffset() + 2 * SimulationConstants.TRAIN_SAFE_DISTANCE; +// } else { // 方向相反,取车头 +// offset = right +// ? +// headPosition.getOffset() - 2 * SimulationConstants.TRAIN_SAFE_DISTANCE +// : +// headPosition.getOffset() + 2 * SimulationConstants.TRAIN_SAFE_DISTANCE; +// } +// return new SectionPosition(this.baseSection, offset); } case END_TRACK: { Section section = (Section) this.device; @@ -138,7 +142,7 @@ public class MovementAuthority { case UNLOCKED_OVERLAP: case FAULT_SWITCH: { Section section = (Section) this.device; - float offset = right ? 0 : section.getLen(); + float offset = right ? section.getLen() : 0; SectionPosition stopPosition = new SectionPosition(section, offset); return CalculateService.calculateNextPositionByStartAndLen(stopPosition, !right, 100); } From f629002d95e163641ac645f1952a2e074ffc048b Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Wed, 14 Jul 2021 09:37:08 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../joylink/rtss/vo/map/MapGraphDataNewVO.java | 5 +++++ .../joylink/rtss/vo/map/display/DisplayVO.java | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 src/main/java/club/joylink/rtss/vo/map/display/DisplayVO.java diff --git a/src/main/java/club/joylink/rtss/vo/map/MapGraphDataNewVO.java b/src/main/java/club/joylink/rtss/vo/map/MapGraphDataNewVO.java index bb8d855a1..43cbba12f 100644 --- a/src/main/java/club/joylink/rtss/vo/map/MapGraphDataNewVO.java +++ b/src/main/java/club/joylink/rtss/vo/map/MapGraphDataNewVO.java @@ -1,6 +1,7 @@ package club.joylink.rtss.vo.map; import club.joylink.rtss.util.JsonUtils; +import club.joylink.rtss.vo.map.display.DisplayVO; import lombok.Getter; import lombok.Setter; import org.springframework.util.StringUtils; @@ -38,6 +39,10 @@ public class MapGraphDataNewVO { * 大屏配置 */ private BigScreenConfig bigScreenConfig; + + /** 显示配置 */ + private List displayList; + /** * 联锁数据生成配置 */ diff --git a/src/main/java/club/joylink/rtss/vo/map/display/DisplayVO.java b/src/main/java/club/joylink/rtss/vo/map/display/DisplayVO.java new file mode 100644 index 000000000..460f85215 --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/map/display/DisplayVO.java @@ -0,0 +1,16 @@ +package club.joylink.rtss.vo.map.display; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +@NoArgsConstructor +public class DisplayVO { + private List stationCodeList; + + private List elementList; +}