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,