Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
e94772cff0
@ -183,7 +183,7 @@ public class TrainHmiDisplay {
|
||||
/**
|
||||
* 确认信息
|
||||
*/
|
||||
private VirtualRealityTrain.ConfirmationMessage confirmationMessage;
|
||||
private VirtualRealityTrain.ConfirmationMessage message;
|
||||
|
||||
/**
|
||||
* ATO可以启动
|
||||
@ -193,7 +193,9 @@ public class TrainHmiDisplay {
|
||||
/**
|
||||
* 列车停站站台
|
||||
*/
|
||||
private String parkingStandCode;
|
||||
private String standCode;
|
||||
|
||||
private VirtualRealityTrain.Handwheel gear;
|
||||
|
||||
public TrainHmiDisplay(VirtualRealityTrain train) {
|
||||
this.code = train.getCode();
|
||||
@ -252,9 +254,10 @@ public class TrainHmiDisplay {
|
||||
this.forcePercent = getForcePercent(train);
|
||||
this.doorMode = train.getDoorMode().toString();
|
||||
this.doorSelection = train.getDoorSelection().toString();
|
||||
this.confirmationMessage = train.findFirstMessage();
|
||||
this.message = train.findFirstMessage();
|
||||
this.atoCanOpen = train.isAtoCanOpen();
|
||||
this.parkingStandCode = train.queryParkingStandCode();
|
||||
this.standCode = train.queryParkingStandCode();
|
||||
this.gear = train.getGear();
|
||||
}
|
||||
|
||||
private int getForcePercent(VirtualRealityTrain train) {
|
||||
@ -443,18 +446,25 @@ public class TrainHmiDisplay {
|
||||
map.put("doorSelection", this.doorSelection);
|
||||
}
|
||||
VirtualRealityTrain.ConfirmationMessage message = train.findFirstMessage();
|
||||
if (!Objects.equals(this.confirmationMessage, message)) {
|
||||
this.confirmationMessage = message;
|
||||
map.put("message", this.confirmationMessage);
|
||||
if (!Objects.equals(this.message, message)) {
|
||||
this.message = message;
|
||||
map.put("message", this.message);
|
||||
}
|
||||
boolean atoCanOpen = train.isAtoCanOpen();
|
||||
if (!Objects.equals(this.atoCanOpen, atoCanOpen)) {
|
||||
this.atoCanOpen = atoCanOpen;
|
||||
map.put("atoCanOpen", this.atoCanOpen);
|
||||
}
|
||||
VirtualRealityTrain.Handwheel gear = train.getGear();
|
||||
if (!Objects.equals(this.gear, gear)) {
|
||||
this.gear = gear;
|
||||
map.put("gear", this.gear);
|
||||
}
|
||||
String standCode = train.queryParkingStandCode();
|
||||
this.parkingStandCode = standCode;
|
||||
map.put("standCode", standCode);
|
||||
if (!Objects.equals(this.standCode, standCode)) {
|
||||
this.standCode = standCode;
|
||||
map.put("standCode", this.standCode);
|
||||
}
|
||||
if (map.size() > 0) {
|
||||
map.put("code", this.code);
|
||||
return map;
|
||||
|
@ -228,7 +228,7 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
private Handwheel gear;
|
||||
|
||||
/**
|
||||
* 实际运行速度
|
||||
* 实际运行速度(m/s)
|
||||
*/
|
||||
private float speed;
|
||||
|
||||
@ -1051,7 +1051,14 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isInNeutral() {
|
||||
public boolean isInATOGear() {
|
||||
return Handwheel.ATO.equals(this.gear);
|
||||
}
|
||||
|
||||
/**
|
||||
* 在空挡?
|
||||
*/
|
||||
public boolean isInNeutralGear() {
|
||||
return gear == null || Handwheel.WASH.equals(gear) || Handwheel.DISCONNECT.equals(gear);
|
||||
}
|
||||
|
||||
@ -1110,6 +1117,13 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 需要释放速度
|
||||
*/
|
||||
public boolean needReleaseSpeed() {
|
||||
return getAtoSpeed() * 3.6 < 20;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class Door extends ControllableVrDevice<Door.Operation> {
|
||||
|
@ -78,7 +78,7 @@ public class VRTrainRunningService {
|
||||
if (VirtualRealityTrain.Handwheel.REVERSE.equals(train.getGear())) { // 倒车挡
|
||||
currentSpeed = Math.min(train.getReverseSpeedMax(), currentSpeed);
|
||||
s = -((currentSpeed+originSpeed) * time / 2);
|
||||
} else if (train.isInNeutral()) { // 空挡
|
||||
} else if (train.isInNeutralGear()) { // 空挡
|
||||
currentSpeed = 0;
|
||||
s = 0;
|
||||
} else {
|
||||
|
@ -64,6 +64,7 @@ public class ATOService {
|
||||
return;
|
||||
if (train.isReleased()) { // 列车释放,以低速行驶
|
||||
SpeedCurve.SpeedCalculator limitSpeedCalculator = SpeedCurve.getLimitSpeedCalculator(SpeedCurve.Release_Limit_Speed);
|
||||
train.setAtoSpeed(limitSpeedCalculator.getVt());
|
||||
this.doControlBySpeedCalculator(train, limitSpeedCalculator, limitSpeedCalculator.getVt());
|
||||
return;
|
||||
}
|
||||
|
@ -91,40 +91,26 @@ public class ATPLogicLoop {
|
||||
}
|
||||
|
||||
private void driveLogicRun(Simulation simulation, VirtualRealityTrain train) {
|
||||
if (train.isReleased()) {
|
||||
if (!simulation.getRepository().hasResponder()) { // 没有应答器
|
||||
// 列车处于释放中,如果列车车头已经跨过信号机还没有更新ITC-MA,触发EB
|
||||
SectionPosition headPosition = train.getHeadPosition();
|
||||
SectionPosition tailPosition = train.calculateTailPosition();
|
||||
Signal signal = headPosition.getSection().getSignalOf(train.isRight());
|
||||
if (signal != null) {
|
||||
if (new SectionPosition(signal.getSection(), signal.getOffset()).isBetween(headPosition, tailPosition)) {
|
||||
this.atpService.triggerSignalEB(train);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
MaService.Ma ma2 = train.getMa2();
|
||||
// ITC级别列车停车手动释放操作判断
|
||||
if (train.isStop() && train.isITC() && train.isAtoOn() && ma2 != null && !train.isReleased()) {
|
||||
Section section = train.getHeadPosition().getSection();
|
||||
if (train.isParkingAt()) {
|
||||
if (!train.isStandReadyStart() || section.equals(train.getTarget())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 对于ITC列车,若列车在站台,且出站信号机开放,且ITC移动授权终点为出站信号机,手动进行释放操作
|
||||
boolean right = train.isRight();
|
||||
Signal signal = section.getSignalOf(right);
|
||||
if (signal != null && signal.isMainAspect() &&
|
||||
(ma2.getDevice().equals(signal) || (ma2.calculateDistanceToEoa() <= 0))) {
|
||||
// 信号机开放,前一个ITC-MA的终点就是此信号机 或 到终点的移动授权距离小于0(应该是折返轨情况)
|
||||
// 手动释放
|
||||
log.debug(String.format("ITC列车[%s]站台准备出发,手动释放速度", train.getGroupNumber()));
|
||||
atpService.confirmMessage(train, VirtualRealityTrain.ConfirmationMessage.Confirm_Release_Speed);
|
||||
}
|
||||
}
|
||||
// MaService.Ma ma2 = train.getMa2();
|
||||
// // ITC级别列车停车手动释放操作判断
|
||||
// if (train.isStop() && train.isITC() && train.isAtoOn() && ma2 != null && !train.isReleased()) {
|
||||
// Section section = train.getHeadPosition().getSection();
|
||||
// if (train.isParkingAt()) {
|
||||
// if (!train.isStandReadyStart() || section.equals(train.getTarget())) {
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// // 对于ITC列车,若列车在站台,且出站信号机开放,且ITC移动授权终点为出站信号机,手动进行释放操作
|
||||
// boolean right = train.isRight();
|
||||
// Signal signal = section.getSignalOf(right);
|
||||
// if (signal != null && signal.isMainAspect() &&
|
||||
// (ma2.getDevice().equals(signal) || (ma2.calculateDistanceToEoa() <= 0))) {
|
||||
// // 信号机开放,前一个ITC-MA的终点就是此信号机 或 到终点的移动授权距离小于0(应该是折返轨情况)
|
||||
// // 手动释放
|
||||
// log.debug(String.format("ITC列车[%s]站台准备出发,手动释放速度", train.getGroupNumber()));
|
||||
//// atpService.confirmMessage(train, VirtualRealityTrain.ConfirmationMessage.Confirm_Release_Speed);
|
||||
// }
|
||||
// }
|
||||
if (train.isChangeEnds() && train.isStop()) {
|
||||
// 列车换端中
|
||||
this.atpService.changeEndsProgress(train);
|
||||
@ -139,7 +125,9 @@ public class ATPLogicLoop {
|
||||
private void onboardLogicRun2(Simulation simulation, VirtualRealityTrain train) {
|
||||
this.handlePreselectionMode(simulation, train);
|
||||
this.calculateSpeedCurve(simulation, train);
|
||||
this.closeATOIfStatusIsIncorrect(train);
|
||||
train.setAtoCanOpen(atpService.canOpenATO(train));
|
||||
this.checkSpeedRelease(train);
|
||||
|
||||
boolean right = train.isRight();
|
||||
SectionPosition headPosition = train.getHeadPosition();
|
||||
@ -187,6 +175,7 @@ public class ATPLogicLoop {
|
||||
// this.checkTrainJumpAndSend2Ats(simulation, train, headPosition, tailPosition, right);
|
||||
if (train.isAtpOn()) {
|
||||
this.atpService.speedProtect(simulation, train);
|
||||
speedReleaseProtect(simulation, train);
|
||||
}
|
||||
if (train.isEB()) {
|
||||
return;
|
||||
@ -198,6 +187,43 @@ public class ATPLogicLoop {
|
||||
this.atoService.ato2(train);
|
||||
}
|
||||
|
||||
/**
|
||||
* 速度释放特殊防护
|
||||
*/
|
||||
private void speedReleaseProtect(Simulation simulation, VirtualRealityTrain train) {
|
||||
if (train.isEB())
|
||||
return;
|
||||
if (train.isReleased()) {
|
||||
if (!simulation.getRepository().hasResponder()) { // 没有应答器
|
||||
// 列车处于释放中,如果列车车头已经跨过信号机还没有更新ITC-MA,触发EB
|
||||
SectionPosition headPosition = train.getHeadPosition();
|
||||
SectionPosition tailPosition = train.calculateTailPosition();
|
||||
Signal signal = headPosition.getSection().getSignalOf(train.isRight());
|
||||
if (signal != null) {
|
||||
if (new SectionPosition(signal.getSection(), signal.getOffset()).isBetween(headPosition, tailPosition)) {
|
||||
this.atpService.triggerSignalEB(train);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭ATO,如果状态不正确
|
||||
*/
|
||||
private void closeATOIfStatusIsIncorrect(VirtualRealityTrain train) {
|
||||
if (train.isEB() || !train.isInATOGear() || !train.isAMMode())
|
||||
atpService.closeATO(train);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查并提示速度释放
|
||||
*/
|
||||
private void checkSpeedRelease(VirtualRealityTrain train) {
|
||||
if (!train.isReleased() && train.isITC() && train.needReleaseSpeed())
|
||||
train.addMessage(VirtualRealityTrain.ConfirmationMessage.Confirm_Release_Speed);
|
||||
}
|
||||
|
||||
private void calculateSpeedCurve(Simulation simulation, VirtualRealityTrain train) {
|
||||
if (!train.isAtpOn())
|
||||
return;
|
||||
|
@ -378,7 +378,8 @@ public class ATPService {
|
||||
return false;
|
||||
if (!train.isAtpOn()) //列车ATP未启用
|
||||
return false;
|
||||
if (train.containsMessage(VirtualRealityTrain.ConfirmationMessage.Confirm_Release_Speed))
|
||||
if (train.isITC() && !train.isReleased()
|
||||
&& train.containsMessage(VirtualRealityTrain.ConfirmationMessage.Confirm_Release_Speed) )
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
@ -33,6 +33,8 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain.ConfirmationMessage.Confirm_Release_Speed;
|
||||
|
||||
/**
|
||||
* 仿真机器人逻辑循环
|
||||
*/
|
||||
@ -102,8 +104,10 @@ public class RobotLogicLoop {
|
||||
}
|
||||
break;
|
||||
case START:
|
||||
if (!train.isAtoOn()) {
|
||||
if (train.isAtoCanOpen()) {
|
||||
atpService.openATO(train);
|
||||
} else if (train.isITC()) {
|
||||
atpService.confirmMessage(train, Confirm_Release_Speed);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import club.joylink.rtss.simulation.cbtc.data.vo.*;
|
||||
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
||||
import club.joylink.rtss.simulation.cbtc.member.SimulationUser;
|
||||
import club.joylink.rtss.simulation.cbtc.message.websocket.SimulationSubscribeTopic;
|
||||
import club.joylink.rtss.util.JsonUtils;
|
||||
import club.joylink.rtss.vo.LoginUserInfoVO;
|
||||
import club.joylink.rtss.vo.client.SocketMessageVO;
|
||||
import club.joylink.rtss.vo.client.WebSocketMessageType;
|
||||
@ -315,7 +316,7 @@ public class SocketMessageFactory {
|
||||
* @return
|
||||
*/
|
||||
public static SocketMessageVO<Object> buildHmiMessage(String group, Object display) {
|
||||
return build(WebSocketMessageType.Train_Hmi_3D, group, display);
|
||||
return build(WebSocketMessageType.Train_Hmi_3D, group, JsonUtils.writeValueNullableFieldAsString(display));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user