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,10 +62,30 @@ public class SignalGeneratorNew implements GeneratorNew {
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) {
// 类似哈尔滨一号线根据配置各类进路分别生成
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_Set_CI_Auto_Trigger:
case Signal_Close_Auto_Setting:{
if (CollectionUtils.isEmpty(routeList)) {
if (!CollectionUtils.isEmpty(routeList)) {
if (routeLikeHa1) {
trainingVOList.add(this.build(config, simulation, signal, operateDefinitionVO));
simulation.reset();
continue;
} else {
for (Route route : routeList) {
@ -82,6 +102,7 @@ public class SignalGeneratorNew implements GeneratorNew {
simulation.reset();
}
}
}
continue;
}
case Signal_Total_Cancel: // 总取消暂时只生成取消未接近锁闭的进路这一种场景的实训
@ -159,9 +180,16 @@ public class SignalGeneratorNew implements GeneratorNew {
case Signal_Open_Auto_Setting:{
// 查询进路列表背景为进路人工控
if (!CollectionUtils.isEmpty(routeList)) {
if (routeLikeHa1) {
for (Route route : routeList) {
if ((routeLikeHa1 && !route.isAtp())
|| route.isGuide()) { // 引导进路不生成
route.setAtsControl(false);
}
trainingVOList.add(this.build(config, simulation, signal, operateDefinitionVO));
// 仿真重置
simulation.reset();
} else {
for (Route route : routeList) {
if (route.isGuide()) { // 引导进路不生成Signal_Cancel_CI_Auto_Trigger
continue;
}
route.setAtsControl(false);
@ -170,6 +198,7 @@ public class SignalGeneratorNew implements GeneratorNew {
simulation.reset();
}
}
}
continue;
}
case Signal_Set_CI_Auto:{
@ -204,11 +233,19 @@ public class SignalGeneratorNew implements GeneratorNew {
continue;
}
case Signal_Cancel_CI_Auto_Trigger:{
// 查询自动触发进路列表背景为自动触发进路的联锁自动触发模式已设置
if (!CollectionUtils.isEmpty(routeList)) {
// 查询自动触发进路列表背景为自动触发进路的联锁自动触发模式已设置
List<Route> arcRouteList = routeList.stream()
.filter(route -> route.isArs())
.collect(Collectors.toList());
if (routeLikeHa1) {
for (Route route : arcRouteList) {
route.setCiControl(true);
}
trainingVOList.add(this.build(config, simulation, signal, operateDefinitionVO));
// 仿真重置
simulation.reset();
} else {
for (Route route : arcRouteList) {
route.setCiControl(true);
trainingVOList.add(this.build(config, simulation, route, operateDefinitionVO));
@ -216,6 +253,7 @@ public class SignalGeneratorNew implements GeneratorNew {
simulation.reset();
}
}
}
continue;
}
case Signal_Set_Guide:{

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 rate 执行频率单位ms
*/
@ -100,6 +100,21 @@ public abstract class Simulation {
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() {
Map<String, Object> map = new HashMap<>();
map.put("id", this.id);