From 786a56b8d13388e1eafa4b05632b328df0b5b3f0 Mon Sep 17 00:00:00 2001 From: tiger_zhou <123456> Date: Mon, 24 Apr 2023 14:04:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=97=E8=BD=A6=E5=9B=BE=E4=BE=8B=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=BD=8D=E7=BD=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cbtc/ATS/ATSTrainMessageDiagram.java | 39 ++++++++++++------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/ATSTrainMessageDiagram.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/ATSTrainMessageDiagram.java index 1a224a9e4..b51c25a8d 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/ATSTrainMessageDiagram.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/ATSTrainMessageDiagram.java @@ -41,18 +41,18 @@ public class ATSTrainMessageDiagram { public void collect(Simulation simulation){ - KmStation kmStation = new KmStation(simulation); List stationDiagramList = Lists.newArrayList(); for (VirtualRealityTrain train : simulation.getRepository().getOnlineTrainList()) { + TrainInfo trainInfo = simulation.getRepository().findSupervisedTrainByGroup(train.getGroupNumber()); + Section target = train.getTarget(); if(ObjectUtils.anyNull(target,train.getNextStation(),train.getTerminalStation())){ StationDiagram sd = new StationDiagram(train,0F,false); stationDiagramList.add(sd); continue; } - TrainInfo trainInfo = simulation.getRepository().getSupervisedTrainByGroup(train.getGroupNumber()); if(Objects.nonNull(trainInfo) && trainInfo.isInbound()){ StationDiagram sd = new StationDiagram(train,0F,false); stationDiagramList.add(sd); @@ -60,8 +60,9 @@ public class ATSTrainMessageDiagram { } Station nextStation = train.getNextStation(); SectionPosition tailPos = train.getTailPosition(); + if(nextStation.isDepot() && !tailPos.getSection().isStandTrack()){ - //出站 + //入库 StationDiagram sd = new StationDiagram(train,0F,false); stationDiagramList.add(sd); }else if(trainInfo.isTurnBack()){ @@ -86,10 +87,10 @@ public class ATSTrainMessageDiagram { private Optional calculateRuning2(Simulation simulation,VirtualRealityTrain train,TrainInfo trainInfo,KmStation kmStation){ - - Section leaveSeaction = simulation.getRepository().getByCode(Objects.isNull(trainInfo.getEstimatedLeaveStandTrack()) ? trainInfo.getActualLeaveStandTrack() : trainInfo.getEstimatedLeaveStandTrack(),Section.class); Section trainSection = train.getHeadPosition().getSection(); + Section arttiveSection = simulation.getRepository().getByCode(trainInfo.getEstimatedArriveStandTrack(),Section.class); + if(train.isParkingAt()){ if(trainSection.isStandTrack() && Objects.equals(trainSection.getStation().getCode(),trainInfo.getStartStation())){ //到达始发站 @@ -108,10 +109,18 @@ public class ATSTrainMessageDiagram { return Optional.of(sd); } } + + if(Objects.equals(train.getNextStation().getCode(),trainInfo.getStartStation())){ + StationDiagram sd = new StationDiagram(train,true,0F,false); + sd.setStartStation(train.getNextStation()); + Station nextStation = kmStation.findNext(train.getNextStation(),train.isRight()); + sd.setEndStation(nextStation); + return Optional.of(sd); + } + + String d = Objects.isNull(trainInfo.getEstimatedLeaveStandTrack()) ? trainInfo.getActualLeaveStandTrack() : trainInfo.getEstimatedLeaveStandTrack(); + Section leaveSeaction = simulation.getRepository().getByCode(d,Section.class); Station endStation = simulation.getRepository().getByCode(trainInfo.getEndStation(),Station.class); - - boolean finalStation = true; - Section targetStand =endStation.getStandOf(train.isRight()).get(0).getSection(); if(Objects.equals(leaveSeaction.getStation().getCode(),trainInfo.getEndStation())){ StationDiagram sd = new StationDiagram(train,true,1F,true); Station preStation = kmStation.findPre(leaveSeaction.getStation(),train.isRight()); @@ -119,16 +128,16 @@ public class ATSTrainMessageDiagram { sd.setEndStation(endStation); return Optional.of(sd); }else{ - finalStation = false; Station targetStation = kmStation.findNext(leaveSeaction.getStation(),train.isRight()); - targetStand = targetStation.getStandOf(train.isRight()).get(0).getSection(); + Section targetStand = targetStation.getStandOf(train.isRight()).get(0).getSection(); + Float complateDis = this.calculateStationRatio(leaveSeaction,targetStand,train); + StationDiagram stationDiagram = new StationDiagram(train,true,complateDis,false); + stationDiagram.setStartStation(leaveSeaction.getStation()); + stationDiagram.setEndStation(targetStand.getStation()); + return Optional.of(stationDiagram); } - Float complateDis = this.calculateStationRatio(leaveSeaction,targetStand,train); - StationDiagram stationDiagram = new StationDiagram(train,true,complateDis,finalStation); - stationDiagram.setStartStation(leaveSeaction.getStation()); - stationDiagram.setEndStation(targetStand.getStation()); - return Optional.of(stationDiagram); + }