控制权限转移修改

This commit is contained in:
DU 2021-02-24 18:43:44 +08:00
parent cf2e10b9db
commit e6390321ae
7 changed files with 45 additions and 22 deletions

View File

@ -204,7 +204,7 @@ public class AtsStandService {
public void cancelJumpStop(Simulation simulation, String standCode, String trainGroupNumber) { public void cancelJumpStop(Simulation simulation, String standCode, String trainGroupNumber) {
Stand stand = getStand(simulation, standCode); Stand stand = getStand(simulation, standCode);
if (!stand.isJumpStop()) { if (!stand.isJumpStop()) {
throw new SimulationException(SimulationExceptionType.Operation_Repetition); return;
} }
if (!StringUtils.hasText(trainGroupNumber)) { //如果是取消站台跳停 if (!StringUtils.hasText(trainGroupNumber)) { //如果是取消站台跳停
stand.setAllSkip(false); stand.setAllSkip(false);

View File

@ -488,6 +488,7 @@ public class AtsStationService {
if (agree) { if (agree) {
if (station.getController() == null || Objects.equals(station.getController(), member)) { if (station.getController() == null || Objects.equals(station.getController(), member)) {
station.setController(station.getControlApplicant()); station.setController(station.getControlApplicant());
station.setControlApplicant(null);
} }
return; return;
} }

View File

@ -181,10 +181,10 @@ public class MapConfig {
*/ */
private boolean needApproachLockBeforeSetGuide; private boolean needApproachLockBeforeSetGuide;
/** // /**
* 站台指定列车跳停仅跳停一次 // * 站台指定列车跳停仅跳停一次
*/ // */
private boolean standSkipSetTrainOnlyOnce; // private boolean standSkipSetTrainOnlyOnce;
/** /**
* 封锁命令状态仅在后备模式下有效 * 封锁命令状态仅在后备模式下有效
@ -238,7 +238,7 @@ public class MapConfig {
setSetRouteBeforeSetFlt(configVO.isSetRouteBeforeSetFlt()); setSetRouteBeforeSetFlt(configVO.isSetRouteBeforeSetFlt());
setCancelRouteWhenCancelFlt(configVO.isCancelRouteWhenCancelFlt()); setCancelRouteWhenCancelFlt(configVO.isCancelRouteWhenCancelFlt());
setNeedApproachLockBeforeSetGuide(configVO.isNeedApproachLockBeforeSetGuide()); setNeedApproachLockBeforeSetGuide(configVO.isNeedApproachLockBeforeSetGuide());
setStandSkipSetTrainOnlyOnce(configVO.isStandSkipSetTrainOnlyOnce()); // setStandSkipSetTrainOnlyOnce(configVO.isStandSkipSetTrainOnlyOnce());
setBlockadeCommandOnlyValidInStandbyMode(configVO.isBlockadeCommandOnlyValidInStandbyMode()); setBlockadeCommandOnlyValidInStandbyMode(configVO.isBlockadeCommandOnlyValidInStandbyMode());
setSomeCommandNeedInit(configVO.isSwitchBlockadeCommandNeedInit()); setSomeCommandNeedInit(configVO.isSwitchBlockadeCommandNeedInit());
setStationPreResetBeforeAxlePreReset(configVO.isStationPreResetBeforeAxlePreReset()); setStationPreResetBeforeAxlePreReset(configVO.isStationPreResetBeforeAxlePreReset());

View File

@ -158,7 +158,7 @@ public class ATOService {
// nextStopStandSection.getName(), nextStopStandSection.getCode())); // nextStopStandSection.getName(), nextStopStandSection.getCode()));
boolean parking = true; boolean parking = true;
Signal signal = target.getSignalOf(right); 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; parking = false;
} }
if (parking) { if (parking) {

View File

@ -215,14 +215,14 @@ public class ATPLogicLoop {
case OPEN_DOOR: // 开门 case OPEN_DOOR: // 开门
if (train.isJump()) { // 列车跳停,跳过开门 if (train.isJump()) { // 列车跳停,跳过开门
train.earlyDeparture(); train.earlyDeparture();
if (simulation.getRepository().getConfig().isStandSkipSetTrainOnlyOnce()) { // if (simulation.getRepository().getConfig().isStandSkipSetTrainOnlyOnce()) {
List<Stand> standList = train.getHeadPosition().getSection().getStandList(); List<Stand> standList = train.getHeadPosition().getSection().getStandList();
if (!CollectionUtils.isEmpty(standList)) { if (!CollectionUtils.isEmpty(standList)) {
standList.stream().filter(stand -> stand.isGivenTrainSkip(train.getGroupNumber())).forEach(stand -> { standList.stream().filter(stand -> stand.isGivenTrainSkip(train.getGroupNumber())).forEach(stand -> {
atsApiService.cancelStandSkipSetOfTrain(simulation,train.getGroupNumber(), stand.getCode()); atsApiService.cancelStandSkipSetOfTrain(simulation,train.getGroupNumber(), stand.getCode());
}); });
} }
} // }
} else { } else {
this.atoService.syncOpenDoor(simulation, train); this.atoService.syncOpenDoor(simulation, train);
if (this.isAllDoorOpen(simulation, train)) { if (this.isAllDoorOpen(simulation, train)) {
@ -665,13 +665,13 @@ public class ATPLogicLoop {
// 列车成功越站 // 列车成功越站
this.atsApiService.handleTrainPassingStation(simulation, train.getGroupNumber(), this.atsApiService.handleTrainPassingStation(simulation, train.getGroupNumber(),
nextStation.getCode(), tailSection.getCode()); nextStation.getCode(), tailSection.getCode());
if (simulation.getRepository().getConfig().isStandSkipSetTrainOnlyOnce()) { // if (simulation.getRepository().getConfig().isStandSkipSetTrainOnlyOnce()) {
List<Stand> standList = train.getHeadPosition().getSection().getStandList(); // List<Stand> standList = train.getHeadPosition().getSection().getStandList();
if (CollectionUtils.isEmpty(standList)) { // if (CollectionUtils.isEmpty(standList)) {
return; // return;
} // }
standList.stream().filter(stand -> stand.isGivenTrainSkip(train.getGroupNumber())).forEach(stand -> atsApiService.cancelStandSkipSetOfTrain(simulation, train.getGroupNumber(), stand.getCode())); // standList.stream().filter(stand -> stand.isGivenTrainSkip(train.getGroupNumber())).forEach(stand -> atsApiService.cancelStandSkipSetOfTrain(simulation, train.getGroupNumber(), stand.getCode()));
} // }
} }
} }
} }

View File

@ -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.member.SimulationMember;
import club.joylink.rtss.simulation.cbtc.onboard.ATO.SpeedCurve; import club.joylink.rtss.simulation.cbtc.onboard.ATO.SpeedCurve;
import org.springframework.beans.factory.annotation.Autowired; 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 org.springframework.stereotype.Component;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -38,13 +41,20 @@ public class RobotLogicLoop {
@Autowired @Autowired
private DriverOperateHandler driverOperateHandler; private DriverOperateHandler driverOperateHandler;
@Qualifier("nsExecutor")
@Autowired
private TaskExecutor executor;
/** /**
* 根据目标位置运行 * 根据目标位置运行
*/ */
public void run(Simulation simulation) { 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<SimulationMember, List<Station>> 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);
});
}
/** /**
* 机器人回复控制权转换申请 * 机器人回复控制权转换申请
* *

View File

@ -120,10 +120,10 @@ public class RealLineConfigVO {
*/ */
private boolean needApproachLockBeforeSetGuide = true; private boolean needApproachLockBeforeSetGuide = true;
/** // /**
* 站台指定列车跳停仅跳停一次 // * 站台指定列车跳停仅跳停一次
*/ // */
private boolean standSkipSetTrainOnlyOnce; // private boolean standSkipSetTrainOnlyOnce;
/** /**
* 封锁命令状态仅在后备模式下有效 * 封锁命令状态仅在后备模式下有效