增加<回库>指令;非计划车不会自动回库;设置头码车时会清空ats待触发进路;设置头码车时会更新计划区段;

This commit is contained in:
joylink_zhangsai 2021-08-12 15:04:49 +08:00
parent 8d217cfae1
commit 9bf2b2ded6
8 changed files with 44 additions and 13 deletions

View File

@ -2,6 +2,7 @@ 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.ATS.service.stage.AtsHeadTrainStageService;
import club.joylink.rtss.simulation.cbtc.ATS.service.stage.AtsPlanTrainStageService;
import club.joylink.rtss.simulation.cbtc.CI.CiApiService;
import club.joylink.rtss.simulation.cbtc.Simulation;
@ -58,6 +59,9 @@ public class AtsTrainService {
@Autowired
private AtsPlanTrainStageService atsPlanTrainStageService;
@Autowired
private AtsHeadTrainStageService atsHeadTrainStageService;
/**
* 添加列车追踪
*
@ -332,6 +336,7 @@ public class AtsTrainService {
needParking = false;
}
supervisedTrain.change2HeadCode(destinationCode, serviceNumber, tripNumber);
atsHeadTrainStageService.updatePlanSection(simulation, supervisedTrain);
this.onboardAtpApiService.update2HeadTrainServiceNumber(simulation, groupNumber, serviceNumber, tripNumber, destinationCode, needParking);
supervisedTrain.updateEstimatedArriveInfo(null, null);
}

View File

@ -40,16 +40,12 @@ public class AtsHeadTrainStageService implements AtsStageService {
@Override
public void handleTransferTrackParking(Simulation simulation, TrainInfo trainInfo, Section parkSection) {
Boolean right = trainInfo.getRight();
if (right == null)
return;
SimulationDataRepository repository = simulation.getRepository();
DestinationCodeDefinition dcd = repository.findDestinationCodeDefinition(trainInfo.getDestinationCode());
if (dcd == null)
return;
if (Objects.equals(dcd.getSection(), parkSection)) {
// 列车到达目的地
trainInfo.finishPlanPrepareInbound();
handleArriveDestination(simulation, trainInfo);
} else {
this.updatePlanSection(simulation, trainInfo);
@ -95,7 +91,7 @@ public class AtsHeadTrainStageService implements AtsStageService {
}
}
private void updatePlanSection(Simulation simulation, TrainInfo trainInfo) {
public void updatePlanSection(Simulation simulation, TrainInfo trainInfo) {
boolean planRight = trainInfo.getHctPath().isRight();
SimulationDataRepository repository = simulation.getRepository();
SectionPosition headPosition = repository.buildHeadPositionOfTrainInfo(trainInfo);

View File

@ -31,9 +31,7 @@ public class AtsManualTrainStageService implements AtsStageService {
if (routePathList.get(0).isRight() == trainInfo.getRight().booleanValue()) {
in = true;
}
if (in) {
trainInfo.finishPlanPrepareInbound();
} else { // 出库查询计划是否此轨道有出库计划
if (!in) { // 出库查询计划是否此轨道有出库计划
if (simulation.isPlanRunning()) {
this.checkAndApplyTripPlan(simulation, trainInfo, parkSection);
}

View File

@ -40,7 +40,10 @@ public class AtsPlanTrainStageService implements AtsStageService {
public void handleTransferTrackParking(Simulation simulation, TrainInfo trainInfo, Section parkSection) {
SimulationDataRepository repository = simulation.getRepository();
TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(), trainInfo.getTripNumber());
if (tripPlan.getEndSection().equals(parkSection) ||
List<RoutePath> routePathList = repository.queryRoutePathsByEnd(parkSection);
if (routePathList.get(0).isRight() == trainInfo.getRight()) { //准备回库
trainInfo.finishPlanPrepareInbound();
} else if (tripPlan.getEndSection().equals(parkSection) ||
tripPlan.getEndSection().getStation().equals(parkSection.getStation())) {
// 列车到达计划终点准备回库
trainInfo.finishPlanPrepareInbound();

View File

@ -60,10 +60,6 @@ public class AtsTrainStageHandler {
AtsStageService stageService = this.getStageService(trainInfo);
if (parkSection.isTransferTrack()) { // 转换轨
stageService.handleTransferTrackParking(simulation, trainInfo, parkSection);
List<RoutePath> routePathList = repository.queryRoutePathsByEnd(parkSection);
if (routePathList.get(0).isRight() == trainInfo.getRight()) { //准备回库
trainInfo.finishPlanPrepareInbound();
}
} else if (parkSection.isNormalStandTrack()) { // 正常站台轨
stageService.handleNormalStandParking(simulation, trainInfo, parkSection);
List<Stand> standList = parkSection.getStandList();

View File

@ -5,11 +5,14 @@ import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.constant.DriveMode;
import club.joylink.rtss.simulation.cbtc.constant.RunLevel;
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
import club.joylink.rtss.simulation.cbtc.data.map.Section;
import club.joylink.rtss.simulation.cbtc.data.map.Signal;
import club.joylink.rtss.simulation.cbtc.data.map.Stand;
import club.joylink.rtss.simulation.cbtc.data.map.Switch;
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.vo.TrainInfo;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
@ -586,6 +589,31 @@ public class CommandBO {
return buildDriverAtoOpenOperationStep(train.getGroupNumber());
}
}
},
/** 回库 */
Inbound(List.of(), SimulationMember.Type.DRIVER) {
@Override
public List<Step> buildStepList(Simulation simulation, SimulationMember targetMember, Map<String, Object> params) {
return List.of();
}
@Override
public Step executeOrReturnStep(Simulation simulation, CommandBO command) {
SimulationMember driver = command.getTargetMember();
driver.setCommand(null);
VirtualRealityTrain train = (VirtualRealityTrain) driver.getDevice();
Section headSection = train.getHeadPosition().getSection();
if (headSection.isTransferTrack() && train.isStop()) { //列车停在折返轨
SimulationDataRepository repository = simulation.getRepository();
TrainInfo trainInfo = repository.getSupervisedTrainByGroup(train.getGroupNumber());
List<RoutePath> routePathList = repository.queryRoutePathsByEnd(headSection);
if (routePathList.get(0).isRight() == trainInfo.getRight()) { //准备回库
trainInfo.finishPlanPrepareInbound();
}
}
return null;
}
}
;

View File

@ -1144,6 +1144,8 @@ public class Section extends MayOutOfOrderDevice {
@Override
public void fix(MayOutOfOrderDevice device) {
Section section = (Section) device;
if (this != section.getFault())
return;
if (!section.isAxleCounter()) {
section = section.getParent();
}
@ -1224,6 +1226,8 @@ public class Section extends MayOutOfOrderDevice {
@Override
public void fix(MayOutOfOrderDevice device) {
Section section = (Section) device;
if (this != section.getFault())
return;
List<Section> sections;
if (!section.isAxleCounter()) {
if (section.getParent() != null && section.getParent().isAxleCounter()) {

View File

@ -556,6 +556,7 @@ public class TrainInfo extends MapElement {
this.planRoutingType = null;
this.type = TrainType.HEAD;
this.routing = null;
this.atsTriggerRouteMap.clear();
}
public void frontTurnBackStart() {