Merge branch 'test' of https://git.code.tencent.com/lian-cbtc/rtss-server into test1
This commit is contained in:
commit
d491b56ef3
@ -70,9 +70,14 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
|||||||
private float mass = 230;
|
private float mass = 230;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列车物理最大速度
|
* 列车前进最大速度
|
||||||
*/
|
*/
|
||||||
private float speedMax = (float) (120 / 3.6);
|
private float speedMax = (float) (100 / 3.6);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列车倒车最大速度
|
||||||
|
*/
|
||||||
|
private float reverseSpeedMax = (float) (36 / 3.6);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列车ATP防护速度
|
* 列车ATP防护速度
|
||||||
|
@ -50,21 +50,27 @@ public class VRTrainRunningService {
|
|||||||
float currentSpeed = originSpeed + increment;
|
float currentSpeed = originSpeed + increment;
|
||||||
if (currentSpeed < 0) {
|
if (currentSpeed < 0) {
|
||||||
currentSpeed = 0;
|
currentSpeed = 0;
|
||||||
} else if (currentSpeed > train.getSpeedMax()) {
|
|
||||||
currentSpeed = train.getSpeedMax();
|
|
||||||
}
|
}
|
||||||
|
// else if (currentSpeed > train.getSpeedMax()) {
|
||||||
|
// currentSpeed = train.getSpeedMax();
|
||||||
|
// }
|
||||||
// 更新列车速度
|
// 更新列车速度
|
||||||
train.setSpeed(currentSpeed);
|
|
||||||
|
|
||||||
// System.out.println(String.format("当前车速:[%s]", currentSpeed));
|
// System.out.println(String.format("当前车速:[%s]", currentSpeed));
|
||||||
// 根据速度计算并更新列车所在区段位置
|
// 根据速度计算并更新列车所在区段位置
|
||||||
// float s = (float) (currentSpeed * time - acceleration * Math.pow(time, 2) / 2);
|
// float s = (float) (currentSpeed * time - acceleration * Math.pow(time, 2) / 2);
|
||||||
float s = (currentSpeed+originSpeed) * time / 2;
|
float s;
|
||||||
if (ControlGear.Reverse.equals(train.getGear())) { // 倒车挡
|
if (ControlGear.Reverse.equals(train.getGear())) { // 倒车挡
|
||||||
s = -s;
|
currentSpeed = Math.min(train.getReverseSpeedMax(), currentSpeed);
|
||||||
|
s = -((currentSpeed+originSpeed) * time / 2);
|
||||||
} else if (ControlGear.Neutral.equals(train.getGear())) { // 空挡
|
} else if (ControlGear.Neutral.equals(train.getGear())) { // 空挡
|
||||||
|
currentSpeed = 0;
|
||||||
s = 0;
|
s = 0;
|
||||||
|
} else {
|
||||||
|
currentSpeed = Math.min(train.getSpeedMax(), currentSpeed);
|
||||||
|
s = (currentSpeed + originSpeed) * time / 2;
|
||||||
}
|
}
|
||||||
|
train.setSpeed(currentSpeed); //更新列车速度
|
||||||
if (s == 0) {
|
if (s == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user