修改:ARB故障逻辑

This commit is contained in:
joylink_zhangsai 2021-07-01 15:27:59 +08:00
parent 6c6da7560d
commit d83a076f14
7 changed files with 72 additions and 55 deletions

View File

@ -94,9 +94,9 @@ public class SectionGeneratorNew implements GeneratorNew {
case Section_Confirm_Axis_Valid:
// 设置计轴失效ARB
if (Objects.nonNull(section.getParent())) {
section.getParent().judgeAsInvalid();
section.getParent().judgeAsNctOccupied();
} else {
section.judgeAsInvalid();
section.judgeAsNctOccupied();
}
break;
case Section_Fault_Unlock:

View File

@ -6,7 +6,6 @@ import club.joylink.rtss.services.training.generatornew.annotation.GeneratorSele
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
import club.joylink.rtss.simulation.cbtc.ATS.service.AtsSectionService;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.map.Section;
import club.joylink.rtss.simulation.cbtc.data.map.Switch;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySectionAxleCounter;
import club.joylink.rtss.simulation.cbtc.tool.DeviceStatusModifyTool;
@ -108,7 +107,7 @@ public class SwitchGeneratorNew implements GeneratorNew {
}
case Switch_Confirm_Axis_Valid:{
// 背景为道岔计轴失效
aSwitch.getA().getParent().judgeAsInvalid();
aSwitch.getA().getParent().judgeAsNctOccupied();
break;
}
default:

View File

@ -178,13 +178,17 @@ public class AtpSectionService {
* @param sectionList
*/
public void sectionARBCheck(Simulation simulation, Section section, List<Section> sectionList) {
if (!section.isInvalid() && section.isNctOccupied()) {
if (!sectionList.contains(section)) {
log.debug(String.format("区段[%s(%s)]检测为ARB故障",
section.getName(), section.getCode()));
section.judgeAsInvalid();
}
//目前ARB故障才会导致ARB判定
if (Section.AxleFault.ARB.equals(section.getFault()) && section.getVirtualAxleCounter().isOccupy() && !sectionList.contains(section)) {
section.judgeAsARB();
} else if (section.getVirtualAxleCounter().isOccupy() && sectionList.contains(section)){
section.judgeAsNctOccupied();
}
// if (/*!section.isInvalid() &&*/ section.isNctOccupied()) {
// if (!sectionList.contains(section)) {
// section.judgeAsNctOccupied();
// }
// }
//ARB故障恢复判断
if (Section.AxleFault.ARB.equals(section.getFault()) && !section.getVirtualAxleCounter().isOccupy()) {
Section.AxleFault.ARB.fix(section);
@ -192,7 +196,7 @@ public class AtpSectionService {
}
/**
* 获取车可能存在的范围
* 获取非通信车可能存在的范围
*
* @param simulation
* @param trainList
@ -201,6 +205,9 @@ public class AtpSectionService {
public List<Section> getTrainExistAxleSectionsUnderDelay(Simulation simulation, List<VirtualRealityTrain> trainList) {
List<Section> list = new ArrayList<>();
for (VirtualRealityTrain train : trainList) {
//只统计非通信车
if (train.isCBTC())
continue;
boolean right = train.isRight();
SectionPosition headPosition = train.getHeadPosition();
float offset = 50;

View File

@ -72,8 +72,8 @@ public class GroundAtpApiServiceImpl implements GroundAtpApiService {
for (Section section : axleSectionList) {
this.atpSectionService.sectionARBCheck(simulation, section, trainExistAxleSectionList);
}
// 判断是否要将ARB设为非通信车占用
this.atpSectionService.judgeFaultSectionAsNctOccupied(nctApproachSignalMap);
// // 判断是否要将ARB设为非通信车占用
// this.atpSectionService.judgeFaultSectionAsNctOccupied(nctApproachSignalMap);
// 根据道岔的位置修改道岔区段的占用暂时只处理因故障导致的占用
repository.getSwitchList().stream().filter(aSwitch -> Section.AxleFault.CBTC_OCCUPIED_FAULT.equals(aSwitch.getA().getFault()))
.forEach(aSwitch -> {

View File

@ -177,7 +177,7 @@ public class ZCLogicLoop {
break;
}
//非通信车占用区段
if (temp.isNonCbtcOccupy() && !section.isInvalid()) {
if (temp.isNonCbtcOccupy() && !temp.isInvalid()) {
endList.add(new MovementAuthority.End(temp, MovementAuthority.EndType.NCT_OCCUPIED_SECTION));
}
//检查关闭的区段

View File

@ -434,7 +434,8 @@ public class Section extends MayOutOfOrderDevice {
public void axleCounterOccupy(boolean right) {
if (!this.isInvalid()) {
this.trainRight = right;
this.nctOccupied = true;
this.setNctOccupied(true);
// this.nctOccupied = true;
// if (!CollectionUtils.isEmpty(logicList)) {
// logicList.forEach(logic -> logic.axleCounterOccupy(right));
// }
@ -685,9 +686,17 @@ public class Section extends MayOutOfOrderDevice {
this.ctOccupied = true;
}
public void setNctOccupied(boolean nctOccupied) {
if (nctOccupied) {
this.invalid = false;
}
this.nctOccupied = nctOccupied;
}
public void nonCommunicateTrainOccupy(boolean right) {
this.trainRight = right;
this.nctOccupied = true;
this.setNctOccupied(true);
// this.nctOccupied = true;
this.ctOccupied = false;
}
@ -726,10 +735,9 @@ public class Section extends MayOutOfOrderDevice {
}
/**
* 判定为失效ARB暂时改为判定非通信车占用
* 判定为非通信车占用
*/
public void judgeAsInvalid() {
//暂时改为判定非通信车占用国赛用
public void judgeAsNctOccupied() {
if (!this.isAxleCounter()) {
return;
}
@ -758,37 +766,6 @@ public class Section extends MayOutOfOrderDevice {
logic.setNctOccupied(true);
}
}
// if (!this.isAxleCounter()) {
// throw new SimulationException(SimulationExceptionType.System_Fault);
// }
// this.setInvalid(true);
// this.setNctOccupied(false);
// if (this.isSwitchAxleCounterSection()) { // 道岔计轴区段
// List<Switch> relSwitchList = this.getRelSwitchList();
// for (Switch aSwitch : relSwitchList) {
// aSwitch.getA().setInvalid(true);
// aSwitch.getA().setNctOccupied(false);
// if (aSwitch.isNormalPosition()) {
// aSwitch.getB().setInvalid(true);
// aSwitch.getB().setNctOccupied(false);
// } else if (aSwitch.isReversePosition()) {
// aSwitch.getC().setInvalid(true);
// aSwitch.getC().setNctOccupied(false);
// } else {
// aSwitch.getB().setInvalid(true);
// aSwitch.getB().setNctOccupied(false);
// aSwitch.getC().setInvalid(true);
// aSwitch.getC().setNctOccupied(false);
// }
// }
// } else if (!CollectionUtils.isEmpty(this.logicList)) {
// for (Section logic : this.logicList) {
// logic.setInvalid(true);
// logic.setNctOccupied(false);
// }
// }
}
/**
@ -1033,6 +1010,40 @@ public class Section extends MayOutOfOrderDevice {
return false;
}
public void setInvalid(boolean invalid) {
if (invalid) {
this.setNctOccupied(false);
}
this.invalid = invalid;
}
public void judgeAsARB() {
if (!this.isAxleCounter()) {
return;
}
this.setInvalid(true);
if (this.isSwitchAxleCounterSection()) { // 道岔计轴区段
List<Switch> relSwitchList = this.getRelSwitchList();
for (Switch aSwitch : relSwitchList) {
aSwitch.getA().setInvalid(true);
if (aSwitch.isNormalPosition()) {
aSwitch.getB().setInvalid(true);
aSwitch.getC().setInvalid(false);
} else if (aSwitch.isReversePosition()) {
aSwitch.getC().setInvalid(true);
aSwitch.getB().setInvalid(false);
} else {
aSwitch.getB().setInvalid(true);
aSwitch.getC().setInvalid(true);
}
}
} else if (!CollectionUtils.isEmpty(this.logicList)) {
for (Section logic : this.logicList) {
logic.setInvalid(true);
}
}
}
public enum SectionRoadType {
/**
* 左行线
@ -1154,10 +1165,10 @@ public class Section extends MayOutOfOrderDevice {
flag = true;
VirtualRealitySectionAxleCounter.Fault.FAULT.apply(axleSection.getVirtualAxleCounter());
axleSection.setFault(this);
axleSection.setInvalid(true);
if (!CollectionUtils.isEmpty(axleSection.getLogicList())) {
axleSection.getLogicList().forEach(logic -> logic.setInvalid(true));
}
// axleSection.setInvalid(true);
// if (!CollectionUtils.isEmpty(axleSection.getLogicList())) {
// axleSection.getLogicList().forEach(logic -> logic.setInvalid(true));
// }
}
}
return flag;

View File

@ -167,7 +167,7 @@ public class Switch extends MayOutOfOrderDevice {
* 是否道岔区段被占用
*/
public boolean isSectionOccupied() {
return this.a.isOccupied();
return this.a.isOccupied() && !this.a.isInvalid();
}
/**