Merge remote-tracking branch 'origin/test' into ats-restruct

This commit is contained in:
walker-sheng 2021-07-13 10:49:36 +08:00
commit 8612c012a9
2 changed files with 24 additions and 55 deletions

View File

@ -172,17 +172,13 @@ public class ZCLogicLoop {
}
}
// 道岔
MovementAuthority.End end = checkSwitch(section);
MovementAuthority.End end = checkSwitch(section, right);
if (end != null)
endList.add(end);
// 轨道尽头/问题道岔
Section temp = section.getNextRunningSectionOf(right);
if (Objects.isNull(temp)) { // 到尽头
if (section.isSwitchTrack()) { // 问题道岔
if (Objects.nonNull(section.getSectionOf(!right))) {
endList.add(new MovementAuthority.End(section.getSectionOf(!right), MovementAuthority.EndType.FAULT_SWITCH));
}
} else {
if (!section.isSwitchTrack()) { // 问题道岔
endList.add(new MovementAuthority.End(section, MovementAuthority.EndType.END_TRACK));
}
break;
@ -221,9 +217,9 @@ public class ZCLogicLoop {
private MovementAuthority.End checkSwitch(Section tailSection, Section headSection, boolean right) {
Section section = tailSection;
for (int i = 0; i < 10; i++) {
if (section.equals(headSection))
if (section == null || section.equals(headSection))
break;
MovementAuthority.End end = checkSwitch(section);
MovementAuthority.End end = checkSwitch(section, right);
if (end != null)
return end;
section = section.getNextRunningSectionOf(right);
@ -231,20 +227,26 @@ public class ZCLogicLoop {
return null;
}
private MovementAuthority.End checkSwitch(Section section) {
private MovementAuthority.End checkSwitch(Section section, boolean right) {
Switch relSwitch = section.getRelSwitch();
if (relSwitch != null) {
Section nextSection = section.getNextRunningSectionOf(right);
if (relSwitch != null) { //是道岔区段
Route route = relSwitch.getRoute();
if ((relSwitch.isRouteLock() || relSwitch.isOverlapLock()) && relSwitch.isLoss()) { //区段进路/延续保护锁闭且失表
return new MovementAuthority.End(section, MovementAuthority.EndType.FAULT_SWITCH);
} else if (route != null) {
List<RouteFls> flsList = route.getFlsList();
if (!CollectionUtils.isEmpty(flsList)) {
List<RouteFls> fls = flsList.stream()
.filter(routeFls -> routeFls.getBase().getASwitch().equals(relSwitch))
.collect(Collectors.toList());
if (!routeService.isFlsCheckPass(fls)) {
return new MovementAuthority.End(section, MovementAuthority.EndType.FAULT_SWITCH);
Section previousSection = section.getNextRunningSectionOf(!right);
if (previousSection == null)
return null;
if (route != null) { //道岔进路锁闭
if (relSwitch.isLoss() && nextSection == null) { //失表且下个区段为null如果下个区段不为null说明已经越过了失表的道岔
return new MovementAuthority.End(previousSection, MovementAuthority.EndType.FAULT_SWITCH);
} else if (nextSection.getRelSwitch() == relSwitch){ //下个区段的关联道岔与当前区段关联道岔一样说明没越过该道岔
List<RouteFls> flsList = route.getFlsList();
if (!CollectionUtils.isEmpty(flsList)) {
List<RouteFls> fls = flsList.stream()
.filter(routeFls -> routeFls.getBase().getASwitch().equals(relSwitch))
.collect(Collectors.toList());
if (!routeService.isFlsCheckPass(fls)) {
return new MovementAuthority.End(previousSection, MovementAuthority.EndType.FAULT_SWITCH);
}
}
}
}
@ -346,27 +348,12 @@ public class ZCLogicLoop {
// 轨道尽头/问题道岔
Section temp = section.getNextRunningSectionOf(right);
if (Objects.isNull(temp)) { // 到尽头
if (section.isSwitchTrack()) { // 问题道岔
if (Objects.nonNull(section.getSectionOf(!right))) {
endList.add(new MovementAuthority.End(section.getSectionOf(!right),
MovementAuthority.EndType.FAULT_SWITCH));
// deviceEnd = new MovementAuthority.End(section.getSectionOf(!right),
// MovementAuthority.EndType.FAULT_SWITCH);
}
} else {
if (!section.isSwitchTrack()) { // 问题道岔
endList.add(new MovementAuthority.End(section,
MovementAuthority.EndType.END_TRACK));
// deviceEnd = new MovementAuthority.End(section,
// MovementAuthority.EndType.END_TRACK);
}
break;
}
// else {
// if (temp.isNonCbtcOccupy() && temp.isInvalid()) {
// endList.add(new MovementAuthority.End(temp, MovementAuthority.EndType.NCT_OCCUPIED_SECTION));
// }
// }
section = temp;
}
if (Objects.nonNull(deviceEnd)) {
endList.add(deviceEnd);
@ -374,20 +361,6 @@ public class ZCLogicLoop {
return endList;
}
private MovementAuthority.End checkFaultSwitchAfterSignal(Signal signal) {
if (Objects.nonNull(signal)) {
Section section = signal.getSection().getSectionOf(signal.isRight());
if (Objects.nonNull(section) && section.isSwitchTrack()) {
Switch relSwitch = section.getRelSwitch();
if (relSwitch.isLoss() && relSwitch.isLoss()) {
return new MovementAuthority.End(signal.getSection(),
MovementAuthority.EndType.FAULT_SWITCH);
}
}
}
return null;
}
/**
* 比较并构建移动授权数据
*

View File

@ -135,11 +135,7 @@ public class MovementAuthority {
float offset = right ? section.getLen() : 0;
return new SectionPosition(section, offset);
}
case UNLOCKED_OVERLAP: { //这种情况下section是进路的最后一个区段
Section section = (Section) this.device;
float offset = right ? Math.max(0, section.getLen() - 100) : Math.min(100, section.getLen());
return new SectionPosition(section, offset);
}
case UNLOCKED_OVERLAP:
case FAULT_SWITCH: {
Section section = (Section) this.device;
float offset = right ? 0 : section.getLen();