This commit is contained in:
DU 2021-02-02 09:28:28 +08:00
commit cfac9c6d9f
2 changed files with 32 additions and 22 deletions

View File

@ -1,6 +1,7 @@
package club.joylink.rtss.simulation.cbtc.CI.service;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.constant.SimulationConstants;
import club.joylink.rtss.simulation.cbtc.constant.SimulationModule;
import club.joylink.rtss.simulation.cbtc.data.map.*;
import club.joylink.rtss.simulation.cbtc.data.support.TrainStopMessage;
@ -355,7 +356,7 @@ public class RouteService {
if (Objects.isNull(route.getSettingStartTime())) {//旧数据兼容逻辑
route.setSettingStartTime(simulation.getSystemTime());
}
if (simulation.getSystemTime().isAfter(route.getSettingStartTime().plusSeconds(10))) {
if (simulation.getSystemTime().isAfter(route.getSettingStartTime().plusSeconds(SimulationConstants.ROUTE_SETTING_TIMEOUT))) {
route.settingFailed();
simulation.getRepository().removeSettingRoute(route);
route.setLock(false);
@ -390,27 +391,24 @@ public class RouteService {
log.debug(section.debugStr() + "因<预先锁闭>锁闭");
}
}
if (!route.isRequisition()) {
// 征用设备
// 道岔位置转换
List<SwitchElement> switchList = route.getSwitchList();
this.routeSwitchTurn(simulation, switchList);
this.routeFlsControl(simulation, route.getFlsList());
if (config.isLockFirst()) {
for (SwitchElement switchElement : switchList) {
switchElement.getASwitch().routeLock();
}
if (!CollectionUtils.isEmpty(route.getFlsList())) {
for (RouteFls routeFls : route.getFlsList()) {
routeFls.lock();
}
// 征用设备
// 道岔位置转换
List<SwitchElement> switchList = route.getSwitchList();
this.routeSwitchTurn(simulation, switchList);
this.routeFlsControl(simulation, route.getFlsList());
if (config.isLockFirst()) {
for (SwitchElement switchElement : switchList) {
switchElement.getASwitch().routeLock();
}
if (!CollectionUtils.isEmpty(route.getFlsList())) {
for (RouteFls routeFls : route.getFlsList()) {
routeFls.lock();
}
}
route.updateRequisition(true);
return;
}
// 设备已征用检查进路条件
boolean onPosition = this.checkSwitchPosition(simulation, route);
boolean onPosition = this.checkSwitchPosition(simulation, route) &&
this.isFlsSwitchOnPosition(route.getFlsList());
if (!onPosition) { // 还未转换到位置
return;
}
@ -479,7 +477,7 @@ public class RouteService {
}
MapConfig config = simulation.getRepository().getConfig();
if (!config.isRouteSettingNoFail()) {
if (simulation.getSystemTime().isAfter(overlap.getSettingStartTime().plusSeconds(10))) {
if (simulation.getSystemTime().isAfter(overlap.getSettingStartTime().plusSeconds(SimulationConstants.ROUTE_SETTING_TIMEOUT))) {
overlap.settingFailed();
log.info(String.format("进路延续保护[%s]办理失败", overlap.debugStr()));
return;
@ -1234,9 +1232,16 @@ public class RouteService {
boolean interlocked = this.isInterlocked(route);
if (!interlocked) {
// 进路信号开放联锁逻辑不满足需关闭信号
this.routeClose(simulation, route);
log.info(String.format("进路[%s]始端信号联锁条件不满足,信号机[%s(%s)]关灯",
route.debugStr(), route.getStart().getName(), route.getStart().getCode()));
if (route.isOpen()) {
this.routeClose(simulation, route);
log.info(String.format("进路[%s]始端信号联锁条件不满足,信号机[%s(%s)]关灯",
route.debugStr(), route.getStart().getName(), route.getStart().getCode()));
}
}
if (route.isOpen()) {
if (this.checkCanOverlapSet(simulation, route) && !route.getOverlap().isLock()) {
this.checkAndSetLockedRouteOverlap(simulation, route);
}
}
}

View File

@ -97,6 +97,11 @@ public interface SimulationConstants {
*/
int ATO_TRAIN_GET_SIGNAL_TO_START_DELAY = 6 * 1000;
/**
* 进路办理超时失败时间,单位秒
*/
int ROUTE_SETTING_TIMEOUT = 20;
/**
* 获取仿真运行计划日期运营日
* @return