Merge
This commit is contained in:
commit
df250b5c71
@ -187,8 +187,9 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
List<Signal> approachList = new ArrayList<>();
|
||||
log.info(String.format("共有信号机[%s]个", signalList.size()));
|
||||
for (Signal signal : signalList) {
|
||||
if (signal.isBlockingSignal()) {
|
||||
if (signal.isBlockingSignal() || signal.isTransmissionSignal()) {
|
||||
// 阻挡信号机永远红灯,不生成联锁
|
||||
// 传输信号机不需要生成联锁
|
||||
continue;
|
||||
}
|
||||
// 信号机接近区段构建
|
||||
@ -1820,7 +1821,8 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
MapCiGenerateConfig config, List<String> errorList) {
|
||||
boolean right = end.isRight();
|
||||
List<SectionPath> overlapPathList = new ArrayList<>();
|
||||
getOverlapPathOf(end.getSection().getSectionOf(right), right,
|
||||
Section signalSection = end.getSection();
|
||||
getOverlapPathOf(signalSection.getSectionOf(right), right,
|
||||
new SectionPath(right), overlapPathList, config, errorList);
|
||||
List<RouteOverlap> overlapList = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(overlapPathList)) {
|
||||
@ -1858,9 +1860,22 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
RouteOverlap routeOverlap = new RouteOverlap(overlapCodeGenerator.next(),
|
||||
String.format("O_%s_%s", end.getName(), deviceName));
|
||||
routeOverlap.setPathList(Arrays.asList(sectionPath));
|
||||
routeOverlap.setSection(end.getSection());
|
||||
routeOverlap.setSection(signalSection);
|
||||
routeOverlap.setRight(right);
|
||||
routeOverlap.setDelayReleaseTime(config.getOverlapReleaseTime()); // 默认延时解锁时间
|
||||
|
||||
if (signalSection.getLen() >= 250) { // 长区段根据长度生成
|
||||
if (signalSection.getLen() >= 250 && signalSection.getLen() <= 400) {
|
||||
if (config.getOverlapReleaseTime() < 40) {
|
||||
routeOverlap.setDelayReleaseTime(40);
|
||||
}
|
||||
} else {
|
||||
int time = (int) (signalSection.getLen() / 15);
|
||||
if (config.getOverlapReleaseTime() < time) {
|
||||
routeOverlap.setDelayReleaseTime(time);
|
||||
}
|
||||
}
|
||||
}
|
||||
overlapList.add(routeOverlap);
|
||||
}
|
||||
// 若存在重名,根据道岔位置修改名称
|
||||
@ -1890,13 +1905,13 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
||||
RouteOverlap routeOverlap = new RouteOverlap(overlapCodeGenerator.next(),
|
||||
String.format("O_%s", end.getName()));
|
||||
routeOverlap.setPathList(overlapPathList);
|
||||
routeOverlap.setSection(end.getSection());
|
||||
routeOverlap.setSection(signalSection);
|
||||
routeOverlap.setDelayReleaseTime(config.getOverlapReleaseTime()); // 默认延时解锁时间
|
||||
routeOverlap.setRight(right);
|
||||
// 是否触发式延续保护
|
||||
if (config.isOverlapSettingByTrigger()) {
|
||||
List<SectionPath> triggerPathList = new ArrayList<>();
|
||||
Section section = end.getSection();
|
||||
Section section = signalSection;
|
||||
// 反方向找触发区段
|
||||
this.getOverlapTriggerPathOf(end, section, !right, new SectionPath(!right), triggerPathList);
|
||||
routeOverlap.setTriggerPathList(triggerPathList);
|
||||
|
@ -183,6 +183,8 @@ public class Operation {
|
||||
Stand_Total_Cancel,
|
||||
/** 手动开启屏蔽门 */
|
||||
Stand_Open_Psd,
|
||||
/** 取消设置(扣车或跳停) */
|
||||
Stand_Cancel_Setting,
|
||||
|
||||
//--------------------------- 控制模式 ---------------------------
|
||||
/** 请求站控 */
|
||||
|
@ -162,4 +162,12 @@ public class StandOperateHandler {
|
||||
public void manualOpenPsd(Simulation simulation, String standCode) {
|
||||
atsStandService.manualOpenPsd(simulation, standCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消设置
|
||||
*/
|
||||
@OperateHandlerMapping(type = Operation.Type.Stand_Cancel_Setting)
|
||||
public void cancelSetting(Simulation simulation, String standCode) {
|
||||
atsStandService.cancelSetting(simulation, standCode);
|
||||
}
|
||||
}
|
||||
|
@ -254,4 +254,10 @@ public class SwitchOperateHandler {
|
||||
vrSwitch.setNormal(normal);
|
||||
vrSwitch.setReverse(!normal);
|
||||
}
|
||||
|
||||
/** 强行转岔 */
|
||||
@OperateHandlerMapping(type = Operation.Type.Switch_Force_Turn)
|
||||
public void switchForceTurn(Simulation simulation, String switchCode, Boolean normal) {
|
||||
ciApiService.switchForceTurn(simulation, switchCode, normal);
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,6 @@ public class AtsRouteSettingService {
|
||||
route = this.queryPlanTrainNeedRoute(simulation, train, signal, trainList);
|
||||
} else if (train.isHeadCodeTrain()) { // 头码车
|
||||
route = this.queryHeadTrainNeedRoute(simulation, train, signal, trainList);
|
||||
// headTrainToSetRoute(repository, trainPositionMap, signalTrainMap, waitSettingList, signal, train);
|
||||
}
|
||||
if (Objects.nonNull(route)) {
|
||||
waitSettingList.add(new TrainRoute(train, trainPositionMap.get(train.getGroupNumber()),
|
||||
@ -211,6 +210,7 @@ public class AtsRouteSettingService {
|
||||
if (!train.isPlanTrain()) {
|
||||
return null;
|
||||
}
|
||||
LocalDateTime systemTime = simulation.getSystemTime();
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
TripPlan tripPlan = repository.getTripPlan(train.getServiceNumber(), train.getTripNumber());
|
||||
// 特殊情况检查处理
|
||||
@ -218,10 +218,6 @@ public class AtsRouteSettingService {
|
||||
// 列车到达终点站台准备折返
|
||||
if (signal.getSection().isNormalStandTrack() &&
|
||||
train.isParkingStand(signal.getSection().getStandList().get(0))) {
|
||||
// 判断从当前时间到折返后下一计划到站时间中是否存在出库的冲突计划
|
||||
if (this.containsConflictOutBoundPlan(simulation, tripPlan)) {
|
||||
return null;
|
||||
}
|
||||
// 折返计划的正常站后折返起始信号机,根据折返策略查询进路
|
||||
Station station = signal.getSection().getStation();
|
||||
StationTurnBackStrategyOption strategy = null;
|
||||
@ -241,7 +237,12 @@ public class AtsRouteSettingService {
|
||||
if (train.isParking()) { // 列车在站台停车
|
||||
// 处理站前折返的进路排列
|
||||
routePaths = repository.queryRoutePaths(trainSection, nextSection);
|
||||
} else if (train.isStop() && !trainSection.isNormalStandTrack() && (trainSection.isTurnBackTrack() || trainSection.isTransferTrack())) { // 折返轨停车
|
||||
} else if (train.isStop() && !trainSection.isNormalStandTrack() && (trainSection.isTurnBackTrack())) { // 折返轨停车
|
||||
// 判断从当前时间到折返后下一计划到站时间中是否存在出库的冲突计划
|
||||
if (this.containsConflictOutBoundPlan(simulation, tripPlan)) {
|
||||
log.debug(String.format("折返与出库冲突,不排列"));
|
||||
return null;
|
||||
}
|
||||
List<RoutePath> routePaths1 = repository.queryRoutePaths(trainSection, nextSection);
|
||||
if (!CollectionUtils.isEmpty(routePaths1)) {
|
||||
routePaths = routePaths1;
|
||||
@ -263,6 +264,12 @@ public class AtsRouteSettingService {
|
||||
for (int i = 1; i < planList.size(); i++) {
|
||||
StationPlan plan1 = planList.get(i - 1);
|
||||
StationPlan plan2 = planList.get(i);
|
||||
if (tripPlan.isOutbound() && tripPlan.isFirstPlan(plan1)) {
|
||||
if (plan1.getLeaveTime().isAfter(systemTime.toLocalTime())) {
|
||||
log.debug(String.format("出库列车未到发车时间,不排列进路"));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
List<RoutePath> paths = repository.getRoutePaths(plan1.getSection(), plan2.getSection());
|
||||
boolean find = false;
|
||||
for (RoutePath path : paths) {
|
||||
|
@ -407,4 +407,16 @@ public class AtsStandService {
|
||||
Stand stand = repository.getByCode(standCode, Stand.class);
|
||||
stand.getPsd().getVirtualScreenDoor().updateLockAndClose(false, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消设置(扣车或跳停)
|
||||
*/
|
||||
public void cancelSetting(Simulation simulation, String standCode) {
|
||||
Stand stand = simulation.getRepository().getByCode(standCode, Stand.class);
|
||||
if (stand.isStationHoldTrain()) {
|
||||
cancelHoldTrain(simulation, standCode);
|
||||
} else if (stand.isAllSkip()) {
|
||||
cancelJumpStop(simulation, standCode, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -316,4 +316,9 @@ public interface CiApiService {
|
||||
* 取消站台紧急停车
|
||||
*/
|
||||
void cancelStandEB(Simulation simulation, Stand stand);
|
||||
|
||||
/**
|
||||
* 强扳道岔
|
||||
*/
|
||||
void switchForceTurn(Simulation simulation, String switchCode, Boolean normal);
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import club.joylink.rtss.simulation.cbtc.data.map.*;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.SignalApproachMessage;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.TrainStopMessage;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -475,4 +476,16 @@ public class CiApiServiceImpl implements CiApiService {
|
||||
return;
|
||||
stand.getEsp().update(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void switchForceTurn(Simulation simulation, String switchCode, Boolean normal) {
|
||||
Switch aSwitch = simulation.getRepository().getByCode(switchCode, Switch.class);
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(!aSwitch.isLocked(), String.format("道岔[%s]锁闭,无法转动", aSwitch.getCode()));
|
||||
VirtualRealitySwitch vrSwitch = aSwitch.getVirtualSwitch();
|
||||
if (normal == null) {
|
||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(vrSwitch.isLoss(), "道岔不在定反位,不能转动");
|
||||
normal = vrSwitch.isReverse();
|
||||
}
|
||||
vrSwitch.startSetting(normal);
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +132,6 @@ public class RouteService {
|
||||
/**
|
||||
* 进路CBTC/联锁办理条件公有检查
|
||||
*
|
||||
*
|
||||
* @param simulation
|
||||
* @param route
|
||||
* @return
|
||||
@ -428,12 +427,12 @@ public class RouteService {
|
||||
}
|
||||
boolean onPosition = this.checkRouteSwitchPosition(switchList);
|
||||
if (!onPosition) return false;
|
||||
if (!route.isCbtcMode()) { // 检查进路延续保护
|
||||
RouteOverlap overlap = route.getOverlap();
|
||||
if (Objects.nonNull(overlap) && !overlap.isLock()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// if (!route.isCbtcMode()) { // 检查进路延续保护
|
||||
// RouteOverlap overlap = route.getOverlap();
|
||||
// if (Objects.nonNull(overlap) && !overlap.isLock()) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -694,6 +693,7 @@ public class RouteService {
|
||||
switchList.forEach(switchElement -> {
|
||||
Switch aSwitch = switchElement.getASwitch();
|
||||
aSwitch.routeUnlock();
|
||||
aSwitch.overlapUnLock();
|
||||
});
|
||||
}
|
||||
// 进路侧防取消锁闭
|
||||
@ -869,15 +869,6 @@ public class RouteService {
|
||||
return level;
|
||||
}
|
||||
}
|
||||
// // 如果进路区段中有站台轨,站台屏蔽门开着,需要关灯
|
||||
// List<Section> standTracks = sectionList.stream().filter(Section::isStandTrack).collect(Collectors.toList());
|
||||
// if (!CollectionUtils.isEmpty(standTracks)) {
|
||||
// for (Section standTrack : standTracks) {
|
||||
// List<Stand> standList = standTrack.getStandList();
|
||||
// if (standList.stream().anyMatch(stand -> stand.getPsd() != null && !stand.getPsd().isCloseAndLock()))
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
} else { // 后备模式检查
|
||||
// 区段占用检查
|
||||
Route.CheckFailMessage checkFailMessage = this.ciLevelCheck(route);
|
||||
@ -885,17 +876,17 @@ public class RouteService {
|
||||
log.debug(String.format("联锁网络检查失败:[%s]", checkFailMessage.toJson()));
|
||||
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 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 level;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// 站台扣车
|
||||
if (!CollectionUtils.isEmpty(route.getStandHoldList())) {
|
||||
for (Stand stand : route.getStandHoldList()) {
|
||||
@ -1050,13 +1041,23 @@ public class RouteService {
|
||||
break;
|
||||
} else {
|
||||
if (section.isSwitchTrack()) { // 如果是道岔区段,解锁道岔
|
||||
SwitchElement switchElement = route.getRouteSwitchElement(relSwitch);
|
||||
section.routeUnlocking(right);
|
||||
relSwitch.routeUnlock();
|
||||
relSwitch.overlapUnLock();
|
||||
// 侧防解锁
|
||||
RouteFls routeFls = route.getRouteFlsOfSwitch(relSwitch);
|
||||
if (routeFls != null) {
|
||||
routeFls.unlock();
|
||||
}
|
||||
//检查道岔的联动道岔和计轴关联道岔是否可以解锁
|
||||
List<Switch> switches = Arrays.asList(relSwitch.queryLinkedSwitch(), relSwitch.queryAxleRelatedOtherSwitch());
|
||||
for (Switch linkedSwitch : switches) {
|
||||
if (linkedSwitch == null)
|
||||
continue;
|
||||
if (route.isRouteSwitch(linkedSwitch) && linkedSwitch.getAllSections().stream().noneMatch(Section::isRouteLock)) { //道岔关联的所有区段都没有进路锁闭
|
||||
linkedSwitch.routeUnlock();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
section.routeUnlocking(right);
|
||||
}
|
||||
|
@ -230,13 +230,13 @@ public class MapDeviceBuilder {
|
||||
}
|
||||
}
|
||||
}
|
||||
if(Objects.equals(BusinessConsts.Section.SectionType.Type01, sectionVO.getType())){
|
||||
if (Objects.equals(BusinessConsts.Section.SectionType.Type01, sectionVO.getType())) {
|
||||
Section parent = (Section) elementMap.get(sectionVO.getParentCode());//所属岔心
|
||||
if (Objects.nonNull(parent)) {
|
||||
if(!parent.isCross()){
|
||||
if (!parent.isCross()) {
|
||||
errMsgList.add(String.format("物理区段[%s(%s)]关联父区段[%s(%s)]不是岔心",
|
||||
section.getName(), section.getCode(),parent.getName(),parent.getCode()));
|
||||
}else{
|
||||
section.getName(), section.getCode(), parent.getName(), parent.getCode()));
|
||||
} else {
|
||||
parent.addLogicSection(section);
|
||||
section.setParent(parent);
|
||||
}
|
||||
@ -383,7 +383,7 @@ public class MapDeviceBuilder {
|
||||
errMsgList.add(String.format("道岔区段[%s(%s)]有问题",
|
||||
section.getName(), section.getCode()));
|
||||
}
|
||||
if (section.isAxleCounterSection() && Objects.nonNull(section.getParent()) && section.getParent().isCross()) {
|
||||
if (section.isAxleCounterSection() && Objects.nonNull(section.getParent()) && section.getParent().isCross()) {
|
||||
Section leftSection = section.getLeftSection();
|
||||
if (Objects.nonNull(leftSection)) {
|
||||
if (!leftSection.isSwitchTrack()) {
|
||||
@ -560,91 +560,9 @@ public class MapDeviceBuilder {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 信号机
|
||||
List<MapSignalNewVO> signalList = graphData.getSignalList();
|
||||
signalList.forEach(signalVO -> {
|
||||
Signal signal = new Signal(signalVO.getCode(), signalVO.getUniqueName());
|
||||
if (Objects.nonNull(elementMap.get(signal.getCode()))) {
|
||||
errMsgList.add(String.format("编码为[%s]的信号机不唯一", signal.getCode()));
|
||||
}
|
||||
elementMap.put(signal.getCode(), signal);
|
||||
signal.setShowName(signalVO.getName());
|
||||
signal.setRight(signalVO.isRight());
|
||||
signal.setVirtual(signalVO.isVirtual());
|
||||
signal.setNoOverlap(signalVO.isNoOverlap());
|
||||
// 所属设备集中站
|
||||
Station deviceStation = (Station) elementMap.get(signalVO.getStationCode());
|
||||
if (Objects.isNull(deviceStation)) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]未设置所属设备集中站或所属设备集中站不存在", signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
signal.setDeviceStation(deviceStation);
|
||||
}
|
||||
// 所属联锁站
|
||||
Station interlockStation = ((Station) elementMap.get(signalVO.getInterlockStationCode()));
|
||||
if (Objects.isNull(interlockStation)) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]未设置所属联锁站或所属联锁站不存在", signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
if (!interlockStation.isInterlock()) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]关联的所属联锁车站[%s(%s)]不是联锁站",
|
||||
signal.getName(), signal.getCode(),
|
||||
interlockStation.getName(), interlockStation.getCode()));
|
||||
}
|
||||
signal.setInterlockStation(interlockStation);
|
||||
}
|
||||
// 信号机类型
|
||||
if (Objects.isNull(signalVO.getType())) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]类型未设置", signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
signal.setType(signalVO.getType());
|
||||
}
|
||||
signal.setRouteEnd(signalVO.isRouteEnd());
|
||||
signal.setIgnoreRouteEnd(signalVO.getIgnoreRouteEnd());
|
||||
signal.setCtc(signalVO.isCtc());
|
||||
signal.setCallOn(signalVO.isCallOn());
|
||||
signal.setTurnBack(signalVO.isTurnBack());
|
||||
// 关联区段及偏移量
|
||||
Section section = (Section) elementMap.get(signalVO.getSectionCode());
|
||||
if (Objects.isNull(section)) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]未关联区段或关联区段不存在", signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
signal.setSection(section);
|
||||
if (signal.isRight()) { // 右向信号机
|
||||
if (Objects.nonNull(section.getSignalToRight())) {
|
||||
errMsgList.add(String.format("区段[%s(%s)]关联了多个右向信号机[%s(%s),%s(%s)]",
|
||||
section.getName(), section.getCode(),
|
||||
section.getSignalToRight().getName(), section.getSignalToRight().getCode(),
|
||||
signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
section.setSignalToRight(signal);
|
||||
}
|
||||
} else {
|
||||
if (Objects.nonNull(section.getSignalToLeft())) {
|
||||
errMsgList.add(String.format("区段[%s(%s)]关联了多个左向信号机[%s(%s),%s(%s)]",
|
||||
section.getName(), section.getCode(),
|
||||
section.getSignalToLeft().getName(), section.getSignalToLeft().getCode(),
|
||||
signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
section.setSignalToLeft(signal);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Objects.isNull(signalVO.getSectionOffset()) ||
|
||||
(Objects.nonNull(section) && Objects.nonNull(section.getLen()) &&
|
||||
(signalVO.getSectionOffset() < 0 || signalVO.getSectionOffset() > section.getLen()))) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]的区段偏移量未设置或数据异常[%s]",
|
||||
signal.getName(), signal.getCode(), signalVO.getSectionOffset()));
|
||||
} else {
|
||||
signal.setOffset(signalVO.getSectionOffset());
|
||||
}
|
||||
buildSignal(graphData, elementMap, deviceMap, errMsgList);
|
||||
|
||||
// 创建虚拟真实信号机
|
||||
if (!signal.isVirtual()) { // 是真实存在的虚拟机才创建
|
||||
VirtualRealitySignal virtualRealitySignal = new VirtualRealitySignal(signal.getCode(), signal.getName());
|
||||
signal.setVirtualSignal(virtualRealitySignal);
|
||||
deviceMap.put(virtualRealitySignal.getCode(), virtualRealitySignal);
|
||||
}
|
||||
});
|
||||
// 折返区段左右信号机存在校验
|
||||
for (Section section : physicalSectionList) {
|
||||
if (section.isTurnBackTrack()) {
|
||||
@ -925,10 +843,99 @@ public class MapDeviceBuilder {
|
||||
// 接触网
|
||||
buildCatenary(graphData, elementMap, errMsgList, mapDataBuildResult.getCatenaryMap());
|
||||
//应答器
|
||||
buildResponderDataRef(graphData, elementMap, errMsgList ,mapDataBuildResult.getSectionRespondersMap());
|
||||
buildResponderDataRef(graphData, elementMap, errMsgList, mapDataBuildResult.getSectionRespondersMap());
|
||||
}
|
||||
|
||||
/**应答器数据验证及关系构建*/
|
||||
|
||||
private static void buildSignal(MapGraphDataNewVO graphData, Map<String, MapElement> elementMap, Map<String, VirtualRealityDevice> deviceMap, List<String> errMsgList) {
|
||||
List<MapSignalNewVO> signalList = graphData.getSignalList();
|
||||
signalList.stream().filter(signalVO -> !Signal.SignalType.TRANSMISSION.equals(signalVO.getType())).forEach(signalVO -> { //非传输信号机
|
||||
Signal signal = new Signal(signalVO.getCode(), signalVO.getUniqueName());
|
||||
if (Objects.nonNull(elementMap.get(signal.getCode()))) {
|
||||
errMsgList.add(String.format("编码为[%s]的信号机不唯一", signal.getCode()));
|
||||
}
|
||||
elementMap.put(signal.getCode(), signal);
|
||||
signal.setShowName(signalVO.getName());
|
||||
signal.setRight(signalVO.isRight());
|
||||
signal.setVirtual(signalVO.isVirtual());
|
||||
signal.setNoOverlap(signalVO.isNoOverlap());
|
||||
// 所属设备集中站
|
||||
Station deviceStation = (Station) elementMap.get(signalVO.getStationCode());
|
||||
if (Objects.isNull(deviceStation)) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]未设置所属设备集中站或所属设备集中站不存在", signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
signal.setDeviceStation(deviceStation);
|
||||
}
|
||||
// 所属联锁站
|
||||
Station interlockStation = ((Station) elementMap.get(signalVO.getInterlockStationCode()));
|
||||
if (Objects.isNull(interlockStation)) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]未设置所属联锁站或所属联锁站不存在", signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
if (!interlockStation.isInterlock()) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]关联的所属联锁车站[%s(%s)]不是联锁站",
|
||||
signal.getName(), signal.getCode(),
|
||||
interlockStation.getName(), interlockStation.getCode()));
|
||||
}
|
||||
signal.setInterlockStation(interlockStation);
|
||||
}
|
||||
// 信号机类型
|
||||
if (Objects.isNull(signalVO.getType())) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]类型未设置", signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
signal.setType(signalVO.getType());
|
||||
}
|
||||
signal.setRouteEnd(signalVO.isRouteEnd());
|
||||
signal.setIgnoreRouteEnd(signalVO.getIgnoreRouteEnd());
|
||||
signal.setCtc(signalVO.isCtc());
|
||||
signal.setCallOn(signalVO.isCallOn());
|
||||
signal.setTurnBack(signalVO.isTurnBack());
|
||||
// 关联区段及偏移量
|
||||
Section section = (Section) elementMap.get(signalVO.getSectionCode());
|
||||
if (Objects.isNull(section)) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]未关联区段或关联区段不存在", signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
signal.setSection(section);
|
||||
if (signal.isRight()) { // 右向信号机
|
||||
if (Objects.nonNull(section.getSignalToRight())) {
|
||||
errMsgList.add(String.format("区段[%s(%s)]关联了多个右向信号机[%s(%s),%s(%s)]",
|
||||
section.getName(), section.getCode(),
|
||||
section.getSignalToRight().getName(), section.getSignalToRight().getCode(),
|
||||
signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
section.setSignalToRight(signal);
|
||||
}
|
||||
} else {
|
||||
if (Objects.nonNull(section.getSignalToLeft())) {
|
||||
errMsgList.add(String.format("区段[%s(%s)]关联了多个左向信号机[%s(%s),%s(%s)]",
|
||||
section.getName(), section.getCode(),
|
||||
section.getSignalToLeft().getName(), section.getSignalToLeft().getCode(),
|
||||
signal.getName(), signal.getCode()));
|
||||
} else {
|
||||
section.setSignalToLeft(signal);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Objects.isNull(signalVO.getSectionOffset()) ||
|
||||
(Objects.nonNull(section) && Objects.nonNull(section.getLen()) &&
|
||||
(signalVO.getSectionOffset() < 0 || signalVO.getSectionOffset() > section.getLen()))) {
|
||||
errMsgList.add(String.format("信号机[%s(%s)]的区段偏移量未设置或数据异常[%s]",
|
||||
signal.getName(), signal.getCode(), signalVO.getSectionOffset()));
|
||||
} else {
|
||||
signal.setOffset(signalVO.getSectionOffset());
|
||||
}
|
||||
|
||||
// 创建虚拟真实信号机
|
||||
if (!signal.isVirtual()) { // 是真实存在的虚拟机才创建
|
||||
VirtualRealitySignal virtualRealitySignal = new VirtualRealitySignal(signal.getCode(), signal.getName());
|
||||
signal.setVirtualSignal(virtualRealitySignal);
|
||||
deviceMap.put(virtualRealitySignal.getCode(), virtualRealitySignal);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 应答器数据验证及关系构建
|
||||
*/
|
||||
private static void buildResponderDataRef(MapGraphDataNewVO graphData, Map<String, MapElement> elementMap, List<String> errMsgList, Map<Section, List<Responder>> sectionRespondersMap) {
|
||||
List<MapResponderVO> responderList = graphData.getResponderList();
|
||||
responderList.forEach(responderVO -> {
|
||||
@ -942,14 +949,14 @@ public class MapDeviceBuilder {
|
||||
errMsgList.add(String.format("应答器[%s(%s)]类型未设置", responderVO.getName(), responderVO.getCode()));
|
||||
} else {
|
||||
responder.setType(responderVO.getType());
|
||||
if (responder.isVB()){
|
||||
if(StringUtils.isEmpty(responderVO.getSignalCode())){
|
||||
if (responder.isVB()) {
|
||||
if (StringUtils.isEmpty(responderVO.getSignalCode())) {
|
||||
errMsgList.add(String.format("可变应答器[%s(%s)]未设置关联信号机", responderVO.getName(), responderVO.getCode()));
|
||||
}else{
|
||||
} else {
|
||||
Signal signal = (Signal) elementMap.get(responderVO.getSignalCode());
|
||||
if(Objects.isNull(signal)){
|
||||
errMsgList.add(String.format("可变应答器[%s(%s)]关联信号机[%s]不存在", responderVO.getName(), responderVO.getCode(),responderVO.getSignalCode()));
|
||||
}else{
|
||||
if (Objects.isNull(signal)) {
|
||||
errMsgList.add(String.format("可变应答器[%s(%s)]关联信号机[%s]不存在", responderVO.getName(), responderVO.getCode(), responderVO.getSignalCode()));
|
||||
} else {
|
||||
responder.setSignal(signal);
|
||||
}
|
||||
}
|
||||
|
@ -120,6 +120,11 @@ public class Signal extends MayOutOfOrderDevice {
|
||||
*/
|
||||
private AutoSignal autoSignal;
|
||||
|
||||
/**
|
||||
* 传输信号机关联的信号机
|
||||
*/
|
||||
private Signal linkSignal;
|
||||
|
||||
// ------------------状态属性---------------------
|
||||
|
||||
/**
|
||||
@ -334,6 +339,13 @@ public class Signal extends MayOutOfOrderDevice {
|
||||
return Objects.equals(this.type, SignalType.PROTECTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否传输信号机
|
||||
*/
|
||||
public boolean isTransmissionSignal() {
|
||||
return SignalType.TRANSMISSION.equals(this.type);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否与轨道常规运行方向相反
|
||||
*
|
||||
@ -404,7 +416,11 @@ public class Signal extends MayOutOfOrderDevice {
|
||||
/**
|
||||
* 通过信号机
|
||||
*/
|
||||
PASSING
|
||||
PASSING,
|
||||
/**
|
||||
* 传输信号机
|
||||
*/
|
||||
TRANSMISSION,
|
||||
}
|
||||
|
||||
public enum SignalFault implements DeviceFault {
|
||||
|
@ -232,7 +232,6 @@ public class Switch extends MayOutOfOrderDevice {
|
||||
|
||||
public void routeUnlock() {
|
||||
this.routeLock = false;
|
||||
this.overlapLock = false;
|
||||
}
|
||||
|
||||
public void fpLock() {
|
||||
@ -367,9 +366,23 @@ public class Switch extends MayOutOfOrderDevice {
|
||||
(!normal && SwitchFault.REVERSE_SPLIT.equals(this.getFault())));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取定位的道岔区段列表
|
||||
*/
|
||||
public List<Section> getNormalSections() {
|
||||
return Arrays.asList(a, b);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取道岔关联的所有区段
|
||||
*/
|
||||
public List<Section> getAllSections() {
|
||||
return List.of(a, b, c);
|
||||
}
|
||||
|
||||
public enum SwitchFault implements DeviceFault {
|
||||
/**
|
||||
* 道岔挤岔
|
||||
* 道岔失表
|
||||
*/
|
||||
SPLIT {
|
||||
@Override
|
||||
@ -421,11 +434,4 @@ public class Switch extends MayOutOfOrderDevice {
|
||||
public boolean isLoss() {
|
||||
return !this.isNormalPosition() && !this.isReversePosition();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取定位的道岔区段列表
|
||||
*/
|
||||
public List<Section> getNormalSections() {
|
||||
return Arrays.asList(a, b);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package club.joylink.rtss.simulation.cbtc.data.plan;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@ -43,4 +43,7 @@ public class RealRun {
|
||||
@JsonSerialize(using = Boolean2NumSerializer.class)
|
||||
private Boolean right;
|
||||
|
||||
public String getSTNumber() {
|
||||
return String.format("%s%s", this.serviceNumber, this.tripNumber == null ? "" : this.tripNumber);
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ public class VirtualRealitySwitch extends VirtualRealityDevice {
|
||||
* 是否失表
|
||||
* @return
|
||||
*/
|
||||
private boolean isLoss() {
|
||||
public boolean isLoss() {
|
||||
return !this.isNormal() && !this.isReverse();
|
||||
}
|
||||
|
||||
|
@ -220,12 +220,12 @@ public class ATPLogicLoop {
|
||||
case CLOSE_DOOR: // 关门
|
||||
Signal signal = train.getHeadPosition().getSection().getSignalOf(train.isRight());
|
||||
if (!train.isHold()) { // 列车未扣车
|
||||
if (Objects.nonNull(signal) && !signal.isNormalOpen()) {
|
||||
if (!train.isRMMode() && !train.isNRMMode()) {
|
||||
// 信号机未正常开放
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if (Objects.nonNull(signal) && !signal.isNormalOpen()) {
|
||||
// if (!train.isRMMode() && !train.isNRMMode()) {
|
||||
// // 信号机未正常开放
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// 可以关门
|
||||
this.ATOService.syncCloseDoor(simulation, train);
|
||||
if (this.isAllDoorClose(simulation, train)) {
|
||||
|
@ -187,4 +187,7 @@ public class MapSignalNewVO {
|
||||
/**是否无延续保护*/
|
||||
@ApiModelProperty(value="是否无延续保护")
|
||||
private boolean noOverlap;
|
||||
|
||||
@ApiModelProperty(value = "传输信号机关联的信号机")
|
||||
private String linkSignalCode;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user