调整查询进路路径计算逻辑
修改列车站台控制逻辑兼容无出站信号机站台 修改其他发现bug
This commit is contained in:
parent
d8f15148c8
commit
c36f7ab639
@ -1938,6 +1938,9 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
|||||||
}
|
}
|
||||||
if (Objects.isNull(section)) {
|
if (Objects.isNull(section)) {
|
||||||
// 找到尽头也没有构成进路,异常
|
// 找到尽头也没有构成进路,异常
|
||||||
|
log.error(String.format("始端信号机[%s(%s)]:找到尽头也没有构成进路,所寻路径为[%s]",
|
||||||
|
startSignal.getName(), startSignal.getCode(),
|
||||||
|
tempPath.getSectionPathString()));
|
||||||
errorList.add(String.format("始端信号机[%s(%s)]:找到尽头也没有构成进路,所寻路径为[%s]",
|
errorList.add(String.format("始端信号机[%s(%s)]:找到尽头也没有构成进路,所寻路径为[%s]",
|
||||||
startSignal.getName(), startSignal.getCode(),
|
startSignal.getName(), startSignal.getCode(),
|
||||||
tempPath.getSectionPathString()));
|
tempPath.getSectionPathString()));
|
||||||
|
@ -768,7 +768,7 @@ public class RouteService {
|
|||||||
if (!CollectionUtils.isEmpty(standTracks)) {
|
if (!CollectionUtils.isEmpty(standTracks)) {
|
||||||
for (Section standTrack : standTracks) {
|
for (Section standTrack : standTracks) {
|
||||||
List<Stand> standList = standTrack.getStandList();
|
List<Stand> standList = standTrack.getStandList();
|
||||||
if (standList.stream().anyMatch(stand -> !stand.getPsd().isCloseAndLock()))
|
if (standList.stream().anyMatch(stand -> stand.getPsd() != null && !stand.getPsd().isCloseAndLock()))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -639,11 +639,34 @@ public class CalculateService {
|
|||||||
|
|
||||||
public static List<RoutePath> queryRoutePathsOnDirection(Section start, Section end, Boolean right) {
|
public static List<RoutePath> queryRoutePathsOnDirection(Section start, Section end, Boolean right) {
|
||||||
List<RoutePath> list = new ArrayList<>();
|
List<RoutePath> list = new ArrayList<>();
|
||||||
Signal signal;
|
Signal signal = null;
|
||||||
if (start.isSwitchTrack()) {
|
// if (start.isSwitchTrack()) {
|
||||||
signal = start.querySwitchSectionRelatedSignalByDirection(right);
|
// signal = start.querySwitchSectionRelatedSignalByDirection(right);
|
||||||
} else {
|
// } else {
|
||||||
signal = start.getSignalOf(right);
|
// signal = start.getSignalOf(right);
|
||||||
|
// }
|
||||||
|
Section section = start;
|
||||||
|
int rc = 0;
|
||||||
|
while (signal == null && rc < 20) {
|
||||||
|
++rc;
|
||||||
|
if (section == null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
signal = section.getSignalOf(right);
|
||||||
|
if (signal != null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Section sectionOf = section.getSectionOf(!right);
|
||||||
|
if (sectionOf != null) {
|
||||||
|
section = sectionOf;
|
||||||
|
} else if (sectionOf == null && section.isSwitchTrack()) {
|
||||||
|
Switch relSwitch = section.getRelSwitch();
|
||||||
|
if (relSwitch.isA(section)) {
|
||||||
|
section = relSwitch.getB();
|
||||||
|
} else {
|
||||||
|
section = relSwitch.getA();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
RoutePath routePath = new RoutePath(start, end, right);
|
RoutePath routePath = new RoutePath(start, end, right);
|
||||||
getRoutePaths(signal, right, end, 1, routePath, list);
|
getRoutePaths(signal, right, end, 1, routePath, list);
|
||||||
@ -655,7 +678,7 @@ public class CalculateService {
|
|||||||
if (Objects.isNull(signal)) {
|
if (Objects.isNull(signal)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (iter > 8) {
|
if (iter > 20) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
routePath.addSignal(signal);
|
routePath.addSignal(signal);
|
||||||
|
@ -219,14 +219,17 @@ public class ATPLogicLoop {
|
|||||||
case CLOSE_DOOR: // 关门
|
case CLOSE_DOOR: // 关门
|
||||||
Signal signal = train.getHeadPosition().getSection().getSignalOf(train.isRight());
|
Signal signal = train.getHeadPosition().getSection().getSignalOf(train.isRight());
|
||||||
if (!train.isHold()) { // 列车未扣车
|
if (!train.isHold()) { // 列车未扣车
|
||||||
if ((Objects.nonNull(signal) && signal.isNormalOpen()) ||
|
if (Objects.nonNull(signal) && !signal.isNormalOpen()) {
|
||||||
(train.isRMMode() || train.isNRMMode())) { // 进路信号机正常开放 或 列车为RM/NRM
|
if (!train.isRMMode() && !train.isNRMMode()) {
|
||||||
// 可以关门
|
// 信号机未正常开放
|
||||||
this.ATOService.syncCloseDoor(simulation, train);
|
break;
|
||||||
if (this.isAllDoorClose(simulation, train)) {
|
|
||||||
train.nextParkedTrainActivity();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 可以关门
|
||||||
|
this.ATOService.syncCloseDoor(simulation, train);
|
||||||
|
if (this.isAllDoorClose(simulation, train)) {
|
||||||
|
train.nextParkedTrainActivity();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case START: // 准备出发
|
case START: // 准备出发
|
||||||
@ -620,9 +623,8 @@ public class ATPLogicLoop {
|
|||||||
if (tailSection.isNormalStandTrack() &&
|
if (tailSection.isNormalStandTrack() &&
|
||||||
Objects.equals(nextStation, tailSection.getStation())) {
|
Objects.equals(nextStation, tailSection.getStation())) {
|
||||||
// 列车尾部在计划的下一站台轨
|
// 列车尾部在计划的下一站台轨
|
||||||
Signal signal = tailSection.getSignalOf(right); // 出站信号机
|
SectionPosition standEndPosition = new SectionPosition(tailSection, right ? tailSection.getLen() : 0);
|
||||||
SectionPosition signalPosition = new SectionPosition(signal.getSection(), signal.getOffset());
|
Float distance = CalculateService.calculateDistance(standEndPosition, headPosition, right);
|
||||||
Float distance = CalculateService.calculateDistance(signalPosition, headPosition, right);
|
|
||||||
if (Objects.nonNull(distance) && distance > 5) {
|
if (Objects.nonNull(distance) && distance > 5) {
|
||||||
// 列车成功越站
|
// 列车成功越站
|
||||||
this.atsApiService.handleTrainPassingStation(simulation, train.getGroupNumber(),
|
this.atsApiService.handleTrainPassingStation(simulation, train.getGroupNumber(),
|
||||||
|
@ -100,7 +100,9 @@ public class PassengerFlowSimulateService {
|
|||||||
if(Objects.isNull(group2mapPassengerFlowID.get(simulation.getGroup()))){
|
if(Objects.isNull(group2mapPassengerFlowID.get(simulation.getGroup()))){
|
||||||
//查询默认的数据
|
//查询默认的数据
|
||||||
passengerFlowData = this.mapPassengerFlowDataService.queryPassengerFlowDataOfMap(mapId,null);
|
passengerFlowData = this.mapPassengerFlowDataService.queryPassengerFlowDataOfMap(mapId,null);
|
||||||
group2mapPassengerFlowID.put(simulation.getGroup(),passengerFlowData.getId());
|
if (passengerFlowData != null) {
|
||||||
|
group2mapPassengerFlowID.put(simulation.getGroup(),passengerFlowData.getId());
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
//根据id查询数据
|
//根据id查询数据
|
||||||
passengerFlowData = this.mapPassengerFlowDataService.queryPassengerFlowDataOfMap(mapId,group2mapPassengerFlowID.get(simulation.getGroup()));
|
passengerFlowData = this.mapPassengerFlowDataService.queryPassengerFlowDataOfMap(mapId,group2mapPassengerFlowID.get(simulation.getGroup()));
|
||||||
|
Loading…
Reference in New Issue
Block a user