From 0433273f35c1d106934c92c17b02932db250f4d9 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Tue, 23 Aug 2022 10:04:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=81=9C=E7=A8=B3=E5=80=92?= =?UTF-8?q?=E8=AE=A1=E6=97=B6=E5=AE=9E=E7=8E=B0=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rtss/simulation/cbtc/CI/CiLogic.java | 31 +++++++++++++------ .../cbtc/build/MapDeviceBuilder.java | 1 + .../cbtc/data/SimulationDataRepository.java | 6 ++++ .../simulation/cbtc/data/map/Section.java | 25 +++++++++++---- .../cbtc/data/status/SectionStatus.java | 4 +-- .../data/storage/device/StorageSection.java | 10 ++++++ .../rtss/vo/map/graph/MapSectionNewVO.java | 5 +++ 7 files changed, 64 insertions(+), 18 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiLogic.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiLogic.java index 06b97d561..af8a15609 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiLogic.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/CiLogic.java @@ -86,19 +86,30 @@ public class CiLogic { * 区段停稳倒计时 */ public void sectionStopCountDown(Simulation simulation) { - for (Stand stand : simulation.getRepository().getStandList()) { - Section track = stand.getSection(); - if (track.getStopCountDown() == null) { - //股道占用且股道两边没有占用 - if (track.isOccupied()) { - if (!track.getNextRunningSectionOf(false).isOccupied() && !track.getNextRunningSectionOf(true).isOccupied()) { - track.startStopCountDown(); + for (Section section : simulation.getRepository().getHasStopCountDownSections()) { + int stopCountDown = section.getStopCountDown(); + if (stopCountDown == 0) { + //股道占用且股道有占用 + if (section.isOccupied()) { + if (section.getNextRunningSectionOf(false).isOccupied() || section.getNextRunningSectionOf(true).isOccupied()) { + section.readyStartStopCountDown(); } } } else { - track.setStopCountDown(track.getStopCountDown() - SimulationConstants.CI_LOOP_RATE); - if (track.getStopCountDown() <= 0) { - track.setStopCountDown(null); + if (stopCountDown == -1) { + // 股道占用、股道两边没有占用、股道没有进路锁闭或该进路正在正常解锁 + if (section.isOccupied()) { + if ((!section.getNextRunningSectionOf(false).isOccupied() + && !section.getNextRunningSectionOf(true).isOccupied()) + && (section.getRoute() == null || section.getRoute().isNormalUnlock())) { + section.startStopCountDown(); + } + } + } else { + section.setStopCountDown(stopCountDown - SimulationConstants.CI_LOOP_RATE); + if (stopCountDown <= 0) { + section.setStopCountDown(0); + } } } } 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 7187ab513..f6534d99b 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 @@ -1116,6 +1116,7 @@ public class MapDeviceBuilder { section.setVirtualAxleCounter(axleCounter); deviceMap.put(axleCounter.getCode(), axleCounter); } + section.setHasStopCountDown(sectionVO.isHasStopCD()); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/SimulationDataRepository.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/SimulationDataRepository.java index d6627caf5..7bec0d266 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/SimulationDataRepository.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/SimulationDataRepository.java @@ -1248,4 +1248,10 @@ public class SimulationDataRepository { } return stream.collect(Collectors.toList()); } + + public List
getHasStopCountDownSections() { + return getListByType(MapElement.DeviceType.SECTION, Section.class).stream() + .filter(Section::isHasStopCountDown) + .collect(Collectors.toList()); + } } 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 abeed805e..6903d8c4b 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 @@ -164,6 +164,11 @@ public class Section extends DelayUnlockDevice { */ private Set zcs = new HashSet<>(); + /** + * 有停稳计时? + */ + private boolean hasStopCountDown; + // ------------------状态属性--------------------- /** @@ -263,8 +268,11 @@ public class Section extends DelayUnlockDevice { /** * 停稳倒计时 + * 0 表示初始状态 + * -1 表示准备开始计时; + * 非负数表示当前计时; */ - private Integer stopCountDown; + private int stopCountDown; @Override public void reset() { @@ -287,7 +295,7 @@ public class Section extends DelayUnlockDevice { this.closed = false; this.badShunt = false; this.shuntingTypeList = new ArrayList<>(); - this.stopCountDown = null; + this.stopCountDown = 0; } /** @@ -297,14 +305,19 @@ public class Section extends DelayUnlockDevice { stopCountDown = 40 * 1000; } - public Integer getStopCountDownInSeconds() { - return stopCountDown == null ? null : stopCountDown / 1000; + /** + * 准备开始停稳倒计时 + */ + public void readyStartStopCountDown() { + stopCountDown = -1; + } + + public int getStopCountDownInSeconds() { + return stopCountDown / 1000; } /** * 区段是否被列车占用 - * - * @return */ public boolean isOccupied() { return this.nctOccupied || this.ctOccupied || this.isLogicOccupied(); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/SectionStatus.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/SectionStatus.java index 437be742f..bd13f3146 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/SectionStatus.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/SectionStatus.java @@ -253,12 +253,12 @@ public class SectionStatus extends DeviceStatus { this.badShunt = section.isBadShunt(); status.setBadShunt(this.badShunt); } - Integer stopCountDownInSeconds = section.getStopCountDownInSeconds(); + int stopCountDownInSeconds = section.getStopCountDownInSeconds(); if (!Objects.equals(this.stopCountDown, stopCountDownInSeconds)) { change = true; this.stopCountDown = stopCountDownInSeconds; } - status.setStopCountDown(stopCountDown == null ? null : stopCountDown); + status.setStopCountDown(stopCountDown == 0 ? null : stopCountDown); return change; } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSection.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSection.java index 7d201fc76..e01254c91 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSection.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/storage/device/StorageSection.java @@ -106,6 +106,11 @@ public class StorageSection extends StorageDelayUnlockDevice { */ private Boolean badShunt; + /** + * 停稳倒计时 + */ + private Integer stopCountDown; + public StorageSection(Section section) { super(section); } @@ -176,6 +181,10 @@ public class StorageSection extends StorageDelayUnlockDevice { this.shuntingTypeList = section.getShuntingTypeList(); this.badShunt = section.isBadShunt(); } + if (section.getStopCountDown() != 0) { + change = true; + this.stopCountDown = section.getStopCountDown(); + } return change; } @@ -197,5 +206,6 @@ public class StorageSection extends StorageDelayUnlockDevice { section.setSpeedLimitBeforeFault(speedLimitBeforeFault); section.setShuntingTypeList(shuntingTypeList != null ? shuntingTypeList : new ArrayList<>()); section.setBadShunt(badShunt != null ? badShunt : false); + section.setStopCountDown(stopCountDown == null ? 0 : stopCountDown); } } diff --git a/src/main/java/club/joylink/rtss/vo/map/graph/MapSectionNewVO.java b/src/main/java/club/joylink/rtss/vo/map/graph/MapSectionNewVO.java index 2ae44d2c8..930f01490 100644 --- a/src/main/java/club/joylink/rtss/vo/map/graph/MapSectionNewVO.java +++ b/src/main/java/club/joylink/rtss/vo/map/graph/MapSectionNewVO.java @@ -48,6 +48,11 @@ public class MapSectionNewVO { */ private Point namePosition; + /** + * 有停稳计时 + */ + private boolean hasStopCD; + /** * 停车倒计时显示坐标 */