修改非通信车占用区段

This commit is contained in:
joylink_zhangsai 2021-08-23 13:12:45 +08:00
parent 2ef600d906
commit 96ab9cd256
2 changed files with 10 additions and 11 deletions

View File

@ -4,6 +4,7 @@ import club.joylink.rtss.simulation.cbtc.CI.CiApiService;
import club.joylink.rtss.simulation.cbtc.Simulation;
import club.joylink.rtss.simulation.cbtc.data.CalculateService;
import club.joylink.rtss.simulation.cbtc.data.SimulationDataRepository;
import club.joylink.rtss.simulation.cbtc.data.map.MapConfig;
import club.joylink.rtss.simulation.cbtc.data.map.Section;
import club.joylink.rtss.simulation.cbtc.data.map.Signal;
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
@ -102,12 +103,14 @@ public class AtpSectionService {
boolean right = train.isRight();
SectionPosition trainHeadPosition = train.getHeadPosition();
SimulationDataRepository repository = simulation.getRepository();
MapConfig config = repository.getConfig();
boolean switchSingleHandle = config.isSwitchSingleHandle();
if (train.isCommunicable()) { // 通信车占用
// 车尾位置追加不确定性距离(速度*2)m
SectionPosition trainTailPosition = CalculateService
.calculateNextPositionByStartAndLen(trainHeadPosition, !right, train.getLen() + train.getSpeed() * 2);
atpSectionList = CalculateService.getAtpSections(trainHeadPosition, trainTailPosition,
right, repository.getConfig().isSwitchSingleHandle());
right, switchSingleHandle);
List<Section> removes = new ArrayList<>();
for (Section atpSection : atpSectionList) {
Section axle = atpSection;
@ -128,6 +131,11 @@ public class AtpSectionService {
List<Section> sectionList = repository.queryTrainOccupySectionList(train.getGroupNumber());
if (!CollectionUtils.isEmpty(sectionList)) {
for (Section section : sectionList) {
if (section.isSwitchAxleCounterSection()) {
Section switchSection = section.getLogicList().get(0);
atpSectionList.addAll(switchSection.getSwitchAxleSectionsBySwitchPosition());
continue;
}
if (CollectionUtils.isEmpty(section.getLogicList())) {
atpSectionList.add(section);
} else {

View File

@ -346,15 +346,6 @@ public class SpeedCurve {
base = base.getNextRunningSectionOf(right);
}
}
// if (Objects.nonNull(endPosition)) {
// Float distance = CalculateService.calculateDistance(headPosition, endPosition, right);
// if (Objects.isNull(distance) || distance > totalLen) {
// return buildTargetSpeedCurve(totalLen, v0, 0, limitSpeed);
// } else {
// return buildTargetSpeedCurve(distance, v0, vt, limitSpeed);
// }
// }
// return buildTargetSpeedCurve(totalLen, v0, 0, limitSpeed);
SpeedCurve normalSpeedCurve = buildTargetSpeedCurve(totalLen, v0, 0, limitSpeed);
if (endPosition != null) {
Float distance = CalculateService.calculateDistance(headPosition, endPosition, right);