Merge remote-tracking branch 'origin/test' into dev
# Conflicts: # src/main/java/club/joylink/rtss/simulation/cbtc/CI/device/CiStandService.java
This commit is contained in:
commit
8f47be4fe1
@ -1,6 +1,5 @@
|
|||||||
package club.joylink.rtss.simulation.cbtc.ATP.ground;
|
package club.joylink.rtss.simulation.cbtc.ATP.ground;
|
||||||
|
|
||||||
import club.joylink.rtss.simulation.cbtc.CI.device.CiSignalControlService;
|
|
||||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
|
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||||
@ -10,7 +9,6 @@ import club.joylink.rtss.simulation.cbtc.data.map.Signal;
|
|||||||
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
@ -27,9 +25,6 @@ import java.util.stream.Collectors;
|
|||||||
@Component
|
@Component
|
||||||
public class AtpSectionService {
|
public class AtpSectionService {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private CiSignalControlService signalControlService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 收集列车接近信号机消息并发送给CI
|
* 收集列车接近信号机消息并发送给CI
|
||||||
*/
|
*/
|
||||||
@ -51,10 +46,8 @@ public class AtpSectionService {
|
|||||||
}
|
}
|
||||||
if (1 == a) { // 只有通信车接近
|
if (1 == a) { // 只有通信车接近
|
||||||
signal.changeToCbtcMode();
|
signal.changeToCbtcMode();
|
||||||
this.signalControlService.controlLightOfSignal(simulation, signal);
|
|
||||||
} else if (2 == a) { // 有非通信车接近
|
} else if (2 == a) { // 有非通信车接近
|
||||||
signal.changeToBackupMode();
|
signal.changeToBackupMode();
|
||||||
this.signalControlService.controlLightOfSignal(simulation, signal);
|
|
||||||
}
|
}
|
||||||
signal.updateApproachLock();//更新信号机接近锁闭状态
|
signal.updateApproachLock();//更新信号机接近锁闭状态
|
||||||
});
|
});
|
||||||
|
@ -370,18 +370,10 @@ public class AtsStationService {
|
|||||||
List<Signal> signalList = simulation.getRepository().getSignalList().stream()
|
List<Signal> signalList = simulation.getRepository().getSignalList().stream()
|
||||||
.filter(signal -> station.equals(signal.getInterlockStation())).collect(Collectors.toList());
|
.filter(signal -> station.equals(signal.getInterlockStation())).collect(Collectors.toList());
|
||||||
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(signalList, station.debugStr() + "下无信号机");
|
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(signalList, station.debugStr() + "下无信号机");
|
||||||
// todo 信号显示变为aspect一个字段,此处逻辑不再适用
|
if (signalList.get(0).isForcePhysical()) {
|
||||||
if (!signalList.get(0).isForcePhysical()) {
|
|
||||||
// signalList.forEach(signal -> {
|
|
||||||
// VirtualRealitySignal virtualSignal = signal.getVirtualSignal();
|
|
||||||
// if (virtualSignal != null) {
|
|
||||||
// virtualSignal.apply(signal.isGreenOpen(), signal.isYellowOpen(), signal.isRedOpen());
|
|
||||||
// }
|
|
||||||
// signal.changeLightType(false);
|
|
||||||
// signal.setForcePhysical(true);
|
|
||||||
// });
|
|
||||||
} else {
|
|
||||||
signalList.forEach(signal -> signal.setForcePhysical(false));
|
signalList.forEach(signal -> signal.setForcePhysical(false));
|
||||||
|
} else {
|
||||||
|
signalList.forEach(signal -> signal.setForcePhysical(true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ public class CiApiServiceImpl2 implements CiApiService {
|
|||||||
"进路未锁闭,不能重开信号机");
|
"进路未锁闭,不能重开信号机");
|
||||||
}
|
}
|
||||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(!lockedRoute.isDelayUnlocking(), "进路延时解锁中,不能重开");
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(!lockedRoute.isDelayUnlocking(), "进路延时解锁中,不能重开");
|
||||||
this.routeService.routeReopen(simulation, lockedRoute);
|
signal.setForbidden(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -405,7 +405,7 @@ public class CiApiServiceImpl2 implements CiApiService {
|
|||||||
// if (config.isSomeCommandNeedInit()) {
|
// if (config.isSomeCommandNeedInit()) {
|
||||||
// BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signal.isInit(), signal.debugStr() + "未初始化");
|
// BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signal.isInit(), signal.debugStr() + "未初始化");
|
||||||
// }
|
// }
|
||||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signal.isForbidAspect(),
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signal.isDefaultAspect(),
|
||||||
String.format("信号机[%s]需处于关闭状态", signal.getCode()));
|
String.format("信号机[%s]需处于关闭状态", signal.getCode()));
|
||||||
boolean signalApproachOccupied = signal.getApproachPathList()
|
boolean signalApproachOccupied = signal.getApproachPathList()
|
||||||
.stream().anyMatch(sectionPath -> sectionPath.getSectionList().stream().anyMatch(Section::isOccupied));
|
.stream().anyMatch(sectionPath -> sectionPath.getSectionList().stream().anyMatch(Section::isOccupied));
|
||||||
@ -520,10 +520,11 @@ public class CiApiServiceImpl2 implements CiApiService {
|
|||||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(axleSection != null && axleSection.isAxleCounter(),
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(axleSection != null && axleSection.isAxleCounter(),
|
||||||
section.debugStr() + "不是计轴区段也不归属于任何计轴区段");
|
section.debugStr() + "不是计轴区段也不归属于任何计轴区段");
|
||||||
VirtualRealitySectionAxleCounter virtualAxleCounter = axleSection.getVirtualAxleCounter();
|
VirtualRealitySectionAxleCounter virtualAxleCounter = axleSection.getVirtualAxleCounter();
|
||||||
if (!virtualAxleCounter.isOccupy())
|
if (!virtualAxleCounter.isOccupy()){
|
||||||
|
VirtualRealitySectionAxleCounter.Fault.FAULT.apply(virtualAxleCounter);
|
||||||
Section.AxleFault.ARB.apply(axleSection);
|
Section.AxleFault.ARB.apply(axleSection);
|
||||||
else
|
}
|
||||||
virtualAxleCounter.preReset();
|
virtualAxleCounter.preReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -9,10 +9,7 @@ import club.joylink.rtss.simulation.cbtc.constant.SignalAspect;
|
|||||||
import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
|
import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
|
||||||
import club.joylink.rtss.simulation.cbtc.constant.SimulationModule;
|
import club.joylink.rtss.simulation.cbtc.constant.SimulationModule;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.MapConfig;
|
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Route;
|
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.RouteOverlap;
|
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@ -35,8 +32,12 @@ public class CiLogic {
|
|||||||
public void run(Simulation simulation) {
|
public void run(Simulation simulation) {
|
||||||
// 采集真实设备状态
|
// 采集真实设备状态
|
||||||
this.deviceStatusCollector.collect(simulation);
|
this.deviceStatusCollector.collect(simulation);
|
||||||
// 联锁监控逻辑
|
// 信号机监控控制
|
||||||
SimulationDataRepository repository = simulation.getRepository();
|
SimulationDataRepository repository = simulation.getRepository();
|
||||||
|
for (Signal signal : repository.getSignalList()) {
|
||||||
|
this.signalMonitor(simulation, signal);
|
||||||
|
}
|
||||||
|
// 联锁监控逻辑
|
||||||
List<Route> routeList = repository.getRouteList();
|
List<Route> routeList = repository.getRouteList();
|
||||||
for (Route route : routeList) {
|
for (Route route : routeList) {
|
||||||
this.interlockMonitor(simulation, route);
|
this.interlockMonitor(simulation, route);
|
||||||
@ -47,6 +48,10 @@ public class CiLogic {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void signalMonitor(Simulation simulation, Signal signal) {
|
||||||
|
this.signalControlService.controlLightOfSignal(simulation, signal);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 进路监控
|
* 进路监控
|
||||||
* @param simulation
|
* @param simulation
|
||||||
@ -72,7 +77,7 @@ public class CiLogic {
|
|||||||
if (route.isNormalUnlock()) {
|
if (route.isNormalUnlock()) {
|
||||||
this.routeService.trainUnlockRoute(simulation, route);
|
this.routeService.trainUnlockRoute(simulation, route);
|
||||||
}
|
}
|
||||||
if (route.isOpenMain() || route.isOpenGuide()) {
|
if (route.isLock()) {
|
||||||
// 进路首区段列车占用,进路开始解锁
|
// 进路首区段列车占用,进路开始解锁
|
||||||
Section firstLogicSection = route.getFirstLogicSection();
|
Section firstLogicSection = route.getFirstLogicSection();
|
||||||
SimulationDataRepository repository = simulation.getRepository();
|
SimulationDataRepository repository = simulation.getRepository();
|
||||||
@ -80,13 +85,17 @@ public class CiLogic {
|
|||||||
this.trainUnlockStart(simulation, route);
|
this.trainUnlockStart(simulation, route);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (route.isOpenMain()) { // 主信号开放
|
if (route.isLock()) {
|
||||||
this.ciService.interlockCheck(simulation, route);
|
this.ciService.interlockCheck(simulation, route);
|
||||||
SignalAspect aspect = this.ciService.getRouteCurrentMaxAspect(route);
|
Signal start = route.getStart();
|
||||||
if (!aspect.equals(route.getStart().getAspect())) {//与联锁显示不同,关闭信号
|
if (route.isOpenMain() && !start.isSupportMainAspect()) {//与联锁显示不同,关闭信号
|
||||||
log.info("进路[{}]联锁条件不满足,关闭信号", route.debugStr());
|
log.info("进路[{}]联锁条件不满足,关闭信号", route.debugStr());
|
||||||
this.signalControlService.tryControlSignalAspectAccordingLevel(simulation,
|
this.signalControlService.tryControlSignalAspectAccordingLevel(simulation,
|
||||||
route.getStart(), route.getStart().getSignalModel().getDefaultAspect());
|
start, start.getDefaultAspect());
|
||||||
|
} else if (start.isDefaultAspect() && !start.isForbidden() && !start.isBlockade() && start.isSupportMainAspect()) {
|
||||||
|
log.info("进路[{}]联锁条件满足,开放信号", route.debugStr());
|
||||||
|
this.signalControlService.tryControlSignalAspectAccordingLevel(simulation,
|
||||||
|
start, route.getAspect());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 进路延续保护办理判断
|
// 进路延续保护办理判断
|
||||||
@ -100,7 +109,7 @@ public class CiLogic {
|
|||||||
route.startNormalUnlock();
|
route.startNormalUnlock();
|
||||||
log.info("进路[{}]因列车进入,关闭信号", route.debugStr());
|
log.info("进路[{}]因列车进入,关闭信号", route.debugStr());
|
||||||
this.signalControlService.tryControlSignalAspectAccordingLevel(simulation,
|
this.signalControlService.tryControlSignalAspectAccordingLevel(simulation,
|
||||||
route.getStart(), route.getStart().getSignalModel().getDefaultAspect());
|
route.getStart(), route.getStart().getDefaultAspect());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,6 +21,7 @@ import java.util.List;
|
|||||||
public class CiDeviceStatusCollector {
|
public class CiDeviceStatusCollector {
|
||||||
@Autowired
|
@Autowired
|
||||||
private GroundAtpApiService groundAtpApiService;
|
private GroundAtpApiService groundAtpApiService;
|
||||||
|
|
||||||
public void collect(Simulation simulation) {
|
public void collect(Simulation simulation) {
|
||||||
SimulationDataRepository repository = simulation.getRepository();
|
SimulationDataRepository repository = simulation.getRepository();
|
||||||
this.collectSection(repository, repository.getSectionList());
|
this.collectSection(repository, repository.getSectionList());
|
||||||
|
@ -207,7 +207,6 @@ public class CiRouteService {
|
|||||||
if (simulation.getSystemTime().isAfter(route.getSettingStartTime().plusSeconds(SimulationConstants.ROUTE_SETTING_TIMEOUT))) {
|
if (simulation.getSystemTime().isAfter(route.getSettingStartTime().plusSeconds(SimulationConstants.ROUTE_SETTING_TIMEOUT))) {
|
||||||
log.info("进路[{}]办理超时,取消办理2", route.debugStr());
|
log.info("进路[{}]办理超时,取消办理2", route.debugStr());
|
||||||
route.settingOver();
|
route.settingOver();
|
||||||
route.setLock(false);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -223,14 +222,13 @@ public class CiRouteService {
|
|||||||
// 检查信号开放条件,开信号
|
// 检查信号开放条件,开信号
|
||||||
this.ciService.interlockCheck(simulation, route);
|
this.ciService.interlockCheck(simulation, route);
|
||||||
if (!route.getStart().isBlockade()) {
|
if (!route.getStart().isBlockade()) {
|
||||||
if (route.isGuideSetting()) {
|
this.signalControlService.tryControlSignalAspectAccordingLevel(simulation, route.getStart(), route.getAspect());
|
||||||
this.signalControlService.tryControlSignalAspectAccordingLevel(simulation, route.getStart(), route.getStart().getSignalModel().getGuideAspect());
|
}
|
||||||
} else {
|
if (route.isGuideSetting()) {
|
||||||
this.signalControlService.tryControlSignalAspectAccordingLevel(simulation, route.getStart(), route.getAspect());
|
this.signalControlService.tryControlSignalAspectAccordingLevel(simulation, route.getStart(), route.getStart().getGuideAspect());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ((route.getAspect().equals(route.getStart().getAspect())) ||
|
if ((route.getAspect().equals(route.getStart().getAspect())) ||
|
||||||
(route.isGuideSetting() && route.getStart().getAspect().equals(route.getStart().getSignalModel().getGuideAspect()))) {
|
(route.isGuideSetting() && route.getStart().isGuideAspect())) {
|
||||||
log.debug("进路[{}]信号开放,办理结束", route.debugStr());
|
log.debug("进路[{}]信号开放,办理结束", route.debugStr());
|
||||||
route.settingOver();
|
route.settingOver();
|
||||||
}
|
}
|
||||||
@ -289,7 +287,7 @@ public class CiRouteService {
|
|||||||
this.cancelFleet(route);
|
this.cancelFleet(route);
|
||||||
// 关闭始端信号机
|
// 关闭始端信号机
|
||||||
this.signalControlService.tryControlSignalAspectAccordingLevel(simulation,
|
this.signalControlService.tryControlSignalAspectAccordingLevel(simulation,
|
||||||
route.getStart(), route.getStart().getSignalModel().getDefaultAspect());
|
route.getStart(), route.getStart().getDefaultAspect());
|
||||||
log.debug(String.format("取消进路,信号机[%s(%s)]关灯",
|
log.debug(String.format("取消进路,信号机[%s(%s)]关灯",
|
||||||
route.getStart().getName(), route.getStart().getCode()));
|
route.getStart().getName(), route.getStart().getCode()));
|
||||||
//进路解锁
|
//进路解锁
|
||||||
@ -330,7 +328,7 @@ public class CiRouteService {
|
|||||||
public void delayUnlockStart(Simulation simulation, Route route, DelayUnlockDevice device) {
|
public void delayUnlockStart(Simulation simulation, Route route, DelayUnlockDevice device) {
|
||||||
device.delayUnlockStart(route);
|
device.delayUnlockStart(route);
|
||||||
route.setDelayUnlockDevice(device);
|
route.setDelayUnlockDevice(device);
|
||||||
this.signalControlService.tryControlSignalAspectAccordingLevel(simulation, route.getStart(), route.getStart().getSignalModel().getDefaultAspect());
|
this.signalControlService.tryControlSignalAspectAccordingLevel(simulation, route.getStart(), route.getStart().getDefaultAspect());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -400,7 +398,7 @@ public class CiRouteService {
|
|||||||
} else {
|
} else {
|
||||||
if (route.isOpenMain() || route.isOpenGuide()) {
|
if (route.isOpenMain() || route.isOpenGuide()) {
|
||||||
this.signalControlService.tryControlSignalAspectAccordingLevel(simulation, route.getStart(),
|
this.signalControlService.tryControlSignalAspectAccordingLevel(simulation, route.getStart(),
|
||||||
route.getStart().getSignalModel().getDefaultAspect());
|
route.getStart().getDefaultAspect());
|
||||||
}
|
}
|
||||||
route.setLock(false);
|
route.setLock(false);
|
||||||
}
|
}
|
||||||
@ -601,14 +599,6 @@ public class CiRouteService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void routeReopen(Simulation simulation, Route route) {
|
|
||||||
// 检查信号开放条件,开信号
|
|
||||||
this.ciService.interlockCheck(simulation, route);
|
|
||||||
if (!route.getStart().isBlockade()) {
|
|
||||||
this.signalControlService.tryControlSignalAspectAccordingLevel(simulation, route.getStart(), route.getAspect());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置自动进路模式
|
* 设置自动进路模式
|
||||||
*
|
*
|
||||||
|
@ -39,19 +39,6 @@ public class CiService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 进路当前最高信号显示
|
|
||||||
*
|
|
||||||
* @param route
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public SignalAspect getRouteCurrentMaxAspect(Route route) {
|
|
||||||
if (route.isNormalUnlock()) {
|
|
||||||
return route.getStart().getSignalModel().getDefaultAspect();
|
|
||||||
}
|
|
||||||
return route.getStart().getMaxAspectByLevel(route.getAspect());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 延续保护检查
|
* 延续保护检查
|
||||||
*
|
*
|
||||||
@ -116,7 +103,7 @@ public class CiService {
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
Signal pSignal = flsElement.getPSignal();
|
Signal pSignal = flsElement.getPSignal();
|
||||||
if (pSignal != null && !pSignal.getSignalModel().getDefaultAspect().equals(pSignal.getAspect())) {
|
if (pSignal != null && !pSignal.isDefaultAspect()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,9 +112,10 @@ public class CiService {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void interlockCheck(Simulation simulation, Route route) {
|
public int interlockCheck(Simulation simulation, Route route) {
|
||||||
int level = this.checkRouteLevel(simulation, route);
|
int level = this.checkRouteLevel(simulation, route);
|
||||||
route.getStart().setLevel(level);
|
route.getStart().setLevel(level);
|
||||||
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int checkRouteLevel(Simulation simulation, Route route) {
|
private int checkRouteLevel(Simulation simulation, Route route) {
|
||||||
@ -179,7 +167,7 @@ public class CiService {
|
|||||||
} else {
|
} else {
|
||||||
SwitchElement fpae = flsElement.getFpae();
|
SwitchElement fpae = flsElement.getFpae();
|
||||||
Signal pSignal = flsElement.getPSignal();
|
Signal pSignal = flsElement.getPSignal();
|
||||||
if (pSignal != null && !pSignal.getSignalModel().getDefaultAspect().equals(pSignal.getAspect())) {
|
if (pSignal != null && !pSignal.isDefaultAspect()) {
|
||||||
if (fpae != null) {
|
if (fpae != null) {
|
||||||
if (fpae.isOnPosition()) {
|
if (fpae.isOnPosition()) {
|
||||||
return level;
|
return level;
|
||||||
@ -211,10 +199,6 @@ public class CiService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (route.getStart().isCbtcMode()) {
|
|
||||||
level = Signal.LEVEL_Atp; // ATP级
|
|
||||||
}
|
|
||||||
// 站台紧急停车
|
// 站台紧急停车
|
||||||
if (!CollectionUtils.isEmpty(route.getEspList())) {
|
if (!CollectionUtils.isEmpty(route.getEspList())) {
|
||||||
for (ESP esp : route.getEspList()) {
|
for (ESP esp : route.getEspList()) {
|
||||||
@ -225,6 +209,9 @@ public class CiService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (route.getStart().isCbtcMode()) {
|
||||||
|
level = Signal.LEVEL_Atp; // ATP级
|
||||||
|
}
|
||||||
// 区段占用检查
|
// 区段占用检查
|
||||||
for (Section section : sectionList) {
|
for (Section section : sectionList) {
|
||||||
if (section.isOccupied()) {
|
if (section.isOccupied()) {
|
||||||
@ -253,12 +240,12 @@ public class CiService {
|
|||||||
if(Stand.Fault.PSD_CANNOT_BE_CLOSED.equals(psd.getStand().getFault()) && !psd.getStand().isInterlockRelease()) {
|
if(Stand.Fault.PSD_CANNOT_BE_CLOSED.equals(psd.getStand().getFault()) && !psd.getStand().isInterlockRelease()) {
|
||||||
return Signal.LEVEL_Guide;
|
return Signal.LEVEL_Guide;
|
||||||
}
|
}
|
||||||
if (!psd.isCloseAndLock() && !psd.isInterlockRelease()) {
|
// if (!psd.isCloseAndLock() && !psd.isInterlockRelease()) {
|
||||||
// log.debug("联锁网络检查:站台[{}({})]屏蔽门[{}({})]未关闭",
|
//// log.debug("联锁网络检查:站台[{}({})]屏蔽门[{}({})]未关闭",
|
||||||
// psd.getStand().getName(), psd.getStand().getCode(),
|
//// psd.getStand().getName(), psd.getStand().getCode(),
|
||||||
// psd.getName(), psd.getCode());
|
//// psd.getName(), psd.getCode());
|
||||||
return level;
|
// return level;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 站台扣车
|
// 站台扣车
|
||||||
|
@ -56,15 +56,14 @@ public class CiSignalControlService {
|
|||||||
*/
|
*/
|
||||||
public void controlLightOfSignal(Simulation simulation, Signal signal) {
|
public void controlLightOfSignal(Simulation simulation, Signal signal) {
|
||||||
VirtualRealitySignal vrSignal = signal.getVirtualSignal();
|
VirtualRealitySignal vrSignal = signal.getVirtualSignal();
|
||||||
if (signal.isCbtcMode()) {
|
if (signal.isCbtcMode() && !signal.isForcePhysical() && !signal.isLogicLight()) {
|
||||||
if (vrSignal != null && !signal.isLogicLight()) {
|
if (vrSignal != null) {
|
||||||
this.virtualRealityDeviceService.control(simulation, vrSignal, SignalAspect.No);
|
this.virtualRealityDeviceService.control(simulation, vrSignal, SignalAspect.No);
|
||||||
|
} else {
|
||||||
|
signal.setLogicLight(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else if ((!signal.isCbtcMode() || signal.isForcePhysical()) && signal.isLogicLight()) {
|
||||||
if (vrSignal != null && signal.isLogicLight()) {
|
if (vrSignal != null) {
|
||||||
if (signal.getLockedRoute() != null && signal.getLockedRoute().getAspect().equals(signal.getAspect())) {
|
|
||||||
signal.getLockedRoute().startSetting(simulation.getSystemTime());
|
|
||||||
}
|
|
||||||
this.virtualRealityDeviceService.control(simulation, vrSignal, vrSignal.getModel().getDefaultAspect());
|
this.virtualRealityDeviceService.control(simulation, vrSignal, vrSignal.getModel().getDefaultAspect());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,7 +76,7 @@ public class CiSignalControlService {
|
|||||||
public void blockade(Simulation simulation, Signal signal) {
|
public void blockade(Simulation simulation, Signal signal) {
|
||||||
if(!signal.isBlockade()) {
|
if(!signal.isBlockade()) {
|
||||||
signal.setBlockade(true);
|
signal.setBlockade(true);
|
||||||
this.closeRoute(simulation, signal);
|
this.tryControlSignalAspectAccordingLevel(simulation, signal, signal.getDefaultAspect());
|
||||||
if (signal.getLockedRoute() != null) {
|
if (signal.getLockedRoute() != null) {
|
||||||
signal.setReblockade(true);
|
signal.setReblockade(true);
|
||||||
log.debug(signal.debugStr() + "因信号机封锁且有锁闭的进路而重复封锁");
|
log.debug(signal.debugStr() + "因信号机封锁且有锁闭的进路而重复封锁");
|
||||||
@ -96,10 +95,7 @@ public class CiSignalControlService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void closeRoute(Simulation simulation, Signal signal) {
|
public void closeRoute(Simulation simulation, Signal signal) {
|
||||||
if (signal.isLogicLight()) {
|
signal.setForbidden(true);
|
||||||
signal.setAspect(signal.getSignalModel().getDefaultAspect());
|
this.tryControlSignalAspectAccordingLevel(simulation, signal, signal.getDefaultAspect());
|
||||||
} else {
|
|
||||||
this.virtualRealityDeviceService.control(simulation, signal.getVirtualSignal(), signal.getSignalModel().getDefaultAspect());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ import club.joylink.rtss.simulation.cbtc.Simulation;
|
|||||||
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityIbp;
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityIbp;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl;
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.map.PSD;
|
||||||
|
import club.joylink.rtss.simulation.cbtc.data.map.Stand;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityScreenDoor;
|
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityScreenDoor;
|
||||||
import club.joylink.rtss.simulation.cbtc.device.virtual.VirtualRealityDeviceService;
|
import club.joylink.rtss.simulation.cbtc.device.virtual.VirtualRealityDeviceService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -17,8 +19,6 @@ import java.util.Objects;
|
|||||||
public class CiStandService {
|
public class CiStandService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private VirtualRealityDeviceService virtualRealityDeviceService;
|
private VirtualRealityDeviceService virtualRealityDeviceService;
|
||||||
@Autowired
|
|
||||||
private CiSignalControlService signalService;
|
|
||||||
/**
|
/**
|
||||||
* 打开屏蔽门
|
* 打开屏蔽门
|
||||||
*/
|
*/
|
||||||
@ -93,10 +93,10 @@ public class CiStandService {
|
|||||||
|
|
||||||
public void cancelSysHoldTrain(Simulation simulation, Stand stand) {
|
public void cancelSysHoldTrain(Simulation simulation, Stand stand) {
|
||||||
stand.setSysHoldTrain(false);
|
stand.setSysHoldTrain(false);
|
||||||
// 如果所有扣车都取消,开放出站信号机
|
// // 如果所有扣车都取消,开放出站信号机
|
||||||
if (!stand.isHoldTrain()) {
|
// if (!stand.isHoldTrain()) {
|
||||||
this.reopenSignal(simulation, stand);
|
// this.reopenSignal(simulation, stand);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ibpHoldTrain(Simulation simulation, Stand stand) {
|
public void ibpHoldTrain(Simulation simulation, Stand stand) {
|
||||||
@ -105,10 +105,10 @@ public class CiStandService {
|
|||||||
|
|
||||||
public void cancelIbpHoldTrain(Simulation simulation, Stand stand) {
|
public void cancelIbpHoldTrain(Simulation simulation, Stand stand) {
|
||||||
stand.setIbpHoldTrain(false);
|
stand.setIbpHoldTrain(false);
|
||||||
// 如果所有扣车都取消,开放出站信号机
|
// // 如果所有扣车都取消,开放出站信号机
|
||||||
if (!stand.isHoldTrain()) {
|
// if (!stand.isHoldTrain()) {
|
||||||
this.reopenSignal(simulation, stand);
|
// this.reopenSignal(simulation, stand);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -124,25 +124,25 @@ public class CiStandService {
|
|||||||
} else {
|
} else {
|
||||||
stand.setStationHoldTrain(false);
|
stand.setStationHoldTrain(false);
|
||||||
}
|
}
|
||||||
// 如果所有扣车都取消,开放出站信号机
|
// // 如果所有扣车都取消,开放出站信号机
|
||||||
if (!stand.isHoldTrain()) {
|
// if (!stand.isHoldTrain()) {
|
||||||
this.reopenSignal(simulation, stand);
|
// this.reopenSignal(simulation, stand);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cancelAllHoldTrain(Simulation simulation, Stand stand) {
|
public void cancelAllHoldTrain(Simulation simulation, Stand stand) {
|
||||||
stand.setCenterHoldTrain(false);
|
stand.setCenterHoldTrain(false);
|
||||||
stand.setStationHoldTrain(false);
|
stand.setStationHoldTrain(false);
|
||||||
this.reopenSignal(simulation, stand);
|
// this.reopenSignal(simulation, stand);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reopenSignal(Simulation simulation, Stand stand) {
|
// private void reopenSignal(Simulation simulation, Stand stand) {
|
||||||
Signal signal = stand.getSection().getSignalOf(stand.isRight());
|
// Signal signal = stand.getSection().getSignalOf(stand.isRight());
|
||||||
if (Objects.nonNull(signal) && !signal.isMainAspect()) {
|
// if (Objects.nonNull(signal) && !signal.isMainAspect()) {
|
||||||
Route lockedRoute = signal.getLockedRoute();
|
// Route lockedRoute = signal.getLockedRoute();
|
||||||
this.signalService.tryControlSignalAspectAccordingLevel(simulation, signal, lockedRoute.getAspect());
|
// this.signalService.tryControlSignalAspectAccordingLevel(simulation, signal, lockedRoute.getAspect());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置或取消互锁解除
|
* 设置或取消互锁解除
|
||||||
@ -151,9 +151,9 @@ public class CiStandService {
|
|||||||
public void setOrCancelInterlockRelease(Simulation simulation, Stand stand, boolean release) {
|
public void setOrCancelInterlockRelease(Simulation simulation, Stand stand, boolean release) {
|
||||||
stand.getPsd().getVirtualScreenDoor().updateIL(release);
|
stand.getPsd().getVirtualScreenDoor().updateIL(release);
|
||||||
stand.getPsd().setInterlockRelease(release);
|
stand.getPsd().setInterlockRelease(release);
|
||||||
if (release) {
|
// if (release) {
|
||||||
this.reopenSignal(simulation, stand);
|
// this.reopenSignal(simulation, stand);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 控制屏蔽门的指令的来源 */
|
/** 控制屏蔽门的指令的来源 */
|
||||||
|
@ -97,9 +97,9 @@ public class CiSwitchControlService {
|
|||||||
return this.turn2NormalPosition(simulation, aSwitch);
|
return this.turn2NormalPosition(simulation, aSwitch);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (aSwitch.isPosN()) {
|
if (vrSwitch.isPosN()) {
|
||||||
return this.turn2ReversePosition(simulation, aSwitch);
|
return this.turn2ReversePosition(simulation, aSwitch);
|
||||||
} else if (aSwitch.isPosR()) {
|
} else if (vrSwitch.isPosR()) {
|
||||||
return this.turn2ReversePosition(simulation, aSwitch);
|
return this.turn2ReversePosition(simulation, aSwitch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -481,6 +481,12 @@ public class Section extends DelayUnlockDevice {
|
|||||||
* 计轴占用出清
|
* 计轴占用出清
|
||||||
*/
|
*/
|
||||||
public void axleCounterClear() {
|
public void axleCounterClear() {
|
||||||
|
if (AxleFault.FAULT.equals(this.getFault()) || AxleFault.ARB.equals(this.getFault())) {
|
||||||
|
this.setFault(null);
|
||||||
|
}
|
||||||
|
if (this.isInvalid()) {
|
||||||
|
this.judgeAsValid();
|
||||||
|
}
|
||||||
this.nctOccupied = false;
|
this.nctOccupied = false;
|
||||||
if (!CollectionUtils.isEmpty(logicList)) {
|
if (!CollectionUtils.isEmpty(logicList)) {
|
||||||
logicList.forEach(Section::axleCounterClear);
|
logicList.forEach(Section::axleCounterClear);
|
||||||
@ -663,7 +669,7 @@ public class Section extends DelayUnlockDevice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isRouteLockBy(Route route) {
|
private boolean isRouteLockBy(Route route) {
|
||||||
return this.routeLock && route.equals(this.route);
|
return this.routeLock && this.route.equals(route);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void forceUnlocking() {
|
public void forceUnlocking() {
|
||||||
@ -871,14 +877,8 @@ public class Section extends DelayUnlockDevice {
|
|||||||
List<Switch> relSwitchList = this.getRelSwitchList();
|
List<Switch> relSwitchList = this.getRelSwitchList();
|
||||||
for (Switch aSwitch : relSwitchList) {
|
for (Switch aSwitch : relSwitchList) {
|
||||||
aSwitch.getA().setInvalid(false);
|
aSwitch.getA().setInvalid(false);
|
||||||
if (aSwitch.isPosN()) {
|
aSwitch.getB().setInvalid(false);
|
||||||
aSwitch.getB().setInvalid(false);
|
aSwitch.getC().setInvalid(false);
|
||||||
} else if (aSwitch.isPosR()) {
|
|
||||||
aSwitch.getC().setInvalid(false);
|
|
||||||
} else {
|
|
||||||
aSwitch.getB().setInvalid(false);
|
|
||||||
aSwitch.getC().setInvalid(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (!CollectionUtils.isEmpty(this.logicList)) {
|
} else if (!CollectionUtils.isEmpty(this.logicList)) {
|
||||||
for (Section logic : this.logicList) {
|
for (Section logic : this.logicList) {
|
||||||
|
@ -190,7 +190,10 @@ public class Signal extends DelayUnlockDevice {
|
|||||||
* 当前信号显示
|
* 当前信号显示
|
||||||
*/
|
*/
|
||||||
private SignalAspect aspect;
|
private SignalAspect aspect;
|
||||||
|
/**
|
||||||
|
* 是否禁止联锁自动开信号
|
||||||
|
*/
|
||||||
|
private boolean forbidden;
|
||||||
/**
|
/**
|
||||||
* 引导信号开放剩余时间,单位ms
|
* 引导信号开放剩余时间,单位ms
|
||||||
*/
|
*/
|
||||||
@ -257,7 +260,12 @@ public class Signal extends DelayUnlockDevice {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean changeToCbtcMode() {
|
public boolean changeToCbtcMode() {
|
||||||
|
if (this.getVirtualSignal() == null) {
|
||||||
|
this.mode = Mode_CBTC;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (!this.isCtc()) {
|
if (!this.isCtc()) {
|
||||||
|
this.mode = Mode_BM;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.mode != Mode_CBTC) {
|
if (this.mode != Mode_CBTC) {
|
||||||
@ -272,7 +280,8 @@ public class Signal extends DelayUnlockDevice {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean changeToBackupMode() {
|
public boolean changeToBackupMode() {
|
||||||
if (this.getVirtualSignal() == null) {
|
if (this.getVirtualSignal() == null) { // 虚拟信号
|
||||||
|
this.mode = Mode_CBTC;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.mode != Mode_BM) {
|
if (this.mode != Mode_BM) {
|
||||||
@ -300,20 +309,6 @@ public class Signal extends DelayUnlockDevice {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否开启引导信号
|
|
||||||
*/
|
|
||||||
public boolean isGuideAspect() {
|
|
||||||
return this.aspect != null && this.aspect.equals(this.signalModel.getGuideAspect());
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 是否禁止信号
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean isForbidAspect() {
|
|
||||||
return this.aspect != null && this.aspect.equals(this.signalModel.getDefaultAspect());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isMainAspect() {
|
public boolean isMainAspect() {
|
||||||
return this.signalModel.getMainAspects() != null && this.signalModel.getMainAspects().contains(this.aspect);
|
return this.signalModel.getMainAspects() != null && this.signalModel.getMainAspects().contains(this.aspect);
|
||||||
}
|
}
|
||||||
@ -596,6 +591,32 @@ public class Signal extends DelayUnlockDevice {
|
|||||||
return this.signalModel.getDefaultAspect();
|
return this.signalModel.getDefaultAspect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSupportMainAspect() {
|
||||||
|
if (this.isMainLevel()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (this.isAtpLevel() && this.isCbtcMode()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDefaultAspect() {
|
||||||
|
return this.aspect.equals(this.signalModel.getDefaultAspect());
|
||||||
|
}
|
||||||
|
|
||||||
|
public SignalAspect getDefaultAspect() {
|
||||||
|
return this.signalModel.getDefaultAspect();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isGuideAspect() {
|
||||||
|
return this.aspect.equals(this.signalModel.getGuideAspect());
|
||||||
|
}
|
||||||
|
|
||||||
|
public SignalAspect getGuideAspect() {
|
||||||
|
return this.signalModel.getGuideAspect();
|
||||||
|
}
|
||||||
|
|
||||||
public enum LightColor {
|
public enum LightColor {
|
||||||
RED,
|
RED,
|
||||||
YELLOW,
|
YELLOW,
|
||||||
|
@ -887,7 +887,7 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
|||||||
boolean right = this.right;
|
boolean right = this.right;
|
||||||
Section section = this.headPosition.getSection();
|
Section section = this.headPosition.getSection();
|
||||||
Signal signal = section.getSignalOf(right);
|
Signal signal = section.getSignalOf(right);
|
||||||
if (signal == null || !signal.isForbidAspect()) { //没有同向信号机或信号机不处于信号关闭状态
|
if (signal == null || !signal.isDefaultAspect()) { //没有同向信号机或信号机不处于信号关闭状态
|
||||||
throw new SimulationException(SimulationExceptionType.Invalid_Operation, "指令要求:列车车头所在区段有同向信号机并且信号关闭");
|
throw new SimulationException(SimulationExceptionType.Invalid_Operation, "指令要求:列车车头所在区段有同向信号机并且信号关闭");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,12 +117,14 @@ public class DeviceStatusModifyTool {
|
|||||||
private void openSignalDirectly(Signal signal, SignalAspect aspect) {
|
private void openSignalDirectly(Signal signal, SignalAspect aspect) {
|
||||||
VirtualRealitySignal virtualSignal = signal.getVirtualSignal();
|
VirtualRealitySignal virtualSignal = signal.getVirtualSignal();
|
||||||
signal.changeLightType(true);
|
signal.changeLightType(true);
|
||||||
if (signal.isLogicLight() && !signal.isVirtual()) {
|
if (virtualSignal != null) {
|
||||||
virtualSignal.control(SignalAspect.No);
|
if (signal.isLogicLight()) {
|
||||||
} else {
|
virtualSignal.control(SignalAspect.No);
|
||||||
virtualSignal.control(aspect);
|
} else {
|
||||||
|
virtualSignal.control(aspect);
|
||||||
|
}
|
||||||
|
virtualSignal.finish();
|
||||||
}
|
}
|
||||||
virtualSignal.finish();
|
|
||||||
signal.setAspect(aspect);
|
signal.setAspect(aspect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user