Merge branch 'test'

This commit is contained in:
weizhihong 2023-06-01 18:18:27 +08:00
commit 8f9316c3c9
8 changed files with 75 additions and 79 deletions

View File

@ -46,7 +46,9 @@ public class AtpSectionService {
}
}
if (1 == a) { // 只有通信车接近
signal.changeToCbtcMode();
if(!signal.getSignalModel().getGuideAspect().equals(signal.getAspect())) {
signal.changeToCbtcMode();
}
} else if (2 == a) { // 有非通信车接近
signal.changeToBackupMode();
}

View File

@ -434,10 +434,10 @@ public class CiApiServiceImpl2 implements CiApiService {
// if (config.isSomeCommandNeedInit()) {
// BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signal.isInit(), signal.debugStr() + "未初始化");
// }
if (!simulation.getRepository().getConfig().isRailway()) {
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signal.isDefaultAspect(),
String.format("信号机[%s]需处于关闭状态", signal.getCode()));
}
// if (!simulation.getRepository().getConfig().isRailway()) {
// BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signal.isDefaultAspect(),
// String.format("信号机[%s]需处于关闭状态", signal.getCode()));
// }
if (config.isNeedApproachLockBeforeSetGuide()) {
boolean signalApproachOccupied = signal.getApproachPathList()
.stream().anyMatch(sectionPath -> sectionPath.getSectionList().stream().anyMatch(Section::isOccupied));
@ -484,11 +484,14 @@ public class CiApiServiceImpl2 implements CiApiService {
}
}
}
if (repository.getConfig().isRailway() && signal.isHigherThanGuideLevel()) {
Route lockedRoute = signal.getLockedRoute();
if (lockedRoute != null && lockedRoute.getFirstLogicSection().isOccupied()) {
signal.guideDelayStart();
}
if (signal.getGuideRemain() > 0) {
// Route lockedRoute = signal.getLockedRoute();
// if (lockedRoute != null && lockedRoute.getFirstLogicSection().isOccupied() && signal.isGuideAspect()) {
// signal.guideDelayStart();
// }
signal.setGuideRemain(0);
} else {
signal.guideDelayStart();
}
}

View File

