From e67b7b8ad1e78d3c3c7117cdf62583e80b42ac39 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Mon, 27 Nov 2023 16:26:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A5ATO=E9=80=9F=E5=BA=A6=E6=9B=B2?= =?UTF-8?q?=E7=BA=BF=E7=9A=84=E8=B7=9D=E7=A6=BB=E7=AD=9B=E9=80=89MA?= =?UTF-8?q?=EF=BC=88=E4=B9=8B=E5=89=8D=E4=BB=A5EOA=E8=B7=9D=E7=A6=BB?= =?UTF-8?q?=E7=AD=9B=E9=80=89=E7=9A=84=E6=96=B9=E5=BC=8F=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E5=88=97=E8=BD=A6=E8=BF=90=E8=A1=8C=E8=BF=87=E8=BF=9C=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simulation/cbtc/ATP/ground/MaService.java | 45 +++++++++++-------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/MaService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/MaService.java index c2aa810d4..29e735902 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/MaService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/MaService.java @@ -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
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); } } }