This commit is contained in:
tiger_zhou 2022-08-24 09:07:31 +08:00
commit ab8f0d3556
10 changed files with 99 additions and 44 deletions

View File

@ -4,25 +4,31 @@ import lombok.Getter;
@Getter @Getter
public enum MapPrdTypeEnum { public enum MapPrdTypeEnum {
LOCAL("01", "ATS现地工作站"), LOCAL("01", "ATS现地工作站", "车站"),
CENTER("02", "ATS行调工作站"), CENTER("02", "ATS行调工作站", "调度台"),
JOINT("03", "综合演练云平台"), JOINT("03", "综合演练云平台", null),
DRIVER("04", "司机模拟驾驶系统"), DRIVER("04", "司机模拟驾驶系统", null),
SCHEDULING("05", "派班工作站"), SCHEDULING("05", "派班工作站", null),
ISCS("06", "ISCS工作站"), ISCS("06", "ISCS工作站", null),
BIG_SCREEN("07", "大屏工作站"), BIG_SCREEN("07", "大屏工作站", null),
RUN_PLAN_MAKE("08", "运行图编制工作站"), RUN_PLAN_MAKE("08", "运行图编制工作站", null),
DEPOT_IL("09", "车辆段联锁工作站"), DEPOT_IL("09", "车辆段联锁工作站", null),
CTC("10", "CTC工作站") // CTC("10", "CTC工作站")
; ;
private String code; private String code;
private String msg; private String msg;
MapPrdTypeEnum(String code, String msg) { /**
* 大铁子系统名称
*/
private String railName;
MapPrdTypeEnum(String code, String msg, String railName) {
this.code = code; this.code = code;
this.msg = msg; this.msg = msg;
this.railName = railName;
} }
public static MapPrdTypeEnum getMapPrdTypeEnumByCode(String code) { public static MapPrdTypeEnum getMapPrdTypeEnumByCode(String code) {

View File

@ -64,20 +64,18 @@ public class MapSystemService implements IMapSystemService {
public void generateSystem(Long mapId) { public void generateSystem(Long mapId) {
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(iMapService.isExist(mapId), BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertTrue(iMapService.isExist(mapId),
String.format("id为[%s]的地图不存在", mapId)); String.format("id为[%s]的地图不存在", mapId));
for (MapPrdTypeEnum value : MapPrdTypeEnum.values()) {
if (MapPrdTypeEnum.CTC.equals(value)) {
MapVO mapDetail = iMapService.getMapDetail(mapId); MapVO mapDetail = iMapService.getMapDetail(mapId);
if (!mapDetail.getConfigVO().isRailway()) { for (MapPrdTypeEnum value : MapPrdTypeEnum.values()) {
boolean railway = mapDetail.getConfigVO().isRailway();
if (railway && value.getRailName() == null)
continue; continue;
} generate(mapId, value, railway);
}
generate(mapId, value);
} }
} }
private void generate(Long mapId, MapPrdTypeEnum value) { private void generate(Long mapId, MapPrdTypeEnum value, boolean railway) {
MapSystem system = new MapSystem(); MapSystem system = new MapSystem();
system.setName(value.getMsg()); system.setName(railway ? value.getRailName() : value.getMsg());
system.setMapId(mapId); system.setMapId(mapId);
system.setPrdType(value.getCode()); system.setPrdType(value.getCode());
system.setStatus(StatusEnum.Valid.getCode()); system.setStatus(StatusEnum.Valid.getCode());
@ -108,7 +106,12 @@ public class MapSystemService implements IMapSystemService {
String.format("id为[%s]的地图不存在", mapId)); String.format("id为[%s]的地图不存在", mapId));
MapPrdTypeEnum prdTypeEnum = MapPrdTypeEnum.getMapPrdTypeEnumByCode(prdType); MapPrdTypeEnum prdTypeEnum = MapPrdTypeEnum.getMapPrdTypeEnumByCode(prdType);
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(prdTypeEnum); BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertNotNull(prdTypeEnum);
generate(mapId, prdTypeEnum); MapVO mapDetail = iMapService.getMapDetail(mapId);
boolean railway = mapDetail.getConfigVO().isRailway();
if (railway && prdTypeEnum.getRailName() == null) {
return;
}
generate(mapId, prdTypeEnum, railway);
} }
private boolean isExist(Long mapId, String prdType, String type) { private boolean isExist(Long mapId, String prdType, String type) {

View File

@ -86,19 +86,30 @@ public class CiLogic {
* 区段停稳倒计时 * 区段停稳倒计时
*/ */
public void sectionStopCountDown(Simulation simulation) { public void sectionStopCountDown(Simulation simulation) {
for (Stand stand : simulation.getRepository().getStandList()) { for (Section section : simulation.getRepository().getHasStopCountDownSections()) {
Section track = stand.getSection(); int stopCountDown = section.getStopCountDown();
if (track.getStopCountDown() == null) { if (stopCountDown == 0) {
//股道占用且股道两边没有占用 //股道占用且股道有占用
if (track.isOccupied()) { if (section.isOccupied()) {
if (!track.getNextRunningSectionOf(false).isOccupied() && !track.getNextRunningSectionOf(true).isOccupied()) { if (section.getNextRunningSectionOf(false).isOccupied() || section.getNextRunningSectionOf(true).isOccupied()) {
track.startStopCountDown(); section.readyStartStopCountDown();
} }
} }
} else { } else {
track.setStopCountDown(track.getStopCountDown() - SimulationConstants.CI_LOOP_RATE); if (stopCountDown == -1) {
if (track.getStopCountDown() <= 0) { // 股道占用股道两边没有占用股道没有进路锁闭或该进路正在正常解锁
track.setStopCountDown(null); if (section.isOccupied()) {
if ((!section.getNextRunningSectionOf(false).isOccupied()
&& !section.getNextRunningSectionOf(true).isOccupied())
&& (section.getRoute() == null || section.getRoute().isNormalUnlock())) {
section.startStopCountDown();
}
}
} else {
section.setStopCountDown(stopCountDown - SimulationConstants.CI_LOOP_RATE);
if (stopCountDown <= 0) {
section.setStopCountDown(0);
}
} }
} }
} }

View File

@ -1116,6 +1116,7 @@ public class MapDeviceBuilder {
section.setVirtualAxleCounter(axleCounter); section.setVirtualAxleCounter(axleCounter);
deviceMap.put(axleCounter.getCode(), axleCounter); deviceMap.put(axleCounter.getCode(), axleCounter);
} }
section.setHasStopCountDown(sectionVO.isHasStopCD());
} }
} }

View File

@ -1248,4 +1248,10 @@ public class SimulationDataRepository {
} }
return stream.collect(Collectors.toList()); return stream.collect(Collectors.toList());
} }
public List<Section> getHasStopCountDownSections() {
return getListByType(MapElement.DeviceType.SECTION, Section.class).stream()
.filter(Section::isHasStopCountDown)
.collect(Collectors.toList());
}
} }

