实训补充修改

This commit is contained in:
DU 2021-02-04 17:26:53 +08:00
parent 4aed94d481
commit 1635c356ed
21 changed files with 258 additions and 64 deletions

View File

@ -1,22 +1,22 @@
package club.joylink.rtss.services.training.generatornew; package club.joylink.rtss.services.training.generatornew;
import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.services.training.constant.TrainingConsts; import club.joylink.rtss.services.training.constant.TrainingConsts;
import club.joylink.rtss.services.training.data.GenerateConfig; import club.joylink.rtss.services.training.data.GenerateConfig;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.map.*; import club.joylink.rtss.simulation.cbtc.data.map.*;
import club.joylink.rtss.simulation.cbtc.data.storage.StorageSimulation; import club.joylink.rtss.simulation.cbtc.data.storage.StorageSimulation;
import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.util.ReflectionUtils; import club.joylink.rtss.util.ReflectionUtils;
import club.joylink.rtss.vo.client.map.newmap.MapTurnBackStrategyVO;
import club.joylink.rtss.vo.client.training.definition.OperateDefinitionVO;
import club.joylink.rtss.vo.client.training.definition.OperatePlaceholderVO;
import club.joylink.rtss.vo.client.training.definition.OperateStepVO;
import club.joylink.rtss.vo.client.map.MapVO; import club.joylink.rtss.vo.client.map.MapVO;
import club.joylink.rtss.vo.client.map.newmap.MapAutomaticRouteButtonVO; import club.joylink.rtss.vo.client.map.newmap.MapAutomaticRouteButtonVO;
import club.joylink.rtss.vo.client.map.newmap.MapCycleButtonVO; import club.joylink.rtss.vo.client.map.newmap.MapCycleButtonVO;
import club.joylink.rtss.vo.client.map.newmap.MapTotalGuideLockButtonVO;
import club.joylink.rtss.vo.client.map.newmap.MapTurnBackStrategyVO;
import club.joylink.rtss.vo.client.training.TrainingNewVO; import club.joylink.rtss.vo.client.training.TrainingNewVO;
import club.joylink.rtss.vo.client.training.TrainingStepVO; import club.joylink.rtss.vo.client.training.TrainingStepVO;
import org.springframework.util.CollectionUtils; import club.joylink.rtss.vo.client.training.definition.OperateDefinitionVO;
import club.joylink.rtss.vo.client.training.definition.OperatePlaceholderVO;
import club.joylink.rtss.vo.client.training.definition.OperateStepVO;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
@ -97,6 +97,9 @@ public interface GeneratorNew {
} else if (mapButton instanceof MapTurnBackStrategyVO) { } else if (mapButton instanceof MapTurnBackStrategyVO) {
s.setDeviceCode(((MapTurnBackStrategyVO) mapButton).getCode()); s.setDeviceCode(((MapTurnBackStrategyVO) mapButton).getCode());
break; break;
} else if (mapButton instanceof MapTotalGuideLockButtonVO) {
s.setDeviceCode(((MapTotalGuideLockButtonVO) mapButton).getCode());
break;
} }
} }
case NULL: case NULL:
@ -128,6 +131,8 @@ public interface GeneratorNew {
trainingVO.setLocateDeviceCode(((MapAutomaticRouteButtonVO) mapButton).getCode()); trainingVO.setLocateDeviceCode(((MapAutomaticRouteButtonVO) mapButton).getCode());
} else if (mapButton instanceof MapTurnBackStrategyVO) { } else if (mapButton instanceof MapTurnBackStrategyVO) {
trainingVO.setLocateDeviceCode(((MapTurnBackStrategyVO) mapButton).getCode()); trainingVO.setLocateDeviceCode(((MapTurnBackStrategyVO) mapButton).getCode());
} else if (mapButton instanceof MapTotalGuideLockButtonVO) {
trainingVO.setLocateDeviceCode(((MapTotalGuideLockButtonVO) mapButton).getCode());
} }
} }
} }

View File

