Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
joylink_zhangsai 2021-02-23 15:59:37 +08:00
commit 3d8564ae84
9 changed files with 102 additions and 21 deletions

View File

@ -329,13 +329,16 @@ public class SignalGeneratorNew implements GeneratorNew {
}
case Signal_Set_Guide: {
// 若信号机可开引导信号则生成实训暂不设置背景暂时先简单处理此处业务比较复杂需明确后再生成各种情况的实训
if (signal.isCallOn()) { // 不是引导信号机不生成
// if (signal.isCallOn()) { // 不是引导信号机不生成
//非折返进路办理引导
List<Route> notTurnBackRouteList = routeList.stream()
.filter(route -> !route.isTurnBack())
.collect(Collectors.toList());
if (routeLikeHa1) {
// 对于ATP进路地面联锁进路引导进路类的取引导进路
if (routeLikeHa1 ) {
if (!signal.isCallOn()) {
continue;
}
// 对于ATP进路地面联锁进路引导进路类的取引导进路
notTurnBackRouteList = notTurnBackRouteList.stream()
.filter(route -> route.isGuide())
.collect(Collectors.toList());
@ -346,11 +349,16 @@ public class SignalGeneratorNew implements GeneratorNew {
deviceStatusModifyTool.closeSignalDirectly(route.getStart());
}
deviceStatusModifyTool.loadManualTrainOfGroup(simulation, "001",signal.getSection(),signal.isRight());
if(operateDefinitionVO.onlyOperateSignal()){
trainingVOList.add(this.build(config, simulation, signal,null, operateDefinitionVO));
simulation.reset();
break;
}
trainingVOList.add(this.build(config, simulation, route,null, operateDefinitionVO));
// 仿真重置
simulation.reset();
}
}
// }
continue;
}
case Signal_Close_Guide: {
@ -376,7 +384,7 @@ public class SignalGeneratorNew implements GeneratorNew {
}
case Signal_Cancel_Guide: {
// 若信号可开放引导信号生成实训背景设置为开放引导进路/开放引导信号
if (signal.isCallOn()) {
// if (signal.isCallOn()) {
if (!CollectionUtils.isEmpty(routeList)) {
for (Route route : routeList) {
if (routeLikeHa1 &&
@ -386,12 +394,17 @@ public class SignalGeneratorNew implements GeneratorNew {
}
if (!route.isTurnBack()) {
this.deviceStatusModifyTool.openGuideRouteDirect(simulation, route);
if(operateDefinitionVO.onlyOperateSignal()){
trainingVOList.add(this.build(config, simulation, signal,null, operateDefinitionVO));
simulation.reset();
break;
}
trainingVOList.add(this.build(config, simulation, route,null, operateDefinitionVO));
// 仿真重置
simulation.reset();
}
}
}
// }
// else if(Objects.nonNull(signal.getAutoSignal())) { // 信号机是自动信号
// this.deviceStatusModifyTool.openGuideSignalDirectly(signal);
// trainingVOList.add(this.build(config, simulation, signal, operateDefinitionVO));

View File

@ -41,4 +41,6 @@ public interface AtsApiService {
* @param sectionCode
*/
void handleTrainOnTransfer(Simulation simulation, String groupNumber, String sectionCode);
void cancelStandSkipSetOfTrain(Simulation simulation, String groupNumber, String standCode);
}

View File

@ -1,10 +1,12 @@
package club.joylink.rtss.simulation.cbtc.ATS;
import club.joylink.rtss.simulation.cbtc.ATS.service.AtsPlanService;
import club.joylink.rtss.simulation.cbtc.ATS.service.AtsStandService;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import club.joylink.rtss.simulation.cbtc.data.map.Section;
import club.joylink.rtss.simulation.cbtc.data.map.Stand;
import club.joylink.rtss.simulation.cbtc.data.map.Station;
import club.joylink.rtss.simulation.cbtc.data.support.TrainStopMessage;
import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo;
@ -25,6 +27,9 @@ public class AtsApiServiceImpl implements AtsApiService {
@Autowired
private AtsPlanService atsPlanService;
@Autowired
private AtsStandService atsStandService;
@Autowired
private ATSMessageCollectAndDispatcher atsMessageCollectAndDispatcher;
@ -72,4 +77,14 @@ public class AtsApiServiceImpl implements AtsApiService {
this.atsPlanService.handleTrainOnTransfer(simulation, train, section);
}
@Override
public void cancelStandSkipSetOfTrain(Simulation simulation, String groupNumber, String standCode) {
SimulationDataRepository repository = simulation.getRepository();
TrainInfo train = repository.findSupervisedTrainByGroup(groupNumber);
if (Objects.isNull(train)) {
return;
}
atsStandService.cancelJumpStop(simulation, standCode,groupNumber);
}
}

View File

@ -165,6 +165,10 @@ public class Operation {
Stand_Set_Jump_Stop(),
/** 取消跳停 */
Stand_Cancel_Jump_Stop(),
/** 全站台设置跳停 */
Stand_All_Set_Jump_Stop(),
/** 全站台取消跳停 */
Stand_All_Cancel_Jump_Stop(),
/** 设置扣车 */
Stand_Set_Hold_Train(),
/** 取消扣车 */

View File

@ -39,6 +39,23 @@ public class StandOperateHandler {
atsStandService.cancelJumpStop(simulation, standCode, trainGroupNumber);
}
/**
* 多站台设置跳停
*/
@OperateHandlerMapping(type = Operation.Type.Stand_All_Set_Jump_Stop)
public void setJumpStop(Simulation simulation, List<String> standCodes, String trainGroupNumber) {
standCodes.forEach(s -> atsStandService.setJumpStop(simulation, s, trainGroupNumber));
}
/**
* 多站台取消跳停
*/
@OperateHandlerMapping(type = Operation.Type.Stand_All_Cancel_Jump_Stop)
public void cancelJumpStop(Simulation simulation, List<String> standCodes, String trainGroupNumber) {
standCodes.forEach(s -> atsStandService.cancelJumpStop(simulation, s, trainGroupNumber));
}
/**
* 设置扣车
*/

View File

@ -120,6 +120,7 @@ public class AtsStandService {
standList.forEach(stand -> stand.setTrainParking(false));
}
/**
* 设置站台跳停指定列车跳停
*/

View File

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

View File

@ -215,6 +215,14 @@ public class ATPLogicLoop {
case OPEN_DOOR: // 开门
if (train.isJump()) { // 列车跳停,跳过开门
train.earlyDeparture();
if (simulation.getRepository().getConfig().isStandSkipSetTrainOnlyOnce()) {
List<Stand> 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)) {
@ -234,7 +242,7 @@ public class ATPLogicLoop {
}
break;
case CLOSE_DOOR: // 关门
Signal signal = train.getHeadPosition().getSection().getSignalOf(train.isRight());
// Signal signal = train.getHeadPosition().getSection().getSignalOf(train.isRight());
if (!train.isHold() || simulation.getRepository().getConfig().isAllowEarlyDepartureWhenHoldTrain()) { // 列车未扣车或允许在扣车状态下提前发车
// if (Objects.nonNull(signal) && !signal.isNormalOpen()) {
// if (!train.isRMMode() && !train.isNRMMode()) {
@ -638,21 +646,31 @@ public class ATPLogicLoop {
*/
private void checkTrainJumpAndSend2Ats(Simulation simulation, VirtualRealityTrain train,
SectionPosition headPosition, SectionPosition tailPosition, boolean right) {
if (!train.isStop()) { // 列车未停车
// 判断列车是否成功跳站
Station nextStation = train.getNextStation();
if (Objects.nonNull(nextStation)) {
Section tailSection = tailPosition.getSection();
if (tailSection.isNormalStandTrack() &&
Objects.equals(nextStation, tailSection.getStation())) {
// 列车尾部在计划的下一站台轨
SectionPosition standEndPosition = new SectionPosition(tailSection, right ? tailSection.getLen() : 0);
Float distance = CalculateService.calculateDistance(standEndPosition, headPosition, right);
if (Objects.nonNull(distance) && distance > 5) {
// 列车成功越站
this.atsApiService.handleTrainPassingStation(simulation, train.getGroupNumber(),
nextStation.getCode(), tailSection.getCode());
if (train.isStop()) {
return;
}
// 列车未停车
// 判断列车是否成功跳站
Station nextStation = train.getNextStation();
if (Objects.isNull(nextStation)) {
return;
}
Section tailSection = tailPosition.getSection();
if (tailSection.isNormalStandTrack() &&
Objects.equals(nextStation, tailSection.getStation())) {
// 列车尾部在计划的下一站台轨
SectionPosition standEndPosition = new SectionPosition(tailSection, right ? tailSection.getLen() : 0);
Float distance = CalculateService.calculateDistance(standEndPosition, headPosition, right);
if (Objects.nonNull(distance) && distance > 5) {
// 列车成功越站
this.atsApiService.handleTrainPassingStation(simulation, train.getGroupNumber(),
nextStation.getCode(), tailSection.getCode());
if (simulation.getRepository().getConfig().isStandSkipSetTrainOnlyOnce()) {
List<Stand> 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()));
}
}
}

View File

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