新增:通信车无法通过有通信车占用故障的区段

This commit is contained in:
joylink_zhangsai 2021-08-25 15:30:32 +08:00
parent d9ff56069c
commit f7f6b4d77a

View File

@ -12,6 +12,7 @@ import club.joylink.rtss.simulation.cbtc.onboard.ATP.OnboardAtpApiService;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.stream.Collectors;
@ -211,6 +212,16 @@ public class MaService {
}
break;
}
case CTC_Occupied_Fault:{
Section section = (Section) this.device;
Section physicalSection = section;
if (!physicalSection.isPhysical()) {
physicalSection = physicalSection.getParent();
}
eoa = new SectionPosition(physicalSection, right ? section.getMinOffset() : section.getMaxOffset());
eoa = CalculateService.calculateNextPositionByStartAndLen(eoa, !right, 10);
break;
}
default:
throw new IllegalStateException("未知的移动授权类型: " + this.type);
}
@ -299,6 +310,8 @@ public class MaService {
Stand,
/** ITC终端信号 */
ITC_Signal,
/** 通信车占用故障 */
CTC_Occupied_Fault,
}
public void calculateMaOfCtcTrains(Simulation simulation) {
@ -422,6 +435,27 @@ public class MaService {
Ma ma2 = this.queryFrontTrain(train, section, trainMap);
ma = this.checkAndUpdateMa(ma, ma2);
}
if (Section.AxleFault.CBTC_OCCUPIED_FAULT.equals(section.getFault()) && section.isCtOccupied()) {
ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.CTC_Occupied_Fault));
} else {
List<Section> logicList = section.getLogicList();
if (!CollectionUtils.isEmpty(logicList)) {
if (right) {
for (Section logic : logicList) {
if (Section.AxleFault.CBTC_OCCUPIED_FAULT.equals(logic.getFault()) && logic.isCtOccupied()) {
ma = this.checkAndUpdateMa(ma, new Ma(train, logic, MaType.CTC_Occupied_Fault));
}
}
} else {
for (int k = logicList.size() - 1; k >= 0; k--) {
Section logic = logicList.get(k);
if (Section.AxleFault.CBTC_OCCUPIED_FAULT.equals(logic.getFault()) && logic.isCtOccupied()) {
ma = this.checkAndUpdateMa(ma, new Ma(train, logic, MaType.CTC_Occupied_Fault));
}
}
}
}
}
// ZC(尽头区段)边界
if (!section.anyZcWorking() &&
(headPosition.getSection().equals(section) ||