This commit is contained in:
DU 2021-02-23 14:11:09 +08:00
commit 8d424521af
12 changed files with 120 additions and 3 deletions

View File

@ -39,6 +39,8 @@ public class Operation {
// Switch_Single_Lock_Chain(), // Switch_Single_Lock_Chain(),
// /** 单解(联动) */ // /** 单解(联动) */
// Switch_Single_Unlock_Chain(), // Switch_Single_Unlock_Chain(),
/** 初始化封锁 */
Switch_Initialize_Block,
/** 封锁 */ /** 封锁 */
Switch_Block(), Switch_Block(),
/** 解封 */ /** 解封 */
@ -149,6 +151,10 @@ public class Operation {
Signal_Cancel_Auto_Turn_Back, Signal_Cancel_Auto_Turn_Back,
/** 信号机总取消 */ /** 信号机总取消 */
Signal_Total_Cancel, Signal_Total_Cancel,
/** 初始化引导 */
Signal_Initialize_Guide,
/** 取消引导的初始化 */
Signal_Cancel_Guide_Initialization,
/** 办理引导 */ /** 办理引导 */
Signal_Set_Guide, Signal_Set_Guide,
/** 取消引导 */ /** 取消引导 */

View File

@ -275,6 +275,22 @@ public class SignalOperateHandler {
atsRouteService.totalCancel(simulation, signalCode); atsRouteService.totalCancel(simulation, signalCode);
} }
/**
* 初始化引导
*/
@OperateHandlerMapping(type = Operation.Type.Signal_Initialize_Guide)
public void initializeGuide(Simulation simulation, String signalCode) {
ciApiService.initializeGuide(simulation, signalCode);
}
/**
* 初始化引导
*/
@OperateHandlerMapping(type = Operation.Type.Signal_Cancel_Guide_Initialization)
public void cancelGuideInitialization(Simulation simulation, String signalCode) {
ciApiService.cancelGuideInitialization(simulation, signalCode);
}
/** /**
* 办理引导 * 办理引导
*/ */

View File

@ -164,6 +164,12 @@ public class SwitchOperateHandler {
// } // }
// } // }
/**道岔初始化封锁*/
@OperateHandlerMapping(type =Operation.Type.Switch_Initialize_Block)
public void initializeBlock(Simulation simulation, String switchCode) {
ciApiService.initializeBlock(simulation, switchCode);
}
/**道岔封锁l*/ /**道岔封锁l*/
@OperateHandlerMapping(type =Operation.Type.Switch_Block) @OperateHandlerMapping(type =Operation.Type.Switch_Block)
public void blockadeSwitch(Simulation simulation, String switchCode) { public void blockadeSwitch(Simulation simulation, String switchCode) {

View File

@ -346,4 +346,19 @@ public interface CiApiService {
* 命令 * 命令
*/ */
void switchCommand(Simulation simulation, String switchCode, Boolean auto, Boolean reserve, Boolean normal); void switchCommand(Simulation simulation, String switchCode, Boolean auto, Boolean reserve, Boolean normal);
/**
* 初始化封锁
*/
void initializeBlock(Simulation simulation, String switchCode);
/**
* 初始化引导
*/
void initializeGuide(Simulation simulation, String signalCode);
/**
* 取消引导的初始化
*/
void cancelGuideInitialization(Simulation simulation, String signalCode);
} }

View File

@ -153,13 +153,19 @@ public class CiApiServiceImpl implements CiApiService {
@Override @Override
public void blockadeSwitch(Simulation simulation, String switchCode) { public void blockadeSwitch(Simulation simulation, String switchCode) {
Switch aSwitch = simulation.getRepository().getByCode(switchCode, Switch.class); Switch aSwitch = simulation.getRepository().getByCode(switchCode, Switch.class);
if (simulation.getRepository().getConfig().isBlockadeCommandOnlyValidInStandbyMode()) { //条件检查
MapConfig config = simulation.getRepository().getConfig();
if (config.isBlockadeCommandOnlyValidInStandbyMode()) {
boolean standbyMode = simulation.getRepository().getRouteList() boolean standbyMode = simulation.getRepository().getRouteList()
.stream().filter(route -> route.isRouteSwitch(aSwitch)).anyMatch(route -> !route.isCbtcMode()); //包含该道岔的进路是否有处于后备模式的 .stream().filter(route -> route.isRouteSwitch(aSwitch)).anyMatch(route -> !route.isCbtcMode()); //包含该道岔的进路是否有处于后备模式的
if (!standbyMode) { if (!standbyMode) {
return; return;
} }
} }
if (config.isSomeCommandNeedInit()) {
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(aSwitch.isInit(), aSwitch.debugStr() + "未初始化");
}
this.switchService.blockade(aSwitch); this.switchService.blockade(aSwitch);
} }
@ -424,6 +430,9 @@ public class CiApiServiceImpl implements CiApiService {
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotNull(signal.getLockedRoute(), String.format("信号机[%s]无已办理进路", signal.getCode())); BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotNull(signal.getLockedRoute(), String.format("信号机[%s]无已办理进路", signal.getCode()));
} }
} }
if (config.isSomeCommandNeedInit()) {
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signal.isInit(), signal.debugStr() + "未初始化");
}
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signal.isClose(), String.format("信号机[%s]需处于关闭状态", signal.getCode())); BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(signal.isClose(), String.format("信号机[%s]需处于关闭状态", signal.getCode()));
boolean signalApproachOccupied = signal.getApproachPathList() boolean signalApproachOccupied = signal.getApproachPathList()
.stream().anyMatch(sectionPath -> sectionPath.getSectionList().stream().anyMatch(Section::isOccupied)); .stream().anyMatch(sectionPath -> sectionPath.getSectionList().stream().anyMatch(Section::isOccupied));
@ -548,10 +557,17 @@ public class CiApiServiceImpl implements CiApiService {
if (!section.isAxleCounter()) { if (!section.isAxleCounter()) {
section = section.getParent(); section = section.getParent();
} }
//条件检查
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(section != null && section.isAxleCounter(), BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(section != null && section.isAxleCounter(),
chooseSection.debugStr() + "不是计轴区段"); chooseSection.debugStr() + "不是计轴区段");
VirtualRealitySectionAxleCounter virtualAxleCounter = section.getVirtualAxleCounter(); VirtualRealitySectionAxleCounter virtualAxleCounter = section.getVirtualAxleCounter();
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(virtualAxleCounter.isOccupy(), chooseSection + "计轴未占用,无需预复位"); BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(virtualAxleCounter.isOccupy(), chooseSection.debugStr() + "计轴未占用,无需预复位");
if (simulation.getRepository().getConfig().isStationPreResetBeforeAxlePreReset()) {
Station station = section.getStation();
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(station, chooseSection.debugStr() + "没有所属车站");
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(station.isPreReset(), station.debugStr() + "需处于预复位状态");
}
virtualAxleCounter.preReset(); virtualAxleCounter.preReset();
} }
@ -586,4 +602,22 @@ public class CiApiServiceImpl implements CiApiService {
aSwitch.setDispatcherReserve(reserve); aSwitch.setDispatcherReserve(reserve);
} }
} }
@Override
public void initializeBlock(Simulation simulation, String switchCode) {
Switch aSwitch = simulation.getRepository().getByCode(switchCode, Switch.class);
aSwitch.setInit(true);
}
@Override
public void initializeGuide(Simulation simulation, String signalCode) {
Signal signal = simulation.getRepository().getByCode(signalCode, Signal.class);
signal.setInit(true);
}
@Override
public void cancelGuideInitialization(Simulation simulation, String signalCode) {
Signal signal = simulation.getRepository().getByCode(signalCode, Signal.class);
signal.setInit(false);
}
} }

