修改target更新逻辑;修改设置计划车bug;修改计轴故障时进路不能解锁问题

This commit is contained in:
joylink_zhangsai 2021-08-10 20:24:48 +08:00
parent c557d118a6
commit ef79a3abf0
6 changed files with 49 additions and 39 deletions

View File

@ -430,8 +430,8 @@ public class MapService implements IMapService {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(!ObjectUtils.isEmpty(mapInfoList), BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(!ObjectUtils.isEmpty(mapInfoList),
String.format("地图名称为[%s]的发布地图数据不存在", mapVO.getName())); String.format("地图名称为[%s]的发布地图数据不存在", mapVO.getName()));
map = mapInfoList.get(0); map = mapInfoList.get(0);
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertEquals(map.getLineCode(), mapVO.getLineCode(), // BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertEquals(map.getLineCode(), mapVO.getLineCode(),
"存在名称相同但基于不同真实线路的地图"); // "存在名称相同但基于不同真实线路的地图");
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertEquals(map.getCityCode(), mapVO.getCityCode(), BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertEquals(map.getCityCode(), mapVO.getCityCode(),
"存在名称相同但基于不同关联城市的地图"); "存在名称相同但基于不同关联城市的地图");
if (Objects.nonNull(map3dDataVO)) { if (Objects.nonNull(map3dDataVO)) {

View File

@ -27,8 +27,8 @@ public class MaService {
@Getter @Getter
public static class Ma { public static class Ma {
public static final int Safety_Margin = 10; // 安全余量单位m public static final int Safety_Margin = 1; // 安全余量单位m
public static final int EB_Trigger = 20; // 紧急制动触发点偏移量单位m public static final int EB_Trigger = 3; // 紧急制动触发点偏移量单位m
public static final int Safety_Distance = 30; // 安全距离 单位m public static final int Safety_Distance = 30; // 安全距离 单位m
VirtualRealityTrain train; // 列车 VirtualRealityTrain train; // 列车

View File

@ -1,5 +1,6 @@
package club.joylink.rtss.simulation.cbtc.ATS.service; package club.joylink.rtss.simulation.cbtc.ATS.service;
import club.joylink.rtss.entity.PlanRouting;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.CI.CiApiService; import club.joylink.rtss.simulation.cbtc.CI.CiApiService;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
@ -157,9 +158,10 @@ public class AtsTrainService {
if (supervisedTrain.hasPositionAndDirection()) { if (supervisedTrain.hasPositionAndDirection()) {
Section phySection = repository.getByCode(supervisedTrain.getPhysicalSection(), Section.class); Section phySection = repository.getByCode(supervisedTrain.getPhysicalSection(), Section.class);
StationPlan nextPlan = null; StationPlan nextPlan = null;
List<StationPlan> planList = tripPlan.getPlanList();
if ((phySection.isTurnBackTrack() || phySection.isTransferTrack()) && supervisedTrain.isStop()) { if ((phySection.isTurnBackTrack() || phySection.isTransferTrack()) && supervisedTrain.isStop()) {
// 列车折返轨停车中判断以此折返轨为始端有没有到计划中的车站停车的路径单元 // 列车折返轨停车中判断以此折返轨为始端有没有到计划中的车站停车的路径单元
List<StationPlan> stationPlanList = tripPlan.getPlanList(); List<StationPlan> stationPlanList = planList;
for (StationPlan stationPlan : stationPlanList) { for (StationPlan stationPlan : stationPlanList) {
List<RoutePath> routePaths = repository.queryRoutePaths(phySection, stationPlan.getSection()); List<RoutePath> routePaths = repository.queryRoutePaths(phySection, stationPlan.getSection());
if (!CollectionUtils.isEmpty(routePaths)) { if (!CollectionUtils.isEmpty(routePaths)) {
@ -169,11 +171,13 @@ public class AtsTrainService {
} }
} else { } else {
// 列车不在折返轨停车判断列车目标区段是否在计划到站的站台轨中 // 列车不在折返轨停车判断列车目标区段是否在计划到站的站台轨中
String targetSection = supervisedTrain.getPlanStandTrack(); for (int i = planList.size() - 1; i >= 0; i--) {
Optional<StationPlan> filterPlan = tripPlan.getPlanList().stream() StationPlan stationPlan = planList.get(i);
.filter(plan -> plan.getSection().getCode().equals(targetSection)).limit(1).findFirst(); List<RoutePath> routePaths = repository.queryRoutePathsByEndAndContainsSection(stationPlan.getSection(), phySection);
if (filterPlan.isPresent()) { if (!CollectionUtils.isEmpty(routePaths)) {
nextPlan = filterPlan.get(); nextPlan = stationPlan;
break;
}
} }
} }
if (Objects.isNull(nextPlan)) { if (Objects.isNull(nextPlan)) {

View File

@ -1361,13 +1361,13 @@ public class RouteService {
section.routeLocking(route, right); section.routeLocking(route, right);
} }
} }
if (route.isOpen()) {
// 判断是否列车进入正常解锁 // 判断是否列车进入正常解锁
Section firstLogicSection = route.getFirstLogicSection(); Section firstLogicSection = route.getFirstLogicSection();
if (firstLogicSection.isCtOccupied() || firstLogicSection.isNctOccupied()) { if (firstLogicSection.isCtOccupied() || firstLogicSection.isNctOccupied()) {
this.normalUnlockStart(simulation, route); this.normalUnlockStart(simulation, route);
return; return;
} }
if (route.isOpen()) {
boolean interlocked = this.isInterlocked(route); boolean interlocked = this.isInterlocked(route);
if (!interlocked) { if (!interlocked) {
// 进路信号开放联锁逻辑不满足需关闭信号 // 进路信号开放联锁逻辑不满足需关闭信号

View File

@ -100,7 +100,7 @@ public class ATOService {
if (speedCurve == null) { if (speedCurve == null) {
return; return;
} }
// 更新目标距离和建议速度 // 更新目标距离
train.setTargetDistance(speedCurve.getTotalDistance()); train.setTargetDistance(speedCurve.getTotalDistance());
this.doControlBySpeedCurve(train, speedCurve, speedCurve.getTotalDistance()); this.doControlBySpeedCurve(train, speedCurve, speedCurve.getTotalDistance());
} }

View File

@ -26,48 +26,54 @@ public class TrainTargetUpdateService {
List<VirtualRealityTrain> onlineTrain = repository.getOnlineTrainList(); List<VirtualRealityTrain> onlineTrain = repository.getOnlineTrainList();
for (VirtualRealityTrain train : onlineTrain) { for (VirtualRealityTrain train : onlineTrain) {
Section target = train.getTarget(); Section target = train.getTarget();
if (target == null) {
continue;
}
TrainInfo trainInfo = repository.getSupervisedTrainByGroup(train.getGroupNumber()); TrainInfo trainInfo = repository.getSupervisedTrainByGroup(train.getGroupNumber());
Section newTarget; Section newTarget;
if (trainInfo.isManualTrain()) { // if (trainInfo.isManualTrain()) {
newTarget = this.queryArriveTarget4Manual(train); newTarget = this.queryArriveTarget4Manual(train, trainInfo, target);
} else { // } else {
if (train.isStop()) { // if (target == null) {
continue; // continue;
} // }
if (Objects.equals(target, train.getHeadPosition().getSection())) { // if (train.isStop()) {
continue; // continue;
} // }
newTarget = this.queryArriveTarget(train, target); // if (Objects.equals(target, train.getHeadPosition().getSection())) {
} // continue;
if (target.equals(newTarget)) { // }
continue; // newTarget = this.queryArriveTarget(train, target);
} else { // }
if (newTarget != null && !Objects.equals(target, newTarget)) {
train.setTarget(newTarget); train.setTarget(newTarget);
} }
} }
} }
private Section queryArriveTarget4Manual(VirtualRealityTrain train) { private Section queryArriveTarget4Manual(VirtualRealityTrain train, TrainInfo trainInfo, Section target) {
SectionPosition headPosition = train.getHeadPosition(); SectionPosition headPosition = train.getHeadPosition();
boolean right = train.isRight(); boolean right = train.isRight();
Section newTarget = target;
Section temp = headPosition.getSection(); Section temp = headPosition.getSection();
Section newTarget = temp;
for (int i = 0; i < 50; i++) { for (int i = 0; i < 50; i++) {
if (temp == null)
break;
if (!temp.isFunctionTrack()) {
temp = temp.getNextRunningSectionBaseRealSwitch(right);
continue;
}
Signal signal = temp.getSignalOf(right); Signal signal = temp.getSignalOf(right);
if (signal != null && !signal.isNormalOpen()) { if (signal != null && !signal.isNormalOpen()) {
newTarget = temp; newTarget = temp;
break; break;
} }
if ((temp.isNormalStandTrack() || temp.isTransferTrack()) && !temp.equals(headPosition.getSection())) { if ((temp.isNormalStandTrack() || temp.isTransferTrack()) && !train.isParkingAt()) {
if ((train.isParkingAt() && temp.isSameAxle(headPosition.getSection().getCode())) ||
headPosition.isAheadOf(temp.buildStopPointPosition(right), right)) {
continue;
}
newTarget = temp; newTarget = temp;
break; break;
} }
temp = temp.getNextRunningSectionBaseRealSwitch(right); temp = temp.getNextRunningSectionBaseRealSwitch(right);
if (temp == null)
break;
} }
return newTarget; return newTarget;
} }