Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
adba252b96
@ -109,7 +109,11 @@ public class AtpSectionService {
|
||||
for (Section section : sectionList) {
|
||||
if (section.isSwitchAxleCounterSection()) {
|
||||
Section switchSection = section.getLogicList().get(0);
|
||||
if (switchSingleHandle) {
|
||||
atpSectionList.addAll(switchSection.getSwitchAxleSectionsBySwitchPositionBySwitchSingleHandle());
|
||||
} else {
|
||||
atpSectionList.addAll(switchSection.getSwitchAxleSectionsBySwitchPosition());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (CollectionUtils.isEmpty(section.getLogicList())) {
|
||||
|
@ -399,8 +399,8 @@ public class TrainOperateHandler {
|
||||
* 大铁加载,指定车次列车
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Train_Load_Trip_Number_Train)
|
||||
public void loadServiceNumberTrain(Simulation simulation, String tripNumber, String sectionCode) {
|
||||
atsTrainLoadService.loadTripNumberTrain(simulation, tripNumber, sectionCode);
|
||||
public void loadServiceNumberTrain(Simulation simulation, String tripNumber, String sectionCode, boolean right) {
|
||||
atsTrainLoadService.loadTripNumberTrain(simulation, tripNumber, sectionCode, right);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -864,11 +864,9 @@ public class AtsTrainLoadService {
|
||||
* @param tripNumber 车次号
|
||||
* @param sectionCode 区段编号
|
||||
*/
|
||||
public void loadTripNumberTrain(Simulation simulation, String tripNumber, String sectionCode) {
|
||||
public void loadTripNumberTrain(Simulation simulation, String tripNumber, String sectionCode, boolean right) {
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
validServiceNumber(simulation, tripNumber);
|
||||
// 最后一位数字:偶数上行、奇数下行
|
||||
boolean right = (tripNumber.charAt(tripNumber.length() - 1) - 48) % 2 == 0;
|
||||
validServiceNumber(simulation, tripNumber, right);
|
||||
Optional<VirtualRealityTrain> virtualRealityTrainOptional = repository.getAllVrTrain().stream()
|
||||
.filter(trainInfo -> !repository.isVrTrainOnline(trainInfo.getGroupNumber()))
|
||||
.findFirst();
|
||||
@ -890,13 +888,13 @@ public class AtsTrainLoadService {
|
||||
*/
|
||||
public void updateServiceNumberTrain(Simulation simulation, String tripNumber, String groupNumber) {
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
validServiceNumber(simulation, tripNumber);
|
||||
// 最后一位数字:偶数上行、奇数下行
|
||||
boolean right = (tripNumber.charAt(tripNumber.length() - 1) - 48) % 2 == 0;
|
||||
validServiceNumber(simulation, tripNumber, right);
|
||||
if (!repository.isVrTrainOnline(groupNumber)) {
|
||||
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, String.format("车组号[%s]的列车不存在", groupNumber));
|
||||
}
|
||||
VirtualRealityTrain virtualRealityTrain = repository.getVRByCode(groupNumber, VirtualRealityTrain.class);
|
||||
// 最后一位数字:偶数上行、奇数下行
|
||||
boolean right = (tripNumber.charAt(tripNumber.length() - 1) - 48) % 2 == 0;
|
||||
if (!Objects.equals(right, virtualRealityTrain.isRight())) {
|
||||
atpService.turnDirectionImmediately(virtualRealityTrain);
|
||||
}
|
||||
@ -913,7 +911,7 @@ public class AtsTrainLoadService {
|
||||
* @param simulation 仿真实体
|
||||
* @param tripNumber 车次号
|
||||
*/
|
||||
private void validServiceNumber(Simulation simulation, String tripNumber) {
|
||||
private void validServiceNumber(Simulation simulation, String tripNumber, boolean right) {
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
boolean isExist = repository.getTrainInfoMap().values().stream()
|
||||
.anyMatch(trainInfo -> tripNumber.equals(trainInfo.getTripNumber()));
|
||||
@ -926,6 +924,11 @@ public class AtsTrainLoadService {
|
||||
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL,
|
||||
String.format("车次[%s]要以数字结尾", tripNumber));
|
||||
}
|
||||
// 最后一位数字:偶数上行、奇数下行
|
||||
boolean checkRight = lastNum % 2 == 0;
|
||||
if (!Objects.equals(right, checkRight)) {
|
||||
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "列车车次与上下行不匹配");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -418,8 +418,10 @@ public class CiApiServiceImpl2 implements CiApiService {
|
||||
} else {
|
||||
throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("signalCode和routeCode不能都为空");
|
||||
}
|
||||
// 判断是否要进行进路判断,大铁可以不对进路判断
|
||||
boolean firstCheck = config.isHasCTC() ? false : config.isGuideNeedRouteSettingFirst();
|
||||
//条件检查
|
||||
if (config.isGuideNeedRouteSettingFirst()) {
|
||||
if (firstCheck) {
|
||||
List<Route> routeList = signal.getRouteList();
|
||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(routeList, String.format("信号机[%s]非进路始端信号机", signal.getCode()));
|
||||
if (route != null) {
|
||||
@ -442,7 +444,7 @@ public class CiApiServiceImpl2 implements CiApiService {
|
||||
String.format("对%s开放引导操作失败,接近区段没有列车占用", signal.getName()));
|
||||
}
|
||||
//办理引导进路或开放引导信号
|
||||
if (config.isGuideNeedRouteSettingFirst()) {
|
||||
if (firstCheck) {
|
||||
this.signalService.tryControlSignalAspectAccordingLevel(simulation, signal, signal.getSignalModel().getGuideAspect());
|
||||
} else {
|
||||
if (route != null) {
|
||||
@ -454,10 +456,18 @@ public class CiApiServiceImpl2 implements CiApiService {
|
||||
} else {
|
||||
if (signal.getLockedRoute() != null) { //如果有已锁闭进路
|
||||
this.signalService.tryControlSignalAspectAccordingLevel(simulation, signal, signal.getSignalModel().getGuideAspect());
|
||||
} else if (!CollectionUtils.isEmpty(signal.getRouteList())) { //如果signal锁闭进路为null,筛选最合适的进路(直线进路>分叉进路>折返进路)
|
||||
List<Route> collect = signal.getRouteList().stream()
|
||||
} else if (!CollectionUtils.isEmpty(signal.getRouteList())) {
|
||||
List<Route> collect;
|
||||
if (config.isHasCTC()) { // 大铁配置引导进路
|
||||
collect = getCtcGuideRouteList(repository, signal);
|
||||
if (collect == null) {
|
||||
return;
|
||||
}
|
||||
} else { //如果signal锁闭进路为null,筛选最合适的进路(直线进路>分叉进路>折返进路)
|
||||
collect = signal.getRouteList().stream()
|
||||
.filter(r -> !r.isTurnBack() && CollectionUtils.isEmpty(r.getSwitchList()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
if (CollectionUtils.isEmpty(collect)) {
|
||||
collect = signal.getRouteList().stream().filter(r -> !r.isTurnBack()).collect(Collectors.toList());
|
||||
}
|
||||
@ -479,6 +489,7 @@ public class CiApiServiceImpl2 implements CiApiService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setEst(Simulation simulation, ESP esp) {
|
||||
esp.update(true);
|
||||
@ -711,4 +722,61 @@ public class CiApiServiceImpl2 implements CiApiService {
|
||||
}
|
||||
return virtualAxleCounter;
|
||||
}
|
||||
|
||||
/**
|
||||
* 大铁、办理引导时获取进路列表
|
||||
*
|
||||
* @param repository 仿真实体
|
||||
* @param signal 信号机
|
||||
*/
|
||||
private List<Route> getCtcGuideRouteList(SimulationDataRepository repository, Signal signal) {
|
||||
// 获取已信号机开头的进路集合
|
||||
List<Route> routeList = repository.getRouteList().stream()
|
||||
.filter(routePojo -> routePojo.isTrainRoute() && routePojo.getStart().getCode().equals(signal.getCode()))
|
||||
.collect(Collectors.toList());
|
||||
// 进路走向
|
||||
boolean isRight = routeList.stream().anyMatch(Route::isRight);
|
||||
// 终端信号机类型,信号机类型匹配时停止循环
|
||||
List<Signal.SignalType> endTypeList = Signal.SignalType.SHUNTING2.equals(signal.getType()) ?
|
||||
Arrays.asList(Signal.SignalType.RECEIVING, Signal.SignalType.DEPARTURE) : Arrays.asList(Signal.SignalType.SHUNTING2);
|
||||
// 终止索引,最多循环20次,防止死循环
|
||||
int endIndex = 0;
|
||||
Section nextSection = signal.getSection();
|
||||
Signal endSignal; // 终端信号机
|
||||
do {
|
||||
if (nextSection.isSwitchTrack()) { // 如果是计轴区段
|
||||
nextSection = nextSection.getNextRunningSectionOf(isRight);
|
||||
} else { // 下一区段
|
||||
nextSection = nextSection.getNextSection(isRight);
|
||||
}
|
||||
if (nextSection == null) { // 道岔不连续不能办理进路,直接返回结果
|
||||
log.error("进路不连续");
|
||||
return null;
|
||||
}
|
||||
// 获取信号机
|
||||
if (isRight) {
|
||||
endSignal = nextSection.getSignalToLeft();
|
||||
} else {
|
||||
endSignal = nextSection.getSignalToRight();
|
||||
}
|
||||
endIndex++;
|
||||
} while (endIndex < 20 && !(endSignal != null && endTypeList.contains(endSignal.getType())));
|
||||
|
||||
// 过滤符合条件的进路
|
||||
if (endSignal != null && endIndex < 20) {
|
||||
String endSignalCode = endSignal.getCode();
|
||||
routeList = routeList.stream()
|
||||
.filter(routePojo -> routePojo.getDestination().getCode().equals(endSignalCode))
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
// 如果是超过第限制停下,获取第endIndex个元素对比
|
||||
String routeSectionCode = nextSection.getCode();
|
||||
final int sectionIndex = endIndex;
|
||||
routeList = routeList.stream()
|
||||
.filter(routePojo -> routePojo.getSectionList().size() >= sectionIndex
|
||||
&& routePojo.getSectionList().get(sectionIndex).getCode().equals(routeSectionCode))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
return routeList;
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ public class CiRouteService {
|
||||
|
||||
/**
|
||||
* 进路排列检查
|
||||
*
|
||||
* @param simulation
|
||||
* @param route
|
||||
* @return
|
||||
@ -174,10 +175,18 @@ public class CiRouteService {
|
||||
|
||||
/**
|
||||
* 排列引导进路
|
||||
*
|
||||
* @param simulation
|
||||
* @param route
|
||||
*/
|
||||
public void setGuide(Simulation simulation, Route route) {
|
||||
// 进路检查
|
||||
Route.CheckFailMessage failMessage = routeSetCheck(simulation, route);
|
||||
if (failMessage == null) {
|
||||
if (route.isLock() && !route.isFleetMode()) {
|
||||
log.info("进路[{}]已经锁闭", route.debugStr());
|
||||
return;
|
||||
}
|
||||
// 引导进路开始办理
|
||||
LocalDateTime systemTime = simulation.getSystemTime();
|
||||
route.startGuideSetting(systemTime);
|
||||
@ -187,9 +196,14 @@ public class CiRouteService {
|
||||
}
|
||||
simulation.getRepository().addSettingRoute(route);
|
||||
}
|
||||
if (Objects.nonNull(failMessage)) {
|
||||
log.info(String.format("进路[%s]排列检查失败,无法排列:%s", route.debugStr(), failMessage.debugStr()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 排列进路
|
||||
*
|
||||
* @param simulation
|
||||
* @param route
|
||||
* @return
|
||||
@ -220,6 +234,7 @@ public class CiRouteService {
|
||||
|
||||
/**
|
||||
* 排列进路过程控制
|
||||
*
|
||||
* @param simulation
|
||||
* @param route
|
||||
*/
|
||||
@ -295,6 +310,7 @@ public class CiRouteService {
|
||||
|
||||
/**
|
||||
* 检查并锁闭主进路(不包含侧防和延续保护)
|
||||
*
|
||||
* @param route
|
||||
*/
|
||||
private void checkAndLockRouteMain(Route route) {
|
||||
@ -319,6 +335,7 @@ public class CiRouteService {
|
||||
|
||||
/**
|
||||
* 解锁进路
|
||||
*
|
||||
* @param simulation
|
||||
* @param route
|
||||
*/
|
||||
@ -380,6 +397,7 @@ public class CiRouteService {
|
||||
|
||||
/**
|
||||
* 延时解锁进路
|
||||
*
|
||||
* @param simulation
|
||||
* @param route
|
||||
*/
|
||||
@ -416,6 +434,7 @@ public class CiRouteService {
|
||||
|
||||
/**
|
||||
* 道岔区段故障解锁
|
||||
*
|
||||
* @param simulation
|
||||
* @param aSwitch
|
||||
* @param route
|
||||
@ -460,6 +479,7 @@ public class CiRouteService {
|
||||
|
||||
/**
|
||||
* 列车逐段解锁进路
|
||||
*
|
||||
* @param simulation
|
||||
* @param route
|
||||
*/
|
||||
@ -495,7 +515,7 @@ public class CiRouteService {
|
||||
if (!logic.isOccupied() && /*!logic.isInvalid() &&*/ logic.isRouteLockOn(right)) {
|
||||
logic.routeUnlocking(route);
|
||||
logic.overlapUnlocking();
|
||||
} else if(logic.isOccupied() /*|| logic.isInvalid()*/) {
|
||||
} else if (logic.isOccupied() /*|| logic.isInvalid()*/) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -564,6 +584,7 @@ public class CiRouteService {
|
||||
|
||||
/**
|
||||
* 延续保护办理
|
||||
*
|
||||
* @param simulation
|
||||
* @param overlap
|
||||
*/
|
||||
@ -589,6 +610,7 @@ public class CiRouteService {
|
||||
|
||||
/**
|
||||
* 延续保护办理过程
|
||||
*
|
||||
* @param simulation
|
||||
* @param overlap
|
||||
*/
|
||||
@ -666,6 +688,7 @@ public class CiRouteService {
|
||||
|
||||
/**
|
||||
* 取消自动进路
|
||||
*
|
||||
* @param route
|
||||
*/
|
||||
public void cancelFleet(Route route) {
|
||||
@ -676,6 +699,7 @@ public class CiRouteService {
|
||||
|
||||
/**
|
||||
* 设置联锁自动触发
|
||||
*
|
||||
* @param route
|
||||
*/
|
||||
public void setCIAutoTrigger(Route route) {
|
||||
@ -690,6 +714,7 @@ public class CiRouteService {
|
||||
|
||||
/**
|
||||
* 取消联锁自动触发
|
||||
*
|
||||
* @param route
|
||||
*/
|
||||
public void cancelCIAutoTrigger(Route route) {
|
||||
|
@ -589,6 +589,8 @@ public class CommandBO {
|
||||
// 存在锁闭进路,获取进路末端
|
||||
if (signal != null && signal.getLockedRoute() != null) {
|
||||
nextSection = signal.getLockedRoute().getDestination().getSection();
|
||||
} else if (nextSection.isRouteLock()) { // 如果当前区段进路锁闭
|
||||
nextSection = nextSection.getRoute().getDestination().getSection();
|
||||
} else if (nextSection.isSwitchTrack()) { // 是邻近岔道
|
||||
nextSection = nextSection.getNextRunningSectionOf(isRight);
|
||||
} else {
|
||||
@ -624,9 +626,10 @@ public class CommandBO {
|
||||
@Override
|
||||
public Step execute(Simulation simulation, CommandBO command) {
|
||||
SimulationMember targetMember = command.getTargetMember();
|
||||
VirtualRealityTrain train = (VirtualRealityTrain) targetMember.getDevice();
|
||||
targetMember.setCommand(null);
|
||||
// 设置目标位置
|
||||
return buildDriveStep(null);
|
||||
return buildDriveStep(train.getHeadPosition());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -822,6 +822,24 @@ public class Section extends DelayUnlockDevice {
|
||||
return atpSectionList;
|
||||
}
|
||||
|
||||
/**
|
||||
* isSwitchSingleHandle 为TRUE的情况下,获取区段列表
|
||||
*
|
||||
* @return 区段列表
|
||||
*/
|
||||
public List<Section> getSwitchAxleSectionsBySwitchPositionBySwitchSingleHandle() {
|
||||
List<Section> atpSectionList = new ArrayList<>();
|
||||
Section parent = this.getParent();
|
||||
List<Switch> relSwitchList = parent.getRelSwitchList();
|
||||
// 反位情况下
|
||||
if (relSwitchList.stream().anyMatch(Switch::isPosR)) {
|
||||
relSwitchList.stream().filter(Switch::isPosR).forEach(relSwitch -> atpSectionList.addAll(relSwitch.getSectionsByPosition()));
|
||||
} else {
|
||||
relSwitchList.forEach(relSwitch -> atpSectionList.addAll(relSwitch.getSectionsByPosition()));
|
||||
}
|
||||
return atpSectionList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判定为非通信车占用
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user