View File

@ -118,6 +118,7 @@ public class SignalService {
} else { } else {
signal.guideStart(); signal.guideStart();
} }
signal.setInit(false);
} }
/** /**

View File

@ -116,6 +116,7 @@ public class SwitchService {
aSwitch.getB().setBlockade(true); aSwitch.getB().setBlockade(true);
aSwitch.getC().setBlockade(true); aSwitch.getC().setBlockade(true);
} }
aSwitch.setInit(false);
} }
/** /**

View File

@ -191,6 +191,16 @@ public class MapConfig {
*/ */
private boolean blockadeCommandOnlyValidInStandbyMode; private boolean blockadeCommandOnlyValidInStandbyMode;
/**
* 一些命令需要初始化泰雷兹道岔封锁信号机开放引导
*/
private boolean someCommandNeedInit;
/**
* 计轴预复位前需要车站预复位
*/
private boolean stationPreResetBeforeAxlePreReset;
private Set<SimulationMember.Type> needConfirmConnectMembers = private Set<SimulationMember.Type> needConfirmConnectMembers =
Stream.of(DISPATCHER, STATION_SUPERVISOR, MAINTAINER, ELECTRIC_DISPATCHER).collect(Collectors.toSet()); Stream.of(DISPATCHER, STATION_SUPERVISOR, MAINTAINER, ELECTRIC_DISPATCHER).collect(Collectors.toSet());
@ -230,6 +240,8 @@ public class MapConfig {
setNeedApproachLockBeforeSetGuide(configVO.isNeedApproachLockBeforeSetGuide()); setNeedApproachLockBeforeSetGuide(configVO.isNeedApproachLockBeforeSetGuide());
setStandSkipSetTrainOnlyOnce(configVO.isStandSkipSetTrainOnlyOnce()); setStandSkipSetTrainOnlyOnce(configVO.isStandSkipSetTrainOnlyOnce());
setBlockadeCommandOnlyValidInStandbyMode(configVO.isBlockadeCommandOnlyValidInStandbyMode()); setBlockadeCommandOnlyValidInStandbyMode(configVO.isBlockadeCommandOnlyValidInStandbyMode());
setSomeCommandNeedInit(configVO.isSwitchBlockadeCommandNeedInit());
setStationPreResetBeforeAxlePreReset(configVO.isStationPreResetBeforeAxlePreReset());
} }
} }

