运行图编制修改,加载列车位置修改,ato bug修改
This commit is contained in:
parent
2ddedd3134
commit
e1ef8cf549
@ -452,6 +452,12 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
||||
|
||||
List<RunPlanArriveConfigVO> arriveConfigList = tripConfigVO.getArriveConfigList();
|
||||
arriveConfigList.stream().map(RunPlanTripTimeVO::new).forEach(timeVO -> tripVO.getTimeList().add(timeVO));
|
||||
if (Objects.equals(tripVO.getEndSectionCode(), (new LinkedList<> (tripVO.getTimeList())).getLast().getSectionCode())) {
|
||||
tripVO.setEndTime(tripConfigVO.getEndTime().minusHours(SimulationConstants.RUN_DIAGRAM_TRANS_TIME));
|
||||
}
|
||||
if (Objects.equals(tripVO.getStartSectionCode(), (new LinkedList<> (tripVO.getTimeList())).getFirst().getSectionCode())) {
|
||||
tripVO.setStartTime(tripConfigVO.getStartTime().minusHours(SimulationConstants.RUN_DIAGRAM_TRANS_TIME));
|
||||
}
|
||||
newTripList.add(tripVO);
|
||||
}
|
||||
} else {
|
||||
@ -752,6 +758,9 @@ public class RunPlanDraftService implements IRunPlanDraftService {
|
||||
if (Objects.equals(tripVO.getEndSectionCode(), (new LinkedList<> (tripVO.getTimeList())).getLast().getSectionCode())) {
|
||||
tripVO.setEndTime(tripConfig.getEndTime().minusHours(SimulationConstants.RUN_DIAGRAM_TRANS_TIME));
|
||||
}
|
||||
if (Objects.equals(tripVO.getStartSectionCode(), (new LinkedList<> (tripVO.getTimeList())).getFirst().getSectionCode())) {
|
||||
tripVO.setStartTime(tripConfig.getStartTime().minusHours(SimulationConstants.RUN_DIAGRAM_TRANS_TIME));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(runPlanVO.getTripList())) {
|
||||
runPlanVO.setTripList(new ArrayList<>());
|
||||
|
@ -429,7 +429,7 @@ public class RunPlanGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
private void setTripTerminalTime(RunPlanTripVO runPlanTripVO, LinkedList<RunPlanTripTimeVO> tripTimeList, int reentryTime) {
|
||||
public void setTripTerminalTime(RunPlanTripVO runPlanTripVO, LinkedList<RunPlanTripTimeVO> tripTimeList, int reentryTime) {
|
||||
setTripStartTime(runPlanTripVO, tripTimeList, reentryTime);
|
||||
setTripEndTime(runPlanTripVO, tripTimeList, reentryTime);
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import club.joylink.rtss.simulation.cbtc.data.CalculateService;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
|
||||
import club.joylink.rtss.simulation.cbtc.data.map.Section;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
||||
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
|
||||
import club.joylink.rtss.vo.client.PageVO;
|
||||
import club.joylink.rtss.vo.client.map.MapVO;
|
||||
import club.joylink.rtss.vo.client.map.newmap.MapRunLevelQueryVO;
|
||||
@ -82,7 +83,17 @@ public class RunPlanRunlevelService implements IRunPlanRunlevelService {
|
||||
list.forEach(l -> {
|
||||
Section startSection = (Section) deviceMap.get(l.getStartSectionCode());
|
||||
Section endSection = (Section) deviceMap.get(l.getEndSectionCode());
|
||||
Float distance = CalculateService.calculateDistance(startSection, endSection, l.getRight());
|
||||
Float distance;
|
||||
if((startSection.isStandTrack() && endSection.isTransferTrack()) || (endSection.isStandTrack() && startSection.isTransferTrack())){
|
||||
try{
|
||||
distance = CalculateService.calculateDistance(startSection, endSection, l.getRight());
|
||||
}catch (SimulationException e){
|
||||
distance = CalculateService.calculateDistance(startSection, endSection, !l.getRight());
|
||||
}
|
||||
}else{
|
||||
|
||||
distance = CalculateService.calculateDistance(startSection, endSection, l.getRight());
|
||||
}
|
||||
RunPlanRunlevel entity = new RunPlanRunlevel();
|
||||
entity.setId(l.getId());
|
||||
entity.setMapId(l.getMapId());
|
||||
|
@ -205,10 +205,15 @@ public class AtsTrainLoadService {
|
||||
RoutePath routePath = this.selectDefaultRoutePath(repository, stationPlan.getSection(), nextStationPlan.getSection());
|
||||
right = routePath.isRight();
|
||||
int t = current.toSecondOfDay() - stationPlan.getLeaveTime().toSecondOfDay();
|
||||
float s = routePath.getLength();
|
||||
float s = routePath.getLenFromSection(stationPlan.getSection());
|
||||
//右:-最后区段+后右停车点 + 前区段-前右停车点 左:-左停车点+前左停车点
|
||||
s= right?
|
||||
s-nextStationPlan.getSection().getLen()+nextStationPlan.getSection().getStopPointByDirection(right)+stationPlan.getSection().getLen()-stationPlan.getSection().getStopPointByDirection(right)
|
||||
:
|
||||
s-nextStationPlan.getSection().getStopPointByDirection(right)+stationPlan.getSection().getStopPointByDirection(right);
|
||||
int totalTime = nextStationPlan.getArriveTime().toSecondOfDay() - stationPlan.getLeaveTime().toSecondOfDay();
|
||||
float moveDistance = s / totalTime * t; // 移动的距离
|
||||
headPosition = routePath.getSectionPositionOfLen(moveDistance);
|
||||
headPosition = routePath.getSectionPositionOfLen(moveDistance,stationPlan.getSection());
|
||||
SectionPosition nextTargetPosition = new SectionPosition(nextStationPlan.getSection(),
|
||||
nextStationPlan.getSection().getStopPointByDirection(right));
|
||||
if (headPosition.isAheadOf(nextTargetPosition, right)) {
|
||||
@ -426,6 +431,8 @@ public class AtsTrainLoadService {
|
||||
trainInfo.updateEstimatedArriveInfo(endStationPlan.getSection(), endStationPlan.getArriveTime());
|
||||
train.updateNextStationPlan(endStationPlan.getStation(), endStationPlan.getSection(), tripPlan.isPlanParking(endStationPlan));
|
||||
break;
|
||||
} else if (passedSectionStopPoint(headPosition, endStationPlan.getSection(), right)) {
|
||||
continue;
|
||||
} else {
|
||||
RoutePath routePath = this.selectDefaultRoutePath(repository, startStationPlan.getSection(), endStationPlan.getSection());
|
||||
if (routePath.containsSection(headPosition.getSection())) {
|
||||
@ -454,6 +461,16 @@ public class AtsTrainLoadService {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private boolean passedSectionStopPoint(SectionPosition headPosition, Section funSection, boolean right) {
|
||||
float d = headPosition.getOffset() - funSection.getStopPointByDirection(right);
|
||||
if (Objects.equals(headPosition.getSection(), funSection)
|
||||
&& d > SimulationConstants.PARK_POINT_MAX_OFFSET) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理碰撞逻辑
|
||||
* @param simulation
|
||||
|
@ -358,6 +358,7 @@ public class RouteService {
|
||||
if (simulation.getSystemTime().isAfter(route.getSettingStartTime().plusSeconds(10))) {
|
||||
route.settingFailed();
|
||||
simulation.getRepository().removeSettingRoute(route);
|
||||
route.setLock(false);
|
||||
log.info(String.format("进路[%s]办理失败,取消办理2", route.debugStr()));
|
||||
return;
|
||||
}
|
||||
|
@ -110,36 +110,79 @@ public class RoutePath {
|
||||
this.end.getStation().getName(), this.end.getName());
|
||||
}
|
||||
|
||||
public SectionPosition getSectionPositionOfLen(float runLen) {
|
||||
public float getLenFromSection(Section fromSection){
|
||||
List<Section> list = new ArrayList<>();
|
||||
if(sectionList.contains(fromSection)){
|
||||
int i = sectionList.indexOf(fromSection);
|
||||
list.addAll(sectionList.subList(i,sectionList.size()));
|
||||
}else{
|
||||
list.add(start);
|
||||
list.addAll(this.sectionList);
|
||||
}
|
||||
float len = 0;
|
||||
for (Section section : list) {
|
||||
if(Objects.equals(section,fromSection)){
|
||||
continue;
|
||||
}
|
||||
len += section.getLen();
|
||||
}
|
||||
return len;
|
||||
}
|
||||
public SectionPosition getSectionPositionOfLen(float runLen,Section fromSection) {
|
||||
float remain = runLen;
|
||||
Section target = null;
|
||||
Float offset = null;
|
||||
if (remain < this.length) {
|
||||
// if (remain < this.length) {
|
||||
List<Section> list = new ArrayList<>();
|
||||
if(sectionList.contains(fromSection)){
|
||||
int i = sectionList.indexOf(fromSection);
|
||||
list.addAll(sectionList.subList(i,sectionList.size()));
|
||||
}else{
|
||||
list.add(start);
|
||||
list.addAll(this.sectionList);
|
||||
}
|
||||
float len = 0;
|
||||
for (Section section : list) {
|
||||
len += section.getLen();
|
||||
}
|
||||
float addLen;
|
||||
for (Section section : list) {
|
||||
float addLen = section.getLen();
|
||||
if (start == section) {
|
||||
addLen = right ? section.getLen() - section.getStopPointByDirection(right) : section.getStopPointByDirection(right);
|
||||
if (runLen < addLen) {
|
||||
target = section;
|
||||
offset = right ? section.getStopPointByDirection(right) + remain : section.getStopPointByDirection(right) - remain;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// else if (this.end == section) {
|
||||
// addLen = right?section.getStopPointByDirection(right):section.getLen() - section.getStopPointByDirection(right);
|
||||
// }
|
||||
else {
|
||||
addLen = section.getLen();
|
||||
}
|
||||
|
||||
if (remain < addLen) { // 在此区段上
|
||||
target = section;
|
||||
if (Objects.equals(this.start, section)) {
|
||||
if (this.right) {
|
||||
offset = section.getLen() - (addLen - remain);
|
||||
} else {
|
||||
offset = (addLen - remain);
|
||||
}
|
||||
} else {
|
||||
// if (Objects.equals(this.start, section)) {
|
||||
// if (this.right) {
|
||||
// offset = section.getLen() - (addLen - remain);
|
||||
// } else {
|
||||
// offset = (addLen - remain);
|
||||
// }
|
||||
// } else {
|
||||
if (this.right) {
|
||||
offset = remain;
|
||||
} else {
|
||||
offset = section.getLen() - remain;
|
||||
offset = addLen - remain;
|
||||
}
|
||||
}
|
||||
// }
|
||||
break;
|
||||
} else {
|
||||
remain -= addLen;
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
if (Objects.isNull(target) || Objects.isNull(offset)) {
|
||||
throw new SimulationException(SimulationExceptionType.System_Fault,
|
||||
String.format("路径[%s]的总距离[%s],未找到距离[%s]对应的区段位置",
|
||||
|
@ -164,7 +164,7 @@ public class ATOService {
|
||||
SectionPosition targetStopPoint = new SectionPosition(target,
|
||||
target.getStopPointByDirection(right));
|
||||
Float targetDistance = CalculateService.calculateDistance(headPosition, targetStopPoint, right);
|
||||
if (Objects.nonNull(targetDistance) && targetDistance < distance) {
|
||||
if (Objects.nonNull(targetDistance)&& targetDistance >= 0 && targetDistance < distance) {
|
||||
return targetDistance;
|
||||
}
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user