diff --git a/src/main/java/club/joylink/rtss/services/draftData/DraftMapCiDataGeneratorImpl.java b/src/main/java/club/joylink/rtss/services/draftData/DraftMapCiDataGeneratorImpl.java index d6c714f16..0b1f94e8c 100644 --- a/src/main/java/club/joylink/rtss/services/draftData/DraftMapCiDataGeneratorImpl.java +++ b/src/main/java/club/joylink/rtss/services/draftData/DraftMapCiDataGeneratorImpl.java @@ -222,6 +222,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator { List flsList = new ArrayList<>(); if (config.isGenerateFls()) { Map flsMap = this.generateFls(switchList); + flsList = new ArrayList<>(flsMap.values()); for (Route route : generatedRouteList) { // 进路道岔侧防 List routeFlsList = new ArrayList<>(); @@ -1903,6 +1904,27 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator { overlapList.add(routeOverlap); } } + // 处理延续保护只有区段且区段有逻辑区段的情况(延续保护区段更换为逻辑区段) + for (RouteOverlap overlap : overlapList) { + List pathList = overlap.getPathList(); + for (SectionPath sectionPath : pathList) { + if (CollectionUtils.isEmpty(sectionPath.getSwitchList())) { + // 非道岔延续保护 + List
logicOverlapList = new ArrayList<>(); + List
sectionList = sectionPath.getSectionList(); + Section section = sectionList.get(0); + List
logicList = section.getLogicList(); + if (!CollectionUtils.isEmpty(logicList)) { + Section logic = logicList.get(0); + if (!end.isRight()) { + logic = logicList.get(logicList.size() - 1); + } + logicOverlapList.add(logic); + } + sectionPath.setLogicList(logicOverlapList); + } + } + } return overlapList; } @@ -2176,11 +2198,40 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator { boolean right = !signal.isRight(); // 信号机反方向 Section section = signal.getSection(); if (config.isSignalApproachOnlyOne()) { - approachPathList.add(new SectionPath(right, null, Arrays.asList(section))); + approachPathList.add(new SectionPath(right, null, Arrays.asList(section), new ArrayList<>())); } else { float l = 600; // 接近距离默认600m getApproachPathOf(section, right, l, new SectionPath(right), config, approachPathList); } + for (SectionPath sectionPath : approachPathList) { + float len = 0; + List
logicApproachList = new ArrayList<>(); + List
sectionList = sectionPath.getSectionList(); + for (Section phySection : sectionList) { + if(len >= 600) break; + if (phySection.isSwitchTrack()) { + len += phySection.getLen(); + logicApproachList.add(phySection); + continue; + } + List
logicList = phySection.getLogicList(); + if (CollectionUtils.isEmpty(logicList)) { + len += phySection.getLen(); + logicApproachList.add(phySection); + continue; + } + List
sortedList = new ArrayList<>(logicList); + if (signal.isRight()) { + Collections.reverse(sortedList); + } + for (Section logic : sortedList) { + logicApproachList.add(logic); + len += logic.getLen(); + if(len >= 600) break; + } + } + sectionPath.setLogicList(logicApproachList); + } signal.setApproachPathList(approachPathList); signal.setRouteReleaseTime(config.getRouteReleaseTime()); } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsPlanService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsPlanService.java index 7cc849c4d..3eaaa928d 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsPlanService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsPlanService.java @@ -211,6 +211,20 @@ public class AtsPlanService { Station station = lastStationPlan.getStation(); // 列车是否到达终点站的折返轨,且列车应该已经到达过最后一个车站 if (axleSection.isTurnBackTrack() && Objects.equals(station, axleSection.getStation())) { + // 判断是否整个车停在折返轨 + Section pre = axleSection.getSectionOf(!right); + if (axleSection.isSwitchTrack()) { + if (pre == null) { + pre = axleSection.getRelSwitch().getA().getSectionOf(!right); + } + if (pre != null && pre.isOccupied()) { + return false; + } + } else { + if (pre.isOccupied()) { + return false; + } + } if (tripPlan.isTurnBackSection(axleSection)) { // 列车在计划折返轨 return true; } else { // 若列车不在计划的折返轨,判断车次最后到达车站计划到列车位置进路是否到列车当前位置 diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsRouteSettingService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsRouteSettingService.java index 8d9558118..a1d05e8a9 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsRouteSettingService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/service/AtsRouteSettingService.java @@ -671,8 +671,10 @@ public class AtsRouteSettingService { * @return */ private Signal queryApproachCloseSignal(Simulation simulation, TrainInfo train, Section section, Boolean right) { + SimulationDataRepository repository = simulation.getRepository(); Section base = section; Signal target = null; + Section logic = repository.getByCode(train.getSection(), Section.class); int count = 0; while (Objects.nonNull(base) && count < 10) { ++count; @@ -684,7 +686,7 @@ public class AtsRouteSettingService { continue; } // 信号机存在,判定信号关闭、接近区段 - if (signal.isApproachSection(section.getCode())) { + if (signal.isApproachSection(train.getSection())) { target = signal; } break; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/RouteService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/RouteService.java index 88e397aea..03777fe9f 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/RouteService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/CI/service/RouteService.java @@ -329,50 +329,53 @@ public class RouteService { */ public void settingProgress(Simulation simulation, Route route) { if (route.isSetting()) { // 进路排列中 - if (Objects.isNull(route.getSettingStartTime())) {//旧数据兼容逻辑 - route.setSettingStartTime(simulation.getSystemTime()); - } - if (simulation.getSystemTime().isAfter(route.getSettingStartTime().plusSeconds(10))) { - route.settingFailed(); - simulation.getRepository().removeSettingRoute(route); - log.info(String.format("进路[%s]办理失败,取消办理2", route.debugStr())); - return; + MapConfig config = simulation.getRepository().getConfig(); + if (!config.isRouteSettingNoFail()) { + if (Objects.isNull(route.getSettingStartTime())) {//旧数据兼容逻辑 + route.setSettingStartTime(simulation.getSystemTime()); + } + if (simulation.getSystemTime().isAfter(route.getSettingStartTime().plusSeconds(10))) { + route.settingFailed(); + simulation.getRepository().removeSettingRoute(route); + log.info(String.format("进路[%s]办理失败,取消办理2", route.debugStr())); + return; + } } route.setLock(true); route.getStart().setLockedRoute(route); - MapConfig config = simulation.getRepository().getConfig(); - if (!route.isRequisition()) { - // 征用设备 - // 预先锁闭 - boolean right = route.getStart().isRight(); - if (config.isLockFirst()) { - // 进路排列区段预先锁闭 - List
sectionList = route.getSectionList(); - for (Section section : sectionList) { - if (section.isSwitchTrack()) { - Switch relSwitch = section.getRelSwitch(); - relSwitch.getA().routeLocking(right); - if (relSwitch.isNormalPosition()) { // 定位 - relSwitch.getB().routeLocking(right); - relSwitch.getC().routeUnlocking(right); - } else if (relSwitch.isReversePosition()) { // 反位 - relSwitch.getC().routeLocking(right); - relSwitch.getB().routeUnlocking(right); - } else { // 失表 - relSwitch.getB().routeLocking(right); - relSwitch.getC().routeLocking(right); - } - } else { - section.routeLocking(right); + boolean right = route.getStart().isRight(); + // 预先锁闭 + if (config.isLockFirst()) { + // 进路排列区段预先锁闭 + List
sectionList = route.getSectionList(); + for (Section section : sectionList) { + if (section.isSwitchTrack()) { + Switch relSwitch = section.getRelSwitch(); + relSwitch.getA().routeLocking(right); + if (relSwitch.isNormalPosition()) { // 定位 + relSwitch.getB().routeLocking(right); + relSwitch.getC().routeUnlocking(right); + } else if (relSwitch.isReversePosition()) { // 反位 + relSwitch.getC().routeLocking(right); + relSwitch.getB().routeUnlocking(right); + } else { // 失表 + relSwitch.getB().routeLocking(right); + relSwitch.getC().routeLocking(right); } + } else { + section.routeLocking(right); } } + } + if (!route.isRequisition()) { + // 征用设备 // 道岔位置转换 List switchList = route.getSwitchList(); this.routeSwitchTurn(simulation, switchList); route.updateRequisition(true); return; } + this.routeFlsControl(simulation, route); // 设备已征用,检查进路条件 boolean onPosition = this.checkSwitchPosition(simulation, route); if (!onPosition) { // 还未转换到位置 @@ -390,6 +393,26 @@ public class RouteService { } } + private void routeFlsControl(Simulation simulation, Route route) { + // 侧防道岔转换 + List flsList = route.getFlsList(); + if (!CollectionUtils.isEmpty(flsList)) { + List switchElementList = new ArrayList<>(); + for (RouteFls routeFls : flsList) { + List level1List = routeFls.getLevel1List(); + for (RouteFls.FlsElement flsElement : level1List) { + SwitchElement pSwitch = flsElement.getPSwitch(); + if (pSwitch != null) { + switchElementList.add(pSwitch); + } else if (flsElement.getFpae() != null) { + switchElementList.add(flsElement.getFpae()); + } + } + } + this.routeSwitchTurn(simulation, switchElementList); + } + } + private boolean checkSwitchPosition(Simulation simulation, Route route) { Set sectionRelSwitches = route.getSectionList().stream().map(Section::getRelSwitch).collect(Collectors.toSet()); List switchList; @@ -427,11 +450,15 @@ public class RouteService { MapConfig config = simulation.getRepository().getConfig(); boolean right = overlap.isRight(); SectionPath sectionPath = overlap.selectPath(); - if (!overlap.isRequisition()) { // 设备征用 - // 延续保护位置转动 - // 延续保护区段预先锁闭 - List
sectionList = sectionPath.getSectionList(); - if (config.isLockFirst()) { + // 延续保护区段预先锁闭 + List
logicList = sectionPath.getLogicList(); + if (config.isLockFirst()) { + if (!CollectionUtils.isEmpty(logicList)) { + for (Section section : logicList) { + section.overlapLocking(right); + } + } else { + List
sectionList = sectionPath.getSectionList(); for (Section section : sectionList) { if (section.isSwitchTrack()) { Switch relSwitch = section.getRelSwitch(); @@ -451,6 +478,9 @@ public class RouteService { } } } + } + if (!overlap.isRequisition()) { // 设备征用 + // 延续保护位置转动 // 道岔位置转换 List pathSwitchList = sectionPath.getPathSwitchElementList(); this.routeSwitchTurn(simulation, pathSwitchList); @@ -529,7 +559,6 @@ public class RouteService { if (section.isSwitchTrack()) { // 道岔锁闭 Switch relSwitch = section.getRelSwitch(); - relSwitch.routeLock(); if (relSwitch.isNormalPosition()) { relSwitch.getC().routeUnlocking(right); } else if (relSwitch.isReversePosition()) { @@ -537,18 +566,31 @@ public class RouteService { } } } -// // 道岔锁闭 -// for (SwitchElement element : route.getSwitchList()) { -// Switch aSwitch = element.getASwitch(); -// aSwitch.routeLock(); -// if (simulation.getRepository().getConfig().isLockFirst()) { -// if (element.isNormal()) { -// aSwitch.getC().routeUnlocking(right); -// } else { -// aSwitch.getB().routeUnlocking(right); -// } -// } -// } + // 道岔锁闭 + for (SwitchElement element : route.getSwitchList()) { + Switch aSwitch = element.getASwitch(); + aSwitch.routeLock(); + } + // 侧防锁闭 + List flsList = route.getFlsList(); + if (!CollectionUtils.isEmpty(flsList)) { + for (RouteFls routeFls : flsList) { + for (RouteFls.FlsElement flsElement : routeFls.getLevel1List()) { + SwitchElement pSwitch = flsElement.getPSwitch(); + if (pSwitch != null) { + Switch aSwitch = pSwitch.getASwitch(); + if (aSwitch.isOnPosition(pSwitch.isNormal())) { + aSwitch.fpLock(); + } + } else { + SwitchElement fpae = flsElement.getFpae(); + if (fpae != null && fpae.getASwitch().isOnPosition(fpae.isNormal())) { + fpae.getASwitch().fpLock(); + } + } + } + } + } // 延续保护 if (!route.isCbtcMode()) { RouteOverlap overlap = route.getOverlap(); @@ -648,6 +690,13 @@ public class RouteService { aSwitch.routeUnlock(); }); } + // 进路侧防取消锁闭 + List flsList = route.getFlsList(); + if (!CollectionUtils.isEmpty(flsList)) { + for (RouteFls routeFls : flsList) { + routeFls.unlock(); + } + } // 进路延续保护解锁 RouteOverlap overlap = route.getOverlap(); if (Objects.nonNull(overlap)) { @@ -709,32 +758,35 @@ public class RouteService { * @return */ public boolean isInterlocked(Route route) { - Route.CheckFailMessage failMessage; - if (route.isOpenGuide()) { - failMessage = this.guideRouteCheck(route); - } else { - failMessage = this.baseCheck(route); - } - if (Objects.nonNull(failMessage)) { - log.debug(String.format("联锁网络检查失败:[%s]", failMessage.toJson())); +// Route.CheckFailMessage failMessage; +// if (route.isOpenGuide()) { +// failMessage = this.guideRouteCheck(route); +// } else { +// failMessage = this.baseCheck(route); +// } +// if (Objects.nonNull(failMessage)) { +// log.debug(String.format("联锁网络检查失败:[%s]", failMessage.toJson())); +// return false; +// } + int level = checkRouteLevel(route); + route.getStart().setLevel(level); + if (level != 3) { return false; } + return true; + } + + private int checkRouteLevel(Route route) { + int level = 1; + // 进路区段检查 boolean right = route.getStart().isRight(); List
sectionList = route.getSectionList(); for (Section section : sectionList) { if (!section.isRouteLockOn(right)) { - return false; + return level; } if (section.isNoStatus()) { - return false; - } - } - // 站台紧急停车 - if (!CollectionUtils.isEmpty(route.getEspList())) { - for (ESP esp : route.getEspList()) { - if (esp.isEffective()) { - return false; - } + return level; } } // 道岔位置一致检查 @@ -754,7 +806,41 @@ public class RouteService { } log.debug(String.format("联锁网络检查失败:道岔[%s(%s)]位置[%s]", element.getASwitch().getName(), element.getASwitch().getCode(), p)); - return false; + return level; + } + } + level = 2; // 引导级 + // 进路侧防检查 + List flsList = route.getFlsList(); + if (!route.isOpenGuide() && !CollectionUtils.isEmpty(flsList)) { + boolean level1Result = true; + for (RouteFls routeFls : flsList) { + List level1List = routeFls.getLevel1List(); + for (RouteFls.FlsElement flsElement : level1List) { + SwitchElement pSwitch = flsElement.getPSwitch(); + if (pSwitch != null && !pSwitch.getASwitch().isOnPosition(pSwitch.isNormal())) { + level1Result = false; + break; + } else { + SwitchElement fpae = flsElement.getFpae(); + Signal pSignal = flsElement.getPSignal(); + if ((pSignal != null && !pSignal.isClose()) || + (fpae != null && !fpae.getASwitch().isOnPosition(fpae.isNormal()))) { + level1Result = false; + } + } + } + } + if (!level1Result) { + return level; + } + } + // 站台紧急停车 + if (!CollectionUtils.isEmpty(route.getEspList())) { + for (ESP esp : route.getEspList()) { + if (esp.isEffective()) { + return level; + } } } // 首区段检查 @@ -767,53 +853,53 @@ public class RouteService { Collections.reverse(logicList); } if (logicList.get(0).isOccupied()) { - return false; + return level; } } else { if (firstRouteSection.isOccupied()) { - return false; - } - } - // 如果进路区段中有站台轨,站台屏蔽门开着,需要关灯 - List
standTracks = sectionList.stream().filter(Section::isStandTrack).collect(Collectors.toList()); - if (!CollectionUtils.isEmpty(standTracks)) { - for (Section standTrack : standTracks) { - List standList = standTrack.getStandList(); - if (standList.stream().anyMatch(stand -> stand.getPsd() != null && !stand.getPsd().isCloseAndLock())) - return false; + return level; } } +// // 如果进路区段中有站台轨,站台屏蔽门开着,需要关灯 +// List
standTracks = sectionList.stream().filter(Section::isStandTrack).collect(Collectors.toList()); +// if (!CollectionUtils.isEmpty(standTracks)) { +// for (Section standTrack : standTracks) { +// List standList = standTrack.getStandList(); +// if (standList.stream().anyMatch(stand -> stand.getPsd() != null && !stand.getPsd().isCloseAndLock())) +// return false; +// } +// } } else { // 后备模式检查 // 区段占用检查 Route.CheckFailMessage checkFailMessage = this.ciLevelCheck(route); if (Objects.nonNull(checkFailMessage)) { - log.debug(String.format("联锁网络检查失败:[%s]", checkFailMessage.toJson())); - return false; + return level; } // 屏蔽门 -// if (!CollectionUtils.isEmpty(route.getPsdList())) { -// for (PSD psd : route.getPsdList()) { -// if (!psd.isCloseAndLock()) { -// log.debug(String.format("联锁网络检查失败:站台[%s(%s)]屏蔽门[%s(%s)]未关闭", -// psd.getStand().getName(), psd.getStand().getCode(), -// psd.getName(), psd.getCode())); -// return false; -// } -// } -// } + if (!CollectionUtils.isEmpty(route.getPsdList())) { + for (PSD psd : route.getPsdList()) { + if (!psd.isCloseAndLock()) { + log.debug(String.format("联锁网络检查失败:站台[%s(%s)]屏蔽门[%s(%s)]未关闭", + psd.getStand().getName(), psd.getStand().getCode(), + psd.getName(), psd.getCode())); + return level; + } + } + } // 站台扣车 if (!CollectionUtils.isEmpty(route.getStandHoldList())) { for (Stand stand : route.getStandHoldList()) { if (stand.isHoldTrain()) { log.debug(String.format("联锁网络检查失败:站台[%s(%s)]扣车", stand.getName(), stand.getCode())); - return false; + return level; } } } } - return true; + level = 3; // 主信号级 + return level; } /** @@ -958,6 +1044,10 @@ public class RouteService { SwitchElement switchElement = route.getRouteSwitchElement(relSwitch); section.routeUnlocking(right); relSwitch.routeUnlock(); + RouteFls routeFls = route.getRouteFlsOfSwitch(relSwitch); + if (routeFls != null) { + routeFls.unlock(); + } } else { section.routeUnlocking(right); } @@ -982,7 +1072,11 @@ public class RouteService { } private void overlapLock(SectionPath sectionPath, boolean right) { - for (Section section : sectionPath.getSectionList()) { + List
sectionList = sectionPath.getSectionList(); + if (!CollectionUtils.isEmpty(sectionPath.getLogicList())) { + sectionList = sectionPath.getLogicList(); + } + for (Section section : sectionList) { if (section.isSwitchTrack()) { Switch relSwitch = section.getRelSwitch(); relSwitch.overlapLock(); @@ -1086,10 +1180,20 @@ public class RouteService { overlap.releaseImmediately(); } else { boolean allUnlock = true; - for (Section section : sectionPath.getSectionList()) { - if (section.isOverlapLock()) { - allUnlock = false; - break; + List
logicList = sectionPath.getLogicList(); + if (!CollectionUtils.isEmpty(logicList)) { + for (Section section : logicList) { + if (section.isOverlapLock()) { + allUnlock = false; + break; + } + } + } else { + for (Section section : sectionPath.getSectionList()) { + if (section.isOverlapLock()) { + allUnlock = false; + break; + } } } if (allUnlock) { @@ -1118,12 +1222,23 @@ public class RouteService { break; } } - List
sectionList = path.getSectionList(); - for (Section section : sectionList) { - if (section.isLockedOn(!right)) { - // 区段锁闭在相反方向 - setting = false; - break; + List
logicList = path.getLogicList(); + if (!CollectionUtils.isEmpty(logicList)) { + for (Section section : logicList) { + if (section.isLockedOn(!right)) { + // 区段锁闭在相反方向 + setting = false; + break; + } + } + } else { + List
sectionList = path.getSectionList(); + for (Section section : sectionList) { + if (section.isLockedOn(!right)) { + // 区段锁闭在相反方向 + setting = false; + break; + } } } if (setting) { @@ -1135,8 +1250,15 @@ public class RouteService { for (SwitchElement element : settingPath.getSwitchList()) { element.getASwitch().overlapLock(); } - for (Section section : settingPath.getSectionList()) { - section.overlapLocking(right); + List
logicList = settingPath.getLogicList(); + if (!CollectionUtils.isEmpty(logicList)) { + for (Section section : logicList) { + section.overlapLocking(right); + } + } else { + for (Section section : settingPath.getSectionList()) { + section.overlapLocking(right); + } } overlap.setLock(true); } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/build/InterlockBuilder2.java b/src/main/java/club/joylink/rtss/simulation/cbtc/build/InterlockBuilder2.java index 654c6a6e9..5ded62d62 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/build/InterlockBuilder2.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/build/InterlockBuilder2.java @@ -1073,6 +1073,16 @@ public class InterlockBuilder2 { sectionList.add(section); } } + // 逻辑区段 + List
logicList = new ArrayList<>(); + List logicCodeList = sectionPathVO.getLogicList(); + if (!CollectionUtils.isEmpty(logicCodeList)) { + for (String code : logicCodeList) { + Section logic = ((Section) elementMap.get(code)); + Objects.requireNonNull(logic, String.format("编码为[%s]的区段不存在", code)); + logicList.add(logic); + } + } // 路径中道岔 List switchPositionList = sectionPathVO.getSwitchPositionList(); List switchElementList = new ArrayList<>(); @@ -1164,7 +1174,7 @@ public class InterlockBuilder2 { ++i; } } - return new SectionPath(sectionPathVO.isRight(), switchElementList, sectionList); + return new SectionPath(sectionPathVO.isRight(), switchElementList, sectionList, logicList); } private static void checkBetweenRouteSameDirectionSignal(Map elementMap, List errMsgList) { diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MapConfig.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MapConfig.java index 866ae18e4..a296891d8 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MapConfig.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/MapConfig.java @@ -31,6 +31,11 @@ public class MapConfig { */ private boolean lockFirst; + /** + * 进路办理不失败一直尝试办理 + */ + private boolean routeSettingNoFail; + /** * 列车停站开门后,才办理出站进路开放出站信号机 */ @@ -148,6 +153,7 @@ public class MapConfig { if (Objects.nonNull(configVO)) { setUpRight(configVO.getUpRight()); setLockFirst(configVO.getLockFirst()); + setRouteSettingNoFail(configVO.isRouteSettingNoFail()); setSignalOpenAfterParking(configVO.isSignalOpenAfterParking()); this.setStandHoldCloseLogicLight(configVO.isStandHoldCloseLogicLight()); setCtcOverlapOnlyTurnBackStationLock(configVO.isCtcOverlapOnlyTurnBackStationLock()); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Route.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Route.java index f3c14a4a9..93bee6332 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Route.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Route.java @@ -466,6 +466,17 @@ public class Route extends MapNamedElement { return Objects.equals(this.getLastRouteSection(), section); } + public RouteFls getRouteFlsOfSwitch(Switch aSwitch) { + if (!CollectionUtils.isEmpty(this.flsList)) { + for (RouteFls routeFls : flsList) { + if (Objects.equals(routeFls.getBase().getASwitch(), aSwitch)) { + return routeFls; + } + } + } + return null; + } + /** * 进路检查失败原因 */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/RouteFls.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/RouteFls.java index 7ca4f84b4..efa208ede 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/RouteFls.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/RouteFls.java @@ -47,6 +47,20 @@ public class RouteFls { return this.level1List != null && !this.level1List.isEmpty(); } + public void unlock() { + for (RouteFls.FlsElement flsElement : this.getLevel1List()) { + SwitchElement pSwitch = flsElement.getPSwitch(); + if (pSwitch != null) { + pSwitch.getASwitch().fpUnlock(); + } else { + SwitchElement fpae = flsElement.getFpae(); + if (fpae != null) { + fpae.getASwitch().fpUnlock(); + } + } + } + } + /** * 侧防元件 */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/SectionPath.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/SectionPath.java index c126950be..91c2ae39a 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/SectionPath.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/SectionPath.java @@ -26,32 +26,29 @@ public class SectionPath { /** 道岔位置(如果有道岔的话) */ private List switchList; - /** 侧防 */ + /** 延续保护侧防 */ private List flsList; private List
sectionList; + private List
logicList; + public SectionPath(boolean right) { this.right = right; this.switchList = new ArrayList<>(); this.sectionList = new ArrayList<>(); + this.logicList = new ArrayList<>(); } - public SectionPath(boolean right, List switchList, List
sectionList) { + public SectionPath(boolean right, List switchList, List
sectionList, List
logicList) { this.right = right; this.switchList = switchList; this.sectionList = sectionList; - } - - public SectionPath(boolean right, List switchList, List
sectionList, List flsList) { - this.right = right; - this.switchList = switchList; - this.sectionList = sectionList; - this.flsList = flsList; + this.logicList = logicList; } public SectionPath cloneNew() { - return new SectionPath(this.right, new ArrayList<>(this.switchList), new ArrayList<>(this.sectionList)); + return new SectionPath(this.right, new ArrayList<>(this.switchList), new ArrayList<>(this.sectionList), new ArrayList<>(this.logicList)); } public void addSection(Section section) { diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Signal.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Signal.java index c1afc9242..37927a28e 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Signal.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Signal.java @@ -127,6 +127,11 @@ public class Signal extends MayOutOfOrderDevice { */ private Route lockedRoute; + /** + * 信号级别:0-不可用;1-关闭;2-引导级;3-主信号级 + */ + private int level; + /** * 是否封锁 */ @@ -232,16 +237,25 @@ public class Signal extends MayOutOfOrderDevice { .collect(Collectors.toMap ((switchElement -> switchElement.getASwitch().getCode()), Function.identity())); - for (Section approach : path.getSectionList()) { - if (approach.isSamePhysical(sectionCode)) { - return true; - } else if (approach.isSwitchTrack()) { - Switch relSwitch = approach.getRelSwitch(); - SwitchElement element = elementMap.get(relSwitch.getCode()); - if (relSwitch.isOnPosition(element.isNormal())) { - continue; - } else { - break; + List
logicList = path.getLogicList(); + if (!CollectionUtils.isEmpty(logicList)) { + for (Section logic : logicList) { + if (logic.isSamePhysical(sectionCode)) { + return true; + } + } + } else { + for (Section approach : path.getSectionList()) { + if (approach.isSamePhysical(sectionCode)) { + return true; + } else if (approach.isSwitchTrack()) { + Switch relSwitch = approach.getRelSwitch(); + SwitchElement element = elementMap.get(relSwitch.getCode()); + if (relSwitch.isOnPosition(element.isNormal())) { + continue; + } else { + break; + } } } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Switch.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Switch.java index 6a90e1ee6..81164aa92 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Switch.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Switch.java @@ -64,6 +64,11 @@ public class Switch extends MayOutOfOrderDevice { */ private boolean routeLock; + /** + * 是否进路侧防锁闭 + */ + private boolean fpLock; + /** * 是否进路延续保护锁闭 */ @@ -120,7 +125,7 @@ public class Switch extends MayOutOfOrderDevice { * @return */ public boolean isLocked() { - return this.singleLock || this.routeLock || this.overlapLock; + return this.singleLock || this.routeLock || this.overlapLock || this.isFpLock(); } /** @@ -229,6 +234,14 @@ public class Switch extends MayOutOfOrderDevice { this.overlapLock = false; } + public void fpLock() { + this.fpLock = true; + } + + public void fpUnlock() { + this.fpLock = false; + } + public void overlapLock() { this.overlapLock = true; } diff --git a/src/main/java/club/joylink/rtss/vo/client/map/RealLineConfigVO.java b/src/main/java/club/joylink/rtss/vo/client/map/RealLineConfigVO.java index 8e9a68d11..e158d6713 100644 --- a/src/main/java/club/joylink/rtss/vo/client/map/RealLineConfigVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/map/RealLineConfigVO.java @@ -21,6 +21,11 @@ public class RealLineConfigVO { @ApiModelProperty(value = "进路办理是否先锁闭——开始办理直接先锁闭区段(如福州一号线)") private Boolean lockFirst = false; + /** + * 进路办理不失败 + */ + private boolean routeSettingNoFail = false; + @ApiModelProperty(value = "是否列车停站开门后,才办理出站进路开放出站信号机") private boolean signalOpenAfterParking = false; diff --git a/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapRouteFlankProtectionNewVO.java b/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapRouteFlankProtectionNewVO.java index dc9b56c74..a72bc79bc 100644 --- a/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapRouteFlankProtectionNewVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapRouteFlankProtectionNewVO.java @@ -118,10 +118,12 @@ public class MapRouteFlankProtectionNewVO { @ApiModelProperty(value = "侧防区域元件") private MapCISwitchVO areaSwitch; - public static List convertBO2VOList(List level1List) { + public static List convertBO2VOList(List flsElementList) { List list = new ArrayList<>(); - for (RouteFls.FlsElement flsElement : level1List) { - list.add(fromBO(flsElement)); + if (!CollectionUtils.isEmpty(flsElementList)) { + for (RouteFls.FlsElement flsElement : flsElementList) { + list.add(fromBO(flsElement)); + } } return list; } diff --git a/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapSectionPathVO.java b/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapSectionPathVO.java index fcf363286..a48a21f8f 100644 --- a/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapSectionPathVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapSectionPathVO.java @@ -25,6 +25,8 @@ public class MapSectionPathVO { private List flsList; + private List logicList; + public MapSectionPathVO(boolean right, List sectionList, List switchPositionList) { this.right = right; this.sectionList = sectionList; @@ -52,6 +54,10 @@ public class MapSectionPathVO { if (!CollectionUtils.isEmpty(sectionPath.getFlsList())) { vo.setFlsList(sectionPath.getFlsList().stream().map(RouteFls::getCode).collect(Collectors.toList())); } + List
logicList = sectionPath.getLogicList(); + if (!CollectionUtils.isEmpty(logicList)) { + vo.setLogicList(logicList.stream().map(Section::getCode).collect(Collectors.toList())); + } return vo; } }