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

This commit is contained in:
joylink_zhangsai 2020-11-25 16:38:27 +08:00
commit de5fa9030f
2 changed files with 75 additions and 18 deletions

View File

@ -62,12 +62,8 @@ public class SignalGeneratorNew implements GeneratorNew {
case Signal_Block: case Signal_Block:
case Signal_Find_Routes_Status: case Signal_Find_Routes_Status:
break; break;
case Signal_Set_Route: case Signal_Set_Route:{
case Signal_Set_CI_Auto_Trigger: if (!CollectionUtils.isEmpty(routeList)) {
case Signal_Close_Auto_Setting:{
if (CollectionUtils.isEmpty(routeList)) {
continue;
} else {
for (Route route : routeList) { for (Route route : routeList) {
// 类似哈尔滨一号线根据配置各类进路分别生成 // 类似哈尔滨一号线根据配置各类进路分别生成
if ((operateDefinitionVO.isAtp() && !route.isAtp()) if ((operateDefinitionVO.isAtp() && !route.isAtp())
@ -84,6 +80,31 @@ public class SignalGeneratorNew implements GeneratorNew {
} }
continue; continue;
} }
case Signal_Set_CI_Auto_Trigger:
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_Total_Cancel: // 总取消暂时只生成取消未接近锁闭的进路这一种场景的实训
case Signal_Cancel_Route:{ case Signal_Cancel_Route:{
// 查询以信号机为始端的进路列表设置背景为进路已排列 // 查询以信号机为始端的进路列表设置背景为进路已排列
@ -159,15 +180,23 @@ public class SignalGeneratorNew implements GeneratorNew {
case Signal_Open_Auto_Setting:{ case Signal_Open_Auto_Setting:{
// 查询进路列表背景为进路人工控 // 查询进路列表背景为进路人工控
if (!CollectionUtils.isEmpty(routeList)) { if (!CollectionUtils.isEmpty(routeList)) {
for (Route route : routeList) { if (routeLikeHa1) {
if ((routeLikeHa1 && !route.isAtp()) for (Route route : routeList) {
|| route.isGuide()) { // 引导进路不生成 route.setAtsControl(false);
continue;
} }
route.setAtsControl(false); trainingVOList.add(this.build(config, simulation, signal, operateDefinitionVO));
trainingVOList.add(this.build(config, simulation, route, operateDefinitionVO));
// 仿真重置 // 仿真重置
simulation.reset(); simulation.reset();
} else {
for (Route route : routeList) {
if (route.isGuide()) { // 引导进路不生成Signal_Cancel_CI_Auto_Trigger
continue;
}
route.setAtsControl(false);
trainingVOList.add(this.build(config, simulation, route, operateDefinitionVO));
// 仿真重置
simulation.reset();
}
} }
} }
continue; continue;
@ -204,16 +233,25 @@ public class SignalGeneratorNew implements GeneratorNew {
continue; continue;
} }
case Signal_Cancel_CI_Auto_Trigger:{ case Signal_Cancel_CI_Auto_Trigger:{
// 查询自动触发进路列表背景为自动触发进路的联锁自动触发模式已设置
if (!CollectionUtils.isEmpty(routeList)) { if (!CollectionUtils.isEmpty(routeList)) {
// 查询自动触发进路列表背景为自动触发进路的联锁自动触发模式已设置
List<Route> arcRouteList = routeList.stream() List<Route> arcRouteList = routeList.stream()
.filter(route -> route.isArs()) .filter(route -> route.isArs())
.collect(Collectors.toList()); .collect(Collectors.toList());
for (Route route : arcRouteList) { if (routeLikeHa1) {
route.setCiControl(true); for (Route route : arcRouteList) {
trainingVOList.add(this.build(config, simulation, route, operateDefinitionVO)); route.setCiControl(true);
}
trainingVOList.add(this.build(config, simulation, signal, operateDefinitionVO));
// 仿真重置 // 仿真重置
simulation.reset(); simulation.reset();
} else {
for (Route route : arcRouteList) {
route.setCiControl(true);
trainingVOList.add(this.build(config, simulation, route, operateDefinitionVO));
// 仿真重置
simulation.reset();
}
} }
} }
continue; continue;

View File

@ -24,7 +24,7 @@ public abstract class Simulation {
/** /**
* 仿真状态 * 仿真状态
*/ */
private State state; private volatile State state;
/** /**
* 仿真运行发生异常时保存的异常信息 * 仿真运行发生异常时保存的异常信息
*/ */
@ -84,7 +84,7 @@ public abstract class Simulation {
/** /**
* 添加定时仿真逻辑循环 * 添加定时仿真逻辑循环
* @param name * @param name 任务名称同时也是id
* @param job 仿真逻辑 * @param job 仿真逻辑
* @param rate 执行频率单位ms * @param rate 执行频率单位ms
*/ */
@ -100,6 +100,21 @@ public abstract class Simulation {
scheduledJob.runAsSpeed(EXECUTOR, this.speed); scheduledJob.runAsSpeed(EXECUTOR, this.speed);
} }
/**
* 移除指定仿真任务逻辑循环
* @param name
*/
public void removeJob(String name) {
if (null == name) {
throw new IllegalArgumentException("name can't be null");
}
SimulationScheduledJob simulationScheduledJob = this.scheduledJobMap.get(name);
if (simulationScheduledJob != null) {
simulationScheduledJob.cancel();
this.scheduledJobMap.remove(name);
}
}
/** /**
* 控制-开始 * 控制-开始
*/ */
@ -182,6 +197,10 @@ public abstract class Simulation {
} }
} }
public Throwable getThrowable() {
return this.throwable;
}
public Map<String, Object> toDataMap() { public Map<String, Object> toDataMap() {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("id", this.id); map.put("id", this.id);