View File

@ -196,6 +196,11 @@ public class Signal extends MayOutOfOrderDevice {
*/ */
private boolean noStatus; private boolean noStatus;
/**
* 初始化
*/
private boolean init;
@Override @Override
public void reset() { public void reset() {
super.reset(); super.reset();
@ -212,6 +217,7 @@ public class Signal extends MayOutOfOrderDevice {
this.approachMsg = SignalApproachMessage.ApproachMessage.NULL; this.approachMsg = SignalApproachMessage.ApproachMessage.NULL;
this.forcePhysical = false; this.forcePhysical = false;
this.noStatus = false; this.noStatus = false;
this.init = false;
} }
@Override @Override

View File

@ -406,6 +406,10 @@ public class Station extends MayOutOfOrderDevice {
return this.preResetValidDuration.get() / 1000; return this.preResetValidDuration.get() / 1000;
} }
public boolean isPreReset() {
return this.preResetValidDuration != null && this.preResetValidDuration.get() > 0;
}
public enum ControlMode { public enum ControlMode {
/** /**
* 交出未被接收 * 交出未被接收
@ -481,7 +485,7 @@ public class Station extends MayOutOfOrderDevice {
} }
public String debugStr() { public String debugStr() {
return String.format("%s", this.getName()); return String.format("车站[%s]", this.getName());
} }
@Override @Override

View File

@ -124,6 +124,11 @@ public class Switch extends MayOutOfOrderDevice {
*/ */
private boolean blockadeInvalid; private boolean blockadeInvalid;
/**
* 初始化
*/
private boolean init;
@Override @Override
public void reset() { public void reset() {
super.reset(); super.reset();
@ -142,6 +147,7 @@ public class Switch extends MayOutOfOrderDevice {
this.dispatcherReserve = false; this.dispatcherReserve = false;
this.interlockReserve = false; this.interlockReserve = false;
this.blockadeInvalid = false; this.blockadeInvalid = false;
this.init = false;
} }
/** /**

View File

@ -130,6 +130,16 @@ public class RealLineConfigVO {
*/ */
private boolean blockadeCommandOnlyValidInStandbyMode; private boolean blockadeCommandOnlyValidInStandbyMode;
/**
* 道岔封锁命令需要初始化
*/
private boolean switchBlockadeCommandNeedInit;
/**
* 计轴预复位前需要车站预复位
*/
private boolean stationPreResetBeforeAxlePreReset;
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);