View File

@ -164,6 +164,11 @@ public class Section extends DelayUnlockDevice {
*/ */
private Set<ZC> zcs = new HashSet<>(); private Set<ZC> zcs = new HashSet<>();
/**
* 有停稳计时
*/
private boolean hasStopCountDown;
// ------------------状态属性--------------------- // ------------------状态属性---------------------
/** /**
@ -263,8 +268,11 @@ public class Section extends DelayUnlockDevice {
/** /**
* 停稳倒计时 * 停稳倒计时
* 0 表示初始状态
* -1 表示准备开始计时
* 非负数表示当前计时
*/ */
private Integer stopCountDown; private int stopCountDown;
@Override @Override
public void reset() { public void reset() {
@ -287,7 +295,7 @@ public class Section extends DelayUnlockDevice {
this.closed = false; this.closed = false;
this.badShunt = false; this.badShunt = false;
this.shuntingTypeList = new ArrayList<>(); this.shuntingTypeList = new ArrayList<>();
this.stopCountDown = null; this.stopCountDown = 0;
} }
/** /**
@ -297,14 +305,19 @@ public class Section extends DelayUnlockDevice {
stopCountDown = 40 * 1000; stopCountDown = 40 * 1000;
} }
public Integer getStopCountDownInSeconds() { /**
return stopCountDown == null ? null : stopCountDown / 1000; * 准备开始停稳倒计时
*/
public void readyStartStopCountDown() {
stopCountDown = -1;
}
public int getStopCountDownInSeconds() {
return stopCountDown / 1000;
} }
/** /**
* 区段是否被列车占用 * 区段是否被列车占用
*
* @return
*/ */
public boolean isOccupied() { public boolean isOccupied() {
return this.nctOccupied || this.ctOccupied || this.isLogicOccupied(); return this.nctOccupied || this.ctOccupied || this.isLogicOccupied();

View File

@ -253,12 +253,12 @@ public class SectionStatus extends DeviceStatus {
this.badShunt = section.isBadShunt(); this.badShunt = section.isBadShunt();
status.setBadShunt(this.badShunt); status.setBadShunt(this.badShunt);
} }
Integer stopCountDownInSeconds = section.getStopCountDownInSeconds(); int stopCountDownInSeconds = section.getStopCountDownInSeconds();
if (!Objects.equals(this.stopCountDown, stopCountDownInSeconds)) { if (!Objects.equals(this.stopCountDown, stopCountDownInSeconds)) {
change = true; change = true;
this.stopCountDown = stopCountDownInSeconds; this.stopCountDown = stopCountDownInSeconds;
} }
status.setStopCountDown(stopCountDown == null ? null : stopCountDown); status.setStopCountDown(stopCountDown == 0 ? null : stopCountDown);
return change; return change;
} }

