Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/rtss-server into test
This commit is contained in:
commit
9e08c224ac
@ -21,18 +21,15 @@ public class StationDiagram {
|
||||
this.finalStation = false;
|
||||
}
|
||||
|
||||
public StationDiagram(VirtualRealityTrain train,Float stationComplateRatio, Boolean finalStation){
|
||||
public StationDiagram(VirtualRealityTrain train,Float stationCompleteRatio, Boolean finalStation){
|
||||
this.groupNum = train.getGroupNumber();
|
||||
this.right = train.isRight();
|
||||
this.stationCompleteRatio = stationComplateRatio;
|
||||
this.stationCompleteRatio = stationCompleteRatio;
|
||||
this.finalStation = finalStation;
|
||||
}
|
||||
|
||||
public StationDiagram(VirtualRealityTrain train,boolean showTrainDiagram,Float stationComplateRatio, Boolean finalStation){
|
||||
this.groupNum = train.getGroupNumber();
|
||||
this.right = train.isRight();
|
||||
this.stationCompleteRatio = stationComplateRatio;
|
||||
this.finalStation = finalStation;
|
||||
public StationDiagram(VirtualRealityTrain train,boolean showTrainDiagram,Float stationCompleteRatio, Boolean finalStation){
|
||||
this(train,stationCompleteRatio,finalStation);
|
||||
this.showTrainDiagram = showTrainDiagram;
|
||||
}
|
||||
|
||||
|
@ -61,29 +61,28 @@ public class RuningService implements CalculateDiagram{
|
||||
private Float calculateStationRatio(Simulation simulation,Section begin,Section end,VirtualRealityTrain train){
|
||||
Long mapId = simulation.getBuildParams().getMap().getId();
|
||||
LocalDateTime simulationDateTime = simulation.getCorrectSystemTime();
|
||||
Float totalDis =null;
|
||||
Float runOffset =null;
|
||||
try{
|
||||
totalDis = CalculateService.calculateDistance(begin,end,train.isRight());
|
||||
if(totalDis == 0F){
|
||||
//车辆已经到达站点
|
||||
return 1F;
|
||||
}
|
||||
Float totalDis = CalculateService.calculateDistance(begin,end,train.isRight());
|
||||
Float runOffset = 0F;
|
||||
float stationCompleteRatio = 1F;
|
||||
if(totalDis != 0F){
|
||||
float off = begin.getStopPointByDirection(train.isRight());
|
||||
runOffset = CalculateService.calculateDistanceIgnoreSwitchFromStationToTrainHead(new SectionPosition(begin,off),train.getHeadPosition(),train.isRight());
|
||||
double t = runOffset / totalDis;
|
||||
float d = new BigDecimal(t).setScale(3, RoundingMode.HALF_UP).floatValue();
|
||||
if(d >= 1F){
|
||||
d = 1F;
|
||||
if(runOffset != 1F){
|
||||
stationCompleteRatio = new BigDecimal(runOffset / totalDis).setScale(3, RoundingMode.HALF_UP).floatValue();
|
||||
if(stationCompleteRatio >= 1F){
|
||||
stationCompleteRatio = 1F;
|
||||
}
|
||||
}
|
||||
}
|
||||
log.debug("线路id:{} 仿真时间:{} 车次[{}] 方向[{}] 车头区段[{}] 车头位置[{}] 车尾区段[{}] 查找开始区段[{}] 结束区段[{}] 距离总长[{}] 剩余距离[{}] 已行驶[{}] 行驶完成度[{}]"
|
||||
,mapId,simulationDateTime
|
||||
,train.getGroupNumber(),train.isRight(),train.getHeadPosition().getSection().getCode(),train.getHeadPosition().getOffset()
|
||||
,train.getTailPosition().getSection().getCode(), begin.getCode(),end.getCode() , totalDis ,(totalDis - runOffset),runOffset ,d);
|
||||
return Math.abs(d);
|
||||
,train.getTailPosition().getSection().getCode(), begin.getCode(),end.getCode() , totalDis ,(totalDis - runOffset),runOffset ,stationCompleteRatio);
|
||||
return Math.abs(stationCompleteRatio);
|
||||
}catch (Exception e){
|
||||
log.error("计算失败 线路id:{} 仿真时间:{} groupNum:{},isRight:{},begin:{},end:{},totalDis:{},targetDis:{} 错误信息:{}",mapId,simulationDateTime
|
||||
,train.getGroupNumber() ,train.isRight(),begin.getCode() ,end.getCode() ,totalDis , runOffset,e.getMessage(),e);
|
||||
log.error("计算失败 线路id:{} 仿真时间:{} groupNum:{},isRight:{},begin:{},end:{}, 错误信息:{}",mapId,simulationDateTime
|
||||
,train.getGroupNumber() ,train.isRight(),begin.getCode() ,end.getCode() ,e.getMessage(),e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1257,10 +1257,12 @@ public class CalculateService {
|
||||
} else {
|
||||
offset = startPosition.getOffset() - endPosition.getOffset();
|
||||
}
|
||||
if (offset > 0) {
|
||||
if (offset >= 0) {
|
||||
return offset;
|
||||
} else {
|
||||
return null;
|
||||
return 1F;
|
||||
// return Math.abs(offset);
|
||||
// return null;
|
||||
}
|
||||
} else {
|
||||
Float distance = recursiveCalculate(startPosition.getSection(), endPosition.getSection(), right, (byte) 51);
|
||||
|
Loading…
Reference in New Issue
Block a user