取消进路操作不能取消转换轨进路

保护区段道岔锁闭位置不正确时不触发保护进路办理
修改延时解锁相关逻辑bug
This commit is contained in:
walker-sheng 2021-09-16 18:07:06 +08:00
parent 7b287b9778
commit 097b32b500
7 changed files with 32 additions and 21 deletions

View File

@ -50,11 +50,10 @@ public class SignalOperateHandler {
@OperateHandlerMapping(type = Operation.Type.Signal_Cancel_Route)
public void cancelRoute(Simulation simulation, String signalCode) {
//是否接近区段占用仍执行取消进路
if (simulation.getRepository().getConfig().isSignalForceCancelRoute()) {
Route route = this.ciApiService.findLockedRouteByStartSignal(simulation, signalCode);
if (Objects.nonNull(route)) {
this.ciApiService.humanCancel(simulation, route.getCode());
}
Route route = this.ciApiService.findLockedRouteByStartSignal(simulation, signalCode);
if (route != null && route.isApproachLock() &&
simulation.getRepository().getConfig().isSignalForceCancelRoute()) {
this.ciApiService.humanCancel(simulation, route.getCode());
return;
}
this.atsRouteService.cancelRoute(simulation, signalCode);

View File

@ -182,6 +182,9 @@ public class CiApiServiceImpl2 implements CiApiService {
@Override
public void unlockRoute(Simulation simulation, String routeCode) {
Route route = simulation.getRepository().getByCode(routeCode, Route.class);
if (route.isTransferRoute() && simulation.getRepository().getConfig().isTransferRouteCanOnlyFaultUnlock()) {
throw BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.exception("转换轨进路只能通过区故解取消");
}
if (simulation.getRepository().getConfig().isDelayWhenCancelRouteWithAbnormalInterlock()) {
if (this.ciService.isRouteSwitchLost(simulation, route)) {
this.routeService.delayUnlockStart(simulation, route, route.getStart());
@ -238,8 +241,9 @@ public class CiApiServiceImpl2 implements CiApiService {
}
}
}
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(!lockedRoute.isDelayUnlocking(),
"进路延时解锁,不能区故解");
if (lockedRoute != null && lockedRoute.isDelayUnlocking()) {
throw BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.exception("进路延时解锁中,不能区故解");
}
this.routeService.sectionFaultUnlock(simulation, section, lockedRoute);
}

View File

@ -119,6 +119,9 @@ public class CiLogic {
if (overlap.isForbidden()) {
this.routeService.checkAndAllowOverlap(simulation, overlap);
}
if (overlap.isLock() && !this.ciService.interlockCheck(simulation, overlap)) {
overlap.setLock(false);
}
if (overlap.isSectionOverlapLocked()) {
if (simulation.getRepository().isTrainParking(overlap.getSection())) {
log.debug("列车停稳,延续保护[{}}],触发区段[{}}]立即解锁",
@ -133,9 +136,6 @@ public class CiLogic {
// 进路首区段列车占用进路开始解锁
overlap.startReleasing();
}
if (overlap.isLock() && !this.ciService.interlockCheck(simulation, overlap)) {
overlap.setLock(false);
}
}
}

View File

@ -328,7 +328,8 @@ public class CiRouteService {
}
public void delayUnlockStart(Simulation simulation, Route route, DelayUnlockDevice device) {
device.delayUnlock(route);
device.delayUnlockStart(route);
route.setDelayUnlockDevice(device);
this.signalControlService.tryControlSignalAspectAccordingLevel(simulation, route.getStart(), route.getStart().getSignalModel().getDefaultAspect());
}
@ -349,6 +350,8 @@ public class CiRouteService {
} else if (device instanceof Section) {
((Section) device).faultUnlock();
}
route.setLock(false);
route.setDelayUnlockDevice(null);
}
}
@ -395,6 +398,10 @@ public class CiRouteService {
this.delayUnlockStart(simulation, route, section);
return;
} else {
if (route.isOpenMain() || route.isOpenGuide()) {
this.signalControlService.tryControlSignalAspectAccordingLevel(simulation, route.getStart(),
route.getStart().getSignalModel().getDefaultAspect());
}
route.setLock(false);
}
}

View File

@ -26,6 +26,14 @@ public class CiService {
if (overlap != null && !overlap.isSetting() && !overlap.isLock() &&
!overlap.isForbidden()) {
if (overlap.getSection().isRouteLock()) {
SectionPath sectionPath = overlap.selectPath();
for (SwitchElement switchElement : sectionPath.getSwitchList()) {
if (switchElement.getASwitch().isLocked() && !switchElement.isOnPosition()) {
log.debug("延续保护进路[{}]道岔[{}]锁闭在相反位置,不触发办理", overlap.debugStr(),
switchElement.getASwitch().debugStr());
return;
}
}
overlap.startSetting(simulation.getSystemTime());
}
}

View File

@ -4,22 +4,18 @@ import lombok.Getter;
@Getter
public abstract class DelayUnlockDevice extends MayOutOfOrderDevice {
private Route theRoute; // 延时解锁的进路
private int remain;
protected DelayUnlockDevice(String code, String name, DeviceType deviceType) {
super(code, name, deviceType);
}
public void delayUnlock(Route route) {
this.theRoute = route;
route.setDelayUnlockDevice(this);
public void delayUnlockStart(Route route) {
this.remain = route.getDelayReleaseTime() * 1000;
}
public void reset() {
super.reset();
this.theRoute = null;
this.remain = 0;
}
@ -36,8 +32,7 @@ public abstract class DelayUnlockDevice extends MayOutOfOrderDevice {
return false;
}
public void recover(Route route, int remain) {
this.theRoute = route;
public void recover(int remain) {
this.remain = remain;
}
}

View File

@ -11,7 +11,6 @@ import lombok.NoArgsConstructor;
@Getter
@NoArgsConstructor
public class StorageDelayUnlockDevice extends StorageMayOutOfOrderDevice {
private String theRoute; // 延时解锁的进路
private int remain;
public StorageDelayUnlockDevice(String code, MayOutOfOrderDevice.DeviceFault fault) {
@ -19,11 +18,10 @@ public class StorageDelayUnlockDevice extends StorageMayOutOfOrderDevice {
}
public void saveFrom(DelayUnlockDevice device) {
this.theRoute = device.getTheRoute().getCode();
this.remain = device.getRemain();
}
protected void recoverTo(DelayUnlockDevice device, SimulationDataRepository repository) {
device.recover(repository.getByCode(this.theRoute, Route.class), this.remain);
device.recover(this.remain);
}
}