From 3e16198215b5a53e2ca0429833a277e33f819e80 Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Thu, 5 Aug 2021 13:48:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B0=E7=89=88ma=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=EF=BC=9B=E6=81=A2=E5=A4=8DATO=E5=88=B0=E7=AB=99?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=BC=80=E9=97=A8=E5=90=8E=E5=85=B3=E9=97=AD?= =?UTF-8?q?ATO=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../draft/DraftMapOverrunController.java | 8 +++ .../draftData/DraftMapOverrunService.java | 4 ++ .../draftData/DraftMapOverrunServiceImpl.java | 6 +++ .../draftData/DraftMapRouteServiceImpl.java | 1 + .../simulation/cbtc/ATP/ground/MaService.java | 9 ++-- .../cbtc/onboard/ATP/ATPLogicLoop.java | 51 ++++--------------- .../simulation/cbtc/robot/RobotLogicLoop.java | 28 ++++++---- .../joylink/rtss/vo/map/MapRouteNewVO.java | 1 + 8 files changed, 52 insertions(+), 56 deletions(-) diff --git a/src/main/java/club/joylink/rtss/controller/draft/DraftMapOverrunController.java b/src/main/java/club/joylink/rtss/controller/draft/DraftMapOverrunController.java index 9c6ba6221..dd05a0de3 100644 --- a/src/main/java/club/joylink/rtss/controller/draft/DraftMapOverrunController.java +++ b/src/main/java/club/joylink/rtss/controller/draft/DraftMapOverrunController.java @@ -3,10 +3,13 @@ package club.joylink.rtss.controller.draft; import club.joylink.rtss.services.draftData.DraftMapOverrunService; import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.map.MapRouteOverrunQueryVO; +import club.joylink.rtss.vo.map.MapRouteNewVO; import club.joylink.rtss.vo.map.MapRouteOverrunVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.List; + @RestController @RequestMapping("/api/draftMap/{id}/overrun") public class DraftMapOverrunController { @@ -18,6 +21,11 @@ public class DraftMapOverrunController { return draftMapOverrunService.pagingQuery(id, queryVO); } + @GetMapping("/all") + public List queryAll(@PathVariable Long id) { + return this.draftMapOverrunService.queryAll(id); + } + @PostMapping("") public void createOverrun(@PathVariable Long id, @RequestBody MapRouteOverrunVO overrunVO) { draftMapOverrunService.createOverrun(id, overrunVO); diff --git a/src/main/java/club/joylink/rtss/services/draftData/DraftMapOverrunService.java b/src/main/java/club/joylink/rtss/services/draftData/DraftMapOverrunService.java index eab5cb794..88689f053 100644 --- a/src/main/java/club/joylink/rtss/services/draftData/DraftMapOverrunService.java +++ b/src/main/java/club/joylink/rtss/services/draftData/DraftMapOverrunService.java @@ -4,6 +4,8 @@ import club.joylink.rtss.vo.client.PageVO; import club.joylink.rtss.vo.client.map.MapRouteOverrunQueryVO; import club.joylink.rtss.vo.map.MapRouteOverrunVO; +import java.util.List; + public interface DraftMapOverrunService { void createOverrun(long mapId, MapRouteOverrunVO overrunVO); @@ -12,4 +14,6 @@ public interface DraftMapOverrunService { void delete(long mapId, String code); void update(Long mapId, String code, MapRouteOverrunVO vo); + + List queryAll(Long mapId); } diff --git a/src/main/java/club/joylink/rtss/services/draftData/DraftMapOverrunServiceImpl.java b/src/main/java/club/joylink/rtss/services/draftData/DraftMapOverrunServiceImpl.java index c3643f988..db2b47d10 100644 --- a/src/main/java/club/joylink/rtss/services/draftData/DraftMapOverrunServiceImpl.java +++ b/src/main/java/club/joylink/rtss/services/draftData/DraftMapOverrunServiceImpl.java @@ -85,6 +85,12 @@ public class DraftMapOverrunServiceImpl implements DraftMapOverrunService { draftMapRouteOverrunDAO.updateByPrimaryKey(newEntity); } + @Override + public List queryAll(Long mapId) { + List entities = findEntitiesByMapId(mapId); + return MapRouteOverrunVO.convertFromDraft(entities); + } + private List findEntitiesByMapId(long mapId) { DraftMapRouteOverrunExample example = new DraftMapRouteOverrunExample(); example.createCriteria().andMapIdEqualTo(mapId); diff --git a/src/main/java/club/joylink/rtss/services/draftData/DraftMapRouteServiceImpl.java b/src/main/java/club/joylink/rtss/services/draftData/DraftMapRouteServiceImpl.java index d87a4ce5f..263c090e8 100644 --- a/src/main/java/club/joylink/rtss/services/draftData/DraftMapRouteServiceImpl.java +++ b/src/main/java/club/joylink/rtss/services/draftData/DraftMapRouteServiceImpl.java @@ -122,6 +122,7 @@ public class DraftMapRouteServiceImpl implements DraftMapRouteService { update.setName(routeNewVO.getName()); update.setSetOverlapInCtc(routeNewVO.isSetOverlapInCtc()); update.setOverlapCode(routeNewVO.getOverlapCode()); + update.setOverrunList(routeNewVO.getOverrunList()); update.setHoldStandList(routeNewVO.getHoldStandList()); DraftMapRoute db = update.convert2Draft(); this.draftMapRouteDAO.updateByPrimaryKeyWithBLOBs(db); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/MaService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/MaService.java index d8cdcfd58..7b7f3da92 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/MaService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATP/ground/MaService.java @@ -310,8 +310,8 @@ public class MaService { // 关闭的区段 ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.Closed_Section)); } - if (this.isFaultStand(section)) { - // 故障/紧急停车站台 + if (this.isAbnormalStand(section)) { + // 屏蔽门不安全/紧急停车站台 ma = this.checkAndUpdateMa(ma, new Ma(train, section, MaType.Stand)); } Section next = section.getNextRunningSectionOf(right); @@ -351,14 +351,13 @@ public class MaService { return ma; } - private boolean isFaultStand(Section section) { + private boolean isAbnormalStand(Section section) { if (section.isNormalStandTrack()) { for (Stand stand : section.getStandList()) { if (stand.isEmergencyClosed()) { return true; } - PSD psd = stand.getPsd(); - if (psd != null && (!psd.isCloseAndLock() && !psd.isInterlockRelease()) && !stand.isTrainParking()) { + if (!stand.isPsdSafe()) { return true; } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPLogicLoop.java b/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPLogicLoop.java index cb6112ec2..1ea3d899d 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPLogicLoop.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/onboard/ATP/ATPLogicLoop.java @@ -201,45 +201,10 @@ public class ATPLogicLoop { float atoSpeed = speedCurve.getSpeedOf(speedCurve.getTotalDistance()); train.setAtpSpeed(atpSpeed); train.setAtoSpeed(atoSpeed); + } else { + train.setAtpSpeed(0); + train.setAtoSpeed(0); } -// // 驾驶故障导致EB -// MovementAuthority ma = train.getMa(); -// if (Objects.nonNull(ma)) { // 通信正常,移动授权可用 -// // 获取移动授权剩余距离 -// Float remainDistance = atpService.calculateProtectDistance(train, ma.getEnd()); -// if (Objects.isNull(remainDistance) || remainDistance <= 0) { -// log.warn(String.format("列车[%s]无法计算出移动防护剩余距离或防护距离不为正", train.getGroupNumber())); -// atpSpeed = 0; -// atoSpeed = 0; -// } else { -//// // 获取防护速度 -//// SpeedCurve protectSpeedCurve = ma.getProtectSpeedCurve(); -//// float protectSpeed = protectSpeedCurve.getSpeedOf(remainDistance); -//// atpSpeed = protectSpeed; -// // 计算推荐速度曲线 -// float targetDistance = ATOService.calculateTargetRemainDistance(train, ma); -// SectionPosition headPosition = train.getHeadPosition(); -// SectionPosition tailPosition = train.calculateTailPosition(); -// boolean right = train.isRight(); -// float speedMax = Math.min(train.getAtoSpeedMax(), train.getSpeedLimit() * 0.9f); -// SpeedCurve speedCurve = SpeedCurve -// .buildTargetSpeedCurve(headPosition, tailPosition, right, -// targetDistance, train.getSpeed(), speedMax); -// // 更新目标距离和建议速度 -// train.setTargetDistance(targetDistance); -// train.setSpeedCurve(speedCurve); -// atoSpeed = speedCurve.getSpeedOf(speedCurve.getTotalDistance()); -// atpSpeed = atoSpeed + 5 / 3.6f; -// } -// } else { -// atpSpeed = 0; -// atoSpeed = 0; -// log.warn(String.format("列车[%s-%s|%s|%s]速度[%s]没有移动授权,触发EB", -// train.getGroupNumber(), train.getServiceNumber(), -// train.getTripNumber(), train.getDestinationCode(), -// train.getSpeed())); -// } -// break; } } @@ -330,9 +295,15 @@ public class ATPLogicLoop { // } //// } // } else { - this.atoService.syncOpenDoor(simulation, train); + if (train.isAtoOn()) { + this.atoService.syncOpenDoor(simulation, train); + } if (this.isAllDoorOpen(simulation, train)) { train.nextParkedTrainActivity(); + if (train.isAtoOn()) { + atoService.closeATO(train); + train.setAutoOpenATO(true); + } } // } break; @@ -360,7 +331,7 @@ public class ATPLogicLoop { // } // } // 可以关门 - this.atoService.syncCloseDoor(simulation, train); +// this.atoService.syncCloseDoor(simulation, train); if (this.isAllDoorClose(simulation, train)) { train.nextParkedTrainActivity(); } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/robot/RobotLogicLoop.java b/src/main/java/club/joylink/rtss/simulation/cbtc/robot/RobotLogicLoop.java index e066e5acc..ac9d64d0d 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/robot/RobotLogicLoop.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/robot/RobotLogicLoop.java @@ -88,19 +88,25 @@ public class RobotLogicLoop { if (activity == null) return; switch (activity) { - case CLOSE_DOOR: - atpService.openOrCloseDoor(simulation, train, false, false); - atpService.openOrCloseDoor(simulation, train, true, false); - if (!train.isCommunicable()) { - Section headSection = train.getHeadPosition().getSection(); - List standList = headSection.getStandList(); - if (!CollectionUtils.isEmpty(standList)) { - for (Stand stand : standList) { - ciApiService.closeScreenDoor(simulation, stand.getCode()); - } - } + case OPEN_DOOR: + if (!train.isAtoOn()) { + atoService.syncOpenDoor(simulation, train); } break; + case CLOSE_DOOR: + atoService.syncCloseDoor(simulation, train); +// atpService.openOrCloseDoor(simulation, train, false, false); +// atpService.openOrCloseDoor(simulation, train, true, false); +// if (!train.isCommunicable()) { +// Section headSection = train.getHeadPosition().getSection(); +// List standList = headSection.getStandList(); +// if (!CollectionUtils.isEmpty(standList)) { +// for (Stand stand : standList) { +// ciApiService.closeScreenDoor(simulation, stand.getCode()); +// } +// } +// } + break; case START: if (train.isAutoOpenATO()) { atoService.openATO(train); diff --git a/src/main/java/club/joylink/rtss/vo/map/MapRouteNewVO.java b/src/main/java/club/joylink/rtss/vo/map/MapRouteNewVO.java index 39896be49..332a4e4c6 100644 --- a/src/main/java/club/joylink/rtss/vo/map/MapRouteNewVO.java +++ b/src/main/java/club/joylink/rtss/vo/map/MapRouteNewVO.java @@ -229,6 +229,7 @@ public class MapRouteNewVO { if (Objects.nonNull(route.getOverlap())) { vo.setOverlapCode(route.getOverlap().getCode()); } + if (!CollectionUtils.isEmpty(route.getStandHoldList())) { vo.setHoldStandList(route.getStandHoldList().stream().map(Stand::getCode).collect(Collectors.toList())); }