实现<强扳道岔>操作;进路正常解锁道岔时,添加<尝试解锁联动道岔和计轴关联道岔>逻辑

This commit is contained in:
joylink_zhangsai 2021-01-19 17:01:34 +08:00
parent d6a5120ccb
commit 3742523aee
4 changed files with 35 additions and 10 deletions

View File

@ -8,6 +8,7 @@ import club.joylink.rtss.simulation.cbtc.data.map.*;
import club.joylink.rtss.simulation.cbtc.data.support.SignalApproachMessage; import club.joylink.rtss.simulation.cbtc.data.support.SignalApproachMessage;
import club.joylink.rtss.simulation.cbtc.data.support.TrainStopMessage; import club.joylink.rtss.simulation.cbtc.data.support.TrainStopMessage;
import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo; import club.joylink.rtss.simulation.cbtc.data.vo.TrainInfo;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException; import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -458,6 +459,13 @@ public class CiApiServiceImpl implements CiApiService {
@Override @Override
public void switchForceTurn(Simulation simulation, String switchCode, Boolean normal) { public void switchForceTurn(Simulation simulation, String switchCode, Boolean normal) {
Switch aSwitch = simulation.getRepository().getByCode(switchCode, Switch.class);
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(!aSwitch.isLocked(), String.format("道岔[%s]锁闭,无法转动", aSwitch.getCode()));
VirtualRealitySwitch vrSwitch = aSwitch.getVirtualSwitch();
if (normal == null) {
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(vrSwitch.isLoss(), "道岔不在定反位,不能转动");
normal = vrSwitch.isReverse();
}
vrSwitch.startSetting(normal);
} }
} }

View File

@ -693,6 +693,7 @@ public class RouteService {
switchList.forEach(switchElement -> { switchList.forEach(switchElement -> {
Switch aSwitch = switchElement.getASwitch(); Switch aSwitch = switchElement.getASwitch();
aSwitch.routeUnlock(); aSwitch.routeUnlock();
aSwitch.overlapUnLock();
}); });
} }
// 进路侧防取消锁闭 // 进路侧防取消锁闭
@ -1043,10 +1044,20 @@ public class RouteService {
SwitchElement switchElement = route.getRouteSwitchElement(relSwitch); SwitchElement switchElement = route.getRouteSwitchElement(relSwitch);
section.routeUnlocking(right); section.routeUnlocking(right);
relSwitch.routeUnlock(); relSwitch.routeUnlock();
relSwitch.overlapUnLock();
RouteFls routeFls = route.getRouteFlsOfSwitch(relSwitch); RouteFls routeFls = route.getRouteFlsOfSwitch(relSwitch);
if (routeFls != null) { if (routeFls != null) {
routeFls.unlock(); routeFls.unlock();
} }
//检查道岔的联动道岔和计轴关联道岔是否可以解锁
List<Switch> switches = Arrays.asList(null, relSwitch.queryAxleRelatedOtherSwitch());
for (Switch linkedSwitch : switches) {
if (linkedSwitch == null)
continue;
if (linkedSwitch.getAllSections().stream().noneMatch(Section::isRouteLock)) { //道岔关联的所有区段都没有进路锁闭
linkedSwitch.routeUnlock();
}
}
} else { } else {
section.routeUnlocking(right); section.routeUnlocking(right);
} }

View File

@ -232,7 +232,6 @@ public class Switch extends MayOutOfOrderDevice {
public void routeUnlock() { public void routeUnlock() {
this.routeLock = false; this.routeLock = false;
this.overlapLock = false;
} }
public void fpLock() { public void fpLock() {
@ -367,6 +366,20 @@ public class Switch extends MayOutOfOrderDevice {
(!normal && SwitchFault.REVERSE_SPLIT.equals(this.getFault()))); (!normal && SwitchFault.REVERSE_SPLIT.equals(this.getFault())));
} }
/**
* 获取定位的道岔区段列表
*/
public List<Section> getNormalSections() {
return Arrays.asList(a, b);
}
/**
* 获取道岔关联的所有区段
*/
public List<Section> getAllSections() {
return List.of(a, b, c);
}
public enum SwitchFault implements DeviceFault { public enum SwitchFault implements DeviceFault {
/** /**
* 道岔挤岔 * 道岔挤岔
@ -421,11 +434,4 @@ public class Switch extends MayOutOfOrderDevice {
public boolean isLoss() { public boolean isLoss() {
return !this.isNormalPosition() && !this.isReversePosition(); return !this.isNormalPosition() && !this.isReversePosition();
} }
/**
* 获取定位的道岔区段列表
*/
public List<Section> getNormalSections() {
return Arrays.asList(a, b);
}
} }

View File

@ -109,7 +109,7 @@ public class VirtualRealitySwitch extends VirtualRealityDevice {
* 是否失表 * 是否失表
* @return * @return
*/ */
private boolean isLoss() { public boolean isLoss() {
return !this.isNormal() && !this.isReverse(); return !this.isNormal() && !this.isReverse();
} }