From 6c80e68b7515e9b8912830a2d1a92517bad7c534 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Wed, 28 Apr 2021 17:26:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=96=E6=B6=88=E5=88=97=E8=BD=A6=E8=BF=9B?= =?UTF-8?q?=E5=85=A5=E8=BF=9B=E8=B7=AF=E9=80=BB=E8=BE=91=E5=88=A4=E6=96=AD?= =?UTF-8?q?=EF=BC=9B=E5=BC=95=E5=AF=BC=E4=BF=A1=E5=8F=B7=E9=A2=9C=E8=89=B2?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9B=E8=BF=9B=E8=B7=AF=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E9=80=BB=E8=BE=91=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rt/CIL/CilRouteLogicService.java | 16 ++++++------ .../rt/CIL/CilSignalLogicService.java | 14 ++++++++-- .../rtss/simulation/rt/CIL/bo/CilRoute.java | 18 +++++++++++-- .../rtss/simulation/rt/CIL/bo/CilSignal.java | 26 +++++-------------- .../rt/SRD/bo/SrdRepositoryBuilder.java | 2 ++ 5 files changed, 45 insertions(+), 31 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/rt/CIL/CilRouteLogicService.java b/src/main/java/club/joylink/rtss/simulation/rt/CIL/CilRouteLogicService.java index 03ac9a428..4aa998b2e 100644 --- a/src/main/java/club/joylink/rtss/simulation/rt/CIL/CilRouteLogicService.java +++ b/src/main/java/club/joylink/rtss/simulation/rt/CIL/CilRouteLogicService.java @@ -41,7 +41,7 @@ public class CilRouteLogicService { if (cilRepository.getSectionById(commonRoute.getPathElement().getStart().getId()).isAxcOccupy()) { //进路首区段占用 cilSignal.initGuideTime(); } - cilSignalLogicService.UpdateSignalDisplay(simulation, cilSignal, CilSignal.GUIDE, false); + cilSignalLogicService.update2GuideAspect(simulation, cilSignal); } public void masterUnlock(RtSimulation simulation, boolean right) { @@ -99,7 +99,7 @@ public class CilRouteLogicService { //进路锁闭,但因为区段占用导致无法开放信号 if (cilRoute.isLock()) { if (cilSignal.isForbidAspect(commonSignal.isShunting())) { - cilSignalLogicService.UpdateSignalDisplay(simulation, cilSignal, CilSignal.GUIDE, false); + cilSignalLogicService.update2GuideAspect(simulation, cilSignal); if (cilRepository.getSectionById(commonRoute.getPathElement().getStart().getId()).isAxcOccupy()) { //进路首区段占用 cilSignal.initGuideTime(); } @@ -404,7 +404,7 @@ public class CilRouteLogicService { //信号开放条件检查,不通过时关闭信号 if (!cilSignal.isForbidAspect(commonSignal.isShunting())) { if (!canOpenSignal(rtSimulation, cilRoute.getId())) { - cilSignalLogicService.try2UpdateSignalDisplay(rtSimulation, cilSignal, CilSignal.RED, false); + cilSignalLogicService.update2ForbiddenAspect(rtSimulation, cilSignal.getId()); } } } @@ -740,7 +740,7 @@ public class CilRouteLogicService { this.try2RouteLockSwitches(cilRepository, route.getId(), route.getPathElement().getSpList()); //道岔锁闭(应该不会失败) this.routeLockSections(cilRepository, route); //区段锁闭 CilSignal cilSignal = cilRepository.getSignalById(route.getStart().getId());//修改信号机信号级别 - cilSignalLogicService.UpdateSignalDisplay(simulation, cilSignal, CilSignal.GUIDE, false); //开放引导信号 + cilSignalLogicService.update2GuideAspect(simulation, cilSignal); //开放引导信号 // route.getPathElement().getAllSectionList().forEach(cs->{ // CilSection cilSection = cilRepository.getSectionById(cs.getId()); //// if (!cilSection.isAxcOccupy()) { @@ -765,10 +765,10 @@ public class CilRouteLogicService { if (cilSignal.getGuideTime() == 0) { cilSignalLogicService.update2ForbiddenAspect(rtSimulation, cilSignal.getId()); } - } else { - if (cilRepository.getSectionById(commonRoute.getPathElement().getStart().getId()).isAxcOccupy()) { - cilSignalLogicService.update2ForbiddenAspect(rtSimulation, cilSignal.getId()); - } + } else { //列车进入进路不能这么判断 +// if (cilRepository.getSectionById(commonRoute.getPathElement().getStart().getId()).isAxcOccupy()) { +// cilSignalLogicService.update2ForbiddenAspect(rtSimulation, cilSignal.getId()); +// } } } } diff --git a/src/main/java/club/joylink/rtss/simulation/rt/CIL/CilSignalLogicService.java b/src/main/java/club/joylink/rtss/simulation/rt/CIL/CilSignalLogicService.java index bf8d8ad97..83a6a14ea 100644 --- a/src/main/java/club/joylink/rtss/simulation/rt/CIL/CilSignalLogicService.java +++ b/src/main/java/club/joylink/rtss/simulation/rt/CIL/CilSignalLogicService.java @@ -28,12 +28,22 @@ public class CilSignalLogicService { CommonSignal commonSignal = commonRepository.getSignalById(signalId); CilSignal cilSignal = cilRepository.getSignalById(signalId); if (commonSignal.isShunting()) { - UpdateSignalDisplay(simulation, cilSignal, CilSignal.A, false); + UpdateSignalDisplay(simulation, cilSignal, SrSignal.A, false); } else { - UpdateSignalDisplay(simulation, cilSignal, CilSignal.RED, false); + UpdateSignalDisplay(simulation, cilSignal, SrSignal.H, false); } } + public void update2GuideAspect(RtSimulation simulation, String signalId) { + CilRepository cilRepository = simulation.getRepository(CilRepository.NAME, CilRepository.class); + CilSignal cilSignal = cilRepository.getSignalById(signalId); + UpdateSignalDisplay(simulation, cilSignal, SrSignal.BH, false); + } + + public void update2GuideAspect(RtSimulation simulation, CilSignal cilSignal) { + UpdateSignalDisplay(simulation, cilSignal, SrSignal.BH, false); + } + /** * 信号机接近区段占用 */ diff --git a/src/main/java/club/joylink/rtss/simulation/rt/CIL/bo/CilRoute.java b/src/main/java/club/joylink/rtss/simulation/rt/CIL/bo/CilRoute.java index 94b68da6c..121614e9e 100644 --- a/src/main/java/club/joylink/rtss/simulation/rt/CIL/bo/CilRoute.java +++ b/src/main/java/club/joylink/rtss/simulation/rt/CIL/bo/CilRoute.java @@ -35,7 +35,7 @@ public class CilRoute extends CilDevice { @Setter private boolean delayUnlocking; //延时解锁中 @Setter - boolean gl; + boolean gl; //引导锁闭 public CilRoute(String id, String name) { super(id, name); @@ -43,7 +43,21 @@ public class CilRoute extends CilDevice { @Override public void init() { - + overlap = null; + ars = false; + arc = false; + flt = false; + waitTurnMap.clear(); + waitOnPositionMap.clear(); + stageStartTime = null; + signalState = 0; + lock = false; + ol = false; + fl = false; + canAutoOpen = true; + trainIn = false; + delayUnlocking = false; + gl = false; } // public boolean isOpenAspect() { diff --git a/src/main/java/club/joylink/rtss/simulation/rt/CIL/bo/CilSignal.java b/src/main/java/club/joylink/rtss/simulation/rt/CIL/bo/CilSignal.java index e221d9cd8..936619f77 100644 --- a/src/main/java/club/joylink/rtss/simulation/rt/CIL/bo/CilSignal.java +++ b/src/main/java/club/joylink/rtss/simulation/rt/CIL/bo/CilSignal.java @@ -10,19 +10,7 @@ public class CilSignal extends CilDevice { public static final int DEFAULT_DELAY_TIME = 30 * 1000; //进路延时解锁默认时长 public static final int DEFAULT_GUIDE_TIME = 15 * 1000; //引导信号有效时长 - int signalAspect = RED; //当前显示的信号 - public static final int RED = 1; // 红灯信号(禁止信号) - public static final int GREEN = 2; // 绿灯信号(直向通行) - public static final int YELLOW = 3; // 黄灯信号(侧向通行) - public static final int GUIDE = 4; // 引导信号(正线为黄红) - public static final int LL = 5; // 绿绿 - public static final int LH = 6; // 绿黄 - public static final int HH = 7; // 黄黄 - public static final int HSH = 8; // 黄闪黄 - public static final int BH = 9; // 白红 - public static final int A = 10; // 蓝 - public static final int B = 11; // 白 - public static final int HS = 12; // 红闪 + int signalAspect = SrSignal.H; //当前显示的信号 boolean logic; boolean forceLight; // 强制点灯 @Setter @@ -56,7 +44,7 @@ public class CilSignal extends CilDevice { @Override public void init() { - signalAspect = RED; + signalAspect = SrSignal.H; logic = false; forceLight = false; bl = false; @@ -80,9 +68,9 @@ public class CilSignal extends CilDevice { public boolean isForbidAspect(boolean shunting) { if (shunting) { - return this.signalAspect == A; + return this.signalAspect == SrSignal.A; } else { - return this.signalAspect == RED; + return this.signalAspect == SrSignal.H; } } @@ -115,10 +103,10 @@ public class CilSignal extends CilDevice { // default: // throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception(String.format("未知的显示状态[%s]", aspect)); // } - if (aspect == RED) { + if (aspect == SrSignal.H) { return true; } - if (aspect == GUIDE) { + if (aspect == SrSignal.BH) { return level == LEVEL_2 || level == LEVEL_3 || level == LEVEL_4; } return level == LEVEL_4; @@ -185,6 +173,6 @@ public class CilSignal extends CilDevice { } public boolean isGuideAspect() { - return this.signalAspect == GUIDE; + return this.signalAspect == SrSignal.BH; } } diff --git a/src/main/java/club/joylink/rtss/simulation/rt/SRD/bo/SrdRepositoryBuilder.java b/src/main/java/club/joylink/rtss/simulation/rt/SRD/bo/SrdRepositoryBuilder.java index c5015b913..8a8f92fb2 100644 --- a/src/main/java/club/joylink/rtss/simulation/rt/SRD/bo/SrdRepositoryBuilder.java +++ b/src/main/java/club/joylink/rtss/simulation/rt/SRD/bo/SrdRepositoryBuilder.java @@ -132,6 +132,8 @@ public class SrdRepositoryBuilder { for (MapSignalNewVO signalVO : signalList) { SrSignal srSignal = new SrSignal(signalVO.getCode()); srSignal.shunting = Signal.SignalType.SHUNTING.equals(signalVO.getType()); + if (srSignal.shunting) + srSignal.state = SrSignal.A; signalMap.put(srSignal.getId(), srSignal); } }