Compare commits

..

No commits in common. "local-test" and "master" have entirely different histories.

8 changed files with 788 additions and 911 deletions

View File

@ -46,14 +46,7 @@ public class SortDiagramStation {
private Station findNotDepotStation(boolean isRight, int index) { private Station findNotDepotStation(boolean isRight, int index) {
Station station = null; Station station = stationList.get(index);
if (index >= stationList.size()) {
station = stationList.get(stationList.size() - 1);
} else if (index <= 0) {
station = stationList.get(0);
} else {
station = stationList.get(index);
}
while (station.isDepot()) { while (station.isDepot()) {
index += isRight ? -1 : 1; index += isRight ? -1 : 1;
station = stationList.get(index); station = stationList.get(index);

View File

@ -32,7 +32,6 @@ public abstract class AtsRouteSelectService {
* 查询需要触发的进路 * 查询需要触发的进路
* *
* @param simulation * @param simulation
* @param targetList 运行计划中的计划区段包含站后折返轨
* @param turnBackSection 站后折返的折返轨 * @param turnBackSection 站后折返的折返轨
* @return * @return
*/ */
@ -64,18 +63,13 @@ public abstract class AtsRouteSelectService {
MapConfig config = repository.getConfig(); MapConfig config = repository.getConfig();
if (!config.isSignalOpenAfterParking() || (headSection.equals(planSection) if (!config.isSignalOpenAfterParking() || (headSection.equals(planSection)
&& trainInfo.isParking())) { //不需要停站就可以开放信号机或者已经在计划区段停站可以继续向前办理进路 && trainInfo.isParking())) { //不需要停站就可以开放信号机或者已经在计划区段停站可以继续向前办理进路
//根据车站折返策略处理 if (nextPlanSection != null) { //计划区段路径未跑完
Station station = planSection.getStation();
if (station.getTbStrategyId() != null && Objects.equals(turnBackSection,
nextPlanSection)) { //有折返策略时按折返策略
return queryTriggerRoutes4TurnBack(simulation, planSection, turnBackSection, trainInfo);
} else if (nextPlanSection != null) { //无折返策略按计划
routePaths = repository.queryRoutePaths(planSection, nextPlanSection); routePaths = repository.queryRoutePaths(planSection, nextPlanSection);
if (!CollectionUtils.isEmpty(routePaths)) { if (!CollectionUtils.isEmpty(routePaths)) {
return this.queryTriggerRoutesOfRoutePath(repository, trainInfo, routePaths, return this.queryTriggerRoutesOfRoutePath(repository, trainInfo, routePaths,
nextPlanSection).getRoute(); nextPlanSection).getRoute();
} }
} else if (turnBackSection != null) { } else if (turnBackSection != null) { //站后折返
return queryTriggerRoutes4TurnBack(simulation, planSection, turnBackSection, trainInfo); return queryTriggerRoutes4TurnBack(simulation, planSection, turnBackSection, trainInfo);
} }
} }

View File

@ -5,26 +5,23 @@ import club.joylink.rtss.simulation.cbtc.ATS.service.AtsStandService;
import club.joylink.rtss.simulation.cbtc.ATS.service.AtsTrainService; import club.joylink.rtss.simulation.cbtc.ATS.service.AtsTrainService;
import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository; import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
import club.joylink.rtss.simulation.cbtc.data.map.MapConfig; import club.joylink.rtss.simulation.cbtc.data.map.*;
import club.joylink.rtss.simulation.cbtc.data.map.Route;
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.plan.StationPlan; 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.plan.TripPlan;
import club.joylink.rtss.simulation.cbtc.data.support.RoutePath; import club.joylink.rtss.simulation.cbtc.data.support.RoutePath;
import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo; import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo;
import club.joylink.rtss.simulation.cbtc.onboard.ATP.OnboardAtpApiService; import club.joylink.rtss.simulation.cbtc.onboard.ATP.OnboardAtpApiService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.LocalTime; import java.time.LocalTime;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
/** /**
* 计划车阶段处理服务 * 计划车阶段处理服务
@ -32,7 +29,6 @@ import org.springframework.util.CollectionUtils;
@Slf4j @Slf4j
@Component @Component
public class AtsPlanTrainStageService implements AtsStageService { public class AtsPlanTrainStageService implements AtsStageService {
@Autowired @Autowired
private AtsRealRunRecordService realRunRecordService; private AtsRealRunRecordService realRunRecordService;
@Autowired @Autowired
@ -43,11 +39,9 @@ public class AtsPlanTrainStageService implements AtsStageService {
private AtsTrainService atsTrainService; private AtsTrainService atsTrainService;
@Override @Override
public void handleTransferTrackParking(Simulation simulation, TrainInfo trainInfo, public void handleTransferTrackParking(Simulation simulation, TrainInfo trainInfo, Section parkSection) {
Section parkSection) {
SimulationDataRepository repository = simulation.getRepository(); SimulationDataRepository repository = simulation.getRepository();
TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(), TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(), trainInfo.getTripNumber());
trainInfo.getTripNumber());
// List<RoutePath> routePathList = repository.queryRoutePathsByEnd(parkSection); // List<RoutePath> routePathList = repository.queryRoutePathsByEnd(parkSection);
// if (routePathList.get(0).isRight() == trainInfo.getRight()) { //准备回库 // if (routePathList.get(0).isRight() == trainInfo.getRight()) { //准备回库
// if (!parkSection.isTurnBackTrack()) { //针对上饶沙盘 // if (!parkSection.isTurnBackTrack()) { //针对上饶沙盘
@ -88,18 +82,15 @@ public class AtsPlanTrainStageService implements AtsStageService {
} }
@Override @Override
public void handleNormalStandParking(Simulation simulation, TrainInfo trainInfo, public void handleNormalStandParking(Simulation simulation, TrainInfo trainInfo, Section parkSection) {
Section parkSection) {
SimulationDataRepository repository = simulation.getRepository(); SimulationDataRepository repository = simulation.getRepository();
MapConfig config = repository.getConfig(); MapConfig config = repository.getConfig();
List<Stand> standList = parkSection.getStandList(); List<Stand> standList = parkSection.getStandList();
TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(), TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(), trainInfo.getTripNumber());
trainInfo.getTripNumber());
TripPlan nextTripPlan = null; TripPlan nextTripPlan = null;
StationPlan stationPlan = tripPlan.queryStationPlan(parkSection); StationPlan stationPlan = tripPlan.queryStationPlan(parkSection);
if (config.isStandTbStrategyIsInvalid()) { if (config.isStandTbStrategyIsInvalid()) {
if (stationPlan != null && tripPlan.isLastPlan(stationPlan) if (stationPlan != null && tripPlan.isLastPlan(stationPlan) && tripPlan.isFrontTurnBack()) { // 到达终点站了判断站前折返还是站后折返
&& tripPlan.isFrontTurnBack()) { // 到达终点站了判断站前折返还是站后折返
// 站前折返查询下一车次计划 // 站前折返查询下一车次计划
nextTripPlan = repository.queryNextTripPlanOf(tripPlan); nextTripPlan = repository.queryNextTripPlanOf(tripPlan);
} else if (stationPlan == null && tripPlan.isLastPlanStation(parkSection.getStation())) { } else if (stationPlan == null && tripPlan.isLastPlanStation(parkSection.getStation())) {
@ -110,12 +101,9 @@ public class AtsPlanTrainStageService implements AtsStageService {
} }
if (nextTripPlan != null) { // 站前折返更新计划 if (nextTripPlan != null) { // 站前折返更新计划
this.updateTripPlan(simulation, trainInfo, nextTripPlan); this.updateTripPlan(simulation, trainInfo, nextTripPlan);
BusinessExceptionAssertEnum.DATA_ERROR.assertEquals( BusinessExceptionAssertEnum.DATA_ERROR.assertEquals(nextTripPlan.getFirstStationPlan().getSection(), parkSection,
nextTripPlan.getFirstStationPlan().getSection(), parkSection, String.format("下一车次计划[%s]第一站台轨和停靠站台轨不相同:[%s]", nextTripPlan.getStNumber(), parkSection.getName()));
String.format("下一车次计划[%s]第一站台轨和停靠站台轨不相同:[%s]", this.updateNextPlan(simulation, trainInfo, nextTripPlan, nextTripPlan.getFirstStationPlan());
nextTripPlan.getStNumber(), parkSection.getName()));
this.updateNextPlan(simulation, trainInfo, nextTripPlan,
nextTripPlan.getFirstStationPlan());
} }
} else { } else {
if (!CollectionUtils.isEmpty(standList)) { if (!CollectionUtils.isEmpty(standList)) {
@ -126,24 +114,20 @@ public class AtsPlanTrainStageService implements AtsStageService {
case AUTO: case AUTO:
if (stationPlan != null && tripPlan.isLastPlan(stationPlan)) { // 当前计划终点站 if (stationPlan != null && tripPlan.isLastPlan(stationPlan)) { // 当前计划终点站
if (Objects.equals(stand.isRight(), trainInfo.getRight())) { if (Objects.equals(stand.isRight(), trainInfo.getRight())) {
onboardAtpApiService.startTurnBack(simulation, trainInfo.getGroupNumber(), onboardAtpApiService.startTurnBack(simulation, trainInfo.getGroupNumber(), parkSection.getCode());
parkSection.getCode());
nextTripPlan = repository.queryNextTripPlanOf(tripPlan); nextTripPlan = repository.queryNextTripPlanOf(tripPlan);
if (nextTripPlan != null) { // 站前折返更新计划 if (nextTripPlan != null) { // 站前折返更新计划
this.updateTripPlan(simulation, trainInfo, nextTripPlan); this.updateTripPlan(simulation, trainInfo, nextTripPlan);
this.updateNextPlan(simulation, trainInfo, nextTripPlan, this.updateNextPlan(simulation, trainInfo, nextTripPlan, nextTripPlan.getSecondStationPlan());
nextTripPlan.getSecondStationPlan());
} }
} }
} }
break; break;
default: default:
if (stationPlan != null && tripPlan.isLastPlan(stationPlan) if (stationPlan != null && tripPlan.isLastPlan(stationPlan) && tripPlan.isFrontTurnBack()) { // 到达终点站了判断站前折返还是站后折返
&& tripPlan.isFrontTurnBack()) { // 到达终点站了判断站前折返还是站后折返
// 站前折返查询下一车次计划 // 站前折返查询下一车次计划
nextTripPlan = repository.queryNextTripPlanOf(tripPlan); nextTripPlan = repository.queryNextTripPlanOf(tripPlan);
} else if (stationPlan == null && tripPlan.isLastPlanStation( } else if (stationPlan == null && tripPlan.isLastPlanStation(parkSection.getStation())) {
parkSection.getStation())) {
if (config.isAtsAutoHandleManualFrontTurnBack()) { if (config.isAtsAutoHandleManualFrontTurnBack()) {
// 人工站前折返 // 人工站前折返
nextTripPlan = repository.queryNextTripPlanOf(tripPlan); nextTripPlan = repository.queryNextTripPlanOf(tripPlan);
@ -151,12 +135,9 @@ public class AtsPlanTrainStageService implements AtsStageService {
} }
if (nextTripPlan != null) { // 站前折返更新计划 if (nextTripPlan != null) { // 站前折返更新计划
this.updateTripPlan(simulation, trainInfo, nextTripPlan); this.updateTripPlan(simulation, trainInfo, nextTripPlan);
BusinessExceptionAssertEnum.DATA_ERROR.assertEquals( BusinessExceptionAssertEnum.DATA_ERROR.assertEquals(nextTripPlan.getFirstStationPlan().getSection(), parkSection,
nextTripPlan.getFirstStationPlan().getSection(), parkSection, String.format("下一车次计划[%s]第一站台轨和停靠站台轨不相同:[%s]", nextTripPlan.getStNumber(), parkSection.getName()));
String.format("下一车次计划[%s]第一站台轨和停靠站台轨不相同:[%s]", this.updateNextPlan(simulation, trainInfo, nextTripPlan, nextTripPlan.getFirstStationPlan());
nextTripPlan.getStNumber(), parkSection.getName()));
this.updateNextPlan(simulation, trainInfo, nextTripPlan,
nextTripPlan.getFirstStationPlan());
} }
break; break;
} }
@ -165,11 +146,9 @@ public class AtsPlanTrainStageService implements AtsStageService {
} }
@Override @Override
public void ready2DepartFromNormalStand(Simulation simulation, TrainInfo trainInfo, public void ready2DepartFromNormalStand(Simulation simulation, TrainInfo trainInfo, Section parkSection) {
Section parkSection) {
SimulationDataRepository repository = simulation.getRepository(); SimulationDataRepository repository = simulation.getRepository();
TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(), TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(), trainInfo.getTripNumber());
trainInfo.getTripNumber());
StationPlan stationPlan = tripPlan.queryStationPlan(parkSection); StationPlan stationPlan = tripPlan.queryStationPlan(parkSection);
if (stationPlan == null) { if (stationPlan == null) {
// 非计划中的停靠站台轨暂不处理 // 非计划中的停靠站台轨暂不处理
@ -189,8 +168,7 @@ public class AtsPlanTrainStageService implements AtsStageService {
} }
// 到达终点站准备折返 // 到达终点站准备折返
log.debug(String.format("列车[%s]折返初始化", trainInfo.getGroupNumber())); log.debug(String.format("列车[%s]折返初始化", trainInfo.getGroupNumber()));
List<RoutePath> routePaths = repository.getRoutePaths(parkSection, List<RoutePath> routePaths = repository.getRoutePaths(parkSection, tripPlan.getEndSection());
tripPlan.getEndSection());
Signal signal = parkSection.getSignalOf(routePaths.get(0).isRight()); Signal signal = parkSection.getSignalOf(routePaths.get(0).isRight());
if (signal.isMainAspect() || signal.isGuideAspect()) { if (signal.isMainAspect() || signal.isGuideAspect()) {
Route lockedRoute = signal.getLockedRoute(); Route lockedRoute = signal.getLockedRoute();
@ -212,8 +190,7 @@ public class AtsPlanTrainStageService implements AtsStageService {
this.onboardAtpApiService.updateTripPlan(simulation, trainInfo.getGroupNumber(), nextTripPlan); this.onboardAtpApiService.updateTripPlan(simulation, trainInfo.getGroupNumber(), nextTripPlan);
} }
public void updateNextPlan(Simulation simulation, TrainInfo trainInfo, TripPlan tripPlan, public void updateNextPlan(Simulation simulation, TrainInfo trainInfo, TripPlan tripPlan, StationPlan nextStationPlan) {
StationPlan nextStationPlan) {
if (nextStationPlan == null) { if (nextStationPlan == null) {
log.warn(String.format("列车[%s]下一计划到站为null", trainInfo.debugStr())); log.warn(String.format("列车[%s]下一计划到站为null", trainInfo.debugStr()));
return; return;
@ -262,8 +239,7 @@ public class AtsPlanTrainStageService implements AtsStageService {
} }
int planRunTime = (int) ChronoUnit.SECONDS.between(startTime, endTime); int planRunTime = (int) ChronoUnit.SECONDS.between(startTime, endTime);
int adjustRunTime = planRunTime; int adjustRunTime = planRunTime;
if (!turnBack && !outbound && config.isAdjustOperationAutomatically() if (!turnBack && !outbound && config.isAdjustOperationAutomatically() && trainInfo.isAtsAutoAdjust()) {
&& trainInfo.isAtsAutoAdjust()) {
startTime = systemTime.toLocalTime(); startTime = systemTime.toLocalTime();
adjustRunTime = (int) ChronoUnit.SECONDS.between(startTime, endTime); adjustRunTime = (int) ChronoUnit.SECONDS.between(startTime, endTime);
} }
@ -277,17 +253,12 @@ public class AtsPlanTrainStageService implements AtsStageService {
} }
@Override @Override
public void handleTurnBackTrackParking(Simulation simulation, TrainInfo trainInfo, public void handleTurnBackTrackParking(Simulation simulation, TrainInfo trainInfo, Section parkSection) {
Section parkSection) {
SimulationDataRepository repository = simulation.getRepository(); SimulationDataRepository repository = simulation.getRepository();
LocalDateTime systemTime = simulation.getSystemTime(); LocalDateTime systemTime = simulation.getSystemTime();
TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(), TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(), trainInfo.getTripNumber());
trainInfo.getTripNumber()); if (tripPlan.getEndSection().equals(parkSection)
/*|| tripPlan.getEndSection().getStation().equals(parkSection.getStation())*/) {
// 车次计划中的车站计划全部完成并且当前折返轨与计划折返轨属于同一站则认为车次计划完成
boolean completed = tripPlan.getPlanList().stream().allMatch(StationPlan::isFinished)
&& tripPlan.getEndSection().getStation().equals(parkSection.getStation());
if (completed) {
// 计划终端折返轨或和计划终端折返轨同站的折返轨,根据车次类型处理 // 计划终端折返轨或和计划终端折返轨同站的折返轨,根据车次类型处理
TripPlan nextTripPlan = repository.queryNextTripPlanOf(tripPlan); TripPlan nextTripPlan = repository.queryNextTripPlanOf(tripPlan);
if (nextTripPlan == null) { if (nextTripPlan == null) {
@ -297,19 +268,15 @@ public class AtsPlanTrainStageService implements AtsStageService {
// 备用车 // 备用车
if (systemTime.toLocalTime().plusMinutes(5).isAfter(nextTripPlan.getStartTime())) { if (systemTime.toLocalTime().plusMinutes(5).isAfter(nextTripPlan.getStartTime())) {
this.updateTripPlan(simulation, trainInfo, nextTripPlan); this.updateTripPlan(simulation, trainInfo, nextTripPlan);
BusinessExceptionAssertEnum.DATA_ERROR.assertNotEquals(parkSection, BusinessExceptionAssertEnum.DATA_ERROR.assertNotEquals(parkSection, nextTripPlan.getFirstStationPlan().getSection());
nextTripPlan.getFirstStationPlan().getSection()); this.updateNextPlan(simulation, trainInfo, nextTripPlan, nextTripPlan.getFirstStationPlan());
this.updateNextPlan(simulation, trainInfo, nextTripPlan,
nextTripPlan.getFirstStationPlan());
return; return;
} }
} else if (tripPlan.isTurnBack()) { } else if (tripPlan.isTurnBack()) {
// 折返计划 // 折返计划
this.updateTripPlan(simulation, trainInfo, nextTripPlan); this.updateTripPlan(simulation, trainInfo, nextTripPlan);
BusinessExceptionAssertEnum.DATA_ERROR.assertNotEquals(parkSection, BusinessExceptionAssertEnum.DATA_ERROR.assertNotEquals(parkSection, nextTripPlan.getFirstStationPlan().getSection());
nextTripPlan.getFirstStationPlan().getSection()); this.updateNextPlan(simulation, trainInfo, nextTripPlan, nextTripPlan.getFirstStationPlan());
this.updateNextPlan(simulation, trainInfo, nextTripPlan,
nextTripPlan.getFirstStationPlan());
return; return;
} }
} else { } else {
@ -350,8 +317,7 @@ public class AtsPlanTrainStageService implements AtsStageService {
return; return;
} }
SimulationDataRepository repository = simulation.getRepository(); SimulationDataRepository repository = simulation.getRepository();
TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(), TripPlan tripPlan = repository.getTripPlan(trainInfo.getServiceNumber(), trainInfo.getTripNumber());
trainInfo.getTripNumber());
StationPlan stationPlan = tripPlan.queryStationPlan(planStandTrack); StationPlan stationPlan = tripPlan.queryStationPlan(planStandTrack);
Section section = repository.getByCode(planStandTrack, Section.class); Section section = repository.getByCode(planStandTrack, Section.class);
//更新离站信息 //更新离站信息

View File

@ -246,12 +246,12 @@ public class CiApiServiceImpl2 implements CiApiService {
@Override @Override
public void humanCancel(Simulation simulation, String routeCode) { public void humanCancel(Simulation simulation, String routeCode) {
Route route = simulation.getRepository().getByCode(routeCode, Route.class); Route route = simulation.getRepository().getByCode(routeCode, Route.class);
if (route.getStart().isGuideAspect()) { // 根据成都三引导解锁逻辑修改 // if (simulation.getRepository().getConfig().isRailway()) {
signalService.closeRoute(simulation, route.getStart()); // BusinessExceptionAssertEnum.OPERATION_FAIL.assertTrue(route.isApproachLock(),
} else { // "进路未接近锁闭,不能人解");
// }
this.routeService.delayUnlockStart(simulation, route, route.getStart()); this.routeService.delayUnlockStart(simulation, route, route.getStart());
} }
}
@Override @Override
public void sectionFaultUnlock(Simulation simulation, String sectionCode) { public void sectionFaultUnlock(Simulation simulation, String sectionCode) {
@ -504,10 +504,6 @@ public class CiApiServiceImpl2 implements CiApiService {
signal.guideDelayStart(); signal.guideDelayStart();
} }
} }
if (repository.getConfig().isGuideDelayCloseWhenFirstSectionOccupied()
&& signal.isGuideAspect()) {
signal.guideDelayStart();
}
// if (signal.getGuideRemain() > 0) { // if (signal.getGuideRemain() > 0) {
// signal.setGuideRemain(0); // signal.setGuideRemain(0);
// } else { // } else {

View File

@ -1,23 +1,21 @@
package club.joylink.rtss.simulation.cbtc.data.map; package club.joylink.rtss.simulation.cbtc.data.map;
import static club.joylink.rtss.simulation.cbtc.member.SimulationMember.Type.DISPATCHER;
import static club.joylink.rtss.simulation.cbtc.member.SimulationMember.Type.ELECTRIC_DISPATCHER;
import static club.joylink.rtss.simulation.cbtc.member.SimulationMember.Type.MAINTAINER;
import static club.joylink.rtss.simulation.cbtc.member.SimulationMember.Type.STATION_SUPERVISOR;
import club.joylink.rtss.simulation.cbtc.constant.RunLevel; import club.joylink.rtss.simulation.cbtc.constant.RunLevel;
import club.joylink.rtss.simulation.cbtc.member.SimulationMember; import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
import club.joylink.rtss.vo.map.MapFunctionConfig; import club.joylink.rtss.vo.map.MapFunctionConfig;
import club.joylink.rtss.vo.map.RealLineConfigVO; import club.joylink.rtss.vo.map.RealLineConfigVO;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static club.joylink.rtss.simulation.cbtc.member.SimulationMember.Type.*;
/** /**
* 地图配置 * 地图配置
*/ */
@ -195,64 +193,40 @@ public class MapConfig {
*/ */
private boolean holdCommandIgnoreControlMode; private boolean holdCommandIgnoreControlMode;
/** /** 共享紧急关闭效果的车站 */
* 共享紧急关闭效果的车站
*/
private Set<String> sharingECStations; private Set<String> sharingECStations;
/** /** 取消联锁条件不满足的进路时需要延时解锁 */
* 取消联锁条件不满足的进路时需要延时解锁
*/
private boolean delayWhenCancelRouteWithAbnormalInterlock; private boolean delayWhenCancelRouteWithAbnormalInterlock;
/** /** 车次号的位数 */
* 车次号的位数
*/
private int figuresOfTripNumber; private int figuresOfTripNumber;
/** /** 服务号的位数 */
* 服务号的位数
*/
private int figuresOfServiceNumber; private int figuresOfServiceNumber;
/** /** 设置头码车时检查方向 */
* 设置头码车时检查方向
*/
private boolean checkDirectionWhenSetHead; private boolean checkDirectionWhenSetHead;
/** /** 转换轨进路只能通过故障解锁来取消 */
* 转换轨进路只能通过故障解锁来取消
*/
private boolean transferRouteCanOnlyFaultUnlock; private boolean transferRouteCanOnlyFaultUnlock;
/** /** 头码车抵达目的地后变为人工车 */
* 头码车抵达目的地后变为人工车
*/
private boolean setManualWhenHeadTrainArriveTarget; private boolean setManualWhenHeadTrainArriveTarget;
/** /** 进路默认开启冲突检测 */
* 进路默认开启冲突检测
*/
private boolean routeDefaultCheckConflict; private boolean routeDefaultCheckConflict;
/** /** 处理停车场/车辆段逻辑 */
* 处理停车场/车辆段逻辑
*/
private boolean handleDepot; private boolean handleDepot;
/** /** 运行图中车次号是否唯一 */
* 运行图中车次号是否唯一
*/
private boolean tripNumberIsUnique; private boolean tripNumberIsUnique;
/** /** 站台折返策略不生效 */
* 站台折返策略不生效
*/
private boolean standTbStrategyIsInvalid; private boolean standTbStrategyIsInvalid;
/** /** 根据服务号更新车次计划(西安三提出,抽线之后,后续列车还跑原来的服务,不会自动顶上) */
* 根据服务号更新车次计划西安三提出抽线之后后续列车还跑原来的服务不会自动顶上
*/
private boolean updateTripPlanByServiceNumber; private boolean updateTripPlanByServiceNumber;
/** /**
@ -262,7 +236,8 @@ public class MapConfig {
/** /**
* 对信号机封锁操作是否影响信号显示 * 对信号机封锁操作是否影响信号显示
* <p> * <p>
* true-封锁信号机会使信号机显示禁止色<br> false-封锁信号机不会影响信号机显示 * true-封锁信号机会使信号机显示禁止色<br>
* false-封锁信号机不会影响信号机显示
*/ */
private boolean signalBolckOptReflectSignal; private boolean signalBolckOptReflectSignal;
@ -285,14 +260,8 @@ public class MapConfig {
*/ */
private boolean manualTrainDefaultStop; private boolean manualTrainDefaultStop;
/**
* 办理引导进路时如果进路首区段占用引导信号15秒后关闭
*/
private boolean guideDelayCloseWhenFirstSectionOccupied;
private Set<SimulationMember.Type> needConfirmConnectMembers = private Set<SimulationMember.Type> needConfirmConnectMembers =
Stream.of(DISPATCHER, STATION_SUPERVISOR, MAINTAINER, ELECTRIC_DISPATCHER) Stream.of(DISPATCHER, STATION_SUPERVISOR, MAINTAINER, ELECTRIC_DISPATCHER).collect(Collectors.toSet());
.collect(Collectors.toSet());
public MapConfig() { public MapConfig() {
this.lockFirst = false; this.lockFirst = false;
@ -321,10 +290,8 @@ public class MapConfig {
setParkingSM(configVO.getParkingSM()); setParkingSM(configVO.getParkingSM());
setRmAtpSpeed(configVO.getRmAtpSpeed() / 3.6f); setRmAtpSpeed(configVO.getRmAtpSpeed() / 3.6f);
setUrmAtpSpeed(configVO.getUrmAtpSpeed() / 3.6f); setUrmAtpSpeed(configVO.getUrmAtpSpeed() / 3.6f);
setCancelAtsControlOfAllRoutesWhenCancelRoute( setCancelAtsControlOfAllRoutesWhenCancelRoute(configVO.isCancelAtsControlOfAllRoutesWhenCancelRoute());
configVO.isCancelAtsControlOfAllRoutesWhenCancelRoute()); setSignalHumanControlBeforeSetAtsControlOrCIAutoTrigger(configVO.isSignalHumanControlBeforeSetAtsControlOrCIAutoTrigger());
setSignalHumanControlBeforeSetAtsControlOrCIAutoTrigger(
configVO.isSignalHumanControlBeforeSetAtsControlOrCIAutoTrigger());
setAllowEarlyDepartureWhenHoldTrain(configVO.isAllowEarlyDepartureWhenHoldTrain()); setAllowEarlyDepartureWhenHoldTrain(configVO.isAllowEarlyDepartureWhenHoldTrain());
setEBWhenCancelRoute(configVO.isEBWhenCancelRoute()); setEBWhenCancelRoute(configVO.isEBWhenCancelRoute());
setAdjustOperationAutomatically(configVO.isAdjustOperationAutomatically()); setAdjustOperationAutomatically(configVO.isAdjustOperationAutomatically());
@ -335,11 +302,9 @@ public class MapConfig {
setBlockadeCommandOnlyValidInStandbyMode(configVO.isBlockadeCommandOnlyValidInStandbyMode()); setBlockadeCommandOnlyValidInStandbyMode(configVO.isBlockadeCommandOnlyValidInStandbyMode());
// setSomeCommandNeedInit(configVO.isSwitchBlockadeCommandNeedInit()); // setSomeCommandNeedInit(configVO.isSwitchBlockadeCommandNeedInit());
setStationPreResetBeforeAxlePreReset(configVO.isStationPreResetBeforeAxlePreReset()); setStationPreResetBeforeAxlePreReset(configVO.isStationPreResetBeforeAxlePreReset());
setSwitchTurnOperationCanRecoverSplitFault( setSwitchTurnOperationCanRecoverSplitFault(configVO.isSwitchTurnOperationCanRecoverSplitFault());
configVO.isSwitchTurnOperationCanRecoverSplitFault());
setHoldCommandIgnoreControlMode(configVO.isHoldCommandIgnoreControlMode()); setHoldCommandIgnoreControlMode(configVO.isHoldCommandIgnoreControlMode());
setDelayWhenCancelRouteWithAbnormalInterlock( setDelayWhenCancelRouteWithAbnormalInterlock(configVO.isDelayWhenCancelRouteWithAbnormalInterlock());
configVO.isDelayWhenCancelRouteWithAbnormalInterlock());
setFiguresOfTripNumber(configVO.getFiguresOfTripNumber()); setFiguresOfTripNumber(configVO.getFiguresOfTripNumber());
setFiguresOfServiceNumber(configVO.getFiguresOfServiceNumber()); setFiguresOfServiceNumber(configVO.getFiguresOfServiceNumber());
setCheckDirectionWhenSetHead(configVO.isCheckDirectionWhenSetHead()); setCheckDirectionWhenSetHead(configVO.isCheckDirectionWhenSetHead());
@ -354,15 +319,12 @@ public class MapConfig {
setSFUCanOnlyApplyForFaultLockSection(configVO.isSFUCanOnlyApplyForFaultLockSection()); setSFUCanOnlyApplyForFaultLockSection(configVO.isSFUCanOnlyApplyForFaultLockSection());
setRouteCanSetWhenSwitchFault(configVO.isRouteCanSetWhenSwitchFault()); setRouteCanSetWhenSwitchFault(configVO.isRouteCanSetWhenSwitchFault());
setManualTrainDefaultStop(configVO.isManualTrainDefaultStop()); setManualTrainDefaultStop(configVO.isManualTrainDefaultStop());
setGuideDelayCloseWhenFirstSectionOccupied(
configVO.isGuideDelayCloseWhenFirstSectionOccupied());
} }
} }
public void copyConfigBy(MapFunctionConfig mapFunctionConfig) { public void copyConfigBy(MapFunctionConfig mapFunctionConfig) {
if (mapFunctionConfig == null) { if (mapFunctionConfig == null)
return; return;
}
this.hasCTC = mapFunctionConfig.isHasCTC(); this.hasCTC = mapFunctionConfig.isHasCTC();
this.hasTDCS = mapFunctionConfig.isHasTDCS(); this.hasTDCS = mapFunctionConfig.isHasTDCS();
} }
@ -372,8 +334,7 @@ public class MapConfig {
if (noParkingSM.contains("-")) { if (noParkingSM.contains("-")) {
String[] split = noParkingSM.split("-"); String[] split = noParkingSM.split("-");
if (split.length == 2) { if (split.length == 2) {
return Integer.parseInt(serviceNumber) >= Integer.parseInt(split[0]) return Integer.parseInt(serviceNumber) >= Integer.parseInt(split[0]) && Integer.parseInt(serviceNumber) <= Integer.parseInt(split[1]);
&& Integer.parseInt(serviceNumber) <= Integer.parseInt(split[1]);
} }
} }
} }
@ -385,8 +346,7 @@ public class MapConfig {
if (parkingSM.contains("-")) { if (parkingSM.contains("-")) {
String[] split = parkingSM.split("-"); String[] split = parkingSM.split("-");
if (split.length == 2) { if (split.length == 2) {
return Integer.parseInt(serviceNumber) >= Integer.parseInt(split[0]) return Integer.parseInt(serviceNumber) >= Integer.parseInt(split[0]) && Integer.parseInt(serviceNumber) <= Integer.parseInt(split[1]);
&& Integer.parseInt(serviceNumber) <= Integer.parseInt(split[1]);
} }
} }
} }
@ -415,14 +375,12 @@ public class MapConfig {
} }
public boolean isSharingECStation(String stationCode) { public boolean isSharingECStation(String stationCode) {
if (CollectionUtils.isEmpty(this.sharingECStations)) { if (CollectionUtils.isEmpty(this.sharingECStations))
return false; return false;
}
for (String code : sharingECStations) { for (String code : sharingECStations) {
if (code.equals(stationCode)) { if (code.equals(stationCode))
return true; return true;
} }
}
return false; return false;
} }
@ -438,7 +396,6 @@ public class MapConfig {
/** /**
* 直接取消 * 直接取消
*/ */
DIRECT, DIRECT,;
;
} }
} }

View File

@ -345,15 +345,10 @@ public class SimulationRobotService {
|| Objects.equals(vrSignal.getAspect(), signal.getGuideAspect())) { //引导信号 || Objects.equals(vrSignal.getAspect(), signal.getGuideAspect())) { //引导信号
if (!Objects.equals(signal, throughSignal) || !Objects.equals(vrSignal.getAspect(), if (!Objects.equals(signal, throughSignal) || !Objects.equals(vrSignal.getAspect(),
throughAspect)) { throughAspect)) {
SectionPosition tempPosition; SectionPosition noPassPosition = CalculateService.calculateNextPositionByStartAndLen(
if (section.isFunctionTrack()) { //解决福州一列车从车辆段开出来时在转换轨停车位置有误导致无法发车的问题
tempPosition = new SectionPosition(section, section.getStopPointByDirection(right));
} else {
tempPosition = CalculateService.calculateNextPositionByStartAndLen(
signalPosition, !right, 2, true); signalPosition, !right, 2, true);
} if (targetPosition == null || noPassPosition.isAheadOf(targetPosition, right)) {
if (targetPosition == null || tempPosition.isAheadOf(targetPosition, right)) { targetPosition = noPassPosition;
targetPosition = tempPosition;
} }
} }
} }

View File

@ -222,7 +222,7 @@ public class MetroSimulationWorkServiceImpl implements SimulationWorkService {
faultGenerator.addJobs(simulation); faultGenerator.addJobs(simulation);
atsMessageCollectAndDispatcher.addJobs(simulation); atsMessageCollectAndDispatcher.addJobs(simulation);
nccAlarmService.addJobs(simulation); nccAlarmService.addJobs(simulation);
// trainMessageDiagram.addJobs(simulation); 逻辑报错暂时注掉 trainMessageDiagram.addJobs(simulation);
} }
@Override @Override

View File

@ -10,7 +10,7 @@ import lombok.Setter;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
/** /**
* 地图线路公共配置项 *地图线路公共配置项
*/ */
@Getter @Getter
@Setter @Setter
@ -18,12 +18,12 @@ import org.springframework.util.StringUtils;
public class RealLineConfigVO { public class RealLineConfigVO {
/** /**
* 上行是否右方向 *上行是否右方向
*/ */
private Boolean upRight = true; private Boolean upRight = true;
/** /**
* 进路办理是否先锁闭开始办理直接先锁闭区段如福州一号线 *进路办理是否先锁闭开始办理直接先锁闭区段如福州一号线
*/ */
private Boolean lockFirst = false; private Boolean lockFirst = false;
@ -38,76 +38,76 @@ public class RealLineConfigVO {
private boolean routeSettingNoFail = false; private boolean routeSettingNoFail = false;
/** /**
* 是否列车停站开门后才办理出站进路开放出站信号机 *是否列车停站开门后才办理出站进路开放出站信号机
*/ */
private boolean signalOpenAfterParking = false; private boolean signalOpenAfterParking = false;
/** /**
* 站台扣车是否关闭逻辑点灯的信号机 *站台扣车是否关闭逻辑点灯的信号机
*/ */
private boolean standHoldCloseLogicLight = false; private boolean standHoldCloseLogicLight = false;
/** /**
* ATS是否自动处理人工设置的站前折返自动更新车次 *ATS是否自动处理人工设置的站前折返自动更新车次
*/ */
private boolean atsAutoHandleManualFrontTurnBack = false; private boolean atsAutoHandleManualFrontTurnBack = false;
/** /**
* CTC列车进路延续保护仅折返站处锁闭 *CTC列车进路延续保护仅折返站处锁闭
*/ */
private boolean ctcOverlapOnlyTurnBackStationLock = false; private boolean ctcOverlapOnlyTurnBackStationLock = false;
/** /**
* 引导办理是否需要先排列进路 *引导办理是否需要先排列进路
*/ */
private boolean guideNeedRouteSettingFirst = true; private boolean guideNeedRouteSettingFirst = true;
/** /**
* 道岔区段状态改变按单个道岔处理 *道岔区段状态改变按单个道岔处理
*/ */
private Boolean switchSingleHandle = true; private Boolean switchSingleHandle = true;
/** /**
* 道岔正/反操是否联动 *道岔正/反操是否联动
*/ */
private Boolean switchNRTurnChain = false; private Boolean switchNRTurnChain = false;
/** /**
* 道岔单解/锁是否联动 *道岔单解/锁是否联动
*/ */
private Boolean switchSingleLockChain = false; private Boolean switchSingleLockChain = false;
/** /**
* 道岔故障失表是否联动 *道岔故障失表是否联动
*/ */
private Boolean switchLossChain = false; private Boolean switchLossChain = false;
/** /**
* 是否强制取消进路/在接近区段占用时是否依旧强制执行取消进路 *是否强制取消进路/在接近区段占用时是否依旧强制执行取消进路
*/ */
private MapConfig.ApproachLockCancel singleApproachLockCancelRoute = MapConfig.ApproachLockCancel.NOT; private MapConfig.ApproachLockCancel singleApproachLockCancelRoute = MapConfig.ApproachLockCancel.NOT;
/** /**
* 列车控制模式/级别 *列车控制模式/级别
*/ */
private String runMode = RunLevel.CBTC.name(); private String runMode = RunLevel.CBTC.name();
/** /**
* 不停站头码车服务号列表 *不停站头码车服务号列表
*/ */
private String noParkingSM = ""; private String noParkingSM="";
/** /**
* 停站头码车服务号列表 *停站头码车服务号列表
*/ */
private String parkingSM = ""; private String parkingSM="";
/** /**
* RM模式下ATP防护速度单位km/h *RM模式下ATP防护速度单位km/h
*/ */
private float rmAtpSpeed = 25f; private float rmAtpSpeed = 25f;
/** /**
* URM模式下ATP防护速度单位km/h *URM模式下ATP防护速度单位km/h
*/ */
private float urmAtpSpeed = 45f; private float urmAtpSpeed = 45f;
@ -186,54 +186,34 @@ public class RealLineConfigVO {
*/ */
private boolean holdCommandIgnoreControlMode; private boolean holdCommandIgnoreControlMode;
/** /** 取消联锁条件不满足的进路时需要延时解锁 */
* 取消联锁条件不满足的进路时需要延时解锁
*/
private boolean delayWhenCancelRouteWithAbnormalInterlock; private boolean delayWhenCancelRouteWithAbnormalInterlock;
/** /** 车次号的位数 */
* 车次号的位数
*/
private int figuresOfTripNumber = 4; private int figuresOfTripNumber = 4;
/** /** 服务号的位数 */
* 服务号的位数
*/
private int figuresOfServiceNumber = 3; private int figuresOfServiceNumber = 3;
/** /** 设置头码车时检查方向 */
* 设置头码车时检查方向
*/
private boolean checkDirectionWhenSetHead; private boolean checkDirectionWhenSetHead;
/** /** 转换轨进路只能通过故障解锁来取消 */
* 转换轨进路只能通过故障解锁来取消
*/
private boolean transferRouteCanOnlyFaultUnlock; private boolean transferRouteCanOnlyFaultUnlock;
/** /** 头码车抵达目的地后变为人工车 */
* 头码车抵达目的地后变为人工车
*/
private boolean setManualWhenHeadTrainArriveTarget; private boolean setManualWhenHeadTrainArriveTarget;
/** /** 进路默认开启冲突检测 */
* 进路默认开启冲突检测
*/
private boolean routeDefaultCheckConflict; private boolean routeDefaultCheckConflict;
/** /** 运行图中车次号是否唯一 */
* 运行图中车次号是否唯一
*/
private boolean tripNumberIsUnique; private boolean tripNumberIsUnique;
/** /** 站台折返策略不生效 */
* 站台折返策略不生效
*/
private boolean standTbStrategyIsInvalid; private boolean standTbStrategyIsInvalid;
/** /** 根据服务号更新车次计划 */
* 根据服务号更新车次计划
*/
private boolean updateTripPlanByServiceNumber; private boolean updateTripPlanByServiceNumber;
/** /**
@ -243,9 +223,10 @@ public class RealLineConfigVO {
/** /**
* 对信号机封锁操作是否影响信号显示 * 对信号机封锁操作是否影响信号显示
* <p> * <p>
* true-封锁信号机会使信号机显示禁止色<br> false-封锁信号机不会影响信号机显示 * true-封锁信号机会使信号机显示禁止色<br>
* false-封锁信号机不会影响信号机显示
*/ */
private boolean signalBolckOptReflectSignal = true; private boolean signalBolckOptReflectSignal=true;
/** /**
@ -264,11 +245,6 @@ public class RealLineConfigVO {
*/ */
private boolean manualTrainDefaultStop; private boolean manualTrainDefaultStop;
/**
* 办理引导进路时如果进路首区段占用引导信号15秒后关闭
*/
private boolean guideDelayCloseWhenFirstSectionOccupied;
public static RealLineConfigVO parseJsonStr(String configData) { public static RealLineConfigVO parseJsonStr(String configData) {
if (StringUtils.hasText(configData)) { if (StringUtils.hasText(configData)) {
return JsonUtils.read(configData, RealLineConfigVO.class); return JsonUtils.read(configData, RealLineConfigVO.class);