From e6390321aefb6000bb944eb6d6b6628f172dd4a3 Mon Sep 17 00:00:00 2001 From: DU Date: Wed, 24 Feb 2021 18:43:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A7=E5=88=B6=E6=9D=83=E9=99=90=E8=BD=AC?= =?UTF-8?q?=E7=A7=BB=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cbtc/ATS/service/AtsStandService.java | 2 +- .../cbtc/ATS/service/AtsStationService.java | 1 + .../simulation/cbtc/data/map/MapConfig.java | 10 +++---- .../cbtc/onboard/ATO/service/ATOService.java | 2 +- .../cbtc/onboard/ATP/ATPLogicLoop.java | 18 ++++++------- .../simulation/cbtc/robot/RobotLogicLoop.java | 26 +++++++++++++++++-- .../rtss/vo/client/map/RealLineConfigVO.java | 8 +++--- 7 files changed, 45 insertions(+), 22 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStandService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStandService.java index 43176c9d9..943349fb0 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStandService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStandService.java @@ -204,7 +204,7 @@ public class AtsStandService { public void cancelJumpStop(Simulation simulation, String standCode, String trainGroupNumber) { Stand stand = getStand(simulation, standCode); if (!stand.isJumpStop()) { - throw new SimulationException(SimulationExceptionType.Operation_Repetition); + return; } if (!StringUtils.hasText(trainGroupNumber)) { //如果是取消站台跳停 stand.setAllSkip(false); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java index a6f8cdfd9..eaa8be8f7 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsStationService.java @@ -488,6 +488,7 @@ public class AtsStationService { if (agree) { if (station.getController() == null || Objects.equals(station.getController(), member)) { station.setController(station.getControlApplicant()); + station.setControlApplicant(null); } return; } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MapConfig.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MapConfig.java index a8fb70422..aa8c80a15 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MapConfig.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MapConfig.java @@ -181,10 +181,10 @@ public class MapConfig { */ private boolean needApproachLockBeforeSetGuide; - /** - * 站台指定列车跳停仅跳停一次 - */ - private boolean standSkipSetTrainOnlyOnce; +// /** +// * 站台指定列车跳停仅跳停一次 +// */ +// private boolean standSkipSetTrainOnlyOnce; /** * 封锁命令(状态)仅在后备模式下有效 @@ -238,7 +238,7 @@ public class MapConfig { setSetRouteBeforeSetFlt(configVO.isSetRouteBeforeSetFlt()); setCancelRouteWhenCancelFlt(configVO.isCancelRouteWhenCancelFlt()); setNeedApproachLockBeforeSetGuide(configVO.isNeedApproachLockBeforeSetGuide()); - setStandSkipSetTrainOnlyOnce(configVO.isStandSkipSetTrainOnlyOnce()); +// setStandSkipSetTrainOnlyOnce(configVO.isStandSkipSetTrainOnlyOnce()); setBlockadeCommandOnlyValidInStandbyMode(configVO.isBlockadeCommandOnlyValidInStandbyMode()); setSomeCommandNeedInit(configVO.isSwitchBlockadeCommandNeedInit()); setStationPreResetBeforeAxlePreReset(configVO.isStationPreResetBeforeAxlePreReset()); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATO/service/ATOService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATO/service/ATOService.java index 49fd116e1..3060a0f71 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATO/service/ATOService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATO/service/ATOService.java @@ -158,7 +158,7 @@ public class ATOService { // nextStopStandSection.getName(), nextStopStandSection.getCode())); boolean parking = true; Signal signal = target.getSignalOf(right); - if (!train.isHold() && (train.isJump() && signal.isNormalOpen() || !train.isNextParking())) { + if (!train.isHold() && (train.isJump() && (Objects.isNull(signal) || signal.isNormalOpen()) || !train.isNextParking())) { parking = false; } if (parking) { 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 8c4e58a48..9010a6a07 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 @@ -215,14 +215,14 @@ public class ATPLogicLoop { case OPEN_DOOR: // 开门 if (train.isJump()) { // 列车跳停,跳过开门 train.earlyDeparture(); - if (simulation.getRepository().getConfig().isStandSkipSetTrainOnlyOnce()) { +// if (simulation.getRepository().getConfig().isStandSkipSetTrainOnlyOnce()) { List standList = train.getHeadPosition().getSection().getStandList(); if (!CollectionUtils.isEmpty(standList)) { standList.stream().filter(stand -> stand.isGivenTrainSkip(train.getGroupNumber())).forEach(stand -> { atsApiService.cancelStandSkipSetOfTrain(simulation,train.getGroupNumber(), stand.getCode()); }); } - } +// } } else { this.atoService.syncOpenDoor(simulation, train); if (this.isAllDoorOpen(simulation, train)) { @@ -665,13 +665,13 @@ public class ATPLogicLoop { // 列车成功越站 this.atsApiService.handleTrainPassingStation(simulation, train.getGroupNumber(), nextStation.getCode(), tailSection.getCode()); - if (simulation.getRepository().getConfig().isStandSkipSetTrainOnlyOnce()) { - List standList = train.getHeadPosition().getSection().getStandList(); - if (CollectionUtils.isEmpty(standList)) { - return; - } - standList.stream().filter(stand -> stand.isGivenTrainSkip(train.getGroupNumber())).forEach(stand -> atsApiService.cancelStandSkipSetOfTrain(simulation, train.getGroupNumber(), stand.getCode())); - } +// if (simulation.getRepository().getConfig().isStandSkipSetTrainOnlyOnce()) { +// List standList = train.getHeadPosition().getSection().getStandList(); +// if (CollectionUtils.isEmpty(standList)) { +// return; +// } +// standList.stream().filter(stand -> stand.isGivenTrainSkip(train.getGroupNumber())).forEach(stand -> atsApiService.cancelStandSkipSetOfTrain(simulation, train.getGroupNumber(), stand.getCode())); +// } } } } 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 43636967e..9cda4657a 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 @@ -14,11 +14,14 @@ import club.joylink.rtss.simulation.cbtc.driving.DrivingService; import club.joylink.rtss.simulation.cbtc.member.SimulationMember; import club.joylink.rtss.simulation.cbtc.onboard.ATO.SpeedCurve; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.core.task.TaskExecutor; import org.springframework.stereotype.Component; import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.stream.Collectors; /** @@ -38,13 +41,20 @@ public class RobotLogicLoop { @Autowired private DriverOperateHandler driverOperateHandler; + @Qualifier("nsExecutor") + @Autowired + private TaskExecutor executor; /** * 根据目标位置运行 */ public void run(Simulation simulation) { - robotDriverLogicLoop(simulation); + executor.execute(() -> robotDriverLogicLoop(simulation)); + executor.execute(() -> robotReplyControlTransferApplicationLogicLoop(simulation)); + executor.execute(() -> robotStationControlAutoTransfer(simulation)); + + + - robotReplyControlTransferApplicationLogicLoop(simulation); } /** @@ -151,6 +161,18 @@ public class RobotLogicLoop { } } + /**机器人自动执行车站控制权限转移*/ + private void robotStationControlAutoTransfer(Simulation simulation) { + if (simulation.getScript() != null && simulation.getScript().isBgSet()) { + return; + } + Map> robotControlStations = simulation.getRepository().getStationList().stream() + .filter(station -> Objects.nonNull(station.getController()) && station.getController().isRobot() && Objects.nonNull(station.getControlApplicant())).collect(Collectors.groupingBy(Station::getController)); + robotControlStations.forEach((controler, stations) -> { + atsStationService.transferControl(simulation, stations.stream().map(Station::getCode).collect(Collectors.toList()), true, controler); + }); + } + /** * 机器人回复控制权转换申请 * diff --git a/src/main/java/club/joylink/rtss/vo/client/map/RealLineConfigVO.java b/src/main/java/club/joylink/rtss/vo/client/map/RealLineConfigVO.java index f4bfb60ce..61388bf74 100644 --- a/src/main/java/club/joylink/rtss/vo/client/map/RealLineConfigVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/map/RealLineConfigVO.java @@ -120,10 +120,10 @@ public class RealLineConfigVO { */ private boolean needApproachLockBeforeSetGuide = true; - /** - * 站台指定列车跳停仅跳停一次 - */ - private boolean standSkipSetTrainOnlyOnce; +// /** +// * 站台指定列车跳停仅跳停一次 +// */ +// private boolean standSkipSetTrainOnlyOnce; /** * 封锁命令(状态)仅在后备模式下有效