【大铁非通信车区段占用处理】
This commit is contained in:
parent
89926b72ee
commit
e02768821c
@ -82,6 +82,7 @@ public class AtpSectionService {
|
|||||||
SimulationDataRepository repository = simulation.getRepository();
|
SimulationDataRepository repository = simulation.getRepository();
|
||||||
MapConfig config = repository.getConfig();
|
MapConfig config = repository.getConfig();
|
||||||
boolean switchSingleHandle = config.isSwitchSingleHandle();
|
boolean switchSingleHandle = config.isSwitchSingleHandle();
|
||||||
|
boolean isHasCTC = config.isHasCTC(); // 大铁逻辑
|
||||||
if (train.isCommunicable()) { // 通信车占用
|
if (train.isCommunicable()) { // 通信车占用
|
||||||
// 车尾位置追加不确定性距离:(速度*2)m
|
// 车尾位置追加不确定性距离:(速度*2)m
|
||||||
SectionPosition trainTailPosition = CalculateService
|
SectionPosition trainTailPosition = CalculateService
|
||||||
@ -110,7 +111,7 @@ public class AtpSectionService {
|
|||||||
for (Section section : sectionList) {
|
for (Section section : sectionList) {
|
||||||
if (section.isSwitchAxleCounterSection()) {
|
if (section.isSwitchAxleCounterSection()) {
|
||||||
Section switchSection = section.getLogicList().get(0);
|
Section switchSection = section.getLogicList().get(0);
|
||||||
if (switchSingleHandle) {
|
if (switchSingleHandle && isHasCTC) {
|
||||||
atpSectionList.addAll(handleSingleSwitchPosition(section, right));
|
atpSectionList.addAll(handleSingleSwitchPosition(section, right));
|
||||||
} else {
|
} else {
|
||||||
atpSectionList.addAll(switchSection.getSwitchAxleSectionsBySwitchPosition());
|
atpSectionList.addAll(switchSection.getSwitchAxleSectionsBySwitchPosition());
|
||||||
|
@ -74,32 +74,37 @@ public class GroundAtpApiServiceImpl implements GroundAtpApiService {
|
|||||||
section.communicateTrainOccupy(train.isRight());
|
section.communicateTrainOccupy(train.isRight());
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
// 非通信车占用
|
// 大铁逻辑
|
||||||
nctSectionMap.forEach(((train, sections) -> {
|
if (simulation.getRepository().getConfig().isHasCTC()) {
|
||||||
//简单写法,效率比较低
|
// 非通信车占用
|
||||||
// sections.stream().filter(section -> train.getHeadPosition()
|
nctSectionMap.forEach(((train, sections) -> {
|
||||||
// .isAheadOf(section, section.getStopPointByDirection(train.isRight()),train.isRight())
|
// 判断车头所在位置
|
||||||
// ).forEach(section -> section.nonCommunicateTrainOccupy(train.isRight()));
|
int index = sections.indexOf(train.getHeadPosition().getSection());
|
||||||
// 判断车头所在位置
|
if (index > 0) {
|
||||||
int index = sections.indexOf(train.getHeadPosition().getSection());
|
/**
|
||||||
if (index > 0) {
|
* 这样写是为了解决反位道岔区段不按顺序加入的问题
|
||||||
/**
|
* 错误:T111,T114,T112,T137,T138,T136,T135
|
||||||
* 这样写是为了解决反位道岔区段不按顺序加入的问题
|
* 正常:T111,T114,T112,T137,T138,T135,T136
|
||||||
* 错误:T111,T114,T112,T137,T138,T136,T135
|
*
|
||||||
* 正常:T111,T114,T112,T137,T138,T135,T136
|
* 处理步骤是将T135前部全部标识状态后,再处理T135
|
||||||
*
|
*
|
||||||
* 处理步骤是将T135前部全部标识状态后,再处理T135
|
* 因为是追加添加,判断下区段位置跟车头位置
|
||||||
*
|
*/
|
||||||
* 因为是追加添加,判断下区段位置跟车头位置
|
int nextIndex = sections.indexOf(train.getHeadPosition().getSection().getNextRunningSectionOf(train.isRight()));
|
||||||
*/
|
int limitIndex = (nextIndex == -1) ? sections.size() : ((nextIndex > index) ? index + 1 : nextIndex);
|
||||||
int nextIndex = sections.indexOf(train.getHeadPosition().getSection().getNextRunningSectionOf(train.isRight()));
|
sections.stream().limit(limitIndex).forEach(section -> section.nonCommunicateTrainOccupy(train.isRight()));
|
||||||
int limitIndex = (nextIndex == -1) ? sections.size() : ((nextIndex > index) ? index + 1 : nextIndex);
|
}
|
||||||
sections.stream().limit(limitIndex).forEach(section -> section.nonCommunicateTrainOccupy(train.isRight()));
|
if (index > -1) {
|
||||||
}
|
sections.get(index).nonCommunicateTrainOccupy(train.isRight());
|
||||||
if (index > -1) {
|
}
|
||||||
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);
|
this.atpSectionService.changeSignalModeByTrainApproach(simulation, onlineTrainList, trainAtpSectionMap);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user