This commit is contained in:
weizhihong 2022-06-14 18:44:06 +08:00
commit 6175a33da4
4 changed files with 87 additions and 10 deletions

View File

@ -43,13 +43,23 @@ public class CTCLogicLoop {
} }
public void sendMessage(Simulation simulation) { public void sendMessage(Simulation simulation) {
sendTrackViewMessage(simulation);
sendRouteSequenceMessage(simulation); sendRouteSequenceMessage(simulation);
} }
public void sendAllMessage(Simulation simulation) { public void sendAllMessage(Simulation simulation) {
sendAllTrackViewMessage(simulation);
sendAllRouteSequenceMessage(simulation); sendAllRouteSequenceMessage(simulation);
} }
private void sendAllTrackViewMessage(Simulation simulation) {
}
private void sendTrackViewMessage(Simulation simulation) {
}
private void sendAllRouteSequenceMessage(Simulation simulation) { private void sendAllRouteSequenceMessage(Simulation simulation) {
CtcRepository ctcRepository = simulation.getCtcRepository(); CtcRepository ctcRepository = simulation.getCtcRepository();
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();

View File

@ -78,9 +78,9 @@ public class CTCService {
* 发送发车预告 * 发送发车预告
*/ */
public void sendDepartureNotice(Simulation simulation, String stationCode, String runPlanCode) { public void sendDepartureNotice(Simulation simulation, String stationCode, String runPlanCode) {
CtcStationRunPlanLog currentStationPlan = getCtcStationRunPlan(simulation, stationCode, runPlanCode); CtcStationRunPlanLog currentStationPlan = getCtcStationRunPlanByRunPlanCode(simulation, stationCode, runPlanCode);
Station nextStation = currentStationPlan.getNextStation(); Station nextStation = currentStationPlan.getNextStation();
CtcStationRunPlanLog nextStationPlan = getCtcStationRunPlan(simulation, nextStation.getCode(), runPlanCode); CtcStationRunPlanLog nextStationPlan = getCtcStationRunPlanByRunPlanCode(simulation, nextStation.getCode(), runPlanCode);
currentStationPlan.sendDepartureNotice(); currentStationPlan.sendDepartureNotice();
nextStationPlan.receiveDepartureNotice(); nextStationPlan.receiveDepartureNotice();
} }
@ -89,9 +89,9 @@ public class CTCService {
* 同意发车预告 * 同意发车预告
*/ */
public void agreeDepartureNotice(Simulation simulation, String stationCode, String tripNumber) { public void agreeDepartureNotice(Simulation simulation, String stationCode, String tripNumber) {
CtcStationRunPlanLog currentStationPlan = getCtcStationRunPlan(simulation, stationCode, tripNumber); CtcStationRunPlanLog currentStationPlan = getCtcStationRunPlanByRunPlanCode(simulation, stationCode, tripNumber);
Station previousStation = currentStationPlan.getPreviousStation(); Station previousStation = currentStationPlan.getPreviousStation();
CtcStationRunPlanLog previousStationPlan = getCtcStationRunPlan(simulation, previousStation.getCode(), tripNumber); CtcStationRunPlanLog previousStationPlan = getCtcStationRunPlanByRunPlanCode(simulation, previousStation.getCode(), tripNumber);
currentStationPlan.finishReceivingNotice(); currentStationPlan.finishReceivingNotice();
previousStationPlan.finishDepartureNotice(); previousStationPlan.finishDepartureNotice();
} }
@ -105,13 +105,13 @@ public class CTCService {
line.setAutoTrigger(trigger); line.setAutoTrigger(trigger);
} }
private CtcStationRunPlanLog getCtcStationRunPlan(Simulation simulation, String stationCode, String runPlanCode) { private CtcStationRunPlanLog getCtcStationRunPlan(Simulation simulation, String stationCode, String tripNumber) {
CtcRepository ctcRepository = simulation.getCtcRepository();
return ctcRepository.getRunPlan(stationCode, tripNumber);
}
private CtcStationRunPlanLog getCtcStationRunPlanByRunPlanCode(Simulation simulation, String stationCode, String runPlanCode) {
CtcRepository ctcRepository = simulation.getCtcRepository(); CtcRepository ctcRepository = simulation.getCtcRepository();
return ctcRepository.getRunPlanByRunPlanCode(stationCode, runPlanCode); return ctcRepository.getRunPlanByRunPlanCode(stationCode, runPlanCode);
} }
private RouteSequence.Line getRouteSequenceLine(Simulation simulation, String stationCode, String tripNumber, boolean departure) {
CtcRepository ctcRepository = simulation.getCtcRepository();
return ctcRepository.getRouteSequenceLine(stationCode, tripNumber, departure);
}
} }

View File

@ -4,9 +4,70 @@ import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
@Getter @Getter
@Setter @Setter
@NoArgsConstructor @NoArgsConstructor
public class TrackViewVO { public class TrackViewVO {
private String stationCode;
private Map<String, TrackInfo> sectionAndTrackInfo;
class TrackInfo {
private boolean occupied;
private List<Line> lines;
}
class Line {
private String tripNumber;
private String trainType;
private String trainDistanceInfo;
private Process process;
private boolean receivingNotice;
private boolean receivingRouteLock;
private String receivingRouteCode;
private boolean receivingRouteAutoTrigger;
private boolean arrive;
private boolean departureNotice;
private boolean departureRouteLock;
private String departureRouteCode;
private boolean departureRouteAutoTrigger;
private boolean departure;
private LocalDateTime arriveTime;
private LocalDateTime departureTime;
private LocalDateTime planArriveTime;
private LocalDateTime planDepartureTime;
}
enum Process {
RECEIVING_BLOCK, //办理接车闭塞
RECEIVING, //准备接车
RECEIVING_ROUTE, //办理接车进路
ARRIVE, //列车到达通过报点
DEPARTURE_BLOCK, //办理发车闭塞
DEPARTURE_ROUTE, //发车进路办理
DEPARTURE, //发车报点
FINISH //流程终止
}
} }

View File

@ -31,6 +31,8 @@ import lombok.Setter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -98,8 +100,12 @@ public class SimulationBuilder {
loadDepotInOutRoutePath(simulation); loadDepotInOutRoutePath(simulation);
// CTC行车日志数据结构构建 // CTC行车日志数据结构构建
if (simulation.getRepository().getConfig().isHasCTC()) { if (simulation.getRepository().getConfig().isHasCTC()) {
LocalDateTime now = LocalDateTime.now();
buildCtcStationRunPlanLog(simulation, simulation.getRepository().getServiceTripsMap()); buildCtcStationRunPlanLog(simulation, simulation.getRepository().getServiceTripsMap());
System.out.println("CTC行车日志耗时" + Duration.between(now, LocalDateTime.now()).getSeconds());
now = LocalDateTime.now();
generateRouteSequence(simulation); generateRouteSequence(simulation);
System.out.println("CTC进路序列耗时" + Duration.between(now, LocalDateTime.now()).getSeconds());
} }
return simulation; return simulation;
} }