修改列车升级逻辑
This commit is contained in:
parent
7a3bea2fee
commit
0cbac09abb
@ -80,6 +80,13 @@ public class Responder extends MapNamedElement {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 是否是可定位的信标
|
||||
*/
|
||||
public boolean isLocalizable() {
|
||||
return this.isVB() || this.isFB();
|
||||
}
|
||||
|
||||
public void exchangeData(VirtualRealityTrain train) {
|
||||
train.viaResponder(this);
|
||||
}
|
||||
|
@ -396,6 +396,11 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
*/
|
||||
private float controlLeaver;
|
||||
|
||||
/**
|
||||
* 有定位
|
||||
*/
|
||||
private boolean positioned = true;
|
||||
|
||||
public void setRunType(RunType runType) {
|
||||
this.runType = runType;
|
||||
switch (runType) {
|
||||
@ -494,6 +499,8 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
this.runType = null;
|
||||
this.orderStop = false;
|
||||
this.needDepartureCommand = false;
|
||||
this.controlLeaver = 0;
|
||||
this.positioned = true;
|
||||
this.fault = null;
|
||||
}
|
||||
|
||||
@ -705,9 +712,12 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
// this.setSignalEB(false);
|
||||
this.setAtoOn(false);
|
||||
this.setDriveMode(DriveMode.RM);
|
||||
if (RunLevel.CBTC.equals(this.runLevel)) {
|
||||
this.setCbtcMaMiss();
|
||||
}
|
||||
this.positioned = false; //定位丢失
|
||||
this.setCbtcMaMiss(); //通信断开
|
||||
this.lastTwoPassedResponders.clear();
|
||||
// if (RunLevel.CBTC.equals(this.runLevel)) {
|
||||
// this.setCbtcMaMiss();
|
||||
// }
|
||||
}
|
||||
|
||||
public void useCMMode() {
|
||||
@ -1083,6 +1093,9 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
|
||||
}
|
||||
lastTwoPassedResponders.remove(responder);
|
||||
lastTwoPassedResponders.offer(responder);
|
||||
if (lastTwoPassedResponders.stream().allMatch(Responder::isLocalizable)) {
|
||||
this.positioned = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void clearResponders() {
|
||||
|
@ -12,7 +12,6 @@ import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
|
||||
import club.joylink.rtss.simulation.cbtc.data.support.TrainStopMessage;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.StandParkedTrainActivity;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
|
||||
import club.joylink.rtss.simulation.cbtc.event.SimulationATPAutoCancelEBEvent;
|
||||
import club.joylink.rtss.simulation.cbtc.event.SimulationTrainIsAbout2ArriveEvent;
|
||||
import club.joylink.rtss.simulation.cbtc.member.SimulationMember;
|
||||
import club.joylink.rtss.simulation.cbtc.onboard.ATO.service.ATOService;
|
||||
@ -68,45 +67,28 @@ public class ATPLogicLoop {
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查ma接收情况并改变列车运行级别
|
||||
* 列车运行级别控制
|
||||
*/
|
||||
private void maCheckAndChangeRunLevel(Simulation simulation, VirtualRealityTrain train) {
|
||||
private void runLevelControl(Simulation simulation, VirtualRealityTrain train) {
|
||||
RunLevel defaultRunLevel = simulation.getRepository().getConfig().getRunMode();
|
||||
if (train.isCbtcMaMiss()) { //cbtc级别ma丢失
|
||||
if (train.isCBTC()) { //并且列车处于CBTC级别
|
||||
//更新移动授权丢失时长
|
||||
train.setCbtcMaMissDuration(train.getCbtcMaMissDuration() + SimulationConstants.ATP_LOOP_RATE);
|
||||
train.setItcMaMissDuration(train.getItcMaMissDuration() + SimulationConstants.ATP_LOOP_RATE);
|
||||
//判断并控制运行级别
|
||||
if (!train.isPositioned()) { //列车定位丢失(降级)
|
||||
if (train.isITC() || train.isCBTC()) { //并且是ITC/CBTC级别
|
||||
train.setRunLevel(RunLevel.IL);
|
||||
atpService.triggerSignalEB(train);
|
||||
train.setMa(null);
|
||||
}
|
||||
} else {
|
||||
train.setCbtcMaMissDuration(train.getCbtcMaMissDuration() + SimulationConstants.ATP_LOOP_RATE);
|
||||
if (train.isITC() && defaultRunLevel.equals(RunLevel.CBTC)) { //如果列车是ITC,同时线路默认级别是CBTC
|
||||
} else { //(升级)
|
||||
if (!train.isCbtcMaMiss() && defaultRunLevel.equals(RunLevel.CBTC)) {
|
||||
train.setCBTCMode();
|
||||
} else if (!train.isItcMaMiss()) {
|
||||
train.setITCMode();
|
||||
}
|
||||
}
|
||||
if (!train.isItcMaMiss()) {
|
||||
train.setItcMaMissDuration(train.getItcMaMissDuration() + SimulationConstants.ATP_LOOP_RATE);
|
||||
if (!simulation.getRepository().hasResponder()) {
|
||||
if (RunLevel.IL.equals(train.getRunLevel())) { //如果列车是IL级别
|
||||
train.setITCMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (!simulation.getRepository().hasResponder()) {
|
||||
// //无应答器
|
||||
// if (!train.isCbtcMaMiss()) {
|
||||
// if (!train.isCBTC() && defaultRunLevel.equals(RunLevel.CBTC)) { //如果列车不是CBTC,同时线路默认级别是CBTC
|
||||
// train.setCBTCMode();
|
||||
// }
|
||||
// train.setCbtcMaMissDuration(train.getCbtcMaMissDuration() + SimulationConstants.ATP_LOOP_RATE);
|
||||
// }
|
||||
// if (!train.isItcMaMiss()) { //itc级别ma未丢失
|
||||
// if (RunLevel.IL.equals(train.getRunLevel())) { //如果列车是IL级别
|
||||
// train.setITCMode();
|
||||
// }
|
||||
// train.setItcMaMissDuration(train.getItcMaMissDuration() + SimulationConstants.ATP_LOOP_RATE);
|
||||
// }
|
||||
// }
|
||||
//(或许升级降级逻辑可以放在移动授权更新和定位状态设置的地方,就不需要循环判断了)
|
||||
}
|
||||
|
||||
private void driveLogicRun(Simulation simulation, VirtualRealityTrain train) {
|
||||
@ -122,7 +104,7 @@ public class ATPLogicLoop {
|
||||
}
|
||||
|
||||
private void onboardLogicRun2(Simulation simulation, VirtualRealityTrain train) {
|
||||
this.maCheckAndChangeRunLevel(simulation, train);
|
||||
this.runLevelControl(simulation, train);
|
||||
|
||||
boolean right = train.isRight();
|
||||
SectionPosition headPosition = train.getHeadPosition();
|
||||
|
Loading…
Reference in New Issue
Block a user