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

This commit is contained in:
walker-sheng 2021-05-27 17:31:03 +08:00
commit b5e9cb50f2
8 changed files with 70 additions and 72 deletions

View File

@ -72,16 +72,16 @@ public class AtpSectionService {
List<Signal> signalList = simulation.getRepository().getSignalList(); List<Signal> signalList = simulation.getRepository().getSignalList();
Map<VirtualRealityTrain, Signal> nctApproachSignalMap = new HashMap<>(); Map<VirtualRealityTrain, Signal> nctApproachSignalMap = new HashMap<>();
signalList.forEach(signal -> { signalList.forEach(signal -> {
if (!signal.isNormalOpen()) { // if (!signal.isNormalOpen()) {
for (VirtualRealityTrain train : onlineTrainList) { // for (VirtualRealityTrain train : onlineTrainList) {
List<Section> atpSectionList = trainAtpSectionMap.get(train.getGroupNumber()); // List<Section> atpSectionList = trainAtpSectionMap.get(train.getGroupNumber());
List<Section> physicalList = this.convert2PhysicalSectionList(atpSectionList); // List<Section> physicalList = this.convert2PhysicalSectionList(atpSectionList);
if (!train.isCBTC() && signal.containsApproachPhysicalSection(physicalList)) { //非通信车在物理接近区段上 // if (!train.isCBTC() && signal.containsApproachPhysicalSection(physicalList)) { //非通信车在物理接近区段上
nctApproachSignalMap.put(train, signal); // nctApproachSignalMap.put(train, signal);
} // }
} // }
return; // return;
} // }
SignalApproachMessage.ApproachMessage approachMsg = SignalApproachMessage.ApproachMessage.NULL; SignalApproachMessage.ApproachMessage approachMsg = SignalApproachMessage.ApproachMessage.NULL;
for (VirtualRealityTrain train : onlineTrainList) { for (VirtualRealityTrain train : onlineTrainList) {
List<Section> atpSectionList = trainAtpSectionMap.get(train.getGroupNumber()); List<Section> atpSectionList = trainAtpSectionMap.get(train.getGroupNumber());

View File

@ -237,21 +237,6 @@ public class AtsTrainService {
boolean stop = supervisedTrain.isStop(); boolean stop = supervisedTrain.isStop();
switch (destinationCodeDefinition.getType()) { switch (destinationCodeDefinition.getType()) {
case NORMAL_OPERATION: case NORMAL_OPERATION:
// Station leftStation = destinationCodeDefinition.getLeftStation();
// Station rightStation = destinationCodeDefinition.getRightStation();
// boolean beyondStationRage =
// Math.min(leftStation.getSn(), rightStation.getSn()) > targetStation.getSn()
// || targetStation.getSn() > Math.max(leftStation.getSn(), rightStation.getSn()); //是否超出车站范围
// if (beyondStationRage) {
// throw new SimulationException(SimulationExceptionType.Illegal_Argument,
// String.format("列车目标轨道[%s]超出目的地码[%s]的范围", targetSection, destinationCode));
// }
// if (destinationCodeDefinition.isBorder(targetStation) && destinationCodeDefinition.isFrontTurnBack(targetStation)) {
// boolean bothNormalAndTurnBack = targetSection.isNormalStandTrack() && targetSection.isTurnBackTrack();
// if (!bothNormalAndTurnBack) {
// throw new SimulationException(SimulationExceptionType.Invalid_Operation, "列车已无法站前折返");
// }
// }
case LAST_OPERATION: case LAST_OPERATION:
case NON_OPERATION: case NON_OPERATION:
case LAST_NON_OPERATION: { case LAST_NON_OPERATION: {
@ -265,27 +250,6 @@ public class AtsTrainService {
} }
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(destinationCodeDefinition.containsSection(startSection, right), BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertTrue(destinationCodeDefinition.containsSection(startSection, right),
String.format("%s超出%s范围", String.format("列车[%s]", groupNumber), destinationCodeDefinition.logStr())); String.format("%s超出%s范围", String.format("列车[%s]", groupNumber), destinationCodeDefinition.logStr()));
// if (right == null) {
// throw new SimulationException(SimulationExceptionType.Illegal_Argument,
// String.format("列车[%s]方向未知", groupNumber));
// }
// BusinessExceptionAssertEnum.INVALID_OPERATION.assertNotNull(targetSection,
// String.format("列车[%s]目标区段为null", supervisedTrain.getGroupNumber()));
// Boolean destinationRight = destinationCodeDefinition.getRight();
// if (!targetSection.isTurnBackTrack() || !stop) {
// if (!Objects.equals(right, destinationRight)) {
// throw new SimulationException(SimulationExceptionType.Illegal_Argument,
// String.format("列车方向与目的地码[%s]的方向相反", destinationCode));
// }
// }
// Station station = destinationSection.getStation();
// if ((destinationRight && targetStation.getSn() > station.getSn())
// || (!destinationRight && targetStation.getSn() < station.getSn())) {
// throw new SimulationException(SimulationExceptionType.Illegal_Argument,
// String.format("列车目标轨道[%s]超出目的地码[%s]的范围", targetSection, destinationCode));
// }
break; break;
} }
case OTHER: case OTHER:

View File

@ -895,8 +895,17 @@ public class RouteService {
if (route.isNormalUnlock()) { if (route.isNormalUnlock()) {
return level; return level;
} }
// 屏蔽门检查
Signal start = route.getStart();
Section signalSection = start.getSection();
if (signalSection.isNormalStandTrack()) {
Stand stand = signalSection.getStandList().get(0);
if (Stand.Fault.PSD_CANNOT_BE_CLOSED.equals(stand.getFault())) {
return level;
}
}
// 进路区段检查 // 进路区段检查
boolean right = route.getStart().isRight(); boolean right = start.isRight();
List<Section> sectionList = route.getSectionList(); List<Section> sectionList = route.getSectionList();
for (Section section : sectionList) { for (Section section : sectionList) {
if (!section.isRouteLockOn(right)) { if (!section.isRouteLockOn(right)) {

View File

@ -317,6 +317,9 @@ public class CommandBO {
if (!DriveMode.RM.equals(train.getDriveMode())) { if (!DriveMode.RM.equals(train.getDriveMode())) {
return buildDriverDriveModeChangeOperationStep(train.getGroupNumber(), DriveMode.RM); return buildDriverDriveModeChangeOperationStep(train.getGroupNumber(), DriveMode.RM);
} }
if (train.isSignalEB()) {
return buildReleaseEBStep(train.getGroupNumber());
}
return driveStep; return driveStep;
} }
return null; return null;

View File

@ -9,6 +9,7 @@ import club.joylink.rtss.simulation.cbtc.data.support.MovementAuthority;
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition; import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException; import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -370,7 +371,9 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
*/ */
private VirtualRealityTrain linkTrain; private VirtualRealityTrain linkTrain;
/**最近经过的两个应答器*/ /**
* 最近经过的两个应答器
*/
private Queue<Responder> lastTwoPassedResponders = new FixedQueue<>(Responders_Record); private Queue<Responder> lastTwoPassedResponders = new FixedQueue<>(Responders_Record);
/** /**
@ -693,6 +696,9 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
this.setSignalEB(false); this.setSignalEB(false);
this.setAtoOn(false); this.setAtoOn(false);
this.setDriveMode(DriveMode.RM); this.setDriveMode(DriveMode.RM);
if (RunLevel.CBTC.equals(this.runLevel)) {
this.setCbtcMaMiss();
}
} }
public void useCMMode() { public void useCMMode() {
@ -724,6 +730,9 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
return; return;
} }
this.driveMode = DriveMode.NRM; this.driveMode = DriveMode.NRM;
if (RunLevel.CBTC.equals(this.runLevel)) {
this.setCbtcMaMiss();
}
} }
public void setITCMode() { public void setITCMode() {
@ -755,6 +764,10 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
return this.cbtcMaMissDuration > 3 * 1000; return this.cbtcMaMissDuration > 3 * 1000;
} }
public void setCbtcMaMiss() {
this.cbtcMaMissDuration = 3 * 1000 + 1;
}
/** /**
* itc级别的移动授权是否丢失 * itc级别的移动授权是否丢失
*/ */
@ -1079,7 +1092,7 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
/** /**
* 通信异常 * 通信异常
*/ */
COMMUNICATION_ABNORMAL{ COMMUNICATION_ABNORMAL {
@Override @Override
public void fix(MapElement device) { public void fix(MapElement device) {
VirtualRealityTrain train = (VirtualRealityTrain) device; VirtualRealityTrain train = (VirtualRealityTrain) device;
@ -1112,16 +1125,26 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
} }
} }
public enum RunType{ public enum RunType {
/** 节能 */ /**
* 节能
*/
ENERGY_CONSERVATION, ENERGY_CONSERVATION,
/** 中间的2 */ /**
* 中间的2
*/
MIDDLE_TWO, MIDDLE_TWO,
/** 中间的1 */ /**
* 中间的1
*/
MIDDLE_ONE, MIDDLE_ONE,
/** 正常 */ /**
* 正常
*/
NORMAL, NORMAL,
/** 加速 */ /**
* 加速
*/
ACCELERATE, ACCELERATE,
} }

View File

@ -183,19 +183,6 @@ public class VRTrainRunningService {
} }
return; return;
} }
//无应答器
if (!train.isCbtcMaMiss()) {
RunLevel defaultRunLevel = simulation.getRepository().getConfig().getRunMode();
if (!train.isCBTC() && defaultRunLevel.equals(RunLevel.CBTC)) { //如果列车不是CBTC同时线路默认级别是CBTC
train.setRunLevel(RunLevel.CBTC);
}
}
if (!train.isItcMaMiss()) { //itc级别ma未丢失
if (RunLevel.IL.equals(train.getRunLevel())) { //如果列车是IL级别
train.setRunLevel(RunLevel.ITC);
}
}
} }
public void addJobs(Simulation simulation) { public void addJobs(Simulation simulation) {

View File

@ -85,13 +85,23 @@ public class ATPLogicLoop {
atpService.triggerSignalEB(train); atpService.triggerSignalEB(train);
train.setMa(null); train.setMa(null);
} }
} else { }
if (!simulation.getRepository().hasResponder()) {
//无应答器
if (!train.isCbtcMaMiss()) {
if (!train.isCBTC() && defaultRunLevel.equals(RunLevel.CBTC)) { //如果列车不是CBTC同时线路默认级别是CBTC
train.setCBTCMode();
}
train.setCbtcMaMissDuration(train.getCbtcMaMissDuration() + SimulationConstants.ATP_LOOP_RATE); train.setCbtcMaMissDuration(train.getCbtcMaMissDuration() + SimulationConstants.ATP_LOOP_RATE);
} }
if (!train.isItcMaMiss()) { //itc级别ma未丢失 if (!train.isItcMaMiss()) { //itc级别ma未丢失
if (RunLevel.IL.equals(train.getRunLevel())) { //如果列车是IL级别
train.setITCMode();
}
train.setItcMaMissDuration(train.getItcMaMissDuration() + SimulationConstants.ATP_LOOP_RATE); train.setItcMaMissDuration(train.getItcMaMissDuration() + SimulationConstants.ATP_LOOP_RATE);
} }
} }
}
private void driveLogicRun(Simulation simulation, VirtualRealityTrain train) { private void driveLogicRun(Simulation simulation, VirtualRealityTrain train) {
if (train.isChangeEnds() && train.isStop()) { if (train.isChangeEnds() && train.isStop()) {

View File

@ -38,6 +38,8 @@ public class OnboardAtpApiServiceImpl implements OnboardAtpApiService {
if (train.getFault() == VirtualRealityTrain.Fault.COMMUNICATION_ABNORMAL) { //列车通信故障 if (train.getFault() == VirtualRealityTrain.Fault.COMMUNICATION_ABNORMAL) { //列车通信故障
return; return;
} }
if (train.isRMMode() || train.isNRMMode())
return;
if (train.isCBTC()) { if (train.isCBTC()) {
this.ATPService.updateMA(train, ma); this.ATPService.updateMA(train, ma);
} }