大铁进路排列代码结构调整
This commit is contained in:
parent
0237c53000
commit
7b960c809e
@ -25,11 +25,7 @@ public class CilRouteLogicService {
|
|||||||
public void routeLogic(RtSimulation rtSimulation, CilRepository cilRepository) {
|
public void routeLogic(RtSimulation rtSimulation, CilRepository cilRepository) {
|
||||||
List<CilRoute> supervisedRouteList = cilRepository.getSupervisedRouteList();
|
List<CilRoute> supervisedRouteList = cilRepository.getSupervisedRouteList();
|
||||||
for (CilRoute cilRoute : supervisedRouteList) {
|
for (CilRoute cilRoute : supervisedRouteList) {
|
||||||
if (!cilRoute.isSettingFinished()) {
|
this.settingProgress(rtSimulation, cilRepository, cilRoute, cilRepository.getConfig());
|
||||||
this.settingProgress(rtSimulation, cilRepository, cilRoute, cilRepository.getConfig());
|
|
||||||
} else {
|
|
||||||
monitorRoute(rtSimulation, cilRepository, cilRoute);
|
|
||||||
}
|
|
||||||
if (cilRoute.isDelayUnlocking()) {
|
if (cilRoute.isDelayUnlocking()) {
|
||||||
this.monitorDelayUnlockingRoute(rtSimulation, cilRoute, cilRepository.getConfig());
|
this.monitorDelayUnlockingRoute(rtSimulation, cilRoute, cilRepository.getConfig());
|
||||||
}
|
}
|
||||||
@ -118,7 +114,7 @@ public class CilRouteLogicService {
|
|||||||
cilRoute.setGl(true); //引导锁
|
cilRoute.setGl(true); //引导锁
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//进路不能锁闭,直接办理引导进路
|
//进路不能锁闭,检查、办理引导进路
|
||||||
List<CommonRoute> routes = commonRepository.getRoutesByStartSignal(cilSignal.getId());
|
List<CommonRoute> routes = commonRepository.getRoutesByStartSignal(cilSignal.getId());
|
||||||
Optional<CommonRoute> routeOptional = routes.stream().filter(cr -> {
|
Optional<CommonRoute> routeOptional = routes.stream().filter(cr -> {
|
||||||
List<SwitchPosition> spList = cr.getPathElement().getSpList();
|
List<SwitchPosition> spList = cr.getPathElement().getSpList();
|
||||||
@ -182,10 +178,15 @@ public class CilRouteLogicService {
|
|||||||
public boolean canOpenSignal(RtSimulation rtSimulation, String routeId) {
|
public boolean canOpenSignal(RtSimulation rtSimulation, String routeId) {
|
||||||
CilRepository cilRepository = rtSimulation.getRepository(CilRepository.NAME, CilRepository.class);
|
CilRepository cilRepository = rtSimulation.getRepository(CilRepository.NAME, CilRepository.class);
|
||||||
CilRoute cilRoute = cilRepository.getRouteById(routeId);
|
CilRoute cilRoute = cilRepository.getRouteById(routeId);
|
||||||
if (cilRoute.isTrainIn())
|
|
||||||
return false;
|
|
||||||
CommonRepository commonRepository = rtSimulation.getRepository(CommonRepository.NAME, CommonRepository.class);
|
CommonRepository commonRepository = rtSimulation.getRepository(CommonRepository.NAME, CommonRepository.class);
|
||||||
CommonRoute commonRoute = commonRepository.getRouteById(cilRoute.getId());
|
CommonRoute commonRoute = commonRepository.getRouteById(cilRoute.getId());
|
||||||
|
//检查区段占用
|
||||||
|
for (CommonSection commonSection : commonRoute.getPathElement().getAllSectionList()) {
|
||||||
|
if (cilRepository.getSectionById(commonSection.getId()).isAxcOccupy()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//检查信号级别
|
||||||
CilSignal cilSignal = cilRepository.getSignalById(commonRoute.getStart().getId());
|
CilSignal cilSignal = cilRepository.getSignalById(commonRoute.getStart().getId());
|
||||||
return cilSignal.sufficientLevel(commonRoute.getSignalAspect(), false);
|
return cilSignal.sufficientLevel(commonRoute.getSignalAspect(), false);
|
||||||
}
|
}
|
||||||
@ -264,17 +265,32 @@ public class CilRouteLogicService {
|
|||||||
*/
|
*/
|
||||||
private void check4SetRoute(CilRepository cilRepository, CommonRoute commonRoute) {
|
private void check4SetRoute(CilRepository cilRepository, CommonRoute commonRoute) {
|
||||||
checkConflictingRoute(cilRepository, commonRoute);
|
checkConflictingRoute(cilRepository, commonRoute);
|
||||||
// 道岔检查
|
checkSwitches(cilRepository, commonRoute);
|
||||||
|
checkStartSignal(cilRepository, commonRoute);
|
||||||
|
//检查区段
|
||||||
|
for (CommonSection commonSection : commonRoute.getPathElement().getSectionList()) {
|
||||||
|
CilSection cilSection = cilRepository.getSectionById(commonSection.getId());
|
||||||
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(cilSection.isAxcOccupy(), "区段占用");
|
||||||
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(cilSection.isRl() || cilSection.isOl(), "区段锁闭");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查道岔
|
||||||
|
*/
|
||||||
|
private void checkSwitches(CilRepository cilRepository, CommonRoute commonRoute) {
|
||||||
List<SwitchPosition> spList = commonRoute.getPathElement().getSpList();
|
List<SwitchPosition> spList = commonRoute.getPathElement().getSpList();
|
||||||
if (!CollectionUtils.isEmpty(spList)) {
|
if (!CollectionUtils.isEmpty(spList)) {
|
||||||
for (SwitchPosition switchPosition : spList) {
|
for (SwitchPosition switchPosition : spList) {
|
||||||
CommonSwitch commonSwitch = switchPosition.getCommonSwitch();
|
CommonSwitch commonSwitch = switchPosition.getCommonSwitch();
|
||||||
CilSwitch cilSwitch = cilRepository.getSwitchById(commonSwitch.getId());
|
CilSwitch cilSwitch = cilRepository.getSwitchById(commonSwitch.getId());
|
||||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(cilSwitch.isBl(), "进路内道岔封锁");
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(cilSwitch.isBl(), "进路内道岔封锁");
|
||||||
|
if (cilSwitch.isLocked()) {
|
||||||
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(switchPosition.getPosition() == cilSwitch.getPosition(),
|
||||||
|
"道岔已锁闭且位置不正确");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
checkStartSignal(cilRepository, commonRoute);
|
|
||||||
checkRouteSections(cilRepository, commonRoute);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -313,6 +329,10 @@ public class CilRouteLogicService {
|
|||||||
checkConflictingRoute(cilRepository, commonRoute);
|
checkConflictingRoute(cilRepository, commonRoute);
|
||||||
checkStartSignal(cilRepository, commonRoute);
|
checkStartSignal(cilRepository, commonRoute);
|
||||||
checkRouteSections(cilRepository, commonRoute);
|
checkRouteSections(cilRepository, commonRoute);
|
||||||
|
for (CommonSection commonSection : commonRoute.getPathElement().getSectionList()) {
|
||||||
|
CilSection cilSection = cilRepository.getSectionById(commonSection.getId());
|
||||||
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(cilSection.isLocked(), "区段锁闭");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean cancelRoute(RtSimulation rtSimulation, String routeId) {
|
public boolean cancelRoute(RtSimulation rtSimulation, String routeId) {
|
||||||
@ -436,15 +456,15 @@ public class CilRouteLogicService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try2LockRouteDevices(rtSimulation, cilRepository, cilRoute, commonRoute);
|
if (!cilRoute.isSettingFinished()) {
|
||||||
setLockingStateByInterlockCheck(cilRepository, cilRoute, commonRoute);
|
try2LockRouteDevices(rtSimulation, cilRepository, cilRoute, commonRoute);
|
||||||
|
}
|
||||||
|
monitorRoute(rtSimulation, cilRepository, cilRoute);
|
||||||
CilSignal cilSignal = cilRepository.getSignalById(commonRoute.getStart().getId());
|
CilSignal cilSignal = cilRepository.getSignalById(commonRoute.getStart().getId());
|
||||||
updateSignalLevel(cilRepository, cilRoute, commonRoute, cilSignal);
|
if (cilRoute.isCanAutoOpen())
|
||||||
|
try2OpenSignal4Route(rtSimulation, cilRoute, commonRoute, cilSignal, commonRoute.getSignalAspect());
|
||||||
if (cilSignal.getSignalAspect() == commonRoute.getSignalAspect()) //信号机已开启进路指定的信号
|
if (cilSignal.getSignalAspect() == commonRoute.getSignalAspect()) //信号机已开启进路指定的信号
|
||||||
cilRoute.finishSetting();
|
cilRoute.finishSetting();
|
||||||
if (cilRoute.isCanAutoOpen()) {
|
|
||||||
try2OpenSignal4Route(rtSimulation, cilRoute, commonRoute, cilSignal, commonRoute.getSignalAspect());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -457,8 +477,6 @@ public class CilRouteLogicService {
|
|||||||
CilSignal cilSignal = cilRepository.getSignalById(commonRoute.getStart().getId());
|
CilSignal cilSignal = cilRepository.getSignalById(commonRoute.getStart().getId());
|
||||||
setLockingStateByInterlockCheck(cilRepository, cilRoute, commonRoute);
|
setLockingStateByInterlockCheck(cilRepository, cilRoute, commonRoute);
|
||||||
updateSignalLevel(cilRepository, cilRoute, commonRoute, cilSignal);
|
updateSignalLevel(cilRepository, cilRoute, commonRoute, cilSignal);
|
||||||
//列车进入进路检查
|
|
||||||
cilRoute.setTrainIn(this.isTrainIn(cilRepository, commonRoute));
|
|
||||||
if (!cilSignal.isGuideAspect()) { //非引导信号
|
if (!cilSignal.isGuideAspect()) { //非引导信号
|
||||||
CommonSignal commonSignal = commonRepository.getSignalById(cilSignal.getId());
|
CommonSignal commonSignal = commonRepository.getSignalById(cilSignal.getId());
|
||||||
//信号开放条件检查,不通过时关闭信号
|
//信号开放条件检查,不通过时关闭信号
|
||||||
@ -505,7 +523,7 @@ public class CilRouteLogicService {
|
|||||||
}
|
}
|
||||||
// 侧防设备转动、锁闭
|
// 侧防设备转动、锁闭
|
||||||
List<CommonFls> flsList = commonRoute.getFlsList();
|
List<CommonFls> flsList = commonRoute.getFlsList();
|
||||||
if (!CollectionUtils.isEmpty(flsList)) { //进路侧防不为空
|
if (!CollectionUtils.isEmpty(flsList)) {
|
||||||
if (!cilRoute.isFl()) { //进路未侧防锁闭
|
if (!cilRoute.isFl()) { //进路未侧防锁闭
|
||||||
for (CommonFls commonFls : flsList) {
|
for (CommonFls commonFls : flsList) {
|
||||||
SwitchPosition target = commonFls.getTarget();
|
SwitchPosition target = commonFls.getTarget();
|
||||||
@ -825,7 +843,17 @@ public class CilRouteLogicService {
|
|||||||
return;
|
return;
|
||||||
CilSignal cilSignal = cilRepository.getSignalById(commonRoute.getStart().getId());
|
CilSignal cilSignal = cilRepository.getSignalById(commonRoute.getStart().getId());
|
||||||
if (cilSignal.isGuideAspect()) {
|
if (cilSignal.isGuideAspect()) {
|
||||||
if (cilSignal.getGuideTime() != 0) { //引导信号的关闭只依赖时间
|
List<SwitchPosition> spList = commonRoute.getPathElement().getSpList();
|
||||||
|
if (!CollectionUtils.isEmpty(spList)) {
|
||||||
|
for (SwitchPosition sp : spList) {
|
||||||
|
CilSwitch cilSwitch = cilRepository.getSwitchById(sp.getCommonSwitch().getId());
|
||||||
|
if (!cilSwitch.isMgl() && !cilSwitch.isRouteLockOnPosition(cilRoute.getId(), sp.getPosition())) {
|
||||||
|
cilSignal.clearGuideTime();
|
||||||
|
cilSignalLogicService.openForbiddenAspect(rtSimulation, cilSignal.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (cilSignal.getGuideTime() != 0) { //引导信号延时关闭
|
||||||
cilSignal.updateGuideTime();
|
cilSignal.updateGuideTime();
|
||||||
if (cilSignal.getGuideTime() == 0) {
|
if (cilSignal.getGuideTime() == 0) {
|
||||||
cilSignalLogicService.openForbiddenAspect(rtSimulation, cilSignal.getId());
|
cilSignalLogicService.openForbiddenAspect(rtSimulation, cilSignal.getId());
|
||||||
@ -837,9 +865,4 @@ public class CilRouteLogicService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isTrainIn(CilRepository cilRepository, CommonRoute commonRoute) {
|
|
||||||
return commonRoute.getPathElement().getAllSectionList()
|
|
||||||
.stream().anyMatch(cs -> cilRepository.getSectionById(cs.getId()).isAxcOccupy());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ public class CilSwitchLogicService {
|
|||||||
if (cilSwitch.getPosition() == position) {
|
if (cilSwitch.getPosition() == position) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!cilSwitch.isLocked() && !isOccupy(rtSimulation, commonSwitch.getId())) {
|
if (!cilSwitch.isLocked() && !isOccupy(rtSimulation, commonSwitch.getId()) && !cilSwitch.isRouteUse()) {
|
||||||
srdApiService.turnSwitch(rtSimulation, commonSwitch.getId(), position);
|
srdApiService.turnSwitch(rtSimulation, commonSwitch.getId(), position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,4 +81,8 @@ public class CilSection extends CilDevice {
|
|||||||
public boolean isDelayUnlocking() {
|
public boolean isDelayUnlocking() {
|
||||||
return this.delayTime != 0;
|
return this.delayTime != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isLocked() {
|
||||||
|
return ol || rl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,6 +98,10 @@ public class CilSwitch extends CilDevice {
|
|||||||
this.routeUseToPosition = 0;
|
this.routeUseToPosition = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRouteUse() {
|
||||||
|
return this.routeUseToPosition != 0;
|
||||||
|
}
|
||||||
|
|
||||||
public void lockByRoute(String routeId) {
|
public void lockByRoute(String routeId) {
|
||||||
if (!Objects.equals(routeId, this.routeId)) {
|
if (!Objects.equals(routeId, this.routeId)) {
|
||||||
this.routeId = routeId;
|
this.routeId = routeId;
|
||||||
@ -131,7 +135,7 @@ public class CilSwitch extends CilDevice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLocked() {
|
public boolean isLocked() {
|
||||||
return sl || rl || ol || fl;
|
return sl || rl || ol || fl || mgl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRouteLockOnPosition(@NonNull String routeId, int position) {
|
public boolean isRouteLockOnPosition(@NonNull String routeId, int position) {
|
||||||
|
Loading…
Reference in New Issue
Block a user