【区段分路不良操作】

This commit is contained in:
weizhihong 2022-05-18 15:06:56 +08:00
parent 015438cfad
commit f8ebf7e691
14 changed files with 242 additions and 68 deletions

View File

@ -212,6 +212,10 @@ public class Operation {
*/
Section_Close,
/**
* 区段分路不良设置
*/
Section_Defective_Shunting,
//--------------------------- 信号机 ---------------------------
/**
* 封锁
@ -451,7 +455,7 @@ public class Operation {
* 回复连锁控请求同意/拒绝
*/
CM_Reply_Interlock_Control(),
/**
* 大铁非常站控
*/
@ -564,6 +568,10 @@ public class Operation {
*/
Station_Master_Unlock,
/**
* 分路不良大铁
*/
Station_Set_Defective_Shunting,
//--------------------------- 列车 ---------------------------
/**
* 在指定区段加载一辆计划列车本地开发使用

View File

@ -26,21 +26,27 @@ public class SectionOperateHandler {
@Autowired
private AtsSectionService atsSectionService;
/**区段跟踪切除*/
/**
* 区段跟踪切除
*/
@OperateHandlerMapping(type = Operation.Type.Section_Cut_Off)
public void cutoff(Simulation simulation, String sectionCode) {
Section section = simulation.getRepository().getByCode(sectionCode, Section.class);
atsSectionService.cutoff(simulation, section);
}
/**区段跟踪激活*/
/**
* 区段跟踪激活
*/
@OperateHandlerMapping(type = Operation.Type.Section_Active)
public void active(Simulation simulation, String sectionCode) {
Section section = simulation.getRepository().getByCode(sectionCode, Section.class);
atsSectionService.active(simulation, section);
}
/**设置临时限速*/
/**
* 设置临时限速
*/
@OperateHandlerMapping(type = Operation.Type.Section_Set_Limit_Speed)
public void setLimitSpeed(Simulation simulation, String sectionCode, String speedLimitValue) {
int limitSpeed;
@ -52,32 +58,42 @@ public class SectionOperateHandler {
this.groundAtpApiService.setSectionLimitSpeed(simulation, sectionCode, limitSpeed);
}
/**取消临时限速*/
/**
* 取消临时限速
*/
@OperateHandlerMapping(type = Operation.Type.Section_Cancel_Limit_Speed)
public void cancelLimitSpeed(Simulation simulation, String sectionCode) {
this.groundAtpApiService.cancelSectionLimitSpeed(simulation, sectionCode);
}
/**屏蔽一次临时限速*/
/**
* 屏蔽一次临时限速
*/
@OperateHandlerMapping(type = Operation.Type.Section_Shield_Limit_Speed)
public void shieldLimitSpeed(Simulation simulation, String sectionCode) {
this.groundAtpApiService.shieldLimitSpeed(simulation, sectionCode);
}
/**取消全线临时限速*/
/**
* 取消全线临时限速
*/
@OperateHandlerMapping(type = Operation.Type.Cancel_All_Limit_Speed)
public void cancelAllLimitSpeed(Simulation simulation) {
simulation.getRepository().getSectionList().forEach(section -> this.groundAtpApiService.cancelSectionLimitSpeed(simulation, section.getCode()));
}
/**区段故障解锁l*/
@OperateHandlerMapping(type =Operation.Type.Section_Fault_Unlock)
/**
* 区段故障解锁l
*/
@OperateHandlerMapping(type = Operation.Type.Section_Fault_Unlock)
public void sectionFaultUnlock(Simulation simulation, String sectionCode) {
ciApiService.sectionFaultUnlock(simulation, sectionCode);
}
/**区段封锁l*/
@OperateHandlerMapping(type =Operation.Type.Section_Block)
/**
* 区段封锁l
*/
@OperateHandlerMapping(type = Operation.Type.Section_Block)
public void blockadeSection(Simulation simulation, String sectionCode) {
Section section = simulation.getRepository().getByCode(sectionCode, Section.class);
if (section.isSwitchTrack()) { // 如果是道岔区段
@ -86,8 +102,10 @@ public class SectionOperateHandler {
ciApiService.blockadeSection(simulation, section.getCode());
}
/**区段解锁l*/
@OperateHandlerMapping(type =Operation.Type.Section_Unblock)
/**
* 区段解锁l
*/
@OperateHandlerMapping(type = Operation.Type.Section_Unblock)
public void unblockSection(Simulation simulation, String sectionCode) {
Section section = simulation.getRepository().getByCode(sectionCode, Section.class);
if (section.isSwitchTrack()) { // 取计轴区段
@ -96,19 +114,25 @@ public class SectionOperateHandler {
ciApiService.unblockSection(simulation, section.getCode());
}
/**区段计轴预复位*/
@OperateHandlerMapping(type =Operation.Type.Section_Axis_Pre_Reset)
/**
* 区段计轴预复位
*/
@OperateHandlerMapping(type = Operation.Type.Section_Axis_Pre_Reset)
public void axisPreReset(Simulation simulation, String sectionCode) {
ciApiService.axlePreReset(simulation, sectionCode);
}
/**区段计轴复位*/
@OperateHandlerMapping(type =Operation.Type.Section_Reset)
/**
* 区段计轴复位
*/
@OperateHandlerMapping(type = Operation.Type.Section_Reset)
public void axleReset(Simulation simulation, String sectionCode) {
ciApiService.axleReset(simulation, sectionCode);
}
/**确认计轴有效*/
/**
* 确认计轴有效
*/
@OperateHandlerMapping(type = Operation.Type.Section_Confirm_Axis_Valid)
public void confirmAxisValid(Simulation simulation, String sectionCode) {
//ZC 系统
@ -140,4 +164,15 @@ public class SectionOperateHandler {
atsSectionService.close(simulation, section);
}
/**
* 设置区段分路不良类型
*
* @param simulation 仿真实体
* @param sectionCode 区段编码
* @param types 分路不良类型列表
*/
@OperateHandlerMapping(type = Operation.Type.Section_Defective_Shunting)
public void defectiveShunting(Simulation simulation, String sectionCode, String types) {
atsSectionService.defectiveShunting(simulation, sectionCode, types);
}
}

View File

@ -318,4 +318,15 @@ public class StationOperateHandler {
public void specialStationControl(Simulation simulation, SimulationMember fromMember, String stationCode, Integer pressDown) {
atsStationService.specialStationControl(simulation, fromMember, stationCode, pressDown);
}
/**
* 车站设置分路不良
*
* @param simulation 仿真实体
* @param stationCode 车站编码
*/
@OperateHandlerMapping(type = Operation.Type.Station_Set_Defective_Shunting)
public void setDefectiveShunting(Simulation simulation, String stationCode) {
atsStationService.setDefectiveShunting(simulation, stationCode);
}
}

View File

@ -1,11 +1,13 @@
package club.joylink.rtss.simulation.cbtc.ATS.service;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.map.Section;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.Objects;
@ -16,9 +18,11 @@ import java.util.Objects;
@Slf4j
public class AtsSectionService {
/**区段跟踪切除*/
/**
* 区段跟踪切除
*/
public void cutoff(Simulation simulation, Section section) {
log.debug("仿真[{}] : 区段[{}]切除",simulation.getId(),String.format("%s(%s)", section.getName(), section.getCode()));
log.debug("仿真[{}] : 区段[{}]切除", simulation.getId(), String.format("%s(%s)", section.getName(), section.getCode()));
if (Objects.nonNull(section.getParent())) {
section = section.getParent();
}
@ -30,9 +34,11 @@ public class AtsSectionService {
}
}
/**区段跟踪激活*/
/**
* 区段跟踪激活
*/
public void active(Simulation simulation, Section section) {
log.debug("仿真[{}] : 区段[{}]激活",simulation.getId(),String.format("%s(%s)", section.getName(), section.getCode()));
log.debug("仿真[{}] : 区段[{}]激活", simulation.getId(), String.format("%s(%s)", section.getName(), section.getCode()));
if (Objects.nonNull(section.getParent())) {
section = section.getParent();
}
@ -45,7 +51,7 @@ public class AtsSectionService {
}
public void confirmAxleValid(Simulation simulation, Section section) {
log.debug("仿真[{}] : 区段[{}]确认计轴有效",simulation.getId(),String.format("%s(%s)", section.getName(), section.getCode()));
log.debug("仿真[{}] : 区段[{}]确认计轴有效", simulation.getId(), String.format("%s(%s)", section.getName(), section.getCode()));
if (Objects.nonNull(section.getParent())) {
section = section.getParent();
}
@ -87,4 +93,23 @@ public class AtsSectionService {
section.setCloseInit(false);
section.setClosed(true);
}
/**
* 设置区段分路不良类型
*
* @param simulation 仿真实体
* @param sectionCode 区段编码
* @param types 分路不良类型列表
*/
public void defectiveShunting(Simulation simulation, String sectionCode, String types) {
if (StringUtils.isEmpty(sectionCode)) {
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "区段不能为空");
}
// 设置区段的不良类型
Section section = simulation.getRepository().getByCode(sectionCode, Section.class);
section.setDefectiveShuntingTypes(types);
// 弹起车站的分路不良按钮
section.getStation().getDefectiveShuntingRemain().set(0);
section.getStation().setDefectiveShunting(false);
}
}

View File

@ -578,4 +578,19 @@ public class AtsStationService {
new OperationMessage(fromMember.getId(), new HashSet<>(Collections.singleton(fromMember)),
operationType, null, true, Arrays.asList(stationCode)));
}
/**
* 按下分路不良
*
* @param simulation 仿真实体
* @param stationCode 车站编码
*/
public void setDefectiveShunting(Simulation simulation, String stationCode) {
if (StringUtils.isEmpty(stationCode)) {
throw new SimulationException(SimulationExceptionType.Operation_Handle_FAIL, "车站不能为空");
}
Station station = getStation(simulation, stationCode);
station.setDefectiveShunting(true);
station.getDefectiveShuntingRemain().set(15);
}
}

View File

@ -1,7 +1,6 @@
package club.joylink.rtss.simulation.cbtc.ATS.service.assist;
import club.joylink.rtss.constants.DirectionLabelEnum;
import club.joylink.rtss.entity.DraftMapStationDirection;
import club.joylink.rtss.simulation.cbtc.ATS.operation.Operation;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.map.Route;
@ -306,9 +305,7 @@ public class StationDirectionService {
/**
* 刷新区间灯状态
*/
public void refreshSectionLightStatus(Simulation simulation, DraftMapStationDirection draftMapStationDirection) {
Station station = getStationByCode(simulation, draftMapStationDirection.getStationCode());
StationDirection stationDirection = station.getStationDirectionMap().get(draftMapStationDirection.getLabelEnum());
public void refreshSectionLightStatus(Simulation simulation, StationDirection stationDirection) {
if (stationDirection == null) {
return;
}

View File

@ -51,11 +51,28 @@ public class CiLogic {
// 区间灯点灯逻辑
if (simulation.getRepository().getConfig().isHasCTC()) {
// 联锁数据检查
simulation.getBuildParams().getMap().getLogicDataNew().getDraftMapStationDirectionList().stream()
.forEach(stationDirectionLabel -> stationDirectionService.refreshSectionLightStatus(simulation, stationDirectionLabel));
// 允许自律状态刷新
simulation.getRepository().getStationList().stream().forEach(Station::refreshAllowAutonomyStatus);
// 车站
simulation.getRepository().getStationList().stream().forEach(station -> {
// 允许自律状态刷新
station.refreshAllowAutonomyStatus();
// 分路不良倒计时
if (station.getDefectiveShuntingRemain().decrementAndGet() <= 0) {
station.setDefectiveShunting(false);
station.getDefectiveShuntingRemain().set(0);
}
// 发辅助按钮倒计时刷新
station.getStationDirectionMap().values().stream()
.filter(stationDirection -> stationDirection.getRemain().intValue() != 0)
.forEach(stationDirection -> {
// 如果倒数结束弹起接发辅助按钮
if (stationDirection.getRemain().decrementAndGet() <= 0) {
stationDirection.setDeliverAssistStatus(false);
stationDirection.setReceiveAssistStatus(false);
}
// 联锁数据检查
stationDirectionService.refreshSectionLightStatus(simulation, stationDirection);
});
});
}
}

View File

@ -46,8 +46,6 @@ public class CTCLogicLoop {
buildNewCtcStationPlan(simulation);
updateCtcStationPlan(simulation);
sendMessage(simulation);
// 车站运行方向倒计时
refreshStationDirection(simulation);
}
private void sendMessage(Simulation simulation) {
@ -235,24 +233,4 @@ public class CTCLogicLoop {
public void addJobs(Simulation simulation) {
simulation.addJob(NAME, () -> this.run(simulation), RATE);
}
/**
* 运行方向接发辅助按钮倒计时
*
* @param simulation 仿真信息
*/
private void refreshStationDirection(Simulation simulation) {
simulation.getRepository().getStationList()
.forEach(station ->
station.getStationDirectionMap().values().stream()
.filter(stationDirection -> stationDirection.getRemain().intValue() != 0)
.forEach(stationDirection -> {
// 如果倒数结束弹起接发辅助按钮
if (stationDirection.getRemain().decrementAndGet() == 0) {
stationDirection.setDeliverAssistStatus(false);
stationDirection.setReceiveAssistStatus(false);
}
})
);
}
}

View File

@ -27,7 +27,6 @@ public class Section extends DelayUnlockDevice {
this.standList = new ArrayList<>();
}
// ------------------固有属性/关联关系---------------------
/**
@ -164,6 +163,11 @@ public class Section extends DelayUnlockDevice {
*/
private Set<ZC> zcs = new HashSet<>();
/**
* 分路不良类型
*/
private String defectiveShuntingTypes;
// ------------------状态属性---------------------
/**
@ -813,6 +817,7 @@ public class Section extends DelayUnlockDevice {
/**
* 判定为非通信车占用
*
* @param simulation
*/
public void judgeAsNctOccupied(Simulation simulation) {
@ -831,6 +836,7 @@ public class Section extends DelayUnlockDevice {
/**
* 根据道岔位置设置非通信车占用
*
* @param simulation
*/
private void nctOccupiedBySwitchPosition(Simulation simulation) {

View File

@ -191,8 +191,21 @@ public class Station extends MayOutOfOrderDevice {
private boolean xGuideMasterLock;
/**
* 允许自律
*/
private boolean allowAutonomy;
/**
* 分路不良
*/
private boolean defectiveShunting;
/**
* 分路不良倒计时
*/
private AtomicInteger defectiveShuntingRemain = new AtomicInteger(0);
@Override
public void reset() {
@ -540,7 +553,8 @@ public class Station extends MayOutOfOrderDevice {
* 允许自律状态
*/
public boolean refreshAllowAutonomyStatus() {
this.allowAutonomy = !this.stationDirectionMap.values().stream().anyMatch(StationDirection::isExistBtnPressDown);
this.allowAutonomy = !this.stationDirectionMap.values().stream().anyMatch(StationDirection::isExistBtnPressDown)
&& !sGuideMasterLock && !xGuideMasterLock;
return this.allowAutonomy;
}

View File

@ -103,6 +103,8 @@ public class SectionStatus extends DeviceStatus {
private String fault;
private String defectiveShuntingTypes;
public SectionStatus(Section section) {
super(section.getCode(), section.getDeviceType());
this.blockade = section.isBlockade();
@ -122,6 +124,7 @@ public class SectionStatus extends DeviceStatus {
this.closed = section.isClosed();
this.remain = section.getRemain();
this.fault = section.getFault() == null ? null : section.getFault().toString();
this.defectiveShuntingTypes = section.getDefectiveShuntingTypes();
}
@Override
@ -215,6 +218,11 @@ public class SectionStatus extends DeviceStatus {
status.setFault(fault);
change = true;
}
if (!Objects.equals(this.defectiveShuntingTypes, section.getDefectiveShuntingTypes())) {
change = true;
this.defectiveShuntingTypes = section.getDefectiveShuntingTypes();
status.setDefectiveShuntingTypes(this.defectiveShuntingTypes);
}
return change;
}
@ -237,6 +245,7 @@ public class SectionStatus extends DeviceStatus {
statusVO.setDelayUnlock(delayUnlock);
statusVO.setClosed(closed);
statusVO.setFault(fault);
statusVO.setDefectiveShuntingTypes(this.defectiveShuntingTypes);
return statusVO;
}

View File

@ -82,8 +82,21 @@ public class StationStatus extends DeviceStatus {
private boolean xGuideMasterLock;
/**
* 允许自律
*/
private boolean allowAutonomy;
/**
* 分路不良
*/
private boolean defectiveBranch;
/**
* 分路不良倒计时
*/
private int defectiveBranchRemain;
public StationStatus(Station station) {
super(station.getCode(), station.getDeviceType());
controlMode = station.getControlMode();
@ -101,6 +114,8 @@ public class StationStatus extends DeviceStatus {
sGuideMasterLock = station.isSGuideMasterLock();
xGuideMasterLock = station.isXGuideMasterLock();
allowAutonomy = station.isAllowAutonomy();
defectiveBranch = station.isDefectiveShunting();
defectiveBranchRemain = station.getDefectiveShuntingRemain().get();
}
@Override
@ -184,6 +199,16 @@ public class StationStatus extends DeviceStatus {
allowAutonomy = station.isAllowAutonomy();
status.setAllowAutonomy(allowAutonomy);
}
if (!Objects.equals(defectiveBranch, station.isDefectiveShunting())) {
change = true;
defectiveBranch = station.isDefectiveShunting();
status.setDefectiveShunting(defectiveBranch);
}
if (defectiveBranchRemain != station.getDefectiveShuntingRemain().get()) {
change = true;
defectiveBranchRemain = station.getDefectiveShuntingRemain().get();
status.setDefectiveShuntingRemain(defectiveBranchRemain);
}
return change;
}
@ -205,6 +230,8 @@ public class StationStatus extends DeviceStatus {
statusVO.setSGuideMasterLock(sGuideMasterLock);
statusVO.setXGuideMasterLock(xGuideMasterLock);
statusVO.setAllowAutonomy(allowAutonomy);
statusVO.setDefectiveShunting(defectiveBranch);
statusVO.setDefectiveShuntingRemain(defectiveBranchRemain);
return statusVO;
}
}

View File

@ -14,43 +14,63 @@ import lombok.Setter;
@Setter
public class SectionStatusVO extends DeviceStatusVO {
/** 是否封锁 */
/**
* 是否封锁
*/
@JsonSerialize(using = Boolean2NumSerializer.class)
private Boolean blockade;
/** 是否进路锁闭 */
/**
* 是否进路锁闭
*/
@JsonSerialize(using = Boolean2NumSerializer.class)
private Boolean routeLock;
/** 锁闭方向 */
/**
* 锁闭方向
*/
@JsonSerialize(using = Boolean2NumSerializer.class)
private Boolean lockRight;
/** 进路延续保护锁闭 */
/**
* 进路延续保护锁闭
*/
@JsonSerialize(using = Boolean2NumSerializer.class)
private Boolean overlapLock;
/** 通信车占用 */
/**
* 通信车占用
*/
@JsonSerialize(using = Boolean2NumSerializer.class)
private Boolean ctOccupied;
/** 非通信车占用 */
/**
* 非通信车占用
*/
@JsonSerialize(using = Boolean2NumSerializer.class)
private Boolean nctOccupied;
/**是否切除*/
/**
* 是否切除
*/
@JsonSerialize(using = Boolean2NumSerializer.class)
private Boolean cutOff;
/**是否失效*/
/**
* 是否失效
*/
@JsonSerialize(using = Boolean2NumSerializer.class)
private Boolean invalid;
/** 故障锁闭 */
/**
* 故障锁闭
*/
@JsonSerialize(using = Boolean2NumSerializer.class)
private Boolean faultLock;
/**最高限速*/
/**
* 最高限速
*/
private Integer speedUpLimit;
@JsonSerialize(using = Boolean2NumSerializer.class)
@ -73,6 +93,8 @@ public class SectionStatusVO extends DeviceStatusVO {
private Integer remain;
private String defectiveShuntingTypes;
public SectionStatusVO(Section section) {
super(section.getCode(), section.getDeviceType());
}

View File

@ -86,7 +86,17 @@ public class StationStatusVO extends DeviceStatusVO {
private Boolean xGuideMasterLock;
private Boolean allowAutonomy;
/**
* 分路不良
*/
private Boolean defectiveShunting;
/**
* 分路不良倒计时
*/
private Integer defectiveShuntingRemain;
public StationStatusVO(Station station) {
super(station.getCode(), station.getDeviceType());
}