修改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),
String.format("地图名称为[%s]的发布地图数据不存在", mapVO.getName()));
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(),
"存在名称相同但基于不同关联城市的地图");
if (Objects.nonNull(map3dDataVO)) {

View File

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

View File

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

View File

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

View File

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

View File

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