Revert "Revert "增加大铁发车进路信号受离去区段占用影响逻辑与数据""

This reverts commit 4654dc4b71.
This commit is contained in:
joylink_zhangsai 2022-08-09 17:10:00 +08:00
parent b892606e76
commit f0ca9e9c77
7 changed files with 106 additions and 21 deletions

View File

@ -571,10 +571,36 @@ public class DraftMapRouteServiceImpl implements DraftMapRouteService {
route.setSwitchList(switches);
if (startSignal.getSection().isStandTrack()) { //发车进路
route.setAspect(SignalAspect.G);
route.setType(Route.Type.DEPARTURE);
if (endSignal.isDepartureSignal()) { //正向发车进路
Section leaveSection = endSignal.getSection();
LinkedHashMap<Section, SignalAspect> leaveSectionWithAspectMap = new LinkedHashMap<>();
for (int i = 0; i < 3; i++) {
if (!Objects.equals(leaveSection.getDeviceStation(), startSignal.getDeviceStation())) {
break;
}
switch (i) { //不同联锁显示可能不同后续根据实际情况再处理
case 0:
leaveSectionWithAspectMap.put(leaveSection, startSignal.getDefaultAspect());
break;
case 1:
leaveSectionWithAspectMap.put(leaveSection, SignalAspect.Y);
break;
case 2:
leaveSectionWithAspectMap.put(leaveSection, SignalAspect.GY);
break;
}
leaveSection = leaveSection.findNextRunningSectionBaseRealSwitch(startSignal.isRight());
if (leaveSection == null)
break;
}
route.setLeaveSectionWithAspectMap(leaveSectionWithAspectMap);
}
} else { //接车进路
SignalAspect aspect;
aspect = route.hasReverseSwitch() ? SignalAspect.YY : SignalAspect.Y;
route.setAspect(aspect);
route.setType(Route.Type.RECEIVING);
}
String startEndSignalCode = route.getStart().getCode() + route.getDestination().getCode();
Route otherRoute = routeMap.get(startEndSignalCode); //同始终端信号机进路

View File

@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Objects;
@Slf4j
@Component
@ -154,18 +155,30 @@ public class CiLogic {
start.setGuideRemain(guideRemain);
}
}
if (route.isLock()) {
if (route.isLock() && !route.isSetting()) {
ciService.interlockCheck(simulation, route);
if (route.isOpenMain() && !start.isSupportMainAspect()) {//与联锁显示不同关闭信号
CiLogic.log.info("进路[{}]联锁条件不满足,关闭信号", route.debugStr());
signalControlService.tryControlSignalAspectAccordingLevel(simulation,
start, start.getDefaultAspect());
if (config.isRailway()) //大铁线路暂时限制自动重开信号
start.setForbidden(true);
} else if (start.isDefaultAspect() && !start.isForbidden() && !start.isBlockade() && start.isSupportMainAspect()) {
CiLogic.log.info("进路[{}]联锁条件满足,开放信号", route.debugStr());
signalControlService.tryControlSignalAspectAccordingLevel(simulation,
start, route.getAspect());
if (!config.isRailway()) {
if (route.isOpenMain() && !start.isSupportMainAspect()) {//与联锁显示不同关闭信号
CiLogic.log.info("进路[{}]联锁条件不满足,关闭信号", route.debugStr());
signalControlService.tryControlSignalAspectAccordingLevel(simulation,
start, start.getDefaultAspect());
} else if (start.isDefaultAspect() && !start.isForbidden() && !start.isBlockade() && start.isSupportMainAspect()) {
CiLogic.log.info("进路[{}]联锁条件满足,开放信号", route.debugStr());
signalControlService.tryControlSignalAspectAccordingLevel(simulation,
start, route.getAspect());
}
} else {
if (route.isOpenMain() && !start.isSupportMainAspect()) {//与联锁显示不同关闭信号
CiLogic.log.info("进路[{}]联锁条件不满足,关闭信号", route.debugStr());
signalControlService.tryControlSignalAspectAccordingLevel(simulation,
start, start.getDefaultAspect());
start.setForcePhysical(true); //大铁线路暂时限制自动重开信号
} else if (!start.isForbidden() && !start.isBlockade() && start.isSupportMainAspect()) {
SignalAspect aspect = route.getAspectOfRailway();
if (!Objects.equals(route.getStart().getAspect(), aspect)) {
signalControlService.tryControlSignalAspectAccordingLevel(simulation, start, aspect);
}
}
}
}
// 进路延续保护办理判断

View File

@ -2,6 +2,7 @@ package club.joylink.rtss.simulation.cbtc.CI.device;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.constant.SignalAspect;
import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
import club.joylink.rtss.simulation.cbtc.constant.SimulationModule;
import club.joylink.rtss.simulation.cbtc.constant.SwitchIndication;
@ -256,13 +257,25 @@ public class CiRouteService {
this.flsSetting(simulation, route.getFlsList());
// 检查信号开放条件,开信号
this.ciService.interlockCheck(simulation, route);
if (!route.getStart().isBlockade()) {
this.signalControlService.tryControlSignalAspectAccordingLevel(simulation, route.getStart(), route.getAspect());
}
SignalAspect aspect = null;
boolean routeRight = route.isRight();
if (route.isGuideSetting()) {
this.signalControlService.tryControlSignalAspectAccordingLevel(simulation, route.getStart(), route.getStart().getGuideAspect());
aspect = route.getStart().getGuideAspect();
} else if (route.getStart().isBlockade()) {
aspect = route.getStart().getDefaultAspect();
} else {
aspect = route.getAspect();
if (config.isRailway() && route.isDepartureRoute()) {
aspect = route.getAspectOfRailway();
}
}
if ((route.getAspect().equals(route.getStart().getAspect())) ||
this.signalControlService.tryControlSignalAspectAccordingLevel(simulation, route.getStart(), aspect);
if (config.isRailway()) {
if (route.isGuideSetting() && route.getStart().isGuideAspect()
|| !route.getStart().isDefaultAspect()) {
route.settingOver();
}
} else if ((route.getAspect().equals(route.getStart().getAspect())) ||
(route.isGuideSetting() && route.getStart().isGuideAspect())) {
log.debug("进路[{}]信号开放,办理结束", route.debugStr());
route.settingOver();

View File

@ -325,6 +325,11 @@ public class InterlockBuilder2 {
List<RouteFls> flsList = flsListVO.stream().map(flsMap::get).collect(Collectors.toList());
route.setFlsList(flsList);
}
if (!CollectionUtils.isEmpty(routeVO.getLeaveSectionWithAspectMap())) {
LinkedHashMap<Section, SignalAspect> map = routeVO.getLeaveSectionWithAspectMap().entrySet().stream()
.collect(Collectors.toMap(entry -> (Section) elementMap.get(entry.getKey()), Map.Entry::getValue, (v1, v2) -> v2, LinkedHashMap::new));
route.setLeaveSectionWithAspectMap(map);
}
}
Signal start = (Signal) elementMap.get(routeVO.getStartSignalCode());
Signal destination = null;

View File

@ -149,6 +149,11 @@ public class Route extends MapNamedElement {
*/
private Type type;
/**
* 当离去区段占用时的信号显示
*/
private LinkedHashMap<Section, SignalAspect> leaveSectionWithAspectMap;
// ------------------状态属性---------------------
/**
* ats自动控制
@ -772,6 +777,24 @@ public class Route extends MapNamedElement {
return Type.RECEIVING.equals(type) || Type.DEPARTURE.equals(type);
}
public boolean isDepartureRoute() {
return Type.DEPARTURE.equals(type);
}
/**
* 获取大铁进路的信号显示
*/
public SignalAspect getAspectOfRailway() {
if (!CollectionUtils.isEmpty(leaveSectionWithAspectMap)) {
for (Map.Entry<Section, SignalAspect> entry : leaveSectionWithAspectMap.entrySet()) {
if (entry.getKey().isOccupied()) {
return entry.getValue();
}
}
}
return getAspect();
}
public enum Type {
RECEIVING, //接车进路
DEPARTURE, //发车进路

View File

@ -257,8 +257,8 @@ public class SimulationRobotService {
SectionPosition signalPosition = signal.getPosition();
if (vrSignal != null
&& (i != 0 || signalPosition.isAheadOf(headPosition, right))) { //有实体信号机且列车未越过信号机
if (Objects.equals(vrSignal.getAspect(), vrSignal.getModel().getDefaultAspect()) //禁止信号
|| Objects.equals(vrSignal.getAspect(), vrSignal.getModel().getGuideAspect())) { //引导信号
if (Objects.equals(vrSignal.getAspect(), signal.getDefaultAspect()) //禁止信号
|| Objects.equals(vrSignal.getAspect(), signal.getGuideAspect())) { //引导信号
if (!Objects.equals(signal, throughSignal) || !Objects.equals(vrSignal.getAspect(), throughAspect)) {
targetPosition = CalculateService
.calculateNextPositionByStartAndLen(signalPosition, !right, 2, true);

View File

@ -15,9 +15,7 @@ import org.springframework.util.CollectionUtils;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
@Getter
@ -210,6 +208,8 @@ public class MapRouteNewVO {
*/
private Route.Type type;
private LinkedHashMap<String, SignalAspect> leaveSectionWithAspectMap;
public MapRouteNewVO() {
this.routeSectionList = new ArrayList<>();
this.routeSwitchList = new ArrayList<>();
@ -261,6 +261,11 @@ public class MapRouteNewVO {
vo.setEspList(route.getEspList().stream().map(ESP::getCode).collect(Collectors.toList()));
vo.setConflictRouteList(route.getConflictingRouteList().stream().map(Route::getCode).collect(Collectors.toList()));
vo.setType(route.getType());
if (!CollectionUtils.isEmpty(route.getLeaveSectionWithAspectMap())) {
LinkedHashMap<String, SignalAspect> map = route.getLeaveSectionWithAspectMap().entrySet().stream()
.collect(Collectors.toMap(entry -> entry.getKey().getCode(), Map.Entry::getValue, (v1, v2) -> v2, LinkedHashMap::new));
vo.setLeaveSectionWithAspectMap(map);
}
return vo;
}