【大铁非通信车区段占用处理】

This commit is contained in:
weizhihong 2022-07-05 11:09:17 +08:00
parent 89926b72ee
commit e02768821c
2 changed files with 33 additions and 27 deletions

View File

@ -82,6 +82,7 @@ public class AtpSectionService {
SimulationDataRepository repository = simulation.getRepository();
MapConfig config = repository.getConfig();
boolean switchSingleHandle = config.isSwitchSingleHandle();
boolean isHasCTC = config.isHasCTC(); // 大铁逻辑
if (train.isCommunicable()) { // 通信车占用
// 车尾位置追加不确定性距离(速度*2)m
SectionPosition trainTailPosition = CalculateService
@ -110,7 +111,7 @@ public class AtpSectionService {
for (Section section : sectionList) {
if (section.isSwitchAxleCounterSection()) {
Section switchSection = section.getLogicList().get(0);
if (switchSingleHandle) {
if (switchSingleHandle && isHasCTC) {
atpSectionList.addAll(handleSingleSwitchPosition(section, right));
} else {
atpSectionList.addAll(switchSection.getSwitchAxleSectionsBySwitchPosition());

View File

@ -74,12 +74,10 @@ public class GroundAtpApiServiceImpl implements GroundAtpApiService {
section.communicateTrainOccupy(train.isRight());
}
}));
// 大铁逻辑
if (simulation.getRepository().getConfig().isHasCTC()) {
// 非通信车占用
nctSectionMap.forEach(((train, sections) -> {
//简单写法效率比较低
// sections.stream().filter(section -> train.getHeadPosition()
// .isAheadOf(section, section.getStopPointByDirection(train.isRight()),train.isRight())
// ).forEach(section -> section.nonCommunicateTrainOccupy(train.isRight()));
// 判断车头所在位置
int index = sections.indexOf(train.getHeadPosition().getSection());
if (index > 0) {
@ -100,6 +98,13 @@ public class GroundAtpApiServiceImpl implements GroundAtpApiService {
sections.get(index).nonCommunicateTrainOccupy(train.isRight());
}
}));
} else {
nctSectionMap.forEach(((train, sections) -> {
for (Section section : sections) {
section.nonCommunicateTrainOccupy(train.isRight());
}
}));
}
// 信号机接近信息
this.atpSectionService.changeSignalModeByTrainApproach(simulation, onlineTrainList, trainAtpSectionMap);