View File

@ -106,6 +106,11 @@ public class StorageSection extends StorageDelayUnlockDevice {
*/ */
private Boolean badShunt; private Boolean badShunt;
/**
* 停稳倒计时
*/
private Integer stopCountDown;
public StorageSection(Section section) { public StorageSection(Section section) {
super(section); super(section);
} }
@ -176,6 +181,10 @@ public class StorageSection extends StorageDelayUnlockDevice {
this.shuntingTypeList = section.getShuntingTypeList(); this.shuntingTypeList = section.getShuntingTypeList();
this.badShunt = section.isBadShunt(); this.badShunt = section.isBadShunt();
} }
if (section.getStopCountDown() != 0) {
change = true;
this.stopCountDown = section.getStopCountDown();
}
return change; return change;
} }
@ -197,5 +206,6 @@ public class StorageSection extends StorageDelayUnlockDevice {
section.setSpeedLimitBeforeFault(speedLimitBeforeFault); section.setSpeedLimitBeforeFault(speedLimitBeforeFault);
section.setShuntingTypeList(shuntingTypeList != null ? shuntingTypeList : new ArrayList<>()); section.setShuntingTypeList(shuntingTypeList != null ? shuntingTypeList : new ArrayList<>());
section.setBadShunt(badShunt != null ? badShunt : false); section.setBadShunt(badShunt != null ? badShunt : false);
section.setStopCountDown(stopCountDown == null ? 0 : stopCountDown);
} }
} }

View File

@ -106,11 +106,11 @@ public class MemberManager {
this.playRole(simulation, userId, ddList.get(0).getId()); this.playRole(simulation, userId, ddList.get(0).getId());
break; break;
} }
case CTC: { // case CTC: {
List<SimulationMember> list = simulation.querySimulationMembersOfRole(SimulationMember.Type.RAIL_CTC); // List<SimulationMember> list = simulation.querySimulationMembersOfRole(SimulationMember.Type.RAIL_CTC);
this.playRole(simulation, userId, list.get(0).getId()); // this.playRole(simulation, userId, list.get(0).getId());
break; // break;
} // }
} }
} }
} }

View File

@ -48,6 +48,11 @@ public class MapSectionNewVO {
*/ */
private Point namePosition; private Point namePosition;
/**
* 有停稳计时
*/
private boolean hasStopCD;
/** /**
* 停车倒计时显示坐标 * 停车倒计时显示坐标
*/ */