修改ATS进路触发逻辑

修改进路排列如果进路已经锁闭直接返回
修改道岔单操逻辑bug
This commit is contained in:
walker-sheng 2021-01-22 16:27:46 +08:00
parent c747a67d59
commit 8c9392bf14
5 changed files with 44 additions and 10 deletions

View File

@ -58,9 +58,6 @@ public class AtsRouteSettingService {
signalTrainMap.forEach((signal, train) -> {
// log.debug(String.format("ATS为列车[%s]触发信号机[%s(%s)]的进路",
// train.getGroupNumber(), signal.getName(), signal.getCode()));
if (CollectionUtils.isEmpty(signal.getRouteList())) { // 信号机不是进路始端结束
return;
}
Route route = null;
if (train.isPlanTrain()) { // 计划车
route = this.queryPlanTrainNeedRoute(simulation, train, signal, trainList);

View File

@ -11,6 +11,7 @@ import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityScreenDoor;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySectionAxleCounter;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySignal;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealitySwitch;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
@ -20,6 +21,7 @@ import java.util.List;
/**
* CI主线逻辑循环
*/
@Slf4j
@Component
public class CILogicLoop {

View File

@ -283,6 +283,10 @@ public class RouteService {
log.info(String.format("进路[%s]排列检查失败,无法排列:%s", route.debugStr(), check.debugStr()));
return check;
}
if (route.isLock()) {
log.info(String.format("进路[%s]已经锁闭", route.debugStr()));
return null;
}
// 进路开始办理
LocalDateTime systemTime = simulation.getSystemTime();
route.startSetting(systemTime);
@ -780,6 +784,9 @@ public class RouteService {
int level = checkRouteLevel(route);
route.getStart().setLevel(level);
if (level != Signal.LEVEL_3) {
if (route.isOpen()) {
log.info(String.format("进路[%s]联锁检查等级为[%s]", route.debugStr(), level));
}
return false;
}
return true;
@ -851,6 +858,7 @@ public class RouteService {
}
}
if (!level1Result) {
log.info(String.format("进路[%s]连锁条件检查失败:侧防不满足", route.debugStr()));
return level;
}
}
@ -1154,7 +1162,7 @@ public class RouteService {
*/
public void openedRouteCheck(Simulation simulation, Route route) {
// if (route.isOpen()) {
this.checkAndSetLockedRouteOverlap(simulation, route);
// this.checkAndSetLockedRouteOverlap(simulation, route);
// 区段锁闭在进路方向上
boolean right = route.getStart().isRight();
for (Section section : route.getSectionList()) {
@ -1162,12 +1170,14 @@ public class RouteService {
section.routeLocking(right);
}
}
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()) {
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()));
}
}
// this.reLockOverlap(simulation, route);
// }

View File

@ -39,6 +39,11 @@ public class SwitchService {
*/
private void controlSwitch(Simulation simulation, Switch aSwitch, boolean toNormal) {
VirtualRealitySwitch virtualSwitch = aSwitch.getVirtualSwitch();
if ((virtualSwitch.isNormal() && toNormal) ||
(virtualSwitch.isReverse() && !toNormal)) {
log.debug(String.format("道岔[%s]已经在指定位置[%s],无需转动", aSwitch.debugStr(), virtualSwitch.isNormal()?"N":"R"));
return;
}
if (virtualSwitch.isSettingTo(toNormal)) {
return;
}

View File

@ -155,6 +155,26 @@ public class TripPlan {
return null;
}
public StationPlan queryStationPlanByStationCode(String stationCode) {
for (StationPlan stationPlan : this.planList) {
if (Objects.equals(stationPlan.getStation().getCode(), stationCode)) {
return stationPlan;
}
}
return null;
}
public StationPlan queryNextStationPlanByStationCode(String stationCode) {
List<StationPlan> planList = this.getPlanList();
for (int i = 0; i < planList.size()-1; i++) {
StationPlan stationPlan = planList.get(i);
if (Objects.equals(stationPlan.getStation().getCode(), stationCode)) {
return planList.get(i+1);
}
}
return null;
}
public StationPlan queryNextStationPlan(Station station) {
List<StationPlan> planList = this.getPlanList();
for (int i = 0; i < planList.size(); i++) {