修改:移动授权计算

This commit is contained in:
joylink_zhangsai 2021-07-13 10:32:33 +08:00
parent 792263361e
commit 5b1603cca4
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) if (end != null)
endList.add(end); endList.add(end);
// 轨道尽头/问题道岔 // 轨道尽头/问题道岔
Section temp = section.getNextRunningSectionOf(right); Section temp = section.getNextRunningSectionOf(right);
if (Objects.isNull(temp)) { // 到尽头 if (Objects.isNull(temp)) { // 到尽头
if (section.isSwitchTrack()) { // 问题道岔 if (!section.isSwitchTrack()) { // 问题道岔
if (Objects.nonNull(section.getSectionOf(!right))) {
endList.add(new MovementAuthority.End(section.getSectionOf(!right), MovementAuthority.EndType.FAULT_SWITCH));
}
} else {
endList.add(new MovementAuthority.End(section, MovementAuthority.EndType.END_TRACK)); endList.add(new MovementAuthority.End(section, MovementAuthority.EndType.END_TRACK));
} }
break; break;
@ -221,9 +217,9 @@ public class ZCLogicLoop {
private MovementAuthority.End checkSwitch(Section tailSection, Section headSection, boolean right) { private MovementAuthority.End checkSwitch(Section tailSection, Section headSection, boolean right) {
Section section = tailSection; Section section = tailSection;
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
if (section.equals(headSection)) if (section == null || section.equals(headSection))
break; break;
MovementAuthority.End end = checkSwitch(section); MovementAuthority.End end = checkSwitch(section, right);
if (end != null) if (end != null)
return end; return end;
section = section.getNextRunningSectionOf(right); section = section.getNextRunningSectionOf(right);
@ -231,20 +227,26 @@ public class ZCLogicLoop {
return null; return null;
} }
private MovementAuthority.End checkSwitch(Section section) { private MovementAuthority.End checkSwitch(Section section, boolean right) {
Switch relSwitch = section.getRelSwitch(); Switch relSwitch = section.getRelSwitch();
if (relSwitch != null) { Section nextSection = section.getNextRunningSectionOf(right);
if (relSwitch != null) { //是道岔区段
Route route = relSwitch.getRoute(); Route route = relSwitch.getRoute();
if ((relSwitch.isRouteLock() || relSwitch.isOverlapLock()) && relSwitch.isLoss()) { //区段进路/延续保护锁闭且失表 Section previousSection = section.getNextRunningSectionOf(!right);
return new MovementAuthority.End(section, MovementAuthority.EndType.FAULT_SWITCH); if (previousSection == null)
} else if (route != 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(); List<RouteFls> flsList = route.getFlsList();
if (!CollectionUtils.isEmpty(flsList)) { if (!CollectionUtils.isEmpty(flsList)) {
List<RouteFls> fls = flsList.stream() List<RouteFls> fls = flsList.stream()
.filter(routeFls -> routeFls.getBase().getASwitch().equals(relSwitch)) .filter(routeFls -> routeFls.getBase().getASwitch().equals(relSwitch))
.collect(Collectors.toList()); .collect(Collectors.toList());
if (!routeService.isFlsCheckPass(fls)) { if (!routeService.isFlsCheckPass(fls)) {
return new MovementAuthority.End(section, MovementAuthority.EndType.FAULT_SWITCH); return new MovementAuthority.End(previousSection, MovementAuthority.EndType.FAULT_SWITCH);
}
} }
} }
} }
@ -346,27 +348,12 @@ public class ZCLogicLoop {
// 轨道尽头/问题道岔 // 轨道尽头/问题道岔
Section temp = section.getNextRunningSectionOf(right); Section temp = section.getNextRunningSectionOf(right);
if (Objects.isNull(temp)) { // 到尽头 if (Objects.isNull(temp)) { // 到尽头
if (section.isSwitchTrack()) { // 问题道岔 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 {
endList.add(new MovementAuthority.End(section, endList.add(new MovementAuthority.End(section,
MovementAuthority.EndType.END_TRACK)); MovementAuthority.EndType.END_TRACK));
// deviceEnd = new MovementAuthority.End(section,
// MovementAuthority.EndType.END_TRACK);
} }
break; break;
} }
// else {
// if (temp.isNonCbtcOccupy() && temp.isInvalid()) {
// endList.add(new MovementAuthority.End(temp, MovementAuthority.EndType.NCT_OCCUPIED_SECTION));
// }
// }
section = temp;
} }
if (Objects.nonNull(deviceEnd)) { if (Objects.nonNull(deviceEnd)) {
endList.add(deviceEnd); endList.add(deviceEnd);
@ -374,20 +361,6 @@ public class ZCLogicLoop {
return endList; 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; float offset = right ? section.getLen() : 0;
return new SectionPosition(section, offset); return new SectionPosition(section, offset);
} }
case UNLOCKED_OVERLAP: { //这种情况下section是进路的最后一个区段 case UNLOCKED_OVERLAP:
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 FAULT_SWITCH: { case FAULT_SWITCH: {
Section section = (Section) this.device; Section section = (Section) this.device;
float offset = right ? 0 : section.getLen(); float offset = right ? 0 : section.getLen();