From c56e657ecf7de42b6a8f9817713b0c343cadef86 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Thu, 28 Apr 2022 17:01:01 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=8E=A5=E5=8F=91=E8=BE=85=E5=8A=A9?= =?UTF-8?q?=E7=81=AF=E7=8A=B6=E6=80=81=E9=80=BB=E8=BE=91=E9=87=8D=E5=86=99?= =?UTF-8?q?=E3=80=91=20=E3=80=90=E8=BE=85=E5=8A=A9=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=EF=BC=88=E9=80=BB=E8=BE=91=E6=9C=AA=E5=AE=8C?= =?UTF-8?q?=E6=88=90=EF=BC=89=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cbtc/ATS/operation/Operation.java | 15 +++++++ .../StationDirectionOperateHandler.java | 42 ++++++++++++++++++- .../assist/StationDirectionService.java | 24 +++++++++++ .../cbtc/data/map/StationDirection.java | 39 +++++++++++++---- 4 files changed, 111 insertions(+), 9 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java index 6d6d0ef77..fb3cff006 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/Operation.java @@ -839,6 +839,21 @@ public class Operation { * 改方按钮操作 */ ASSIST_PRESS_DOWN_TURN_DIRECTION, + + /** + * 总辅助按钮操作 + */ + ASSIST_PRESS_MAIN_ASSIST, + + /** + * 接辅助按钮操作 + */ + ASSIST_PRESS_RECEIVE_ASSIST, + + /** + * 发辅助按钮操作 + */ + ASSIST_PRESS_DELIVER_ASSIST } /** diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StationDirectionOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StationDirectionOperateHandler.java index 5f10a27f1..04746827a 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StationDirectionOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/StationDirectionOperateHandler.java @@ -23,7 +23,7 @@ public class StationDirectionOperateHandler { * * @param simulation 仿真数据 * @param stationCode 车站编码 - * @param labelEnum 按钮类型 + * @param labelEnum 运行方向 * @param pressDown 弹起:0;按下:1 */ @OperateHandlerMapping(type = Operation.Type.ASSIST_PRESS_DOWN_TURN_DIRECTION) @@ -38,4 +38,44 @@ public class StationDirectionOperateHandler { , Button.ButtonTypeEnum.CHANGE_DIRECTION, isPressDown, validInterface, null); } + /** + * 总辅助按钮操作 + * + * @param simulation 仿真数据 + * @param stationCode 车站编码 + * @param labelEnum 运行方向 + * @param pressDown 弹起:0;按下:1 + */ + @OperateHandlerMapping(type = Operation.Type.ASSIST_PRESS_MAIN_ASSIST) + public void pressMainAssist(Simulation simulation, String stationCode, DirectionLabelEnum labelEnum + , Integer pressDown) { + stationDirectionService.changeButtonAspect(simulation, stationCode, labelEnum, Button.ButtonTypeEnum.MAIN_ASSIST + , (pressDown == 1), null, null); + } + + /** + * 按下接辅助 + * + * @param simulation 仿真数据 + * @param stationCode 车站编码 + * @param labelEnum 运行方向 + */ + @OperateHandlerMapping(type = Operation.Type.ASSIST_PRESS_RECEIVE_ASSIST) + public void pressReceiveAssist(Simulation simulation, String stationCode, DirectionLabelEnum labelEnum) { + stationDirectionService.changeButtonAspect(simulation, stationCode, labelEnum, Button.ButtonTypeEnum.RECEIVE_ASSIST + , Boolean.TRUE, stationDirectionService.turnAssistValid, stationDirectionService.receiveAssistThen); + } + + /** + * 按下发辅助 + * + * @param simulation 仿真数据 + * @param stationCode 车站编码 + * @param labelEnum 运行方向 + */ + @OperateHandlerMapping(type = Operation.Type.ASSIST_PRESS_DELIVER_ASSIST) + public void pressDeliverAssist(Simulation simulation, String stationCode, DirectionLabelEnum labelEnum) { + stationDirectionService.changeButtonAspect(simulation, stationCode, labelEnum, Button.ButtonTypeEnum.DELIVER_ASSIST + , Boolean.TRUE, stationDirectionService.turnAssistValid, stationDirectionService.deliverAssistThen); + } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/assist/StationDirectionService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/assist/StationDirectionService.java index 8e0513853..a0294e2aa 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/assist/StationDirectionService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/assist/StationDirectionService.java @@ -107,6 +107,30 @@ public class StationDirectionService { } }; + + /** + * 接、发辅助按钮操作校验 + */ + public ButtonValidInterface turnAssistValid = (simulation, stationLabelEnum) -> { + if (!stationLabelEnum.isMainAssistStatus()) { + throw new SimulationException(SimulationExceptionType.Operation_Cannot_handed, "操作异常:总辅助按钮未按下"); + } + }; + + /** + * 接辅助按钮后续操作 + */ + public ButtonThenInterface receiveAssistThen = (simulation, stationLabelEnum) -> { + + }; + + /** + * 接辅助按钮后续操作 + */ + public ButtonThenInterface deliverAssistThen = (simulation, stationLabelEnum) -> { + + }; + /** * 获取当前车站实体 * diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/StationDirection.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/StationDirection.java index 14bc29241..08c175999 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/StationDirection.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/StationDirection.java @@ -18,6 +18,17 @@ import java.util.List; @Getter @Slf4j public class StationDirection extends MapNamedElement { + + /** + * 发辅助默认倒计时 25s + */ + public static final int DEFAULT_DELIVER_DELAY_TIME = 25 * 1000; + + /** + * 接辅助默认倒计时 15s + */ + public static final int DEFAULT_RECEIVE_DELAY_TIME = 15 * 1000; + /** * 车站 */ @@ -170,17 +181,12 @@ public class StationDirection extends MapNamedElement { // 进路区段占用判断点灯颜色 if (ReceiveAndDeliverModel.RECEIVE.equals(this.receiveAndDeliver)) { deliverAspect = IndicatorStatusEnum.No; - boolean receiveSectionBlock = this.receiveRouteList - .stream() - .anyMatch(route -> route.getSectionList().stream().anyMatch(Section::isRouteLock)); - receiveAspect = receiveSectionBlock ? IndicatorStatusEnum.R : IndicatorStatusEnum.Y; + // 接车进路锁闭 + receiveAspect = judgeSignalLock() ? IndicatorStatusEnum.R : IndicatorStatusEnum.Y; } else if (ReceiveAndDeliverModel.DELIVER.equals(this.receiveAndDeliver)) { receiveAspect = IndicatorStatusEnum.No; // 发车进路锁闭 - boolean deliverSectionBlock = this.deliverRouteList - .stream() - .anyMatch(route -> route.getSectionList().stream().anyMatch(Section::isRouteLock)); - deliverAspect = deliverSectionBlock ? IndicatorStatusEnum.R : IndicatorStatusEnum.G; + deliverAspect = judgeSignalLock() ? IndicatorStatusEnum.R : IndicatorStatusEnum.G; } else { receiveAspect = this.receiveAspect; deliverAspect = this.receiveAspect; @@ -226,6 +232,23 @@ public class StationDirection extends MapNamedElement { } } + /** + * 如果信号灯所在区段任意一边被锁闭 + * + * @return 锁闭状态 + */ + private boolean judgeSignalLock() { + Section section = this.getSignal().getSection(); + boolean isLock = section.isRouteLock(); + if (!isLock && section.getLeftSection() != null) { + isLock = section.getLeftSection().isRouteLock(); + } + if (!isLock && section.getRightSection() != null) { + isLock = section.getRightSection().isRouteLock(); + } + return isLock; + } + public enum ReceiveAndDeliverModel { // 接 RECEIVE,