@ -5,8 +5,10 @@ import club.joylink.rtss.services.training.generatornew.GeneratorNew;
import club.joylink.rtss.services.training.generatornew.annotation.GeneratorSelectorNew; import club.joylink.rtss.services.training.generatornew.annotation.GeneratorSelectorNew;
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation; import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.build.SimulationBuilder;
import club.joylink.rtss.simulation.cbtc.data.map.Cycle; import club.joylink.rtss.simulation.cbtc.data.map.Cycle;
import club.joylink.rtss.simulation.cbtc.data.map.Route; import club.joylink.rtss.simulation.cbtc.data.map.Route;
import club.joylink.rtss.simulation.cbtc.data.map.SectionPath;
import club.joylink.rtss.simulation.cbtc.data.map.Signal; import club.joylink.rtss.simulation.cbtc.data.map.Signal;
import club.joylink.rtss.simulation.cbtc.tool.DeviceStatusModifyTool; import club.joylink.rtss.simulation.cbtc.tool.DeviceStatusModifyTool;
import club.joylink.rtss.vo.client.training.definition.OperateDefinitionVO; import club.joylink.rtss.vo.client.training.definition.OperateDefinitionVO;
@ -179,17 +181,16 @@ public class SignalGeneratorNew implements GeneratorNew {
case Signal_Human_Release_Route: { case Signal_Human_Release_Route: {
// 查询信号机为始端的进路列表设置背景为进路排列且进路接近区段占用 // 查询信号机为始端的进路列表设置背景为进路排列且进路接近区段占用
// todo 接近区段设置列车逻辑较复杂推迟实现 // todo 接近区段设置列车逻辑较复杂推迟实现
for (Route route : signal.getRouteList()) {
deviceStatusModifyTool.openRouteDirect(simulation, route);
deviceStatusModifyTool.closeSignalDirectly(route.getStart());
deviceStatusModifyTool.loadManualTrainOfGroup(simulation, "001", signal.getSection(), signal.isRight());
// todo 在接近区段设置一辆列车
trainingVOList.add(this.build(config, simulation, signal, null, operateDefinitionVO));
// 仿真重置
simulation.reset();
}
continue; continue;
// List<Route> routeList = signal.getRouteList();
// for (Route route : routeList) {
// deviceStatusModifyTool.openRouteDirect(simulation, route);
// List<Section> approachSectionList = signal.getApproachSectionList();
// // todo 在接近区段设置一辆列车
// trainingVOList.add(this.build(config, simulation, signal, operateDefinitionVO));
// // 仿真重置
// simulation = SimulationBuilder.build(simulation.getBuildParams());
// }
// continue;
} }
case Signal_Close_Signal: { case Signal_Close_Signal: {
// 查询进路设置背景为进路已排列 // 查询进路设置背景为进路已排列
@ -328,26 +329,28 @@ public class SignalGeneratorNew implements GeneratorNew {
} }
case Signal_Set_Guide: { case Signal_Set_Guide: {
// 若信号机可开引导信号则生成实训暂不设置背景暂时先简单处理此处业务比较复杂需明确后再生成各种情况的实训 // 若信号机可开引导信号则生成实训暂不设置背景暂时先简单处理此处业务比较复杂需明确后再生成各种情况的实训
// if (!signal.isCallOn()) { // 不是引导信号机不生成 if (signal.isCallOn()) { // 不是引导信号机不生成
// continue; //非折返进路办理引导
// } else { List<Route> notTurnBackRouteList = routeList.stream()
// //非折返进路办理引导 .filter(route -> !route.isTurnBack())
// List<Route> notTurnBackRouteList = routeList.stream() .collect(Collectors.toList());
// .filter(route -> !route.isTurnBack()) if (routeLikeHa1) {
// .collect(Collectors.toList()); // 对于ATP进路地面联锁进路引导进路类的取引导进路
// if (routeLikeHa1) { notTurnBackRouteList = notTurnBackRouteList.stream()
// // 对于ATP进路地面联锁进路引导进路类的取引导进路 .filter(route -> route.isGuide())
// notTurnBackRouteList = notTurnBackRouteList.stream() .collect(Collectors.toList());
// .filter(route -> route.isGuide()) }
// .collect(Collectors.toList()); for (Route route : notTurnBackRouteList) {
// } if(simulation.getRepository().getConfig().isGuideNeedRouteSettingFirst()){
// for (Route route : notTurnBackRouteList) { deviceStatusModifyTool.openRouteDirect(simulation, route);
// trainingVOList.add(this.build(config, simulation, route, operateDefinitionVO)); deviceStatusModifyTool.closeSignalDirectly(route.getStart());
// // 仿真重置 }
// simulation.reset(); deviceStatusModifyTool.loadManualTrainOfGroup(simulation, "001",signal.getSection(),signal.isRight());
// } trainingVOList.add(this.build(config, simulation, route,null, operateDefinitionVO));
// continue; // 仿真重置
// } simulation.reset();
}
}
continue; continue;
} }
case Signal_Close_Guide: { case Signal_Close_Guide: {

View File

@ -6,15 +6,21 @@ import club.joylink.rtss.services.training.generatornew.annotation.GeneratorSele
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation; import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.constant.TrainType; import club.joylink.rtss.simulation.cbtc.constant.TrainType;
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
import club.joylink.rtss.simulation.cbtc.data.map.Route;
import club.joylink.rtss.simulation.cbtc.data.map.Section; 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.Stand;
import club.joylink.rtss.constants.MapPrdTypeEnum; import club.joylink.rtss.constants.MapPrdTypeEnum;
import club.joylink.rtss.simulation.cbtc.data.support.RoutePath;
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition; import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo; import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityDevice; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityDevice;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
import club.joylink.rtss.simulation.cbtc.tool.DeviceStatusModifyTool;
import club.joylink.rtss.vo.client.training.definition.OperateDefinitionVO; import club.joylink.rtss.vo.client.training.definition.OperateDefinitionVO;
import club.joylink.rtss.vo.client.training.TrainingNewVO; import club.joylink.rtss.vo.client.training.TrainingNewVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import java.util.*; import java.util.*;
@ -22,6 +28,8 @@ import java.util.*;
public class StandGeneratorNew implements GeneratorNew { public class StandGeneratorNew implements GeneratorNew {
protected static final int PARKING_TIME = 20; protected static final int PARKING_TIME = 20;
@Autowired
private DeviceStatusModifyTool deviceStatusModifyTool;
@Override @Override
public List<TrainingNewVO> generate(GenerateConfig config, Simulation simulation, OperateDefinitionVO operateDefinitionVO) { public List<TrainingNewVO> generate(GenerateConfig config, Simulation simulation, OperateDefinitionVO operateDefinitionVO) {
@ -43,9 +51,11 @@ public class StandGeneratorNew implements GeneratorNew {
stand.setTypeStrategy(Stand.TurnBackType.AUTO); stand.setTypeStrategy(Stand.TurnBackType.AUTO);
break; break;
case Stand_Set_Hold_Train_Auto: case Stand_Set_Hold_Train_Auto:
stand.setTrainLimit(-1);
break;
case Stand_Cancel_Hold_Train_Auto: case Stand_Cancel_Hold_Train_Auto:
// 功能暂未实现不生成 stand.setTrainLimit(3);
continue; break;
case Stand_Set_Jump_Stop: { case Stand_Set_Jump_Stop: {
// todo 应该设置列车在上一车站暂时简单处理 // todo 应该设置列车在上一车站暂时简单处理
// 终点车站正常应不能设置跳停暂时也不处理 // 终点车站正常应不能设置跳停暂时也不处理
@ -69,9 +79,15 @@ public class StandGeneratorNew implements GeneratorNew {
standList.forEach(stand1 -> stand1.setCenterHoldTrain(true)); standList.forEach(stand1 -> stand1.setCenterHoldTrain(true));
break; break;
} }
case Stand_Early_Depart:{ case Stand_Early_Depart: {
// 提前发车需要列车暂不生成 List<Route> routeList = simulation.getRepository().getRouteList();
continue; Route route = routeList.stream().filter(route1 ->
(route1.getStart().getSection() == stand.getSection() || route1.containSection(stand.getSection()) && !route1.routeLastSection(stand.getSection())) && Objects.equals(stand.isRight(), route1.getStart().isRight())).findAny().orElse(null);
if (Objects.nonNull(route)) {
deviceStatusModifyTool.openRouteDirect(simulation, route);
}
deviceStatusModifyTool.loadManualTrainOfGroup(simulation, "001", stand.getSection(), stand.isRight());
break;
} }
case Stand_Cancel_Jump_Stop:{ case Stand_Cancel_Jump_Stop:{
// 设置背景为全部跳停 // 设置背景为全部跳停

View File

@ -5,11 +5,14 @@ import club.joylink.rtss.services.training.generatornew.GeneratorNew;
import club.joylink.rtss.services.training.generatornew.annotation.GeneratorSelectorNew; import club.joylink.rtss.services.training.generatornew.annotation.GeneratorSelectorNew;
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation; import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.map.Route; import club.joylink.rtss.simulation.cbtc.data.map.*;
import club.joylink.rtss.simulation.cbtc.data.map.Station; import club.joylink.rtss.simulation.cbtc.tool.DeviceStatusModifyTool;
import club.joylink.rtss.vo.client.training.definition.OperateDefinitionVO; import club.joylink.rtss.vo.client.training.definition.OperateDefinitionVO;
import club.joylink.rtss.vo.client.training.TrainingNewVO; import club.joylink.rtss.vo.client.training.TrainingNewVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import java.time.LocalTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@ -17,7 +20,8 @@ import java.util.stream.Collectors;
@GeneratorSelectorNew(operateObject = Operation.Object.Station) @GeneratorSelectorNew(operateObject = Operation.Object.Station)
public class StationGeneratorNew implements GeneratorNew { public class StationGeneratorNew implements GeneratorNew {
@Autowired
private DeviceStatusModifyTool deviceStatusModifyTool;
@Override @Override
public List<TrainingNewVO> generate(GenerateConfig config, Simulation simulation, OperateDefinitionVO operateDefinitionVO) { public List<TrainingNewVO> generate(GenerateConfig config, Simulation simulation, OperateDefinitionVO operateDefinitionVO) {
List<TrainingNewVO> trainingVOList = new ArrayList<>(); List<TrainingNewVO> trainingVOList = new ArrayList<>();
@ -105,14 +109,66 @@ public class StationGeneratorNew implements GeneratorNew {
}); });
continue; continue;
} }
// simulation.getRepository().getSignalList().stream()
// .filter(s -> Objects.equals(station.getCode(), s.getDeviceStation().getCode()))
// .forEach(signal -> {
// if (!signal.isBlockade()) {
// signal.setBlockade(false);
// }
// });
break; break;
case Station_Power_On_Unlock:
if(!station.isCentralized()) {
continue;
}
station.setControlMode(Station.ControlMode.Local);
station.setRestartTime(LocalTime.now());
List<Section> sections = simulation.getRepository().getSectionList();
sections.stream().filter(section -> Objects.equals(section.getDeviceStation(), station)).forEach(section -> section.setFaultLock(true));
break;
case Station_Set_Master_Guide_Lock:
if(!station.isCentralized()) {
continue;
}
station.setControlMode(Station.ControlMode.Local);
List<Switch> switchList = simulation.getRepository().getSwitchList();
List<Switch> collect = switchList.stream().filter(
aSwitch -> Objects.equals(aSwitch.getDeviceStation(), station)).collect(Collectors.toList());
collect.forEach(aSwitch -> aSwitch.setFault(Switch.SwitchFault.SPLIT));
station.setControlMode(Station.ControlMode.Center);
if (operateDefinitionVO.guideTotalLockButton()) {
simulation.getBuildParams().getMap().getGraphDataNew().getTotalGuideLockButtonVOList()
.stream().filter(guideLockButtonVO -> guideLockButtonVO.getStationCode().equals(station.getCode()))
.forEach(button -> {
trainingVOList.add(this.build(config, simulation, station, button, operateDefinitionVO));
simulation.reset();
});
continue;
}
break;
case Station_Cancel_Master_Guide_Lock:
if(station.isCentralized()) {
station.setTotalGuideLock(true);
station.setControlMode(Station.ControlMode.Local);
List<Switch> switchList1 = simulation.getRepository().getSwitchList();
switchList1.stream().filter(aSwitch -> Objects.equals(aSwitch.getDeviceStation(), station)).forEach(aSwitch -> aSwitch.setSingleLock(true));
List<Signal> signalList = simulation.getRepository().getSignalList();
signalList.stream().filter(signal -> Objects.equals(signal.getDeviceStation(), station)).forEach(signal -> {
if (signal.isCallOn()) {
List<Route> routeList = signal.getRouteList();
if (!CollectionUtils.isEmpty(routeList)) {
for (Route route : routeList) {
if (!route.isTurnBack()) {
this.deviceStatusModifyTool.openGuideRouteDirect(simulation, route);
trainingVOList.add(this.build(config, simulation, station, null, operateDefinitionVO));
// 仿真重置
simulation.reset();
break;
}
}
} else if (Objects.nonNull(signal.getAutoSignal())) { // 信号机是自动信号
this.deviceStatusModifyTool.openGuideSignalDirectly(signal);
trainingVOList.add(this.build(config, simulation, station, null, operateDefinitionVO));
// 仿真重置
simulation.reset();
}
}
});
}
continue;
default: default:
// 其他操作不生成 // 其他操作不生成
continue; continue;

View File

@ -179,9 +179,9 @@ public class Operation {
Stand_Set_Hold_Train_Batch(), Stand_Set_Hold_Train_Batch(),
/**批量取消扣车*/ /**批量取消扣车*/
Stand_Cancel_Hold_Train_Batch(), Stand_Cancel_Hold_Train_Batch(),
/** 区间列车数量限制 */ /** 区间列车数量限制(自动扣车) */
Stand_Set_Hold_Train_Auto(), Stand_Set_Hold_Train_Auto(),
/** 取消区间列车数量限制 */ /** 取消区间列车数量限制(取消自动扣车) */
Stand_Cancel_Hold_Train_Auto(), Stand_Cancel_Hold_Train_Auto(),
/** 站台总取消 */ /** 站台总取消 */
Stand_Total_Cancel, Stand_Total_Cancel,
@ -209,6 +209,8 @@ public class Operation {
CM_Surrender_Control(), CM_Surrender_Control(),
/** 连锁控 */ /** 连锁控 */
CM_Interlock_Control(), CM_Interlock_Control(),
/** 回复中控请求(同意/拒绝) */
CM_Reply_Interlock_Control(),
//--------------------------- 集中车站 --------------------------- //--------------------------- 集中车站 ---------------------------
/** 设置折返策略 */ /** 设置折返策略 */

View File

@ -137,8 +137,8 @@ public class StandOperateHandler {
* 区间列车数量限制 * 区间列车数量限制
*/ */
@OperateHandlerMapping(type = Operation.Type.Stand_Set_Hold_Train_Auto) @OperateHandlerMapping(type = Operation.Type.Stand_Set_Hold_Train_Auto)
public void setHoldTrainAuto() { public void setHoldTrainAuto(Simulation simulation, String standCode, int limit) {
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "功能暂未实现"); atsStandService.setAutoHoldTrainLimit(simulation, standCode, limit);
} }
@ -146,8 +146,8 @@ public class StandOperateHandler {
* 取消区间列车数量限制 * 取消区间列车数量限制
*/ */
@OperateHandlerMapping(type = Operation.Type.Stand_Cancel_Hold_Train_Auto) @OperateHandlerMapping(type = Operation.Type.Stand_Cancel_Hold_Train_Auto)
public void cancelHoldTrainAuto() { public void cancelHoldTrainAuto(Simulation simulation, String standCode) {
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "功能暂未实现"); atsStandService.setAutoHoldTrainLimit(simulation, standCode, -1);
} }

View File

@ -102,9 +102,9 @@ public class StationOperateHandler {
* 上电解锁 * 上电解锁
*/ */
@OperateHandlerMapping(type = Operation.Type.Station_Power_On_Unlock) @OperateHandlerMapping(type = Operation.Type.Station_Power_On_Unlock)
public void powerOnUnlock() { public void powerOnUnlock(Simulation simulation, String stationCode) {
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "功能暂未实现"); SimulationDataRepository repository = simulation.getRepository();
ciApiService.powerOnUnlock(simulation, repository.getByCode(stationCode, Station.class));
} }
/** /**
@ -143,6 +143,12 @@ public class StationOperateHandler {
atsStationService.applyForCenterControl(simulation, fromMember, stationCodes); atsStationService.applyForCenterControl(simulation, fromMember, stationCodes);
} }
/**连锁控*/
@OperateHandlerMapping(type = Operation.Type.CM_Interlock_Control)
public void applyForInterlockControl(Simulation simulation, SimulationMember fromMember, List<String> stationCodes){
atsStationService.applyForInterlockControl(simulation, fromMember, stationCodes);
}
/**强制站控-l*/ /**强制站控-l*/
@OperateHandlerMapping(type = Operation.Type.CM_Force_Station_Control) @OperateHandlerMapping(type = Operation.Type.CM_Force_Station_Control)
public void forceForStationControl(Simulation simulation, SimulationMember fromMember, List<String> stationCodes){ public void forceForStationControl(Simulation simulation, SimulationMember fromMember, List<String> stationCodes){

View File

@ -277,6 +277,14 @@ public class AtsStandService {
stand.setRunLevelTimeForever(alwaysValid); stand.setRunLevelTimeForever(alwaysValid);
} }
/**
* 设置站间列车数量
*/
public void setAutoHoldTrainLimit(Simulation simulation, String standCode, int limit) {
Stand stand = getStand(simulation, standCode);
stand.setTrainLimit(limit);
}
/** /**
* 设置人工折返策略 * 设置人工折返策略
*/ */

View File

@ -61,7 +61,7 @@ public class AtsStationService {
station.setTotalGuideLock(true); station.setTotalGuideLock(true);
List<Switch> switches = simulation.getRepository().getSwitchListByDeviceStationCode(station.getCode()); List<Switch> switches = simulation.getRepository().getSwitchListByDeviceStationCode(station.getCode());
if (!CollectionUtils.isEmpty(switches)) { if (!CollectionUtils.isEmpty(switches)) {
switches.forEach(s -> s.setMasterGuideLock(true)); switches.forEach(s -> s.setSingleLock(true));
} }
} }
@ -77,7 +77,7 @@ public class AtsStationService {
station.setTotalGuideLock(false); station.setTotalGuideLock(false);
List<Switch> switches = simulation.getRepository().getSwitchListByDeviceStationCode(station.getCode()); List<Switch> switches = simulation.getRepository().getSwitchListByDeviceStationCode(station.getCode());
if (!CollectionUtils.isEmpty(switches)) { if (!CollectionUtils.isEmpty(switches)) {
switches.forEach(s -> s.setMasterGuideLock(false)); switches.forEach(s -> s.setSingleLock(false));
} }
} }
@ -217,6 +217,20 @@ public class AtsStationService {
} }
/**
* 请求连锁控处理
*/
public void applyForInterlockControl(Simulation simulation, SimulationMember fromMember, List<String> stationCodes) {
if (CollectionUtils.isEmpty(stationCodes)) {
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "连锁控的车站不能为空");
}
stationCodes.forEach(stationCode -> {
Station station = getStation(simulation, stationCode);
station.setControlMode(Station.ControlMode.Interlock);
});
atsMessageCollectAndDispatcher.handlerOperateMessage(simulation, new OperationMessage(fromMember.getId(), new HashSet<>(Collections.singleton(fromMember)), Operation.Type.CM_Reply_Interlock_Control, null, true, stationCodes));
}
/** /**
* 回复站控请求c * 回复站控请求c
*/ */

View File

@ -305,6 +305,9 @@ public interface CiApiService {
*/ */
void restart(Simulation simulation, Station station); void restart(Simulation simulation, Station station);
/**上电解锁*/
void powerOnUnlock(Simulation simulation, Station station);
/** /**
* 站台紧急停车 * 站台紧急停车
*/ */

View File

@ -18,6 +18,7 @@ import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.time.LocalTime;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
@ -397,7 +398,7 @@ public class CiApiServiceImpl implements CiApiService {
} }
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signal.isClose(), String.format("信号机[%s]需处于关闭状态", signal.getCode())); BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signal.isClose(), String.format("信号机[%s]需处于关闭状态", signal.getCode()));
boolean signalApproachOccupied = signal.getApproachPathList() boolean signalApproachOccupied = signal.getApproachPathList()
.stream().anyMatch(sectionPath -> sectionPath.getLogicList().stream().anyMatch(Section::isOccupied)); .stream().anyMatch(sectionPath -> sectionPath.getSectionList().stream().anyMatch(Section::isOccupied));
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signalApproachOccupied, BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signalApproachOccupied,
String.format("对%s开放引导操作失败接近区段没有列车占用", signal.getName())); String.format("对%s开放引导操作失败接近区段没有列车占用", signal.getName()));
//办理引导进路或开放引导信号 //办理引导进路或开放引导信号
@ -468,8 +469,21 @@ public class CiApiServiceImpl implements CiApiService {
.filter(signal -> signal.getDeviceStation().equals(deviceStation)).collect(Collectors.toList()); .filter(signal -> signal.getDeviceStation().equals(deviceStation)).collect(Collectors.toList());
signals.forEach(Signal::reset); signals.forEach(Signal::reset);
deviceStation.setInterlockMachineStarting(false); deviceStation.setInterlockMachineStarting(false);
deviceStation.setRestartTime(LocalTime.now());
} }
@Override
public void powerOnUnlock(Simulation simulation, Station station){
if (!station.isCentralized()) {
station = station.getDeviceStation();
}
Station deviceStation = station;
if (Objects.nonNull(deviceStation.getRestartTime()) && deviceStation.getRestartTime().plusMinutes(8).isBefore(LocalTime.now())) {
List<Section> sections = simulation.getRepository().getSectionList();
sections.stream().filter(section -> Objects.equals(section.getDeviceStation(), deviceStation)).forEach(Section::faultUnlock);
}
throw BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.exception("无效操作或连锁机重启过8分钟需手动解锁");
}
@Override @Override
public void standEB(Simulation simulation, Stand stand) { public void standEB(Simulation simulation, Stand stand) {
if (stand.getEsp() == null) if (stand.getEsp() == null)

View File

@ -538,7 +538,9 @@ public class Route extends MapNamedElement {
} }
return sections; return sections;
} }
public boolean routeLastSection(Section section) {
return Objects.equals(this.sectionList.get(sectionList.size()-1),section);
}
/** /**
* 进路检查失败原因 * 进路检查失败原因
*/ */

View File

@ -109,6 +109,11 @@ public class Stand extends MayOutOfOrderDevice {
*/ */
private boolean runLevelTimeForever; private boolean runLevelTimeForever;
/**
* 区间列车数量限制自动扣车不限制-1
*/
private int trainLimit;
/*停站时间相关*/ /*停站时间相关*/
/** /**
* 停车时间自动为-1 * 停车时间自动为-1

View File

@ -12,6 +12,7 @@ import lombok.NonNull;
import lombok.Setter; import lombok.Setter;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.time.LocalTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -156,6 +157,11 @@ public class Station extends MayOutOfOrderDevice {
*/ */
private boolean interlockMachineStarting; private boolean interlockMachineStarting;
/**
* 联锁机重启时间
*/
private LocalTime restartTime;
@Override @Override
public void reset() { public void reset() {
super.reset(); super.reset();
@ -473,6 +479,7 @@ public class Station extends MayOutOfOrderDevice {
if (!Objects.equals(this, device.getFault())) if (!Objects.equals(this, device.getFault()))
return; return;
station.setInterlockMachineStarting(true); station.setInterlockMachineStarting(true);
station.setRestartTime(null);
station.setFault(null); station.setFault(null);
} }
} }

View File

@ -63,6 +63,9 @@ public class StandStatus extends DeviceStatus {
@JsonSerialize(using = Boolean2NumSerializer.class) @JsonSerialize(using = Boolean2NumSerializer.class)
private boolean runLevelTimeForever; private boolean runLevelTimeForever;
/**区间列车数量限制(不限制为-1*/
private int trainLimit;
/**停车时间(自动为-1*/ /**停车时间(自动为-1*/
private int parkingTime; private int parkingTime;
@ -97,6 +100,7 @@ public class StandStatus extends DeviceStatus {
} }
this.runLevelTime = stand.getRunLevelTime(); this.runLevelTime = stand.getRunLevelTime();
this.runLevelTimeForever = stand.isRunLevelTimeForever(); this.runLevelTimeForever = stand.isRunLevelTimeForever();
this.trainLimit = stand.getTrainLimit();
this.parkingTime = stand.getParkingTime(); this.parkingTime = stand.getParkingTime();
this.parkingAlwaysValid = stand.isParkingAlwaysValid(); this.parkingAlwaysValid = stand.isParkingAlwaysValid();
this.noStatus = stand.isNoStatus(); this.noStatus = stand.isNoStatus();
@ -170,6 +174,11 @@ public class StandStatus extends DeviceStatus {
status.setRunLevelTimeForever(this.runLevelTimeForever); status.setRunLevelTimeForever(this.runLevelTimeForever);
change = true; change = true;
} }
if (!Objects.equals(this.trainLimit, stand.getTrainLimit())) {
this.trainLimit = stand.getTrainLimit();
status.setTrainLimit(this.trainLimit);
change = true;
}
if (!Objects.equals(this.parkingTime, stand.getParkingTime())) { if (!Objects.equals(this.parkingTime, stand.getParkingTime())) {
this.parkingTime = stand.getParkingTime(); this.parkingTime = stand.getParkingTime();
status.setParkingTime(this.parkingTime); status.setParkingTime(this.parkingTime);
@ -203,6 +212,7 @@ public class StandStatus extends DeviceStatus {
StandStatusVO statusVO = new StandStatusVO((Stand) device); StandStatusVO statusVO = new StandStatusVO((Stand) device);
statusVO.setParkingAlwaysValid(parkingAlwaysValid); statusVO.setParkingAlwaysValid(parkingAlwaysValid);
statusVO.setParkingTime(parkingTime); statusVO.setParkingTime(parkingTime);
statusVO.setTrainLimit(trainLimit);
statusVO.setRunLevelTimeForever(runLevelTimeForever); statusVO.setRunLevelTimeForever(runLevelTimeForever);
statusVO.setRunLevelTime(runLevelTime); statusVO.setRunLevelTime(runLevelTime);
statusVO.setAssignSkip(assignSkip); statusVO.setAssignSkip(assignSkip);

View File

@ -10,6 +10,7 @@ import club.joylink.rtss.util.jsonSerialize.Boolean2NumDeserializer;
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
import lombok.Getter; import lombok.Getter;
import java.time.LocalTime;
import java.util.Objects; import java.util.Objects;
/** /**
@ -50,6 +51,9 @@ public class StationStatus extends DeviceStatus {
*/ */
private Integer validDuration; private Integer validDuration;
/**连锁机上电重启时间*/
private LocalTime restartTime;
public StationStatus(Station station) { public StationStatus(Station station) {
super(station.getCode(), station.getDeviceType()); super(station.getCode(), station.getDeviceType());
this.controlMode = station.getControlMode(); this.controlMode = station.getControlMode();
@ -58,6 +62,7 @@ public class StationStatus extends DeviceStatus {
this.applicantId = station.getApplicantId(); this.applicantId = station.getApplicantId();
this.apply2TheControlMode = station.getApply2TheControlMode(); this.apply2TheControlMode = station.getApply2TheControlMode();
this.validDuration = station.getValidDurationInSeconds(); this.validDuration = station.getValidDurationInSeconds();
this.restartTime = station.getRestartTime();
} }
@Override @Override
@ -95,6 +100,12 @@ public class StationStatus extends DeviceStatus {
this.validDuration = station.getValidDurationInSeconds(); this.validDuration = station.getValidDurationInSeconds();
} }
status.setValidDuration(validDuration); status.setValidDuration(validDuration);
if (!Objects.equals(this.restartTime, station.getRestartTime())) {
change = true;
this.restartTime = station.getRestartTime();
status.setRestartTime(restartTime);
}
return change; return change;
} }
@ -107,6 +118,7 @@ public class StationStatus extends DeviceStatus {
statusVO.setApplicantId(applicantId); statusVO.setApplicantId(applicantId);
statusVO.setApply2TheControlMode(apply2TheControlMode); statusVO.setApply2TheControlMode(apply2TheControlMode);
statusVO.setValidDuration(validDuration); statusVO.setValidDuration(validDuration);
statusVO.setRestartTime(restartTime);
return statusVO; return statusVO;
} }
} }

