修改:判断抢路逻辑(西安三问题29)

This commit is contained in:
joylink_zhangsai 2021-06-10 15:59:13 +08:00
parent d7b0e8c065
commit 96af0971ec

View File

@ -3,12 +3,10 @@ package club.joylink.rtss.simulation.cbtc.ATS.service;
import club.joylink.rtss.simulation.cbtc.CI.CiApiService;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.constant.DriveMode;
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
import club.joylink.rtss.simulation.cbtc.data.map.*;
import club.joylink.rtss.simulation.cbtc.data.plan.StationPlan;
import club.joylink.rtss.simulation.cbtc.data.plan.TripPlan;
import club.joylink.rtss.simulation.cbtc.data.status.DeviceStatus;
import club.joylink.rtss.simulation.cbtc.data.support.RoutePath;
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
import club.joylink.rtss.simulation.cbtc.data.support.StationTurnBackStrategyOption;
@ -288,8 +286,8 @@ public class AtsRouteSettingService {
// 处理站前折返的进路排列
routePaths = repository.queryRoutePaths(trainSection, nextSection);
} else if (train.isStop() && !trainSection.isNormalStandTrack() && (trainSection.isTurnBackTrack())) { // 折返轨停车
// 判断从当前时间到折返后下一计划到站时间中是否存在出库的冲突计划
if (this.containsConflictOutBoundPlan(simulation, tripPlan)) {
// 判断从当前时间到折返后下一计划到站时间中是否存在冲突计划
if (this.containsConflictPlan(simulation, tripPlan)) {
log.debug(String.format("折返与出库冲突,不排列"));
return null;
}
@ -346,11 +344,12 @@ public class AtsRouteSettingService {
* @param tripPlan
* @return
*/
private boolean containsConflictOutBoundPlan(Simulation simulation, TripPlan tripPlan) {
private boolean containsConflictPlan(Simulation simulation, TripPlan tripPlan) {
LocalTime current = simulation.getSystemTime().toLocalTime();
LocalTime arriveTime = tripPlan.getFirstStationPlan().getArriveTime();
SimulationDataRepository repository = simulation.getRepository();
// 判断是否有冲突的出库计划
if (tripPlan.isTurnBack()) {
SimulationDataRepository repository = simulation.getRepository();
LocalTime arriveTime = tripPlan.getFirstStationPlan().getArriveTime();
if (current.isAfter(arriveTime)) {
return false;
}
@ -362,11 +361,10 @@ public class AtsRouteSettingService {
}
}
}
StationPlan stationPlan = repository.queryStationPlanBetween(tripPlan.getPlanList().get(0).getStation(), current, arriveTime);
if (stationPlan != null)
return true;
}
return false;
// 判断是否有冲突的运行计划
StationPlan stationPlan = repository.queryStationPlanBetween(tripPlan.getPlanList().get(0).getStation(), current, arriveTime);
return stationPlan != null;
}
private Route selectRouteOfPaths(Simulation simulation, TrainInfo train,