Merge remote-tracking branch 'origin/test2' into test2
This commit is contained in:
commit
a834811cab
@ -465,7 +465,7 @@ public class CiRouteService {
|
|||||||
if (!logic.isOccupied() && /*!logic.isInvalid() &&*/ logic.isRouteLockOn(right)) {
|
if (!logic.isOccupied() && /*!logic.isInvalid() &&*/ logic.isRouteLockOn(right)) {
|
||||||
logic.routeUnlocking(route);
|
logic.routeUnlocking(route);
|
||||||
logic.overlapUnlocking();
|
logic.overlapUnlocking();
|
||||||
} else if(logic.isOccupied() || logic.isInvalid()) {
|
} else if(logic.isOccupied() /*|| logic.isInvalid()*/) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -318,13 +318,22 @@ public class MapDeviceBuilder {
|
|||||||
});
|
});
|
||||||
/* ZC和区段相互赋值 */
|
/* ZC和区段相互赋值 */
|
||||||
// ZC
|
// ZC
|
||||||
if (graphData.getZcList().size() == 1) {
|
if (graphData.getZcList().size() == 1 && CollectionUtils.isEmpty(graphData.getZcList().get(0).getManagedSectionList())) {
|
||||||
|
//线路的【ZC只有一个】且【ZC没有设置关联区段】时,自动关联全线计轴区段
|
||||||
MapZcVO mapZcVO = graphData.getZcList().get(0);
|
MapZcVO mapZcVO = graphData.getZcList().get(0);
|
||||||
ZC zc = (ZC) elementMap.get(mapZcVO.getCode());
|
ZC zc = (ZC) elementMap.get(mapZcVO.getCode());
|
||||||
physicalSectionList.forEach(section -> {
|
elementMap.values().stream()
|
||||||
zc.addSection(section);
|
.filter(element -> element instanceof Section)
|
||||||
section.addZc(zc);
|
.map(element -> (Section) element)
|
||||||
});
|
.filter(Section::isAxleCounterSection)
|
||||||
|
.forEach(section -> {
|
||||||
|
zc.addSection(section);
|
||||||
|
section.addZc(zc);
|
||||||
|
});
|
||||||
|
// physicalSectionList.forEach(section -> {
|
||||||
|
// zc.addSection(section);
|
||||||
|
// section.addZc(zc);
|
||||||
|
// });
|
||||||
} else {
|
} else {
|
||||||
graphData.getZcList().forEach(mapZcVO -> {
|
graphData.getZcList().forEach(mapZcVO -> {
|
||||||
if (mapZcVO.isNoService())
|
if (mapZcVO.isNoService())
|
||||||
@ -338,15 +347,20 @@ public class MapDeviceBuilder {
|
|||||||
Section section = (Section) elementMap.get(sectionCode);
|
Section section = (Section) elementMap.get(sectionCode);
|
||||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(section,
|
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(section,
|
||||||
String.format("ZC[%s]关联的区段[%s]不存在", zc.getCode(), sectionCode));
|
String.format("ZC[%s]关联的区段[%s]不存在", zc.getCode(), sectionCode));
|
||||||
if (section.isPhysical()) {
|
Section axleCounterSection = section.findAxleCounterSection();
|
||||||
section.addZc(zc);
|
if (axleCounterSection != null) {
|
||||||
zc.addSection(section);
|
axleCounterSection.addZc(zc);
|
||||||
} else if (section.isSwitchAxleCounterSection() || section.isCross()) {
|
zc.addSection(axleCounterSection);
|
||||||
section.getLogicList().forEach(logic -> {
|
|
||||||
logic.addZc(zc);
|
|
||||||
zc.addSection(logic);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
// if (section.isPhysical()) {
|
||||||
|
// section.addZc(zc);
|
||||||
|
// zc.addSection(section);
|
||||||
|
// } else if (section.isSwitchAxleCounterSection() || section.isCross()) {
|
||||||
|
// section.getLogicList().forEach(logic -> {
|
||||||
|
// logic.addZc(zc);
|
||||||
|
// zc.addSection(logic);
|
||||||
|
// });
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -12,10 +12,7 @@ import lombok.Getter;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 区段
|
* 区段
|
||||||
@ -165,7 +162,7 @@ public class Section extends DelayUnlockDevice {
|
|||||||
/**
|
/**
|
||||||
* 所属zc
|
* 所属zc
|
||||||
*/
|
*/
|
||||||
private List<ZC> zcs = new ArrayList<>();
|
private Set<ZC> zcs = new HashSet<>();
|
||||||
|
|
||||||
// ------------------状态属性---------------------
|
// ------------------状态属性---------------------
|
||||||
|
|
||||||
@ -1148,10 +1145,15 @@ public class Section extends DelayUnlockDevice {
|
|||||||
* 任意一个zc正常工作
|
* 任意一个zc正常工作
|
||||||
*/
|
*/
|
||||||
public boolean anyZcWorking() {
|
public boolean anyZcWorking() {
|
||||||
if (!CollectionUtils.isEmpty(zcs)) {
|
Section axleCounterSection = this.findAxleCounterSection();
|
||||||
return zcs.stream().anyMatch(zc -> !zc.isFault());
|
if (axleCounterSection != null && !CollectionUtils.isEmpty(axleCounterSection.getZcs())) {
|
||||||
|
return axleCounterSection.getZcs().stream().anyMatch(zc -> !zc.isFault());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
// if (!CollectionUtils.isEmpty(zcs)) {
|
||||||
|
// return zcs.stream().anyMatch(zc -> !zc.isFault());
|
||||||
|
// }
|
||||||
|
// return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInvalid(boolean invalid) {
|
public void setInvalid(boolean invalid) {
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
package club.joylink.rtss.simulation.cbtc.data.map;
|
package club.joylink.rtss.simulation.cbtc.data.map;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 区域控制器
|
* 区域控制器
|
||||||
@ -13,7 +12,7 @@ import java.util.Objects;
|
|||||||
@Getter
|
@Getter
|
||||||
public class ZC extends MayOutOfOrderDevice {
|
public class ZC extends MayOutOfOrderDevice {
|
||||||
|
|
||||||
private List<Section> sections = new ArrayList<>();
|
private Set<Section> sections = new HashSet<>();
|
||||||
|
|
||||||
public ZC(String code, String name) {
|
public ZC(String code, String name) {
|
||||||
super(code, name, DeviceType.ZC);
|
super(code, name, DeviceType.ZC);
|
||||||
|
@ -136,29 +136,20 @@ public class VRTrainRunningService {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//进入计轴区段判断
|
//进入计轴区段判断
|
||||||
Section headAxleCounterSectionNew = headPositionNew.getSection();
|
Section headAxleCounterSectionNew = headPositionNew.getSection().findAxleCounterSection();
|
||||||
if (!headAxleCounterSectionNew.isAxleCounter()) {
|
if (headAxleCounterSectionNew != null) {
|
||||||
headAxleCounterSectionNew = headAxleCounterSectionNew.getParent();
|
Section headAxleCounterSection = headPosition.getSection().findAxleCounterSection();
|
||||||
}
|
if (!headAxleCounterSectionNew.equals(headAxleCounterSection)) { //【车头所在计轴区段】发生变化
|
||||||
if (!headAxleCounterSectionNew.isAxleCounter()) { //当是——物理区段-岔心-道岔计轴区段三层结构的时候需要多这次判断
|
|
||||||
headAxleCounterSectionNew = headAxleCounterSectionNew.getParent();
|
|
||||||
}
|
|
||||||
if (headAxleCounterSectionNew != null && headAxleCounterSectionNew.isAxleCounter()) { //新的区段是计轴区段
|
|
||||||
Section headSectionOld = headPosition.getSection();
|
|
||||||
if (!headAxleCounterSectionNew.equals(headSectionOld) && !headAxleCounterSectionNew.equals(headSectionOld.getParent())) { //新计轴区段和老区段不一样
|
|
||||||
headAxleCounterSectionNew.getVirtualAxleCounter().trainIn(trainRight);
|
headAxleCounterSectionNew.getVirtualAxleCounter().trainIn(trainRight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//离开计轴区段判断
|
//离开计轴区段判断
|
||||||
SectionPosition tailPositionOld = CalculateService.calculateNextPositionByStartAndLen(headPosition, !trainRight, train.getLen(), true);
|
SectionPosition tailPositionOld = CalculateService.calculateNextPositionByStartAndLen(headPosition, !trainRight, train.getLen(), true);
|
||||||
Section tailAxleCounterSection = tailPositionOld.getSection();
|
Section tailAxleCounterSection = tailPositionOld.getSection().findAxleCounterSection();
|
||||||
if (!tailAxleCounterSection.isAxleCounter()) {
|
if (tailAxleCounterSection != null) {
|
||||||
tailAxleCounterSection = tailAxleCounterSection.getParent();
|
|
||||||
}
|
|
||||||
if (tailAxleCounterSection != null && tailAxleCounterSection.isAxleCounter()) { //老的车尾区段是计轴区段
|
|
||||||
SectionPosition tailPositionNew = CalculateService.calculateNextPositionByStartAndLen(headPositionNew, !trainRight, train.getLen(), true);
|
SectionPosition tailPositionNew = CalculateService.calculateNextPositionByStartAndLen(headPositionNew, !trainRight, train.getLen(), true);
|
||||||
Section tailSectionNew = tailPositionNew.getSection();
|
Section tailAxleCounterSectionNew = tailPositionNew.getSection().findAxleCounterSection();
|
||||||
if (!tailAxleCounterSection.equals(tailSectionNew) && !tailAxleCounterSection.equals(tailSectionNew.getParent())) { //老车尾计轴区段和新车尾区段不一样
|
if (!tailAxleCounterSection.equals(tailAxleCounterSectionNew)) { //【车尾所在计轴区段】发生变化
|
||||||
tailAxleCounterSection.getVirtualAxleCounter().trainOut(trainRight);
|
tailAxleCounterSection.getVirtualAxleCounter().trainOut(trainRight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user