diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/TrainOperateHandler.java b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/TrainOperateHandler.java index 227d8a4b7..de7d38e20 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/TrainOperateHandler.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/ATS/operation/handler/TrainOperateHandler.java @@ -153,7 +153,7 @@ public class TrainOperateHandler { break; case HEAD: this.atsTrainService.setHeadTrain(simulation, updateParam.getGroupNumber(), - updateParam.getServiceNumber(), null, updateParam.getDestinationCode()); + updateParam.getServiceNumber(), updateParam.getTripNumber(), updateParam.getDestinationCode()); break; } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/build/InterlockBuilder2.java b/src/main/java/club/joylink/rtss/simulation/cbtc/build/InterlockBuilder2.java index 42cf81d3c..89328dcde 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/build/InterlockBuilder2.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/build/InterlockBuilder2.java @@ -460,34 +460,10 @@ public class InterlockBuilder2 { log.info("目的地码构建耗时:" + (System.currentTimeMillis() - start)); // ------------目的地码end------------- -// // 交路的经过区段校验 -// for (Routing routing : routingList) { -// List
viaSectionList = routing.getViaSectionList(); -// for (int i = 1; i < viaSectionList.size(); i++) { -// Section start = viaSectionList.get(i - 1); -// Section end = viaSectionList.get(i); -// boolean find = false; -// for (StationRunLevel stationRunLevel : stationRunLevelList) { -// if (Objects.equals(start, stationRunLevel.getStartSection()) && -// Objects.equals(end, stationRunLevel.getEndSection())) { -// find = true; -// break; -// } -// } -// if (!find) { -// log.warn(String.format("交路[%s]中,从区段[%s(%s)]-区段[%s(%s)]的站间运行等级数据不存在", -// routing.getName(), -// start.getName(), start.getCode(), -// end.getName(), end.getCode())); -// } -// } -// } - // 根据站间运行等级数据构建路径单元 if (!errMsgList.isEmpty()) { return; } -// buildRouteUnitFromStationRunLevel(stationRunLevelList, mapDataBuildResult, errMsgList); buildRoutePathFromStationRunLevel(stationRunLevelList, mapDataBuildResult, errMsgList); } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/build/MapDeviceBuilder.java b/src/main/java/club/joylink/rtss/simulation/cbtc/build/MapDeviceBuilder.java index 599b78031..01e8ba547 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/build/MapDeviceBuilder.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/build/MapDeviceBuilder.java @@ -410,6 +410,13 @@ public class MapDeviceBuilder { } } } + //站台默认折返策略 + Stand.TurnBackType defaultStrategy = standVO.getDefaultReentryStrategy(); + if (defaultStrategy == null) { + stand.setDefaultTypeStrategy(Stand.TurnBackType.DEFAULT); + } else { + stand.setDefaultTypeStrategy(defaultStrategy); + } }); // 站台轨关系数据校验 List
standTrackList = elementMap.values().stream() diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Stand.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Stand.java index 0d45b504d..2bd4ce57e 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Stand.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/map/Stand.java @@ -1,5 +1,6 @@ package club.joylink.rtss.simulation.cbtc.data.map; +import club.joylink.rtss.simulation.cbtc.constant.TurnBackStrategyType; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityPsl; import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityScreenDoor; import club.joylink.rtss.simulation.cbtc.exception.SimulationException; @@ -62,6 +63,9 @@ public class Stand extends MayOutOfOrderDevice { private VirtualRealityPsl vrPsl; + /** 默认折返策略 */ + private TurnBackType defaultTypeStrategy; + // -------------------------------状态属性--------------------------------- /** @@ -139,7 +143,7 @@ public class Stand extends MayOutOfOrderDevice { */ private boolean parkingAlwaysValid; - private TurnBackType defaultTypeStrategy; +// private TurnBackType defaultTypeStrategy; /** * 折返类型策略(无折返/自动换端/无人折返) @@ -181,7 +185,7 @@ public class Stand extends MayOutOfOrderDevice { this.runLevelTimeForever = false; this.parkingTime = -1; this.parkingAlwaysValid = false; - this.typeStrategy = TurnBackType.DEFAULT; + this.typeStrategy = this.defaultTypeStrategy; this.noStatus = false; this.closed = false; } @@ -322,6 +326,10 @@ public class Stand extends MayOutOfOrderDevice { this.closed = true; } + public boolean turnBackTypeNonDefault() { + return !Objects.equals(typeStrategy, TurnBackType.DEFAULT); + } + /** * 站台折返类型策略 */ diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/StandStatus.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/StandStatus.java index 7d88d6cd8..4f2a2be1c 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/StandStatus.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/StandStatus.java @@ -80,6 +80,8 @@ public class StandStatus extends DeviceStatus { @JsonSerialize(using = Boolean2NumSerializer.class) private boolean parkingAlwaysValid; + private Stand.TurnBackType typeStrategy; + @JsonSerialize(using = Boolean2NumSerializer.class) private boolean noStatus; diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/TrainStatus.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/TrainStatus.java index 5e679334a..de7f78b75 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/TrainStatus.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/status/TrainStatus.java @@ -37,6 +37,9 @@ public class TrainStatus extends DeviceStatus { /** 乘务组号 */ private String crewNumber; + /** 最后一个抵达的车站 */ + private String stationCode; + /** 计划交路类型 */ private PlanRoutingType planRoutingType; @@ -116,6 +119,10 @@ public class TrainStatus extends DeviceStatus { private int parkingRemainTime; + private String turnBackStrategy; + + private String turnBackStatus; + public TrainStatus(TrainInfo train) { super(train.getGroupNumber(), MapElement.DeviceType.TRAIN); this.groupNumber = train.getGroupNumber(); @@ -129,6 +136,7 @@ public class TrainStatus extends DeviceStatus { this.destinationCode = train.getDestinationCode(); } this.crewNumber = train.getCrewNumber(); + this.stationCode = train.getStationCode(); this.sectionCode = train.getSection(); this.physicalCode = train.getPhysicalSection(); this.offsetp = train.getOffsetp(); @@ -147,6 +155,8 @@ public class TrainStatus extends DeviceStatus { this.endStation = train.getEndStation(); this.runningTime = train.getRunningTimeInSeconds(); this.parkingRemainTime = train.getParkingRemainTimeInSeconds(); + this.turnBackStrategy = train.getTurnBackStrategy(); + this.turnBackStatus = train.getTurnBackStatus(); } /** @@ -187,6 +197,11 @@ public class TrainStatus extends DeviceStatus { status.setCrewNumber(this.crewNumber); change = true; } + if (!Objects.equals(this.stationCode, train.getStationCode())) { + this.stationCode = train.getStationCode(); + status.setStationCode(this.stationCode); + change = true; + } if (!Objects.equals(this.planRoutingType, train.getPlanRoutingType())) { this.planRoutingType = train.getPlanRoutingType(); change = true; @@ -292,35 +307,46 @@ public class TrainStatus extends DeviceStatus { status.setParkingRemainTime(this.parkingRemainTime); change = true; } + if (!Objects.equals(this.turnBackStrategy, train.getTurnBackStrategy())) { + this.turnBackStrategy = train.getTurnBackStrategy(); + status.setTurnBackStrategy(this.turnBackStrategy); + change = true; + } + if (!Objects.equals(this.turnBackStatus, train.getTurnBackStatus())) { + this.turnBackStatus = train.getTurnBackStatus(); + status.setTurnBackStatus(this.turnBackStatus); + change = true; + } return change; } @Override public DeviceStatusVO convert2VO(MapElement device) { - TrainStatusVO statusVO = new TrainStatusVO((TrainInfo) device); - statusVO.setDt(dt); - statusVO.setHold(hold); - statusVO.setJump(jump); - statusVO.setSpeed(speed); - statusVO.setDoorCloseLock(doorCloseLock); - statusVO.setDriveMode(driveMode); - statusVO.setRunLevel(runLevel); - statusVO.setRight(right); - statusVO.setOffsetp(offsetp); - statusVO.setPhysicalCode(physicalCode); - statusVO.setSectionCode(sectionCode); - statusVO.setType(type); - statusVO.setDestinationCode(destinationCode); - statusVO.setPlanRoutingType(planRoutingType); - statusVO.setTripNumber(tripNumber); - statusVO.setServiceNumber(serviceNumber); - statusVO.setGroupNumber(groupNumber); - statusVO.setDispose(dispose); - statusVO.setStop(stop); - statusVO.setBackUp(backUp); - statusVO.setOrderStop(orderStop); - statusVO.setCrewNumber(crewNumber); - return statusVO; + return new TrainStatusVO(this); +// TrainStatusVO statusVO = new TrainStatusVO((TrainInfo) device); +// statusVO.setDt(dt); +// statusVO.setHold(hold); +// statusVO.setJump(jump); +// statusVO.setSpeed(speed); +// statusVO.setDoorCloseLock(doorCloseLock); +// statusVO.setDriveMode(driveMode); +// statusVO.setRunLevel(runLevel); +// statusVO.setRight(right); +// statusVO.setOffsetp(offsetp); +// statusVO.setPhysicalCode(physicalCode); +// statusVO.setSectionCode(sectionCode); +// statusVO.setType(type); +// statusVO.setDestinationCode(destinationCode); +// statusVO.setPlanRoutingType(planRoutingType); +// statusVO.setTripNumber(tripNumber); +// statusVO.setServiceNumber(serviceNumber); +// statusVO.setGroupNumber(groupNumber); +// statusVO.setDispose(dispose); +// statusVO.setStop(stop); +// statusVO.setBackUp(backUp); +// statusVO.setOrderStop(orderStop); +// statusVO.setCrewNumber(crewNumber); +// return statusVO; } @Override diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainInfo.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainInfo.java index 201b6e860..ed7d1c950 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainInfo.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainInfo.java @@ -38,10 +38,14 @@ public class TrainInfo extends MapElement { private String destinationCode; - /** 是否准备入库 */ + /** + * 是否准备入库 + */ private boolean inbound; - /** 入库删除剩余时间,单位ms */ + /** + * 入库删除剩余时间,单位ms + */ private int deleteRemain; /** @@ -49,25 +53,39 @@ public class TrainInfo extends MapElement { */ private Routing routing; - /** 计划交路类型 */ + /** + * 计划交路类型 + */ private PlanRoutingType planRoutingType; - /** 司机号 */ + /** + * 司机号 + */ private String driverCode; - /** 乘务组号 */ + /** + * 乘务组号 + */ private String crewNumber; - /** 车站 */ + /** + * 车站 + */ private String stationCode; - /** 所处区段 */ + /** + * 所处区段 + */ private String section; - /** 所处物理区段 */ + /** + * 所处物理区段 + */ private String physicalSection; - /** 物理区段偏移量百分比 */ + /** + * 物理区段偏移量百分比 + */ private float offsetp; @Setter @@ -77,95 +95,171 @@ public class TrainInfo extends MapElement { private boolean doorOpen; - /** 跟踪模式 */ + /** + * 跟踪模式 + */ private RunLevel runLevel; - /** 驾驶模式 */ + /** + * 驾驶模式 + */ private DriveMode driveMode; - /** 标记ATP切除状态 */ + /** + * 标记ATP切除状态 + */ private boolean atpCutOffMark; private boolean jump; private boolean hold; - /** 停站状态 */ + /** + * 停站状态 + */ private boolean parking; - /** 站前折返剩余时间,单位ms */ + /** + * 站前折返剩余时间,单位ms + */ private int ftbRemain; - /** 折返 */ + /** + * 折返 + */ private boolean turnBack; - /** 优先排进路 */ + /** + * 优先排进路 + */ private boolean priorityRouteSet; - /** 与计划时间差 */ + /** + * 与计划时间差 + */ private int dt; - /** 计划站台轨 */ + /** + * 计划站台轨 + */ @Setter private String planStandTrack; - /** 计划到点 */ + /** + * 计划到点 + */ private LocalTime planArriveTime; - /** 计划发点 */ + /** + * 计划发点 + */ private LocalTime planLeaveTime; - /** 预计到达站台 */ + /** + * 预计到达站台 + */ private String estimatedArriveStandTrack; - /** 预计到达时间 */ + /** + * 预计到达时间 + */ private LocalTime estimatedArriveTime; - /** 实际到达站台轨 */ + /** + * 实际到达站台轨 + */ private String actualArriveStandTrack; - /** 实际到达时间 */ + /** + * 实际到达时间 + */ private LocalTime actualArriveTime; - /** 预计离开站台 */ + /** + * 预计离开站台 + */ private String estimatedLeaveStandTrack; - /** 预计离开时间 */ + /** + * 预计离开时间 + */ private LocalTime estimatedLeaveTime; - /** 实际离开站台 */ + /** + * 实际离开站台 + */ private String actualLeaveStandTrack; - /** 实际离开时间 */ + /** + * 实际离开时间 + */ private LocalTime actualLeaveTime; - /**备用车*/ + /** + * 备用车 + */ private boolean backUp; - /** 头码车的区段路径 */ + /** + * 头码车的区段路径 + */ @Setter private List
headPath; - /** 下令停车 */ + /** + * 下令停车 + */ private boolean orderStop; - /** 起点车站 */ + /** + * 起点车站 + */ private String startStation; - /** 终点车站 */ + /** + * 终点车站 + */ private String endStation; - /** 运行时间 */ + /** + * 运行时间 + */ private int runningTime; - /** 停站时间 */ + /** + * 停站时间 + */ private int parkingRemainTime; - /** 折返策略 */ + /** + * 折返策略 + */ private String turnBackStrategy; - /** 折返状态 */ - private String turnBackStatus; + /** + * 折返状态 + */ + private String turnBackStatus = NON; + /** + * 无折返 + */ + public static String NON = "NON"; + /** + * 初始化 + */ + public static String INIT = "INIT"; + /** + * 开往折返轨 + */ + public static String TO = "TO"; + /** + * 到达折返轨停稳 + */ + public static String STOP = "STOP"; + /** + * 开出折返轨 + */ + public static String EXIT = "EXIT"; public TrainInfo(String groupNumber) { super(groupNumber, DeviceType.TRAIN); @@ -298,7 +392,16 @@ public class TrainInfo extends MapElement { this.backUp = train.isBackUp(); this.orderStop = train.isOrderStop(); this.runningTime = train.getRunningTime(); - this.parkingRemainTime = train.getParkRemainTime(); + if (train.isParkingAt()) { + this.parkingRemainTime = train.getParkRemainTime(); + } else { + this.parkingRemainTime = -1000; + } + if (speed == 0 && turnBackStatus.equals(TO) && headPosition.getSection().isTurnBackTrack()) { + this.turnBackStatus = STOP; + } else if (speed != 0 && this.turnBackStatus.equals(STOP)) { + this.turnBackStatus = EXIT; + } } public boolean isCbtcTrack() { @@ -336,6 +439,11 @@ public class TrainInfo extends MapElement { this.parking = false; this.actualLeaveStandTrack = section.getCode(); this.actualLeaveTime = leaveTime; + if (!CollectionUtils.isEmpty(section.getStandList())) { + if (section.getStandList().get(0).turnBackTypeNonDefault()) { + this.turnBackStatus = TO; + } + } } public void updatePlanInfo(StationPlan nextStationPlan) { @@ -343,6 +451,7 @@ public class TrainInfo extends MapElement { this.planStandTrack = nextStationPlan.getSection().getCode(); this.planArriveTime = nextStationPlan.getArriveTime(); this.planLeaveTime = nextStationPlan.getLeaveTime(); + this.turnBackStrategy = nextStationPlan.getSection().getStandList().get(0).getTypeStrategy().name(); } else { this.planStandTrack = null; this.planArriveTime = null; @@ -363,6 +472,13 @@ public class TrainInfo extends MapElement { log.warn(String.format("列车[%s-%s|%s|%s]到达车站,没有计划到达,无法更新到达与计划误差时间", groupNumber, serviceNumber, tripNumber, destinationCode)); } + if (EXIT.equals(this.turnBackStatus)) { + this.turnBackStatus = NON; + } else if (!CollectionUtils.isEmpty(section.getStandList())) { + if (section.getStandList().get(0).turnBackTypeNonDefault()) { + this.turnBackStatus = INIT; + } + } } public void updateEstimatedArriveInfo(Section section, LocalTime arriveTime) { @@ -422,7 +538,7 @@ public class TrainInfo extends MapElement { } public void frontTurnBackStart() { - this.ftbRemain = SimulationConstants.FRONT_TURN_BACK_TIME*1000; + this.ftbRemain = SimulationConstants.FRONT_TURN_BACK_TIME * 1000; } public void updateFtbRemain(int ftbRemain) { @@ -439,7 +555,7 @@ public class TrainInfo extends MapElement { public void finishPlanPrepareInbound() { this.inbound = true; - this.deleteRemain = 5*1000; + this.deleteRemain = 5 * 1000; } public void updateDeleteRemain(int deleteRemain) { @@ -453,7 +569,7 @@ public class TrainInfo extends MapElement { /** * 获取physicalSection并确保它不是null */ - public String getNotNullPhysicalSection(){ + public String getNotNullPhysicalSection() { BusinessExceptionAssertEnum.DATA_ERROR.assertNotNull(physicalSection, String.format("列车[%s]所在物理区段为空", groupNumber)); return physicalSection; } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainStatusVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainStatusVO.java index fb545c43a..2a4590f0f 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainStatusVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/vo/TrainStatusVO.java @@ -5,6 +5,7 @@ import club.joylink.rtss.simulation.cbtc.constant.PlanRoutingType; import club.joylink.rtss.simulation.cbtc.constant.RunLevel; import club.joylink.rtss.simulation.cbtc.constant.TrainType; import club.joylink.rtss.simulation.cbtc.data.map.MapElement; +import club.joylink.rtss.simulation.cbtc.data.status.TrainStatus; import club.joylink.rtss.util.jsonSerialize.Boolean2NumSerializer; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.annotation.JsonSerialize; @@ -35,6 +36,8 @@ public class TrainStatusVO extends DeviceStatusVO { /** 乘务组号 */ private String crewNumber; + private String stationCode; + /** 计划交路类型 */ @JsonInclude(JsonInclude.Include.ALWAYS) private PlanRoutingType planRoutingType; @@ -116,10 +119,47 @@ public class TrainStatusVO extends DeviceStatusVO { private Integer parkingRemainTime; + private String turnBackStrategy; + + private String turnBackStatus; + public TrainStatusVO(TrainInfo train) { super(train.getGroupNumber(), MapElement.DeviceType.TRAIN); } + public TrainStatusVO(TrainStatus train) { + super(train.getGroupNumber(), MapElement.DeviceType.TRAIN); + this.serviceNumber = train.getServiceNumber(); + this.tripNumber = train.getTripNumber(); + this.destinationCode = train.getDestinationCode(); + this.crewNumber = train.getCrewNumber(); + this.planRoutingType = train.getPlanRoutingType(); + this.sectionCode = train.getSectionCode(); + this.physicalCode = train.getPhysicalCode(); + this.offsetp = train.getOffsetp(); + this.speed = train.getSpeed(); + this.right = train.getRight(); + this.doorCloseLock = train.isDoorCloseLock(); + this.stop = train.isStop(); + this.type = train.getType(); + this.runLevel = train.getRunLevel(); + this.driveMode = train.getDriveMode(); + this.jump = train.isJump(); + this.hold = train.isHold(); + this.dt = train.getDt(); + this.dispose = train.isDispose(); + this.backUp = train.isBackUp(); + this.orderStop = train.isOrderStop(); + this.startStation = train.getStartStation(); + this.endStation = train.getEndStation(); + this.runningTime = train.getRunningTime(); + this.parkingRemainTime = train.getParkingRemainTime(); + this.turnBackStrategy = train.getTurnBackStrategy(); + this.turnBackStatus = train.getTurnBackStatus(); + } + + + public TrainStatusVO(String groupNumber) { super(groupNumber, MapElement.DeviceType.TRAIN); } diff --git a/src/main/java/club/joylink/rtss/vo/map/MapStationStandNewVO.java b/src/main/java/club/joylink/rtss/vo/map/MapStationStandNewVO.java index 915020afb..8e7149ca3 100644 --- a/src/main/java/club/joylink/rtss/vo/map/MapStationStandNewVO.java +++ b/src/main/java/club/joylink/rtss/vo/map/MapStationStandNewVO.java @@ -1,5 +1,6 @@ package club.joylink.rtss.vo.map; +import club.joylink.rtss.simulation.cbtc.data.map.Stand; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @@ -46,7 +47,7 @@ public class MapStationStandNewVO { /** * 默认折返策略(02-无人折返,03-自动换端) */ - private String defaultReentryStrategy; + private Stand.TurnBackType defaultReentryStrategy; /**