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 0aead1d0e..f76371565 100644 --- a/src/main/java/club/joylink/rtss/services/psl/VirtualRealityPslService.java +++ b/src/main/java/club/joylink/rtss/services/psl/VirtualRealityPslService.java @@ -60,25 +60,23 @@ public class VirtualRealityPslService implements IVirtualRealityPslService { private void theButtonIsPressed(Simulation simulation, VirtualRealityPsl vrPsl, VirtualRealityPsl.Button button) { Stand stand = vrPsl.getStand(); - synchronized (vrPsl) { - switch (button) { - case YXJZ: - vrPsl.setYxjzKey(!vrPsl.isYxjzKey()); - break; - case HSJC: - vrPsl.setHsjcKey(!vrPsl.isHsjcKey()); - ciApiService.setOrCancelInterlockRelease(simulation, stand, vrPsl.isHsjcKey()); - break; - case KM: - ciApiService.openScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL); - break; - case GM: - ciApiService.closeScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL); - break; - case SD: - vrPsl.setSdButton(!vrPsl.isSdButton()); - break; - } + switch (button) { + case YXJZ: + vrPsl.setYxjzKey(!vrPsl.isYxjzKey()); + break; + case HSJC: + vrPsl.setHsjcKey(!vrPsl.isHsjcKey()); + ciApiService.setOrCancelInterlockRelease(simulation, stand, vrPsl.isHsjcKey()); + break; + case KM: + ciApiService.openScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL); + break; + case GM: + ciApiService.closeScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.PSL); + break; + case SD: + vrPsl.setSdButton(!vrPsl.isSdButton()); + break; } } 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 88d9a5597..9edfc9c47 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 @@ -306,7 +306,7 @@ public class ATPLogicLoop { } break; case OPEN_DOOR: // 开门 - if (!train.getDoorMode().equals(VirtualRealityTrain.DoorMode.MM)) { // 不是自动开门 + if (train.isAutoOpenDoor()) { this.atoService.syncOpenDoor(simulation, train); } if (this.isAllDoorOpen(simulation, train)) { @@ -316,16 +316,7 @@ public class ATPLogicLoop { case BOARD: // 乘客乘降 break; case CLOSE_DOOR: // 关门 -// Signal signal = train.getHeadPosition().getSection().getSignalOf(train.isRight()); -// if (Objects.nonNull(signal) && !signal.isNormalOpen()) { -// if (!train.isRMMode() && !train.isNRMMode()) { -// // 信号机未正常开放 -// break; -// } -// } - // 可以关门 -// this.atoService.syncCloseDoor(simulation, train); - if (train.getDoorMode().equals(VirtualRealityTrain.DoorMode.AA)) { // 自动关门 + if (train.isAutoCloseDoor()) { this.atoService.syncCloseDoor(simulation, train); } if (this.isAllDoorClose(simulation, train)) { diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/robot/RobotLogicLoop.java b/src/main/java/club/joylink/rtss/simulation/cbtc/robot/RobotLogicLoop.java index 46037e39e..1cfb16cd0 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/robot/RobotLogicLoop.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/robot/RobotLogicLoop.java @@ -18,6 +18,7 @@ import club.joylink.rtss.simulation.cbtc.data.vo.ControlTransferReplyVO; import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo; import club.joylink.rtss.simulation.cbtc.data.vr.StandParkedTrainActivity; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl; +import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityScreenDoor; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain; import club.joylink.rtss.simulation.cbtc.member.SimulationMember; import club.joylink.rtss.simulation.cbtc.onboard.ATO.SpeedCurve; @@ -66,9 +67,6 @@ public class RobotLogicLoop { } robotReplyControlTransferApplicationLogicLoop(simulation); robotStationControlAutoTransfer(simulation); -// executor.execute(() -> robotDriverLogicLoop(simulation)); -// executor.execute(() -> robotReplyControlTransferApplicationLogicLoop(simulation)); -// executor.execute(() -> robotStationControlAutoTransfer(simulation)); } private void robotOpenATO(Simulation simulation, VirtualRealityTrain train) { @@ -77,30 +75,15 @@ public class RobotLogicLoop { return; switch (activity) { case OPEN_DOOR: - if (!train.isAtoOn()) { + if (!train.isAutoOpenDoor()) { atoService.syncOpenDoor(simulation, train); + usePsl2ControlPsd(simulation, train, true); } break; case CLOSE_DOOR: - atoService.syncCloseDoor(simulation, train); - SectionPosition headPosition = train.getHeadPosition(); - Section section = headPosition.getSection(); - List standList = section.getStandList(); - if (!CollectionUtils.isEmpty(standList)) { - for (Stand stand : standList) { - PSD psd = stand.getPsd(); - if (psd != null && !psd.isCloseAndLock()) { - VirtualRealityPsl vrPsl = stand.getVrPsl(); - if (!vrPsl.isAllowOperation()) { //确保此时允许操作 - iVirtualRealityPslService.pressTheButton(simulation.getId(), - stand.getCode(), VirtualRealityPsl.Button.YXJZ); - } - iVirtualRealityPslService.pressTheButton(simulation.getId(), - stand.getCode(), VirtualRealityPsl.Button.GM); - iVirtualRealityPslService.pressTheButton(simulation.getId(), - stand.getCode(), VirtualRealityPsl.Button.YXJZ); - } - } + if (!train.isAutoCloseDoor()) { + atoService.syncCloseDoor(simulation, train); + usePsl2ControlPsd(simulation, train, false); } break; case START: @@ -113,6 +96,48 @@ public class RobotLogicLoop { } } + /** + * 使用psl控制屏蔽门 + */ + private void usePsl2ControlPsd(Simulation simulation, VirtualRealityTrain train, boolean open) { + SectionPosition headPosition = train.getHeadPosition(); + Section section = headPosition.getSection(); + List standList = section.getStandList(); + if (!CollectionUtils.isEmpty(standList)) { + for (Stand stand : standList) { + PSD psd = stand.getPsd(); + if (psd == null) + continue; + VirtualRealityScreenDoor vrPsd = psd.getVirtualScreenDoor(); + if (open) { + if (!vrPsd.isClose() || vrPsd.isSettingOpen()) { + continue; + } + } else { + if (vrPsd.isLockAndClose() || vrPsd.isSettingClose()) { + continue; + } + } + VirtualRealityPsl vrPsl = stand.getVrPsl(); + if (!vrPsl.isAllowOperation()) { //确保此时允许操作 + iVirtualRealityPslService.pressTheButton(simulation.getId(), + stand.getCode(), VirtualRealityPsl.Button.YXJZ); + } + if (open) { + iVirtualRealityPslService.pressTheButton(simulation.getId(), + stand.getCode(), VirtualRealityPsl.Button.KM); + } else { + iVirtualRealityPslService.pressTheButton(simulation.getId(), + stand.getCode(), VirtualRealityPsl.Button.GM); + } + if (vrPsl.isAllowOperation()) { //将允许禁止钥匙打到禁止位 + iVirtualRealityPslService.pressTheButton(simulation.getId(), + stand.getCode(), VirtualRealityPsl.Button.YXJZ); + } + } + } + } + /** * 机器人司机逻辑循环 */