以ATO速度曲线的距离筛选MA(之前以EOA距离筛选的方式导致列车运行过远)
This commit is contained in:
parent
300804dccc
commit
e67b7b8ad1
|
@ -487,14 +487,15 @@ public class MaService {
|
|||
if (route != null) {
|
||||
if (this.isSwitchFaultRoute(route, section)) {
|
||||
// 道岔故障进路,直接构建返回
|
||||
ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.Fault_Route));
|
||||
ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.Fault_Route), train);
|
||||
}
|
||||
// 反向锁闭区段
|
||||
if (front && right != route.getStart().isRight()) { // 列车方向和区段进路方向相反
|
||||
Signal aheadSignal = section.getSignalOf(right);
|
||||
if (aheadSignal == null || aheadSignal.getLockedRoute() == null ||
|
||||
!aheadSignal.getLockedRoute().isOpenMain()) {
|
||||
ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.Reverse_Lock_Section));
|
||||
ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.Reverse_Lock_Section),
|
||||
train);
|
||||
}
|
||||
}
|
||||
} else if (front) {
|
||||
|
@ -503,21 +504,21 @@ public class MaService {
|
|||
Signal aheadSignal = section.getSignalOf(right);
|
||||
if (aheadSignal == null || aheadSignal.getLockedRoute() == null ||
|
||||
!aheadSignal.getLockedRoute().isOpenMain()) {
|
||||
ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.UnLock_Section));
|
||||
ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.UnLock_Section), train);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (section.isNoStatus()) {
|
||||
// 联锁故障
|
||||
ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.No_Status_Section));
|
||||
ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.No_Status_Section), train);
|
||||
}
|
||||
if (section.isClosed()) {
|
||||
// 关闭的区段
|
||||
ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.Closed_Section));
|
||||
ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.Closed_Section), train);
|
||||
}
|
||||
if (this.isAbnormalStand(section)) {
|
||||
// 屏蔽门不安全/紧急停车站台
|
||||
ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.Stand));
|
||||
ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.Stand), train);
|
||||
}
|
||||
Section next = section.getNextRunningSectionOf(right);
|
||||
if (front) { // 车头前方
|
||||
|
@ -525,23 +526,24 @@ public class MaService {
|
|||
if (signal != null && !signal.isMainAspect()) {
|
||||
// 限制信号机
|
||||
if (signal.isOverlapLock()) {
|
||||
ma = this.checkAndUpdateMa(ma, new Ma(train, signal, MaType.Limit_Signal_With_Overlap));
|
||||
ma = this.checkAndUpdateMa(ma, new Ma(train, signal, MaType.Limit_Signal_With_Overlap),
|
||||
train);
|
||||
} else {
|
||||
ma = this.checkAndUpdateMa(ma,
|
||||
new Ma(train, signal, MaType.Limit_Signal_Without_Overlap));
|
||||
new Ma(train, signal, MaType.Limit_Signal_Without_Overlap), train);
|
||||
}
|
||||
}
|
||||
if (section.hasNctOccupy() && !section.isInvalid()) {
|
||||
// 计轴占用区段
|
||||
ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.Axle_Occupy_Section));
|
||||
ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.Axle_Occupy_Section), train);
|
||||
} else if (section.isOnlyCtcOccupy()) {
|
||||
// 前方列车
|
||||
Ma ma2 = this.queryFrontTrain(train, section, trainMap);
|
||||
ma = this.checkAndUpdateMa(ma, ma2);
|
||||
ma = this.checkAndUpdateMa(ma, ma2, train);
|
||||
}
|
||||
if (Section.AxleFault.CBTC_OCCUPIED_FAULT.equals(section.getFault())
|
||||
&& section.isCtOccupied()) {
|
||||
ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.CTC_Occupied_Fault));
|
||||
ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.CTC_Occupied_Fault), train);
|
||||
} else {
|
||||
List<Section> logicList = section.getLogicList();
|
||||
if (!CollectionUtils.isEmpty(logicList)) {
|
||||
|
@ -549,7 +551,8 @@ public class MaService {
|
|||
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));
|
||||
ma = this.checkAndUpdateMa(ma, new Ma(train, logic, MaType.CTC_Occupied_Fault),
|
||||
train);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -557,7 +560,8 @@ public class MaService {
|
|||
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));
|
||||
ma = this.checkAndUpdateMa(ma, new Ma(train, logic, MaType.CTC_Occupied_Fault),
|
||||
train);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -568,10 +572,10 @@ public class MaService {
|
|||
(headPosition.getSection().equals(section) ||
|
||||
!headPosition.isAheadOf(new SectionPosition(section, right ? section.getLen() : 0),
|
||||
right))) {
|
||||
ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.ZC_Boundary));
|
||||
ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.ZC_Boundary), train);
|
||||
}
|
||||
if (next == null || (!next.anyZcWorking())) {
|
||||
ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.ZC_Boundary));
|
||||
ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.ZC_Boundary), train);
|
||||
}
|
||||
}
|
||||
section = next;
|
||||
|
@ -658,13 +662,18 @@ public class MaService {
|
|||
return switchFault;
|
||||
}
|
||||
|
||||
private Ma checkAndUpdateMa(Ma ma, Ma ma2) {
|
||||
private Ma checkAndUpdateMa(Ma ma, Ma ma2, VirtualRealityTrain train) {
|
||||
if (ma == null) {
|
||||
return ma2;
|
||||
} else if (ma2 != null) {
|
||||
if (ma.distanceToEoa > ma2.distanceToEoa) {
|
||||
SpeedCurve maAto = SpeedCurve.calculateAtoStopCurveAndUpdate(train, ma);
|
||||
SpeedCurve ma2Ato = SpeedCurve.calculateAtoStopCurveAndUpdate(train, ma2);
|
||||
if (ma2Ato.getTotalDistance() < maAto.getTotalDistance()) {
|
||||
return ma2;
|
||||
}
|
||||
// if (ma.distanceToEoa > ma2.distanceToEoa) {
|
||||
// return ma2;
|
||||
// }
|
||||
}
|
||||
return ma;
|
||||
}
|
||||
|
@ -683,7 +692,7 @@ public class MaService {
|
|||
for (VirtualRealityTrain vrTrain : trainList) {
|
||||
Ma ma1 = new Ma(train, vrTrain, MaType.Front_Train);
|
||||
if (ma1.getDistanceToEoa() > 0) {
|
||||
ma = this.checkAndUpdateMa(ma, ma1);
|
||||
ma = this.checkAndUpdateMa(ma, ma1, train);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue