信号机自排关和进路自动触发实训生成逻辑分开

This commit is contained in:
joylink_zhangsai 2020-11-27 15:06:02 +08:00
parent 76df1f7cd0
commit 91e23f39fc

View File

@ -30,7 +30,7 @@ public class SignalGeneratorNew implements GeneratorNew {
OperateDefinitionVO operateDefinitionVO) {
List<TrainingNewVO> trainingVOList = new ArrayList<>();
switch (Operation.Type.valueOf(operateDefinitionVO.getOperateType())) {
case Signal_Set_Auto_Turn_Back:{
case Signal_Set_Auto_Turn_Back: {
List<Cycle> cycleList = simulation.getRepository().getCycleList();
for (Cycle cycle : cycleList) {
trainingVOList.add(this.build(config, simulation, cycle, operateDefinitionVO));
@ -39,7 +39,7 @@ public class SignalGeneratorNew implements GeneratorNew {
}
return trainingVOList;
}
case Signal_Cancel_Auto_Turn_Back:{
case Signal_Cancel_Auto_Turn_Back: {
// 设置背景自动折返为已设置
List<Cycle> cycleList = simulation.getRepository().getCycleList();
for (Cycle cycle : cycleList) {
@ -55,14 +55,14 @@ public class SignalGeneratorNew implements GeneratorNew {
List<Signal> signalList = simulation.getRepository().getSignalList();
for (Signal signal : signalList) {
if(signal.isVirtual()) continue;
if (signal.isVirtual()) continue;
List<Route> routeList = signal.getRouteList();
boolean routeLikeHa1 = simulation.getRepository().getConfig().isRouteLikeHa1();
switch (Operation.Type.valueOf (operateDefinitionVO.getOperateType())) {
switch (Operation.Type.valueOf(operateDefinitionVO.getOperateType())) {
case Signal_Block:
case Signal_Find_Routes_Status:
break;
case Signal_Set_Route:{
case Signal_Set_Route: {
if (!CollectionUtils.isEmpty(routeList)) {
for (Route route : routeList) {
// 类似哈尔滨一号线根据配置各类进路分别生成
@ -80,8 +80,7 @@ public class SignalGeneratorNew implements GeneratorNew {
}
continue;
}
case Signal_Set_CI_Auto_Trigger:
case Signal_Close_Auto_Setting:{
case Signal_Set_CI_Auto_Trigger: {
if (!CollectionUtils.isEmpty(routeList)) {
if (routeLikeHa1) {
trainingVOList.add(this.build(config, simulation, signal, operateDefinitionVO));
@ -105,8 +104,32 @@ public class SignalGeneratorNew implements GeneratorNew {
}
continue;
}
case Signal_Close_Auto_Setting: {
if (!CollectionUtils.isEmpty(routeList)) {
if (routeLikeHa1) {
trainingVOList.add(this.build(config, simulation, signal, operateDefinitionVO));
simulation.reset();
continue;
} else {
for (Route route : routeList) {
// 类似哈尔滨一号线根据配置各类进路分别生成
if ((operateDefinitionVO.isAtp() && !route.isAtp())
|| (operateDefinitionVO.isGround() && !route.isGround())) {
continue;
}
if (route.isGuide()) { // 引导进路跳过
continue;
}
trainingVOList.add(this.build(config, simulation, route, operateDefinitionVO));
// 仿真重置
simulation.reset();
}
}
}
continue;
}
case Signal_Total_Cancel: // 总取消暂时只生成取消未接近锁闭的进路这一种场景的实训
case Signal_Cancel_Route:{
case Signal_Cancel_Route: {
// 查询以信号机为始端的进路列表设置背景为进路已排列
if (!CollectionUtils.isEmpty(routeList)) {
for (Route route : routeList) {
@ -126,7 +149,7 @@ public class SignalGeneratorNew implements GeneratorNew {
}
continue;
}
case Signal_Human_Release_Route:{
case Signal_Human_Release_Route: {
// 查询信号机为始端的进路列表设置背景为进路排列且进路接近区段占用
// todo 接近区段设置列车逻辑较复杂推迟实现
continue;
@ -141,7 +164,7 @@ public class SignalGeneratorNew implements GeneratorNew {
// }
// continue;
}
case Signal_Close_Signal:{
case Signal_Close_Signal: {
// 查询进路设置背景为进路已排列
if (!CollectionUtils.isEmpty(routeList)) {
for (Route route : routeList) {
@ -156,7 +179,7 @@ public class SignalGeneratorNew implements GeneratorNew {
}
continue;
}
case Signal_Reopen_Signal:{
case Signal_Reopen_Signal: {
// 查询进路列表设置背景为进路已排列且信号机关闭
if (!CollectionUtils.isEmpty(routeList)) {
for (Route route : routeList) {
@ -172,12 +195,12 @@ public class SignalGeneratorNew implements GeneratorNew {
}
continue;
}
case Signal_Unblock:{
case Signal_Unblock: {
// 背景为信号机封锁
signal.setBlockade(true);
break;
}
case Signal_Open_Auto_Setting:{
case Signal_Open_Auto_Setting: {
// 查询进路列表背景为进路人工控
if (!CollectionUtils.isEmpty(routeList)) {
if (routeLikeHa1) {
@ -201,7 +224,7 @@ public class SignalGeneratorNew implements GeneratorNew {
}
continue;
}
case Signal_Set_CI_Auto:{
case Signal_Set_CI_Auto: {
// 查询自动进路列表背景为进路已排列
if (!CollectionUtils.isEmpty(routeList)) {
List<Route> fltRouteList = routeList.stream()
@ -216,7 +239,7 @@ public class SignalGeneratorNew implements GeneratorNew {
}
continue;
}
case Signal_Cancel_CI_Auto:{
case Signal_Cancel_CI_Auto: {
// 查询自动进路列表背景为进路已排列且已设置为自动进路模式
if (!CollectionUtils.isEmpty(routeList)) {
List<Route> fltRouteList = routeList.stream()
@ -232,7 +255,7 @@ public class SignalGeneratorNew implements GeneratorNew {
}
continue;
}
case Signal_Cancel_CI_Auto_Trigger:{
case Signal_Cancel_CI_Auto_Trigger: {
if (!CollectionUtils.isEmpty(routeList)) {
// 查询自动触发进路列表背景为自动触发进路的联锁自动触发模式已设置
List<Route> arcRouteList = routeList.stream()
@ -256,7 +279,7 @@ public class SignalGeneratorNew implements GeneratorNew {
}
continue;
}
case Signal_Set_Guide:{
case Signal_Set_Guide: {
// 若信号机可开引导信号则生成实训暂不设置背景暂时先简单处理此处业务比较复杂需明确后再生成各种情况的实训
if (!signal.isCallOn()) { // 不是引导信号机不生成
continue;
@ -279,7 +302,7 @@ public class SignalGeneratorNew implements GeneratorNew {
continue;
}
}
case Signal_Close_Guide:{
case Signal_Close_Guide: {
// 若信号可开放引导信号生成实训背景设置为开放引导进路/开放引导信号
if (signal.isCallOn()) {
if (!CollectionUtils.isEmpty(routeList)) {
@ -291,7 +314,7 @@ public class SignalGeneratorNew implements GeneratorNew {
simulation.reset();
}
}
} else if(Objects.nonNull(signal.getAutoSignal())) { // 信号机是自动信号
} else if (Objects.nonNull(signal.getAutoSignal())) { // 信号机是自动信号
this.deviceStatusModifyTool.openGuideSignalDirectly(signal);
trainingVOList.add(this.build(config, simulation, signal, operateDefinitionVO));
// 仿真重置
@ -300,7 +323,7 @@ public class SignalGeneratorNew implements GeneratorNew {
}
continue;
}
case Signal_Cancel_Guide:{
case Signal_Cancel_Guide: {
// 若信号可开放引导信号生成实训背景设置为开放引导进路/开放引导信号
if (signal.isCallOn()) {
if (!CollectionUtils.isEmpty(routeList)) {