Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
walker-sheng 2021-09-26 17:39:22 +08:00
commit e94772cff0
8 changed files with 106 additions and 49 deletions

View File

@ -183,7 +183,7 @@ public class TrainHmiDisplay {
/** /**
* 确认信息 * 确认信息
*/ */
private VirtualRealityTrain.ConfirmationMessage confirmationMessage; private VirtualRealityTrain.ConfirmationMessage message;
/** /**
* ATO可以启动 * ATO可以启动
@ -193,7 +193,9 @@ public class TrainHmiDisplay {
/** /**
* 列车停站站台 * 列车停站站台
*/ */
private String parkingStandCode; private String standCode;
private VirtualRealityTrain.Handwheel gear;
public TrainHmiDisplay(VirtualRealityTrain train) { public TrainHmiDisplay(VirtualRealityTrain train) {
this.code = train.getCode(); this.code = train.getCode();
@ -252,9 +254,10 @@ public class TrainHmiDisplay {
this.forcePercent = getForcePercent(train); this.forcePercent = getForcePercent(train);
this.doorMode = train.getDoorMode().toString(); this.doorMode = train.getDoorMode().toString();
this.doorSelection = train.getDoorSelection().toString(); this.doorSelection = train.getDoorSelection().toString();
this.confirmationMessage = train.findFirstMessage(); this.message = train.findFirstMessage();
this.atoCanOpen = train.isAtoCanOpen(); this.atoCanOpen = train.isAtoCanOpen();
this.parkingStandCode = train.queryParkingStandCode(); this.standCode = train.queryParkingStandCode();
this.gear = train.getGear();
} }
private int getForcePercent(VirtualRealityTrain train) { private int getForcePercent(VirtualRealityTrain train) {
@ -443,18 +446,25 @@ public class TrainHmiDisplay {
map.put("doorSelection", this.doorSelection); map.put("doorSelection", this.doorSelection);
} }
VirtualRealityTrain.ConfirmationMessage message = train.findFirstMessage(); VirtualRealityTrain.ConfirmationMessage message = train.findFirstMessage();
if (!Objects.equals(this.confirmationMessage, message)) { if (!Objects.equals(this.message, message)) {
this.confirmationMessage = message; this.message = message;
map.put("message", this.confirmationMessage); map.put("message", this.message);
} }
boolean atoCanOpen = train.isAtoCanOpen(); boolean atoCanOpen = train.isAtoCanOpen();
if (!Objects.equals(this.atoCanOpen, atoCanOpen)) { if (!Objects.equals(this.atoCanOpen, atoCanOpen)) {
this.atoCanOpen = atoCanOpen; this.atoCanOpen = atoCanOpen;
map.put("atoCanOpen", this.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(); String standCode = train.queryParkingStandCode();
this.parkingStandCode = standCode; if (!Objects.equals(this.standCode, standCode)) {
map.put("standCode", standCode); this.standCode = standCode;
map.put("standCode", this.standCode);
}
if (map.size() > 0) { if (map.size() > 0) {
map.put("code", this.code); map.put("code", this.code);
return map; return map;

View File

@ -228,7 +228,7 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
private Handwheel gear; private Handwheel gear;
/** /**
* 实际运行速度 * 实际运行速度(m/s)
*/ */
private float speed; 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); 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 @Getter
@Setter @Setter
public static class Door extends ControllableVrDevice<Door.Operation> { public static class Door extends ControllableVrDevice<Door.Operation> {

View File

@ -78,7 +78,7 @@ public class VRTrainRunningService {
if (VirtualRealityTrain.Handwheel.REVERSE.equals(train.getGear())) { // 倒车挡 if (VirtualRealityTrain.Handwheel.REVERSE.equals(train.getGear())) { // 倒车挡
currentSpeed = Math.min(train.getReverseSpeedMax(), currentSpeed); currentSpeed = Math.min(train.getReverseSpeedMax(), currentSpeed);
s = -((currentSpeed+originSpeed) * time / 2); s = -((currentSpeed+originSpeed) * time / 2);
} else if (train.isInNeutral()) { // 空挡 } else if (train.isInNeutralGear()) { // 空挡
currentSpeed = 0; currentSpeed = 0;
s = 0; s = 0;
} else { } else {

View File

@ -64,6 +64,7 @@ public class ATOService {
return; return;
if (train.isReleased()) { // 列车释放以低速行驶 if (train.isReleased()) { // 列车释放以低速行驶
SpeedCurve.SpeedCalculator limitSpeedCalculator = SpeedCurve.getLimitSpeedCalculator(SpeedCurve.Release_Limit_Speed); SpeedCurve.SpeedCalculator limitSpeedCalculator = SpeedCurve.getLimitSpeedCalculator(SpeedCurve.Release_Limit_Speed);
train.setAtoSpeed(limitSpeedCalculator.getVt());
this.doControlBySpeedCalculator(train, limitSpeedCalculator, limitSpeedCalculator.getVt()); this.doControlBySpeedCalculator(train, limitSpeedCalculator, limitSpeedCalculator.getVt());
return; return;
} }

View File

@ -91,40 +91,26 @@ public class ATPLogicLoop {
} }
private void driveLogicRun(Simulation simulation, VirtualRealityTrain train) { private void driveLogicRun(Simulation simulation, VirtualRealityTrain train) {
if (train.isReleased()) { // MaService.Ma ma2 = train.getMa2();
if (!simulation.getRepository().hasResponder()) { // 没有应答器 // // ITC级别列车停车手动释放操作判断
// 列车处于释放中如果列车车头已经跨过信号机还没有更新ITC-MA触发EB // if (train.isStop() && train.isITC() && train.isAtoOn() && ma2 != null && !train.isReleased()) {
SectionPosition headPosition = train.getHeadPosition(); // Section section = train.getHeadPosition().getSection();
SectionPosition tailPosition = train.calculateTailPosition(); // if (train.isParkingAt()) {
Signal signal = headPosition.getSection().getSignalOf(train.isRight()); // if (!train.isStandReadyStart() || section.equals(train.getTarget())) {
if (signal != null) { // return;
if (new SectionPosition(signal.getSection(), signal.getOffset()).isBetween(headPosition, tailPosition)) { // }
this.atpService.triggerSignalEB(train); // }
} // // 对于ITC列车若列车在站台且出站信号机开放且ITC移动授权终点为出站信号机手动进行释放操作
} // boolean right = train.isRight();
} // Signal signal = section.getSignalOf(right);
return; // if (signal != null && signal.isMainAspect() &&
} // (ma2.getDevice().equals(signal) || (ma2.calculateDistanceToEoa() <= 0))) {
MaService.Ma ma2 = train.getMa2(); // // 信号机开放前一个ITC-MA的终点就是此信号机 到终点的移动授权距离小于0应该是折返轨情况
// ITC级别列车停车手动释放操作判断 // // 手动释放
if (train.isStop() && train.isITC() && train.isAtoOn() && ma2 != null && !train.isReleased()) { // log.debug(String.format("ITC列车[%s]站台准备出发,手动释放速度", train.getGroupNumber()));
Section section = train.getHeadPosition().getSection(); //// atpService.confirmMessage(train, VirtualRealityTrain.ConfirmationMessage.Confirm_Release_Speed);
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()) { if (train.isChangeEnds() && train.isStop()) {
// 列车换端中 // 列车换端中
this.atpService.changeEndsProgress(train); this.atpService.changeEndsProgress(train);
@ -139,7 +125,9 @@ public class ATPLogicLoop {
private void onboardLogicRun2(Simulation simulation, VirtualRealityTrain train) { private void onboardLogicRun2(Simulation simulation, VirtualRealityTrain train) {
this.handlePreselectionMode(simulation, train); this.handlePreselectionMode(simulation, train);
this.calculateSpeedCurve(simulation, train); this.calculateSpeedCurve(simulation, train);
this.closeATOIfStatusIsIncorrect(train);
train.setAtoCanOpen(atpService.canOpenATO(train)); train.setAtoCanOpen(atpService.canOpenATO(train));
this.checkSpeedRelease(train);
boolean right = train.isRight(); boolean right = train.isRight();
SectionPosition headPosition = train.getHeadPosition(); SectionPosition headPosition = train.getHeadPosition();
@ -187,6 +175,7 @@ public class ATPLogicLoop {
// this.checkTrainJumpAndSend2Ats(simulation, train, headPosition, tailPosition, right); // this.checkTrainJumpAndSend2Ats(simulation, train, headPosition, tailPosition, right);
if (train.isAtpOn()) { if (train.isAtpOn()) {
this.atpService.speedProtect(simulation, train); this.atpService.speedProtect(simulation, train);
speedReleaseProtect(simulation, train);
} }
if (train.isEB()) { if (train.isEB()) {
return; return;
@ -198,6 +187,43 @@ public class ATPLogicLoop {
this.atoService.ato2(train); 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) { private void calculateSpeedCurve(Simulation simulation, VirtualRealityTrain train) {
if (!train.isAtpOn()) if (!train.isAtpOn())
return; return;

View File

@ -378,7 +378,8 @@ public class ATPService {
return false; return false;
if (!train.isAtpOn()) //列车ATP未启用 if (!train.isAtpOn()) //列车ATP未启用
return false; 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 false;
return true; return true;
} }

View File

@ -33,6 +33,8 @@ import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors; 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; break;
case START: case START:
if (!train.isAtoOn()) { if (train.isAtoCanOpen()) {
atpService.openATO(train); atpService.openATO(train);
} else if (train.isITC()) {
atpService.confirmMessage(train, Confirm_Release_Speed);
} }
break; break;
} }

View File

@ -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.SimulationMember;
import club.joylink.rtss.simulation.cbtc.member.SimulationUser; import club.joylink.rtss.simulation.cbtc.member.SimulationUser;
import club.joylink.rtss.simulation.cbtc.message.websocket.SimulationSubscribeTopic; 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.LoginUserInfoVO;
import club.joylink.rtss.vo.client.SocketMessageVO; import club.joylink.rtss.vo.client.SocketMessageVO;
import club.joylink.rtss.vo.client.WebSocketMessageType; import club.joylink.rtss.vo.client.WebSocketMessageType;
@ -315,7 +316,7 @@ public class SocketMessageFactory {
* @return * @return
*/ */
public static SocketMessageVO<Object> buildHmiMessage(String group, Object display) { 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));
} }
/** /**