From 27e2f456fce4219cfa3216b360d70cdea40d86ce Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Tue, 24 Aug 2021 13:07:49 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9F=E5=BA=A6=E6=9B=B2=E7=BA=BF=E9=99=90?= =?UTF-8?q?=E9=80=9F=E9=80=BB=E8=BE=91=E9=87=8D=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rtss/simulation/cbtc/data/map/Section.java | 13 +++++++++++-- .../cbtc/onboard/ATO/SpeedCurve.java | 18 ++++++++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Section.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Section.java index ecd3ffabc..22836c15f 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Section.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Section.java @@ -976,12 +976,21 @@ public class Section extends MayOutOfOrderDevice { return this.getSpeedUpLimit() / 3.6f; } else if (this.isSwitchTrack() && this.getRelSwitch().isReversePosition()) { return 30 / 3.6f; - } else if (this.getParent() != null) { - return this.getParent().getNeedLimitSpeed(); + } else if (isLogicStandTrack()) { //站台逻辑区段默认限速 + return 45 / 3.6f; } return null; } + private boolean isLogicStandTrack() { + Section parent = this.getParent(); + if (parent == null || !parent.isStandTrack()) + return false; + float left = parent.getStopPointByDirection(false); + float right = parent.getStopPointByDirection(true); + return this.minOffset <= right && this.maxOffset >= left; + } + /** * 根据方向获取终点偏移量 */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATO/SpeedCurve.java b/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATO/SpeedCurve.java index 17f5d2607..3d8489efd 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATO/SpeedCurve.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATO/SpeedCurve.java @@ -300,19 +300,26 @@ public class SpeedCurve { Float tailLimitSpeed = tailPosition.getLogicSection().getNeedLimitSpeed(); float limitSpeed = tailLimitSpeed == null ? recommendedSpeedMax : Math.min(tailLimitSpeed, recommendedSpeedMax); SectionPosition endPosition; - float vt = 0; SpeedCurve speedCurve = buildTargetSpeedCurve(totalLen, v0, 0, limitSpeed); for (int i = 0; i < 20; i++) { + if (base == null) + break; List
logicSections = base.getLogicList(); if (logicSections == null) { logicSections = Collections.singletonList(base); } - for (Section logic : logicSections) { + int index = right ? 0 : logicSections.size() - 1; + int x = right ? 1 : -1; + Float distance = null; + for (; 0 <= index && index < logicSections.size(); index += x) { + Section logic = logicSections.get(index); Float needLimitSpeed = logic.getNeedLimitSpeed(); if (needLimitSpeed != null && needLimitSpeed * 0.9f < limitSpeed) { //新的限速更小 endPosition = new SectionPosition(base, logic.getEndOffsetByDirection(!right)); //限速起始点 - Float distance = CalculateService.calculateDistance(headPosition, endPosition, right); - if (distance != null && distance < 500 && distance < totalLen) { //限速点在车头前方;限速点距车头不超过500m(因为超过500m就不用顾忌) + distance = CalculateService.calculateDistance(headPosition, endPosition, right); + if (distance != null && (distance > 500 || distance > totalLen)) //限速点在车头前方;限速点距车头不超过500m(过早考虑限速没有意义) + break; + if (distance != null && distance > 0) { //取最靠下的速度曲线 SpeedCurve limitSpeedCurve = buildTargetSpeedCurve(distance, v0, needLimitSpeed * 0.9f, limitSpeed); //到达新限速点的速度曲线 float speed = speedCurve.getSpeedOf(speedCurve.getTotalDistance()); @@ -326,6 +333,9 @@ public class SpeedCurve { } } } + if (distance != null && (distance > 500 || distance > totalLen)) + break; + base = base.getNextRunningSectionOf(right); } return speedCurve; }