View File

@ -60,6 +60,9 @@ public class StandStatusVO extends DeviceStatusVO {
@JsonSerialize(using = Boolean2NumSerializer.class) @JsonSerialize(using = Boolean2NumSerializer.class)
private Boolean runLevelTimeForever; private Boolean runLevelTimeForever;
/**区间列车数量限制(自不限制-1*/
private Integer trainLimit;
/**停车时间(自动为-1*/ /**停车时间(自动为-1*/
private Integer parkingTime; private Integer parkingTime;

View File

@ -10,6 +10,7 @@ import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalTime;
/** /**
* 车站状态 * 车站状态
@ -49,6 +50,8 @@ public class StationStatusVO extends DeviceStatusVO {
@JsonInclude() @JsonInclude()
private Integer validDuration; private Integer validDuration;
private LocalTime restartTime;
public StationStatusVO(Station station) { public StationStatusVO(Station station) {
super(station.getCode(), station.getDeviceType()); super(station.getCode(), station.getDeviceType());
} }

View File

@ -1,11 +1,14 @@
package club.joylink.rtss.simulation.cbtc.tool; package club.joylink.rtss.simulation.cbtc.tool;
import club.joylink.rtss.simulation.cbtc.ATS.service.AtsTrainLoadService;
import club.joylink.rtss.simulation.cbtc.CI.service.RouteService; import club.joylink.rtss.simulation.cbtc.CI.service.RouteService;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
import club.joylink.rtss.simulation.cbtc.data.map.*; import club.joylink.rtss.simulation.cbtc.data.map.*;
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySignal; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySignal;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -25,6 +28,8 @@ public class DeviceStatusModifyTool {
@Autowired @Autowired
private RouteService routeService; private RouteService routeService;
@Autowired
private AtsTrainLoadService atsTrainLoadService;
/** /**
* 直接开放进路 * 直接开放进路
@ -238,4 +243,8 @@ public class DeviceStatusModifyTool {
} }
} }
} }
public void loadManualTrainOfGroup(Simulation simulation, String groupNumber, Section section , boolean right){
atsTrainLoadService.loadSpareTrain(simulation, groupNumber, section.getCode(),right);
}
} }

View File

@ -22,6 +22,8 @@ public class OperateDefinitionConfig {
//折返策略按钮 //折返策略按钮
private Boolean tbStrategyBT; private Boolean tbStrategyBT;
private Boolean guideTotalLockBT;
private List<String> sectionTypes;//区段生成指定类型 private List<String> sectionTypes;//区段生成指定类型
public boolean isAtp() { public boolean isAtp() {
@ -62,4 +64,10 @@ public class OperateDefinitionConfig {
} }
return false; return false;
} }
public boolean guideTotalLockButton(){
if(Objects.nonNull(guideTotalLockBT)){
return guideTotalLockBT;
}
return false;
}
} }

View File

@ -189,6 +189,14 @@ public class OperateDefinitionVO {
return false; return false;
} }
public boolean guideTotalLockButton() {
OperateDefinitionConfig routeSettingConfig = this.getRouteSettingConfig();
if (Objects.nonNull(routeSettingConfig)) {
return routeSettingConfig.guideTotalLockButton();
}
return false;
}
public List<String> getSectionTypes() { public List<String> getSectionTypes() {
OperateDefinitionConfig routeSettingConfig = this.getRouteSettingConfig(); OperateDefinitionConfig routeSettingConfig = this.getRouteSettingConfig();
if (Objects.nonNull(routeSettingConfig)) { if (Objects.nonNull(routeSettingConfig)) {