Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
de5fa9030f
@ -62,12 +62,8 @@ public class SignalGeneratorNew implements GeneratorNew {
|
||||
case Signal_Block:
|
||||
case Signal_Find_Routes_Status:
|
||||
break;
|
||||
case Signal_Set_Route:
|
||||
case Signal_Set_CI_Auto_Trigger:
|
||||
case Signal_Close_Auto_Setting:{
|
||||
if (CollectionUtils.isEmpty(routeList)) {
|
||||
continue;
|
||||
} else {
|
||||
case Signal_Set_Route:{
|
||||
if (!CollectionUtils.isEmpty(routeList)) {
|
||||
for (Route route : routeList) {
|
||||
// 类似哈尔滨一号线,根据配置各类进路分别生成
|
||||
if ((operateDefinitionVO.isAtp() && !route.isAtp())
|
||||
@ -84,6 +80,31 @@ public class SignalGeneratorNew implements GeneratorNew {
|
||||
}
|
||||
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_Cancel_Route:{
|
||||
// 查询以信号机为始端的进路列表,设置背景为进路已排列
|
||||
@ -159,15 +180,23 @@ public class SignalGeneratorNew implements GeneratorNew {
|
||||
case Signal_Open_Auto_Setting:{
|
||||
// 查询进路列表,背景为进路人工控
|
||||
if (!CollectionUtils.isEmpty(routeList)) {
|
||||
for (Route route : routeList) {
|
||||
if ((routeLikeHa1 && !route.isAtp())
|
||||
|| route.isGuide()) { // 引导进路不生成
|
||||
continue;
|
||||
if (routeLikeHa1) {
|
||||
for (Route route : routeList) {
|
||||
route.setAtsControl(false);
|
||||
}
|
||||
route.setAtsControl(false);
|
||||
trainingVOList.add(this.build(config, simulation, route, operateDefinitionVO));
|
||||
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);
|
||||
trainingVOList.add(this.build(config, simulation, route, operateDefinitionVO));
|
||||
// 仿真重置
|
||||
simulation.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
@ -204,16 +233,25 @@ 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());
|
||||
for (Route route : arcRouteList) {
|
||||
route.setCiControl(true);
|
||||
trainingVOList.add(this.build(config, simulation, route, operateDefinitionVO));
|
||||
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));
|
||||
// 仿真重置
|
||||
simulation.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user