From 8eab5d364240a15477a4fbf8ea415f64f792b5f9 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Tue, 14 Jun 2022 18:39:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E9=93=81CTC=E8=82=A1=E9=81=93?= =?UTF-8?q?=E8=A7=86=E5=9B=BE=E6=81=A2=E5=A4=8D=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simulation/cbtc/CTC/CTCLogicLoop.java | 10 +++ .../rtss/simulation/cbtc/CTC/CTCService.java | 20 +++--- .../simulation/cbtc/CTC/data/TrackViewVO.java | 61 +++++++++++++++++++ .../cbtc/build/SimulationBuilder.java | 6 ++ 4 files changed, 87 insertions(+), 10 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCLogicLoop.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCLogicLoop.java index 0093f02eb..14ee38c1b 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCLogicLoop.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCLogicLoop.java @@ -43,13 +43,23 @@ public class CTCLogicLoop { } public void sendMessage(Simulation simulation) { + sendTrackViewMessage(simulation); sendRouteSequenceMessage(simulation); } public void sendAllMessage(Simulation simulation) { + sendAllTrackViewMessage(simulation); sendAllRouteSequenceMessage(simulation); } + private void sendAllTrackViewMessage(Simulation simulation) { + + } + + private void sendTrackViewMessage(Simulation simulation) { + + } + private void sendAllRouteSequenceMessage(Simulation simulation) { CtcRepository ctcRepository = simulation.getCtcRepository(); List> list = new ArrayList<>(); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCService.java index 616e19010..dcb9acc3f 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/CTCService.java @@ -78,9 +78,9 @@ public class CTCService { * 发送发车预告 */ public void sendDepartureNotice(Simulation simulation, String stationCode, String runPlanCode) { - CtcStationRunPlanLog currentStationPlan = getCtcStationRunPlan(simulation, stationCode, runPlanCode); + CtcStationRunPlanLog currentStationPlan = getCtcStationRunPlanByRunPlanCode(simulation, stationCode, runPlanCode); Station nextStation = currentStationPlan.getNextStation(); - CtcStationRunPlanLog nextStationPlan = getCtcStationRunPlan(simulation, nextStation.getCode(), runPlanCode); + CtcStationRunPlanLog nextStationPlan = getCtcStationRunPlanByRunPlanCode(simulation, nextStation.getCode(), runPlanCode); currentStationPlan.sendDepartureNotice(); nextStationPlan.receiveDepartureNotice(); } @@ -89,9 +89,9 @@ public class CTCService { * 同意发车预告 */ public void agreeDepartureNotice(Simulation simulation, String stationCode, String tripNumber) { - CtcStationRunPlanLog currentStationPlan = getCtcStationRunPlan(simulation, stationCode, tripNumber); + CtcStationRunPlanLog currentStationPlan = getCtcStationRunPlanByRunPlanCode(simulation, stationCode, tripNumber); Station previousStation = currentStationPlan.getPreviousStation(); - CtcStationRunPlanLog previousStationPlan = getCtcStationRunPlan(simulation, previousStation.getCode(), tripNumber); + CtcStationRunPlanLog previousStationPlan = getCtcStationRunPlanByRunPlanCode(simulation, previousStation.getCode(), tripNumber); currentStationPlan.finishReceivingNotice(); previousStationPlan.finishDepartureNotice(); } @@ -105,13 +105,13 @@ public class CTCService { line.setAutoTrigger(trigger); } - private CtcStationRunPlanLog getCtcStationRunPlan(Simulation simulation, String stationCode, String runPlanCode) { + private CtcStationRunPlanLog getCtcStationRunPlan(Simulation simulation, String stationCode, String tripNumber) { + CtcRepository ctcRepository = simulation.getCtcRepository(); + return ctcRepository.getRunPlan(stationCode, tripNumber); + } + + private CtcStationRunPlanLog getCtcStationRunPlanByRunPlanCode(Simulation simulation, String stationCode, String runPlanCode) { CtcRepository ctcRepository = simulation.getCtcRepository(); return ctcRepository.getRunPlanByRunPlanCode(stationCode, runPlanCode); } - - private RouteSequence.Line getRouteSequenceLine(Simulation simulation, String stationCode, String tripNumber, boolean departure) { - CtcRepository ctcRepository = simulation.getCtcRepository(); - return ctcRepository.getRouteSequenceLine(stationCode, tripNumber, departure); - } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackViewVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackViewVO.java index 949c93980..86b804c1b 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackViewVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CTC/data/TrackViewVO.java @@ -4,9 +4,70 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; + @Getter @Setter @NoArgsConstructor public class TrackViewVO { + private String stationCode; + private Map sectionAndTrackInfo; + + class TrackInfo { + private boolean occupied; + + private List lines; + } + + class Line { + private String tripNumber; + + private String trainType; + + private String trainDistanceInfo; + + private Process process; + + private boolean receivingNotice; + + private boolean receivingRouteLock; + + private String receivingRouteCode; + + private boolean receivingRouteAutoTrigger; + + private boolean arrive; + + private boolean departureNotice; + + private boolean departureRouteLock; + + private String departureRouteCode; + + private boolean departureRouteAutoTrigger; + + private boolean departure; + + private LocalDateTime arriveTime; + + private LocalDateTime departureTime; + + private LocalDateTime planArriveTime; + + private LocalDateTime planDepartureTime; + } + + enum Process { + RECEIVING_BLOCK, //办理接车闭塞 + RECEIVING, //准备接车 + RECEIVING_ROUTE, //办理接车进路 + ARRIVE, //列车到达(通过)报点 + DEPARTURE_BLOCK, //办理发车闭塞 + DEPARTURE_ROUTE, //发车进路办理 + DEPARTURE, //发车报点 + FINISH //流程终止 + } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/build/SimulationBuilder.java b/src/main/java/club/joylink/rtss/simulation/cbtc/build/SimulationBuilder.java index 715cdbc80..44c12a173 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/build/SimulationBuilder.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/build/SimulationBuilder.java @@ -31,6 +31,8 @@ import lombok.Setter; import lombok.extern.slf4j.Slf4j; import org.springframework.util.CollectionUtils; +import java.time.Duration; +import java.time.LocalDateTime; import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; @@ -98,8 +100,12 @@ public class SimulationBuilder { loadDepotInOutRoutePath(simulation); // CTC行车日志数据结构构建 if (simulation.getRepository().getConfig().isHasCTC()) { + LocalDateTime now = LocalDateTime.now(); buildCtcStationRunPlanLog(simulation, simulation.getRepository().getServiceTripsMap()); + System.out.println("CTC行车日志耗时:" + Duration.between(now, LocalDateTime.now()).getSeconds()); + now = LocalDateTime.now(); generateRouteSequence(simulation); + System.out.println("CTC进路序列耗时:" + Duration.between(now, LocalDateTime.now()).getSeconds()); } return simulation; }