From 8c9392bf14dc6a8277c6de38c2082942d6c43685 Mon Sep 17 00:00:00 2001 From: walker-sheng Date: Fri, 22 Jan 2021 16:27:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9ATS=E8=BF=9B=E8=B7=AF?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E9=80=BB=E8=BE=91=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=BF=9B=E8=B7=AF=E6=8E=92=E5=88=97=E5=A6=82=E6=9E=9C=E8=BF=9B?= =?UTF-8?q?=E8=B7=AF=E5=B7=B2=E7=BB=8F=E9=94=81=E9=97=AD=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=20=E4=BF=AE=E6=94=B9=E9=81=93=E5=B2=94?= =?UTF-8?q?=E5=8D=95=E6=93=8D=E9=80=BB=E8=BE=91bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ATS/service/AtsRouteSettingService.java | 3 --- .../rtss/simulation/cbtc/CI/CILogicLoop.java | 2 ++ .../cbtc/CI/service/RouteService.java | 24 +++++++++++++------ .../cbtc/CI/service/SwitchService.java | 5 ++++ .../simulation/cbtc/data/plan/TripPlan.java | 20 ++++++++++++++++ 5 files changed, 44 insertions(+), 10 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsRouteSettingService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsRouteSettingService.java index 8346a001c..0a970f55b 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsRouteSettingService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsRouteSettingService.java @@ -58,9 +58,6 @@ public class AtsRouteSettingService { signalTrainMap.forEach((signal, train) -> { // log.debug(String.format("ATS为列车[%s]触发信号机[%s(%s)]的进路", // train.getGroupNumber(), signal.getName(), signal.getCode())); - if (CollectionUtils.isEmpty(signal.getRouteList())) { // 信号机不是进路始端,结束 - return; - } Route route = null; if (train.isPlanTrain()) { // 计划车 route = this.queryPlanTrainNeedRoute(simulation, train, signal, trainList); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CILogicLoop.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CILogicLoop.java index e994e1489..c2d932392 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CILogicLoop.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CILogicLoop.java @@ -11,6 +11,7 @@ import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityScreenDoor; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySectionAxleCounter; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySignal; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; @@ -20,6 +21,7 @@ import java.util.List; /** * CI主线逻辑循环 */ +@Slf4j @Component public class CILogicLoop { diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/RouteService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/RouteService.java index 303090679..19fdc1ab0 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/RouteService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/RouteService.java @@ -283,6 +283,10 @@ public class RouteService { log.info(String.format("进路[%s]排列检查失败,无法排列:%s", route.debugStr(), check.debugStr())); return check; } + if (route.isLock()) { + log.info(String.format("进路[%s]已经锁闭", route.debugStr())); + return null; + } // 进路开始办理 LocalDateTime systemTime = simulation.getSystemTime(); route.startSetting(systemTime); @@ -780,6 +784,9 @@ public class RouteService { int level = checkRouteLevel(route); route.getStart().setLevel(level); if (level != Signal.LEVEL_3) { + if (route.isOpen()) { + log.info(String.format("进路[%s]联锁检查等级为[%s]", route.debugStr(), level)); + } return false; } return true; @@ -851,6 +858,7 @@ public class RouteService { } } if (!level1Result) { + log.info(String.format("进路[%s]连锁条件检查失败:侧防不满足", route.debugStr())); return level; } } @@ -1154,7 +1162,7 @@ public class RouteService { */ public void openedRouteCheck(Simulation simulation, Route route) { // if (route.isOpen()) { - this.checkAndSetLockedRouteOverlap(simulation, route); +// this.checkAndSetLockedRouteOverlap(simulation, route); // 区段锁闭在进路方向上 boolean right = route.getStart().isRight(); for (Section section : route.getSectionList()) { @@ -1162,12 +1170,14 @@ public class RouteService { section.routeLocking(right); } } - boolean interlocked = this.isInterlocked(route); - if (!interlocked) { - // 进路信号开放,联锁逻辑不满足,需关闭信号 - this.routeClose(simulation, route); - log.info(String.format("进路[%s]始端信号联锁条件不满足,信号机[%s(%s)]关灯", - route.debugStr(), route.getStart().getName(), route.getStart().getCode())); + if (route.isOpen()) { + boolean interlocked = this.isInterlocked(route); + if (!interlocked) { + // 进路信号开放,联锁逻辑不满足,需关闭信号 + this.routeClose(simulation, route); + log.info(String.format("进路[%s]始端信号联锁条件不满足,信号机[%s(%s)]关灯", + route.debugStr(), route.getStart().getName(), route.getStart().getCode())); + } } // this.reLockOverlap(simulation, route); // } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/SwitchService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/SwitchService.java index d1c86b046..45b48cc12 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/SwitchService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/SwitchService.java @@ -39,6 +39,11 @@ public class SwitchService { */ private void controlSwitch(Simulation simulation, Switch aSwitch, boolean toNormal) { VirtualRealitySwitch virtualSwitch = aSwitch.getVirtualSwitch(); + if ((virtualSwitch.isNormal() && toNormal) || + (virtualSwitch.isReverse() && !toNormal)) { + log.debug(String.format("道岔[%s]已经在指定位置[%s],无需转动", aSwitch.debugStr(), virtualSwitch.isNormal()?"N":"R")); + return; + } if (virtualSwitch.isSettingTo(toNormal)) { return; } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/plan/TripPlan.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/plan/TripPlan.java index 0a95579be..927a384b8 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/plan/TripPlan.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/plan/TripPlan.java @@ -155,6 +155,26 @@ public class TripPlan { return null; } + public StationPlan queryStationPlanByStationCode(String stationCode) { + for (StationPlan stationPlan : this.planList) { + if (Objects.equals(stationPlan.getStation().getCode(), stationCode)) { + return stationPlan; + } + } + return null; + } + + public StationPlan queryNextStationPlanByStationCode(String stationCode) { + List planList = this.getPlanList(); + for (int i = 0; i < planList.size()-1; i++) { + StationPlan stationPlan = planList.get(i); + if (Objects.equals(stationPlan.getStation().getCode(), stationCode)) { + return planList.get(i+1); + } + } + return null; + } + public StationPlan queryNextStationPlan(Station station) { List planList = this.getPlanList(); for (int i = 0; i < planList.size(); i++) {