联锁生成——延续保护和侧防生成道岔相关逻辑调整
仿真初始化进路状态添加侧防元素转换锁闭逻辑 进路服务修改侧防锁闭,道岔预先锁闭等逻辑
This commit is contained in:
parent
4a4c5fa92f
commit
e5fe7c4dd3
@ -1238,8 +1238,16 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
|||||||
if (Objects.nonNull(oppositeSignal)) { // 找到反向信号机
|
if (Objects.nonNull(oppositeSignal)) { // 找到反向信号机
|
||||||
Section firstSection = oppositeSignal.getSection().getSectionOf(oppositeSignal.isRight());
|
Section firstSection = oppositeSignal.getSection().getSectionOf(oppositeSignal.isRight());
|
||||||
RouteFls.FlsElement flsElement;
|
RouteFls.FlsElement flsElement;
|
||||||
if (firstSection.isSwitchTrack() && !Objects.equals(aSwitch, firstSection.getRelSwitch())) {
|
Switch relSwitch = firstSection.getRelSwitch();
|
||||||
flsElement = new RouteFls.FlsElement(oppositeSignal, new SwitchElement(firstSection.getRelSwitch(), true));
|
if (firstSection.isSwitchTrack() &&
|
||||||
|
!Objects.equals(aSwitch, relSwitch) &&
|
||||||
|
!Objects.equals(aSwitch.queryAxleRelatedOtherSwitch(), relSwitch)) {
|
||||||
|
Switch remoteSwitch = relSwitch.queryAxleRelatedOtherSwitch();
|
||||||
|
if (Objects.nonNull(remoteSwitch)) {
|
||||||
|
flsElement = new RouteFls.FlsElement(oppositeSignal, new SwitchElement(remoteSwitch, true));
|
||||||
|
} else {
|
||||||
|
flsElement = new RouteFls.FlsElement(oppositeSignal, new SwitchElement(relSwitch, true));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
flsElement = new RouteFls.FlsElement(oppositeSignal);
|
flsElement = new RouteFls.FlsElement(oppositeSignal);
|
||||||
}
|
}
|
||||||
@ -2042,7 +2050,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
|||||||
SectionPath npPath = tempPath.cloneNew();// 定位路径
|
SectionPath npPath = tempPath.cloneNew();// 定位路径
|
||||||
npPath.addSection(relSwitch.getB());
|
npPath.addSection(relSwitch.getB());
|
||||||
npPath.addSwitchElement(new SwitchElement(relSwitch, true));
|
npPath.addSwitchElement(new SwitchElement(relSwitch, true));
|
||||||
if (Objects.nonNull(linkedSwitch)) {
|
if (!config.isGenerateFls() && Objects.nonNull(linkedSwitch)) {
|
||||||
npPath.addSwitchElement(new SwitchElement(linkedSwitch, true));
|
npPath.addSwitchElement(new SwitchElement(linkedSwitch, true));
|
||||||
}
|
}
|
||||||
getOverlapPathOf(relSwitch.getB().getSectionOf(right), right,
|
getOverlapPathOf(relSwitch.getB().getSectionOf(right), right,
|
||||||
@ -2051,14 +2059,14 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
|||||||
SectionPath rpPath = tempPath.cloneNew();// 反位路径
|
SectionPath rpPath = tempPath.cloneNew();// 反位路径
|
||||||
rpPath.addSection(relSwitch.getC());
|
rpPath.addSection(relSwitch.getC());
|
||||||
rpPath.addSwitchElement(new SwitchElement(relSwitch, false));
|
rpPath.addSwitchElement(new SwitchElement(relSwitch, false));
|
||||||
if (Objects.nonNull(linkedSwitch) && config.isOverlapOnlyOneSwitch()) {
|
if (!config.isGenerateFls() && Objects.nonNull(linkedSwitch) && config.isOverlapOnlyOneSwitch()) {
|
||||||
// 如果有联动道岔,且配置只构建一个道岔,这里添加上联动道岔
|
// 如果有联动道岔,且配置只构建一个道岔,这里添加上联动道岔
|
||||||
rpPath.addSwitchElement(new SwitchElement(linkedSwitch, false));
|
rpPath.addSwitchElement(new SwitchElement(linkedSwitch, false));
|
||||||
}
|
}
|
||||||
// if (config.isCoupleSwitch()) {
|
// if (config.isCoupleSwitch()) {
|
||||||
// 如果是同一道岔计轴,添加另一道岔定位
|
// 如果是同一道岔计轴,添加另一道岔定位
|
||||||
Switch otherSwitch = relSwitch.queryAxleRelatedOtherSwitch();
|
Switch otherSwitch = relSwitch.queryAxleRelatedOtherSwitch();
|
||||||
if (Objects.nonNull(otherSwitch) && relSwitch.isBConnectTo(otherSwitch)) {
|
if (!config.isGenerateFls() && Objects.nonNull(otherSwitch) && relSwitch.isBConnectTo(otherSwitch)) {
|
||||||
rpPath.addSwitchElement(new SwitchElement(otherSwitch, true));
|
rpPath.addSwitchElement(new SwitchElement(otherSwitch, true));
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
@ -2069,7 +2077,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
|||||||
// 只有一条路径,从B->A,道岔定位
|
// 只有一条路径,从B->A,道岔定位
|
||||||
tempPath.addSection(relSwitch.getA());
|
tempPath.addSection(relSwitch.getA());
|
||||||
tempPath.addSwitchElement(new SwitchElement(relSwitch, true));
|
tempPath.addSwitchElement(new SwitchElement(relSwitch, true));
|
||||||
if (Objects.nonNull(linkedSwitch)) {
|
if (!config.isGenerateFls() && Objects.nonNull(linkedSwitch)) {
|
||||||
tempPath.addSwitchElement(new SwitchElement(linkedSwitch, true));
|
tempPath.addSwitchElement(new SwitchElement(linkedSwitch, true));
|
||||||
}
|
}
|
||||||
getOverlapPathOf(relSwitch.getA().getSectionOf(right), right,
|
getOverlapPathOf(relSwitch.getA().getSectionOf(right), right,
|
||||||
@ -2081,7 +2089,7 @@ public class DraftMapCiDataGeneratorImpl implements DraftMapCiDataGenerator {
|
|||||||
// if (config.isCoupleSwitch()) {
|
// if (config.isCoupleSwitch()) {
|
||||||
// 如果是同一道岔计轴,添加另一道岔定位
|
// 如果是同一道岔计轴,添加另一道岔定位
|
||||||
Switch otherSwitch = relSwitch.queryAxleRelatedOtherSwitch();
|
Switch otherSwitch = relSwitch.queryAxleRelatedOtherSwitch();
|
||||||
if (Objects.nonNull(otherSwitch)) {
|
if (!config.isGenerateFls() && Objects.nonNull(otherSwitch)) {
|
||||||
tempPath.addSwitchElement(new SwitchElement(otherSwitch, true));
|
tempPath.addSwitchElement(new SwitchElement(otherSwitch, true));
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
|
@ -178,10 +178,10 @@ public class RouteService {
|
|||||||
if (aSwitch.isLocked() && !aSwitch.isOnPosition(element.isNormal())) {
|
if (aSwitch.isLocked() && !aSwitch.isOnPosition(element.isNormal())) {
|
||||||
return new Route.CheckFailMessage(Route.CheckFailReason.SwitchLockPositionError, aSwitch);
|
return new Route.CheckFailMessage(Route.CheckFailReason.SwitchLockPositionError, aSwitch);
|
||||||
}
|
}
|
||||||
// 道岔是否故障
|
// // 道岔是否故障
|
||||||
if (aSwitch.isFaultOnPosition(element.isNormal()) && aSwitch.isLoss()) {
|
// if (aSwitch.isFaultOnPosition(element.isNormal()) && aSwitch.isLoss()) {
|
||||||
return new Route.CheckFailMessage(Route.CheckFailReason.SwitchFault, aSwitch);
|
// return new Route.CheckFailMessage(Route.CheckFailReason.SwitchFault, aSwitch);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
// 敌对进路办理中或已锁闭,不能办理
|
// 敌对进路办理中或已锁闭,不能办理
|
||||||
List<Route> conflictingRouteList = route.getConflictingRouteList();
|
List<Route> conflictingRouteList = route.getConflictingRouteList();
|
||||||
@ -395,6 +395,16 @@ public class RouteService {
|
|||||||
List<SwitchElement> switchList = route.getSwitchList();
|
List<SwitchElement> switchList = route.getSwitchList();
|
||||||
this.routeSwitchTurn(simulation, switchList);
|
this.routeSwitchTurn(simulation, switchList);
|
||||||
this.routeFlsControl(simulation, route.getFlsList());
|
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);
|
route.updateRequisition(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -503,19 +513,27 @@ public class RouteService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
List<SwitchElement> switchList = sectionPath.getSwitchList();
|
||||||
if (!overlap.isRequisition()) { // 设备征用
|
if (!overlap.isRequisition()) { // 设备征用
|
||||||
// 延续保护位置转动
|
// 延续保护位置转动
|
||||||
// 道岔位置转换
|
this.routeSwitchTurn(simulation, switchList);
|
||||||
List<SwitchElement> pathSwitchList = sectionPath.getPathSwitchElementList();
|
List<RouteFls> flsList = sectionPath.getFlsList();
|
||||||
this.routeSwitchTurn(simulation, pathSwitchList);
|
this.routeFlsControl(simulation, flsList);
|
||||||
List<SwitchElement> notPathSwitchList = sectionPath.getNotPathSwitchElementList();
|
if (config.isLockFirst()) {
|
||||||
this.routeSwitchTurn(simulation, notPathSwitchList);
|
for (SwitchElement switchElement : switchList) {
|
||||||
this.routeFlsControl(simulation, sectionPath.getFlsList());
|
switchElement.getASwitch().overlapLock();
|
||||||
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(flsList)) {
|
||||||
|
for (RouteFls routeFls : flsList) {
|
||||||
|
routeFls.lock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
overlap.updateRequisition(true);
|
overlap.updateRequisition(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 道岔是否转换到位置
|
// 道岔是否转换到位置
|
||||||
boolean onPosition = this.checkRouteSwitchPosition(sectionPath.getSwitchList());
|
boolean onPosition = this.checkRouteSwitchPosition(switchList);
|
||||||
if (!onPosition) return; // 未到位,返回
|
if (!onPosition) return; // 未到位,返回
|
||||||
if (!overlap.getSection().isRouteLock()) {
|
if (!overlap.getSection().isRouteLock()) {
|
||||||
return;
|
return;
|
||||||
@ -622,20 +640,7 @@ public class RouteService {
|
|||||||
private void routeFlsLock(List<RouteFls> flsList) {
|
private void routeFlsLock(List<RouteFls> flsList) {
|
||||||
if (!CollectionUtils.isEmpty(flsList)) {
|
if (!CollectionUtils.isEmpty(flsList)) {
|
||||||
for (RouteFls routeFls : flsList) {
|
for (RouteFls routeFls : flsList) {
|
||||||
for (RouteFls.FlsElement flsElement : routeFls.getLevel1List()) {
|
routeFls.lock();
|
||||||
SwitchElement pSwitch = flsElement.getPSwitch();
|
|
||||||
if (pSwitch != null) {
|
|
||||||
Switch aSwitch = pSwitch.getASwitch();
|
|
||||||
if (aSwitch.isOnPosition(pSwitch.isNormal())) {
|
|
||||||
aSwitch.fpLock();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
SwitchElement fpae = flsElement.getFpae();
|
|
||||||
if (fpae != null && fpae.getASwitch().isOnPosition(fpae.isNormal())) {
|
|
||||||
fpae.getASwitch().fpLock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1099,10 +1104,9 @@ public class RouteService {
|
|||||||
section.getParent().routeUnlocking(right);
|
section.getParent().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.getBase().getASwitch().isRouteLock() && !routeFls.getBase().getASwitch().isOverlapLock()) {
|
||||||
routeFls.unlock();
|
routeFls.unlock();
|
||||||
}
|
}
|
||||||
//检查道岔的联动道岔和计轴关联道岔是否可以解锁
|
//检查道岔的联动道岔和计轴关联道岔是否可以解锁
|
||||||
|
@ -61,6 +61,20 @@ public class RouteFls {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void lock() {
|
||||||
|
for (FlsElement flsElement : this.getLevel1List()) {
|
||||||
|
SwitchElement pSwitch = flsElement.getPSwitch();
|
||||||
|
if (pSwitch != null) {
|
||||||
|
pSwitch.getASwitch().fpLock();
|
||||||
|
} else {
|
||||||
|
SwitchElement fpae = flsElement.getFpae();
|
||||||
|
if (fpae != null) {
|
||||||
|
fpae.getASwitch().fpLock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 侧防元件
|
* 侧防元件
|
||||||
*/
|
*/
|
||||||
|
@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@ -32,6 +33,8 @@ public class DeviceStatusModifyTool {
|
|||||||
public void openRouteDirect(Simulation simulation, Route route) {
|
public void openRouteDirect(Simulation simulation, Route route) {
|
||||||
// 修改进路涉及的所有道岔元素到指定位置
|
// 修改进路涉及的所有道岔元素到指定位置
|
||||||
this.batchSetRouteSwitchPositionAndLock(route, route.getSwitchList(), true);
|
this.batchSetRouteSwitchPositionAndLock(route, route.getSwitchList(), true);
|
||||||
|
// 修改进路侧防到指定位置
|
||||||
|
this.batchSetRouteFlsSwitchPositionAndLock(route.getFlsList());
|
||||||
// 进路元素锁闭
|
// 进路元素锁闭
|
||||||
route.getSectionList().forEach(section -> section.routeLocking(route.getStart().isRight()));
|
route.getSectionList().forEach(section -> section.routeLocking(route.getStart().isRight()));
|
||||||
if (this.routeService.checkCanOverlapSet(simulation, route)) {
|
if (this.routeService.checkCanOverlapSet(simulation, route)) {
|
||||||
@ -39,6 +42,7 @@ public class DeviceStatusModifyTool {
|
|||||||
if (Objects.nonNull(overlapPath)) {
|
if (Objects.nonNull(overlapPath)) {
|
||||||
this.batchSetRouteSwitchPositionAndLock(route, overlapPath.getSwitchList(), false);
|
this.batchSetRouteSwitchPositionAndLock(route, overlapPath.getSwitchList(), false);
|
||||||
overlapPath.getSectionList().forEach(section -> section.overlapLocking(route.getStart().isRight()));
|
overlapPath.getSectionList().forEach(section -> section.overlapLocking(route.getStart().isRight()));
|
||||||
|
this.batchSetRouteFlsSwitchPositionAndLock(overlapPath.getFlsList());
|
||||||
route.getOverlap().setLock(true);
|
route.getOverlap().setLock(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -50,14 +54,37 @@ public class DeviceStatusModifyTool {
|
|||||||
route.getStart().setLockedRoute(route);
|
route.getStart().setLockedRoute(route);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void batchSetRouteFlsSwitchPositionAndLock(List<RouteFls> flsList) {
|
||||||
|
if (!CollectionUtils.isEmpty(flsList)) {
|
||||||
|
List<SwitchElement> switchElementList = new ArrayList<>();
|
||||||
|
for (RouteFls routeFls : flsList) {
|
||||||
|
for (RouteFls.FlsElement flsElement : routeFls.getLevel1List()) {
|
||||||
|
SwitchElement pSwitch = flsElement.getPSwitch();
|
||||||
|
if (pSwitch != null) {
|
||||||
|
switchElementList.add(pSwitch);
|
||||||
|
} else if (flsElement.getFpae() != null) {
|
||||||
|
switchElementList.add(flsElement.getFpae());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (SwitchElement switchElement : switchElementList) {
|
||||||
|
this.setSingleSwitchPositionDirectly(switchElement.getASwitch(), switchElement.isNormal());
|
||||||
|
switchElement.getASwitch().fpLock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void openGuideRouteDirect(Simulation simulation, Route route) {
|
public void openGuideRouteDirect(Simulation simulation, Route route) {
|
||||||
// 修改进路涉及的所有道岔元素到指定位置
|
// 修改进路涉及的所有道岔元素到指定位置
|
||||||
this.batchSetRouteSwitchPositionAndLock(route, route.getSwitchList(), true);
|
this.batchSetRouteSwitchPositionAndLock(route, route.getSwitchList(), true);
|
||||||
|
// 修改进路侧防到指定位置
|
||||||
|
this.batchSetRouteFlsSwitchPositionAndLock(route.getFlsList());
|
||||||
// 进路元素锁闭
|
// 进路元素锁闭
|
||||||
route.getSectionList().forEach(section -> section.routeLocking(route.getStart().isRight()));
|
route.getSectionList().forEach(section -> section.routeLocking(route.getStart().isRight()));
|
||||||
SectionPath overlapPath = route.selectOverlapElement();
|
SectionPath overlapPath = route.selectOverlapElement();
|
||||||
if (Objects.nonNull(overlapPath)) {
|
if (Objects.nonNull(overlapPath)) {
|
||||||
this.batchSetRouteSwitchPositionAndLock(route, overlapPath.getSwitchList(), false);
|
this.batchSetRouteSwitchPositionAndLock(route, overlapPath.getSwitchList(), false);
|
||||||
|
this.batchSetRouteFlsSwitchPositionAndLock(overlapPath.getFlsList());
|
||||||
overlapPath.getSectionList().forEach(section -> section.overlapLocking(route.getStart().isRight()));
|
overlapPath.getSectionList().forEach(section -> section.overlapLocking(route.getStart().isRight()));
|
||||||
}
|
}
|
||||||
route.setLock(true);
|
route.setLock(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user