From 3742523aee81f76967891ab34480eda767bbb0f0 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Tue, 19 Jan 2021 17:01:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0<=E5=BC=BA=E6=89=B3=E9=81=93?= =?UTF-8?q?=E5=B2=94>=E6=93=8D=E4=BD=9C=EF=BC=9B=E8=BF=9B=E8=B7=AF?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E8=A7=A3=E9=94=81=E9=81=93=E5=B2=94=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0<=E5=B0=9D=E8=AF=95=E8=A7=A3?= =?UTF-8?q?=E9=94=81=E8=81=94=E5=8A=A8=E9=81=93=E5=B2=94=E5=92=8C=E8=AE=A1?= =?UTF-8?q?=E8=BD=B4=E5=85=B3=E8=81=94=E9=81=93=E5=B2=94>=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simulation/cbtc/CI/CiApiServiceImpl.java | 10 ++++++++- .../cbtc/CI/service/RouteService.java | 11 ++++++++++ .../rtss/simulation/cbtc/data/map/Switch.java | 22 ++++++++++++------- .../cbtc/data/vr/VirtualRealitySwitch.java | 2 +- 4 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java index 7bba22f21..5e990cc0d 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiApiServiceImpl.java @@ -8,6 +8,7 @@ import club.joylink.rtss.simulation.cbtc.data.map.*; import club.joylink.rtss.simulation.cbtc.data.support.SignalApproachMessage; import club.joylink.rtss.simulation.cbtc.data.support.TrainStopMessage; import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo; +import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch; import club.joylink.rtss.simulation.cbtc.exception.SimulationException; import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; import lombok.extern.slf4j.Slf4j; @@ -458,6 +459,13 @@ public class CiApiServiceImpl implements CiApiService { @Override public void switchForceTurn(Simulation simulation, String switchCode, Boolean normal) { - + Switch aSwitch = simulation.getRepository().getByCode(switchCode, Switch.class); + BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(!aSwitch.isLocked(), String.format("道岔[%s]锁闭,无法转动", aSwitch.getCode())); + VirtualRealitySwitch vrSwitch = aSwitch.getVirtualSwitch(); + if (normal == null) { + BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(vrSwitch.isLoss(), "道岔不在定反位,不能转动"); + normal = vrSwitch.isReverse(); + } + vrSwitch.startSetting(normal); } } 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 3bf018a3a..8d6559bea 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 @@ -693,6 +693,7 @@ public class RouteService { switchList.forEach(switchElement -> { Switch aSwitch = switchElement.getASwitch(); aSwitch.routeUnlock(); + aSwitch.overlapUnLock(); }); } // 进路侧防取消锁闭 @@ -1043,10 +1044,20 @@ public class RouteService { SwitchElement switchElement = route.getRouteSwitchElement(relSwitch); section.routeUnlocking(right); relSwitch.routeUnlock(); + relSwitch.overlapUnLock(); RouteFls routeFls = route.getRouteFlsOfSwitch(relSwitch); if (routeFls != null) { routeFls.unlock(); } + //检查道岔的联动道岔和计轴关联道岔是否可以解锁 + List switches = Arrays.asList(null, relSwitch.queryAxleRelatedOtherSwitch()); + for (Switch linkedSwitch : switches) { + if (linkedSwitch == null) + continue; + if (linkedSwitch.getAllSections().stream().noneMatch(Section::isRouteLock)) { //道岔关联的所有区段都没有进路锁闭 + linkedSwitch.routeUnlock(); + } + } } else { section.routeUnlocking(right); } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Switch.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Switch.java index 3ca080594..4b87be41f 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Switch.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Switch.java @@ -232,7 +232,6 @@ public class Switch extends MayOutOfOrderDevice { public void routeUnlock() { this.routeLock = false; - this.overlapLock = false; } public void fpLock() { @@ -367,6 +366,20 @@ public class Switch extends MayOutOfOrderDevice { (!normal && SwitchFault.REVERSE_SPLIT.equals(this.getFault()))); } + /** + * 获取定位的道岔区段列表 + */ + public List
getNormalSections() { + return Arrays.asList(a, b); + } + + /** + * 获取道岔关联的所有区段 + */ + public List
getAllSections() { + return List.of(a, b, c); + } + public enum SwitchFault implements DeviceFault { /** * 道岔挤岔 @@ -421,11 +434,4 @@ public class Switch extends MayOutOfOrderDevice { public boolean isLoss() { return !this.isNormalPosition() && !this.isReversePosition(); } - - /** - * 获取定位的道岔区段列表 - */ - public List
getNormalSections() { - return Arrays.asList(a, b); - } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealitySwitch.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealitySwitch.java index 78df87ffb..660b60b94 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealitySwitch.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vr/VirtualRealitySwitch.java @@ -109,7 +109,7 @@ public class VirtualRealitySwitch extends VirtualRealityDevice { * 是否失表 * @return */ - private boolean isLoss() { + public boolean isLoss() { return !this.isNormal() && !this.isReverse(); }