From 2258062e9a42cebf4c73dab75940af2fd2a6cec0 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Mon, 6 Dec 2021 10:31:53 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=88=97=E8=BD=A6=E7=BB=8F=E8=BF=87?= =?UTF-8?q?=E3=80=90ARB=E3=80=91=E3=80=90=E8=BF=9B=E8=B7=AF=E9=94=81?= =?UTF-8?q?=E9=97=AD=E3=80=91=E7=9A=84=E5=8C=BA=E6=AE=B5=E4=B9=8B=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E5=8F=96=E6=B6=88=E8=BF=9B=E8=B7=AF=E9=94=81=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../joylink/rtss/simulation/cbtc/CI/device/CiRouteService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/device/CiRouteService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/device/CiRouteService.java index 9b053eae3..5279f10b4 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/device/CiRouteService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/device/CiRouteService.java @@ -465,7 +465,7 @@ public class CiRouteService { if (!logic.isOccupied() && /*!logic.isInvalid() &&*/ logic.isRouteLockOn(right)) { logic.routeUnlocking(route); logic.overlapUnlocking(); - } else if(logic.isOccupied() || logic.isInvalid()) { + } else if(logic.isOccupied() /*|| logic.isInvalid()*/) { break; } } From f5c711da90e29130b009899343522421d510595d Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Mon, 6 Dec 2021 13:22:48 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B2=94=E5=BF=83?= =?UTF-8?q?=E6=89=80=E5=9C=A8=E8=AE=A1=E8=BD=B4=E5=8C=BA=E6=AE=B5=E9=A2=84?= =?UTF-8?q?=E5=A4=8D=E4=BD=8D=E6=88=90=E5=8A=9F=E5=90=8E=EF=BC=8C=E9=A2=84?= =?UTF-8?q?=E5=A4=8D=E4=BD=8D=E7=8A=B6=E6=80=81=E6=9C=AA=E6=B8=85=E9=99=A4?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/virtual/VRTrainRunningService.java | 25 ++++++------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/device/virtual/VRTrainRunningService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/device/virtual/VRTrainRunningService.java index f37495659..f1622561a 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/device/virtual/VRTrainRunningService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/device/virtual/VRTrainRunningService.java @@ -136,29 +136,20 @@ public class VRTrainRunningService { return; //进入计轴区段判断 - Section headAxleCounterSectionNew = headPositionNew.getSection(); - if (!headAxleCounterSectionNew.isAxleCounter()) { - headAxleCounterSectionNew = headAxleCounterSectionNew.getParent(); - } - if (!headAxleCounterSectionNew.isAxleCounter()) { //当是——物理区段-岔心-道岔计轴区段三层结构的时候需要多这次判断 - headAxleCounterSectionNew = headAxleCounterSectionNew.getParent(); - } - if (headAxleCounterSectionNew != null && headAxleCounterSectionNew.isAxleCounter()) { //新的区段是计轴区段 - Section headSectionOld = headPosition.getSection(); - if (!headAxleCounterSectionNew.equals(headSectionOld) && !headAxleCounterSectionNew.equals(headSectionOld.getParent())) { //新计轴区段和老区段不一样 + Section headAxleCounterSectionNew = headPositionNew.getSection().findAxleCounterSection(); + if (headAxleCounterSectionNew != null) { + Section headAxleCounterSection = headPosition.getSection().findAxleCounterSection(); + if (!headAxleCounterSectionNew.equals(headAxleCounterSection)) { //【车头所在计轴区段】发生变化 headAxleCounterSectionNew.getVirtualAxleCounter().trainIn(trainRight); } } //离开计轴区段判断 SectionPosition tailPositionOld = CalculateService.calculateNextPositionByStartAndLen(headPosition, !trainRight, train.getLen(), true); - Section tailAxleCounterSection = tailPositionOld.getSection(); - if (!tailAxleCounterSection.isAxleCounter()) { - tailAxleCounterSection = tailAxleCounterSection.getParent(); - } - if (tailAxleCounterSection != null && tailAxleCounterSection.isAxleCounter()) { //老的车尾区段是计轴区段 + Section tailAxleCounterSection = tailPositionOld.getSection().findAxleCounterSection(); + if (tailAxleCounterSection != null) { SectionPosition tailPositionNew = CalculateService.calculateNextPositionByStartAndLen(headPositionNew, !trainRight, train.getLen(), true); - Section tailSectionNew = tailPositionNew.getSection(); - if (!tailAxleCounterSection.equals(tailSectionNew) && !tailAxleCounterSection.equals(tailSectionNew.getParent())) { //老车尾计轴区段和新车尾区段不一样 + Section tailAxleCounterSectionNew = tailPositionNew.getSection().findAxleCounterSection(); + if (!tailAxleCounterSection.equals(tailAxleCounterSectionNew)) { //【车尾所在计轴区段】发生变化 tailAxleCounterSection.getVirtualAxleCounter().trainOut(trainRight); } } From ac1e32082cb4ee08932a6f3cae7bb698dcadfb57 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Mon, 6 Dec 2021 15:52:14 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E3=80=90=E7=BA=BF=E8=B7=AF=E7=9A=84ZC?= =?UTF-8?q?=E5=8F=AA=E6=9C=89=E4=B8=80=E4=B8=AA=E3=80=91=E4=B8=94=E3=80=90?= =?UTF-8?q?ZC=E6=B2=A1=E6=9C=89=E8=AE=BE=E7=BD=AE=E5=85=B3=E8=81=94?= =?UTF-8?q?=E5=8C=BA=E6=AE=B5=E3=80=91=E6=97=B6=EF=BC=8C=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=85=B3=E8=81=94=E5=85=A8=E7=BA=BF=E8=AE=A1=E8=BD=B4=E5=8C=BA?= =?UTF-8?q?=E6=AE=B5=EF=BC=88=E4=BB=A5=E5=89=8D=E6=98=AF=E7=89=A9=E7=90=86?= =?UTF-8?q?=E5=8C=BA=E6=AE=B5=EF=BC=89=EF=BC=9B=E4=BF=AE=E6=94=B9=E3=80=90?= =?UTF-8?q?=E5=8C=BA=E6=AE=B5=E6=9C=89ZC=E5=9C=A8=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E3=80=91=E7=9A=84=E5=88=A4=E5=AE=9A=E4=B8=BA=E3=80=90=E6=89=80?= =?UTF-8?q?=E5=B1=9E=E8=AE=A1=E8=BD=B4=E5=8C=BA=E6=AE=B5=E6=9C=89ZC?= =?UTF-8?q?=E5=9C=A8=E5=B7=A5=E4=BD=9C=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cbtc/build/MapDeviceBuilder.java | 40 +++++++++++++------ .../simulation/cbtc/data/map/Section.java | 16 ++++---- .../rtss/simulation/cbtc/data/map/ZC.java | 7 ++-- 3 files changed, 39 insertions(+), 24 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/build/MapDeviceBuilder.java b/src/main/java/club/joylink/rtss/simulation/cbtc/build/MapDeviceBuilder.java index a0881fcff..817fb30e3 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/build/MapDeviceBuilder.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/build/MapDeviceBuilder.java @@ -314,13 +314,22 @@ public class MapDeviceBuilder { }); /* ZC和区段相互赋值 */ // ZC - if (graphData.getZcList().size() == 1) { + if (graphData.getZcList().size() == 1 && CollectionUtils.isEmpty(graphData.getZcList().get(0).getManagedSectionList())) { + //线路的【ZC只有一个】且【ZC没有设置关联区段】时,自动关联全线计轴区段 MapZcVO mapZcVO = graphData.getZcList().get(0); ZC zc = (ZC) elementMap.get(mapZcVO.getCode()); - physicalSectionList.forEach(section -> { - zc.addSection(section); - section.addZc(zc); - }); + elementMap.values().stream() + .filter(element -> element instanceof Section) + .map(element -> (Section) element) + .filter(Section::isAxleCounterSection) + .forEach(section -> { + zc.addSection(section); + section.addZc(zc); + }); +// physicalSectionList.forEach(section -> { +// zc.addSection(section); +// section.addZc(zc); +// }); } else { graphData.getZcList().forEach(mapZcVO -> { if (mapZcVO.isNoService()) @@ -334,15 +343,20 @@ public class MapDeviceBuilder { Section section = (Section) elementMap.get(sectionCode); BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(section, String.format("ZC[%s]关联的区段[%s]不存在", zc.getCode(), sectionCode)); - if (section.isPhysical()) { - section.addZc(zc); - zc.addSection(section); - } else if (section.isSwitchAxleCounterSection() || section.isCross()) { - section.getLogicList().forEach(logic -> { - logic.addZc(zc); - zc.addSection(logic); - }); + Section axleCounterSection = section.findAxleCounterSection(); + if (axleCounterSection != null) { + axleCounterSection.addZc(zc); + zc.addSection(axleCounterSection); } +// if (section.isPhysical()) { +// section.addZc(zc); +// zc.addSection(section); +// } else if (section.isSwitchAxleCounterSection() || section.isCross()) { +// section.getLogicList().forEach(logic -> { +// logic.addZc(zc); +// zc.addSection(logic); +// }); +// } } } }); 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 a039ab7e3..f78945094 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 @@ -12,10 +12,7 @@ import lombok.Getter; import lombok.Setter; import org.springframework.util.CollectionUtils; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Objects; +import java.util.*; /** * 区段 @@ -160,7 +157,7 @@ public class Section extends DelayUnlockDevice { /** * 所属zc */ - private List zcs = new ArrayList<>(); + private Set zcs = new HashSet<>(); // ------------------状态属性--------------------- @@ -1143,10 +1140,15 @@ public class Section extends DelayUnlockDevice { * 任意一个zc正常工作 */ public boolean anyZcWorking() { - if (!CollectionUtils.isEmpty(zcs)) { - return zcs.stream().anyMatch(zc -> !zc.isFault()); + Section axleCounterSection = this.findAxleCounterSection(); + if (axleCounterSection != null && !CollectionUtils.isEmpty(axleCounterSection.getZcs())) { + return axleCounterSection.getZcs().stream().anyMatch(zc -> !zc.isFault()); } return false; +// if (!CollectionUtils.isEmpty(zcs)) { +// return zcs.stream().anyMatch(zc -> !zc.isFault()); +// } +// return false; } public void setInvalid(boolean invalid) { diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/ZC.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/ZC.java index f5d31d790..58f959294 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/ZC.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/ZC.java @@ -1,11 +1,10 @@ package club.joylink.rtss.simulation.cbtc.data.map; import lombok.Getter; -import lombok.Setter; -import java.util.ArrayList; -import java.util.List; +import java.util.HashSet; import java.util.Objects; +import java.util.Set; /** * 区域控制器 @@ -13,7 +12,7 @@ import java.util.Objects; @Getter public class ZC extends MayOutOfOrderDevice { - private List
sections = new ArrayList<>(); + private Set
sections = new HashSet<>(); public ZC(String code, String name) { super(code, name, DeviceType.ZC);