diff --git a/src/main/java/club/joylink/rtss/services/VirtualRealityIbpService.java b/src/main/java/club/joylink/rtss/services/VirtualRealityIbpService.java index 7d35d803e..1adcb8cd4 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()); @@ -289,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/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/ATP/ground/ZCLogicLoop.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/ZCLogicLoop.java index e8a51baef..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 @@ -172,17 +172,15 @@ public class ZCLogicLoop { } } // 道岔 - MovementAuthority.End end = checkSwitch(section); + 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)) { // 到尽头 - 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; @@ -202,28 +200,37 @@ 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++) { - 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 +238,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.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()) { //失表且下个区段 + return new MovementAuthority.End(previousSection, MovementAuthority.EndType.FAULT_SWITCH); + } else { + 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 +359,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 +372,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/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)); } } 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 e34e1fa0d..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,40 +109,40 @@ 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; 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(); + float offset = right ? section.getLen() : 0; SectionPosition stopPosition = new SectionPosition(section, offset); return CalculateService.calculateNextPositionByStartAndLen(stopPosition, !right, 100); } 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/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; + } + } } } 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); 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; +}