修改按计划行车的进路办理、解锁逻辑

This commit is contained in:
joylink_zhangsai 2021-10-08 15:53:18 +08:00
parent 3a52cbc4e4
commit 3364b096f5
2 changed files with 35 additions and 4 deletions

View File

@ -3,6 +3,7 @@ package club.joylink.rtss.simulation.cbtc.ATS.service;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.ATP.ground.MaService; import club.joylink.rtss.simulation.cbtc.ATP.ground.MaService;
import club.joylink.rtss.simulation.cbtc.ATS.service.ars.AtsRouteSelectService; import club.joylink.rtss.simulation.cbtc.ATS.service.ars.AtsRouteSelectService;
import club.joylink.rtss.simulation.cbtc.CI.CiApiService;
import club.joylink.rtss.simulation.cbtc.CI.CiLogic; import club.joylink.rtss.simulation.cbtc.CI.CiLogic;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.SimulationLifeCycleService; import club.joylink.rtss.simulation.cbtc.SimulationLifeCycleService;
@ -69,6 +70,9 @@ public class AtsTrainLoadService {
@Qualifier("atsPlanTrainRouteSelectServiceImpl") @Qualifier("atsPlanTrainRouteSelectServiceImpl")
private AtsRouteSelectService atsRouteSelectService; private AtsRouteSelectService atsRouteSelectService;
@Autowired
private CiApiService ciApiService;
public int getGivenTimeCouldLoadedTrainNumber(Simulation simulation, LocalTime time) { public int getGivenTimeCouldLoadedTrainNumber(Simulation simulation, LocalTime time) {
List<TrainLoadParam2> list = this.getCurrentAllNeedLoadTrain(simulation, time); List<TrainLoadParam2> list = this.getCurrentAllNeedLoadTrain(simulation, time);
return list.size(); return list.size();
@ -438,10 +442,17 @@ public class AtsTrainLoadService {
SimulationDataRepository repository = simulation.getRepository(); SimulationDataRepository repository = simulation.getRepository();
for (TrainInfo trainInfo : repository.getSuperviseTrainList()) { for (TrainInfo trainInfo : repository.getSuperviseTrainList()) {
VirtualRealityTrain train = repository.getOnlineTrainBy(trainInfo.getGroupNumber()); VirtualRealityTrain train = repository.getOnlineTrainBy(trainInfo.getGroupNumber());
if (train.isStop())
continue;
//筛选其它进路 //筛选其它进路
Route route = atsRouteSelectService.select(simulation, trainInfo); Route route = atsRouteSelectService.select(simulation, trainInfo);
if (route == null) if (route == null)
continue; continue;
if (route.getStart().getSection().getCode().equals(trainInfo.getPlanStandTrack())) //进路始端信号机所在区段是列车的计划区段
continue;
Route.CheckFailMessage checkFailMessage = ciApiService.routeSettingCheck(simulation, route.getCode());
if (checkFailMessage != null)
continue;
VirtualRealityTrain thatTrain = map.get(route); VirtualRealityTrain thatTrain = map.get(route);
if (thatTrain != null) { if (thatTrain != null) {
if (train.isRight() == thatTrain.isRight()) { if (train.isRight() == thatTrain.isRight()) {
@ -653,10 +664,11 @@ public class AtsTrainLoadService {
if (Objects.nonNull(route)) { if (Objects.nonNull(route)) {
// 排列好进路 // 排列好进路
this.deviceStatusModifyTool.openRouteDirect(simulation, route); this.deviceStatusModifyTool.openRouteDirect(simulation, route);
// 根据列车位置直接进路正常解锁
this.deviceStatusModifyTool.routeUnlockByEndSection(route, tailPosition);
// 进路设置为正常解锁 // 进路设置为正常解锁
this.ciLogic.trainUnlockStart(simulation, route); this.ciLogic.trainUnlockStart(simulation, route);
// // 根据列车位置直接进路正常解锁 route.setUnlockedSection(tailPosition.getSection());
// this.deviceStatusModifyTool.routeUnlockByEndSection(route, tailPosition.getSection());
break; break;
} }
} }

View File

@ -7,6 +7,7 @@ import club.joylink.rtss.simulation.cbtc.constant.SignalAspect;
import club.joylink.rtss.simulation.cbtc.constant.SwitchIndication; import club.joylink.rtss.simulation.cbtc.constant.SwitchIndication;
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
import club.joylink.rtss.simulation.cbtc.data.map.*; import club.joylink.rtss.simulation.cbtc.data.map.*;
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySignal; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySignal;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch;
import club.joylink.rtss.simulation.cbtc.device.virtual.VirtualRealityDeviceService; import club.joylink.rtss.simulation.cbtc.device.virtual.VirtualRealityDeviceService;
@ -16,6 +17,7 @@ import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@ -204,9 +206,9 @@ public class DeviceStatusModifyTool {
/** /**
* 直接根据最后一根区段解锁进路 * 直接根据最后一根区段解锁进路
* @param route * @param route
* @param endOccupied
*/ */
public void routeUnlockByEndSection(Route route, Section endOccupied) { public void routeUnlockByEndSection(Route route, SectionPosition tailPosition) {
Section endOccupied = tailPosition.getSection();
if (!route.isRouteSection(endOccupied)) { if (!route.isRouteSection(endOccupied)) {
// 不是进路区段不解锁 // 不是进路区段不解锁
return; return;
@ -216,6 +218,23 @@ public class DeviceStatusModifyTool {
List<Section> sectionList = route.getSectionList(); List<Section> sectionList = route.getSectionList();
for (Section section : sectionList) { for (Section section : sectionList) {
if (section.isSamePhysical(endOccupied.getCode())) { if (section.isSamePhysical(endOccupied.getCode())) {
if (!CollectionUtils.isEmpty(section.getLogicList())) {
// 逻辑区段占用根据逻辑区段占用位置解锁
List<Section> logicList = section.getLogicList();
if (!right) { // 向左逻辑区段列表reverse
logicList = new ArrayList<>(section.getLogicList());
Collections.reverse(logicList);
}
Section logicSection = tailPosition.getLogicSection();
for (Section logic : logicList) {
if (logic.equals(logicSection)) {
break;
} else {
logic.routeUnlocking(route);
logic.overlapUnlocking();
}
}
}
break; break;
} }
// 直接解锁区段 // 直接解锁区段