修改大铁CTC流程
This commit is contained in:
parent
d95dbe982f
commit
318ccb915e
@ -25,6 +25,7 @@ import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class CTCLogicLoop {
|
||||
@ -106,6 +107,8 @@ public class CTCLogicLoop {
|
||||
Section receivingSection = receivingPlan.getSection();
|
||||
VirtualRealityTrain train = repository.getOnlineTrainBy(ctcStationPlan.getTrainInfo().getGroupNumber());
|
||||
SectionPosition headPosition = train.getHeadPosition();
|
||||
//轨道占用
|
||||
ctcStationPlan.setReceivingSectionOccupied(receivingSection.isOccupied());
|
||||
//发点
|
||||
Signal departureSignal = receivingSection.getSignalOf(planRight); //发车信号机
|
||||
if (headPosition.isAheadOf(departureSignal.getPosition(), planRight)) {
|
||||
@ -120,7 +123,7 @@ public class CTCLogicLoop {
|
||||
Route departureRoute = ctcStationPlan.getDepartureRoute();
|
||||
if (departureRoute.isLock()) {
|
||||
ctcStationPlan.setDepartureRouteLock(true);
|
||||
} else if (ctcStationPlan.isDepartureRouteAutoTrigger()){
|
||||
} else if (ctcStationPlan.isDepartureRouteAutoTrigger()) {
|
||||
if (systemTime.isAfter(ctcStationPlan.getReceivingPlan().getLeaveTime())) { //晚于发车时间
|
||||
ciApiService.settingRoute(simulation, departureRoute.getCode());
|
||||
}
|
||||
@ -130,11 +133,13 @@ public class CTCLogicLoop {
|
||||
ctcStationPlan.updateProcess(CtcStationPlan.Process.DEPARTURE);
|
||||
}
|
||||
//发预
|
||||
if (ctcStationPlan.isDepartureNotice() && ctcStationPlan.getDeparturePlan() != null) { //邻站发车预告
|
||||
if (ctcStationPlan.isDepartureNotice()) {
|
||||
ctcStationPlan.updateProcess(CtcStationPlan.Process.DEPARTURE_ROUTE);
|
||||
CtcStationPlan departureCtcStationPlan = ctcRepository
|
||||
.getCtcStationPlan(ctcStationPlan.getDeparturePlan().getStation().getCode(), ctcStationPlan.getTripNumber());
|
||||
departureCtcStationPlan.updateProcess(CtcStationPlan.Process.RECEIVING);
|
||||
if (ctcStationPlan.getDeparturePlan() != null) { //邻站发车预告
|
||||
CtcStationPlan departureCtcStationPlan = ctcRepository
|
||||
.getCtcStationPlan(ctcStationPlan.getDeparturePlan().getStation().getCode(), ctcStationPlan.getTripNumber());
|
||||
departureCtcStationPlan.updateProcess(CtcStationPlan.Process.RECEIVING);
|
||||
}
|
||||
}
|
||||
//到点
|
||||
if (ctcStationPlan.getTrainInfo().isParkingAt(receivingPlan.getSection())) {
|
||||
@ -178,10 +183,12 @@ public class CTCLogicLoop {
|
||||
TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(), trainInfo.getTripNumber());
|
||||
VirtualRealityTrain train = repository.getOnlineTrainBy(trainInfo.getGroupNumber());
|
||||
StationPlan stationPlan = tripPlan.queryStationPlanByStationCode(trainInfo.getStationCode());
|
||||
Section previousSection = train.getHeadPosition().getSection(); //前一个的停车区段
|
||||
Section headSection = train.getHeadPosition().getSection();
|
||||
while (stationPlan != null) {
|
||||
Section headSection = train.getHeadPosition().getSection();
|
||||
List<RoutePath> paths = repository.queryRoutePathsByEndAndContainsSection(stationPlan.getSection(), previousSection);
|
||||
List<RoutePath> paths = repository.queryRoutePathsByEndAndContainsSection(stationPlan.getSection(), headSection);
|
||||
if (!CollectionUtils.isEmpty(paths)) {
|
||||
paths = paths.stream().filter(routePath -> Objects.equals(routePath.isRight(), tripPlan.isRight())).collect(Collectors.toList());
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(paths)) {
|
||||
CtcStationPlan ctcStationPlan = new CtcStationPlan(trainInfo, stationPlan);
|
||||
ctcRepository.addCtcStationPlan(ctcStationPlan);
|
||||
@ -192,7 +199,7 @@ public class CTCLogicLoop {
|
||||
ctcStationPlan.setArrive(true);
|
||||
ctcStationPlan.updateProcess(CtcStationPlan.Process.DEPARTURE_BLOCK);
|
||||
} else { //没到站
|
||||
RoutePath routePath = atsRouteSelectService.selectRoutePath(paths);
|
||||
RoutePath routePath = selectRoutePath(paths);
|
||||
Route receivingRoute = routePath.getLastRoute();
|
||||
ctcStationPlan.setReceivingRoute(receivingRoute);
|
||||
ctcStationPlan.updateProcess(CtcStationPlan.Process.RECEIVING_BLOCK);
|
||||
@ -206,17 +213,21 @@ public class CTCLogicLoop {
|
||||
} else {
|
||||
routePaths = repository.getRoutePaths(stationPlan.getSection(), tripPlan.getEndSection());
|
||||
}
|
||||
RoutePath routePath = atsRouteSelectService.selectRoutePath(routePaths);
|
||||
RoutePath routePath = selectRoutePath(routePaths);
|
||||
Route departureRoute = routePath.getFirstRoute();
|
||||
ctcStationPlan.setDepartureRoute(departureRoute);
|
||||
}
|
||||
previousSection = stationPlan.getSection();
|
||||
stationPlan = tripPlan.queryNextStationPlan(stationPlan.getStation());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public RoutePath selectRoutePath(List<RoutePath> routePaths) {
|
||||
Optional<RoutePath> min = routePaths.stream().min((rp1, rp2) -> rp1.getReverseSwitchQuantity() < rp2.getReverseSwitchQuantity() ? -1 : 1);
|
||||
return min.orElse(null);
|
||||
}
|
||||
|
||||
public void addJobs(Simulation simulation) {
|
||||
simulation.addJob(NAME, () -> this.run(simulation), RATE);
|
||||
}
|
||||
|
@ -25,6 +25,11 @@ public class CtcStationPlan {
|
||||
*/
|
||||
private StationPlan departurePlan;
|
||||
|
||||
/**
|
||||
* 接车股道占用
|
||||
*/
|
||||
private boolean receivingSectionOccupied;
|
||||
|
||||
private boolean receivingNotice;
|
||||
|
||||
private Route receivingRoute;
|
||||
|
@ -20,10 +20,15 @@ public class TrackView {
|
||||
@Setter
|
||||
public static class Line {
|
||||
/**
|
||||
* 轨道名
|
||||
* 股道名
|
||||
*/
|
||||
private String trackName;
|
||||
|
||||
/**
|
||||
* 股道占用
|
||||
*/
|
||||
private boolean occupied;
|
||||
|
||||
/**
|
||||
* 车次号
|
||||
*/
|
||||
@ -89,6 +94,7 @@ public class TrackView {
|
||||
|
||||
public Line(CtcStationPlan plan) {
|
||||
this.trackName = plan.getReceivingPlan().getSection().getName();
|
||||
this.occupied = plan.isReceivingSectionOccupied();
|
||||
this.tripNumber = plan.getTripNumber();
|
||||
// this.trainType =
|
||||
// this.trainDistanceInfo
|
||||
|
Loading…
Reference in New Issue
Block a user