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