@ -15,6 +15,7 @@ import club.joylink.rtss.simulation.cbtc.data.map.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Objects;
@ -194,9 +195,13 @@ public class CiLogic {
if (route.isLock()) {
// 进路首区段列车占用进路开始解锁
Section firstLogicSection = route.getFirstLogicSection();
SimulationDataRepository repository = simulation.getRepository();
if (repository.isTrainHeadOccupy(firstLogicSection)) {
trainUnlockStart(simulation, route);
if(route.getStart().isGuideAspect() && firstLogicSection.getAxleCounterSection().isFaultOccupied()) {
log.debug(String.format("进路【%s(%s)】引导占用中,列车通过后请人工解锁", route.getName(), route.getCode()));
} else{
SimulationDataRepository repository = simulation.getRepository();
if (repository.isTrainHeadOccupy(firstLogicSection)) {
trainUnlockStart(simulation, route);
}
}
}
Signal start = route.getStart();

View File

@ -89,9 +89,9 @@ public class CiRouteService {
break;
section = section.getParent();
}
if (Section.AxleFault.FAULT.equals(section.getFault())) {
return new Route.CheckFailMessage(Route.CheckFailReason.SectionFaultOccupied, section);
}
// if (Section.AxleFault.FAULT.equals(section.getFault())) {
// return new Route.CheckFailMessage(Route.CheckFailReason.SectionFaultOccupied, section);
// }
}
//敌对进路
List<Route> conflictingRouteList = route.getConflictingRouteList();
@ -102,10 +102,10 @@ public class CiRouteService {
}
if (start.isCbtcMode()) {
// CBTC办理检查
Section firstLogicSection = route.getFirstLogicSection();
if (firstLogicSection.isOccupied()) {
return new Route.CheckFailMessage(Route.CheckFailReason.SectionNotFree, firstLogicSection);
}
// Section firstLogicSection = route.getFirstLogicSection();
// if (firstLogicSection.isOccupied()) {
// return new Route.CheckFailMessage(Route.CheckFailReason.SectionNotFree, firstLogicSection);
// }
} else {
// 后备办理检查
// 区段占用

View File

@ -16,37 +16,56 @@ public class CiSignalControlService {
@Autowired
private VirtualRealityDeviceService virtualRealityDeviceService;
/**
* 是否可以开放指定逻辑信号
* @param signal
* @param aspect
* @return
*/
private boolean couldOpenLogicAspect(Signal signal, SignalAspect aspect) {
if(signal.getSignalModel().getGuideAspect().equals(aspect)) {
return false;
}
if (signal.getSignalModel().getDefaultAspect().equals(aspect)) {
return true;
}
// else if (aspect.equals(signal.getSignalModel().getGuideAspect()) && signal.isHigherThanGuideLevel()) {
// return true;
// }
else if (signal.isAtpLevel() || signal.isMainLevel()) {
return true;
}
return false;
}
/**
* 根据联锁信号级别 控制真实信号机/设置逻辑开放信号
* @param simulation
* @param signal
* @param aspect
*/
public void tryControlSignalAspectAccordingLevel(Simulation simulation, Signal signal, SignalAspect aspect) {
VirtualRealitySignal vrSignal = signal.getVirtualSignal();
boolean cbtcMode = signal.isCbtcMode();
if (cbtcMode) {//CBTC模式
if (!signal.isLogicLight()) {
return;
}
if (vrSignal != null) {
if (vrSignal.getModel().getDefaultAspect().equals(aspect)) {
signal.setAspect(aspect);
} else if (aspect.equals(vrSignal.getModel().getGuideAspect()) && (signal.isGuideLevel() || signal.isAtpLevel() || signal.isMainLevel())) {
signal.setAspect(aspect);
} else if (signal.isAtpLevel() || signal.isMainLevel()) {
signal.setAspect(aspect);
}
} else {
if(vrSignal == null) {
if(this.couldOpenLogicAspect(signal, aspect)) {
signal.setAspect(aspect);
}
} else { // 后备模式
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(vrSignal);
if (signal.isLogicLight()) {
return;
} else {
if(signal.isCbtcMode() && aspect.equals(vrSignal.getModel().getGuideAspect())) {
signal.changeToBackupMode();
}
if (vrSignal.getModel().getDefaultAspect().equals(aspect)) {
this.virtualRealityDeviceService.control(simulation, vrSignal, aspect);
} else if (aspect.equals(vrSignal.getModel().getGuideAspect())) {
if (signal.isGuideLevel() || signal.isAtpLevel() || signal.isMainLevel()) {
this.virtualRealityDeviceService.control(simulation, vrSignal, aspect);
if(signal.isCbtcMode()) { // CTC模式
if (vrSignal.getAspect().equals(SignalAspect.No)) {
if(this.couldOpenLogicAspect(signal, aspect)) {
signal.setAspect(aspect);
}
} else {
this.virtualRealityDeviceService.control(simulation, vrSignal, SignalAspect.No);
}
} else {
if (signal.isMainLevel()) {
} else { // 后背模式开放室外信号
if(signal.getSignalModel().getDefaultAspect().equals(aspect) ||
(signal.getSignalModel().getGuideAspect().equals(aspect) && signal.isHigherThanGuideLevel()) ||
(signal.isAtpLevel() || signal.isMainLevel())) {
this.virtualRealityDeviceService.control(simulation, vrSignal, aspect);
}
}

View File

@ -115,8 +115,6 @@ public class MapDeviceBuilder {
MapDeviceBuilder.buildCatenary(graphData, elementMap, errMsgList, mapDataBuildResult.getCatenaryMap());
//应答器
MapDeviceBuilder.buildResponderDataRef(graphData, elementMap, errMsgList, mapDataBuildResult.getSectionRespondersMap());
// 设置信号机引导关键道岔信息
initSignalGuideKeySwitch(graphData, elementMap, errMsgList);
if (mapDataBuildResult.getErrMsgList().isEmpty()) {
Map<String, Set<Section>> sectionArriveMap = MapDeviceBuilder.buildNormalStandTrackAdjoinSections(mapDataBuildResult.getDeviceMap());
mapDataBuildResult.setSectionArriveNearMap(sectionArriveMap);
@ -1572,25 +1570,4 @@ public class MapDeviceBuilder {
return Objects.equals(type, BusinessConsts.Section.SectionType.Type05);
}
/**
* 初始化信号机的引导关键道岔设置作用于引导信号的开放
* @param graphData 地图信息
* @param elementMap 设备信息
* @param errMsgList 错误提示信息
*/
private static void initSignalGuideKeySwitch(MapGraphDataNewVO graphData, Map<String, MapElement> elementMap, List<String> errMsgList) {
graphData.getSignalList().stream().filter(s -> !CollectionUtils.isEmpty(s.getGuideKeySwitchList())).forEach(s -> {
List<SwitchElement> switchElementList = new ArrayList<>(s.getGuideKeySwitchList().size());
for (MapCISwitchVO ciSwitchVO : s.getGuideKeySwitchList()) {
Switch aSwitch = (Switch) elementMap.get(ciSwitchVO.getSwitchCode());
if (Objects.isNull(aSwitch)) {
errMsgList.add(String.format("编码为[%s]的道岔不存在", ciSwitchVO.getSwitchCode()));
} else {
switchElementList.add(new SwitchElement(aSwitch, ciSwitchVO.isNormal()));
}
}
Signal signal = (Signal) elementMap.get(s.getCode());
signal.setGuideKeySwitchList(switchElementList);
});
}
}

View File

@ -159,11 +159,6 @@ public class Signal extends DelayUnlockDevice {
*/
private List<Signal> replaceSignals;
/**
* 信号机引导关键道岔列表
*/
private List<SwitchElement> guideKeySwitchList;
// ------------------状态属性---------------------
private int mode;

View File

@ -203,11 +203,6 @@ public class MapSignalNewVO {
*/
private String srCode;
/**
* 引导关键道岔列表
*/
private List<MapCISwitchVO> guideKeySwitchList;
@JsonIgnore
public boolean isShunting() {
return Signal.SignalType.SHUNTING.equals(this.type);