大铁引导总锁和通过进路操作
This commit is contained in:
parent
d9226d47b6
commit
1505ff4604
@ -3,6 +3,7 @@ package club.joylink.rtss.controller.simulation.rt;
|
|||||||
import club.joylink.rtss.constants.MapPrdTypeEnum;
|
import club.joylink.rtss.constants.MapPrdTypeEnum;
|
||||||
import club.joylink.rtss.simulation.cbtc.data.vo.SimulationVO;
|
import club.joylink.rtss.simulation.cbtc.data.vo.SimulationVO;
|
||||||
import club.joylink.rtss.simulation.rt.RtSimulationService;
|
import club.joylink.rtss.simulation.rt.RtSimulationService;
|
||||||
|
import club.joylink.rtss.simulation.rt.vo.SimulationBasicInfo;
|
||||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||||
import club.joylink.rtss.vo.UserVO;
|
import club.joylink.rtss.vo.UserVO;
|
||||||
import club.joylink.rtss.vo.client.map.MapVO;
|
import club.joylink.rtss.vo.client.map.MapVO;
|
||||||
@ -25,7 +26,7 @@ public class RtSimulationController {
|
|||||||
|
|
||||||
@ApiOperation(value = "根据仿真group获取仿真基础信息")
|
@ApiOperation(value = "根据仿真group获取仿真基础信息")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public SimulationVO getSimulationBasicInfo(@PathVariable String id) {
|
public SimulationBasicInfo getSimulationBasicInfo(@PathVariable String id) {
|
||||||
return rtSimulationService.getBasicInfo(id);
|
return rtSimulationService.getBasicInfo(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ public class AtsSignal extends AtsDevice {
|
|||||||
int level;
|
int level;
|
||||||
String lrId;
|
String lrId;
|
||||||
int delayTime;
|
int delayTime;
|
||||||
|
int guideTime;
|
||||||
|
|
||||||
public AtsSignal(String id, String name) {
|
public AtsSignal(String id, String name) {
|
||||||
super(id, name);
|
super(id, name);
|
||||||
@ -26,7 +27,7 @@ public class AtsSignal extends AtsDevice {
|
|||||||
List<Object> buildMessage() {
|
List<Object> buildMessage() {
|
||||||
return Arrays.asList(this.id, this.signalAspect,
|
return Arrays.asList(this.id, this.signalAspect,
|
||||||
this.convert(this.logic), this.convert(this.forceLight), this.convert(this.bl), this.convert(this.rbl),
|
this.convert(this.logic), this.convert(this.forceLight), this.convert(this.bl), this.convert(this.rbl),
|
||||||
this.level, this.lrId, this.delayTime);
|
this.level, this.lrId, this.delayTime, this.guideTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean applyChange(CilSignal cilSignal) {
|
public boolean applyChange(CilSignal cilSignal) {
|
||||||
@ -72,6 +73,11 @@ public class AtsSignal extends AtsDevice {
|
|||||||
stateList.set(8, this.delayTime);
|
stateList.set(8, this.delayTime);
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
|
if (!Objects.equals(this.guideTime, cilSignal.getGuideTime())) {
|
||||||
|
this.guideTime = cilSignal.getGuideTime();
|
||||||
|
stateList.set(9, this.guideTime);
|
||||||
|
change = true;
|
||||||
|
}
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,9 +57,7 @@ public class CilApiService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean setRoute(RtSimulation simulation, String id) {
|
public boolean setRoute(RtSimulation simulation, String id) {
|
||||||
CilRepository repository = simulation.getRepository(CilRepository.NAME, CilRepository.class);
|
return cilRouteLogicService.setRoute(simulation, id);
|
||||||
CilRoute cilRoute = repository.getRouteById(id);
|
|
||||||
return cilRouteLogicService.setRoute(simulation, cilRoute);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean cancelRoute(RtSimulation simulation, String signalId) {
|
public boolean cancelRoute(RtSimulation simulation, String signalId) {
|
||||||
|
@ -3,7 +3,6 @@ package club.joylink.rtss.simulation.rt.CIL;
|
|||||||
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
|
||||||
import club.joylink.rtss.simulation.rt.CIL.bo.*;
|
import club.joylink.rtss.simulation.rt.CIL.bo.*;
|
||||||
import club.joylink.rtss.simulation.rt.RtSimulation;
|
import club.joylink.rtss.simulation.rt.RtSimulation;
|
||||||
import club.joylink.rtss.simulation.rt.SRD.bo.SrSignal;
|
|
||||||
import club.joylink.rtss.simulation.rt.repo.*;
|
import club.joylink.rtss.simulation.rt.repo.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@ -29,9 +28,7 @@ public class CilRouteLogicService {
|
|||||||
if (cilRoute.isDelayUnlocking()) {
|
if (cilRoute.isDelayUnlocking()) {
|
||||||
this.monitorDelayUnlockingRoute(rtSimulation, cilRoute, cilRepository.getConfig());
|
this.monitorDelayUnlockingRoute(rtSimulation, cilRoute, cilRepository.getConfig());
|
||||||
}
|
}
|
||||||
if (cilRoute.isGl()) {
|
this.monitorGuide(rtSimulation, cilRoute);
|
||||||
this.monitorGuide(rtSimulation, cilRoute);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,6 +37,7 @@ public class CilRouteLogicService {
|
|||||||
List<SwitchPosition> spList = commonRoute.getPathElement().getSpList();
|
List<SwitchPosition> spList = commonRoute.getPathElement().getSpList();
|
||||||
spList.forEach(sp -> cilRepository.getSwitchById(sp.getCommonSwitch().getId()).setMgl(true)); //设置引导总锁
|
spList.forEach(sp -> cilRepository.getSwitchById(sp.getCommonSwitch().getId()).setMgl(true)); //设置引导总锁
|
||||||
CilSignal cilSignal = cilRepository.getSignalById(commonRoute.getStart().getId());
|
CilSignal cilSignal = cilRepository.getSignalById(commonRoute.getStart().getId());
|
||||||
|
cilSignal.updateLevel(CilSignal.LEVEL_2);
|
||||||
if (cilRepository.getSectionById(commonRoute.getPathElement().getStart().getId()).isAxcOccupy()) { //进路首区段占用
|
if (cilRepository.getSectionById(commonRoute.getPathElement().getStart().getId()).isAxcOccupy()) { //进路首区段占用
|
||||||
cilSignal.initGuideTime();
|
cilSignal.initGuideTime();
|
||||||
}
|
}
|
||||||
@ -50,6 +48,7 @@ public class CilRouteLogicService {
|
|||||||
CommonRepository commonRepository = simulation.getRepository(CommonRepository.NAME, CommonRepository.class);
|
CommonRepository commonRepository = simulation.getRepository(CommonRepository.NAME, CommonRepository.class);
|
||||||
CilRepository cilRepository = simulation.getRepository(CilRepository.NAME, CilRepository.class);
|
CilRepository cilRepository = simulation.getRepository(CilRepository.NAME, CilRepository.class);
|
||||||
List<CommonSignal> signals = commonRepository.querySignalsByDirection(right);
|
List<CommonSignal> signals = commonRepository.querySignalsByDirection(right);
|
||||||
|
boolean find = false; //发现引导总锁
|
||||||
for (CommonSignal signal : signals) {
|
for (CommonSignal signal : signals) {
|
||||||
CilSignal cilSignal = cilRepository.getSignalById(signal.getId());
|
CilSignal cilSignal = cilRepository.getSignalById(signal.getId());
|
||||||
if (!StringUtils.hasText(cilSignal.getRouteId()))
|
if (!StringUtils.hasText(cilSignal.getRouteId()))
|
||||||
@ -58,7 +57,6 @@ public class CilRouteLogicService {
|
|||||||
List<SwitchPosition> spList = commonRepository.getRouteById(cilRoute.getId()).getPathElement().getSpList();
|
List<SwitchPosition> spList = commonRepository.getRouteById(cilRoute.getId()).getPathElement().getSpList();
|
||||||
if (CollectionUtils.isEmpty(spList))
|
if (CollectionUtils.isEmpty(spList))
|
||||||
continue;
|
continue;
|
||||||
boolean find = false; //发现引导总锁
|
|
||||||
for (SwitchPosition sp : spList) {
|
for (SwitchPosition sp : spList) {
|
||||||
CilSwitch cilSwitch = cilRepository.getSwitchById(sp.getCommonSwitch().getId());
|
CilSwitch cilSwitch = cilRepository.getSwitchById(sp.getCommonSwitch().getId());
|
||||||
if (cilSwitch.isMgl()) {
|
if (cilSwitch.isMgl()) {
|
||||||
@ -67,9 +65,9 @@ public class CilRouteLogicService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (find)
|
if (find)
|
||||||
return;
|
cilSignalLogicService.update2ForbiddenAspect(simulation, signal.getId());
|
||||||
}
|
}
|
||||||
cilRepository.getSwitches().forEach(cilSwitch -> cilSwitch.setMgl(false));
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(find, "无引导总锁");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGuide(RtSimulation simulation, String signalId, String routeId) {
|
public void setGuide(RtSimulation simulation, String signalId, String routeId) {
|
||||||
@ -97,16 +95,22 @@ public class CilRouteLogicService {
|
|||||||
throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("参数缺失");
|
throw BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.exception("参数缺失");
|
||||||
}
|
}
|
||||||
//执行
|
//执行
|
||||||
/* 进路锁闭,但因为区段占用导致无法开放信号 */
|
|
||||||
if (cilRoute != null) {
|
if (cilRoute != null) {
|
||||||
if (cilRoute.isLock() && cilSignal.isForbidAspect()) {
|
//进路锁闭,但因为区段占用导致无法开放信号
|
||||||
cilSignalLogicService.UpdateSignalDisplay(simulation, cilSignal, CilSignal.GUIDE, false);
|
if (cilRoute.isLock()) {
|
||||||
if (cilRepository.getSectionById(commonRoute.getPathElement().getStart().getId()).isAxcOccupy()) { //进路首区段占用
|
if (cilSignal.isForbidAspect(commonSignal.isShunting())) {
|
||||||
|
cilSignalLogicService.UpdateSignalDisplay(simulation, cilSignal, CilSignal.GUIDE, false);
|
||||||
|
if (cilRepository.getSectionById(commonRoute.getPathElement().getStart().getId()).isAxcOccupy()) { //进路首区段占用
|
||||||
|
cilSignal.initGuideTime();
|
||||||
|
}
|
||||||
|
} else if (cilSignal.isGuideAspect() && cilSignal.getGuideTime() != 0) { //之前开放了引导信号,重复点击续时间
|
||||||
cilSignal.initGuideTime();
|
cilSignal.initGuideTime();
|
||||||
|
} else {
|
||||||
|
throw BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.exception("信号正常开放,不能办理引导");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} 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();
|
||||||
@ -138,15 +142,15 @@ public class CilRouteLogicService {
|
|||||||
cilRoute.setGl(false);
|
cilRoute.setGl(false);
|
||||||
cilSignal.clearGuideTime();
|
cilSignal.clearGuideTime();
|
||||||
if (cilSignal.isGuideAspect()) {
|
if (cilSignal.isGuideAspect()) {
|
||||||
cilSignalLogicService.UpdateSignalDisplay(simulation, cilSignal, CilSignal.RED, false);
|
cilSignalLogicService.update2ForbiddenAspect(simulation, signalId);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(cilRoute.isDelayUnlocking(), "进路已在延时解锁中");
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(cilRoute.isDelayUnlocking(), "进路已在延时解锁中");
|
||||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(cilRoute.isTrainIn(), "进路非空闲状态");
|
|
||||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(cilSignalLogicService.isApproachOccupied(simulation, signalId),
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(cilSignalLogicService.isApproachOccupied(simulation, signalId),
|
||||||
"进路未接近锁闭");
|
"进路未接近锁闭");
|
||||||
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(cilRoute.isTrainIn(), "进路非空闲状态");
|
||||||
//关闭信号
|
//关闭信号
|
||||||
cilSignalLogicService.UpdateSignalDisplay(simulation, cilSignal, CilSignal.RED, false);
|
cilSignalLogicService.update2ForbiddenAspect(simulation, signalId);
|
||||||
//设置延时解锁
|
//设置延时解锁
|
||||||
cilSignal.initDelayTime();
|
cilSignal.initDelayTime();
|
||||||
cilRoute.setDelayUnlocking(true);
|
cilRoute.setDelayUnlocking(true);
|
||||||
@ -176,32 +180,34 @@ public class CilRouteLogicService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 排列进路接口,包括办理冲突检查和选出延续保护及一些初始化工作
|
* 排列进路接口,包括办理冲突检查和选出延续保护及一些初始化工作
|
||||||
*
|
|
||||||
* @param rtSimulation
|
|
||||||
* @param cilRoute
|
|
||||||
* @return 是否办理
|
* @return 是否办理
|
||||||
*/
|
*/
|
||||||
public boolean setRoute(RtSimulation rtSimulation, CilRoute cilRoute) {
|
public boolean setRoute(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);
|
||||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(cilRepository.isSupervised(cilRoute.getId()), "进路已经办理");
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertNotTrue(cilRepository.isSupervised(cilRoute.getId()), "进路已经办理");
|
||||||
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());
|
||||||
if (!CollectionUtils.isEmpty(commonRoute.getMultiRouteAspectList())) {
|
if (!CollectionUtils.isEmpty(commonRoute.getMultiRouteAspectList())) {
|
||||||
for (CommonRoute.MultiRouteAspect mra : commonRoute.getMultiRouteAspectList()) {
|
for (CommonRoute.MultiRouteAspect mra : commonRoute.getMultiRouteAspectList()) {
|
||||||
check4SetRoute(cilRepository, mra.getRoute());
|
CommonRoute subCommonRoute = mra.getRoute();
|
||||||
init4SetRoute(cilRoute, cilRepository, mra.getRoute());
|
CilRoute subCilRoute = cilRepository.getRouteById(subCommonRoute.getId());
|
||||||
|
check4SetRoute(cilRepository, subCommonRoute);
|
||||||
|
init4SetRoute(subCilRoute, cilRepository, subCommonRoute);
|
||||||
|
CilSignal cilSignal = cilRepository.getSignalById(subCommonRoute.getStart().getId());
|
||||||
|
cilSignal.setRouteId(subCilRoute.getId());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
check4SetRoute(cilRepository, commonRoute);
|
check4SetRoute(cilRepository, commonRoute);
|
||||||
init4SetRoute(cilRoute, cilRepository, commonRoute);
|
init4SetRoute(cilRoute, cilRepository, commonRoute);
|
||||||
|
CommonSignal commonSignal = commonRepository.getSignalById(commonRoute.getStart().getId());
|
||||||
|
CilSignal cilSignal = cilRepository.getSignalById(commonSignal.getId());
|
||||||
|
cilSignal.setRouteId(cilRoute.getId());
|
||||||
}
|
}
|
||||||
// 开始办理
|
// 开始办理
|
||||||
cilRoute.startSetting(rtSimulation.getSystemTime());
|
cilRoute.startSetting(rtSimulation.getSystemTime());
|
||||||
cilRepository.addSupervisedRoute(cilRoute);
|
cilRepository.addSupervisedRoute(cilRoute);
|
||||||
CommonSignal commonSignal = commonRepository.getSignalById(commonRoute.getStart().getId());
|
|
||||||
CilSignal cilSignal = cilRepository.getSignalById(commonSignal.getId());
|
|
||||||
cilSignal.setRouteId(cilRoute.getId());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,6 +246,12 @@ public class CilRouteLogicService {
|
|||||||
* 进路办理条件检查
|
* 进路办理条件检查
|
||||||
*/
|
*/
|
||||||
private void check4SetRoute(CilRepository cilRepository, CommonRoute commonRoute) {
|
private void check4SetRoute(CilRepository cilRepository, CommonRoute commonRoute) {
|
||||||
|
//敌对进路检查
|
||||||
|
List<CommonRoute> conflictingList = commonRoute.getConflictingList();
|
||||||
|
if (!CollectionUtils.isEmpty(conflictingList)) {
|
||||||
|
boolean nonSettingConflictingRoute = conflictingList.stream().noneMatch(cr -> cilRepository.isSupervised(cr.getId()));
|
||||||
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(nonSettingConflictingRoute, "敌对进路已经办理");
|
||||||
|
}
|
||||||
// 道岔检查
|
// 道岔检查
|
||||||
List<SwitchPosition> spList = commonRoute.getPathElement().getSpList();
|
List<SwitchPosition> spList = commonRoute.getPathElement().getSpList();
|
||||||
if (!CollectionUtils.isEmpty(spList)) {
|
if (!CollectionUtils.isEmpty(spList)) {
|
||||||
@ -271,7 +283,7 @@ public class CilRouteLogicService {
|
|||||||
// 关灯
|
// 关灯
|
||||||
CommonSignal commonSignal = commonRoute.getStart();
|
CommonSignal commonSignal = commonRoute.getStart();
|
||||||
CilSignal cilSignal = cilRepository.getSignalById(commonSignal.getId());
|
CilSignal cilSignal = cilRepository.getSignalById(commonSignal.getId());
|
||||||
cilSignalLogicService.UpdateSignalDisplay(rtSimulation, cilSignal, SrSignal.H, true);
|
cilSignalLogicService.update2ForbiddenAspect(rtSimulation, cilSignal.getId());
|
||||||
cilSignal.setRouteId(null);
|
cilSignal.setRouteId(null);
|
||||||
/* 取消进路相关所有设备的锁闭状态 */
|
/* 取消进路相关所有设备的锁闭状态 */
|
||||||
// 延续保护解锁
|
// 延续保护解锁
|
||||||
@ -358,20 +370,18 @@ public class CilRouteLogicService {
|
|||||||
CilRepository cilRepository = rtSimulation.getRepository(CilRepository.NAME, CilRepository.class);
|
CilRepository cilRepository = rtSimulation.getRepository(CilRepository.NAME, CilRepository.class);
|
||||||
List<CommonRoute.MultiRouteAspect> routes = commonRoute.getMultiRouteAspectList();
|
List<CommonRoute.MultiRouteAspect> routes = commonRoute.getMultiRouteAspectList();
|
||||||
if (!CollectionUtils.isEmpty(routes)) {
|
if (!CollectionUtils.isEmpty(routes)) {
|
||||||
CommonRoute route = routes.get(0).getRoute();
|
|
||||||
System.out.println(route.getId());
|
|
||||||
for (SwitchPosition sp : route.getPathElement().getSpList()) {
|
|
||||||
System.out.println(sp.getCommonSwitch().getName() + ":" + sp.getPosition());
|
|
||||||
}
|
|
||||||
for (int i = routes.size() - 1; i >= 0; i--) {
|
for (int i = routes.size() - 1; i >= 0; i--) {
|
||||||
CommonRoute.MultiRouteAspect mra = routes.get(i);
|
CommonRoute.MultiRouteAspect mra = routes.get(i);
|
||||||
CommonRoute subCommonRoute = mra.getRoute();
|
CommonRoute subCommonRoute = mra.getRoute();
|
||||||
CilRoute subCilRoute = cilRepository.getRouteById(subCommonRoute.getId());
|
CilRoute subCilRoute = cilRepository.getRouteById(subCommonRoute.getId());
|
||||||
CilSignal cilSignal = cilRepository.getSignalById(subCommonRoute.getStart().getId());
|
CilSignal cilSignal = cilRepository.getSignalById(subCommonRoute.getStart().getId());
|
||||||
monitorRoute(rtSimulation, cilRepository, cilSignal, subCommonRoute, subCilRoute);
|
|
||||||
if (cilSignal.getSignalAspect() != mra.getSignalAspect()) {
|
if (cilSignal.getSignalAspect() != mra.getSignalAspect()) {
|
||||||
lockRouteDevices(rtSimulation, cilRepository, subCilRoute, subCommonRoute);
|
if (!cilRepository.isSupervised(subCilRoute.getId())) {
|
||||||
try2OpenSignal4Route(rtSimulation, subCilRoute, subCommonRoute, cilSignal, subCommonRoute.getSignalAspect());
|
setRoute(rtSimulation, subCilRoute.getId());
|
||||||
|
if (i == 0) {
|
||||||
|
cilRepository.removeSupervisedRoute(cilRoute.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -379,21 +389,20 @@ public class CilRouteLogicService {
|
|||||||
lockRouteDevices(rtSimulation, cilRepository, cilRoute, commonRoute);
|
lockRouteDevices(rtSimulation, cilRepository, cilRoute, commonRoute);
|
||||||
CilSignal cilSignal = cilRepository.getSignalById(commonRoute.getStart().getId());
|
CilSignal cilSignal = cilRepository.getSignalById(commonRoute.getStart().getId());
|
||||||
try2OpenSignal4Route(rtSimulation, cilRoute, commonRoute, cilSignal, commonRoute.getSignalAspect());
|
try2OpenSignal4Route(rtSimulation, cilRoute, commonRoute, cilSignal, commonRoute.getSignalAspect());
|
||||||
monitorRoute(rtSimulation, cilRepository, cilSignal, commonRoute, cilRoute);
|
monitorRoute(rtSimulation, commonRepository, cilRepository, cilSignal, commonRoute, cilRoute);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监控进路(目前只是信号显示)
|
* 监控进路(目前只是信号显示)
|
||||||
*/
|
*/
|
||||||
private void monitorRoute(RtSimulation rtSimulation, CilRepository cilRepository, CilSignal cilSignal, CommonRoute commonRoute, CilRoute cilRoute) {
|
private void monitorRoute(RtSimulation rtSimulation, CommonRepository commonRepository, CilRepository cilRepository, CilSignal cilSignal, CommonRoute commonRoute, CilRoute cilRoute) {
|
||||||
//列车进入进路检查
|
//列车进入进路检查
|
||||||
boolean routeSectionOccupied = commonRoute.getPathElement().getAllSectionList()
|
cilRoute.setTrainIn(this.isTrainIn(cilRepository, commonRoute));
|
||||||
.stream().anyMatch(cs -> cilRepository.getSectionById(cs.getId()).isAxcOccupy());
|
|
||||||
cilRoute.setTrainIn(routeSectionOccupied);
|
|
||||||
if (!cilSignal.isGuideAspect()) { //非引导信号
|
if (!cilSignal.isGuideAspect()) { //非引导信号
|
||||||
|
CommonSignal commonSignal = commonRepository.getSignalById(cilSignal.getId());
|
||||||
//信号开放条件检查,不通过时关闭信号
|
//信号开放条件检查,不通过时关闭信号
|
||||||
if (!cilSignal.isForbidAspect()) {
|
if (!cilSignal.isForbidAspect(commonSignal.isShunting())) {
|
||||||
if (!canOpenSignal(rtSimulation, cilRoute.getId())) {
|
if (!canOpenSignal(rtSimulation, cilRoute.getId())) {
|
||||||
cilSignalLogicService.try2UpdateSignalDisplay(rtSimulation, cilSignal, CilSignal.RED, false);
|
cilSignalLogicService.try2UpdateSignalDisplay(rtSimulation, cilSignal, CilSignal.RED, false);
|
||||||
}
|
}
|
||||||
@ -496,6 +505,12 @@ public class CilRouteLogicService {
|
|||||||
} else {
|
} else {
|
||||||
cilSignal.updateLevel(CilSignal.LEVEL_2);
|
cilSignal.updateLevel(CilSignal.LEVEL_2);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (commonRoute.getPathElement().getSpList().stream().allMatch(sp->cilRepository.getSwitchById(sp.getCommonSwitch().getId()).isMgl())) {
|
||||||
|
cilSignal.updateLevel(CilSignal.LEVEL_2);
|
||||||
|
} else {
|
||||||
|
cilSignal.updateLevel(CilSignal.LEVEL_1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -546,7 +561,7 @@ public class CilRouteLogicService {
|
|||||||
CommonSignal ps = flsElement.getPs();
|
CommonSignal ps = flsElement.getPs();
|
||||||
if (ps != null) {
|
if (ps != null) {
|
||||||
CilSignal cilSignal = cilRepository.getSignalById(ps.getId());
|
CilSignal cilSignal = cilRepository.getSignalById(ps.getId());
|
||||||
if (!cilSignal.isForbidAspect() || !cilSignal.isFl()) {
|
if (!cilSignal.isForbidAspect(ps.isShunting()) || !cilSignal.isFl()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -741,18 +756,25 @@ public class CilRouteLogicService {
|
|||||||
CommonRepository commonRepository = rtSimulation.getRepository(CommonRepository.NAME, CommonRepository.class);
|
CommonRepository commonRepository = rtSimulation.getRepository(CommonRepository.NAME, CommonRepository.class);
|
||||||
CilRepository cilRepository = rtSimulation.getRepository(CilRepository.NAME, CilRepository.class);
|
CilRepository cilRepository = rtSimulation.getRepository(CilRepository.NAME, CilRepository.class);
|
||||||
CommonRoute commonRoute = commonRepository.getRouteById(cilRoute.getId());
|
CommonRoute commonRoute = commonRepository.getRouteById(cilRoute.getId());
|
||||||
|
if (!CollectionUtils.isEmpty(commonRoute.getMultiRouteAspectList()))
|
||||||
|
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) { //引导信号的关闭只依赖时间
|
if (cilSignal.getGuideTime() != 0) { //引导信号的关闭只依赖时间
|
||||||
cilSignal.updateGuideTime();
|
cilSignal.updateGuideTime();
|
||||||
if (cilSignal.getGuideTime() == 0) {
|
if (cilSignal.getGuideTime() == 0) {
|
||||||
cilSignalLogicService.UpdateSignalDisplay(rtSimulation, cilSignal, CilSignal.RED, false);
|
cilSignalLogicService.update2ForbiddenAspect(rtSimulation, cilSignal.getId());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (cilRepository.getSectionById(commonRoute.getPathElement().getStart().getId()).isAxcOccupy()) {
|
if (cilRepository.getSectionById(commonRoute.getPathElement().getStart().getId()).isAxcOccupy()) {
|
||||||
cilSignalLogicService.UpdateSignalDisplay(rtSimulation, cilSignal, CilSignal.RED, false);
|
cilSignalLogicService.update2ForbiddenAspect(rtSimulation, cilSignal.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isTrainIn(CilRepository cilRepository, CommonRoute commonRoute) {
|
||||||
|
return commonRoute.getPathElement().getAllSectionList()
|
||||||
|
.stream().anyMatch(cs -> cilRepository.getSectionById(cs.getId()).isAxcOccupy());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,18 @@ public class CilSignalLogicService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private CilRouteLogicService cilRouteLogicService;
|
private CilRouteLogicService cilRouteLogicService;
|
||||||
|
|
||||||
|
public void update2ForbiddenAspect(RtSimulation simulation, String signalId) {
|
||||||
|
CommonRepository commonRepository = simulation.getRepository(CommonRepository.NAME, CommonRepository.class);
|
||||||
|
CilRepository cilRepository = simulation.getRepository(CilRepository.NAME, CilRepository.class);
|
||||||
|
CommonSignal commonSignal = commonRepository.getSignalById(signalId);
|
||||||
|
CilSignal cilSignal = cilRepository.getSignalById(signalId);
|
||||||
|
if (commonSignal.isShunting()) {
|
||||||
|
UpdateSignalDisplay(simulation, cilSignal, CilSignal.A, false);
|
||||||
|
} else {
|
||||||
|
UpdateSignalDisplay(simulation, cilSignal, CilSignal.RED, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 信号机接近区段占用
|
* 信号机接近区段占用
|
||||||
*/
|
*/
|
||||||
@ -50,7 +62,8 @@ public class CilSignalLogicService {
|
|||||||
CilRepository cilRepository = rtSimulation.getRepository(CilRepository.NAME, CilRepository.class);
|
CilRepository cilRepository = rtSimulation.getRepository(CilRepository.NAME, CilRepository.class);
|
||||||
CommonRepository commonRepository = rtSimulation.getRepository(CommonRepository.NAME, CommonRepository.class);
|
CommonRepository commonRepository = rtSimulation.getRepository(CommonRepository.NAME, CommonRepository.class);
|
||||||
CilSignal cilSignal = cilRepository.getSignalById(signalId);
|
CilSignal cilSignal = cilRepository.getSignalById(signalId);
|
||||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(cilSignal.isForbidAspect(),
|
CommonSignal commonSignal = commonRepository.getSignalById(signalId);
|
||||||
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertTrue(cilSignal.isForbidAspect(commonSignal.isShunting()),
|
||||||
"信号未关闭,无需重开");
|
"信号未关闭,无需重开");
|
||||||
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertHasText(cilSignal.getRouteId(), "无已办理的进路");
|
BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertHasText(cilSignal.getRouteId(), "无已办理的进路");
|
||||||
CommonRoute commonRoute = commonRepository.getRouteById(cilSignal.getRouteId());
|
CommonRoute commonRoute = commonRepository.getRouteById(cilSignal.getRouteId());
|
||||||
@ -83,8 +96,10 @@ public class CilSignalLogicService {
|
|||||||
}
|
}
|
||||||
if (signal.sufficientLevel(aspect, false)) {
|
if (signal.sufficientLevel(aspect, false)) {
|
||||||
srdApiService.changeSignalLight(rtSimulation, signal.getId(), aspect);
|
srdApiService.changeSignalLight(rtSimulation, signal.getId(), aspect);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateSignalDisplay(RtSimulation rtSimulation, CilSignal signal, int aspect, boolean ctcMode) {
|
public void UpdateSignalDisplay(RtSimulation rtSimulation, CilSignal signal, int aspect, boolean ctcMode) {
|
||||||
|
@ -101,7 +101,7 @@ public class CilRepository extends SimulationRepository {
|
|||||||
|
|
||||||
public CilSignal getSignalById(String id) {
|
public CilSignal getSignalById(String id) {
|
||||||
CilSignal cilSignal = this.signalMap.get(id);
|
CilSignal cilSignal = this.signalMap.get(id);
|
||||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(cilSignal);
|
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(cilSignal, String.format("无id为[%s]的信号机", id));
|
||||||
return cilSignal;
|
return cilSignal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ import club.joylink.rtss.vo.client.map.MapSwitchVO;
|
|||||||
import club.joylink.rtss.vo.client.map.MapVO;
|
import club.joylink.rtss.vo.client.map.MapVO;
|
||||||
import club.joylink.rtss.vo.client.map.newmap.*;
|
import club.joylink.rtss.vo.client.map.newmap.*;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -20,10 +20,10 @@ public class CilSignal extends CilDevice {
|
|||||||
public static final int HH = 7; // 黄黄
|
public static final int HH = 7; // 黄黄
|
||||||
public static final int HSH = 8; // 黄闪黄
|
public static final int HSH = 8; // 黄闪黄
|
||||||
public static final int BH = 9; // 白红
|
public static final int BH = 9; // 白红
|
||||||
public static final int L = 10; // 蓝
|
public static final int A = 10; // 蓝
|
||||||
public static final int B = 11; // 白
|
public static final int B = 11; // 白
|
||||||
public static final int HS = 12; // 红闪
|
public static final int HS = 12; // 红闪
|
||||||
boolean logic = true;
|
boolean logic;
|
||||||
boolean forceLight; // 强制点灯
|
boolean forceLight; // 强制点灯
|
||||||
@Setter
|
@Setter
|
||||||
boolean bl; // 封锁
|
boolean bl; // 封锁
|
||||||
@ -49,10 +49,15 @@ public class CilSignal extends CilDevice {
|
|||||||
super(id, name);
|
super(id, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CilSignal(String id, String name, int aspect) {
|
||||||
|
this(id, name);
|
||||||
|
this.signalAspect = aspect;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
signalAspect = RED;
|
signalAspect = RED;
|
||||||
logic = true;
|
logic = false;
|
||||||
forceLight = false;
|
forceLight = false;
|
||||||
bl = false;
|
bl = false;
|
||||||
rbl = false;
|
rbl = false;
|
||||||
@ -73,8 +78,12 @@ public class CilSignal extends CilDevice {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isForbidAspect() {
|
public boolean isForbidAspect(boolean shunting) {
|
||||||
return this.signalAspect == RED;
|
if (shunting) {
|
||||||
|
return this.signalAspect == A;
|
||||||
|
} else {
|
||||||
|
return this.signalAspect == RED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateLevel(int level) {
|
public void updateLevel(int level) {
|
||||||
|
@ -11,6 +11,7 @@ import club.joylink.rtss.simulation.rt.SRD.SrdLogicService;
|
|||||||
import club.joylink.rtss.simulation.rt.repo.CommonRepoService;
|
import club.joylink.rtss.simulation.rt.repo.CommonRepoService;
|
||||||
import club.joylink.rtss.simulation.rt.repo.CommonRepository;
|
import club.joylink.rtss.simulation.rt.repo.CommonRepository;
|
||||||
import club.joylink.rtss.simulation.rt.repo.CommonStation;
|
import club.joylink.rtss.simulation.rt.repo.CommonStation;
|
||||||
|
import club.joylink.rtss.simulation.rt.vo.SimulationBasicInfo;
|
||||||
import club.joylink.rtss.vo.UserVO;
|
import club.joylink.rtss.vo.UserVO;
|
||||||
import club.joylink.rtss.vo.client.map.MapVO;
|
import club.joylink.rtss.vo.client.map.MapVO;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -80,12 +81,9 @@ public class RtSimulationService {
|
|||||||
this.atsLogicService.init(rtSimulation, mapVO);
|
this.atsLogicService.init(rtSimulation, mapVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimulationVO getBasicInfo(String id) {
|
public SimulationBasicInfo getBasicInfo(String id) {
|
||||||
RtSimulation rtSimulation = simulationManager.getById(id, RtSimulation.class);
|
RtSimulation rtSimulation = simulationManager.getById(id, RtSimulation.class);
|
||||||
SimulationVO.SimulationVOBuilder builder = SimulationVO.builder();
|
return new SimulationBasicInfo(rtSimulation);
|
||||||
builder.map(rtSimulation.mapVO.buildBasicInfo());
|
|
||||||
builder.prodType(rtSimulation.prdType != null ? rtSimulation.prdType.getCode() : null);
|
|
||||||
return builder.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapVO getMapData(String id) {
|
public MapVO getMapData(String id) {
|
||||||
|
@ -50,7 +50,7 @@ public class CommonFls extends CommonDevice {
|
|||||||
}
|
}
|
||||||
if (this.ps != null) {
|
if (this.ps != null) {
|
||||||
CilSignal cilSignal = cilRepository.getSignalById(this.ps.getId());
|
CilSignal cilSignal = cilRepository.getSignalById(this.ps.getId());
|
||||||
if (cilSignal.isForbidAspect()) {
|
if (cilSignal.isForbidAspect(this.ps.isShunting())) {
|
||||||
cilSignal.flankLock();
|
cilSignal.flankLock();
|
||||||
} else {
|
} else {
|
||||||
flag = false;
|
flag = false;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package club.joylink.rtss.simulation.rt.repo;
|
package club.joylink.rtss.simulation.rt.repo;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -43,6 +44,15 @@ public class CommonRoute extends CommonDevice {
|
|||||||
this.standList = new ArrayList<>();
|
this.standList = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCombinedRoute() {
|
||||||
|
return !CollectionUtils.isEmpty(multiRouteAspectList);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean contains(String routeId) {
|
||||||
|
return isCombinedRoute() && this.multiRouteAspectList
|
||||||
|
.stream().anyMatch(mra -> mra.getRoute().getId().equals(routeId));
|
||||||
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public static class MultiRouteAspect {
|
public static class MultiRouteAspect {
|
||||||
CommonRoute route;
|
CommonRoute route;
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
package club.joylink.rtss.simulation.rt.vo;
|
||||||
|
|
||||||
|
import club.joylink.rtss.simulation.Simulation;
|
||||||
|
import club.joylink.rtss.simulation.rt.RtSimulation;
|
||||||
|
import club.joylink.rtss.vo.UserVO;
|
||||||
|
import club.joylink.rtss.vo.client.map.MapVO;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public class SimulationBasicInfo {
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private int state;
|
||||||
|
|
||||||
|
private int speed;
|
||||||
|
|
||||||
|
private String prodType;
|
||||||
|
|
||||||
|
private MapVO map;
|
||||||
|
|
||||||
|
public SimulationBasicInfo(RtSimulation simulation) {
|
||||||
|
this.id = simulation.getId();
|
||||||
|
this.state = simulation.getState();
|
||||||
|
this.speed = simulation.getSpeed();
|
||||||
|
this.prodType = simulation.getPrdType() == null ? null : simulation.getPrdType().getCode();
|
||||||
|
if (simulation.getMapVO() != null) {
|
||||||
|
this.map = simulation.getMapVO().buildBasicInfo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,7 @@ package club.joylink.rtss.vo.client.map.newmap;
|
|||||||
|
|
||||||
import club.joylink.rtss.simulation.cbtc.data.map.Signal;
|
import club.joylink.rtss.simulation.cbtc.data.map.Signal;
|
||||||
import club.joylink.rtss.vo.client.Point;
|
import club.joylink.rtss.vo.client.Point;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@ -193,4 +194,9 @@ public class MapSignalNewVO {
|
|||||||
|
|
||||||
@ApiModelProperty(value = "传输信号机关联的信号机")
|
@ApiModelProperty(value = "传输信号机关联的信号机")
|
||||||
private String linkSignalCode;
|
private String linkSignalCode;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
public boolean isShunting() {
|
||||||
|
return Signal.SignalType.SHUNTING.equals(this.type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user